Displaying 20 results from an estimated 600 matches similar to: "nil can't be coerced into BigDecimal Options"
2011 Aug 02
1
NoMethodError in Store#index
Thanks in advance
I want to know how to solve No method errors
Agile Rails 4th ed
Great book
But second time I get this type of error
I would like to know how to troubleshoot and resolve
Please see below thanks once again
NoMethodError in Store#index
Showing C:/rails/shop9/app/views/line_items/_line_item.html.erb where
line #9 raised:
undefined method `title'' for nil:NilClass
2008 Aug 25
2
maths not working (can't get this)
I''ve got a few problems with this...Hopefully it''s cleaer what I''m
trying to do (work out and display two prices, one discounted / one
full). Be grateful for answers...
The total price and discounted price are not calculated correctly and
the duration is not coming through to the output page.
---------------
class Course < ActiveRecord::Base
has_one :enquiry
2007 Aug 30
3
Rails - depot application
I''m doing the depot example in the Agle Web development book. I''m
getting this error:
"undefined method `product'' for #<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>"
2006 Apr 24
3
Form with multiple rows of content
I have looked at examples for this. I found a similar example in the
Agile Web Dev... book but that didn''t help. Here''s what i am trying to
do.
A Cart has many line items. On the Display Cart page, I want to provide
the user the option to update quantities.
Here''s the rhtml code:
<%= start_form_tag :action => ''update_cart'' %>
2008 Jul 29
1
can't crop images using ImageMagick
I''m using Attachment_Fu to save several thumbnails of a photo
(resizing with ImageMagick)
But when I try to crop them, nothing seems to happen to the file I
want to drop and no error messages. I check the file timestamp of the
thumbnail I want to crop and it looks updated. What''s strange is that
ALL the other thumbnails and the original image''s file timestamps are
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
2006 Feb 27
1
Odd problem in Agile tutorial
I am getting an undefined method error in my cart.rb class when trying
to find in an array. I cannot see what my error is. Perhaps a view
more eyes can help me with this:
#---------------------------------------------------------------
1 class Cart
2
3 attr_reader :items
4 attr_reader :total_price
5
6 def initialize
7 @items = []
8
2006 Feb 12
0
no method error - you have a nil object....
hi,
i''ve been cracking my head on this one for a while and would be humbly
grateful for any pointers
i''m working through Agile Web Devopment w Rails and, in the depot
example have created the cart class for session handling, but am getting
the following error, which suggests the @items variable is not being
populated with any data from LineItem
NoMethodError (You have a
2006 Mar 31
6
BigDecimal + Float => Float?
I was just playing around in irb and noticed that while BigDecimal + Integer
=> BigDecimal, BigDecimal + Float => Float. Is there any reason for this?
It seems inconsistent and means you have to check the class of any number you
add to a BigDecimal, which looks very un-Ruby-like to me.
Ashley
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
I''m working on building the shopping cart in the Depot tutorial in the
Agile Web Development book. I''m at the part (about page 80) where you
build the ability to add items to the cart. I''m able to get to
/store/display_cart/ and it seems items are being added, but if I just
click on a link to add an item (/store/add_to_cart/2) it gives me this:
NoMethodError in
2006 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
Hi, I have a real simple association setup here that''s just trying to:
- Create a new PayjunctionOrder
- Create some LineItem objects and assign them to the PayjunctionOrder
- Save everything
I''m using Rails Edge.
----
class PayjunctionOrder < ActiveRecord::Base
has_many :line_items
end
------------------
----
class LineItem < ActiveRecord::Base
belongs_to :order,
2006 Jul 09
6
Float -> BigDecimal
So, I''m personally cool with this change (patch from #5454, applied in
[4596]), and I''ll make it work for Oracle tomorrow.
But just wondering if folks considered the performance impact of the
change? From a simple test it seems that BigDecimal math is about twice
as slow as using Floats.
2006 Jun 23
3
Yet another problem with NoMethodError in Store#display_cart
Hi everybody,
I''ve search a lot on google to help me with this one without success. I
know that some people had the same problem as I have, but there
solutions doesn''t seems to work for me.
I''m trying to do the depot example in the AWDwR book. But now I''m stock
with a problem that I can''t solve. I get this error:
<--- begin error here --->
2008 Aug 01
2
BigDecimal to letters
Is there a method that converts BigDecimal 1520.0 to "one thousand five
hundred and twenty"?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2010 Oct 22
0
Overriding to_s method of BIgDecimal
I am overriding to_s method of BigDecimal class as below and its working
fine.
Wanted to confirm is there any other better way to do this ? Thanks!
49 class BigDecimal
50 alias :old_s :to_s
51 def to_s
52 return to_i.to_s if eql? to_i
53 self.old_s
54 end
55 end
--
sαη∂ιρ Rαηѕιηg
---
blog www.funonrails.com
twitter @sandipransing
skype sandip.ransing
--
You received
2006 May 25
3
Storing BigDecimal in the db
I need to do some precise math, going to 12-14 decimal places, so I''m
using BigDecimal. How can I store this in a db? I''m using postgresql
8.1.0, if that matters at all. I found a plugin [1] but it gives me
the error "You have a nil object when you didn''t expect it! The error
occurred while evaluating nil.each_pair," with no line number. The
plugin itself
2006 Mar 03
1
number_to_currency() helper == non DRY == could be improved
Hi all,
Apologies in advance if I got this one wrong, I''m still just a
newbie ;-)
Going through the Apple ADC RoR tutorial it suddenly occurred to me
that the ''number_to_currency()'' helper method was not DRY streamlined.
Scenario::
The "number_to_currency()" methods options hash works great when I
need to dynamically display different currencies when I
2009 Feb 03
4
Ruby EE: Problem with BigDecimal
I have a strange problem with my setup of Passenger and Ruby Enterprise
Edition.
Sometimes the loading of BigDecimals from the database and session fails
(silently) and the variable containing the BigDecimal is just empty.
I cannot pinpoint where/when/how it happens, and it IS only periodic.
I am using the newest versions of both Passenger and REE - I have even
tried to run with latest commit
2006 Apr 05
1
number_to_currency inside model
I was wondering if this is possible.
I have a model (Item) that contains products. These products have prices
that I''d like to format using number_to_currency. Rather than doing this
several times inside the view, I thought it might be nice to do it once
inside the model.
The item table has an field called regular_price which holds a currency
amount. I would like to do something
2006 Apr 01
7
BigDecimal column type?
I was hoping 1.1 would provide a way to map SQL "decimal" column types
to BigDecimal values, since BigDecimal is part of the Ruby standard api
as of 1.8.
But I don''t see any support for that in the migration documentation, and
when I try to let Active Record do the mapping for me, it seems to
coerce the column into a Float (as the AwdwR book says).
Is it really there in