Hello!

I want to limit my model to just show companies from the current users
account:

user.account.companies

I have this in my model which seems to be working:

def self.find(*args)
    args << {:conditions => XXXXX"}
    super
end


Now I just need to turn this sql into rails conditions:


SELECT `companies`.* FROM `companies` INNER JOIN `users` ON
`companies`.user_id = `users`.id WHERE ((`users`.account_id = 1))

Can anyone help with this?

Thanks

Scott
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to