Displaying 20 results from an estimated 1100 matches similar to: "Formatting values of numbers using text_field"
2006 Mar 01
3
Form helpers and overloaded methods - help!
Can someone explain why form helpers appear to bypass any model methods
I override for fields that are bound to database fields? It would be
great if someone could tell me how to force the form field, etc to call
the method instead of looking at the database / attributes collection.
Let''s say I have a column called ''price'' in my database table "books"
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/.
2008 Jul 01
2
rateable plugin problem
I am having some problem figuring out how to use the rateable plugin. i
followed as close as the directions located at
http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system
but there seem to be some problem.
I am getting the following error
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.rating
Extracted source (around line
2006 Feb 20
0
Windows Deployment questions
Hello out there in Rails land. This is a multipart question so please
bear with me...
First, the background info:
I''ve been making Apache work on our Windows servers here and I''m having
good luck. However, I notice that Apache+FCGI doesn''t scale quite as
well as I''d hoped.
I have one static process defined for my FastCGI server, and I see about
5 requests
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 Sep 23
8
acts_as_rateable plugin help!
Hello,
I am having some trouble figuring out how to use the rateable plugin. i
followed as close as the directions located at
http://www.naffis.com/blog/articles/2006/08/31/rails-ajax-star-rating-system
but i fail at working it.
i am getting this error
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.rating
Extracted source (around line #1):
1:
2007 Jun 04
1
acts_as_rateable in Beast
I''m trying to implement acts_as_rateable to my Beast installation to
give users the option to rate posts (like reddit). I chose
acts_as_rateable as it supposedly easily allows reddit-type voting but
I''m having some problems setting it up and the documentation seems
outdated.
(http://www.juixe.com/techknow/index.php/2006/07/05/acts-as-rateable-plugin/)
So far, I''ve
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
All,
I''m having a hell of a time figuring out what is going on here.
I''m trying to override one of my getters so that I can format it a
certain way in my form. But I can''t seem to get text_field to call the
appropriate method on my object.
So here''s my getter:
public
def FAX
fax = read_attribute(:FAX)
puts fax
2006 Feb 21
4
displaying double digits
Hi,
I have a question about displaying digits in Rails.
whenever I print the price of an item, if the last digit is a zero or
double zeros then it doesn''t display properly.
How do I display a number so that it looks like currency?
thank you!
--
Posted via http://www.ruby-forum.com/.
2006 Feb 28
6
File_column, RMagick, and watermarking
I''m working on a photo gallery and I''m using File_column to handle the
uploads of the files and create my thumbnails, but does anyone here have
any idea how to have a watermark (opaque text maybe) placed over one of
the versions? Any ideas on how to go about this would be great. Even if
it''s just straight RMagick code, that would be fine too.
Thanks in advance for the
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?
2006 Mar 02
0
syntax for number_with_precision
I normally use number_with_precision in my views and I''ve never had a
problem.
Now however, I need to use it in my controller because my Ajax method is
calling the controller and the controller will return values to it which
will be displayed in the span of my html document.
In short, what am I doing wrong in the statement below? I need the ''bid''
to be formatted
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/.
2006 Jul 03
4
text_field doesn''t call overridden ActiveRecord getters
All,
In a template, I have
<%= text_field :target_list, :DateReceived,
{ :title => ''uploaded_at'',
:class =>
''target_list_info'',
:disabled => ''true'' } %>
Here is the DateReceived method on my
2008 Dec 06
0
Problem in number_helper.rb ?
Hello,
Today I noticed that the number_to_currency helper didn''t work anymore
(it just returned the numeric value, without any currency).
I tracked down the error and saw that editing line 89
( number_to_currency method) as follows solved the problem :
Old piece of code :
begin
format.gsub(/%n/, number_with_precision(number,
:precision => precision,
:delimiter =>
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 Jan 11
8
Enterprise Rails Apps
Is there a place I can get a list of "enterprise" Rails applications?
Apparently, even though I''ve looked at the wiki and cited the examples
there, there are some at my organization who still can''t find proof that
Rails is usable in an enterprise setting.
Would you fine folks be able to tell me about some large-scale projects
that could be classified as
2006 Aug 04
0
How do you use form helpers in your controllers or classes?
I need to use the number_with_precision Form helper in my controllers
and classes.
How do i do this?
Thanks in advance
Chris
--
Posted via http://www.ruby-forum.com/.
2006 Jul 21
3
adding numbers
hi! how can i add all the values from one tables field? i mean, i have a
table with the entries of a booking (amount), and at the end, i want to
have the total.
i tried with different loops making a method in the model, but nothing.
im doing something wrong, but i dont know what.
please could somebody help me?
ty!!
--
Posted via http://www.ruby-forum.com/.
2010 Apr 26
0
add a new format to locales
hello list,
i try to add a new format to my locales file de.yml
i looks like that:
de:
number:
square_meter:
format:
unit: ''m²''
format: "%n %u"
precision: 2
separator: '',''
delimiter: ''.''
after that i''ve copied the number_to_currency method to the