Skip to content

Instantly share code, notes, and snippets.

@esparkman
Created January 19, 2011 01:39
Show Gist options
  • Save esparkman/785526 to your computer and use it in GitHub Desktop.
Save esparkman/785526 to your computer and use it in GitHub Desktop.
=> Booting WEBrick
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-01-18 20:53:12] INFO WEBrick 1.3.1
[2011-01-18 20:53:12] INFO ruby 1.9.2 (2010-12-25) [x86_64-darwin10.5.0]
[2011-01-18 20:53:12] INFO WEBrick::HTTPServer#start: pid=3154 port=3000
Started POST "/tickets" for 127.0.0.1 at 2011-01-18 20:53:44 -0500
Processing by TicketsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"GDDzDw1nC7GLEAViH/bY+HBJ1q2u//QX7KyuW9kv7t8=", "ticket"=>{"title"=>"Hello World", "call_type"=>"Error", "priority"=>"High", "description"=>"Hello World", "call_back_needed"=>"0", "status"=>"Open", "user_id"=>"1"}, "commit"=>"Create Ticket"}
SQL (0.6ms) SHOW TABLES
SQL (0.6ms) SHOW TABLES
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
Rendered text template (0.0ms)
Completed in 131ms
NoMethodError (undefined method `ticket' for ["Huh?"]:Array):
app/controllers/tickets_controller.rb:15:in `create'
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.6ms)
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (11.8ms)
Started POST "/tickets" for 127.0.0.1 at 2011-01-18 20:54:15 -0500
Processing by TicketsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"GDDzDw1nC7GLEAViH/bY+HBJ1q2u//QX7KyuW9kv7t8=", "ticket"=>{"title"=>"Hello World", "call_type"=>"Error", "priority"=>"High", "description"=>"Hello World", "call_back_needed"=>"0", "status"=>"Open", "user_id"=>"1"}, "commit"=>"Create Ticket"}
SQL (0.5ms) SHOW TABLES
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
Completed in 48ms
NoMethodError (undefined method `ticket' for nil:NilClass):
app/controllers/tickets_controller.rb:15:in `create'
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms)
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.2ms)
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (10.4ms)
Started POST "/tickets" for 127.0.0.1 at 2011-01-18 20:54:36 -0500
Processing by TicketsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"GDDzDw1nC7GLEAViH/bY+HBJ1q2u//QX7KyuW9kv7t8=", "ticket"=>{"title"=>"Hello World", "call_type"=>"Error", "priority"=>"High", "description"=>"Hello World", "call_back_needed"=>"0", "status"=>"Open", "user_id"=>"1"}, "commit"=>"Create Ticket"}
SQL (0.4ms) SHOW TABLES
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
CACHE (0.0ms) SELECT `users`.* FROM `users` WHERE (`users`.`id` = 1) LIMIT 1
Completed in 50ms
NoMethodError (undefined method `tickets' for nil:NilClass):
app/controllers/tickets_controller.rb:15:in `create'
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms)
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.0ms)
Rendered /Users/esparkman/.rvm/gems/ruby-1.9.2-p136@rails3/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (10.3ms)
Clientmanager::Application.routes.draw do
resources :roles
root :to => "users#show"
resources :tickets do
resources :comments
end
resources :people do
resources :tickets
end
resources :companies, :shallow => true do
resources :people, :tickets
end
resources :profiles
resources :users, :user_sessions
match 'login' => 'user_sessions#new', :as => :login
match 'logout' => 'user_sessions#destroy', :as => :logout
match 'register' => 'users#new', :as => :register
end
class TicketsController < ApplicationController
def show
@ticket = Ticket.find(params[:id])
# @comments = Comment.all
# @comment = @ticket.comments.build
end
def new
@ticket = ticketable.tickets.build
#@ticket = @person.tickets.build
end
def create
@ticket = ticketable.tickets.build(params[:ticket])
# @user = current_user
if @ticket.save
redirect_to @ticket, :notice => 'Ticket was created successfully'
else
flash[:notice] = 'Ticket was not created Successfully.'
render = 'new'
end
end
def edit
end
def update
if @ticket.update_attributes(params[:ticket])
flash[:notice] = "Ticket has been updated."
redirect_to [@person, @ticket]
else
flash[:alert] = "Ticket has not been updated."
render :action => "edit"
end
end
def destroy
@ticket.destroy
flash[:notice] = "Ticket has been deleted."
redirect_to @person
end
private
def ticketable
find_company || find_person
end
def find_company
(id = params[:company_id]) ? Company.find(id) : nil
end
def find_person
(id = params[:person_id]) ? Person.find(id) : nil
end
def find_user
(id = params[:user_id]) ? User.find(id) : nil
end
def find_ticket
@ticket = @person.tickets.find(params[:id])
end
end
NoMethodError in TicketsController#create
undefined method `tickets' for nil:NilClass
Rails.root: /Users/esparkman/Programming/Rails/clientmanager
Application Trace | Framework Trace | Full Trace
activesupport (3.0.3) lib/active_support/whiny_nil.rb:48:in `method_missing'
app/controllers/tickets_controller.rb:15:in `create'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:445:in `_run__3607929900740583364__process_action__660204105009447629__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:120:in `process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.3) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:82:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in `call'
haml (3.0.25) lib/sass/plugin/rack.rb:41:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in `call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/Users/esparkman/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/esparkman/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/esparkman/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"GDDzDw1nC7GLEAViH/bY+HBJ1q2u//QX7KyuW9kv7t8=",
"ticket"=>{"title"=>"Hello World",
"call_type"=>"Error",
"priority"=>"High",
"description"=>"Hello World",
"call_back_needed"=>"0",
"status"=>"Open",
"user_id"=>"1"},
"commit"=>"Create Ticket"}
Show session dump
Show env dump
Response
Headers:
None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment