Displaying 20 results from an estimated 500 matches similar to: "Setter not being called"
2005 Dec 27
2
Error when starting WebBrick after installing Login Engine.
I''ve installed and configured my app according to the instructions of the
README file. When I try to start WebBrick i get the following error:
./script/../config/../config/environment.rb:55: undefined method `config'' for
LoginEngine:Module (NoMethodError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require__''
from
2009 May 20
1
Problem on rack_setup
I''m having problems trying to set up facebooker on a Rails 2.3.2
project using :active_record_store for cookies. The problem happens
because of this commit:
http://github.com/mmangino/facebooker/commit/308770447db06433e505aaf27db2614cee213cc2
That code is trying to add the Rack::Facebook to the dispatch chain
after ActionController::RewindableInput or
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
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,
2006 Jan 28
1
Unit Tests Behavior
Hi,
Working on unit tests and I have a few cascade delete constraints I am
testing.
The unit tests stop at the first assert_raise test. Is this typical?
def test_destroy_all_cascade_delete
assert_equal 1, Iep.find(:first).client_id
assert_equal 1, Encounter.find(:first).client_id
@client.destroy
assert_raise(ActiveRecord::RecordNotFound) { Iep.find(1) } <--
2006 Mar 08
0
Unit tests dynamic finders
Hi all,
I am having a problem with unit tests. Whenever I have a dependency
between two models (B depends on A) deleting A should also delete B.
This is simple with the dependent parameter in the model file of A. But
when I write a test the dependency seems to work, I can''t find the
answer with id 1 anymore(Answer.find(1)). But I appearently _do_ find it
with
2006 Nov 22
1
Using assert_raise
When Im writing tests and I do:
assert_raise RuntimeError, raise("raising")
Then I run the test is says the test failed and I have 1 error:
RuntimeError: hey
Should assert_raise catch that error and say the test passed?
Thanks for your time and help.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because
2006 Jul 18
2
Testing which RuntimeError is raised
I am just starting to use unit testing. Way cool. But I am not finding
very clear docs on assert_raise. I have managed to write a test that
tells me that the destroy I am trying to test fails with a
RuntimeError (as it should). However, I would really like to test that
it rails for the specific reason I have in my model. How can I get
more specific? Am I going to have to create my own exception
2009 Jun 29
0
[PATCH server] Add svc_vm_actions method to VmService.
Also includes a couple minor model changes to support better
error reporting.
This method was added so that a client could submit multiple
vms to the service layer in one call and get back appropriate
messages showing any failures without those failures also causing
the entire call to fail, or forcing the client to implement handling
(begin/rescue blocks) of these errors to continue through the
2008 Oct 24
1
rescue_from and assert_raise
Since commit 5e3517ea7b9fbd460f772bffc9212d882011f2bc, rescue_from is
now being handled in tests. I''ve been using rescue_from to handle
custom exceptions and testing that those exceptions are raised in
functional tests with assert_raise. This no longer works now. What''s
the proper way to test this now?
--~--~---------~--~----~------------~-------~--~----~
You received this
2006 Dec 28
0
problem with assert_raise in Unit Test
I''m running a simple unit test to validate that ActiveRecord raises an
exception when I try and update a column with a duplicate foreign key.
Inside the unit test,
charge.time_logs << time_logs(:first)
will generate
ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry
''20'' for key 2: UPDATE time_logs SET `task_id` = 1, `date_created` =
NULL,
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
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 |
2001 Jul 11
1
Porting MS Structured Exception Handling to Linux.
Hello all,
I am trying to port some more code from windows 2000 to linux. The
specific functionality I would like to port is called "Structured
Exception Handling" and it works like so:
1. Define a function which based upons a signal throws an exceptoion.
For example:
void translateException(unsigned int u, EXCEPTION_POINTERS* pExp)
{
switch (u)
{
case (unsigned
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 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,
2012 Feb 23
1
Bug in nested_attributes_for: question about best way to patch
I''ve discovered what I''m pretty confident is unexpected behavior in
accepts_nested_attributes_for, and am developing a patch, but I''ve
encountered a question about how the core team would prefer the
implementation to look.
Here''s the bug: when assigning to a belongs_to relationship (and I
believe one-to-one, but I haven''t verified yet) if you mark the