Reputation: 1549
My app is works fine in localhost, but when i deploy to heroku and try create a new order i receive this error:
2013-03-20T21:26:02+00:00 app[web.1]: Started GET "/orders/new" for 189.44.29.3 at 2013-03-20 21:26:02 +0000
2013-03-20T21:26:02+00:00 app[web.1]: Processing by OrdersController#new as HTML
2013-03-20T21:26:02+00:00 app[web.1]: Rendered orders/new.html.erb within layouts/application (49.4ms)
2013-03-20T21:26:02+00:00 app[web.1]: Completed 500 Internal Server Error in 62ms
2013-03-20T21:26:02+00:00 app[web.1]:
2013-03-20T21:26:02+00:00 app[web.1]: ActionView::Template::Error (/app/app/views/orders/new.html.erb:31: unknown regexp options - tabl
2013-03-20T21:26:02+00:00 app[web.1]: /app/app/views/orders/new.html.erb:33: unterminated string meets end of file
2013-03-20T21:26:02+00:00 app[web.1]: /app/app/views/orders/new.html.erb:33: syntax error, unexpected $end, expecting keyword_end):
2013-03-20T21:26:02+00:00 app[web.1]: 28: <td><%= order.select :drop,options_for_select({"Nao",false,"Sim",true}) %></td>
2013-03-20T21:26:02+00:00 app[web.1]: 29: </tr>
2013-03-20T21:26:02+00:00 app[web.1]: 30: </tbody>
2013-03-20T21:26:02+00:00 app[web.1]: 31: </table>
2013-03-20T21:26:02+00:00 app[web.1]: 32: <%= order.submit "Criar nova Compra !"%>
2013-03-20T21:26:02+00:00 app[web.1]: 33: <% end %>
2013-03-20T21:26:02+00:00 app[web.1]: app/controllers/orders_controller.rb:16:in `new'
in my view have this code:
<%= form_for @order do |order| %>
<table>
<tbody>
<tr>
<td>Fornecedor</td>
<td>Produto</td>
<td>Quantidade</td>
<td>Nr Compra</td>
<td>Pagamento</td>
<td>Valor</td>
<td>Endereço</td>
<td>Dropship</td>
</tr>
<tr>
<td><%= order.select :seller,Place.all.map { |a| [a.place,a.place] }%></td>
<td><%= order.select :product_id,Product.all.map { |a| [a.name,a.id] } %></td>
<td><%= order.text_field :quantity,:size => 4 %></td>
<td><%= order.text_field :order_number,:size => 2%></td>
<td><%= order.select :payment,Place.all.map { |a| [a.place,a.place] }%></td>
<td><%= order.text_field :value,:size => 5 %></td>
<td><%= order.select :adress_id,Adress.all.map { |a| [a.name,a.id] }%></td>
<td><%= order.select :drop,options_for_select({"Nao",false,"Sim",true}) %></td>
</tr>
</tbody>
</table>
<%= order.submit "Criar nova Compra !"%>
<% end %>
if someone can help me whit this i thanks, this erro happening when i try create a new order, thanks
i try whit the options_for_select and whitout, all cases i get this error in heroku !
Upvotes: 0
Views: 199
Reputation: 11494
You have a syntax error in your view. My best guess is that for your case, is that the following line
<td><%= order.select :drop,options_for_select({"Nao",false,"Sim",true}) %></td>
</tr>
may be rewritten as:
<td><%= order.select :drop,options_for_select({"Nao" => false, "Sim" => true}) %></td>
</tr>
The expression {"Nao",false,"Sim",true}
has no meaning in default Ruby syntax.
Changing to this {"Nao" => false,"Sim" => true}
will produce a hash.
Changing to this ["Nao",false,"Sim",true]
will produce an array.
According to the docs, the rails method options_for_select will accept either a hash or an array (or any enumerable type).
Upvotes: 1