Skip to content

Instantly share code, notes, and snippets.

@slucha
Last active September 29, 2017 12:01
Show Gist options
  • Save slucha/d014b8b21e98f0f8d755ff145aaba2eb to your computer and use it in GitHub Desktop.
Save slucha/d014b8b21e98f0f8d755ff145aaba2eb to your computer and use it in GitHub Desktop.
form_for error
Rendered types/show.html.erb within layouts/application (40.8ms)
Completed 500 Internal Server Error in 71ms (ActiveRecord: 5.4ms)
ActionView::Template::Error (wrong number of arguments (0 for 2)):
59: <div><h3>Can you please tell us why you gave us this score?</h3></div>
60: <div class="field-box">
61: <br>
62: <%= f.text_area :review, class: "form-control", rows: "4" %><br>
63: </div>
64:
65:
app/views/types/show.html.erb:62:in `block in _app_views_types_show_html_erb__989903270_22506500'
app/views/types/show.html.erb:54:in `_app_views_types_show_html_erb__989903270_22506500'
Rendering /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
Rendering /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (7.7ms)
Rendering /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (3.1ms)
Rendering /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.2ms)
Rendered /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (33.5ms)
<div class="row">
<h2><%= @type.product.brand.name %> <%= @type.product.name %></h2>
</div>
<div class="row">
<h4>Flavour: <%= @type.flavour %></h4><br>
</div>
<div class="row">
<%= link_to 'Back', product_path(@type.product) %>
</div>
<div class="row">
<div class="col">
<img src="">
</div>
<div class="col">
<p>
<strong><h1><%= @type.average_rating %></h1> of 10 <h6>(from <%= @type.nps_ratings.count %> reviews)</h6></strong>
</p>
</div>
<div class="col">
<p>
<strong><h1><%= @type.average_rating %></h1> of 28 <%= @type.product.brand.name %> <%= @type.product.name %> Flavours</strong>
</p>
<p>
<strong><h1><%= @type.average_rating %></h1> of 128 of all Protein Flavours</strong>
</p>
</div>
</div>
<% unless @type.rated_by?(@user) %>
<div class="row">
<h5>Please rate the Flavor <%= @type.flavour %> of the product <%= @type.product.brand.name %> <%= @type.product.name %> according to your personal taste from 0 (really bad taste) to 10 (amazing taste)</h5>
<%= button_to '0', vote_type_path(@type, score: 0), method: :post, class: 'vote' %>
<%= button_to '1', vote_type_path(@type, score: 1), method: :post, class: 'vote' %>
<%= button_to '2', vote_type_path(@type, score: 2), method: :post, class: 'vote' %>
<%= button_to '3', vote_type_path(@type, score: 3), method: :post, class: 'vote' %>
<%= button_to '4', vote_type_path(@type, score: 4), method: :post, class: 'vote' %>
<%= button_to '5', vote_type_path(@type, score: 5), method: :post, class: 'vote' %>
<%= button_to '6', vote_type_path(@type, score: 6), method: :post, class: 'vote' %>
<%= button_to '7', vote_type_path(@type, score: 7), method: :post, class: 'vote' %>
<%= button_to '8', vote_type_path(@type, score: 8), method: :post, class: 'vote' %>
<%= button_to '9', vote_type_path(@type, score: 9), method: :post, class: 'vote' %>
<%= button_to '10', vote_type_path(@type, score: 10), method: :post, class: 'vote' %>
</div>
<% else %>
<%= form_for @type, url: comment_type_path(@type), method: "post" do |f| %>
<div><h3>How likely are you to recommend our service to your friends, family or colleagues?</h3></div>
<div><h3>Can you please tell us why you gave us this score?</h3></div>
<div class="field-box">
<br>
<%= f.text_area :review %>
</div>
<div class="actions">
<%= f.submit 'Vote', class: 'btn-flat success new-product' %>
</div>
<% end %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment