similar to: Creating multiple option groups

Displaying 20 results from an estimated 200 matches similar to: "Creating multiple option groups"

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?
2006 Mar 30
4
Select List to change type of STI class
Hi: I''m trying to create a drop-down list to change the type of a Single Table Inheritance class. I tried this: <%= select :user, :type, [ [''Author'', ''Author''], [''Editor'', ''Editor''], [''Administrator'', ''Administrator''] ]
2006 Jul 21
3
How can I create OrderItems that go in a Order?
I suspect my problem is similar to having an order and wanting to have order 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
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/.
2003 May 16
4
[RFC] report options
I have hinted in the past of wanting to go to a more selective control of the output of rsync. Here it is. PROBLEMS with the existing --verbose et al. The simple incrementing verbose doesn't allow one to restrict stdout to what actually is of interest. For instance inside dirvish i don't care about directories, or any kind of non-regular file because they show up every time even if
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 Mar 26
4
Updating query results in real time with AJAX
I have the following view template: <%= form_remote_tag :update => "new_item", :url => {:action => ''create''}, :before => %(Element.show(''spinner'')), :success => %(Element.hide(''spinner'')) %> <div id="new_item"> </div>
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 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 >>
2005 Dec 29
1
Has_Many - Saving Child Rows
I have read extensively on has_many but cannot find an explicit example on how to do what I need. I am a newbie, but can grasp it if I see it in a working example. Here is my scenario... I have a form which I can add a TODO item (patterned after http://darkhost.mine.nu:81/~vince/rails/tutorial.html). I have the form working perfectly so I decided to modify it a bit to add more functionality.
2005 Jan 07
3
multicolumn primary keys in activerecord
hi, I''ve got the following tables in mysql notation: CREATE TABLE `nodes` ( `id` int(11) NOT NULL auto_increment, `parent_id` int(11) default ''0'', `group_id` int(11) default ''0'', PRIMARY KEY (`id`), ); CREATE TABLE `groups` ( `parent_id` int(11) NOT NULL default ''0'', `id` int(11) NOT NULL auto_increment,
2011 Jan 05
16
Nicedit (rich text editor)
Hello, I''m trying to use Nicedit to improve my text_areas in some views of my project. I have installed jquery: ruby script/plugin install git://github.com/aaronchi/jrails.git nicEdit plugin: ruby script/plugin install git://github.com/sergio-fry/Simple-nicEdit.git Add js in layout: <%= javascript_include_tag ''nicEdit'', ''nicEditInit'' %> Use it
2008 Jul 14
18
[git patches] Ocfs2 and Configfs updates for 2.6.27
I'm running a bit late with the e-mail this time around, but I think that's ok since there really isn't any major new features here - the bulk of the Ocfs2 update is bug fixes, or cleanups. The same goes for configfs. The only two things that could be described as features would be: - Sunil has updated Ocfs2 to provide even more live cluster locking information via debugfs. - Joel
2004 Nov 30
1
RE: question about rails regarding handling more than onetable in one view
Hi, Jarkko: Thanks for the quick reply. I understand I can use ActiveRecord to specify the relation between the table as you have suggested, The part that I have trouble to understand is 1. Since I have a third table ProvWorkAtDept, do I need to specify this table somewhere when I define Provider or Dept? 2. If the provider view has both the provider name and several depts the provider
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
2006 Aug 18
0
AJAX question
Dear all, Help me get a simple AJAX behavior right. I know zero AJAX, thus please advice. Below is a simplification of the real code and I hope I can describe my intention clearly. class StoreController < ApplicationController def show_cart @cart = Cart.new @new_item = CartItem.new end def add_item @new_item = CartItem.new(params[:new_item]) if
2006 Aug 18
0
Simple AJAX question
Dear all, Help me get a simple AJAX behavior right. I know zero AJAX, thus please advice. Below is a simplification of the real code and I hope I can describe my intention clearly. class StoreController < ApplicationController def show_cart @cart = Cart.new @new_item = CartItem.new end def add_item @new_item = CartItem.new(params[:new_item]) if @new_item.valid?
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