class CustomerClass < ActiveRecord
class << self
attr_reader :lov
end
at开发者_Python百科tr_reader :lov1
end
What is the diffrence between attr_reader lov and lov1 ?
The difference is that :lov
will be a class-level accessor, while :lov1
is instance-level.
So, you can only access lov1
from an instance:
customer = CustomerClass.new
lov1 = customer.lov1
While CustomerClass.lov1
wouldn't work, but CustomerClass.lov
would.
精彩评论