Displaying 8 results from an estimated 8 matches for "orderlin".
Did you mean:
orderline
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 try, I cannot get that to work.
Can anyone tell what I''m do...
2007 May 11
2
spec a replace_html with a partial
I wanted to use ARTS to add RJS in a behaviour driven way to my
application, but I''m having some trouble asserting a replace_html with
a partial.
I''ve created a pastie (http://pastie.caboo.se/60694) which contains
the RJS I want to spec, the spec which I already wrote and its failure
message.
I''m currently using RSpec-0.9.2
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
In part of my 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...
2007 Sep 05
8
Hi..Guys new plugin again
...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_categories with foreign-
keys to both the product and product_categories tables, the plugin
creates:
Produc...
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 "order", &qu...
2006 Feb 27
2
Multiple forms on a page
...; ) -%> <%=
text_field_tag("frozen","", :size => "2", :value => "0") -%></td>
<td><%= submit_tag("Order") -%></td>
<% end_form_tag -%>
<% end -%>
The idea is to present the user with a list of orderlines with an
"Order" button at the end of each line. They fill in the "Fresh" and
"Frozen" values for a line and hit that line''s order button.
What appears to be happening is that the submit button for every line
tries to submit the data in the "Fresh&qu...
2011 Jun 04
0
Rails 3.1 : Complex database query with Arel 2
...nothing and all I''ve found is for Arel 1 so I''ve run into
NoMethodError: undefined method `[]'' for
#<Arel::SelectManager:0x00000003f1b820> errors with join syntax.
My query is barely simple but involve nesting queries. I have 4 tables.
Assets, Deposits, Orders and OrderLines and I want to
get asset name, the stock, the quantity that is ordered and the
difference between the two previous.
I''ve manage to do it in pure SQL. (tested on postgres)
select assets.name, stock, ordered, (stock - ordered) as available
from
assets
join
(
select asset_id, sum(q...
2006 Mar 21
2
Validation to make sure associations don''t change?
I have a main form representing the model, let''s call that ''Order'', and a
partial displaying its'' OrderLines.
I use the bulk update methods to initialize model objects directly from form
data, leaving validation of business logic to the model. As AR likes to
write stuff before i do an explicit save, I wrap the whole update in a
manual transaction.
This works for valid data, but how do i deal with atta...