Here is a separate example:

class Group < ActiveRecord::Base
  belongs_to :project
  has_one :organization, through: :project
  has_many :group_users
  has_many :users, through: :group_users

has_many :active_memberships, through: :organization  # WHAT I  NEED TO DO
has_many :users, through: :active_memberships             # IS SELECT USERS
FROM :active_membership  available to :group_users

end

Just wishing there was an example of how one could do this.

Thanks to :all!


On Wed, Feb 3, 2016 at 4:30 AM, Sergio Cambra <[email protected]>
wrote:

> You need to use association_klass_scoped or
> options_for_association_conditions
> in the helper to restrict which options are included in select.
>
>
> https://github.com/activescaffold/active_scaffold/wiki/Custom-Association-Options
>
> El martes, 2 de febrero de 2016 5:44:45 (CET) loveand light escribió:
> > I have  simple update to an associations called 'conditions' that
> contains
> > 2 select fields that need to be updated after the user selects which
> 'udt'
> > needed
> >
> >  In the controller I put:
> >
> >       config.columns[:udt].update_columns = :conditions # enables the
> > "magic"
> >       config.columns[:udt].send_form_on_update_column = true
> >
> >
> > this looks to do the right thing... but now I need to set the
> corresponding
> > association array into the current record object. Instead of the entire
> > project, I want to display ONLY the ones that are in this assoc which I
> can
> > get from the 'record' object passed into the
> >
> > class AdvancedSearch < ActiveRecord::Base
> >   has_many :conditions, class_name: 'AdvancedSearchCondition'
> >   belongs_to :udt # udt to search
> > end
> >
> >   protected
> >     def after_render_field(record, column)
> >       if column.name == :udt
> >        record.udt.udt_fields'
> >       end
> >     end
> >
> >
> > This is an advanced search object so I just want to select the fields
> that
> > are in the associaiton: 'udt'...
> >
> > => #<AdvancedSearch:0x007fdeab199970
> >  id: nil,
> >  project_id: 1,
> >  name: nil,
> >  description: nil,
> >  user_id: nil,
> >  udt_id: 3,
> >  created_at: nil,
> >  updated_at: nil>
> >
> > so 'record.udt.udt_fields' gets the the fields I need but now I need to
> > update  the select to show only these fields.
> >
> > This seems pretty trial but I am have a time trying to get to work..
> >
> > Does anyone have any knowledge as to how to do something like this?
> >
> > Thanks!
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to