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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -