NEWBIE - Agile Web development Book - posting #3

1). regarding the book book "agile web development with rails 2nd edition" , I am now on chapter 8, Task C+: Cart Creation, and I have encountered a new bug in following the material.

as the book instructs, in order to resolve an migration issue to display my depot application, I need to clear the session.So as instructed , i issue the command ;

C:\rails\depot>rake db:sessions:clear

2). what i get is :

(in C:/rails/depot) rake aborted! Mysql::Error: #42S02Table 'depot_development.sessions' doesn't exist: DELETE FRO M sessions

(See full trace by running task with --trace)

C:\rails\depot>

3). i researched previous postings on this, and found something interesting from a "Peter Vandenberk" who writes:

Email: joe <rails-mailing-l...@andreas-s.net> Not yet rated Rating: show options Reply | Reply to Author | Forward | Print | Individual Message | Show original | Report Abuse | Find messages by this author

Peter Vandenberk wrote:

That syntax is now deprecated in favor of adding the following declaration in your model file:

include Reloadable

See also: http://clarkware.com/cgi/blosxom/2006/03/28

Let us know how it goes! :slight_smile:

Peter

3). THIS SOUNDS LIKE A SOLUTION , BUT I AM NOT SURE WHERE TO POST THIS COMMAND IN THE MODELS. AND I CANT REPLY TO HIS POSTIGN BECAUSE ITS 30 DAYS OLD, AND GOOGLE WONT ALLOW IT.

4). WHAT CAN I DO ? WHY ISNT THE RAKE COMMAND WORKING? WHERE DO I ISSUE TEH CODE SNIPPET - "INCLUDE RELOADABLE " TO GET IT TO WORK.

(in C:/rails/depot) rake aborted! Mysql::Error: #42S02Table 'depot_development.sessions' doesn't exist: DELETE FRO M sessions

I don't have my copy of the AWDWR book on this computer, but if memory serves, you need to do:

  rake db:sessions:create   rake db:migrate

Before the sessions table will exist, and thus, before you can clear it.

-- Tammy

1). book doesnt inmention your suggestion , but i tried it anyway. Here is what i get :

C:\rails\depot>rake db:sessions:clear (in C:/rails/depot) rake aborted! Mysql::Error: #42S02Table 'depot_development.sessions' doesn't exist: DELETE FRO M sessions

(See full trace by running task with --trace)

C:\rails\depot>rake db:sessions:create (in C:/rails/depot)       exists db/migrate       create db/migrate/004_add_sessions.rb

C:\rails\depot>rake db:sessions:migrate (in C:/rails/depot) rake aborted! Don't know how to build task 'db:sessions:migrate'

(See full trace by running task with --trace)

C:\rails\depot>rake db:sessions:clear (in C:/rails/depot) rake aborted! Mysql::Error: #42S02Table 'depot_development.sessions' doesn't exist: DELETE FRO M sessions

(See full trace by running task with --trace)

C:\rails\depot>

2). PLEASE HELP , PROBLEM NOT RESOLVED YET. WHY DOE IT SAY 'DEPOT DEVELOPMENT.SESSIONS DOESNT EXIST', HOW CAN I RESOLVE?

1). PLEASE DISREGARD MY LAST REPONSE. TAMMY'S SUGGESTION MADE ME REALIZE THAT I MISSED THE BEGININNG OF THE SECTION OF TASK C , AND SO DIDNT FOLLOW SOME OF THE BEGINNING WORK .

I SHOULD HAVE NO MORE PROBLEMS WITH 'SESSIONS' ONCE I REVIEW THE ENTIRE SECTION .

STAY TUNED , AND THANKS ...

1) THAT WORKED BUT WHEN I DP I REFRESH ON MY ADD_TO_CART/2 website, I now i get :

NoMethodError in Store#add_to_cart Showing app/views/store/add_to_cart.rhtml where line #10 raised:

undefined method `quantity' for #<Product:0x3916e98>

Extracted source (around line #10):

7: 8: <ul> 9: <% for cart_item in @cart.items %> 10: <li><%= cart_item.quantity %> &times; <%= h(cart_item.title) %></li> 11: <% end %> 12: </ul>

RAILS_ROOT: ./script/../config/..

3). NOT SURE HOW TO HANDLE THIS ONE ....