Displaying 20 results from an estimated 300 matches similar to: "MySql Memory Error"
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 28
1
simple output string
Hi!
I am new to Rails and wanted to know how I can print an easy
string-line.
I wanted to generate a dynamic title for my blog articles made with
"typo":
The first part of the html-title stays the same:
<title>softrockcookie</title>
if it is not the mainpage ("softrockcookie") it shall add the
page_title, so:
<title>softrockcookie <%= page_title
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
2008 Jun 02
1
Looking for help on two issues with Rails 2.1 and RSpec 1.14
I have specs that ran fine in Rails 2.02/RSpec 1.13 that are failing on
Rails 2.1/RSpec 1.14.
There is one problem and one issue:
problem: sometimes (but not always) I get a NoMethodError referencing a
has_many association
issue: in helper specs, instance variables don''t get set unless the
HelperModule is included. Using the preferred helper.<method> I can''t seem
to
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
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
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
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
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
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,
2012 Mar 16
0
Rails tests failing
http://dl.dropbox.com/u/15024055/CloudShot/shot_15032012_232654.png
if i write the test like this its working just fine it passes green
[code]
it "should have the right title" do
get ''view''
response.should have_selector(''title'',
:content => "View Snippets")
end
[/code]
but for
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
2011 Sep 04
4
same html elements rendering twice on page
hey all,
My index.html.haml:
- wrap do
- page_title "Teams List View"
application_helper.rb:
def page_title(title)
content_tag :h1, title
end
def wrap(&block)
concat(content_tag(:div, capture(&block), :class =>
"generic_header"))
end
I load in browser and get:
<div class="generic_header"><h1>Teams List
2007 Jun 19
1
javascript_tag replacing whitespaces w/ '%20'
javascript_tag replacing whitespaces w/ ''%20''
Hello,
I have a form that tests if a title has been changed since the page
was loaded and the page has been submitted. If the page title has been
changed then a confirm box will ask if the user wants to have the title
changed. The problem is if the person hits cancel, all white spaces
in the title get replaced w/
2010 Aug 21
4
No route matches?
Hi all,
I''m coming from the PHP world and I''m trying to learn Ruby and Rails.
I''m having a problem where I keep getting the error "No route matches /
home/view" even though I have it defined it. I''d appreciate any help
on this. I''m using rails 3.0 and the setting for the environment is
"development".
# routes.rb
2007 Mar 22
1
Functional test and flash with an error
I''m getting this error thats moaning about expected tag, but no tag
found matching {:content=>"User James Apps was successfully created.",
:attributes=>{:id=>"notice"}, :tag=>"div"} in the file application.rb.
I tried using a regular expression - /#{user.first_name}/ , but that
wouldn''t work either
user_controller_test.rb
1) Failure:
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
2006 Nov 04
0
RJS not setting form input value correctly
Good day.
I have spent almost 2 days on this issue.
I have asked everyone from my Rails expert to my Javasript expert and we can
not for the life of us figure out the issue with this one form element.
I have a form which contains several readonly/disabled (firefox/ie) form
elements.
ALL elements in the form are updated correctly EXCEPT this one form element.
The form element in the view looks as