Sha256: a710ccd659f397b9de06a1d7eebc4d19a150b6946fbcae07c69400badac36718
Contents?: true
Size: 870 Bytes
Versions: 3
Compression:
Stored size: 870 Bytes
Contents
module Rails class Views module ViewHelpers extend ActiveSupport::Concern def flash parent_controller.flash end def render_each_and_join(views) views.map { |view| render(view) }.join end class_methods do def option(*array) array.each do |option| define_method(option) do options[option] end end end def date_property(*array) options = array.pop if array.last.is_a?(Hash) options ||= {} array.each do |field| format = options[:format] || :default name = options[:prefix] ? "#{options[:prefix]}_#{field}" : field define_method(name) do I18n.l(model.send(field), format: format) end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rails-views-0.2.1 | lib/rails/views/view_helpers.rb |
rails-views-0.2.0 | lib/rails/views/view_helpers.rb |
rails-views-0.1.0 | lib/rails/views/view_helpers.rb |