ruby on rails - How Do I Call An Array Written in My Model -


greeting create array in model , reference later view or helper. how do this?

this in events model. users can select lunch type(1,2,3) event. instead of hard-coding sandwich names, can change, in view, thought keep names in 1 place (model) reference name based on lunch type chosen.

sandwiches = { 1 => 'turkey', 2 => 'veggie', 3 => 'roast beef' } 

how call script in app view or helper?

event.sandwiches[1] not work event_obj.sandwiches[1] not work 

thanks help.

what have there constant , need access event::sandwiches.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -