similar to: number_to_currency inside model

Displaying 20 results from an estimated 400 matches similar to: "number_to_currency inside model"

2009 Jul 24
7
number_to_currency not working since 2.1.1
Back in 2.1.1 everything was sweet: Loading development environment (Rails 2.3.3) >> include ActionView::Helpers::NumberHelper => Object >> number_to_currency(12.3) >> "$12.30" Then I upgraded to 2.3.2 and: Loading development environment (Rails 2.3.3) >> include ActionView::Helpers::NumberHelper => Object >> number_to_currency(12.3) >> 12.3
2005 Jul 24
1
international version for number_to_currency ?
bryce benton wrote: > number_to_currency(1234567890.506) => $1,234,567,890.51 BTW agile book does mention this .. will this number_to_currency(x) be internationalized ? or i can set it to Indonesian for example (or to any other languages rather than just English) ? -- Salam hangat, <%= Arie %> | http://blog.riyari.com | Y!: riyari3 email: ariekusumaatmaja_at_riyari_dot_com
2006 Apr 08
2
Cannot use view helpers in RJS helpers
Any ideas why I would get an error in a RJS helper on view helpers such as number_to_currency. Example: # my_template.rjs page.help_me # my_helper for my_controller def help_me number_to_currency(10) end I have also tired page.number_to_currency but that doesn''t work either. Cheers, Nicholas
2009 Sep 24
2
Calling ActionView from uninheriting class
Hi Gurus, I have a class, specified in models cart.rb, which doesn''t inherit from anything--it''s just a container class Cart ... I just discovered I can''t call number_to_currency in that class. Any idea how to "include" it in my code? I tried ActionView.number_to_currency without luck. I could kill a few lines of non-DRY regexp code in cart.rb if I could
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
2006 Aug 18
4
HELP!!!! - number_to_currency in model?
Hi, I''m trying to use number_to_currency in one of my models, but i''m getting the following error: undefined method `number_to_currency'' for #<Product:0x396d680> Obviously, my Product model can''t access number_to_currency -- is there something I need to do to make it available? Thanks so much for your assistance. -- Posted via
2007 Dec 06
3
number_to_currency
I am using the number to currency function because i live in the uk and the company want me to only show values of the pound of course.I have created all my application using ruby script/generate scaffold_resource.... I have come across with a problem... this code is in my applcation: def number_to_currency(number, options = {}) options = options.stringify_keys precision, unit, separator,
2006 Feb 28
4
number_to_currency UK pounds
I work in the UK and therefore most of my currency figures will be in UK pounds. I realise that to format a number to a currency format I can use: number_to_currency(amt, :unit => "?") but it would be more convenient to set ? as the default currency symbol. What is the best way to do that? Should I edit line 39 of this file:
2006 Jun 23
6
float calculation error
Hi I have the following values pActualCost = 33.00 pPaymentCost = 29.99 So this calculation should leave me with 0.01 pPaymentDifference = pActualCost - pPaymentCost however when doing this in rails, it returns 0.00999999999999801 has anyone got any suggestions to whats going wrong and how I can correct this Thanks Scott -- Posted via http://www.ruby-forum.com/.
2006 May 21
6
Is there a way to call helper methods in a controller?
Hi, Is there a way to call helper methods in a controller? I want to do something like this in my controller Class MyController < Action.... def my_method string = link_to "some_url", :controller => "home", :action => "command" end end link_to is an ActionView helper method and it seems that I couldn''t access the method in the controller
2006 Oct 08
3
Call an helper method from a controller
Hello, this have been debated few times in the forum but I didn''t found a satisfying solution : my problem is very simple, I have few methods dealing with cookies that are intended to be used in controllers and views. Let say I have the read_cookie() method. Because it deals with the response object putting this method in the /lib directory doesn''t fit nicely because I
2010 Oct 16
3
Doubt with symbols in Rails
I was trying to write a wrapper for number_to_currency to return currency in pounds. I used a helper class to do this. def number_to_pounds(amt) number_to_currency(amt, :unit => "£") end This works fine, but I am trying to understand why I can''t use a symbol to pass the values. I thought symbols were like pointers. (you now know I am a newbie). def
2006 Jan 27
3
Formatting Data in rhtml
Is there a simple way to format your data in the .rhtml file? I come from a PHP/Smarty background, and in the templates, I''ve used what is called "modifiers" to format data. {$price|currency_format} # displays in currency format {$description|truncate:"100"} # Truncates the description after 100 characters It seems like the template (rhtml) would be the ideal
2008 Feb 05
5
how can my model reference a helper?
I know, I know, they''re not allowed to. But here''s my problem. I''ve got a really simple model with two fields, name and price, which I want to show in a form select drop-down. "collection_select" takes a ''text_method'' parameter, which is the method in the model that gets its value placed in the <option> tag. Because I want to show both
2006 Jan 06
2
How do I reference eagerly loaded Models in the View?
[I hope the repost isnt'' "minded". Following the advice of another thread I''ve changed the subject to a question. If I haven''t included important info, please ask. My database is being unduly killed. Jodi] Cheers on-the-Rails-ers, Before I start, I''ve read the ActiveRecord docs on eager loading, but for the life of me, I can''t seem to get
2009 Mar 04
10
total per user
so I am trying to sum month over month the amount that a user has posted. So for example: User 1: Jan $3000 Feb $4000 March $1500, etc. I can get this to work if I sum totals (aggregate of all users) but just not by user. Here is my code in the controller: def index @users = User.find :all, :order => ''name ASC'' @deal_groups = Deal.find(:all).group_by {|t|
2006 Mar 12
1
alias_method interferes ApplicationHelper
Hello, I''m using Ruby 1.8.4 (darwinport), rails-1.0.0 (gem) , Powerbook / Mac OS X 10.4.5 , Webrick. How come Rails always raises NoMethodError for my helper (must_fill and rp or number_to_currency_rp) in application_helper.rb ? I doubt that alias_method is the culprit, but if i give # comment then there will be no errors at all ... :/ what am i doing wrong? is it a bug or stupid me? Thx
2008 Apr 24
7
Please help. The error occurred while evaluating nil.name
Okay so heres my code which works fine, i''ll explain the problem below. <% for num in 1..-04Gazou6+pmm/bHYDwDEOA@public.gmane.org %> <table class="products" id="table1" cellspacing="2" cellpadding="3" border="3"> <tr> <td> <table width="25%"> <tr> <tr> <td><%=
2007 Nov 27
3
Disappearing decimals... please help!
Maybe it''s all in my head, but I''m having the strangest little issue ever. My pricetags in my rails app are always whole numbers. Rails seems to completely ignore my decimal input. So as a consequence, 10.41 becomes 10.00, always. Here''s some worthwhile stuff: within my 004_create_products.rb file: :price, :decimal, :percision => 2, :default => 0 And calling
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'' %>