don't working with twitter-bootstrap-rails #221

Closed
nvoynov opened this Issue Nov 23, 2012 · 3 comments

Projects

None yet

3 participants

@nvoynov
nvoynov commented Nov 23, 2012

Hi! I'm playing with nested_form, simple_form and twitter-bootstrap-rails. nested_form with simple_form works fine, but if I use twitter-booostrap-rails link_to_add and link_to_remove don't working.

most simplest example
<%= simple_nested_form_for @master, :html => { :class => 'form-horizontal' } do |f| %>
<%= f.input :name %>

<%= f.simple_fields_for :details do |detail_form| %>
<%= detail_form.input :name %>
<%= detail_form.link_to_remove "Delete" %>
<% end %>

<%= f.link_to_add "Add detail", :details %>

<%= f.button :submit, :class => 'btn-primary' %> <%= link_to t('.cancel', :default => t("helpers.links.cancel")), masters_path, :class => 'btn' %>
<% end %>
@shadowbq

+1

@shadowbq

This is confirmed to work.

It is a possible syntax error by @nvoynov , attr_accessible, or nested attributes error. (He does not include the error in the issue report)

FYI: The correct way to call simple_nested_form_for is

simple_nested_form_for(@master, :html => { :class => 'form-horizontal' }) do |f|

-or-

simple_nested_form_for @master, :html => { :class => 'form-horizontal' } do |f|

(Also note - link_to_add and link_to_remove are confirmed to work)

Please close this ticket.


Example *args Splat parsing FAILURE

simple_nested_form_for (@master, :html => { :class => 'form-horizontal' }) do |f|

In modern RoR apps you must not put a space after the method call when using *arg (splat) operations. This will cause the .extract_options! method to fail.

_form.html.erb:1: syntax error, unexpected ',', expecting ')'
  #...mple_nested_form_for (@master, :html => {:class => 'form-ho.
@lest
Collaborator
lest commented Jan 30, 2013

@shadowbq Thanks for the investigation!

@lest lest closed this Jan 30, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment