Skip to content

Instantly share code, notes, and snippets.

@tomciopp
Created April 20, 2012 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomciopp/2425335 to your computer and use it in GitHub Desktop.
Save tomciopp/2425335 to your computer and use it in GitHub Desktop.
Observer not working
Here is an example record from the database before I have added a bid:
SELECT "loads".* FROM "loads" WHERE "loads"."id" = $1 LIMIT 1 [["id", 25]]
=> #<Load id: 25, commodity: "Coca-Cola", price: #<BigDecimal:103fb82c8,'0.4E3',9(18)>, weight: 30000, notes: "", created_at: "2012-04-17 22:41:53", updated_at: "2012-04-17 22:41:53", distance: 2733.36707093163, truck_type: "53' Dry Van", latitude: 0.651560856964623, longitude: -2.12983434097684, user_id: 5, delta: false, current_asking_price: nil>
Then we create a bid on that load with the following log:
Started POST "/loads/25/bids" for 127.0.0.1 at 2012-04-19 22:07:53 -0400
Processing by BidsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"iHCqQR68t9mrVZ3y5r3/ZMSZY++ZckIAJYwb2GGD3gg=", "bid"=>{"bid_price"=>"200", "questions"=>""}, "commit"=>"Create Bid", "load_id"=>"25"}
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 15 LIMIT 1
Load Load (0.2ms) SELECT "loads".* FROM "loads" WHERE "loads"."id" = $1 LIMIT 1 [["id", "25"]]
(0.1ms) BEGIN
SQL (0.5ms) INSERT INTO "bids" ("bid_price", "created_at", "load_id", "questions", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["bid_price", #<BigDecimal:100f144c8,'0.2E3',9(18)>], ["created_at", Fri, 20 Apr 2012 02:07:54 UTC +00:00], ["load_id", 25], ["questions", ""], ["updated_at", Fri, 20 Apr 2012 02:07:54 UTC +00:00], ["user_id", 15]]
(0.3ms) COMMIT
Redirected to http://localhost:3000/loads/25/bids/8
Completed 302 Found in 424ms (ActiveRecord: 5.9ms)
Started GET "/loads/25/bids/8" for 127.0.0.1 at 2012-04-19 22:07:54 -0400
Processing by BidsController#show as HTML
Parameters: {"load_id"=>"25", "id"=>"8"}
Load Load (0.3ms) SELECT "loads".* FROM "loads" WHERE "loads"."id" = $1 LIMIT 1 [["id", "25"]]
Bid Load (0.2ms) SELECT "bids".* FROM "bids" WHERE "bids"."load_id" = 25 AND "bids"."id" = $1 LIMIT 1 [["id", "8"]]
User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" = 15 LIMIT 1
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 15 LIMIT 1
Rendered bids/show.html.erb within layouts/application (4.3ms)
Rendered layouts/_header.html.erb (0.9ms)
Rendered layouts/_footer.html.erb (0.9ms)
Completed 200 OK in 44ms (Views: 40.5ms | ActiveRecord: 0.9ms | Sphinx: 0.0ms)
Then we have the following load:
SELECT "loads".* FROM "loads" WHERE "loads"."id" = $1 LIMIT 1 [["id", 25]]
=> #<Load id: 25, commodity: "Coca-Cola", price: #<BigDecimal:103fb82c8,'0.4E3',9(18)>, weight: 30000, notes: "", created_at: "2012-04-17 22:41:53", updated_at: "2012-04-17 22:41:53", distance: 2733.36707093163, truck_type: "53' Dry Van", latitude: 0.651560856964623, longitude: -2.12983434097684, user_id: 5, delta: false, current_asking_price: nil>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment