Displaying 20 results from an estimated 700 matches similar to: "Problem with a setter that converts euros to cents"
2006 Jun 07
1
Setter that converts a float attribute to integer
Hi,
I have some problems with an application where I''m using custom
accessors to do currency conversions. In my model, I have a price
attribute in the database that stores the value in cents, to avoid
future problems with float arithmetic and round. But at the views, I
would like to show the price in euros, with decimal for the cents. So
I defined a new attribute called price_in_euros,
2006 Jun 18
2
Hosting timezone differs of clients timezone
Hi,
I have a website in production wich uses a lot of date and time
calculations to show specific information.
The timezone of my hosting service (Dreamhost) is PDT, and the timezone
of my potential clients is CEST. There are 9 hours of difference between
them.
Is there an environment variable that I could adjust in my rails
application, so all date/time values be set to CEST timezone?
Thanks.
2006 Jun 13
2
Top margin on PDF generated with PDF::Writer
Hi,
A little question. I''ve written a method that uses PDF::Writer to
generate a PDF document with some images and text. This is the code on
my controller:
def pdf
gen_pdf
redirect_to("#{@request.relative_url_root}/pdf/cupones.pdf")
end
private
def gen_pdf
pdf = PDF::Writer.new(:paper => "A4")
pdf.margins_cm(0)
pdf.start_columns(2, 0)
pdf.select_font
2008 Mar 24
1
Support for unparsed responses and json parser
This is my first message to the list. Hello everybody!
I just wanted to let you know that I submitted a couple of patches for
two features that you might find them of interest.
The first one adds support for unparsed responses to
Facebooker::Session and Facebooker::Service models. This allows to use
the
Facebooker::Session.post method to obtain a plain response from the
Facebook API, useful for
2005 Dec 23
10
Extending model
Hi,
I''m looking for a way to extend one of my models to allow some level
of abstraction between what goes into it and how it is stored.
For example, say I have a Product and I want to set it''s price. A
person using the website will type the price in euros. Internally, I''d
like to store the price as an integer value of cents.
I can currently do this with some ugly code
2008 May 14
2
MissingSourceFile: no such file to load -- digest/shal
I attempted to bring up digest/shal in the console but it seems to not
be in there. After - gem update I still do not have this file.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
2006 Apr 21
2
Using before_create and conflicting setter method...
Hi,
I am having trouble using before_create when I have an specialized
setter method:
before_save :set_campaign_start
#-----------------------------------------------------------------------
-------
def set_campaign_start
self.campaign_start = Time.now
end
# We want the date to always start at midnight
2013 Apr 22
0
setter method in rails 4 beta 1
I have a virtual attribute ''tags'' , and defined a setter method for it
tags=(val).
My setter method is not called while creating a Article.
I copied my rails 3.2.11 code in rails 4, it was perfectly working in
former.
I want to know who can i use setter method for virtual attribute in rails 4.
Or is it a bug in rails 4.
I raised this as a issue in
2010 Apr 18
1
Getter and Setter with non DB property
Hi,
I can''t find how do i created a getter and setter property for a non db
property. what i have done isnt working, i have a cnt mass assign error.
Here is what i''ve done:
attr_accessor :creator_is_participant
def creator_is_participant
@participe
end
def creator_is_participant=(participe)
if participe == true
@participe = true
else
@participe
2006 Jun 01
1
Automatted Getter/Setter
Hey..
So I have a model that has a lot of number fields. Each of these go
through a process when read in and read out to add/remove commas
(between every three numbers) to make them more readable.
The getter I currently have is like this:
def sale_price
Listing.insert_commas(read_attribte (:sale_price))
end
and the setter is:
def sale_price=(price)
write_attribute(:saleprice,
2005 Dec 25
0
Setter not being called
I have written the followign setter to raise an exception when the field
disabled_on is beeing assigned a value minor or equal that the enabled_on
field.
class Survey < ActiveRecord::Base
def disabled_on=(date)
raise AssignmentException if date != nil and date <= self.enabled_on
write_attribute(:disabled_on, date)
end
end
The matter is that this method never gets called, as I
2011 May 26
0
Reference Classes: getter and setter functions/methods and possible shortcuts
Hi everyone,
just wanted to ask what's the smartest/recommended way of defining
getter and setter function *shortcuts* (i.e. something like "[", "[<-")
for Reference Class objects?
Or is it desired to not use this stuff, but define methods like
'obj$getSubset(row=1:3, col=1)' and 'obj$setSubset(value=x)' instead?
I have some example code that might
2007 Jun 26
1
ActiveRecord: Attribute Setter for belongs_to relation attribute
Hi,
I m trying to link into the process of setting an belongs_to attribute
in my model. Unfortunetly, it does not seem to be as easy as for
"normal" attributes.
I ve tried the following:
class Treatment < ActiveRecord::Base
belongs_to :drug
def drug=(new_value)
''my stuff
super new_value
end
However, that does not work. Ive also tried self[:drug] =
2017 May 21
0
[PATCH 2/2] python: unicode decode handler error scheme setter
The set_decode_error_handler function allows the User to set the
decoding error scheme to be used when non UTF8 characters are
encountered in Python 3.
The function has no effect in Python 2.
Signed-off-by: Matteo Cafasso <noxdafox@gmail.com>
---
generator/python.ml | 16 ++++++++++++++++
python/handle.c | 18 ++++++++++++++++--
python/t/test830RHBZ1406906.py |
2009 Aug 17
1
Problem with setter override on ActiveRecord
(This message was originally written on StackOverflow -- the
formatting is much prettier there --
http://stackoverflow.com/questions/1283046/problem-with-setter-override-on-activerecord)
This is not exactly a question, it''s rather a report on how I solved
an issue with write_attribute when the attribute is an object, on
Rails'' Active Record. I hope this can be useful to others
2007 Dec 16
4
Make AR setter methods private?
Hi,
I have a AR model that I want to limit changes to be only via instance
methods that I''ve added.
How do I prevent my other sw from setting the instance''s attributes?
I know about #attr_protected and #attr_readonly. But the first leaves
the individual setters as they were and the second stops all changes.
I want something like "attr_private"
Thoughts?
Thanks,
2006 Jan 28
1
worth a few Euros?
Yo Timo, did you say that login processes "just don't
crash"? Found these while doing load/malformed data
tests. Got the kernel patch allow_setid_cores
working. Don't have time to check if they're
exploitable. Probably time to get a gamma version out
for people, eh?
Cheers,
Jared :)
2004 May 27
3
"privileged slots"
Hi all,
in the help for RClassUtils I found the expression "privileged slots" in
function "checkSlotAssignment" with the explanation:
/privileged slots (those that can only be set by accesor functions
defined along with the class itself)/
I thought all slots of a (not private) class can be a accessed by a user
via the @ Operator.
Is there a way to make a single slot of a
2010 May 31
0
hello cents os network proble dk dkim and dlv
hello all reader
hello centos network
I use to bind core fecora 12
http://jason.roysdon.net/2009/10/16/building-bind-9-6-on-rhel5-centos5-for-dnssec-nsec3-support/
I am having problems with my dk and dkim signature of my emails
I have successfully made the process of verification of signatures dnssec
all my domains are correct and good displays on dlv.isc.org
the reason for my problem just the
2011 Apr 15
3
cents 5.6 ..... futur
To pass from Centos 5.5 to 5.6 it was easy as an upgrade.
Will it be the same from 5.6 to 6.0 or a full install will be better.
---
Michel Donais
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20110414/8d100c75/attachment-0005.html>