Displaying 11 results from an estimated 11 matches for "orderitems".
Did you mean:
order_items
2008 Jun 04
2
Mock with an attributes that has state
I''m developing a rails application. I have an Order model that has_many
OrderItems.
I mocked the OrderItem model in my Order specs using mock_model. I thought
I should focus my specs on each model and always mock associated models.
In my Order model I need a way to merge OrderItems which have the same cost
and same product_id. That I can spec.
The other thing this merge help...
2006 Jul 21
3
How can I create OrderItems that go in a Order?
...er items as part of the order, so I''ll explain the problem in those
more familiar terms and then explain what if anything makes my actual
situation different at the end.
In an Order lets say you have: shipping_address and a shipped bool.
OrderItem has quantity and name
So Order has_many :OrderItems, and OrderItem belongs_to :Order
It''s pretty easy to make it so you can create an Order then go to
another URL and create a OrderItem and associate (say with a select)
the Order the OrderItem belongs to, and so on.
What I really want though is the ability to have users click to create
an...
2006 May 26
4
Using ''validates_inclusion_of'' to validate foreign key
I seem to be missing something trying to use ''validates_inclusion_of'' to
validate a foreign key and was hoping some one could piont out my
mistake?
The problem seems to be that Order.find_all.collect is not returning an
array that contains the order_id, if I replace it with a hardcoded array
everything works as expected.
The model:
class OrderItem < ActiveRecord::Base
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?
2005 Apr 13
2
Creating multiple option groups
I''m setting up a basic shopping cart type app, and the products we
have will have multiple options. Size, color, etc. I''m trying to
figure out how I can collect the the options that are selected when a
user adds the item to their cart. An OptionSet is a group of options
("Size", "Color", etc), and an ItemOption is the option itself ("12
oz",
2006 Mar 13
8
Nested find(:all, :include => ) statements
Is there a way for me to do:
OrderItem.find(:all, :include => [:user, :product => [:supplier]]
So I don''t have a supplier_id on my order_item, but have it on my
product, which is part of order_item.
Joerg
--
Posted via http://www.ruby-forum.com/.
2005 Dec 23
0
newbie question
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 29
0
SOAP for large datasets
...ilitzation goes up to almost 70%.
A simpler application where I just use plain xml in the request and
response, and use a bit of to_xml and REXML for building the trees
still takes a good amount of memory but nowhere near the amount of
cpu.
The data is from 3 tables. Customers, transactions, and orderitems.
I created a struct for customers and in customers there are two
members that contain a struct for transactions and orderitems.
Right now the code looks like this. Any ideas on how to optimize it?
Or even ideas on better methods then using soap for something like
this?
@orders = Customer.find(:a...
2006 Dec 02
0
Fwd: Re: Mocha and ActiveRecord
...er <jbrains762 at gmail.com>
Date: 02-Dec-2006 02:48
Subject: Re: Mocha and ActiveRecord
To: ruby-talk ML <ruby-talk at ruby-lang.org>
James Mead wrote:
> On 28/11/06, J. B. Rainsberger <jbrains762 at gmail.com> wrote:
>>
>> Suppose I have an Order, which has_many OrderItems. Suppose I want to
>> write a test that checks that when I ask the Order to do something, it
>> asks its order items to do that something. I tried to do this like so:
>>
>> def test_delegates
>> order_items = []
>> 3.times {
>> item = moc...
2006 Mar 14
5
GROUP BY and SUM
I have orders, order_items, and products.
I want to collate several orders so that I can get a SUM of quantities
ordered for each product etc.
Can I say something like (the below gives an error on :sum, and ignores
:group)
OrderItem.find(:all, :sum => ''quantity'', :group => ''product_id'',
:include => [:order, :product])
I want to get back a
2004 Nov 30
1
RE: question about rails regarding handling more than onetable in one view
...extensive explanation of how associations work in
Rails.
For your example:
class Provider > ActiveRecord::Base
has_and_belongs_to_many :depts
end
class Dept > ActiveRecord::Base
has_and_belongs_to_many :providers
end
class Order > ActiveRecord::Base
has_many :orderitems
end
class Orderitem > ActiveRecord::Base
belongs_to :order
end
HTH,
Jarkko
On 30.11.2004, at 18:16, ChongQing Xiao wrote:
Hi, Everyone
I am just starting to look at the rail and really like how it
works.
One question I can not figure out is how rails w...