similar to: BestPractise for monitoring change of model attribute?

Displaying 20 results from an estimated 30000 matches similar to: "BestPractise for monitoring change of model attribute?"

2002 Nov 21
0
dbPowerAMP, CDex / Re: Freeware windows ogg audio CD bur ner?
There's another nice Windows program in the pipeline: Feurio 2.0 (www.feurio.de) will have OggVorbis and MonkeyAudio support. Feurio is a all-in-one solution for CD ripping/burning specialized on audio CD. Feurio supports high speed, high-quality on-the-fly ripping and encoding, and on-the-fly decoding/burning, too. Feurio supports allmost all available CD writers, and there is a
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)
2008 Dec 13
3
session In the model
Hi i have the model SDTicket which has a field modified_by_id and it has to take data from session[:id] Now this SDTicket model has many associated models like Activity one of them So when ever an activity happens then also the value in session[:id] is to be go to modified_by_id field SDTicket has_many activities Activity belongs to SDTicket So for that what I am trying is in Activity
2006 Apr 28
0
Model caching for pseudo-constant globals
Hi folks, I have a number of models which do sometimes change, but which are mostly invariant. These include things like FeatureType, Feature, Country and SwearWord. They''re ActiveRecord subclasses, backed by the database, so that they''re easy for administrators to edit. Is there a sane way to implement model caching for these, such that I can do stuff like this in my
2006 Jul 17
6
Rails+Mongrel+Lighthttpd: Ruby-Sendfile Problem
Hello, I have a working mongrel cluster and want to use Lighty as the frontend webserver. I want ligthttpd to deliver the static content. So I did gem install sendfile --remote Everything installed. But if I run the tests like gem check sendfile --test --debug i get the following error message: Exception `Errno::ENOSYS'' at ./test/test_sendfile.rb:75 - Function not implemented -
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 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 Apr 29
1
Setting a message on a model -without- errors.add_to_base
I''m trying my best to follow the skinny controller/fat model concept, and I''ve got a series of callbacks (that I''m about to move into observers) running on a few models. Based on what these callbacks do to the data (it''s implementing business rules), I''d like to add some type of message on the state of the model *without* invalidating it. For example:
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 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.
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
2006 Jul 12
2
Weird problem. How to tell if an attribute has changed? Please help.
How do you tell if an foreign key attribute has been changed? For example, lets say you have a model with attribute table_a_id. Would you do this? def table_a_id=(value) if value != table_a_id @table_a_changed = true write_attribute ''table_a_id'', value end end def table_a=(value) if value != table_a @table_a_changed = true
2006 Jun 02
1
form_for scope issue
Hi, I am just ran into the problem that I cannot access helper methods from within a form_for scope. I do have something like the following: <% form_for :potential_buyer, @potential_buyer, :url => { :action => "register" } do |f| %> <%= render(:partial => ''register_form'', :locals => { :f => f } ) %> <% end %> ----- I cannot
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
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
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 May 09
2
handling file upload onto local filesystem.
Hi, I have a multipart form upload field uploaded through <%= file_field("profile", "profile") %> Once a submit happens, the action basically does something like: profile = Profile.new(params["picture"]) This invokes the models = to method: def picture=(picture_field) ...do a bunch of assignments here end def validate ... do a bunch of validations
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 Aug 07
2
paperclip model fails while when updating with no attachment
Hi all, I have paperclip running in my rails environment. I setup a new model just for paperclip called Assets so that I could upload multiple files per item (even though I''m only using 1 attachment per item at the moment). Everything works except for the following: Updating an item record with no attachment in the form but having PREVIOUSLY attached an asset while creating or updating.