similar to: How do I stop a column being updated by model.save?

Displaying 20 results from an estimated 1000 matches similar to: "How do I stop a column being updated by model.save?"

2006 Dec 08
9
How to update partial attributes of a object from a form?
I have a user table, and it has forty columns, including name, gender, address, email, phone... So my @user object will have forty attributes. I divide these attributes into 4 groups... namely ''general info'', ''personal info'', ''contact info''... and I make separate forms to edit these 4 different group attributes. The problem is when I update
2008 Feb 13
4
Migration Issues: Can't update newly added column values
Hello everyone, just wondering if anyone can help me with a migrations question here. Using: rails 2.0.2 ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin] mysql 5.0.45 Platform: windows xp The problem: ---------- I created a migration that is designed to add a column named "deleted_at" (timestamp) and then remove a column named "is_deleted" (boolean). The idea is to
2005 Apr 23
7
Validation question
Hi all, Is there a way to invoke validations at times other than save, create and update? I know that I can do this by writing my own validation checks using errors.add_[blah], but I''d like to leverage the existing validation code. What I have is two sets of fields in a record, set A and set B. Both sets must be validated on record create. However, the trouble is that after
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:
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
2001 Nov 12
3
histogram question
hist(rbinom(1000,10,0.5),col=2,xlim=c(0,10),ylim=c(0,300)) gives a histogram with "touching bars" hist(rbinom(100000,10,0.5),col=2,xlim=c(0,10),ylim=c(0,30000)) gives a histogram with space between the bars. is there a way to control the space betweent he bars easily? -- Erich Neuwirth, Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at
2009 Sep 06
1
How many attributes are there of a variable?
Hi, According to the example below this email, attr(x,"names") is the same as names(x). I am wondering how many attributes there are of a given variable. How to find out what they are? Can I always use some_attribute(x) instead of attr(x, "some_attribute")? Regards, Peng > x=c(1,2,3) > attr(x,"names")=c("a","b","c") > x a b c
2006 May 26
9
What syntax is this? belongs_to :Person
so when I''m reading the pick axe book second edition I don''t see anything like the syntax you see people using in rails code. Specifically when you see. belongs_to :Person has_many :Phones etc these are methods on ActiveRecord right? Why is this invocation syntax never described in the Pick Axe book? I do see things like attr_reader :some_attribute etc but you
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
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 <
2011 Sep 04
3
rspec assert inclusion in..
hello, I would like to assert that an attribute of a model has value among those in an array. How would I do it in rspec? Something like this... describe OptionType do context "shoulda validations" do it { assert_contains :type, [''Type1'', ''Type1'']} end end
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
2007 Apr 20
10
Softphone that supports central provisioning?
Has anyone found a softphone that supports pulling it's configuration from a central server via TFTP/FTP/HTTP, much like hard desk phones use? I'm looking for something for a call center that I can provision from a central location by generating config files. If the phone has "soft keys" (yes, I know they're all soft - but you know what I mean; programmable buttons whose
2007 Mar 05
2
TDM400P/FXS in a HP DL380 G5
The HP DL380 G5 (like many rack servers) has no AMP Mate-n-Lok connector available to attach to a card that needs more power than the PCI bus can provide, like the TDM400P when FXS modules are used. HP has confirmed that there is no part they sell to give you such a connector, and Digium says their business edition folks got it to work, but only by doing nasty warranty-voiding things to the
2006 May 02
9
Updating only one field
At present, I use an update like this to set the user''s last login time: authenticated_user.update_attribute(:last_login, Time.now) However, this calls the following, updating all fields: UPDATE users SET `last_login` = ''2006-05-02 13:27:41'', `hashed_password` = .... Is there any way I can tell ActionRecord to only update the one field? I don''t really want
2006 Jul 31
3
Missing controller default code
Hello, I generated a controller, using the command: ruby script/generate controller my_kontroller my_model The generated controller file, however, contains an empty class definition. The default controller code is missing. Any idea what went wrong? Thanks, gk -- Posted via http://www.ruby-forum.com/.
2010 Nov 03
2
[klaR package] [NaiveBayes] warning message numerical 0 probability
Hi, I run R 2.10.1 under ubuntu 10.04 LTS (Lucid Lynx) and klaR version 0.6-4. I compute a model over a 2 classes dataset (composed of 700 examples). To that aim, I use the function NaiveBayes provided in the package klaR. When I then use the prediction function : predict(my_model, new_data). I get the following warning : "In FUN(1:747[[747L]], ...) : Numerical 0 probability with
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/.