small medium large xlarge

Generic-user-small
29 May 2008, 03:59
Thomas Gall (1 post)

As I was enabling the use of cookies for the new cart code I think there’s a step missing to edit application.rb and change:

class ApplicationController < ActionController::Base

session :session_key =>’_depot_session_id’ helper :all # include all helpers, all the time

# See ActionController::RequestForgeryProtection for details # Uncomment the :secret if you’re not using the cookie session store protect_from_forgery # :secret => ‘6cc287d9179e28b15c0f72d47da09656’ end

to (Note the uncommenting of :secret)

class ApplicationController < ActionController::Base

session :session_key =>’_depot_session_id’ helper :all # include all helpers, all the time

# See ActionController::RequestForgeryProtection for details # Uncomment the :secret if you’re not using the cookie session store protect_from_forgery :secret => ‘6cc287d9179e28b15c0f72d47da09656’ end

If one doesn’t do this you’ll get the following error when you create the first pass on add_to_cart.html.erb:

ActionView::TemplateError (No :secret given to the #protect_from_forgery call. Set that or use a session store capable of generating its own keys (Cookie Session Store).) on line #20 of products/index.html.erb: 17: <td class="list-actions"> 18: <%= link_to ‘Show’, product %>
19: <%= link_to ‘Edit’, edit_product_path(product) %> 20: <%= link_to ‘Destroy’, product, :confirm => ‘Are you sure?’, :method => :delete %></td> 21: </td> 22: </tr> 23: <% end %>

Samr_small_pragsmall
29 May 2008, 12:02
Sam Ruby (634 posts)

Depending on which version of the beta you are looking at, this should be described on the top of page 106 (B1.0 and B1.1) or 107 (B1.2). It is mentioned in the prose “uncomment out the secret provided” and an arrow is next to the code line that you need to change.

You must be logged in to comment