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?

self :slight_smile:

On 8 May 2014 16:03, S Ahmed [email protected] wrote:

@company = Company.build_with_user(this)

use self.build_company instead. See

Colin