similar to: How to Disable Callbacks on a Model

Displaying 20 results from an estimated 120 matches similar to: "How to Disable Callbacks on a Model"

2006 Apr 25
6
Does Rails need more useful URL helpers?
Similar topic to my last post, but a different brand of methods. In particular, the url_for and link_to methods have come to bother me at times. I will mention one instance in particular: I am designing a high-end administrative interface. This interface supports paging, sorting and limiting to specific field values. Thus I have params named page, sort and limit. The lack of elegance I see
2010 Sep 04
4
Store a single variable / row in database
What would be the best way in rails to store a single variable and have it persist. Like a have a variable that says "total_visits" that counts the total number of page loads. The only solution I can think of is having a table with a single row. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2007 Apr 19
7
Lock errors and segfaults
Greetings, I''ve been using ferret with great results now for a while, but in the last week, I''ve been running into some issues. I will occasionally see this message: Exception Message: Lock Error occured at <except.c>:103 in xpop_context Error occured in index.c:5368 - iw_open Couldn''t obtain write lock when opening IndexWriter Which is accompanied by
2005 Aug 08
4
Bug#322036: logcheck: [manual] typo in SYNOPSIS (TIOS => OPTIONS)
Package: logcheck Version: 1.2.35 Severity: minor Manual page reads: SYNOPSIS logcheck [TIONS] Perhaps it was intended to read: SYNOPSIS logcheck [OPTIONS] -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked
2005 Jun 14
3
Bug#313601: logcheck-database: ignore mount version messages
Package: logcheck-database Version: 1.2.39 Severity: wishlist These are the subject of an am-utils FAQ <URL:http://www.am-utils.org/docs/am-utils/FAQ.txt> and would be useful in the ignored list. Note that it's either `newer' or `older'. Jun 14 14:32:25 albion kernel: nfs warning: mount version newer than kernel Jun 14 14:37:54 dlsy kernel: nfs warning: mount version older
2005 Jul 11
3
Bug#317741: logcheck-database: fails to ignore properly some lines from 'rbldnsd'
Package: logcheck-database Version: 1.2.40 Severity: normal Tags: patch There are one line that is not properly ignored. I include in the report a better version. -- System Information: Debian Release: 3.1 APT prefers testing APT policy: (400, 'testing'), (300, 'unstable'), (200, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.8-2-k7 Locale:
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 =
2006 May 19
1
FileColumn
I''m using Windows and Postgres 8. I installed RMagic gem thingy and FileColumn plugin ok. I followed instructions exactly as directed on FileColumn web site which is very straight forward: ---model class My_model < ActiveRecord::Base file_column :column_for_file_name end -----view -upload form--set to mulitpart <%= file_column_field "my_model",
2005 Apr 24
2
Model names in controllers
Please excuse yet another newbie question... I''m getting this error: MissingSourceFile in <controller not set>#<action not set> c:/program files/ruby/lib/ruby/gems/1.8/gems/actionpack-1.8.1/lib/action_controller/dependencies.rb:75:in `require_dependencies'': Missing model MyModel.rb From these lines of code: class MyModelController < ApplicationController
2006 May 08
7
How to get difference between two dates in days???
Hi, I want to calculate difference between Current date & previous date (stored in database). The difference should be in days. Hhow to do that?? PLs tell me. Thanx in advance. Prash -- Posted via http://www.ruby-forum.com/.
2006 Sep 22
2
Editing the migration template
Hi. I''d like to edit the generated template in AR where tables are created. for example, this file is created when generating a new model or migration: class CreateModel < ActiveRecord::Migration def self.up create_table :models do |t| # t.column :type, I''d like to edit the above so it''ll generate this: class CreateModel <
2007 Dec 15
2
Reading Model data before update
Hi all, here is the challenge: I have this validation method, that basically prevents an object which billed = true to be updated: def before_update if read_attribute(:billed) errors.add_to_base(''This service has already been billed for'') end !read_attribute(:billed) end The above code does not work in case I do something like: object =
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a separate process, so it is important that when a record is saved in rails, this column should be left alone. In the update method of the controller I have: @record = MyModel.find(params[:id]) @record.update_attributes(params[:my_model]) params[:my_model] doesn''t have a reference to the column I''m talking
2006 Feb 22
3
after_update: old, new values?
With after triggers in Postgres, there are special NEW and OLD vars accessible to trigger functions. Any such thing in Rails? Or would it entail doing something like setting a class var in before_update? Jack -- Posted via http://www.ruby-forum.com/.
2005 Apr 10
2
residuals in VGAM
Hi all: I want to fit a multinomial logit model with VGAM package, however I cannot find a way to check the residuals since residuals(my_model) and resid(my_model) does not work. Any suggestions? Thanks in advance. Alex Brito [[alternative HTML version deleted]]
2006 May 08
4
gsub no workie
Don''t know why, but cant seem to get this to work for me. I have a phone number field for an addressbook. In the addressbook model I have a before_update declaration that says the following: I''d like to be able to remove all special characters (just numbers please), but this doesn''t want to work for me. before_update :format_phone def format_phone self.phone =
2006 May 31
1
ActiveRecord: When / where to validate data? Tricky question
First of all, thanks for you time. I have kind of a tricky question and wanted to see what you guys thought. ------------------------------------------- Lets say I have this: ------------------------------------------- class Purchase < ActiveRecord::Base validates_numericality_of :some_number, :only_integer => true end ------------------------------------------- Then I do this:
2017 Jun 26
3
Jagged ROC curves?
Hi, I was trying to draw some ROC curves (prediction of case/control status), but seem to be getting a somewhat jagged plot. Can I do something that would 'smooth' it somewhat? Most roc curves seem to have many incremental changes (in x and y directions), but my plot only has 4 or 5 steps even though there are 22 data points. Should I be doing something differently? How can I provide a
2006 Jul 20
7
How do you use :message with validation?
If I do validates_uniqueness_of :name, :message => "It''s not uniqueeee!!!" then how do I have it display that message when the check fails? -Ben Lisbakken -- Posted via http://www.ruby-forum.com/.
2007 Sep 07
6
ActiveRecord::Base#update_all expected behaviour
Hi I noticed that if in my code I use the following: Photo.update_all("title = ''Ruby rocks'' ", "id IN (#{@photo_ids})") All my objects are properly updated but none of the filters/callbacks are triggered. Is that what''s expected? I have a before_update filter set on the Photo class and it gets totally ignored, I guess the only way to solve this