activerecord - rails 3 + active record: how do I do something like stores = Store.User_find_all_by_owner_name("Ted") -


i'm having trouble understanding how simple query combines stores owned users named "ted"

my class user has_many :stores , user.owner_name name of store owner

my class store belongs_to :user

users = user.find_all_by_owner_name("ted") pulls users named ted

but how stores owned set of users (named ted)?

i need list single record set.

i think should it

store.joins(:user).where('users.owner_name = ?', 'ted') 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -