Hi Sergio,

Thanks for the fix.  I was playing with it.  It works.  But there is
another issue with a nested scaffold inside a nested scaffold.  The example
is model A has_many model B which has_many model C.

For a nested inside a nested, I see that AS includes both parent and
grand-parent id numbers in params.  Then the system checks if the current
AS has grand-parent-id.  However the sql query should NOT include
grand-parent-id.  In our app, one table happens to have a column name
grand-parent-id.  It caused the query returns no results.

For example, network has_many subnets, subnet has_many hosts.  In network
list, click subnets column where network_id is 192.  In subnet list, click
hosts column where subnet_id is 8361, the sql query is

  SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`subnet_id` = 8361 AND
((((hosts.subnet_id = '8361')) AND (hosts.network_id = '192'))).

It should have been,

  SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`subnet_id` = 8361


So if I rename network_id in hosts table, the query becomes,  less optimal
but works though.

  SELECT `hosts`.* FROM `hosts` WHERE `hosts`.`subnet_id` = 8361 AND
((((hosts.subnet_id = '8361')))

Is there a way to fix it? It should just check the parent_scaffold's id,
not one more level up.

Thanks,

On Mon, Apr 9, 2012 at 11:32 PM, Sergio Cambra <[email protected]>wrote:

> I don't need it, I have fixed it in master branch
>
> On Martes, 10 de abril de 2012 11:19:21 Sergio Cambra escribió:
> > Post render :active_scaffold line
> >
> > On Lunes, 9 de abril de 2012 07:06:04 Richard Zheng escribió:
> > > Hi Sergio,
> > >
> > > Any ETA to fix it?  It becomes a big show stopper to migrate to Rails
> 3.
> > >
> > > Thanks,
> > >
> > > On Fri, Apr 6, 2012 at 7:47 AM, Nick Rogers <[email protected]>
> wrote:
> > > > I'm experiencing the same problem with nested scaffolds and
> conditions.
> > > > Latest active_scaffold master and rails 3.2.3.
> > > >
> > > > On Thu, Apr 5, 2012 at 11:01 PM, Richard Zheng <[email protected]>
> wrote:
> > > >> Hi,
> > > >>
> > > >> With AS 3.2.2, we have an embedded scaffold with a constraint.
>  Inside
> > > >> it, click one column, a nested scaffold shows up.  But for the
> nested
> > > >> scaffold, the sql query now includes the constraint for embedded
> which
> > > >> refers to columns not available for the table.  Here is an example.
> As
> > > >> you
> > > >> can see, it adds `subnets`.parent_id IN (30792) which is the
> constraint
> > > >> for
> > > >> the embedded.
> > > >>
> > > >> On the old version, working
> > > >>
> > > >> SELECT `hosts`.* FROM `hosts` WHERE (((hosts.subnet_id = '5302')))
> > > >>
> > > >>
> > > >>
> > > >> One the new version, broken
> > > >>
> > > >> SELECT COUNT(*) FROM `hosts`  WHERE `hosts`.`subnet_id` = 5302 AND
> > > >> (((hosts.subnet_id = '5302')) AND (`subnets`.parent_id IN (30792))))
> > > >>
> > > >>
> > > >> Thanks,
> > > >> Richard
> > > >>
> > > >>  --
> > > >>
> > > >> 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.
> > > >>
> > > >  --
> > > >
> > > > 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.
>
> --
> 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.
>
>

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