similar to: restrict callback to fields

Displaying 20 results from an estimated 3000 matches similar to: "restrict callback to fields"

2006 May 10
8
dynamic setting of username and password in database.yml
Hello I''ve now read a lot about application-level authentication in Rails, but I need to do database-level authentication. The reason is that my database needs to have the current_user (database current_user, not current_user defined in an ActiveRecord Model) set to execute triggers for automatically updating audit tables. So it is not enough to have a session check against a User
2006 May 10
2
ruby bindings odds and ends
In the Ruby bindings, set_X and get_X are renamed to remove the get/set, so MSet::get_matches_estimated() becomes a read-only property (if I have my terminology right) of the Ruby MSet class called matches_estimated. This matches how a Ruby programmer would expect a class to be designed. I was looking through the getters and setters list. I wonder if a few entries shouldn't be there, (the
2006 Jun 01
4
how can I control when to commit a transaction?
hello it seems like this question has appeared a few times with no answer: how do you get rails to issue ''write'' statements (ie ''CREATE/UPDATE'') to the database without committing each time? I tried setting ActiveRecord::Base.connection.begin_db_transaction before calling any action on my object, but as soon as myObject.save or myObject.update is called,
2006 May 31
0
how to disable callback
How do I locally disable a callback from being performed? My class has class Keyword < ActiveRecord::Base after_update :switch_versioned private # Callback used to warn the user that an updated record # has not been saved in the version table def switch_versioned logger.debug "coucou" self.versioned= false end But another class has a
2006 Jun 01
4
Ruby on Rails strange issue
Hello, I just installed Ruby on Rails and created the new repository. I wanted to use Ruby on Rails with FCGI The repository was created in /path/to/public_html ls /path/to/public_html/ : app cgi-bin config doc log public README script tmp asd components db lib logo.jpg Rakefile README_LOGIN test vendor I installed fcgi support for ruby on rails and
2006 Aug 10
6
save without commit ?
How do I get ''save'' to execute without commit? I have tried: ActiveRecord::Base.connection.begin_db_transaction # do some stuff that doesn''t issue a database COMMIT statement # then: @myObject.save # this issues a COMMIT but it shouldn''t! Shouldn''t it wait until I''ve called: ActiveRecord::Base.connection.commit_db_transaction ? what am
2006 Apr 07
2
errors.add_to_base
What are the limitations on using: errors.add_to_base to display errors in views? I have tried for days to add errors from my object.rb and they never get displayed. class Keyword < ActiveRecord::Base validates_presence_of(:name, :message => "Name is required.") validates_uniqueness_of(:name, :message => "This name is already in use. Please try
2006 Jun 01
2
update_all broken in postgres?
Hi has anyone managed to use update_all with rails on postgres? In my setup, it does not work: >> @keyword.update_all(myupdates) NoMethodError: undefined method `update_all'' for #<Keyword:0xb7ac4670> from /home/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1786:in `method_missing'' from (irb):14 I checked that the base.rb
2006 Mar 08
3
Namespace & Organisation Conventions
Hi All I wanted a little advice on the convention for namespace usage and organisation of code. I originally used PHP and often had an "admin" backend that performed the various admin tasks with users, and data Then I had a front-end often situated at the root that had user services. I''m trying to emulate this in Rails but feel I''m missing a significant point here and
2007 Apr 05
2
best way to maintain dynamic fields?
I have a Topic that has_many comments. In the search results only want Topics to show up, but I want them to include the text of the comments that they have when they are indexed. To do this I''ve added a :comments_text field for acts_as_ferret and the comments_text method gathers the text from all comments up into a string that can be indexed. The trick is that when comments are added,
2007 Sep 21
1
Temporary disabling after_update
Hi, I am trying to replace my old database trigger with ActiveRecord callbacks in rails. I have a model like following: class Action < ActiveRecord::Base belongs_to :inquiry def after_update #clean up all action associated with the inquiry. Action.update_all("latest = ''''", ["inquiry_id = ?", self.inquiry_id]) #find the latest action
2007 Mar 09
1
in after_update, possible to see previous value of record?
I have this situation where in an after_update, I would like to know the previous value of the record instead of simply being notified the record has been updated. For example let''s say I had a table called ''foo'' which had a field ''new_flag''. I want to know when the ''new_flag'' field changes from 0 -- > 1 in an after_update so I
2019 May 16
0
[nbdkit PATCH v2 08/24] ocaml: Implement .cache script callback
This was a bit harder than sh, but still a lot of copy-and-paste. Signed-off-by: Eric Blake <eblake@redhat.com> --- Note: I'm not sure how to actually test this beyond compilation. --- plugins/ocaml/ocaml.c | 51 ++++++++++++++++++++++++++++++++++++++++ plugins/ocaml/NBDKit.ml | 16 ++++++++++++- plugins/ocaml/NBDKit.mli | 5 ++++ 3 files changed, 71 insertions(+), 1 deletion(-)
2006 Jun 01
0
question about observer callbacks
I''m not sure how to implement this so I''ll describe what I currently have done then what I wish to have happen currently, I have a generic observer for several models class AuditObserver < ActiveRecord::Observer observe Foo, Bar def after_update(model) model.log("UPDATED " + Time.now.strftime("%m-%d-%Y %H:%M")) end def after_create(model)
2006 Mar 30
0
Specify callbacks before associations
In the RoR API documentation (http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html) for callbacks, there is a note that says: "*IMPORTANT:* In order for inheritance to work for the callback queues, you must specify the callbacks before specifying the associations. Otherwise, you might trigger the loading of a child before the parent has registered the callbacks and they won?t
2020 Feb 10
1
[nbdkit PATCH] ocaml: Support .preconnect callback
Somewhat of a mishmash between .open (in that it takes a bool readonly parameter) and .config_complete (in that the C code returns an int, but the Ocaml code either throws an exception or completes with unit). I did not spot any existing testsuite coverage to modify for this, and am relying on the fact that it compiles cleanly. Signed-off-by: Eric Blake <eblake@redhat.com> ---
2001 Aug 21
0
Re: [R] Problem using GLM in a loop (fwd)
This example is caused by R's messing with formula environments. That's explained in ?formula, but should it not be explained in ?model.frame ? Simple test: data <- data.frame(y=rnorm(100), x=1:100) testit <- function(formula) { weights <- runif(100) glm(formula, weights=weights, data=data) } testit(y ~ x) weights is looked for in the environment of the formula, not of
2000 Oct 26
2
Problem with lm
Hello Everybody, I have a problem with the output of lm. In fact, when I compare the R output and the Splus output, the results appears to be different : I have a dataframe with 5 factors , 16 rows and a response. First, I tried to fit this response to a linear model : lm(rep~(A+B+C+D+E),data). The results beetween SPlus and R are different. In a second time, I tried a new fit :
2007 Jan 04
6
after_update attributes problem
Hey guys, I''m having a hard time w/ the after_update callback on rails... As far as I can tell, when I define a after_update callback on a model, the attributes of the object have the same values that they had *before* Base.save was called. I''m probably wrong so here''s the code: UNIT TEST: def test_register_item_adjusts_account_balance account =
2004 Nov 16
0
From S-Plus to R
Dear Isabelle, for most of my work I have switched from S-Plus to R, because it is easier to make scripts with due to the better documentation and some other more reasonable implementations. And there was also a cost issue with the S-Plus Server, which is not for free at all. In R I use the its package for time series, which is quite sufficient for my needs. The only problem I encountered was