Re: [Rails] objects in the create method

12 views
Skip to first unread message

Colin Law

unread,
Nov 27, 2015, 3:41:45 AM11/27/15
to Ruby on Rails: Talk
On 27 November 2015 at 05:53, fugee ohu <fuge...@gmail.com> wrote:
> I'm trying to follow this example in my controller: science =
> Category.create!(:name => 'Science')
> but most create actions look like @science=Category.new(science_params)
> do I need the object to be an array beginning with @

I think this is covered by
https://www.railstutorial.org/book/rails_flavored_ruby#sec-a_user_class
in the rails tutorial.

You really would save yourself a lot of time if you took two days out
and worked right through it, doing all the exercises and so on.

Colin
Reply all
Reply to author
Forward
0 new messages