Displaying 20 results from an estimated 40000 matches similar to: "is there an "before_commit" hook somewhere in Rails?"
2009 Jan 14
6
How do I change MYSQL startup options on Mac??? (can't work it out)
Hi,
Can anyone help me out re how I change the startup options for mysql (v5.0)
running on my Mac? (I just want to add the "--log" option is about it). I
tried doing "sudo ./Library/StartupItems/MySQLCOM/MySQLCOM restart" however
this started a 2nd instances of mysql & mysqld.
Here is what I see start after Mac startup if this helps:
$ ps aux | grep mysql
_mysql 137 0.0
2009 Feb 09
5
"reaper" is not picking up new changes to my application???
Hi,
Can anyone shed any light on why "reaper" (whilst seemingly working re
restarting my mongrel ruby process) does not pick up changes to my
application? (e.g. changing a title in a view for example). It''s like the
"mongrel_rails start etc..." is just restarting the current process but
ignoring the new details re where the new application directory is. That
is
2009 Sep 25
8
Cheapest Rails Hosting where they give you full access to Apache (to load modules etc)???
any pointers / suggestions re cheapest Rails hosting where they give
you full access to Apache (to load modules etc)??? Can be a shared
platform, however not sure if there is a shared platform type hosting
service where they do give you such access?
2006 Jul 23
18
help with "rake db:migrate" error please?
Hi,
Just trying to get my first database based rails app up on
dreamhost.com. The app was working prior to putting in mysql DB usage
but I''m just stuck on getting the app working with mysql. I''ve already
created the database and can connect to it manually.
Below is the error I get after running the rake migrate. It worked OK
on my home PC environment. I did change the
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 11
6
Why does ActiveRecord allow perception of success when updating an ID, however it doesn't really work(i.e. no change in database)?
Hi,
Why does ActiveRecord allow perception of success when updating an ID,
however it doesn''t really work(i.e. no change in database)?
Here''s an example. The update of "id" versus update of a non-existent
attribute.
?> ai = AccountItem.find(:first) => #<AccountItem id: 1, account_id: 1,
date: "2009-01-11", amount:
2009 Jan 13
0
How can I get Rspec on Mac iTerm formatting and colors occuring when I use Putty remotely???
Hi,
Any ideas how can I get the nice formatting & colors that occurs on my Mac
iTerm when I run Rspec (e.g. ./script/autotest), to occur when I log in to
my dev environment via Putty (from Windows) and run it here???
--
Greg
http://blog.gregnet.org/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
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
2006 Mar 10
9
Observers?
Hello all!
I''m having an issue with Observers, and I''m hoping someone knows the
answer.
Here is the definition:
app/models/vehicle_observer.rb
> class VehicleObserver < ActiveRecord::Observer
> def after_save(vehicle)
> breakpoint
> if vehicle.has_new_mil_indication?
> UserMailer.deliver_mil_notice(vehicle)
> end
> end
> end
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)
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''
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
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.
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`,
2011 Mar 08
2
Rails - Acts as Nested - Impossible move, target node cannot be inside moved tree.
Hello, I''m using the Awesome Nested Set plugin:
https://github.com/collectiveidea/awesome_nested_set
And in my model I do the following:
acts_as_nested_set
after_save :ensure_max_nestedset_level
private
def ensure_max_nestedset_level
if self.level > 2
self.move_to_child_of(parent.parent)
end
end
I do this to keep the levels from getting
2008 Sep 23
3
calling save in after_create hook
Scenario:
I''m creating an image file upload service for my web site.
As well as saving the actual file I also need to create a database
record for the file.
I would like to name the file after the record id, but I also need to
save some attributes of the image (width/height/mime_type etc) which I
can''t discover until after the file is created.
The Problem:
1) The id is not
2008 Dec 05
1
Question About Rails.cache and find method.
The DB load on my site is getting really high so it is time for me to
cache common queries that are being called 1000s of times an hour
where the results are not changing.
So for instance on my city model I do the following:
def self.fetch(id)
Rails.cache.fetch("city_#{id}") { City.find(id) }
end
def after_save; Rails.cache.delete("city_#{self.id}"); end;
def
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
2006 Feb 02
0
Is there an on_reload hook?
I am working on a code base that uses a fair amount of custom queries and
then caches the result in an instance var. Now when I call reload I need to
clear out this cached data. I looked for an on_reload hook and didn''t find
one in the API for ActiveRecord.
Any ideas?
Thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: