diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2013-08-10 04:29:19 -0700 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2013-08-10 04:29:19 -0700 |
commit | a3f390b569c3b7b4e51554043a2262f2bce652e9 (patch) | |
tree | c46f2af49dc6b39f788a082e6869e29ffbe6e23d /guides | |
parent | 4f5f59a492bd32afa476ac6b51ca5295b70fe246 (diff) | |
parent | 9d39577bd9509b5168f92269a0482e2fd0615093 (diff) | |
download | rails-a3f390b569c3b7b4e51554043a2262f2bce652e9.tar.gz rails-a3f390b569c3b7b4e51554043a2262f2bce652e9.tar.bz2 rails-a3f390b569c3b7b4e51554043a2262f2bce652e9.zip |
Merge pull request #11830 from cr0t/master
Fixed small mistake in the engines docs
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/engines.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/guides/source/engines.md b/guides/source/engines.md index a77be917a2..9106b6382d 100644 --- a/guides/source/engines.md +++ b/guides/source/engines.md @@ -525,6 +525,14 @@ First, the `author_name` text field needs to be added to the `app/views/blorgh/p </div> ``` +Next, we need to update our `Blorgh::PostController#post_params` method to permit the new form parameter: + +```ruby +def post_params + params.require(:post).permit(:title, :text, :author_name) +end +``` + The `Blorgh::Post` model should then have some code to convert the `author_name` field into an actual `User` object and associate it as that post's `author` before the post is saved. It will also need to have an `attr_accessor` setup for this field so that the setter and getter methods are defined for it. To do all this, you'll need to add the `attr_accessor` for `author_name`, the association for the author and the `before_save` call into `app/models/blorgh/post.rb`. The `author` association will be hard-coded to the `User` class for the time being. |