I'm using the 2.3 branch. Interesting, the problem is not limited to
record_select.

Even trying with :select does not work for me.

On Nov 16, 10:30 am, "Sergio Cambra .:: entreCables S.L. ::."
<[email protected]> wrote:
> On Martes, 16 de Noviembre de 2010 13:50:41 Jack Miller escribió:
>
>
>
>
>
> > If I change the config columns in my categories controller from
> > categorizations to products -
>
> > class CategoriesController < BaseController
> >   active_scaffold :category do |config|
> >     config.columns.exclude :created_at, :updated_at
> >     config.columns = [:name,
>
> >                       :products]
>
> >     config.columns[:products].form_ui = :record_select
> >   end
> > end
>
> > Then when I submit any changes, nothing is updated and no errors are
> > thrown. I end up in the same situation as mentioned by PK here:
>
> It's working here with both :select and :record_select form_ui, at least in
> master branch.
>
>
>
>
>
>
>
> >http://groups.google.com/group/activescaffold/browse_thread/thread/24...
> > af16c8a4?hl=en
>
> > On Nov 16, 3:25 am, "Sergio Cambra .:: entreCables S.L. ::."
>
> > <[email protected]> wrote:
> > > On Martes, 16 de Noviembre de 2010 04:12:12 Jack Miller escribió:
> > > > I have 2 models Product and Categories associated with each other via
> > > > a third model Categorization by using a has_many through. I'm trying
> > > > to use record_select  along with activescaffold to display the
> > > > products associated with a category. To do so, I'm using the model as
> > > > product (instead of categorizations) for the record_select in the
> > > > CategorizationsController.
>
> > > > However, when I choose a product from the record_select and submit the
> > > > form, it tries to match the id of the product selected to an id in the
> > > > categorizations table, rather than the products table. I know this is
> > > > not totally an activescaffold issue, but hopefully some of you might
> > > > have found a way to correctly use AS with record_select with has_many
> > > > through.
>
> > > Have you tried to set record select in products association instead of
> > > categorizations? I'm not sure whether I have tried it, but at least
> > > select form_ui should work, so I think record select should work too.
>
> > > > How do I fix this? What parameters should I set on the record_select?
>
> > > > My models and controllers are as listed below.
>
> > > > class CategorizationsController < BaseController
> > > >   record_select :search_on => 'Product.Name', :model => :product
> > > >   active_scaffold :categorization do |config|
> > > >     config.columns.exclude :created_at, :updated_at, :audits
> > > >   end
> > > > end
>
> > > > class CategoriesController < BaseController
> > > >   active_scaffold :category do |config|
> > > >     config.columns.exclude :created_at, :updated_at
> > > >     config.columns = [:name,
>
> > > >                       :categorizations]
>
> > > >     config.columns[:categorizations].form_ui = :record_select
> > > >   end
> > > > end
>
> > > > class Product < ActiveRecord::Base
> > > >   has_many :categorizations, :dependent => :destroy
> > > >   has_many :categories, :through => :categorizations
>
> > > >   def to_label
> > > >       "#{name}"
> > > >   end
> > > > end
>
> > > > class Category < ActiveRecord::Base
> > > >   has_many :categorizations, :dependent => :destroy
> > > >   has_many :products, :through => :categorizations
>
> > > >   def to_label
> > > >       "#{name}"
> > > >   end
> > > > end
>
> > > > class Categorization < ActiveRecord::Base
> > > >   belongs_to :product
> > > >   belongs_to :category
>
> > > >   def to_label
> > > >     "#{product.to_label}-#{category.to_label}"
> > > >   end
> > > > end
>
> > > --
> > > Sergio Cambra .:: entreCables S.L. ::.
> > > Mariana Pineda 23, 50.018 Zaragoza
> > > T) 902 021 404 F) 976 52 98 07 E) [email protected]
>
> --
> Sergio Cambra .:: entreCables S.L. ::.
> Mariana Pineda 23, 50.018 Zaragoza
> T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
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.

Reply via email to