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

The post path for the create method in posts controller only passed when an 's' was added to the end of 'post' #8

Closed
samsonyuwono opened this issue Jul 18, 2017 · 1 comment
Labels

Comments

@samsonyuwono
Copy link

Below is what you have for this readme and wont pass unless post_path is changed to posts_path

def create
@post = Post.new
@post.title = params[:title]
@post.description = params[:description]
@post.save
redirect_to post_path(@post)
end

@gj
Copy link
Contributor

gj commented Jul 19, 2017

Hi @samsonyuwono !

posts_path and post_path are helpers for different routes. The relevant section from README.md:

In this refactored create action, we're following the convention of redirecting to the new resource's show page. It stands to reason that a user who submits a new post would then like to view the successfully-created post. With that being said, the page flow is not set in stone, and we could've redirected the create action to the index action just as easily.

@gj gj closed this as completed Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
@gj @samsonyuwono and others