Reputation: 3031
I'm using haml 3.1.4 and haml-rails 0.3.5
The issue I'm having only occurs on the server (production) and locally (test) but not in development (both appear to be using the same gem versions)
=form_for @thing, :remote => true do |f|
=hidden_field_tag :template, 'thing'
%table
%thead
%tr
%th
Name
%th
=image_tag 'cancel.png'
%tbody
=f.fields_for :items do |item_fields|
%tr
%td
=f.text_field :name
%td
=f.submit 'Save'
it outputs the following html save text:
<input type='hidden' value='thing' /><table><thead><tr><th>Name</th><th><img src='cancel.png.....' /></tr></thead>
followed be the rendered html above.
How can I narrow down what the differences are between test/production and development?
Any ideas? :)
EDIT: It might be worth mentioning that this is the second form for '@thing' on the page. The first one renders fine, the second one is where the issue is.
Upvotes: 5
Views: 898
Reputation: 9529
You might be using two different versions of haml. Could be one version is more strict on the space after the '='. I would write it like:
= form_for @thing, :remote => true do |f|
= hidden_field_tag :template, 'thing'
%table
%thead
%tr
%th Name
%th= image_tag 'cancel.png'
%tbody
= f.fields_for :items do |item_fields|
%tr
%td= f.text_field :name
%td
= f.submit 'Save'
Upvotes: 0
Reputation: 2228
I have a couple theories.
Whitespace is very important in haml. Is it possible you have a tab somewhere and whitespaces elsewhere?
Do both your form_for
s have remote: true
? That creates some extra div output which I suppose could confuse the DOM if it's reusing ids.
Are you sure you are using the =
on form_for
because without it, it won't output the HTML form tags.
I'm afraid I'm just guessing, and none of these would explain why it works in development.
Perhaps it helps...
Upvotes: 1
Reputation: 824
By the looks of it you are not closing the tag is this your problem? Anyway in regards to narrowing down the differences between test/prod/dev you really need to check out the contents of your /config/
folder. I can suggest for testing that you can use the Rails.env == "development"
for choosing your environment and then trying the debugger and looking for differences.
Upvotes: 0