similar to: Nil being coerced to float

Displaying 20 results from an estimated 4000 matches similar to: "Nil being coerced to float"

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/.
2012 Dec 26
2
has value in a console but it's nil in my controller and my view?
I have this strange behavior and I don''t undertand why. Here is the thing: I have this record in my payment model: 1.9.3p286 :019 > u.payment.last Payment Load (0.3ms) SELECT "payments".* FROM "payments" WHERE "payments"."user_id" = 10 => [#<Payment id: 37, bank_name: "Mercantil", plan: "Plan Uno", date:
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
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'' else render
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
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 '' , , , )'' at line 1: INSERT INTO line_items (`qty`, `quote_id`,
2006 May 02
4
Bug in rails ?
Hi ! I just have a simple question. I am writing an app using rails to familiarize myself with the framework (which is pretty cool, by the way). I just wanted to know why these two work differently (since "find" should be a synonym for "detect" according to the Pick Axe) : current_item = @invoice.line_items.detect {|i| i.product.id == key} current_item =
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone, I am relatively new to rspec and I am running into a wall in testing my views. I have a RESTful resource Contracts with a nested resource of Line_items. I am trying to figure out how to test the "edit" form of the Line_items. What complicates this is the nested routing and how to account for it, and that there is a partial form (_form.haml) that both the edit.haml and
2012 Feb 21
0
nil can't be coerced into BigDecimal Options
hi guys im playing with RoR with the environment of rails 3 ruby 1.9 i got stuck in nil can''t be coerced into BigDecimal error i need to get the total cost of the products inside the cart i know where the problem is(i think) but i almost did every thing cart/show.html.rb <div class="cart_title" >Your Cart</div> <table> <% for item in
2006 Jul 20
1
Having issues saving line items to the DB
Hello everyone, I''m fairly new to Rails (writing my first real app) and brand new to this mailing list. I''ve got a rails/sql error I just can''t seem to solve. It''s probably really simple, but I''m been googling and reading for a day and have made zero progress on it. Hopefully someone on this list can shine some light on my problem, or point me in the
2009 Aug 31
3
How to deal with PayPal frauds?
I charge my customers through PayPal, but recently faced a fraud which previously had only heard about. Somebody registered a few accounts, paid online with paypal (as my service is only prepaid) and started making expensive long distance calls. In fact the IP registering the accounts was from Florida, and IPs making calls were from Africa. After about 20 minutes the first payment was reversed.
2008 Sep 02
5
Appending a record to a table
Hi I''m not too sure how best to explain this but here goes! I am trying to write an appointment system. I have, through 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
2006 Mar 27
1
polymorphism + inheritance
Hi, currently I do some work with polymorphic associations in egde rails class Order < ActiveRecord::Base belongs_to :payment, :polymorphic => true end class CreditCardPayment < Payment end class PayPalPayment < Payment end class Payment < ActiveRecord::Base has_one :order, :as => :payment # common stuff in here end I want to use [Payment] for common functionality
2008 Apr 23
1
Validation dependent on unsaved parent
I''m having trouble with a validation that depends on an attribute of a belongs_to parent. If the child is added to an unsaved parent (parent.children << new child), the has_many collection parent.children includes the unsaved child. However the belongs_to attribute child.parent appears to be nil until the parent has been saved. Without access to the parent attributes, the validation
2005 Dec 14
9
Passing quantity in a shopping cart
I am using this line on my index.rhtml page to capture the quantity required of a particular item for a basic shopping cart app: <%= text_field ''line_item'', ''quantity'', {:size=>3} %> </td> but my next screen (a cart screen) doesn''t reflect what was entered in that text field when the item is added to the cart. That is,
2006 May 09
1
$4529.72 spend received from blocked e-gold account #168571 - Please accept or refuse this payment
<p>Dear E-gold Customer, <br> <br> You have received a payment from <font color="#000000">blocked </font>e-gold account <font color="#000000" face="Courier New, Courier, mono">#168571</font> to the value of <font face="Courier New, Courier, mono">$4529.72</font>. Your current account security
2006 Apr 11
5
multiple select_tag
Hello again, I have a table called line_items, with the following fields: id int item_name varchar() qty int conditions text I''ve made my LineItem model, and everything works as such (with simple text_fields).. Now I''d like for the conditions field to be a select_tag() with multiple choice possibility. I''m guessing I need some code to expand/restract the array for
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 30
1
Insert multiple new child records with the parent
Hello, I am implementing a classic invoice application. On the create new invoice page I want to allow users to add new line items using AJAX: ----------------------------------------------------------------------------- Invoice Date [ ] Client [ ] Line Items 1. [ ] $[ ] <add new line item> <save> <cancel>
2006 Feb 24
1
Preventing Double Submit?
Hi, I have a sensitive submit button that does a separate credit card payment post in the controller action, which could take ~2 seconds. I want to ensure that if the user double clicks on it, that the controller won''t do two payments. Right now, I do a redirect after the payment succeeds, so a refresh of the page won''t cause a problem but I am worried about multiple requests