I tested, that they, in fact, don't work:
class User < ActiveRecord::Base
def self.call_protected_method
protected_method
end
def self.call_private_method
private_method
end
protected
def self.protected_method
puts "protected_method"
end
private
def self.private_method
puts "private_method"
end
end
What i mean, by they don't work, is You can call all methods in this example. It doesn't matter if they are under private and/or protected.
# in rails console:
User.call_protected_method # => protected_method
User.protected_method # => protected_method
User.call_private_method # => private_method
User.private_method # => private_method
Why is that? Whats the reason for ignoring 'private' and 'protected'?
UPDATE: my question isn't how to do this. My question is why doesn't this approach work in rails models!?