Displaying 20 results from an estimated 100000 matches similar to: "Callback not called in development mode"
2008 Jul 28
1
callback executed like after_save but after transaction
I''m trying to add some code for my ActiveRecord class so that it is
executed whenever an object is updated, this code is a seperate
process that reads from the same table represented by my model class
so when it runs it needs the database to be up to date.
In the following situation this is fine:
# MyModel
def after_save
`/usr/local/bin/update_models -i #{self.id}`
end
# controller
2006 Apr 01
2
ActiveRecord callbacks not called
Hi, there must be something wrong somewhere in my unit test because
there''s a model I can''t have any callback executed on.
In my unit test I do
@image = Image.new
@image.set_uploaded_file({:file =>
uploaded_file("pic1.jpg","image/jpeg","article-picture.jpg"),
:article_id => @article.id,
:title => ''Titre
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)
2010 May 12
2
How to add an after_save callback on runtime on a particular instance
class User < AR
end
user = User.new
Let''s say that I have a user instance with me. After this record is
saved I want an after_save callback which would print the id of the
record.
The only catch is that I am not allowed to change the User class. How
can I accomplish my goal? Is that even possible to add an after_save
callback on a particular instance object. Any metaprogramming
2007 May 06
3
Using session-type data in an ActiveRecord callback...
Any suggestions on how best to gain access to session-type information
while in an ActiveRecord callback, such as after_save?
I am encrypting some information in the database, using the
generalized encryption/decryption handler in "Agile Web Development
With Rails" (p 375ff). I got it working, and now I want to reference
a session field (a user PIN) which is NOT stored in the
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
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
2012 Jan 28
2
after_save in plugin
Dear list,
I am trying to override an after_save callback declared in main app
using plugin.
The main model class is:
class WorkHours < ActiveRecord::Base
@after_save_call_back_called=0
after_save :after_save_call_back
def after_save_call_back
logger.debug "after save called"
@after_save_call_back_called=1
end
end
And in my plugin (in the lib directory) :
module
2007 Feb 14
4
cache sweeper not getting called
Hi,
I''ve started to implement page caches but I''ve hit a brick wall getting
a sweeper to clear the cache when needed. It seems that any models that
I tell it to observe aren''t being observed properly. If I add the
sweeper to a controller the initialize method runs, but no matter what I
do the after_save/after_update callbacks aren''t running. Also if I try
to
2007 Feb 04
2
Per activerecord object callbacks (aka: should I have gone to bed hours ago?)
First of all, I should have gone to bed a long time, so please be
forgiving with regards to what will follow :)
So I''ve been working all day on a rails project that needs to go out
soon, and I thought I would try to refactor a has_many relationship to
a has_and_belongs_to_many relationship (using has_many :through).
However, I then realized that I would loose a lot of the simple beauty
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 Aug 23
5
validation, concurrency, and transactions
Hi,
Something has been bothering me about model validation: how do I know that
the database has not changed in between when I validate my model''s data, and
when it actually gets saved to the database? As a simple example, say I have
a User model like:
class User
validates_uniqueness_of :username
end
When this gets saved to the database, the validation code checks that there is
2007 Sep 05
2
after_create callback called twice in test env when using fixtures
All,
I''ve been trying to figure out a strange bug in one of my applications
that I think I''ve narrowed down to a problem with rails fixtures. It
seems as though the after_create callback is being run twice when I
save a record. This is only happening a) in the test environment, and
b) when there is a fixture file for that table.
The test below only prints "Doing
2023 Jun 09
1
[Intel-gfx] [PATCH v3 4/4] PCI/VGA: introduce is_boot_device function callback to vga_client_register
On Fri, Jun 09, 2023 at 10:27:39AM +0800, Sui Jingfeng wrote:
> On 2023/6/9 03:19, Bjorn Helgaas wrote:
> > On Thu, Jun 08, 2023 at 07:43:22PM +0800, Sui Jingfeng wrote:
> > > From: Sui Jingfeng <suijingfeng at loongson.cn>
> > >
> > > The vga_is_firmware_default() function is arch-dependent, which doesn't
> > > sound right. At least, it also
2007 Mar 13
3
showResponse() Callback not being called in Firefox
Hello All ---
I am using the AJAX Object to send form data to a PHP page. In IE, I
am able to get a call back thru the showResponse(); However, in
Firefox, the callback never gets executed. Here is my code:
function showResponse()
{
alert(''Thank You. Your information has been sent'');
}
function processForm()
{
var url = "sendEmail.php";
var name =
2006 Jul 20
1
file_column - assigning with an actual file rather than a multipart
Hi there,
I''m using the wonderful file_column and have struck an issue that
someone might have seen before.
My images already sit on the server. So, instead of passing a
multipart message I''m sending a file object.
Something like...
f = File.new("public/gallery_images/builder.png")
p = Product.find_first
p.image = f
p.save
On the save I recieve an error which
2007 Feb 05
0
after_save and associations
It appears that when after_save is triggered, associations such as
habtm haven''t been populated yet.
Each association can have an :after_add callback, but my code needs to
access multiple associations.
Is there an explicit reason why after_save isn''t triggered after all
of the associations have been populated?
--~--~---------~--~----~------------~-------~--~----~
You received
2011 May 24
0
Can a libFLAC encoder be initialize and called from inside a libFLAC decoder callback?
Have you tried decoding to memory, and encoding from that memory?
This technique would avoid file I/O.
If you are reluctant to allocate enough memory for the full file (and
why not, with a 64-bit system?), then you could implement a FIFO.
You would need a semaphore to keep track of the decoder's progress,
and multithreaded coding. The decoder would pause, whenever the FIFO
gets
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
2007 Jun 27
0
ActiveRecord Type issue -- What am I missing?
Hey everyone,
First, apologies for the crosspost, I meant to post this to this
group, my previous post was a mistake.
I''m having a frustrating ActiveRecord issue. Maybe what I''m trying to
do will not work, but if that''s the case, I''d like to know why.
Otherwise I''d love to know what I''m doing wrong.
My goal is to store prices (numbers with