Skip to content

Instantly share code, notes, and snippets.

@meltzerj
Created May 17, 2011 18:47
Show Gist options
  • Select an option

  • Save meltzerj/977094 to your computer and use it in GitHub Desktop.

Select an option

Save meltzerj/977094 to your computer and use it in GitHub Desktop.
Request URL:http://localhost:3000/users/sign_in
Request Method:POST
Status Code:200 OK
Request Headers
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:195
Content-Type:application/x-www-form-urlencoded
Cookie:_session_id=BAh7ByIQX2NzcmZfdG9rZW4iMXVlVCs5ZzZBWlRYSm5kajdWNTBQTDVKc29GRHAvTktzVXJVTHhSWXVCdFE9Ig9zZXNzaW9uX2lkIiU5NjM0YTg2MWQ0Mzg0NzcxZDk2MmE2Yzg2YjRjZjkwMg%3D%3D--612ba4fabd5ed3bb6b169063e031b2afb4b78145
Host:localhost:3000
Origin:http://localhost:3000
Referer:http://localhost:3000/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_4) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
Form Data
utf8:✓
authenticity_token:ueT 9g6AZTXJndj7V50PL5JsoFDp/NKsUrULxRYuBtQ=
User%5Bemail%5D:[email protected]
User%5Bpassword%5D:[FILTERED]
User%5Bremember_me%5D:0
commit:Sign in
Response Headers
Cache-Control:max-age=0, private, must-revalidate
Connection:Keep-Alive
Content-Length:3035
Content-Type:text/html; charset=utf-8
Date:Tue, 17 May 2011 22:10:42 GMT
Etag:"82d775e3ad28aa4c47178e398eebc0ae"
Server:WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
Set-Cookie:_session_id=BAh7CCIQX2NzcmZfdG9rZW4iMXVlVCs5ZzZBWlRYSm5kajdWNTBQTDVKc29GRHAvTktzVXJVTHhSWXVCdFE9Ig9zZXNzaW9uX2lkIiU5NjM0YTg2MWQ0Mzg0NzcxZDk2MmE2Yzg2YjRjZjkwMiIKZmxhc2hJQzolQWN0aW9uRGlzcGF0Y2g6OkZsYXNoOjpGbGFzaEhhc2h7BjoKYWxlcnQiH0ludmFsaWQgZW1haWwgb3IgcGFzc3dvcmQuBjoKQHVzZWRvOghTZXQGOgpAaGFzaHsGOwZU--a5c2e2a1311483064e75d1bc2f03c85e8b0de75a; path=/; HttpOnly
X-Runtime:0.215757
X-Ua-Compatible:IE=Edge
ActionView::Template::Error (undefined local variable or method `resource' for #<#<Class:0x103283940>:0x103277a00>):
3: </div>
4: <h3>Sign in</h3>
5:
6: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
7: <p><%= f.label :email %><br />
8: <%= f.email_field :email %></p>
9:
app/views/devise/sessions/_login_box.js.erb:6:in `_app_views_devise_sessions__login_box_js_erb__187310603_2173897000_2273950'
app/controllers/application_controller.rb:23:in `access_denied'
app/controllers/application_controller.rb:16:in `access_denied'
app/controllers/application_controller.rb:11:in `authenticate'
def authenticate
unless user_signed_in?
access_denied
end
end
def access_denied
respond_to do |format|
format.html do
flash[:alert] = "You must log in to peform this action."
redirect_to root_path
end
format.js do
render_to_facebox(:partial => 'devise/sessions/login_box')
end
end
false
end
<div class='login_error'>
You must sign in to perform this action.
</div>
<h3>Sign in</h3>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
<p><%= f.label :password %><br />
<%= f.password_field :password %></p>
<% if devise_mapping.rememberable? -%>
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
<% end -%>
<p><%= f.submit "Sign in" %></p>
<% end %>
<p id = "signup_prompt"> Don't have a DreamSti
class Devise::SessionsController < ApplicationController
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
include Devise::Controllers::InternalHelpers
# GET /resource/sign_in
def new
resource = build_resource
clean_up_passwords(resource)
respond_with_navigational(resource, stub_options(resource)){ render_with_scope :new }
end
# POST /resource/sign_in
def create
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => redirect_location(resource_name, resource)
end
# GET /resource/sign_out
def destroy
signed_in = signed_in?(resource_name)
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
set_flash_message :notice, :signed_out if signed_in
# We actually need to hardcode this, as Rails default responder doesn't
# support returning empty response on GET request
respond_to do |format|
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name) }
format.all do
method = "to_#{request_format}"
text = {}.respond_to?(method) ? {}.send(method) : ""
render :text => text, :status => :ok
end
end
end
protected
def stub_options(resource)
array = resource_class.authentication_keys.dup
array << :password if resource.respond_to?(:password)
{ :methods => array, :only => [:password] }
end
end
Started POST "/video_votes?type=up&video_id=2" for 127.0.0.1 at Tue May 17 15:00:28 -0700 2011
Processing by VideoVotesController#create as JS
Parameters: {"video_id"=>"2", "type"=>"up"}
ERROR: compiling _app_views_devise_sessions__login_box_js_erb__187310603_2174651400_2273950 RAISED compile error
/rubyprograms/dreamstill/app/views/devise/sessions/_login_box.js.erb:23: syntax error, unexpected kENSURE, expecting $end
Function body: def _app_views_devise_sessions__login_box_js_erb__187310603_2174651400_2273950(local_assigns)
_old_virtual_path, @_virtual_path = @_virtual_path, "devise/sessions/_login_box";_old_output_buffer = @output_buffer;login_box = local_assigns[:login_box];;@output_buffer = ActionView::OutputBuffer.new;@output_buffer.safe_concat('<div class=\'login_error\'>
You must sign in to perform this action.
</div>
<h3>Sign in</h3>
Request URL:http://localhost:3000/users/sign_in
Request Method:POST
Status Code:302 Found
Request Headers
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:195
Content-Type:application/x-www-form-urlencoded
Cookie:_session_id=BAh7CCIQX2NzcmZfdG9rZW4iMXVlVCs5ZzZBWlRYSm5kajdWNTBQTDVKc29GRHAvTktzVXJVTHhSWXVCdFE9Ig9zZXNzaW9uX2lkIiU5NjM0YTg2MWQ0Mzg0NzcxZDk2MmE2Yzg2YjRjZjkwMiIKZmxhc2hJQzolQWN0aW9uRGlzcGF0Y2g6OkZsYXNoOjpGbGFzaEhhc2h7BjoKYWxlcnQiH0ludmFsaWQgZW1haWwgb3IgcGFzc3dvcmQuBjoKQHVzZWRvOghTZXQGOgpAaGFzaHsGOwZU--a5c2e2a1311483064e75d1bc2f03c85e8b0de75a
Host:localhost:3000
Origin:http://localhost:3000
Referer:http://localhost:3000/users/sign_in
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_4) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24
Form Data
utf8:✓
authenticity_token:ueT 9g6AZTXJndj7V50PL5JsoFDp/NKsUrULxRYuBtQ=
user%5Bemail%5D:[email protected]
user%5Bpassword%5D:[FILTERED]
user%5Bremember_me%5D:0
commit:Sign in
Response Headers
Cache-Control:no-cache
Connection:Keep-Alive
Content-Length:88
Content-Type:text/html; charset=utf-8
Date:Tue, 17 May 2011 22:13:18 GMT
Location:http://localhost:3000/
Server:WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
Set-Cookie:_session_id=BAh7CSIQX2NzcmZfdG9rZW4iMXVlVCs5ZzZBWlRYSm5kajdWNTBQTDVKc29GRHAvTktzVXJVTHhSWXVCdFE9Ig9zZXNzaW9uX2lkIiVjNWFmZjZhNjUzYjZmNTc3MWE5YWI0Nzg1NTk4MTljOCIZd2FyZGVuLnVzZXIudXNlci5rZXlbCCIJVXNlclsGaQYiIiQyYSQxMCQueUNDM1c5NlhIWmN6bXJWdDRMSG4uIgpmbGFzaElDOiVBY3Rpb25EaXNwYXRjaDo6Rmxhc2g6OkZsYXNoSGFzaHsGOgtub3RpY2UiHFNpZ25lZCBpbiBzdWNjZXNzZnVsbHkuBjoKQHVzZWRvOghTZXQGOgpAaGFzaHsA--0f8418c3a228b7348118115bfee7f5405e9473a9; path=/; HttpOnly
X-Runtime:0.323707
X-Ua-Compatible:IE=Edge
@alindeman
Copy link
Copy Markdown

render_to_facebox(:partial => '...', :locals => { :resource => User.new, :resource_name => User.name })

@alindeman
Copy link
Copy Markdown

<% user = User.new %>
<%= form_for(user, :as => user.class.name.underscore, :url => session_path(user.class.name.underscore)) %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment