S Ahmed
2014-May-08 15:03 UTC
creating a model form inside another model, how to pass 'this'?
I am inside a model, and need to create another model, how to I pass
'this'
as a parameter?
Example:
class User < AR
has_one :company
def create_associations!
@company = Company.build_with_user(this)
end
end
So I'm trying to create the company association using a method from the
Company model, and pass it a User parameter.
How do I pass 'this' in ruby?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/CAG2rwuMqR8zHc7itBQLmrMhCZc%3D2Dpy%3DhLD7D-7_6b2p0ns2gw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.