Ruby on Rails
Sunday, July 12, 2015
class Asset < ActiveRecord::Base
-- belongs_to :site
# class variable :name
end
class Site < ActiveRecord::Base
has_many :assets
# class var x, y, z
end
Is there a dynamic finder that will traverse the inner join:
e.g. Site.find_by_asset_name("xyzzy")
Can I get a list of sites where asset.name == "BAZ"
Can this be done in AR or do I have to resort to SQL?
Thanks,
Joe
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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/7f72701d-cd1c-4219-b4e3-1aa5b643a895%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment