search for: order_lin

Displaying 15 results from an estimated 15 matches for "order_lin".

Did you mean: order_line
2006 May 02
3
Ordering Results returned by has_many relationship.
Noob Question 31,265,232 if I''m searching on an object, say order, that has many "order_lines" and I want to display order lines by Quantity ( an attribute of the order_lines ) descending how could I do that without having to do a find() with :order, but something like; Order.order_lines.each do |ol| <!-- code to diplay the line --> how can I determine the field and the...
2005 Dec 23
5
Can''t get data from products into @order
...#39; the code with some extra options. When I go to admin/shipping I want to include some data from the products table in with the order info listed. I can''t seem to get this to work. in my partial form I''m trying to add this: <td class="olnamebox"> <%= order_line.image_url %> </td> I''m recieving this error undefined method `image_url'' for #<Order:0xb77ee194> I call the partial with: <table cellpadding="5" cellspacing="0"> <%= render(:partial => "order_line", :collection => @pen...
2005 Dec 18
3
undefined local variable in partial
i can''t get rid of the following error: ActionView::TemplateError (undefined local variable or method `order_line'' for #<#<Class:0xb75b2090>:0xb75b1f28>) on line #13 of app/views/admin/_order_line.rhtml: 10: 11: <tr valign="top"> 12: <td> 13: <div class="olnamebox"><%= h(order_line.name) %></div> 14: <div class...
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 example to pull back the name of the product it''s linking to - but no matter what I t...
2006 Jun 06
3
Invoice and invoice_lines
...solution I can think of is to have a session variable (session[:invoice_id]?) so that the application "remembers" which invoice you are dealing with (and in fact can also show the heading for it etc.). I can see problems here though, in case for example I want to allow the user to add order_lines from the same page as the invoice_view using Ajax. The scenario is clear: the user opens an order. Then he opens another order and adds some order_lines there. Then... well, he goes back to the first window, and - surprise surprise - he will be adding line_items to the wrong invoice! The sup...
2007 Sep 05
8
Hi..Guys new plugin again
...table to an id column in an orders table, the plugin creates: Invoice.belongs_to :orderOrder.has_one :invoice Additionally, if there is a position column in the child table, the parent association will be created with an order clause. For example, given a foreign-key from a order_id column in an order_lines table containing a position column, to an id column in a orders table, the plugin creates: OrderLine.belongs_to :ordersOrder.has_many :lines, :order => :position The plugin also supports the creation of has_and_belongs_to_many associations. For example, given the tables product_product_categ...
2006 Mar 13
0
(Nested) collection in a view
Say I have a model consisting of Order( has_many :order_lines) and OrderLine( belongs_to :order). What would be the ''rails way'' to create an order form? Know I could just say @order = Order.some_order, @lines = @order.order_lines, and use something like this..: order.rhtml: Order no: <%= @order.no %> Date <%= date_select "...
2008 Oct 21
1
How to force a lock_version increment
Hi everyone, I have a order with order_lines use case. On changing the lines, I want to be sure no one else changed the order. So I use lock_version on the order. This works fine if something is changed on the order record. But now i have the situation that I delete, alter and add order lines without changing the order record itself. I hav...
2006 Jul 24
2
BIG JS limit? Using replace_html with partials containing JS
...enerated Javascript. Something like: order_screen.rhtml ------------------------------------------- <h1>Order</h1> <div id="order_part"> <%=render :partial=>''order_new'' %> </div> <h1>Ordered products</h1> <div id="order_lines_part"> <p>Please finalise the order information first...</p> </div> -------------------------------------------- And... order_edit.rhtml ------------------------------------------- <h2>Order id: <%=@order.id %></h2> <div id="order_message&q...
2006 Apr 01
3
Ignoring Validations In An Admin Tool?
I have the following validation on and ''Order'' model: validates_presence_of :order_lines, :message => ''missing one or more products.'', :on => :save Ok, great. An order has to have products. Ok. Problem is, there are some old orders that don''t have lines (don''t ask) and in the admin tool we need to be able to work on these orders. Problem i...
2006 Aug 16
4
New Model Object from Existing Model Object
Hey Guys, need a hand again.... Lets say I have an Order... and an Order has Order Lines and Order_Lines have Items... I want to create a New Order, which would have New Order Lines with the same Items... Is there a fast / easy way to do this, w/o having to create a new order, loop through all the order lines, and create them associating them with the Items? Any help would be great, thanks -- Vi...
2006 Aug 18
1
Populating Select Box from DB table...
Hi everyone, I have in a DB table item id''s (ints) and what i''d like to do is populate a select box (in another separate ruby app) with the corresponding name of each item. What''s the best way to go about that - this isn''t working too well for me(http://www.protoscript.net/article/4/ruby-on-rails--filling-select-boxes) -- Posted via
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
...application I''m using dynamic tables. I''m aware of the single thread conditions. I''ve tackled some caveats yet - will post a blog about it soon - but there''s one I need help with. Consider 2 models that are associated: Order and OrderLine where Order has many order_lines. Now we set the table names for them: Order.table_name=''v1_orders'' OrderLine.table_name=''v1_order_lines'' Query: OrderLine.joins(:order).where(Order.table_name=>{:customer_id=>1}).all Result: Select v1_order_lines.* FROM v1_order_lines INNER JOIN v1_ord...
2011 Jun 04
0
Rails 3.1 : Complex database query with Arel 2
...ordered, (stock - ordered) as available from assets join ( select asset_id, sum(quantity) as stock from "deposits" where validated = true group by asset_id ) as stocks on assets.id = stocks.asset_id join ( select asset_id, sum(quantity) as ordered from order_lines join orders on orders.id = order_id where state in (''IN_PREPARATION'', ''WAIT_DELIVERY'') group by asset_id ) as ordereds on assets.id = ordereds.asset_id I expect to retrieve a simple hash with results so I''ve tried to do that directly w...
2006 Feb 09
13
Howto work with a page not generated by the scaffold ?
I am a newbie Ruby and RoR user. In my tests using the turorials that I found over the web, everthing is working fine and I am very impressed about RoR framework. As I am a Delphi developer, without any web development experience, There is some thing hard to understando and I didn''t find a tutorial about this. I wonder how to create a non-scaffold page ? I have customers,