All,
I have two contexts in which I create an object whose controller is
AS-enabled. In one context, there will be an attribute ("filename")
that has a value and in the other, this attribute will not have a
value. I want the "show" template to not show the "filename" attribute
if it doesn't have a value.
I considered moving the AS "show" template into my specific view folder
and modifying it there, but wanted a way to do it via the configuration.
What I ended up with was this:
def show
....
self.class.active_scaffold :invoices do |config|
config.show.columns = invoice.filename? ? DEFAULT_COLUMNS :
NON_FILENAME_COLUMNS
end
end
in my "show" action. DEFAULT_COLUMNS and NON_FILENAME_COLUMNS differ
only by the key :filename.
This works fine. However, I did notice that when I do this within the
"show" action, that it appears to completely redefine the configuration.
So I have 2 questions:
1) Is there a way to "reopen" the controller wide AS config. and just
override/change the parts I want to?
2) Is there a bettter way in general to do this that is less clunky?
Thanks,
Wes
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---