Does Rails set the session[:session_id] field in functional testing?
I’ve been getting an empty string… which is causing the url_for
function call in my view to blow up. It would be really nice to avoid
the following ugly workaround…
<%= if session.session_id != ‘’
link_to ‘Sign Out’, session_url(:id => session.session_id), :method =>
:delete end %>
I’ve tried that but and gotten the following error message:
ActionView::TemplateError: session_url failed to generate from
{:controller=>“sessions”, :id=>“”, :action=>“show”}, expected:
{:controller=>“sessions”, :action=>“show”}, diff: {:id=>“”}
On line #21 of app/views/layouts/application.rhtml
18: Signed in as <%= link_to user.name, user_url(:id => user)%>
19:
:id=>current_user will work… but if someone was malicious they
could spam my site with session_url(:id => random_number, :method =>
:delete) which would result in my users being logged out
unexpectedly…
Sonny.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.