Using simple_form to set data content
I am using Simple_form with Rails 3.2.1
Everything is fine except that I need to set the "data-content" attribute on input_html for bootstrapping
However, when I use the following Rails / Ruby I don't like this code as there is a dash in the "content-content" method:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", :data-content => "Popover content"}
and I get the error:
undefined local variable or method `content'
Does anyone know how you can set content content for input elements using simple_form ???
thank
You cannot use -
ruby in symbols, but you can use a string like "data-content"
. So this will probably work:
<%= f.input :first_name, :required => true, :label => "First Name", :autofocus => true, :input_html => {:rel => "tooltip", :title => "Testing!", 'data-content'=> "Popover content"}
I think you can use data settings like this:
<%= f.input blar..., :input_html => { :data => { content: => "Popover content"}}
this should give you an attribute data-content="Popover content"
You cannot use hyphens in your character names. :data-content
interpreted as :data - content
=> character :data
minus `content.
Wrap it in quotes instead ... "data-content" => "Popover content" ...