i don't remember if there's a method to tell if nested, but nested calls have params[:parent_scaffold] set.
On Fri, Jan 4, 2013 at 9:29 AM, emai relle <[email protected]> wrote: > Hi > > I try to configure different behaviours in AS, based on whether the AS is > nested or directly called. Assume bills should only be created in the > nested view, but a direct AS should list any bill, without possiblity to > "Create". > > I constructed following code, inspired from the "Per Request > Configuration" wiki page. See comments for behaviour. > > class BillsController < ApplicationController > > before_filter :bf_nested > > def bf_nested > if nested? > # This works > active_scaffold_config.list.label="Nested" > > # This has no effect on what is seen on the application > active_scaffold_config.actions.exclude :search > else > # This works as well > active_scaffold_config.list.label="Not" > > # This seems to work but has no effect on the end output on the > application > active_scaffold_config.actions.exclude :search, :create > > # This generates an error because create was excluded above. So I > conclude the exclude command works at a certain point in time. > #active_scaffold_config.create.link.label="Foo" > end > end > > active_scaffold :bill do |conf| > > # The nested? generates the following error: > # "undefined method `nested?' for BillsController:Class" > if nested? > else > end > ..... > > > > Is there a way to directly code the nested? into the |conf| block? > Why do the before_filter configuration settings sometimes not have effect > on the output? > > Or is there a smarter way to get different configs for the same controller? > > Thanks > Emairelle > > > > > -- > 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.
