diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index 3224a0c42..dc55da674 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -1,6 +1,6 @@ class ArtistsController < ApplicationController respond_to :html, :xml, :json - before_filter :member_only, :except => [:index, :show, :banned] + before_filter :member_only, :except => [:index, :show, :show_or_new, :banned] before_filter :builder_only, :only => [:destroy] before_filter :admin_only, :only => [:ban, :unban] before_filter :load_artist, :only => [:ban, :unban, :show, :edit, :update, :destroy, :undelete] @@ -96,7 +96,9 @@ class ArtistsController < ApplicationController if @artist redirect_to artist_path(@artist) else - redirect_to new_artist_path(:name => params[:name]) + @artist = Artist.new(name: params[:name]) + @post_set = PostSets::Artist.new(@artist) + respond_with(@artist) end end diff --git a/app/views/artists/show_or_new.html.erb b/app/views/artists/show_or_new.html.erb new file mode 100644 index 000000000..221f69869 --- /dev/null +++ b/app/views/artists/show_or_new.html.erb @@ -0,0 +1,5 @@ +<%= render layout: "show" do %> +
+

This artist entry does not exist. <%= link_to "Create new artist entry", new_artist_path(name: params[:name]) %>.

+
+<% end %> diff --git a/test/functional/artists_controller_test.rb b/test/functional/artists_controller_test.rb index 362a66f0d..db3c4ec67 100644 --- a/test/functional/artists_controller_test.rb +++ b/test/functional/artists_controller_test.rb @@ -42,7 +42,7 @@ class ArtistsControllerTest < ActionController::TestCase assert_redirected_to(@masao) get :show_or_new, { name: "nobody" }, { user_id: @user.id } - assert_redirected_to(new_artist_path(name: "nobody")) + assert_response :success end should "get the edit page" do