I saw from another thread and docs the use of update_table_config,
however It does not work as expected. Given I have the same controller
table nested twice, and I have the following code
before_filter :update_table_config
def update_table_config
active_scaffold_config.label = params
[:parent_column].humanize.titleize unless params[:parent_column].nil?
or not params[:nested]
end
The code runs though three times instead of two ? only overrides one
of the table labels and assigns the label of the other table. It would
be great if the code above was part of the standard AS implementation
and worked ?
It seems that the @label retrieval in _nested.rhtml happen before the
update_table_config filter. This would explain the error above as the
first pass uses the current label, the label override is then set and
used for the second pass using the wrong label.
I have no idea why this is being called three times, and this does not
happen all the time.
Is this a bug and do I need to raise a defect ?
Thanks
-Simon
On May 18, 8:08 pm, simonS <[email protected]> wrote:
> Hi
>
> I have a model that has self referencing has many though associations
> as defined
> inhttp://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-t...
>
> Essentially you have two associations of the same model class "Hunt"
> for "preys" and "escapes". I have a single AS controller for the Hunt
> model as HuntsController. My AnimalsControler has nested links added
> for both ":preys" and ":escapes".
>
> When the nesred links are displayed the name of each lis is determined
> by the config.label of the HuntsController, that means they are the
> same and is is non obvious to a user which list is which.
>
> Assuming the confign was this:
>
> config.nested.add_link("Links", [::preys, :escapes])
>
> When the "Links" nested link is slected the HuntsController is
> displays once for each association with the HuntsController label as
> defined in the config.label.
>
> Is there a way to dynamically set the name of the controller label
> depending on which association is listed in the context of the
> controller ?
>
> For nested lists I'd expect the list label to be derived of the parent
> column ?
>
> Thanks !
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---