Displaying 20 results from an estimated 50000 matches similar to: "Custom Rails Application Logging"
2008 Mar 18
0
Major issues with ActiveRecord callbacks in BackgroundRb r324
Hi there
I''ve been running BackgroundRb in production for a few months now. Recently
we added encryption onto some of our ActiveRecord fields by hooking in the
before_save and after_save callbacks, like:
class MyCallback
def initialize(attr_names)
@attr_names = attr_names
end
def before_save(model)
@attr_names.each do |attr_name|
next if
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 Aug 18
11
When after_save isn't after the save....
I have a Production model, which represents a farmer''s crop. After
create (via after_save) I call a method that creates one or more
Supply models, which represent a week of anticipated product harvest.
After each of those are created, a class method gets called that tries
to match each new Supply with outstanding orders for the same time
period. If a match is made, a transaction (an
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 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
I''ve got a really strange problem using belongs_to. I apologize in
advance for the length... this is going to take a while to explain.
Basic idea: Creating a User requires that the user enter an email
address and activation key that matches an existing PendingUser.
After creating the user successfully, that pending user should be
marked as "used".
The problem:
When I
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 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
2012 Nov 10
6
Suggestion: `before_save on: :create` should either work or raise an exception
There''s a small inconsistency in ActiveRecord''s callback syntax that has
tripped me up before. It wouldn''t be a big deal, but it can lead to a
silent failure. I''d like to suggest that it either be made consistent or be
made to fail loudly.
The issue is that to do something before validating, but only when
creating, you use `before_validation on: :create`,
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 May 15
1
encrypting databases
Hi all, your thoughts appreciated:
I''d like to encrypt one of my databases, as described in the first Rails book,
by putting encrypt and decrypt methods on the :after_find, :before_save, and
:after_save hooks in my model (what a lovely transparent way rails does
things!). But unlike the book, I actually want to use real encryption, perhaps
something from the OpenSSL library, something
2006 Mar 13
0
Encrypting data before saving
Hi,
In the pragmatic rails book, a password is hashed and saved using the
callback before_create. To do this it sets up an accessor called
''password'' and saves the SHA1 output in the backend as
''hashed_password''.
I''ve done a similar thing, but instead of using an accessor I simply use
''password'' for both and assign using:
def
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
2010 Jul 28
1
paperclip, authlogic and callback issue
I use authlogic for authentication and paperclip for handling user''s
profile picture attachments.
I use the following method to get the current_user
def current_user_session
return @current_user_session if defined?
(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
2009 Jun 24
1
[PATCH server] Vm state change auditing/accounting
Adds VmStateChangeEvent class and uses VmObserver to track/audit state
changes for Vm objects. Callbacks in VmObserver also update the new
total_uptime and total_uptime_timestamp attributes of Vm class, which
allows easy calculation of time spent in running states for user
resource use accounting.
---
src/app/models/vm.rb | 34 +++++++++++
src/app/models/vm_observer.rb
2009 Jun 29
0
[PATCH server] REVISED Vm state change auditing/accounting
Adds VmStateChangeEvent class and uses VmObserver to track/audit state
changes for Vm objects. Callbacks in VmObserver also update the new
total_uptime and total_uptime_timestamp attributes of Vm class, which
allows easy calculation of time spent in running states for user
resource use accounting.
---
src/app/models/vm.rb | 34 +++++++++++
src/app/models/vm_observer.rb
2010 Apr 16
1
Active Record observers broken: can't be used for "before" callbacks
I was just wondering what about a report that I made almost 2 months
ago: Active
Record observers
broken<https://rails.lighthouseapp.com/projects/8994/tickets/4087-activerecord-observers-cant-be-used-for-before-callbacks>
I think it''s a pretty big bug. In Rails 3, creating an observer with a
"before_save" callback (for instance) will result in all observed models
being
2006 Jul 17
5
Keeping attributes of two models in sync
Hi,
I have a Product and a corresponding Keyword (1:1 via belongs_to and
has_one). I want to ensure, that two attributes (:name) of the two
models alway stay in sync. What''s the easiest way to accomplish that?
I did play around with before_/after_save hooks and with
AR::Observers but in the end I''d always get infinite recursion...
Thanks,
Timo
2009 Jun 11
8
before_create return value breaking object.save: rails bug?
I know that usually when people say ''i think i found a bug in
rails/ruby'' they''ve done something dumb. I''m wondering if this is the
case here, but this does seem like a genuine rails bug to me.
In my user model i have a few different before_create callbacks. In one
of them, if it happens to return false (just because the last statement
in it evaluated to
2007 Jan 10
3
ActiveRecord Error?
We spent a big chunk of yesterday hunting down a strange bug in one of
our rails apps and created a test project to try out different theories
on what was going on. The result so far is a very small test case app
that perfectly reproduces the problem. The question is, is there
anything *wrong* with what we''re doing here, or is it a problem with
ActiveRecord? We''re on rails