Hi,
I'm trying to control the way the nested.add_link(s) display based on a user's 
role.

The situation:
Assets 
has_many :procurements

Procurements 
belongs_to :asset

I'm using update_table_config to control the AS block in the Assets controller.
 
class AssetsController< ApplicationController 
...
def update_table_config


if current_user.has_role?('Administrator')
  active_scaffold_config.list.label = 'Administrator View'
  active_scaffold_config.list.columns = 
[:property_no,:assetmodel,:serial_no,:location,:notes] 
  **active_scaffold_config.nested.add_link :procurements, :label => 
'',:html_options => {:class => 'picViewProcure',:title =>'Procurements'}*
...
elsif current_user.has_role?('Manager') 
....
end


This line, 
  active_scaffold_config.nested.add_link :procurements, :label => 
'',:html_options => {:class => 'picViewProcure',:title =>'Procurements'}

I get the error...

*NoMethodError (undefined method `link_for_association' for 
#<ActiveScaffold::Config::Core:0x7132698>):*

*  app/controllers/assets_controller.rb:138:in `update_table_config'*


Anyone dealt with this before? The nested.add_link works outside the 
update_table_config method.
Not sure,am I missing something? Is there a better way to control this?
Thanks all!



-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to