Displaying 20 results from an estimated 2000 matches similar to: "displaying double digits"
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 Mar 01
15
Is there a perl equivalent of .= in ruby/rails??
I want to make a for loop that concats strings onto a variable:
html .= var1 + "this is a test" + whatever
What is the syntax that does this in ruby/rails?
Also, is there a ''print'' method in ruby? Because when I try to use
render_text it will only let me use this once.
--
Posted via http://www.ruby-forum.com/.
2006 Feb 21
4
customizing layouts for functions
I want to be able to have different layouts in my rails program for
different functions.
For example, when a person first comes to the site the layout will have
a link that says ''home'', ''login'', or register on the menu bar.
Once the user logs in however, the layout will change. I want it to show
the links ''account manager'',
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 Mar 31
3
Need to use a method without the layout
I need to use a method (called by one of my controllers) without using
the layout. All the other methods in the controller need to use this
layout except for thismethod (becausae it''s called by an Ajax script). I
know how to use :layout=>layout_name when calling a method from another
method, but nothing is calling this.
The layout needs to be removed in the method itself or I need
2006 Jan 17
9
Formatting a float with a set number of decimals
Another newbie question:
How do i convert a float to a string, rounded to a certain number of
decimals?
Thanks
--
Posted via http://www.ruby-forum.com/.
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
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 06
2
Quick Question: Using a CSS class statement in a link_to tag
Hi,
I have a css file with lots of classes. I want different links on my
page (which all use the ''link_to'' tag) to belong to different classes so
that I can format their font, size, color, etc.
Where or how do I use the css class name in the link_to tag?
Thank you very much
--
Posted via http://www.ruby-forum.com/.
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 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
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
2010 Feb 24
2
How to read percentage and currency data?
I'm struggling to find any help on this seemingly simple question - how does
one read data with percentage (%) or currency (?,$ etc.) signs? When I try
to read a data file which has any of those symbols in the data fields, they
are read as characters rather than values. Is there a function or library
which can deal with such values?
As an example, I use this sample from one of chinna's
2009 Sep 09
5
Newbie question: undefined method 'number_with_delimiter'(probably configuration problem)
Hi all:
i am using gem to insall rails 2.3.3 and using $rails myapp to
generate my application, but strangely i can''t use the number_helper
below is my env:
export RUBY_HOME=$HOME/ruby
export GEM_HOME=$HOME/gems
export RUBYLIB=$RUBY_HOME/lib:$RUBY_HOME/lib/ruby:$RUBY_HOME/lib/
site_ruby/1.8
export PATH=$HOME/gems/bin:$HOME/ruby/bin:
and:
$ locate number_helper.rb
2006 Feb 23
6
irb with rails
I was trying to access rails functions (number_with_precision) from an
irb session.
It can''t find the method. How do I load the libraries ?
TIA
LS
--
Posted via http://www.ruby-forum.com/.
2007 May 12
4
Multiply and format with thousands separator
I have just started with Ruby and Rails and am still greatly confuse,
finding the usual tutorials not much help.
What I want to do is take two numbers from my database, multiply them
together and display them in a list with a comma for the thousands
separator. This would be very easy to do in a spreadsheet, so I assumed
it would be easy to do in Ruby on Rails but I can''t work out how.
I
2006 Jan 24
7
formatting numbers with commas
I needed to format numbers with commas to make it more human
readable. Here''s how I did it.
def commify(number)
c = { :value => "", :length => 0 }
r = number.to_s.reverse.split("").inject(c) do |t, e|
iv, il = t[:value], t[:length]
iv += '','' if il % 3 == 0 && il != 0
{ :value => iv + e, :length =>
2009 Aug 03
5
Decimal datatype and trailing zeros
Hello
I''ve encountered a little problem with zeros using the decimal data
type
Specifying a scale of 3 and inserting a number with 3 zeros after the
point (for example 12345.000) it gets correctly stored in the
database, but rails insists to show me the number only with the first
zero after the point (12345.0)
There is a way to tell rails to not truncate at the first zero?
2009 Sep 30
2
What is this view syntax? Old beast forum code...
Hey folks
A long time ago, before i started working at this company, we used a
Beast forum. The beast code (models, controllers and views) were all
just lumped in with our app code, but when we moved to a new version
(about a year and a half ago) the forum section of our site was closed
off (simply by not linking to it anywhere).
I''ve been tasked with resurrecting it, and the first