Displaying 20 results from an estimated 2000 matches similar to: "Major issues with ActiveRecord callbacks in BackgroundRb r324"
2006 Apr 12
0
Netmask validator
Sharing the wealth. I just finished working on a custom netmask
validator and thought others might benefit. Of course, comments and
suggestions are welcome.
def validates_netmask(*attr_names)
configuration = { :only_numbers => ''must only use numbers as octet values'',
:range => ''has one or more octet values that are > 255'',
2006 Sep 04
2
"include" versus "extend" - what's the difference
Hi,
Just wondering when one would use "include" over "extend"? Both seem to
bring in methods to the class no?
The context is I''m just trying to understand why both are used with the
acts_as_audited plugin:
Full extract from plugin (used within here):
==================================================
# Copyright (c) 2006 Brandon Keepers
#
# Permission is hereby
2006 Jul 06
0
updating model bypasses callbacks
Hi,
Very quickly, I''m having trouble calling my before_save ro before_update
callbacks when I do something like User.update(id, params["user"]). I
notice that Rails is calling after_save but for some reason it doesn''t
call the before_save or before_update callbacks. Any thoughts would be
appreciated.
Thanks.
--
Posted via http://www.ruby-forum.com/.
2010 Jun 04
3
[LLVMdev] Is there a "callback optimization"?
By that I mean an optimization pass (or a combination of them) that turns:
void useCallback(void (*callbackfn)())
{
// Do something
callbackfn();
// Do something else
}
void myCallback()
{
// Respond one way
}
void myOtherCallback()
{
// Respond another way
}
void foo()
{
useCallback(myCallback);
useCallback(myOtherCallback);
}
into:
// Keep the original; it'll get removed
// by other
2006 May 24
1
Observer behavior differences between DEV and TEST environments ?
Hi all !
I''m having an issue and I can''t seem to make heads or tails of it.
I am attempting to add an observer to a model object. I created
app/models/greenback_transaction_observer.rb, inherited from
AR::Observer, defined methods, registered in config/environment.rb,
but things don''t work...
So, I took a step back and put in the following code:
class
2005 Apr 08
2
attr_names in test67
Hello,
I'm wondering if the following situation is valid (though I think it
isn't since I still cannot authenticate with ldap pass/userdb on
test67 running on FreeBSD-5.3).
Is it normal that the passdb_ldap_conn->attr_names second element (for
instance) "turns to" "homeDirectory" as the following step by step gdb
run sample shows ? :
--
Breakpoint 1,
2006 May 18
1
Introspection of validates_presence_of
Hello all.
I don''t know how to get all symbols passed to method
validates_presence_of in model. I''ve trying to use following solution:
class News < ActiveRecord::Base
validates_presence_of :title, :text
def validates_presence_of(*attr_names)
@@obligatory_fields = attr_names
ActiveRecord::Base.validates_presence_of(*attr_names)
end
def obligatory_fields
2007 Oct 20
0
Proper timestamps in callbacks
Yay, another Task model:
## the model
class Task < ActiveRecord::Base
attr_accessible :lots, :of, :stuff, :but, :not, :finished_at, :and, :finished
before_save do
@before_save.call if @before_save
end
def finish
self.finished = true
@before_save = proc { self.finished_at = Time.now }
end
end
## usage
t = Task.find(some_id)
t.finish
t.save
(same code on pastie:
2008 Mar 11
6
saving an ActiveRecord without trigging the callbacks
Hello,
How can I save an ActiveRecord without trigger before_save,
after_save, etc?
Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group,
2006 Jul 20
0
Custom Rails Application Logging
I am trying to add custom logging to my rails app via a ''.rb'' module
file in the ''/lib'' directory and then call it from my models via
CallBacks (ie: before_save, after_save, etc).
It loads the module just fine in my class and the CallBack executes the
module''s code. However, my module (remember it''s in the ''/lib''
2007 Aug 18
0
RSpec and acts_as_attachment
Hey guys,
I''m getting a weird error when trying to test something like the
following. It''s a model that is using acts_as_attachment but the
weird thing is the equivalent Test::Unit case passes. Does anyone
have any ideas?
Best,
Dave
# it was a Test::Unit case first
def test_should_be_invalid_without_file
UserFile.any_instance.expects(:with_image).never
2006 Dec 12
2
RXML partial question
All,
I have a RXML template which renders partial RXML templates within it.
A snippet is below. The "xml" variable is the parent template''s Builder
variable. It is passed into the partial under the name "parent_xml".
Why can''t I use :locals => {.... :xml => xml ....} in my call to render
the partial? It seems like if I do use :xml => xml, it
2005 Mar 30
2
test65 killed by SIGSEV
Hi,
I had successfully set up dovecot-1.0-test62 + ldap pass/user db, but
now I'm encoutering a SIGSEV problem with a similar set up of a brand
new dovecot-1.0-test65 installation.
The auth process is killed by a SIGSEV as reported in the error log file :
dovecot: Mar 30 17:06:59 Error: child 28291 (auth) killed with signal 11
To be precise, the problem occurs in the
2005 Apr 12
1
test67 ldap_connection
Hello,
I've been trying to figure out what's wrong with authentication
against an ldap pass/user db with test67 as test62 was working fine.
[ The problem is the same as previously described in this list :
- FreeBSD-5.3
- dovecot-1.0-test67
- openldap-2.1.27
--> "ldap(dovetest,127.0.0.1): No password in reply"
--> "NO Temporary authentication failure."
or
--
2006 Nov 19
1
ActiveRecord save-update not performed ?
I try to understand the following issue :
- when creating a new User record, I use an UserObserver to trap the
before_save call back and send an email
def after_create(user)
UserNotifier.deliver_signup_notification(user)
end
- Once created a user can ask for a password reset, which is also
trapped by the UserOberver
def after_save(user)
UserNotifier.deliver_reset_password(user) if
2006 Aug 15
1
Update attribute without validations or any save hooks?
If I wanted to update an attribute with calling any validation or any of
the before_save and after_save hooks, how would I go about doing this?
Supposed the update_attribute method calls the before and after save
methods.
Thanks for your help.
--
Posted via http://www.ruby-forum.com/.
2006 Jul 11
1
Determine if attributes changed?
Is there a way to determine if attributes were changed? Let''s say in
the before_save or after_save method?
Thanks for your help.
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060711/442b20d2/attachment.html
2009 Sep 23
5
Overriding AR read/write_attribute - Overridden write_attribute Is Never Called
Could someone explain this?
#config/initializers/ar_attributes.rb
module ActiveRecord
module AttributeMethods
alias_method :ar_read_attribute, :read_attribute
def read_attribute(attr_name)
p "read_override"
ar_read_attribute(attr_name)
end
alias_method :ar_write_attribute, :write_attribute
def write_attribute(attr_name, value)
2008 Jan 11
1
BackgrounDRb::PacketLogger issue
Hi there
I have recently upgraded to v1.0.1 and I''ve noticed an issue which I don''t
believe was present in the 0.2 release. In my worker class I am logging
errors as follows:
logger.error "the error message"
However, this now causes an exception to be thrown in the new version:
undefined method `error'' for
2011 Sep 17
3
[PATCH 1/1] hivexml: Base64-encode non-printable data
Some of the data in names and string values were being unsafely printed,
causing some types of XML processors to fail (e.g. Python's Expat).
This patch checks for printability of each character and outputs base64
with an encoding attribute for unsafe data.
---
xml/hivexml.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 64 insertions(+), 11 deletions(-)