Hello,
I am using accepts_nested_attributes_for for saving the records.
let say I have a model
class User < AR::Base
has_many :books
accepts_nested_attributes_for :books
end
class Book < AR::Base
belongs_to :user
end
Now the params value I am getting is
user={:id => 123, books_attributes={:name => "test"}}
and in my books controller
def create
user = @user.update_attributes(params[:user])
@book = ????
end
Every thing is working as expected but my requirement is that the book which
is saved I need to know the ID.
How do I find the books ID.
*Thanks
Abhis
*
--
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.