0
好吧,我有這個在我有什麼如何打開underscrore找到Ruby on Rails中模型
user.rb //用戶模式
OPTION = ['none', 'all', 'partial']
ANOTHER = ['true', 'false', 'neither']
YET_ANOTHER = ['something', 'another']
application_helper.rb
def my_method(information, name)
#this is where i need help
User::OPTIONS
index.html.erb
my_method('information', :option)
my_method('information', :another)
my_method('information', :yet_another)
我如何在my_method視圖助手抓住正確的數組因此,例如,如果我在my_method視圖助手在
my_method('information', :another)
送我應該執行
我在想我可以upcase,但如何執行此....
我試過下面
User::name.upcase
NoMethodError: undefined method `name' for #<Class:0x000d001078cd9c8>
是有辦法做到這一點,如果所述第一部分是一個字符串也因此,如果i具有--------------信息=「用戶」 – Trace 2011-12-14 02:08:53