Displaying 20 results from an estimated 2000 matches similar to: "uninitialized constant Product"
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
2006 Feb 28
3
Agile Web Development Example Application Question
I''m new to Ruby and to fairly new to programming. I''ve been working
through the "Agile Web Development with Rails" book, and I''m stuck on page
73 of the print version. The book''s online errata directed me here with my
questions.
I''m running Ruby 1.8.3 with MySQL 4.1.8 on OSX 10.3.9. I''ve created the
scaffolding for Admin controller
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 Jan 27
4
testing for nil numeric value in find
In the agile/rails tutorial book the following construct is added
to products.rb.
def self.salable_items
find( :all,
:conditions => "date_available <= now()",
:order => "date_available desc")
end
Now, I wish to extend :conditions => to exclude products that have
a nil value for the price. I have tried different syntax
2006 Aug 04
6
Errors ... errors and errors.
I bought the second edition of the ruby on rails, it seems to work fine
now, did some adjustments to the code. But now I get a second error and
I want 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
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 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
2006 Jan 11
6
Help -- NoMethodError in
Hi,
I am just learing Rails and I am going 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''
2006 Feb 12
0
no method error - you have a nil object....
hi,
i''ve been cracking my head on this one for a while and would be humbly
grateful for any pointers
i''m working through Agile Web Devopment w Rails and, in the depot
example have created the cart class for session handling, but am getting
the following error, which suggests the @items variable is not being
populated with any data from LineItem
NoMethodError (You have a
2006 Aug 07
4
Unit testing diffculty
ok, let me show you my "products" fixtures file:
ram:
id: 1
title: RAM
description: ECC RAM Registered, 512MB
image_url: images/test.jpg
price: 29.95
date_available: 2005-01-25 00:00:00
busted_arsehole:
id: 2
title: Busted Arsehole
description: I have an arsehole, it is-e busted
image_url: images/test.jpg
price: 999.95
2007 Oct 19
14
Agile Web Development Book, need a bit of help
I''m working my way through the book Agile Web Development with Rails,
and I am in the section where the book has me creating a display_cart
method and the associated view. When I copied the code from the book
into the view, it threw this error. If anyone could give me some hints
where I should be looking I''d appreciate it.
NoMethodError in Store#display_cart
Showing
2006 Jul 03
2
Agile Web Dev on Rails - ActiveRecord::RecordNotFound Prob
Hi there
I''ve also made a start on the Agile Web Dev using Rails book! I''ve been
hit with a problem when hitting the ''Add to Cart'' button - I get the
following error message:
ActiveRecord::RecordNotFound in StoreController#add_to_cart
Couldn''t find Product without an ID
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full
2006 Mar 04
2
unittest, not loading yml data
Here is my products.yml
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: /images/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
automation_book:
id: 2
title: Pragmatic Project Automation
description: How to automate your project
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
I''m working on building the shopping cart in the Depot tutorial in the
Agile Web Development book. I''m at the part (about page 80) where you
build the ability to add items to the cart. I''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
2006 Jan 30
2
Cannot see what I have done wrong.
In the Agile Rails tutorial I am revisiting building a cart. I have
followed the steps given in the book to create the class ''Cart''
thus:
class Cart
attr_reader :items
attr_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
2006 Jun 08
19
Agile Web Dev (book) question: errors
This is kind of frustrating (but no doubt helpful in the long run) that
after following along and coding , and d/l the code the same error is
appearing.
For those who are familiar with the depot app, I''ve run into a problem after
fixing the cart to reflect quanitites. I worked through the intended error
messages but now have this appearing:
SyntaxError in StoreController#add_to_cart
2006 Apr 26
1
rake db_schema_dump make syntax error
rake migrate bug with datetime:
> rake db_schema_dump
produced a bad schema.rb that isn''t valid ruby, it has an invalid default, unless ruby
takes bare words:
t.column "date_available", :datetime, :default => Sun Jan 01 00:00:00 Arabic Standard
Time 2006, :null => false
I don''t think the Baghdad time zone should matter.
ruby 1.8.4, rails 1.1.2,
2005 Dec 31
2
Test Unit Problem
Hello All,
I am experiencing the following test unit error working with Rails that
I can''t fathom.
I have a products.yml file which holds the following test fixture for
the products table:
dell_pc:
id: 1
title: Dell PC
description: Dell PC
image_url: http://.../pc_image.jpg
price: 15000.00
date_available: 2005-12-31 06:53:00
I also have the following product_test.rb file to
2009 Apr 06
11
How do I fix this? Power went down.
I was successful in reaching page 184 in the book "Agile Web
Development with Rails" 3rd edition and while running the website with
PostGreSQL as the backend, the power went down. The PostGreSQL
database contents look OK and so do the source code files I was
editing. But whenever I click on any "Add To Cart" button in the
catalog, I get the following information in the
2006 Apr 30
1
no such file to load -- net/https
Hi,
Came across the substruct project and decided to download and play with
it. Am running rails 1.1.2 with ruby 1.8.4 on Ubuntu.
I start webrick .. went to the admin section of the store. Create a
product. Went to the store section and put this product in my cart and
then clicked on checkout. I fill the form and submit it . I click on
the "Finish Order" button and get the following