Displaying 20 results from an estimated 400 matches similar to: "after_save in plugin"
2009 Mar 29
2
after_create and after_save
Hi,
AFAIK after_create is called after_save if the entry does not exist in
the DB.
Is there a way to tell if a specific model is new or not in
after_save?
I have to do something like:
def after_save
add_to_history ''save''
end
def after_create
add_to_history ''create''
end
However after_save is called when creating too.
--
cheers,
M.
2006 Jul 17
2
after_save deletes is an exception is raised?
Does after_save in a model delete if an exception is raised in there?
I simply did
def after_save
raise ''hmmm''
end
and it raised the exception but there was nothing in the database. I
removed that entire method and its in the database. Is this correct?
Thank You,
Ben Johnson
E: bjohnson@contuitive.com
-------------- next part --------------
An HTML attachment was
2009 Jan 18
2
after_save -- stack level too deep
Hi all,
I''m running into a brick wall trying to figure out my problem here. I
have a model that has a boolean property called "paid". I''d like to
add the following to my model:
def after_save
self.amount == self.splits.sum(:amount) ? self.update_attribute
(:paid, true) : self.update_attribute(:paid, false)
end
The problem is, when I do this I get an error that
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 Jun 01
0
Disabling an after_save() in a rake conversion?
Hi all -
I''ve got a model Foo that has an after_save() method. I''d like to disable
it while doing a rake conversion.
Seems I should be able to just redeclare Foo.after_save() somehow, but I''m
not quite sure how to do that in the rake task...
Any ideas?
Thanks!
-philip
2009 May 28
1
:has_many and :after_save
Having one to many connection (for example post has many comments), what
is the most efficient way of saving all comments when post is saved.
Using after_save on Post would introduce the n+1 problem. Is there any
way of saving the whole structure at once?
--
Posted via http://www.ruby-forum.com/.
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
2006 Jul 19
0
save without after_save, after_create, after_update?
How to update attribute(s) and save a record instance without triggering
the hooks: after_save, after_create, after_update?
I know it''s possible with Record.update() but this is dynamic. Only
receive the instance, without knowing its class (thus cannot call the
class method update()). Or is there a way of knowing the class and
calling the class method?
Thank you.
--
Posted via
2006 Mar 21
0
does after_save get called if failed save?
does after_save get called if failed save?
Thanks,
Chris
--
Posted via http://www.ruby-forum.com/.
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
2006 Jul 17
2
Very strange after_save problem. Please help.
I have a very strange problem here. I do not get this. So any help is
greatly appreciated.
Basically I have a model that calls a method in the background
process in the "after_save" method. Let''s call the model products. So
what happens is this:
1. I create a new product.
2. Everything works and the product is saved with id 13.
3. A method is called in my background
2006 Aug 11
1
after_initialize and after_save
Hello,
I am still reading Agile Web Developer pdf, it says about
after_initialize and after_find. There is a Joe asks part when I read
that they are special, however I didn''t really get the idea, why they are.
On rubyonrails.org in the manual there is some sort description about
their speciality, however their full descriptions are missing.
What are the difference between
2006 Jul 19
1
Catch 22 with after_save. Please help.
I have a pretty strange problem. Here is basically what I have to
demonstrate my problem:
class Event < ActiveRecord::Base
def after_create
AnotherClass.find_event(id)
end
end
class AnotherClass < ActiveRecord::Base
def self.find_event(event_id)
e = Event.find event_id
end
end
Here is the catch 22 and it''s quite annoying. Basically ActiveRecord
puts to whole save
2006 Apr 06
0
3 doubts on observe_field
Dear friends, with the yours aid already I obtained to use
observe_field, but still I am with some problems and necessary again.
They are three questions to long of the source code below.
Since already I am grateful for the tips.
==== _form.rhtml
<!--[form:city]-->
<p><label for="city_state_country_id">Pa?s</label><br/>
<select
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
2017 Nov 14
1
Re: [PATCH v12 3/3] New tool: virt-builder-repository
On Mon, Nov 13, 2017 at 02:56:12PM +0100, Cédric Bosdonnat wrote:
> +let checksums_get_sha512 = function
> + | None -> None
> + | Some csums ->
> + try
> + Some (List.find (
> + function
> + | Checksums.SHA512 _ -> true
> + | _ -> false
> + ) csums)
> + with Not_found -> None
This is still a bit
2008 Aug 30
0
[PATCH] btrfs: remove unused function btrfs_ilookup
btrfs_ilookup is unused, which is good because a normal filesystem
should never have to use ilookup anyway. Remove it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: btrfs-unstable/ctree.h
===================================================================
--- btrfs-unstable.orig/ctree.h 2008-08-30 11:08:58.000000000 -0300
+++ btrfs-unstable/ctree.h 2008-08-30 11:09:10.000000000
2017 Apr 12
0
[PATCH v6 10/10] Add a virt-builder-repository tool
virt-builder-repository allows users to easily create or update
a virt-builder source repository out of disk images. The tool can
be run in either interactive or automated mode.
---
.gitignore | 3 +
builder/Makefile.am | 84 +++++-
builder/repository_main.ml | 570 ++++++++++++++++++++++++++++++++++++
builder/test-docs.sh | 2
2017 Jun 19
0
[PATCH v7 9/9] Add a virt-builder-repository tool
virt-builder-repository allows users to easily create or update
a virt-builder source repository out of disk images. The tool can
be run in either interactive or automated mode.
---
.gitignore | 3 +
builder/Makefile.am | 84 +++++-
builder/repository_main.ml | 584 ++++++++++++++++++++++++++++++++++++
builder/test-docs.sh | 2
2017 Sep 18
0
[PATCH v9 7/7] New tool: virt-builder-repository
virt-builder-repository allows users to easily create or update
a virt-builder source repository out of disk images. The tool can
be run in either interactive or automated mode.
---
.gitignore | 3 +
builder/Makefile.am | 85 +++++-
builder/repository_main.ml | 589 ++++++++++++++++++++++++++++++++++++
builder/test-docs.sh | 2