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