Igor
Igor

Reputation: 2919

Ruby on Rails, formtastic gives different HTML

I have this template:

- f.inputs do
= user.input :is_vip?, :as => :boolean, :label=>'VIP'
= f.input :test, :as => :boolean, :required => false, :label => "This is TEST company"
= f.input :multi_destination, :as => :boolean, :required => false, :label => "Multi destination"

It's fully working thing. But the code that the browser receive is different in my localhost and in stage server. I don't know where to dig. CSSes are exactly the same, sources are same, everything is the same.

Upvotes: 0

Views: 155

Answers (1)

kikito
kikito

Reputation: 52651

Formtastic, by default, uses a method named label_with_nested_checkbox for rendering boolean input fields. That method renders the checkbox inside the label - like you are getting in localhost.

Formtastic doesn't have any "default way" to "take the input field out of the label" (his author confirmed this to me on this question) It must have been patched somehow to do that. Here're some possible places to look:

  • Check inside the apps/inputs directory, if there is any. That's the "standard" place where someone can modify Formtastic plugins
  • Check the config/initializers directory. To see if there is any Formtastic monkeypatching there.
  • Check the vendors directory.
  • Finally, even if the gem versions are the same, some could (grasp!) have changed the code of the gem itself in the server. I certainly hope they nave not. But anyway, uninstalling and reinstalling the gem, and maybe rebooting the server, should check that one out.

Upvotes: 2

Related Questions