Well, looks like I figured it out just after I posted. I managed to get things working using the custom association options after I figured out that there is a @record available to the helper.
On Jan 12, 9:52 am, chelsea <[email protected]> wrote: > Hi, I've been looking through the forums and documentation but haven't > found a solution that addresses my problem. I have 2 models, > companies and users. A company has many users, and a company belongs > to one owner, where the owner is also a user. > > <blockquote> > <pre> > class Company < ActiveRecord::Base > has_many :users > belongs_to :owner, :class_name => 'User', :foreign_key => 'owner_id' > end > > class User < ActiveRecord::Base > belongs_to :company > end > </pre> > </blockquote> > > On the edit view of a company I have a form_ui => :select for the > owner, however it lists all users in the DB, not just the users in > that company. I tried adding a condition into the has_many :users > statement to check that the company_id field matches the record's ID > but that was only returning the user assigned as the owner into the > select list. > > Does any one know a way to do this is ActiveScaffold? > > Thanks a lot for your help! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
