ruby on rails - How to convert form_tag in haml to erb -
hi form_tag in haml , getting errors when convert erb,
%h2 create new movie = form_tag movies_path, :method => :post = label :movie, :title, 'title' = text_field :movie, :title = label :movie, :rating, 'rating' = select :movie, :rating, ['g','pg','pg-13','r','nc-17'] = label :movie, :release_date, 'released on' = date_select :movie, :release_date = submit_tag 'save changes'
below erb,
<h2> create new movie </h2> <form action = <%= "#{movies_path}"%> method = "post"> <%= label :movie, :title, 'title' %> <%= text_field :movie, :title %> <%= label :movie, :rating, 'rating' %> <%= select :movie, :rating, ['g','pg','pg-13','r','nc-17'] %> <%= label :movie, :release_date, 'released on' %> <%= date_select :movie, :release_date %> <%= submit_tag 'save changes' %> </form>
i getting "can't convert symbol string" @ around line 12.
you can use form_tag
helper.
<%= form_tag movies_path, method: :post %> ... <% end %>
suggested reading: http://api.rubyonrails.org/classes/actionview/helpers/formtaghelper.html#method-i-form_tag
Comments
Post a Comment