Displaying 9 results from an estimated 9 matches for "cart_id".
Did you mean:
card_id
2006 Apr 10
4
Many To Many''s Join table attributes + migrations
Hi all,
just joined and have only just kicked off with Rails (coming, but not
departing, from WebObjects development). And so far there seems to be
a lot of promise except for one thing I can''t figure out as yet --
the above problem.
Say I have the following conceptual relationships:
ITEMS <<--->> CARTS
i.e., each item can belong to one or more categories. So really
2007 Oct 17
9
@session['user'] vs session[:user]
...9;] and session[:user] ? and how
would you use each?
And another question, I have the following code:
def get_customer
if @session[''customer'']
@c = Customer.find(@session[''customer''])
end
end
private
def initialize_cart
if session[:cart_id]
@cart = Cart.find(session[:cart_id])
else
@cart = Cart.create
session[:cart_id] = @cart.id
end
end
How do I assign the cart to the logged in customer?
Thanks in advance,
Elle
--~--~---------~--~----~------------~-------~--~----~
You received this message...
2014 May 02
0
What does assign method do in testing ?
*assigns* - _Any objects that are stored as instance variables in
actions for use in views._
(http://guides.rubyonrails.org/testing.html#the-four-hashes-of-the-apocalypse)
I have a code :-
test "should update line_item" do
patch :update, id:@line_item, line_item: {
cart_id:@line_item.cart_id, product_id:@line_item.product_id}
assert_redirected_to line_item_path(assigns(:line_item))
end
Does *assigns(:line_item)* give back an instance of the model _LineItem_
? I am bit confused with the use of the method *assigns*.
--
Posted via http://www.ruby-forum.com/.
-...
2007 Sep 22
0
How to DRY up controller action spec with different params.
...DRY-ed up code (certainly in the examples), but those long blocks make the
controller spec file tedious.
Take for instance the code from the following pastie (
http://pastie.caboo.se/99683 ). The only difference between the two examples
is that, in the first example a cart is retreived using the cart_id from the
session, and in the second a new cart is created. Both then find an item and
add this item to the cart.
How would you guys rewrite the examples in the provided pastie? (and don''t
hesitate to tell me if you have any comments about the way I wrote these
examples)
-------------- nex...
2003 Jul 01
0
Acom 200 B/D/E
...same
time? and it would make a good integration unit with *.
The price of the Acom 200E is $220 USD and the price of the Internet Line
Jack is 299.95 USD
The Acom unit support H.323, SIP, and G.723, G.729, and G.711 and it does
T.28 RTP for faxes
http://www.aislecom.com/aisleshopping/agora.cgi?cart_id=1161878.6905%2aE
H7Es8&next=3&exact_match=on&product=VOIP
Thanks
Brad.
2006 Sep 26
0
Find Returning String Instead of Integer?
...Rails 1.1.6
Mac OS 10.4.7
mysql Ver 14.7 Distrib 4.1.20, for apple-darwin8.5.1 (i686) using
readline 4.3
mysql> desc carts_items;
+----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+-------+
| cart_id | int(11) | | | 0 | |
| item_id | int(11) | | | 0 | |
| quantity | int(11) | | | 1 | |
+----------+---------+------+-----+---------+-------+
3 rows in set (0.10 sec)
mysql> desc carts;
+-------+---------+------+-----+---------+--...
2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
line_items.yml:
one:
product_id: 1
cart_id: 1
quantity: 1
carts.yml:
one: {}
product.rb:
has_many :line_items
cart.rb:
has_many :line_items, dependent: :destroy
line_item.rb:
belongs_to :product
belongs_to :cart
line_item_controller.rb:
def destroy
@line_item = LineItem.find(params[:id])
@cart = @line_item.cart
@line_item...
2006 Mar 11
11
Noob needs help with ''if'' block
Hello all. I''m a noob at Ruby on Rails, only started learning a few days
ago, but I''m loving it so far. I do have a few years experience with
PHP, ASP, MySQL, etc., so I''m not *totally* clueless, though. :)
Anyway, I''m having trouble with something that should be fairly trivial:
I have an ''if'' statement that is supposed to print out a table
2006 May 24
22
Components going out of style?
I see in the new Agile Rails 2nd edition that components are going out
of style?
Is this so? has anybody abandoned the idea of components for helpers?
Specifically I''m considering a menu sytem for a website that depends
heavily on the users permissions to decide which menu options a user
would need to see. I thought that components, since they have the logic
in the controller and