Reputation: 6639
Rails 3.2
Ruby 2.15
I have a somewhat complex view app/views/tickets/show.html.slim. Inside this view, I render various sections of the the ticket
One section is called customer_info. Here's what I have:
render 'tickets/sections/customer_info', locals: { customer_info: CustomerInfo.new, ticket: @ticket }
In my app/views/tickets/sections/_customer_info.html.slim, I have:
= form_for(customer_info) do |f|
- :ticket_id = ticket.id
= f.hidden_field :ticket_id
.form-horizontal-column.customer-info
.form-group
= f.label :first_name
= f.text_field :first_name
.form-group
= f.label :last_name
= f.text_field :last_name
.actions = f.submit 'Save'
.clear
I am however getting the following error message:
_customer_info.html.slim:2: syntax error, unexpected '=', expecting keyword_end
; :ticket_id = ticket.id;
^
I am starting to learn .slim. Any ideas?
Upvotes: 1
Views: 1898
Reputation: 4060
You can't set a symbol to something - they are immutable. You can remove the 2nd line do do something like:
= form_for(customer_info) do |f|
= f.hidden_field :ticket_id, :value => ticket.id
...
Upvotes: 2