Method: PageRecord::Helpers#attribute_for

Defined in:
lib/page_record/helpers.rb

#attribute_for(name) ⇒ Object

Returns a hash containing the attribute name. This can be used as html options in rails helpers

example in a form builder block:

<%= f.text_field :name, attribute_for(:name) %>

this returns the follwing HTML:

<input data-attribute-for="name" id="team_name" name="team[name]" type="text">

Parameters:

  • name

    Symbol or String identifying the name

Returns:

  • Hash



89
90
91
# File 'lib/page_record/helpers.rb', line 89

def attribute_for(name)
  Hash['data-attribute-for', name]
end