Monday, July 30, 2012

[Rails] ActiveRecord::Reflection active_record read-only method

I was horsing around with the reflect_on_assocation class method of
ActiveRecord Reflection, which returns an instance of
AssociationReflection. One of its methods is called active_record. I
run it in console:

Account.reflect_on_association(:users).active_record
=> Account(id: integer, name: string, created_at: datetime,
updated_at: datetime, ancestry: string, street_address: string, city:
string, postal_code: string, state: string, country: string,
street_address2: string, account_type_id: integer, client_logo:
string, subdomain: string, email: string, phone: string)

What it returns is not the Account object.

According to documentation, it "Returns the value of attribute
active_record".


http://rubydoc.info/docs/rails/3.0.0/ActiveRecord/Reflection/MacroReflection#active_record-instance_method


Well, that's not too informative...

thanks for response

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate