Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show diary entry after creation #5484

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/diary_entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def create
# Subscribe user to diary comments
@diary_entry.subscriptions.create(:user => current_user)

redirect_to :action => "index", :display_name => current_user.display_name
redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
else
render :action => "new"
end
Expand Down
6 changes: 3 additions & 3 deletions test/controllers/diary_entries_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ def test_create
post diary_entries_path(:diary_entry => { :title => "New Title", :body => "This is a new body for the diary entry", :latitude => "1.1",
:longitude => "2.2", :language_code => "en" })
end
assert_redirected_to :action => :index, :display_name => user.display_name
entry = DiaryEntry.last
assert_redirected_to diary_entry_path(user, entry)
assert_equal user.id, entry.user_id
assert_equal "New Title", entry.title
assert_equal "This is a new body for the diary entry", entry.body
Expand All @@ -184,8 +184,8 @@ def test_create_german
post diary_entries_path(:diary_entry => { :title => "New Title", :body => "This is a new body for the diary entry", :latitude => "1.1",
:longitude => "2.2", :language_code => "de" })
end
assert_redirected_to :action => :index, :display_name => user.display_name
entry = DiaryEntry.last
assert_redirected_to diary_entry_path(user, entry)
assert_equal user.id, entry.user_id
assert_equal "New Title", entry.title
assert_equal "This is a new body for the diary entry", entry.body
Expand All @@ -211,8 +211,8 @@ def test_new_spammy
assert_difference "DiaryEntry.count", 1 do
post diary_entries_path(:diary_entry => { :title => spammy_title, :body => spammy_body, :language_code => "en" })
end
assert_redirected_to :action => :index, :display_name => user.display_name
entry = DiaryEntry.last
assert_redirected_to diary_entry_path(user, entry)
assert_equal user.id, entry.user_id
assert_equal spammy_title, entry.title
assert_equal spammy_body, entry.body
Expand Down
Loading