Hey all,
I have this in view:
- if site_action_enabled?(:site_flag_enabled, Site)
And I have this in application controller:
def site_action_enabled?(operation, resource)
if resource.is_a?(Class) && resource == Site
return current_user.site.call operation
else
return false
end
end
helper_method :site_action_enabled?
It gives me error:
undefined method `call'' for
site-1:ActiveRecord::Associations::BelongsToAssociation
If I use something like send:
return current_user.site.send operation
It does not call the site_flag_enabled instance method, which returns
true or false (site_flag_enabled is a field in database for sites
table of tinyint type)
thanks for response
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.