Groups
Sign in
Groups
Ruby on Rails: Talk
Conversations
About
Send feedback
Help
[Rails] What is the difference between new and build?
225 views
Skip to first unread message
Manoj Kumar
unread,
Apr 23, 2010, 3:38:02 AM
4/23/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
What is the difference between
parent.children << child.new
and
parent.children.build(params[:child])
--
Posted via
http://www.ruby-forum.com/
.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonra...@googlegroups.com
.
To unsubscribe from this group, send email to
rubyonrails-ta...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
.
Sharagoz
unread,
Apr 23, 2010, 4:40:02 AM
4/23/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
In the first one, the child is saved right away.
In the second, the child is not saved until the parent is saved
You may find this usefull:
http://blog.mrbrdo.net/2009/10/27/ruby-on-rails-new-vs-create-vs-build/
On Apr 23, 9:38 am, Manoj Kumar <
li...@ruby-forum.com
> wrote:
> What is the difference between
>
> parent.children << child.new
>
> and
>
> parent.children.build(params[:child])
> --
> Posted viahttp://
www.ruby-forum.com/
.
Manoj Kumar
unread,
Apr 26, 2010, 12:18:04 AM
4/26/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Sharagoz wrote:
> In the first one, the child is saved right away.
> In the second, the child is not saved until the parent is saved
>
> You may find this usefull:
>
http://blog.mrbrdo.net/2009/10/27/ruby-on-rails-new-vs-create-vs-build/
Thanks Sharagoz. I got some idea about this.
--
Posted via
http://www.ruby-forum.com/
.
Francesco Mari
unread,
Feb 13, 2018, 4:57:36 AM
2/13/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
Actually if the parent is not persisted, the shovel operator does not save data on db.
Reply all
Reply to author
Forward
0 new messages