New Discussion

Notifications

You’re not receiving notifications from this thread.

Creating New Blog Posts Discussion

1
General

Hi!
I don't understand why we must instantiate a BlogPost object in the new function, if we are also doing so in the create function.
It is also not clear to me how did we map the <%= form.button %> in new.html.erb to the blog_posts#create action.

Thank you for the guides!

Why instantiate in new and create? For me, new often handles basic object setup, while create adds persistence logic. For example, new sets default values, and create saves the completed object to a database.
Has anyone else found this a useful pattern?

Join the discussion
Create an account Log in