Displaying 8 results from an estimated 8 matches for "orderlines".
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
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:
2007 Sep 05
8
Hi..Guys new plugin again
Hi..
Guys new plugin again
Foreign Key Associations is a plugin that automatically creates
associations based on foreign-keys. The associations are created at
runtime-ie. as your ActiveRecord models are loaded-so they will always
be up-to-date.
For example, given a foreign-key from a customer_id column in an
orders table to an id column in a customers table, the plugin
creates:
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", "date" %>
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"...
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(qua...
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 attack...