search for: product_ids

Displaying 20 results from an estimated 180 matches for "product_ids".

Did you mean: product_id
2006 Jul 13
8
can''t convert true into integer
I have a method: ? def reduceProuctInventoryBy(product_id, reduction) ? ? t=Product.find(:first, :conditions =>["id = ?", product_id]) ? ? t.qty=(t.qty-reduction) ? ? t.save ? end and the model: class Product < ActiveRecord::Base ? validates_presence_of :qty, :specialDescription ? validates_numericality_of :qty end but when i run my method, I get this: "can''t
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t spec it, see this pastie: http://pastie.caboo.se/53120. When following the link from a browser I''m being redirected to the right page. -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Jan 05
2
Agile Depot Tutorial Help
anyone can explain me why in the Agile Depot Tutorial application they use i.product_id to find if a product already exist in the cart, because the cart contains items, each of them references a product. I tried i.product_id like in the tutorial and i.product.i all of these 2 notation works , but i find the second seems more clean??? isn''t it. Any explanation will be fine Regards
2006 Jul 13
1
error_messages_for
I can''t seem to figure out how to validate a few fields some1 please help me out model--------- class Record < ActiveRecord::Base validates_presence_of :sw, :flex end controller------------ class RecordController < A;;icationController def new @record = Rrecord.new @product = Product.find(params[''product_id'']) end def create
2006 May 04
2
Building a FAQ
I''m new in Rails, and I''m building my first application. I''m trying to make a FAQ for this application, organized by product (questions about each product) and category (questions of different categories or topics), and there is something I can''t figure it out how to do. I have these tables: create_table "faqs" do |t| t.column "question",
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
2009 Feb 18
3
wrong number of arguments (1 for 0)
Hello, I am new to ruby on rails. When I tried to create a session I am getting an error, ''wrong number of arguments (1 for 0)'', in my controller. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ArgumentError in CustomerController#add_to_cart wrong number of arguments (1 for 0) RAILS_ROOT: /project/bob_shopping Application Trace | Framework Trace | Full
2006 Jan 06
6
HABTM problem not saving all associations
...TM association declared in the model will save during the initial @order.save in the create action in my orders_controller.rb code below. If the order is then updated via an edit action, all selected associations will save correctly. If you notice in the development.log dump, I''m passing product_ids and loan_type_ids arrays back to the controller properly. Inspecting the @order object during a breakpointer session shows the related object are available for saving, but for some reason, ActiveRecord does not want to save the second association class at the beginning. Any ideas what I''...
2006 May 19
7
How can I set up relations for these models?
Hello! I have a legacy DB and want to use ActiveRecord for it. However, I can''t set up a relation correctly. Here''s table spec: [products] id name price [subproducts] product_id subproduct_id Some example data: [products] 1, "Computer", 500.00 2, "Monitor", 200.00 3, "Printer", 100.00 4, "System", 700.00 5, "System2",
2011 Sep 07
4
jquery and ajax query in rails 3
hi people I don''t know much about ajax - jquery. And right now I need to use some functionality with them. In a form (sales model) I have the following code: <div> <%= f.label :product_id, "Product" %> <%= f.collection_select( :product_id, Product.all, :id, :name, options={} ) %> </div> <div> <%= f.label :price,
2009 Feb 12
4
routes
I''m trying to figure this. in my schools controller i want to do this.... # implement a create action to create just the review for the School... def create_review_for_a_school @review = Review.new @school = School.find(params[:school_id]) @review = @school.reviews.build(params[:review]) if @review.save # The creation worked....do this flash[:notice] =
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 Aug 15
3
update or alter cart
I want to modify and update the items in the Depot - "display_cart". Since the cart is in a session, its a little hard to get at the data. I just want to create a way to change quantities, prices and recalculate. Has someone done this, and could you point me to the right direction. Thanks Chas -- Posted via http://www.ruby-forum.com/.
2006 Jun 05
5
adding habtm through migrations
Hello, I''m stuck, I''ve got a model Product and would like to add a new model called Category. Furthermore, I want to set up a many2many relationship between the mentioned models. the problem is that I do not know how to set the primary key in the categories_products table. this is what I''ve got in my migration file: create_table :categories do |t| t.column :name,
2006 Jun 24
2
Migrations problem with Agile Rails book
I am following the instructions on Agile Web Development with Rails book "Iteratio E1: Capturing an Order" section. When I run the migrations I get the following error. rake db:migrate (in /Users/balaparanj/work/depot) -- execute("alter table line_items \n add constraint fk_line_item_products \n foreign key (product_id) references products(id)") rake
2005 Dec 19
2
Difficulty using correct moldel for the data in DB
Hi everyone, I''ve tried posting the same question to the list last Friday but somehow did not see it being posted.. I''ve just started with Rails and Ruby. I just started to play one of those RPG and to get my feet wet I''m writing an app to keep track of item fusions. So the scoop is that item can be fused with another items to create a higher level item. The higher
2006 Jul 11
7
Rails associations: Easy Question requires dumb answer
***Scroll down to see the dumb quick question*** I have two Models: class Template < ActiveRecord::Base end which has this migration: /snip t.column :name, :string And the other model: class Product < ActiveRecord::Base has_one :template end with the migration: /snip t.column :qty, :integer, :default => 0 t.column :specialDescription, :string t.column
2006 Mar 21
11
Stuck on ActiveRecord
Hi, I''m having great fun developing with Rails but I''ve come to a problem that I can''t quite figure out. I have an Order object that "has_many" order_lines. This works perfectly and I can see all the lines. The OrderLine object has an order_id field as well as product_id and amount. Now ideally I would want to do : order.orderline[0].product.name for
2005 Oct 05
3
Shopping Cart: SKU and Product Confusion
Hi there, I''m at a loss... I was on the #ROR channel last night and spoke to a really helpful person (Defiler) who gave me some direction on building a shopping cart. Unfortunately, I wasn''t able to successfully get to where I need to go. This is the predicament I am currently finding myself in: I''m building a shopping cart for a client''s new website. They
2006 Mar 03
7
Meta Programming Help
I have the following two methods: def ProductFile::find_images(mode, prod_id) # convert to symbol in case it is not (most commonly it may be a String) mode = mode.to_sym case mode when :all, :first ProductFile::find(mode, :conditions => ["product_id = ? AND file_type LIKE ?", prod_id, "image%"]) end end def ProductFile::find_documents(mode,