May 17, 2008
Generic-user-small Casey Smith 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Iteration F2

Thanks Sam I will check that. Is there a place just to get problems answers that I come across?

 
May 16, 2008
Generic-user-small Casey Smith 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Iteration F2

I get an error when I run http://localhost:3000/login/login I get this error message=

NoMethodError in Login#index

Showing login/index.html.erb where line #3 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

Extracted source (around line #3):

1:

Your Pragmatic Catalog


2:
3: <% for product in @products ->
4:

5: <= image_tag(product.image_url) >
6:

<= h(product.title) %>

 
May 13, 2008
Generic-user-small Casey Smith 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Chapter 10.1 - Foreign key constraints with SQLite?

Awesome thanks Sam, I think it worked.

 
May 12, 2008
Generic-user-small Casey Smith 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Chapter 10.1 - Foreign key constraints with SQLite?

Thanks Sam but I am still getting the same error message. I have given the error message again and the text from the file. I am loving Ruby and Rails. Thanks for writing the books and help us noobs out.

C:\rails\work\depot>rake db:migrate
(in C:/rails/work/depot)
5 CreateOrders: migrating ================================================
—create_table(:orders) -> 0.0940s
5 CreateOrders: migrated (0.0940s) =======================================

6 CreateLineItems: migrating =============================================
—create_table(:line_items)
rake aborted!
SQLite3::SQLException: table line_items already exists: CREATE TABLE line_items
(“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, “product_id” integer NOT NULL, “order_id” integer NOT NULL, “quantity” integer NOT NULL, “total_price” decimal
(8,2) NOT NULL, “created_at” datetime DEFAULT NULL, “updated_at” datetime DEFAUL
T NULL)

File:

class CreateLineItems < ActiveRecord::Migration def self.up create_table :line_items do |t| t.integer :product_id, :null => false t.integer :order_id, :null => false t.integer :quantity, :null => false t.decimal :total_price, :null => false, :precision => 8, :scale => 2

t.timestamps
end
end
  def self.down
    drop_table :line_items
  end
end
 
May 12, 2008
Generic-user-small Casey Smith 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Chapter 10.1 - Foreign key constraints with SQLite?

I have a problem when I run “rake db:migrate” after I have created and editied the models “order” and “line_item” on page 140 of Check out. I get:

C:\rails\work\depot>rake db:migrate
(in C:/rails/work/depot)
5 CreateOrders: migrating ================================================
—create_table(:orders) -> 0.0780s
5 CreateOrders: migrated (0.0780s) =======================================

6 CreateLineItems: migrating =============================================
—create_table(:line_items)
rake aborted!
SQLite3::SQLException: table line_items already exists: CREATE TABLE line_items
(“id” INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, “product_id” integer NOT NULL, “order_id” integer NOT NULL, “quantity” integer NOT NULL, “total_price” decimal
(8,2) NOT NULL, “created_at” datetime DEFAULT NULL, “updated_at” datetime DEFAUL
T NULL)

(See full trace by running task with—trace)

Thanks for the help.

5 posts