-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Custom inputs examples
Lucas Mazza edited this page Jan 27, 2013
·
10 revisions
In order to get an input with localized week days:
# app/inputs/wday_input.rb
class WdayInput < SimpleForm::Inputs::Base
def input
@builder.select(attribute_name, I18n.t(:"date.day_names").each_with_index.to_a)
end
end
Then, use it in your form:
<%= timetable.input :wday, :as => :wday %>
This page was created by the OSS community and might be outdated or incomplete. Feel free to improve or update this content according to the latest versions of SimpleForm and Rails to help the next developer who visits this wiki after you.
Keep in mind to maintain the guides as simple as possible and to avoid additional dependencies that might be specific to your application or workflow (such as Haml, RSpec, Guard and similars).