Displaying 20 results from an estimated 6000 matches similar to: "Instance variable?"
2006 Apr 11
2
Extending Depot Example
Hi
I am new to the whole Rails/Ruby world as having come from a MS .NET
background, but I have followed the Depot example in the Agile Web Dev.
with Rails book with relative ease. However as an exercise to see how
much I had understood, I thought I would attempt to modify the example a
bit and add a Quantity field to the store index so as to pass that value
into the cart. I have extended the
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,
2005 Dec 24
2
Common menu
Hi,
I''m releasing my first rails application and I''d like to have a common
menu in all my templates.
Do I have to include an rhtml from .rb or other rhtml ? Some sample code pls
?
Regards,
Fabian
2008 Mar 13
2
Loading an array of MiddleMen
Hi,
I am currently working on a project that requires multiple rails
applications (lets call them consumers, since they will consume
requests) to exposes long running services that will be executed from
a management rails application (the producer of the requests). To do
this BackgrounDrb was installed on all the consumers and the producer.
BackgrounDrb was configured to on each of the consumers
2006 Aug 07
2
Newbie question about adding product to cart
Hello. I''m using the Agile Web Dev. book 1st Edition and I''m puzzled by
the code on pp. 83-84.
<%= link_to ''Add to Cart'', {:action => ''add_to_cart'', :id => product },
:class => ''addtocart'' %>
def add_to_cart
product = Product.find(params[:id])
@cart = find_cart
2006 May 17
6
newbie wants to know..FasterCSV or just CSV?
I''m trying to grab a CSV file from a user and let them upload it
directly to my database, but doing some minor checks on the data before
saving. Which is the easier way to implement this? CSV or FasterCSV? I
saw that perhaps there were some issues with FasterCSV and csv files
created from Mac versions of Excel.
Anyone have any experience with this and can recommend a newbie friendly
2006 Jan 13
2
Problem
Hi. I''m doing a tutorial from the Thomas~Hansson book and am getting this
error message:
Extracted source (around line #17):
14: <%= link_to ''Add to Cart'',
15: {:action => ''add_to_cart'',
16: :id => product },
17: class => ''addtocart'' %>
18: </br>
19: </td>
20:
2005 Dec 19
1
<% unless params[:context] == :gallery -%> question
I have a template that is called by two different methods. I only want
part of it too show up when it is called from one of the methods. It
always shows up for me. Can someone help to point out my error? Below
is the method that should keep part of the tempate from printing, and
the relevent part of the template.
method:
def gallery
@product_pages,@products = paginate(:products,
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless
2006 Apr 24
3
Form with multiple rows of content
I have looked at examples for this. I found a similar example in the
Agile Web Dev... book but that didn''t help. Here''s what i am trying to
do.
A Cart has many line items. On the Display Cart page, I want to provide
the user the option to update quantities.
Here''s the rhtml code:
<%= start_form_tag :action => ''update_cart'' %>
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
2009 Feb 18
3
wrong number of arguments (1 for 0)
Hello,
I am new to ruby on rails. When I tried to create a session I am
getting an error, ''wrong number of arguments (1 for 0)'', in my
controller.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArgumentError in CustomerController#add_to_cart
wrong number of arguments (1 for 0)
RAILS_ROOT: /project/bob_shopping
Application Trace | Framework Trace | Full
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 15
3
update or alter cart
I want to modify and update the items in the Depot - "display_cart".
Since the cart is in a session, its a little hard to get at the data.
I just want to create a way to change quantities, prices and
recalculate.
Has someone done this, and could you point me to the right direction.
Thanks
Chas
--
Posted via http://www.ruby-forum.com/.
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
2005 Dec 25
2
[repost] newbie questions
Hi all,
I''m following the shop example in ''Agile Web Development with Rails''.
I would like to extend the checkout screen, in such a way people can change
the number of items they have selected in there cart.
In my controller I have:
def checkout
@cart = find_cart
@items = @cart.items
if @items.empty?
2006 Jul 28
15
Store/product stock design question
Hi all,
I''m having trouble figuring out how to handle stock levels in a new
store I''m building. When products are entered into the admin of the
store, they have a stock number associated with them.
What I''m not sure about, is how I go about maintaining this stock
level. Take this scenario:
1. User A adds an item to their cart, and I check that it''s in stock -
2007 Aug 30
3
Rails - depot application
I''m doing the depot example in the Agle Web development book. I''m
getting this error:
"undefined method `product'' for #<BigDecimal:331ce70,''0.21E1'',8(8)> "
"Extracted source (around line #9):
8: for item in @items
9: product = item.product
10: -%>
11: <tr>
12: <td><%= item.product%></td>"
2008 Oct 11
8
Observing few fields in a form - Best Practise?
Hi,
im looking to build a page similar to a shopping cart page. When you
change the ''price'' or ''quantity'' fields, the total is calculated and
displayed.
There are other fields in the form which have no relation to this
action. So i guess observe_form is not required. Can someone tell me
what the best practise is for this?
2006 Feb 03
7
how to add multiple new records from one form
I''m trying to provide our customers with a page where they can add up to
20 items to their cart in one form. The form simply has 20 rows with
each row containing a text input for product code and a text input for
quantity.
I''ve tried having the controller create an array that has an object for
each row by looping through something like:
@new_items[1] = Cart.new
and the