search for: salable_item

Displaying 16 results from an estimated 16 matches for "salable_item".

Did you mean: salable_items
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_ava...
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 using...
2006 Feb 28
3
Agile Web Development Example Application Question
...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()", :order => "date_available desc") end _____end snip____ When I try to...
2006 Dec 04
3
uninitialized constant Product
...ally 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") end but it keeps showing this error in http://localhost:3000/store/ : NameError in StoreController#index u...
2006 Feb 12
0
no method error - you have a nil object....
...@items << LineItem.for_product(product) #uses helper class method "for_product" in model: line_item.rb, which creates a line_item based on a given product @total_price += product.price end end ===== class StoreController < ApplicationController def index # calls salable_items function in the controller to create a list of items that are available for sale depending on date @products = Product.salable_items end def add_to_cart # method to add product with :id to the cart with redirect to display product = Product.find(params[:id]) @cart = find_cart...
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 Apr 20
0
Please help me !
Hi To This Group! I am new to ROR I have some problem in varible acessing in the rb file. I worte the def in the strored controller .rb def products_cat $rid=params[:id] @categories = Category.salable_items @products_id = Product.find(params[:id]) @products = Product.salable_items1(params[:id]) flash[:notice] = "Succesfully" end I want to acess the varible that is in nthe product.rb file that is model def self.salable_items1(rid) find(:all, :conditions => "cat_id =...
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
...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]) @cart = find_cart @cart.add_product(product) redirect_to(:action => ''display_cart'') end def display_cart @cart = find_cart @items = @cart.items end private def find_cart session[...
2006 Jan 30
2
Cannot see what I have done wrong.
...troller 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 = find_cart @items = @cart.items end def index @products = Product.salable_items end private def find_cart session[:cart] ||= Cart.new end end ~ "app/controllers/store_controller.rb" ******* class LineItem < ActiveRecord::Base belongs_to :product def self.for_product(product) item = self.new item.quantity = 1 item.product = product...
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 Jun 23
3
Yet another problem with NoMethodError in Store#display_cart
...t</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_cart'') end def diplay_cart @cart = find_cart @items = @cart.items end private def find_cart...
2006 Jan 19
0
file_column error: tmp file created but not actual
...:with => %r{^http:.+\.(gif|jpg|png)$}i, # :message => "must be a URL for a GIF, JPG, or PNG image" # Return a list of wallpapers we can sell (which means they have to be # available). Show the most recently available first. def self.salable_items find(:all, :conditions => "date_available <= now()", :order => "date_available desc") end protected # Validate that the wallpaper price is a positive Float. #def validate #:doc: # errors.add(:price, "should be positive&quo...
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 02
7
Same error ... again.
...lt;/td> <td align="right"><%= item.unit_price * item.quantity %></td> </tr> <% end -%> </table> [CODE] My store_controller.rb in app/controllers/ is: [CODE] class StoreController < ApplicationController def index @products = Product.salable_items #salable items defined in product.rb end #model 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 = fi...
2005 Dec 30
1
Problems with Testing (Depot) demo app in Agile Rails book
.../mysql_adapter.rb:171:in `select_all'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:431:in `find_by_sql'' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:395:in `find'' #{RAILS_ROOT}/app/models/product.rb:12:in `salable_items'' #{RAILS_ROOT}/app/controllers/store_controller.rb:6:in `index'' Request Parameters: None Show session dump --- :user_id: flash: !ruby/hash:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"} ~~...
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''