similar to: YAML and has many associations

Displaying 20 results from an estimated 20000 matches similar to: "YAML and has many associations"

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 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
2006 Jan 15
6
Saving one-many associations (elegant solution please)
What is the most elegant way to save new one-many associations? order = Order.new(:name => "My Order") order.line_items << LineItem.new(:product_id => 1, :quantity => 2) order.line_items << LineItem.new(:product_id => 2, :quantity => 5) order.save The above - which is by far the most elegant way of putting it - doesn''t work for me - the line_items
2006 Jan 22
3
Download an Image using Net::HTTP
Hi, I need to download an image, and I''ve mucked about with Net::HTTP resp = Net::HTTP.get_response(''www.mydomain.com'', ''/test.jpg'') f = File.new("test.jpg","w") f.write(response.body) And various other combinations using HTTP.get etc. Anyway, I get an image, but it looks very psychedelic. This is obviously not the correct way.
2006 Feb 14
7
Launching a standalone Rails app
Hi, I''ve developed a standalone Rails app - using tar2rubyscript and rubyscript2exe. The users aren''t going to understand that the''ll need to open the browser and go to 127.0.0.1:3000 to view the app, after running the exe. I am wondering whether other people have tackled this problem in the past, and how they went about solving it. One way would be to write a
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 >>
2006 Jan 22
0
Using AWS to pass in an object and associations
I, I have an object and associations, say order and line_items. I want to submit this order and its lineitems to a central server using AWS. One way is to have an AWS method to submit the order object, and another method to submit each line_item individually (as I can''t have a typed array as an :expects parameters) - so I can''t submit all my line_items in one go. This is
2006 Apr 05
0
Has Many :through associations
Greetings again: I''m simplifying the case I presented earlier regarding the use of has_many :through. I''m using DHH''s example from "Persuing Beauty with Ruby On Rails". Here are his models: class Author < ActiveRecord::Base has_many :authorships has_many :books, :through => :authorships end class Book < ActiveRecord::Base has_many
2006 Jan 15
1
Cloning a one-many association
Hi, I want to make a copy of an object with its associations, and I am looking for an elegant solution. This is what I intuitively think should work, but it doesn''t: order2 = order1.clone order1.line_items.each do |o| order2.line_items.build(o) end This doesn''t work because a model class does not stringify its keys ... so I can''t pass an object into a method that
2006 Jul 17
14
REST Relationship Models
I''m trying to figure out an elegant way to do this: I have the following three tables: people, employer, employees And consequently the following three models: class Person < ActiveRecord::Base end class Employer < ActiveRecord::Base has_many :employees end class Employee < ActiveRecord::Base belongs_to :person belongs_to :employer end I want to be able to say:
2010 Feb 26
0
save has-many associations
I have the following association class Document < ActiveRecord::Base has_many :sections has_many :items, :through => :sections end class Section < ActiveRecord::Base belongs_to :document has_many :items end class Item < ActiveRecord::Base belongs_to :section end Here is the sample view for the ''new'' action <% form_for(@document) do |f| %> <%=
2010 Sep 02
3
err: Too many open files - /var/lib/puppet/state/state.yaml.tmp
I keep on getting this message: err: Too many open files - /var/lib/puppet/state/state.yaml.tmp Does anybody know what might be causing it? I''m also getting "err: State got corrupted". Everything does seem to be kind of working, but it''s sort of worrying getting these new errors. -- You received this message because you are subscribed to the Google Groups
2006 Nov 01
0
Re: YAML.load(some_string) doesn't return hash?
Oleg Kh wrote: > A small problem here. As per documentation on > http://corelib.rubyonrails.org/classes/YAML.html YAML.load(string) > should just return a hash. However on my windows machine it returns > something like this: > > #<YAML::Syck::DomainType:0x36d5038 > @domain="yaml.org,2002", > @type_id="map:HashWithIndifferentAccess", >
2012 Oct 23
0
[LLVMdev] Status of YAML IO?
On Oct 22, 2012, at 4:40 PM, Sean Silva wrote: > Hey Nick, what's the status on YAML IO? The other thread seems to have died.\ I'm waiting on Michael Spencer's feedback. The issues I know of right now are: 1) Should we structure YAML I/O to be a more general I/O utility that could support reading and writing other data formats such as JSON or plists. RIght now, all the code is
2009 Aug 07
1
Yaml for jqgrid
Anyone have a more extensive yaml file for jqgrid than the one that''s shown with the example Jqgrid Demos page? Also, I''ve been successful in just using the straight jQuery javascript code, rather than invoking the yaml file to produce it), but sometimes get an "unitialized class variable @@grid_name" error. I was doing this because all the code I see on the web to
2012 Jan 24
1
bugzilla + centos 5.7 + yaml errors
Hi all, Struggling with installing ol Bugzy 4.0.3 onto Centos 5.7. When I run the checksetup.pl script included with Bugzilla, I get the message; /usr/bin/perl install-module.pl Email::MIME So I run this from the command line and get YAML errors; Checking for YAML (any) not found I had installed YAML via; yum install *YAML* The package perl-YAML-0.72-1.el5.rf.noarch
2006 Jul 24
0
HTML YAML Builder
Is anyone interested in a YAML Builder for HTML? Some trivial YAML that could be converted to HTML: html: - head: - title: My title - body: - p: - {!id: someId, !class: class1 class2} - Hello - img: {!src: someurl.gif} - hr: - ul: [{!id: someId}, {li: hello}, {li: goodbye}] - ul: - {!style: "height: 30px"} - li: [{!id: first}, First] -
2006 May 02
0
YAML failing to de-serialize
I''m seeing this same problem that Josh was seeing back on March 23rd (see below) I''ve got the following YAML snippet stored in a text field: "--- !ruby/object:FieldValue \nattributes: \n item_id: 60\n title: Test\n field_id: 15\n created_by_id: 5\n locale: en\n link: www.cclearn.com\n comment: this is a test\n created_at: 2006-05-02 15:43:14.256792 Z\nnew_record:
2013 Mar 11
0
[LLVMdev] YAML IO problems
I'm trying to parse a simple JSON file, and am having problems with using YAMLIO. FWIW, I see the unit test YAMLIOTest.cpp is disabled with a #if 0. Anyway, the JSON file yaml.json contains: { "bool_test": true, "directory": ".", "suffix": "_test", "int_test": 4 } The test program when run shows: YAML:5:15: error: invalid
2008 Apr 16
2
Question about yaml. Thank you !!
Hi friends: I tried to convert a model object to yaml(use to_yaml method), and after that, I would like to convert the yaml(string type) back to the model object. But when I use YAML::load to do that, it failed, the return object''s class is Yaml class, not my prior model class.. Please tell me how can I do to convert yaml to an object as the prior model class, or how can I access the