Displaying 20 results from an estimated 10000 matches similar to: "Observer method names"
2006 Apr 26
1
Observer best practices
I''ve seen two ways of connecting observers:
1) In the observer class put
observe MyModel
2) In the controller class put
observer :my_observer
What is the difference between these two? Also, is it necessary to put
in the observer class the following?
MyObserver.instance
Jose
--
Posted via http://www.ruby-forum.com/.
2008 Jul 21
1
Re: Observer
eh, like so?
def after_create(model)
generate_hotel_param_files(model.id)
generate_hotel_setup_files(model.id)
end
def after_update(model)
generate_hotel_param_files(model.id)
generate_hotel_setup_files(model.id)
end
On Jul 21, 9:59 am, David Nguyen <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
> Hi,
> I have to make an observer if a
2006 Apr 06
1
observer doesn''t react
i followed the observer documentation [1] and created, and registered an
observer. i had to realise that the observer doesn''t work at all -- in
fact the rails application does not even start -- with acts_as_taggable,
for whatever reason.
i must admit that i''m still using ruby 1.8.2. however, after commenting
the acts_as_taggable instruction out the application runs smoothly
2006 Jul 18
7
Observer not working
Help please.
I''m trying to observe a User class, but I can''t get this to work, the
after_create method never gets called... (the breakpoint never gets
called)
app/models/user_observer.rb:
class UserObserver < ActiveRecord::Observer
def after_create(user)
breakpoint
setting =
2005 Dec 07
3
ActiveRecord::Observer problem
Hi all,
I have a problem with an observer. I have a simple observer...
class ActivityObserver < ActiveRecord::Observer
observe Customer
def after_create(model)
bind_params(model)
@al.action = "create"
@al.save
logger "#{model.id} : created"
end
private
def bind_params(model)
@al = ActivityLog.new
@al.user_id = User.current.id
2007 Dec 14
0
async-observer rails plugin
I''m pleased to announce the existence of async-observer.
This is the very first public release. In the future I''ll confine
announcements to the beanstalk-talk mailing list.
WHAT IS ASYNC OBSERVER?
-----------------------
Async Observer is a Rails plugin that provides deep integration with
Beanstalk.
beanstalkd is a fast, distributed, in-memory work-queue service. Its
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
2006 Jun 01
0
question about observer callbacks
I''m not sure how to implement this so I''ll describe what I currently have
done then what I wish to have happen
currently, I have a generic observer for several models
class AuditObserver < ActiveRecord::Observer
observe Foo, Bar
def after_update(model)
model.log("UPDATED " + Time.now.strftime("%m-%d-%Y %H:%M"))
end
def after_create(model)
2007 Oct 24
1
Attachment_fu and observers/emailing
Hi all,
I''m developing a site where a user can upload their CV/resume with a
profile, and am using restful_authentication for this with
attachment_fu to handle the file uploading.
When a user creates their profile/user account, I''ve got an observer
that will email the site admin with a copy of the uploaded CV. My
user_observer looks something like:
class UserObserver <
2006 Aug 16
1
Active Record Observers causing 404''s and other weird issues
Hi all. I''ve got a simple AR Observer:
class NewOrderObserver < ActiveRecord::Observer
observe NewOrder
def after_create(object)
Note.create(...)
end
end
In environment.rb I have the following line:
config.active_record.observers = :new_order_observer
And in application.rb I have:
NewOrderObserver.instance
Aside from simply not working, it''s causing
2006 Feb 25
3
Enumerating over a Tree by Depth
I have a model using acts_as_tree which is working fine.
Being new to Ruby I''m don''t know what enumerator is best to use for
traversing a tree by depth. I can write one, but before I do I wanted
to know if there is there an enumerator for traversing trees available
that the community recommends?
Thank you,
Jose
--
Posted via http://www.ruby-forum.com/.
2008 Jul 12
0
R-outlet: Journal of Statistical Software
The Journal of Statistical Software was founded by Jan
de Leeuw in 1996. Currently, there are 26 volumes with 260
aricles and the journal publishes about 4 new volumes
per year. The web address is www.jstatsoft.org. All
articles are pdf files, since 2005 all produced from
JSS LaTeX templates.
JSS is edited by Jan de Leeuw, since
2005 jointly with Achim Zeileis of the Wirtschaftsuniversität Wien.
2009 Sep 27
1
Switchboard - Easy to use global ActiveRecord event listeners
Switchboard is a simple, event-observing framework for ActiveRecord.
It''s designed to make it easy to add observers for all models in your
app, and to easily turn them on and off selectively.
Intallation
gem sources -a http://gems.github.com
sudo gem install zilkey-switchboard
Usage
First, require switchboard above your rails initializer:
# environment.rb
require
2008 May 21
1
Callback method for field
Is there callback method for field level?
Generally, after_create and after_save will fire at object level.
I need to fire some code when the value for the field is changed. I need
to call the call back method from observer
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2006 Oct 24
1
Locking issues when adding to the Index
Hi,
I keep getting locking errors when updating my index which puzzles me
since only one process is supposed to be accessing the index at a
time (at least in development mode).
I''m using Ferret with Rails (NOT acts_as_ferret, though) and employed
an observer to add a new document to the index when a new
ActiveRecord is created. I''m not sure if this has any impact on the
2015 Apr 05
3
[LLVMdev] alloca not in first bb behaving differently
Here is some IR that is working and executing as expected -- All allocas
are in the first basic block, and only updates happen in other basic blocks.
define i32 @f() {
entry:
%x = alloca i32
store i32 333, i32* %x
%i = alloca i32
store i32 11, i32* %i
br i1 true, label %if.then, label %if.else
if.then: ; preds = %entry
store i32 3, i32* %i
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
2008 Apr 30
6
best practice for object transaction?
I have a new @offer that needs to generate a document if saved. But
that''s all or nothing:
transaction do
@offer.save!
generate_document
end
# handle exceptions if needed
If save! fails everything is fine, but if generate_document raises an
exception @offer is left as a model with timestamps, id, which is not
a new_record? anymore (though the database was
2006 Feb 11
5
after_(read|find) callback?
I am pondering the possibility of encrypting/decrypting some fields
in a SQLite backend on-the-fly.
The point of the message is not security, I know that''s broken, but
whether there''s a technique that provides on-the-fly save/read
filters. Of course the solution would need to work transparently in
joins, so
user.posts.last.title
would do the right thing if title
2009 May 25
4
after_create and has_one association bug?
Hello,
I''ve come across an issue that I''m sure is a bug when using after_create
with a has_one association, but I''m not 100% certain if I''m missing
something.
This is pretty much exactly the code I''m using. Two simple classes
(Account and Contact) and I create the contact after I create an account
(via after_create). I''m not passing in a