Sha256: 2c3bcfddba029e008393a73461b59cd8a0e50d72183c6c7343187f96e3045ea0

Contents?: true

Size: 523 Bytes

Versions: 4

Compression:

Stored size: 523 Bytes

Contents

module RailsDataHelper

  def text_field_tag(name, value = nil, options = {})
    if options[:as]
      type = RailsData.config.mapping[options[:as]][:input]

      if type == 'textarea'
        return text_area_tag(name, value, options)
      end

      if type == 'select'
        opts = RailsData.config.mapping[options[:as]][:options]
        selected = RailsData.config.mapping[options[:as]][:selected]
        return select_tag name, options_for_select(opts, selected), options
      end
    end

    super
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_data-1.0.2 app/helpers/rails_data_helper.rb
rails_data-1.0.1 app/helpers/rails_data_helper.rb
rails_data-1.0.0 app/helpers/rails_data_helper.rb
rails_data-0.0.1 app/helpers/rails_data_helper.rb