lib / constant.rb
module Constant
BANQUET_TYPE_OF_OFFER = [['Narrow By Offer Type',''], ["A la Carte", "A la Carte"],
["Alcohol Offer", "Alcohol Offer"], ["Buffet", "Buffet"], ["Brunch", "Brunch"],
["Happy Hours", "Happy Hours"], ["Set Menu", "Set Menu"],["Banquets", "Banquets" ]]
end
application_controller.rb
class ApplicationController < ActionController::Base
include Constant
end
views / banquets / banquet.html.haml
= f.select_tag "type_of_offer", options_for_select(Constant::BANQUET_TYPE_OF_OFFER,
@selected), :name => "banquet[type_of_offer][]", :multiple => true
Я создал многоконстанты в приложении рельсов, такие как константы Java.Это лучшая практика или нет ???Есть другое решение?