With the following code
class User < ActiveRecord::Base
# ...
# code filtered from here
# ...
# both methods below are public methods
def humanized_roles
roles.collect {|e| e.name.humanize }.join(', ')
end
def role=( arg = nil)
self.roles = []
self.add_role arg.to_sym
end
end
This is happening
[2] pry(main)> User.new.respond_to? :humanized_roles
=> false
[3] pry(main)> User.new.respond_to? "role=".to_sym
=> true
rvm, ruby, rails versions
rvm 1.26.3 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
Rails 3.2.14
Am I missing something obvious?
Aucun commentaire:
Enregistrer un commentaire