Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::. 
wrote:
> El Thursday 08 January 2009 00:13:13 Wes Gamble escribió:
>   
>> All,
>>
>> I have a module that is included into 3 of my controllers, each of which
>> is Active Scaffolded.
>>
>> However, not all three controllers have the same actions enabled, but my
>> common code needs to handle all three cases.
>>
>> How can I reliably inspect a given active_scaffold_config to see which
>> actions are actually enabled on it?
>>
>> For example, I want to know if the "show" action is enabled on a given
>> scaffold.
>>
>> active_scaffold_config.actions.include?(:show) doesn't work because the
>> action objects are not symbols.
>>     
>
> It should work, that check is used in active_scaffold, look at 
> actions/nested.rb 
>   
SOLUTION:

This works well:

def has_action?(action)
   active_scaffold_config.actions.to_set.include?(action)
end

has_action?(:show)

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

  • De... Wes Gamble
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
      • ... Wes Gamble

Reply via email to