aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorMikhail Dieterle <MikDiet@gmail.com>2013-07-19 10:54:24 +0300
committerMikhail Dieterle <MikDiet@gmail.com>2013-07-19 10:54:24 +0300
commit760662de868c0311f2e40a5e6f8982a521a3d990 (patch)
tree8b20383ef5196c27dad4542ddbdbad6f30e81f38 /guides
parentbae07dcce2f6821e202e1e0b544421d6851e8ecf (diff)
downloadrails-760662de868c0311f2e40a5e6f8982a521a3d990.tar.gz
rails-760662de868c0311f2e40a5e6f8982a521a3d990.tar.bz2
rails-760662de868c0311f2e40a5e6f8982a521a3d990.zip
use strong_params in example
Diffstat (limited to 'guides')
-rw-r--r--guides/source/engines.md7
1 files changed, 6 insertions, 1 deletions
diff --git a/guides/source/engines.md b/guides/source/engines.md
index bc66ed256e..d8120fe244 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -393,10 +393,15 @@ The form will be making a `POST` request to `/posts/:post_id/comments`, which wi
```ruby
def create
@post = Post.find(params[:post_id])
- @comment = @post.comments.create(params[:comment])
+ @comment = @post.comments.create(comment_params)
flash[:notice] = "Comment has been created!"
redirect_to posts_path
end
+
+private
+def comment_params
+ params.require(:comment).permit(:text)
+end
```
This is the final part required to get the new comment form working. Displaying the comments however, is not quite right yet. If you were to create a comment right now you would see this error: