On Mon, Dec 17, 2012 at 10:15 PM, Avi
<aavinash.behera-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hello All,
>
> I have two tables:
> user has_many room
> room belongs_to user
>
> When a new user is created, I want to save the room through some default
> values at the same time.
> How to do this by using callbacks?
>
> after_save or after_create ?
> & I want to use blocks with callbacks.
>
I''m assuming that a room is unique to a user and you want to create a
room
everytime a user is created
so you need to use the after_create callback. as for using the syntax to
use blocks in a callback, you can
look at http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html
>
> Any suggestions??
>
>
> Thanks,
> Avi
>
> --
> 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
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/UrFJjpp9RX4J.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.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
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 https://groups.google.com/groups/opt_out.