app/models/user.rb
# Return true if this user can change the specified attribute.
#
# If record is an ActiveRecord object, returns true if the change is allowed to complete.
#
# If record is an ActiveRecord class (eg. Pool rather than an actual pool), returns
# false if the user would never be allowed to make this change for any instance of the
# object, and so the option should not be presented.
#
# For example, can_change(Pool, :description) returns true (unless the user level
# is too low to change any pools), but can_change(Pool.find(1), :description) returns
# false if that specific pool is locked.
#
# attribute usually corresponds with an actual attribute in the class, but any value
# can be used.
Return true if this user can change the specified attribute.
If record is an ActiveRecord object, returns true if the change is allowed to complete.

If record is an ActiveRecord class , returns
false if the user would never be allowed to make this change for any instance of the
object, and so the option should not be presented.

For example, can_change(Pool, :description) returns true (unless the user level
is too low to change any pools), but can_change(Pool.find(1), :description) returns
false if that specific pool is locked.

attribute usually corresponds with an actual attribute in the class, but any value
can be used.
Return true if this user can change the specified attribute . If record is an ActiveRecord object returns true if the change is allowed to complete . If record is an ActiveRecord class returns false if the user would never be allowed to make this change for any instance of the object and so the option should not be presented . For example can_change ( Pool : description ) returns true ( unless the user level is too low to change any pools ) but can_change ( Pool . find ( 1 ) : description ) returns false if that specific pool is locked . attribute usually corresponds with an actual attribute in the class but any value can be used .
def can_change?(record, attribute)
      method = "can_change_#{attribute}?"
      if is_mod_or_higher?
        true
      elsif record.respond_to?(method)
        record.__send__(method, self)
      elsif record.respond_to?(:can_change?)
        record.can_change?(self, attribute)
      else
        true
      end
    end
def can_change? ( record , attribute ) method = "can_change_#{attribute}?" if is_mod_or_higher? true elsif record . respond_to? ( method ) record . __send__ ( method , self ) elsif record . respond_to? ( :can_change? ) record . can_change? ( self , attribute ) else true end end
Return true if this user can change the specified attribute.
Return true if this user can change the specified attribute .
record
attribute