On Miércoles, 15 de Julio de 2009 19:50:35 David Cato escribió:
> Any resolution on this?
>
> From what I've been able to determine while porting an app from 2.2 to
> 2.3, it appears that the problem may be related to commit b93bda08 on
> 2 May. That change does not appear in the rails-2.2 branch and the HMT
> association works fine under 2.2 but the list view dies under 2.3.
>
> Modifying render_list_column, as follows (hopefully the patch isn't
> mangled too badly), to ignore a through reflection on the associated
> column seems to be working -- at least the list view comes up -- but I
> haven't tested it too much yet. Can anyone confirm whether this is an
> appropriate, or sufficient, fix?

Thanks, I have committed a fix for it, it's a similar fix. I don't use has_many 
:through, can you try it?

>
> --- a/lib/active_scaffold/helpers/list_column_helpers.rb
> +++ b/lib/active_scaffold/helpers/list_column_helpers.rb
> @@ -58,7 +58,7 @@ module ActiveScaffold
>        def render_list_column(text, column, record)
>          if column.link
>            link = column.link
> -          associated = record.send(column.association.name) if
> column.association
> +          associated = record.send(column.association.name) if
> column.association && !column.association.through_reflection
>            url_options = params_for(:action => nil, :id =>
> record.id, :link => text)
>            url_options[:parent_controller] = params[:controller] if
> link.controller and link.controller.to_s != params[:controller]
>            url_options[:id] = associated.id if associated and
> link.controller and link.controller.to_s != params[:controller]
>
> On Jul 2, 12:28 am, Sylvain <[email protected]> wrote:
> > Hi all,
> > I have the following model :
> >
> > Device
> > Has_many :cross_connections
> > Has_many :aspen_connections, :through=> :cross_connections
> >
> > AspenConnection
> > Has_many :cross_connections
> > has_many :devices, :through=> :cross_connections
> >
> > CrossConnection
> > belongs_to :aspen_connection
> > belongs_to :device
> >
> > In the Device view, I want to see the AspenConnection, so I add the
> > column AspenConnection to the list and I disable the eager loading:
> >
> > active_scaffold :aspen_connection do
> > [...]
> > self.list.columns = [
> >    [...]
> >
> >    :aspen_connections,
> >
> >    [...]}
> >
> > [...]
> > self.columns[:aspen_connections].includes = nil
> >
> > When I trie to see the view, I have the following error:
> > "undefined method `aspen_connection_id=' for #<Link:0x3dbfb20>"
> >
> > I have the same error with all myhasmanythroughassociations, even
> > if I let the eager loading enabled...
> >
> > Is there a bug or did I make a mistake somewhere?
> >
> > Thanks in advance,
> >
> > Sylvain
>
> 
-- 
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