Displaying 20 results from an estimated 75 matches for "lineitem".
Did you mean:
line_item
2006 Jul 21
1
How to dynamically add more rows and submit data
...ank row for the
line items.
<tr>
<th>Description</th>
<th>Date</th>
<th>Hours </th>
<th>Rate </th>
</tr>
<tr>
<td><%= text_field ''lineitem'',''desc-1'' %></td>
<td><%= text_field ''lineitem'',''date-1'' %></td>
<td><%= text_field ''lineitem'',''hours-1''%></td>
<td&...
2008 Sep 02
5
Appending a record to a table
...rough example,
just about got the dynamics correct. Even tried to play with some
table joins (and excuse me if I''ve used the incorrect terminlogy). But
no matter what I try I can''t seem to get the following code to work.
I have a cart filled with Treatment id''s. I have a LineItem model set
up as follows:
class LineItem < ActiveRecord::Base
belongs_to :appointment
belongs_to :customer
belongs_to :therapist
belongs_to :treatment
end
I have worked out enough to be able to create a new LineItem record.
I have populated it with appointment, customer and therapist da...
2006 Jul 17
1
Updating multiple children from one page
Hello,
I have a model called invoice and one called lineitem. An invoice
has_many lineitems, and an lineitem belongs to an invoice. I have a
model method that calculates the price of a lineitem, and one that
calculates all lineitems in an invoice. I want to have an edit page
that lists all the invoices lineitems and their calculated prices, with
a te...
2006 Feb 16
9
association not inserted automatically.
Hello,
I am trying to write a sample application.
I have
class LineItem< ActiveRecord::Base
belongs_to : order
end
&&
class Order < ActiveRecord::Base
has_one :line_item
end
Now in the controller i am trying :
def add
@ord = Order.new(params[:ord])
@ord.line_item = LineItem.new(params[:lineitem])
if @ord.save
redirect_to :action => ''list&...
2006 Nov 22
1
Polymorphic Data Modelling Question
...ituation in Rails and
would appreciate some guidance.
An order can hold multiple line items. Each line item is for a
certain number of any given product. There are four products, each
in a different table because they have completely different
attributes. So I have:
Order
- has many LineItems
LineItem
- belongs to an Order
- holds the quantity of the particular product
- has one {ProductA or ProductB or ProductC or ProductD}
ProductA
- belongs to many LineItems
- holds various attributes unique to product A
ProductB
- belongs to many LineItems
- holds various at...
2006 Apr 20
5
strange mysql problem
i have this model:
class LineItem < ActiveRecord::Base
belongs_to :quote
end
in the console:
>>l = LineItem.create
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '' , , , )...
2007 Aug 30
3
Rails - depot application
...BigDecimal:331ce70,''0.21E1'',8(8)> "
"Extracted source (around line #9):
8: for item in @items
9: product = item.product
10: -%>
11: <tr>
12: <td><%= item.product%></td>"
this is display_cart.rhtml
line_item.rb has:
"class LineItem < ActiveRecord::Base
belongs_to :product
def self.for_product(product)
item = self.new
item.quantity = 1
item.product = product
item.unit_price = product.price
end
end "
cart.rb has:
"class Cart
attr_reader :items
attr_reader :total_price
def initialize
@items = []...
2006 Feb 24
7
One To Many To Many
Hey all,
I''m trying to find a simple way to reference all of the objects that
belong to their parent''s parent. In other words:
Clients --> Orders --> LineItems
How do I get all of a client''s lineitems in one array (i.e.,
client.all_lineitems)?
Thanks!
-Neal
--
Posted via http://www.ruby-forum.com/.
2005 Mar 06
8
Tutorial about XMLHttpRequest+Rails
Hi All
I just finished writing up a tutorial relating my experience
developing a system to edit line-items ''in-line'' in my Rails
application using XMLHttpRequest. I thought this might be of interest
to some readers of this list... Check it out at
http://hieraki.goodlad.ca/read/book/1
Thanks!
Dave
--
Dave Goodlad
dgoodlad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org or
2007 Jan 05
4
How To Spec Controllers with Finders
...faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless @line_item.nil?
4. @line_item.update_attribute(:quantity, params[:quantity])
5. @extension_id = "extension#{params[:id]}"
6. end
7. end
Thanks
2006 Aug 08
1
Legacy system belongs_to problem
Hi all,
I am trying to patch a small rails app into a large system we have at
our company. The legacy has a large database that naturally does not
match the Rails conventions, but this has not been a serious problem
thanks to rails flexibility.
The problem I just ran into is that my "LineItems" table links back to
the "Products" table using a modified foreign key. For example, the
ProductID in the LineItem table as a "LI-" prefixed to the productID. So
they link together as follows:
LineItem (ProductID) Product (ID)
IN-123456 -> 123456
IN...
2007 Aug 07
0
has_and_belongs_to_many polymorphic question
I''ve got a situation where I''m trying to model the following
relationship:
a ''page'' has multiple lineitems
a ''lineitem'' can be either a ''page'' or a ''entity''
The ''lineitem'' looks like it should be polymorphic but the ''page'' and
''lineitem'' relationship has me confused. It looks like a
has_and...
2003 Jan 08
2
Problem with fontsize of pie-chart in postscript file
...ize, so I
change cex (see below). On screen this works fine, but cex doesn't seem to
affect the postscript-file. Any suggestions?
Thanks a lot,
Daniel
Copy/Past-example (will try to write to c:/temp!):
labels <- c("I", "H", "G", "K", "V")
lineItems <- c(6252,943605,271207,517764,44108)
orders <- c(2084,226894,49218,164056,15809)
value <- c(1380425,87743481,35212459,76346384,10403599)
count <- c(52,17571,261,53270,843)
col = gray(seq(0.2,.8,length=6))
oldpar <- par()
par(cex=2)
#postscript("c:/temp/1.eps", onefile...
2009 May 27
4
Sale, pop and product
Hi,
I couldn''t find a better word for pop, but let''s go:
There are 3 models: sale, pop and product
sale:
-total:integer
pop:
-quantity:integer
-discount:float
product:
-name:string
-price:float
A sale can have many different products, each one has a quantity and
discount associated.
So each sale has_many :products through => pops
And each product has_many :sales
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
--
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 don''t get saved. Presumably because the
o...
2008 Feb 20
1
text_field_tag - different parameter name
Hi, I have one problem with validation
I am creating e-shop and I have products. This view look like this:
<% for product in @category.products %>
<div class="produktyBox">
<%= product.title %><br />
Price: <br />
<div style="color:red; font-size:large; font-weight:bold; margin-
bottom:5px"><%=
2006 Jan 30
2
Cannot see what I have done wrong.
In the Agile Rails tutorial I am revisiting building a cart. I have
followed the steps given in the book to create the class ''Cart''
thus:
class Cart
attr_reader :items
attr_reader :total_price
def add_product(product)
@items << LineItem.for_product(product)
@total_price += product.price
end
def initialize
@items = []
@total_price = 0.0
end
end
~
"app/models/cart.rb"
I have wired together the other bits in
app/controllers/store_controller.rb and app/models/line_item.rb
class StoreController < Ap...
2006 Aug 02
7
Same error ... again.
...#This new cart is then returned.
end
end
[CODE]
and finally my cart.rb which rests in app/models:
[CODE]
class Cart
attr_reader :items
attr_reader :total_price
def initialize
@items = []
@total_price = 0.0
end
def add_product(product)
@items << LineItem.for_product(product)
@total_price += product.price
end
end
[CODE]
What is the problem that it gives me that float error? Eeverything seems
to be in order.
--
Posted via http://www.ruby-forum.com/.
2008 Jan 19
1
Decimals are being converted to Bigdecimals!!!!!
Hi all,
I''m working on a financial app, and have set up some columns in my
tables as decimals with precision => 8 and scale => 2. My migration
looks like:
change_column :lineitems, :price, :decimal, :precision =>
8, :scale => 2
change_column :payments, :amount, :decimal, :precision =>
8, :scale => 2
I''ve run the migration and restarted the server. I also looked at the
Mysql tables to verify that the migration ran correctly, and the
fields look like...