Displaying 20 results from an estimated 47 matches for "storecontroller".
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(...
2007 Oct 15
4
ArgumentError in StoreController#add_to_cart: wrong number of arguments (1 for 0)
...ng
to get the shopping card working from the book. I am getting this
error but I really don''t know what to do. I have looked up several of
topics that stated the same problem but as far as I am, nothing has
helped me out yet. Is there something wrong with the Product model?
This is in the StoreController and I believe it is all good.
def add_to_cart
@cart = find_cart
product = Product.find(params[:id])
@cart.add_product(product)
end
Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups &q...
2008 Jul 10
5
Uninitialized constant (controller/model)
NameError in StoreController#add_to_cart
uninitialized constant StoreController::Cart
This is the controller:
class StoreController < ApplicationController
def index
@products = Product.find_products_for_sale
end
def add_to_cart
@cart = find_cart
product = Product.find(params[:id])
@cart.add_produc...
2008 Apr 15
2
NoMethodError in StoreController#add_to_cart
I''m trying to set up the Depot app from Agile Web Development and I
got this error after C1 - Creating a Cart.
The exact error looks like this:
-------------------------------------------------------------------
NoMethodError in StoreController#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/sto...
2009 Apr 23
0
NoMethodError in StoreController#add_to_cart
Working through the Agile Web Development w/ Rails book on p114. I can
add single items of each to the cart but when I try to add a second item
I get the following error:
NoMethodError in StoreController#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.+
Any idea why this is happening? Thanks.
Frank.
--
Posted via http://www.ruby-forum.com/.
2010 Jun 20
1
NoMethodError in StoreController#add_to_cart -> getting nil
Hey everybody,
I am currently following the depot application from the book Web Agile
Development with Rails (3rd Edition) but after creating the controller
for the Store and the Cart model, I am always getting a nil product, no
matter how many products I add to the database.
I am very new with RoR (this only the page 110 of the book) and thus I
am not very sure about what I could do to mitigate
2006 Apr 20
0
problem in "depot" app - cart contents not shown on checkout
...rom Apachefriends
XAMPP.
Here is a snippet of the log file, where I add an item to an empty cart
and then show the order page. You can see where I noticed something odd
below. It appears that the cart is not getting loaded in display_cart()
when in the context of the order page:
Processing StoreController#add_to_cart (for 127.0.0.1 at 2006-04-20
02:02:07) [GET]
Session ID: 90352668088f989d5f939978b52b2a3a
Parameters: {"action"=>"add_to_cart", "id"=>"4",
"controller"=>"store"}
Product Load (0.132395) SELECT * FROM products...
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 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/...
2006 Feb 07
11
Possible Rails Security Issue?
...s to be addressed? If so, what''s the
correct way to escalate it? At the very least, I think there should
be clear warnings and documentation about this fact.
Kevin Skoglund
------
Here''s a sample from my log with the personal information stripped
out by hand:
Processing StoreController#checkout (for xxx.xxx.xxx.xxx at
2006-02-06 09:38:27) [GET]
Parameters: {"action"=>"checkout", "controller"=>"store"}
Rendering within layouts/store
Rendering store/checkout
Start rendering component ({:action=>"display_cart"}):
Proc...
2006 Jun 08
19
Agile Web Dev (book) question: errors
...at
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
app/models/cart.rb:15: parse error, unexpected $, expecting kEND
Not sure where to turn to figure this out being a newb.
TIA
Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060608/93f630...
2006 Aug 18
0
AJAX question
Dear all,
Help me get a simple AJAX behavior right. I know zero AJAX, thus
please advice. Below is a simplification of the real code and I hope
I can describe my intention clearly.
class StoreController < ApplicationController
def show_cart
@cart = Cart.new
@new_item = CartItem.new
end
def add_item
@new_item = CartItem.new(params[:new_item])
if @new_item.valid?
@cart.items << @new_item
# execute add_item.rjs
else
breakpoint
re...
2006 Aug 18
0
Simple AJAX question
Dear all,
Help me get a simple AJAX behavior right. I know zero AJAX, thus
please advice. Below is a simplification of the real code and I hope I
can describe my intention clearly.
class StoreController < ApplicationController
def show_cart
@cart = Cart.new
@new_item = CartItem.new
end
def add_item
@new_item = CartItem.new(params[:new_item])
if @new_item.valid?
@cart.items << @new_item
# execute add_item.rjs
else
breakpoint
render :partia...
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")
end
but it keeps showing this er...
2006 Apr 18
4
''depot'' tutorial failing on adding to cart
...(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:
--
NoMethodError in StoreController#add_to_cart
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.<<
--
I''ve been testing in Firefox to ensure that the cookie is being
created (it appears to be OK). Does anyone know what I&...
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''
../config/../vendor/rails/act...
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 `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, tha...
2006 Jan 30
7
"x" and "y" values in a form_tag
Hi,
I have some strange output in my log file, where I am sending information
via a form to the database, eg:
<-- snip -->
Processing StoreController#add_var_product (for 127.0.0.1 at 2006-01-30
12:30:19) [POST]
Parameters: {"size"=>{"id"=>""}, "x"=>"44", "y"=>"11",
"action"=>"add_var_product", "controller"=>"store"}
&l...
2006 Jul 03
2
Strange local requests with Apache 2.2, mod_proxy_balancer, and Mongrel 0.3.13.2
Hello all,
My Rails app is logging some rather strange requests:
Processing StoreController#index (for ::1 at 2006-07-03 13:18:48) [GET]
Session ID: ed5e2a0e5b4b9290835a969cdd749e6e
Parameters: {"action"=>"index", "controller"=>"store"}
Completed in 0.08174 (12 reqs/sec) | Rendering: 0.07951 (97%) | DB:
0.00000 (0%) | 200 OK [http://127.0....
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''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.rb:853:in
`send''
c:/ruby/lib/ruby/ge...
2005 Dec 25
2
SOAP Client Connections
...interface to pull
down data, that would be great. Currently I''m trying to port an
application from PHP to Rails (for purely educational reasons) and can''t
seem to get past this hump.
Here''s my controller definition:
--------------------------------------------
class StoreController < ApplicationController
web_client_api :amazon,
:soap,
"http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl",
{:Service => ''AWSECommerceService''}
def index
end
end
-------------------...