Displaying 20 results from an estimated 700 matches similar to: "add a new format to locales"
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 =>
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,
2008 Jan 15
9
using postgres rails/rake fails
hello list,
yesterday i installed a fresh rails installation with a proper upgrade
of gem to version 1.0.1
i saw, there is still a gem package to support postgresql known as
postgres-0.7.9.2008.01.09
on rubyforge, its the newest one of stable postgres support for ruby
additionally i installed, of course, a the postgres database on my
machine to
C:\Programme\PostgreSQL\8.2
after setting up a new
2006 May 14
0
Beware of HashWithIndifferentAccess#symbolize_keys!
Hi,
I just posted a patch tot he rails trac for a bug we found where
running symbolize_keys! on a HashWithIndifferentAccess will delete all
items from the hash. Please make sure you either never call
symbolize_keys! (or to_options! which just alias it) on a
HashWithIndifferentAccess, or apply the path attached from the ticket
at: http://dev.rubyonrails.org/ticket/5076
I also posted a much longer
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
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 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 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 Apr 19
3
How to find nil object error in the rails application?
After I added some plugins to rails my application it begin to give
following error.
Error during failsafe response: You have a nil object when you didn''t
expect it!
The error occurred while evaluating nil.symbolize_keys
(originally You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.symbolize_keys)
But there is no stack trace I dont
2008 Jan 18
2
NameError when using alias_method -- but method exists?
Hello Rubyists,
I am a bit stumped here. I want to extend the ''load_file'' method in the
YAML module. Following along with the PickAxe example of making old
methods do new things, I try this in irb:
>> module YAML
>> alias_method :orig_load_f, :load_file
>> def load_file(*args)
>> contents = orig_load_f(*args)
>>
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
2006 Feb 24
2
Formatting values of numbers using text_field
Anyone have a quick solution on how to format a number in a text_field
tag?
<% text_field "price", "amount" %> returns 100.0 and it would be nice
if it showed 100.00
Of course, number_with_precision works nicely, but how do you make that
work with text_field?
I thought maybe overriding the getter in the model. However, this means
I would have to bring the helper
2010 Feb 22
0
Re: rake db:migrate throws unexpected error
danwoods wrote:
> The Error:
> (in [my current directory])
> rake aborted!
> undefined method `symbolize_keys'' for nil:NilClass
Given that nil does not implement symbolize_keys you need to know where
you''re ending up with a nil.
Have your run your rake task with the --trace option to see if you get a
backtrace that will show you where to look?
rake --trace
2007 Sep 18
0
Help with RESTful named url options
I''ve found quite a few posts on the subject, but no satisfactory
answers. Maybe Rails just doesn''t support this yet.
How do I create a url with a named RESTful route that also has
parameters?
I want to write this:
link_to_remote "Show Details", {:url => item_url(@item, :details =>
1), :method => :get}
And get this:
<a href="#"
2005 Mar 15
0
0.10.0, Routes and Query strings
So I made the leap to 0.10.0 but I can not get routes to play nice
with query strings...
I have this mapping in my routes.rb file
map.connect '':controller/:action/:id'', :controller => ''main_controller''
This is all cool and everything works fine http://www.siteroot.com/
maps to http://www.siteroot.com/main_controller/index
But when I add a query string to
2007 Apr 18
3
nil.symbolize_keys -- error with attachment_fu
I''ve spent at least 2 hours on this one problem. On my local machine
in my controller I have this:
def new
@page_title = "New User"
@user = User.new
@photo = Photo.new
end
All is good.
Now, on the remote server I get an error when accessing the ''new''
view. If I remove @photo = Photo.new from the controller then the
error goes away. This same error
2009 Aug 07
2
paperclip model fails while when updating with no attachment
Hi all,
I have paperclip running in my rails environment. I setup a new model
just for paperclip called Assets so that I could upload multiple files
per item (even though I''m only using 1 attachment per item at the
moment). Everything works except for the following:
Updating an item record with no attachment in the form but having
PREVIOUSLY attached an asset while creating or updating.
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:
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
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