search for: store_control

Displaying 20 results from an estimated 49 matches for "store_control".

Did you mean: store_controler
2006 Jan 24
3
Unitialized constant
...Agile Web Development with Rails, I get this error when adding a product to my cart: uninitialized constant Cart ... Application Trace: /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:200:in `const_missing'' ./public/../config/../app/controllers/store_controller.rb:21:in `find_cart'' ./public/../config/../app/controllers/store_controller.rb:9:in `add_to_cart'' This error occured while loading the following files: cart.rb Any ideas what I did wrong? I can''t find a problem with "find_cart" or "add_to_car...
2009 Apr 06
11
How do I fix this? Power went down.
...1+w=", "id"=>"1"} Product Load (1.0ms) SELECT * FROM "products" WHERE ("products"."id" = 1) NoMethodError (You have a nil object when you didn''t expect it! The error occurred while evaluating nil.add_product): app/controllers/store_controller.rb:9:in `add_to_cart'' /usr/lib/ruby/1.8/mongrel.rb:159:in `process_client'' /usr/lib/ruby/1.8/mongrel.rb:158:in `each'' /usr/lib/ruby/1.8/mongrel.rb:158:in `process_client'' /usr/lib/ruby/1.8/mongrel.rb:285:in `run'' /usr/lib/ruby/1.8/mongrel.rb...
2006 Aug 17
10
Expected ... to define ...
Hi, I have edge frozen on vendor, and getting these errors logged: Expected ../config/../app/controllers/store_controller.rb to define StoreController ../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:177:in `load_missing_constant'' ../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:275:in `const_missing'...
2006 Mar 06
5
Rails MySQL query
Hi, I?m following the Depot tutorial in Agile Web Development with Rails. I need some help to display products thats in one specific category. mysql> select * from products where category = "jackets" does what I want, but I?m not sure how to make a list and display it in rails? This code displays every product with some of its fields, but I want it to only display the products
2006 Feb 12
0
no method error - you have a nil object....
...ble is not being populated with any data from LineItem NoMethodError (You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.<<): /app/models/cart.rb:12:in `add_product'' /app/controllers/store_controller.rb:10:in `add_to_cart'' i''ve triple-checked the code, and found the error in the book through the errata, but really am stumped by this error. any suggestions on good troubleshooting techniques . i have tried rake - which says it can''t connect to mysql through the s...
2006 Dec 04
3
uninitialized constant Product
I am actually following the instructions/code snippets from "Agile Web Development with Rails" and got as far as page 73 where I did ruby script/generate controller Store index, then edited store_controller.rb to class StoreController < ApplicationController def index @products = Product.salable_items end end and product.rb to: def self.salable_items find(:all, :conditions => "date_available <= now()", :order => "date_available desc") en...
2006 Feb 28
3
Agile Web Development Example Application Question
....3 with MySQL 4.1.8 on OSX 10.3.9. I''ve created the scaffolding for Admin controller and entered three sample products. I typed the examples to build the Store controller carefully and finally just copied them from what the book''s Web site supplies. So now I have: app/controllers/store_controller.rb> class StoreController < ApplicationController def index @products = Product.salable_items end end and in the app/models/product.rb I have the new piece of code ____snip____ def self.salable_items find(:all, :conditions => "date_available <= now...
2006 Jan 11
6
Help -- NoMethodError in
...g through the Agile Web Development with Rails book. I am receiving: NoMethodError in Store#add_to_cart undefined method `add_product'' for #<StoreController:0x3764d80> RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/store_controller.rb:12:in `add_to_cart'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `send'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in `perform_action_without_filters'' c:/ruby/lib/ruby/gems/1.8/gems/a...
2006 Apr 18
4
''depot'' tutorial failing on adding to cart
Hi I''m very keen to learn RoR and have been following the Agile Web Development with Rails book (first edition). However, I''ve come across a problem which has had me stumped for days now. After following the instructions up to page 85 I have tried testing the code thus far, as suggested, by adding an item to the cart. But I am getting the following error: --
2006 Aug 04
6
Errors ... errors and errors.
...to learn to understand to fix them myself. So here is the error. ArgumentError in StoreController#add_to_cart wrong number of arguments (1 for 0) #{RAILS_ROOT}/app/models/cart.rb:15:in `initialize'' #{RAILS_ROOT}/app/models/cart.rb:15:in `add_product'' #{RAILS_ROOT}/app/controllers/store_controller.rb:19:in `add_to_cart'' -e:4 Now, it says as far as I understand it, that it should need 0 arguments instead of 1. But that should be quite impossible, beacause the cart.rb has a def add_product(product) as we shall see later. I do not understand why it gives me that error. Here is t...
2005 Sep 02
4
Error has me stumped (Agile Web Dev with Rails book)
Hello everyone, I''m a complete Rails newbie who is currently working my way through the Agile Web Dev with Rails book. I''ve reached the chapter on creating the shopping cart (chapter 8). I keep having a problem with the same error which I can''t get past, however what''s more confusing is that it''s being generated even when I swap all my app code out
2006 Jun 23
3
Yet another problem with NoMethodError in Store#display_cart
...instance of Array. The error occured while evaluating nil.size Extracted source (around line #4): 1: <h1>Display Cart</h1> 2: 3: <p> 4: Your cart contains <%= @items.size %> items. 5: </p> <--- end error here ---> Here is a copy/paste of my code: <--- file store_controller.rb begin here ---> class StoreController < ApplicationController def index @products = Product.salable_items end def add_to_cart product = Product.find(params[:id]) @cart = find_cart @cart.add_product(product) redirect_to(:action => ''display_c...
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
...#39;'m able to get to /store/display_cart/ and it seems items are being added, but if I just click on a link to add an item (/store/add_to_cart/2) it gives me this: NoMethodError in Store#add_to_cart #{RAILS_ROOT}/app/models/cart.rb:10:in `add_product'' #{RAILS_ROOT}/app/controllers/store_controller.rb:11:in `add_to_cart'' Any ideas? Here are various bits of code: =============================== #store_controller.rb class StoreController < ApplicationController def index @products = Product.salable_items end def add_to_cart product = Product.find(params[:id])...
2006 Jan 30
2
Cannot see what I have done wrong.
...r_reader :total_price def add_product(product) @items << LineItem.for_product(product) @total_price += product.price end def initialize @items = [] @total_price = 0.0 end end ~ "app/models/cart.rb" I have wired together the other bits in app/controllers/store_controller.rb and app/models/line_item.rb class StoreController < ApplicationController def add_to_cart product = Product.find(params[:id]) @cart = find_cart @cart.add_product(product) redirect_to(:action => ''display_cart'') end def display_cart @cart = f...
2008 Apr 15
2
NoMethodError in StoreController#add_to_cart
...ler#add_to_cart 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.<< E:/InstantRails/rails_apps/depot/app/models/cart.rb:9:in `add_product'' E:/InstantRails/rails_apps/depot/app/controllers/store_controller.rb: 8:in `add_to_cart'' ------------------------------------------------------------------ The contents of cart.rb: --------------------------------------------- class Cart attr_reader :items def initialize @items = [] end def add_product(product) @itmes << product deb...
2006 Jul 03
2
Agile Web Dev on Rails - ActiveRecord::RecordNotFound Prob
...ork Trace | Full Trace D:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:939:in `find_from_ids'' D:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:382:in `find'' #{RAILS_ROOT}/app/controllers/store_controller.rb:11:in `add_to_cart'' It seems to me that the id of the item is not been passed in - my storecontroller code looks like this: # add a product to the cart def add_to_cart @cart = find_cart @product = Product.find(params[:id]) @cart.add_product(@product) end It'...
2005 Dec 25
2
SOAP Client Connections
...rectory, but it looks almost as if it is looking for it relative to the base directory. The reason I say this is that later on in the error screen I get this: -------------------------------------------- |This error occured while loading the following files: ./script/../config/../app/controllers/store_controller.rb |amazon|_api.rb |-------------------------------------------- This leads me to believe that the first file is being called relative to that directory, but the second is being called from inside the base directory. Now my question is, could it be possible that the environmental variable fo...
2005 Aug 04
7
Frames within rails
What is the best way to create frames in rails? thanks fp
2006 Jun 07
8
erb Regex ?
Hi Got a column named ''sku'' in a table named ''product'' <%= product.sku %> ...looks like this.... ''1234_56'' These last two chars (56) are an audio Track number. I ultimately want to display: Track <%= product.sku %> I can isolate the first part with /\d+\_/ = 1234_ But can''t figure out how to get the last two
2006 Aug 06
6
Having Problem w/ Agile Web Development book
I get this error ... NoMethodError in StoreController#index undefined method `salable_items'' for Product:Class and here is my store_controller.rb ... class StoreController < ApplicationController def index @products = Product.salable_items end def self.salable_items find(:all, :conditions => "date_available <= now()", :order => "date_available desc") end end What am I doing wrong? --...