similar to: How can I create OrderItems that go in a Order?

Displaying 20 results from an estimated 500 matches similar to: "How can I create OrderItems that go in a Order?"

2006 Jul 20
5
How can I make has_many prevent a delete that would lead to orphans?
e.g. class Asset < ActiveRecord::Base validates_presence_of :asset_number, :make, :model, :location, :name, :serial_number validates_numericality_of :asset_number validates_uniqueness_of :asset_number belongs_to :user belongs_to :location belongs_to :asset_type, :foreign_key => ''type_id'' end class Location < ActiveRecord::Base validates_presence_of :name
2006 Jul 25
4
Sorting by two fields
I have a list of TimeSheet objects from an ealier AR query, which I can sort by the full name of the user like so: @time_sheet_entries.sort! { |a,b| a.user.full_name <=> b.user.full_name } I can sort by the started time like so: @time_sheet_entries.sort! { |a,b| a.start_time <=> b.start_time } My question is how do I do a sort so that the list is sorted primarily by user.full_name
2006 Jul 21
5
Reports in Rails
Hi, In my rails application I want to include a reporting mechanism that will allow the users of application to view statistics of various operations graphically. Does rails provide inbuilt reporting capabilities? what are different appraoches I can follow to achieve reporting in rails? On googling I found following as some of the options, 1.Gruff Graphs for Ruby 2.SVG 3. using Apache FOP.
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 helper
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/.
2006 Dec 02
0
Fwd: Re: Mocha and ActiveRecord
---------- Forwarded message ---------- From: J. B. Rainsberger <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 >>
2010 Jun 03
3
[LLVMdev] Generating Floating point constants
Le 3 juin 2010 à 16:00, Martin Guy a écrit : > [off list] > >> 0.8f get converted in 0x3FE99999A0000000 by LLVM > > single precision > >> http://babbage.cs.qc.edu/IEEE-754/Decimal.html gives: >> >> 0x3FE999999999999A instead and this value cannot be read back by "llc"... > > double precision > > M Well For float 0.8 :
2005 Jan 29
4
format question
how can I get a float to always print two decimal places? Thanks, Jamie
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
2009 Oct 07
1
Log entries with truncated service names
Hi, Situation: I'm seeing lots (~500k per day) of log entries like: smbd[13939]: itlab-pc06 (::ffff:10.51.51.103) couldn't find service it261 In this case, the last character of the request is truncated - it should be it2610 I'm seeing the same/similar issue to http://lists.samba.org/archive/samba/2009-March/147277.html I've dismissed this over the last few weeks as a minor
2003 Jun 08
6
Basic question on applying a function to each row of a dataframe
Hi, I have a function foo(x,y) and a dataframe, DF, comprised of two vectors, x & w, as follows : x w 1 1 1 2 2 1 3 3 1 4 4 1 etc I would like to apply the function foo to each 'pair' within DF e.g foo(1,1), foo(2,1), foo(3,1) etc I have tried >apply(DF,foo) >apply(DF[,],foo) >apply(DF[DF$x,DF$w],foo) However, none of the above worked. Can anyone help ?
2001 Apr 17
2
Stupid question: where is the Preferences box?
Good day! I am GUI-challenged, and proud of it, but I would like a bit of help. When I start netscape (picked from an Earthlink CD) it raises a message box that says (this is picked from --debugmsg +text and folded for mailing convenience): trace:text:DrawTextExW L"Error: temporary directory E: does not exist. Please enter a new directory in the preferences box.", 99 , [(0,0),(264,0)]
2005 Mar 12
0
How do I pick up a trailing number in extensions.conf?
Hi, my SIP provider sends me all the numbers that are dialed, i.e. when a number is appended to the phone number proper, it gets appended to the incoming number, like (my number is 0123456789, and I append a "5"): To: <sip:491234567895@sipgate.net>;tag=as1174b008 Question is, how can I use the trailing number in extensions.conf? This is ideal for a direct dial through to an
2003 Jun 07
1
Extracting Numbers from MANOVA output
Hi, Suppose I have: > summary(manova(plank.man)) Df Pillai approx F num Df den Df Pr(>F) plankton.new[, 1] 1 0.5267 9.8316 6 53 2.849e-07 *** Residuals 58 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 My understanding is the MANOVA summary returns a list.
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
I''ve been playing around with a soap interface to an application that can return large datasets (up to 50mb or so). There are also some nested structures for which I''ve used ActionWebService::Struct with 2-3 nested members of oher ActionWebService::Struct members. In addition to chewing up a ton of memory, cpu ulilization isn''t that great either. My development
2003 Jun 01
1
Wording of "R Installation and Administration"
Hi, I hope I haven't got this wrong, but I don't think one needs Perl installed if they install the "precompiled" packages for Windows right? I'm just wondering if the first sentence in the "R Installation and Administration" can be re-worded a bit so newbies won't get confused.... ---------- Forwarded message ---------- Date: Mon, 2 Jun 2003 08:56:37 +1200