Displaying 20 results from an estimated 8000 matches similar to: "uninitialized constant Cart::CartItem"
2007 Oct 18
0
REST help
Hi all,
I am trying to build a RESTful shopping cart and I have hit a small
wall, but before I get to that let me explain what I have done thus far.
I have two RESTful controllers, CartController and CartItemsController
with a nested routes setup like so
map.resources :carts do |carts|
carts.resources :cart_items, :collection => {:empty => :delete}
end
(I added a custom route to
2006 Jul 24
1
Newbie error: undefined local variable or method
When I add an item to the shopping cart, I get an error:
undefined local variable or method `cart_item'' for
#<#<Class:0x3715a78>:0x3715a48>
Session info says the cart being updated properly. I''m just not able
to output two variables:
<%= cart_item.quantity %> × <%= h(cart_item.title) %>
I did some research, and I can grasp that local
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 Feb 27
1
Nested hash from form params into create()?
Hi,
I''m really excited about getting the create() method working on a
nested hash. The Rails book make it seem like I''m close to doing the
right thing but I think something very small is not quite right. The
error at the below isn''t giving any hints that I understand.
I have a form that produces a nested params hash and sends it to my
add_to_cart controller method.
2006 Jul 10
2
cross controller functional tests?
Hi,
I have an online store and I would like to simulate a complete
shopping trip which involves several controllers? How can I write a
test that calls actions from different controllers in a particular
sequence? Something like the following which involves department,
product, cart_item, and cart controllers.
get department 5
check it has a link to product 4
get product 4
post cartitem/create
get
2006 Jul 03
0
Page 129 of Agile Web Dev on Rails (or pg141 of pdf!)
Hi - another question, sorry....
I''m trying to get the highlighting effect to work on the current_item.
The page refreshes fine, and then I get an error as the highlighting
code is fired:
page[:current_item].visual_effect :highlight,
:startcolor => "#88ff88",
:endcolor => "#114411"
The error
2010 Oct 11
0
undefined method `includes_values' for :conditions:Symbol
Rails 3 / Ruby 1.9.2
Over the weekend I saw the "undefined method `includes_values''
for :conditions:Symbol" error for the 1st time while working with
AAF.
http://j-k.lighthouseapp.com/projects/45560-acts-as-ferret/tickets/176-aaf-051-undefined-method-includes_values-for-conditionssymbol#ticket-176-4
Anyway, i fixed the query and moved on.
Today I hit the error again but I
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,
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
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?
2006 Jun 26
5
Newbie question about Agile Rails book - Delete from cart
I have been working through the Agile Web Development with Rails book
doing the Depot tutorial. I have completed it and it works but I cant
say I understand how and why.
My question is this "After adding products to the Cart, how do I then
give users the option to delete just one item and not empty the whole
cart?"
I''ve been playing around with all sorts of code, just making
2006 Jan 10
5
using dynamic element ids with visual_effect
Mike and I demo an Ajaxified version of the Depot application in the
Rails Studio. Part of the demo is a cart in the sidebar which updates
when you add a product to it. As well as updating the div, it also
highlights the most recently added link item. Right now, we do it with:
<script language="JavaScript">
function flash_cart(request) {
var id =
2008 Oct 24
4
Railscast 75, Observe_field and Shopping Cart
Hi all,
I have the shopping cart page where a user can add items dynamically
through ajax as explained in Railscast episode 75. I am using
observe_field to observe the ''quantity'' and ''cost'' fields to update
the total field for each item.
This does not work however, for records that are added through the
Ajax. How can i name the fields and observe them as i have
2007 Sep 14
0
deal with Controller and Action logic in RJS?
The question is, should we deal with Controller and Action logic in the RJS
file? If so, is it quite "spaghetti-like"?
This is actually for the Agile Web book Shopping Cart example:
If the user clicks "Remove Item" and we do it the AJAX way,
what if we want to first show the cart''s content as
0 x Pragmatic Version Control $0.00
and then highlight
2005 Oct 15
1
uninitialized constant errors?
Running with WEBrick, I seem to be occasionally
getting these odd "uninitialized constant XXX" errors.
Where the XXX is the first class that whatever action
I run uses (e.g. Product, CartItem etc).
>From the backtrace, it looks almost like the server is
somehow trying to reinitialize?
Any thoughts?
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_product(product)
end
private
def find_cart
session[:cart] ||=
2007 Oct 15
4
ArgumentError in StoreController#add_to_cart: wrong number of arguments (1 for 0)
I am really new to Ruby and Rails but as you probably see I am trying
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
2007 Aug 17
1
Need volunteers for new Rails based shopping cart
We''re currently looking for volunteers on the new RailsCart[1]
project. The idea is to build something relatively simple with all of
the features that most open source shopping carts seem to be missing.
We''ll be using ActiveMerchant for all of our payment gateway needs.
We''re not trying to build the ultimate shopping cart. This is
designed for Rails developers who need
2005 Oct 05
3
Shopping Cart: SKU and Product Confusion
Hi there,
I''m at a loss...
I was on the #ROR channel last night and spoke to a really helpful person
(Defiler) who gave me some direction on building a shopping cart.
Unfortunately, I wasn''t able to successfully get to where I need to go. This
is the predicament I am currently finding myself in:
I''m building a shopping cart for a client''s new website. They
2005 Dec 14
9
Passing quantity in a shopping cart
I am using this line on my index.rhtml page to capture the quantity
required of a particular item for a basic shopping cart app:
<%= text_field ''line_item'', ''quantity'', {:size=>3} %> </td>
but my next screen (a cart screen) doesn''t reflect what was entered in
that text field when the item is added to the cart. That is,