similar to: Removing a default value for a foreign key with not null set

Displaying 20 results from an estimated 4000 matches similar to: "Removing a default value for a foreign key with not null set"

2005 Jul 14
1
Single-table inheritance and eager loading
I have a people table with four types of people: clients, spouses, children, and others all setup using single-table inheritance with a foreign key back to a household record. A Household has_one client and spouse, and has_many children and others. I want to use a single "Household.find(@session [:household_id], :include => [:client, :spouse, :children, :others])"
2006 Jun 21
1
Migration with foreign key won''t work
Hi all I use the plugin which supports foreign keys with migrations: http://wiki.rubyonrails.org/rails/pages/Foreign+Key+Schema+Dumper+Plugin/versions/12 I have created the following migration file: class AddArtistsTable < ActiveRecord::Migration def self.up create_table :artists, :force => true do |t| t.column :name, :string, :limit => 100 t.column :artist_type_id,
2005 Oct 09
1
enter a survey design in survey2.9
Hi dears, I expect that Mr Thomas Lumley will read this message. I have data from a complexe stratified survey. The population is divide in 12 regions and a region consist to and urban area and rural one. there to region just with urbain area. stratification variable is a combinaison of region and area type (urban/rural) In rural area, subdivision are sample with probabilties proporionnal to
2006 Apr 01
4
Custom Validations
Does anyone how to create a validation that: validates_presence_of :a OR :b I.e. :a OR :b must be present. I thought this would probably be possible with some kind of validation callback, e.g.: def check_a_or_b_is_set return (a or b) end Any ideas? Thanks, Rob -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Mar 24
1
Problems with before_validation
Hi all My visitors can create party organisator profiles, and I want assign them as the creators (the field creator_id in the organisators table references a member in the members table). To do that I tried it with before_validation: def before_validation creator = Member.find 1 end Sadly, this does not work. The validation validates_presence_of :creator_id Still tells me, that
2007 Oct 27
1
[non-statistics question]methodological problem
Good afternoon! As mentioned in the subject, my question regards more the methodological part that accompanies survey design and the statistical part that is involved. So, I have the following data: a<-data.frame (id_hh=c(1:5), strata=c(1,1,2,2,1), Nhstrata=c(100,100,200,200,100), Nrmemb=c(2,4,2,5,4)) a$ocmemb1<-c("wk","jl","st","jl","st")
2006 Feb 09
1
Alternative take on Selenium in Rails
Hey there, There''s been a bit of work going on with Selenium and Rails recently, so I thought I may as well share what I came up with. Check out my blog post at http://blog.viney.net.nz/articles/2006/02/09/selenium-testing, grab the plugin and give it a whirl (be sure to read the README!). Basically, my approach was to make it possible to write Selenium tests in the same way that
2006 Sep 06
6
validates_presence_of question
Can I use validates_presence_of somehow if I want to check that at least one of 2 fields is not empty? Thanks, Dmitry -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2003 Aug 20
1
query on converting survey data from one structure to another
Dear R users, I am trying to convert a dataset from one format to several rectangular datasets. A consultant helped design the data entry program for our survey using Delphi/Pascal and for each household the information is stored in a file called "EA-HM-HH.TXT" where EA is the enumeration area number, HM is the homestead number and HH is the household number. Within this file the
2006 Nov 01
3
active_record_base_without_table plugin - Easily use models without tables
Hi all, Here''s another little plugin I wrote to use AR models without tables. It''s dead simple, just extend from ActiveRecord::BaseWithoutTable instead of ActiveRecord::Base: class Contact < ActiveRecord::BaseWithoutTable column :name, :string column :email_address, :string column :message, :text validates_presence_of :name, :email_address, :message end
2006 Apr 24
4
[TIP] Ensure your test data is valid
Recently I wanted to check that my test data was valid. Seems like a reasonable thing to want to do so I thought I''d share the rake task. Add this code to a rake file in lib/tasks and run with rake db:fixtures:validate. It will print out the class, record id and error messages for any model objects that fail validation. Enjoy! -Jonathan. -- namespace :db do namespace :fixtures do
2006 Jun 27
4
Not Active Record Model Validation
I have a problem with ruby on rails validation total_book_toy.rhtml ================ <%= text_field ''book1'', ''title1'' %> <%= text_field ''book2'', ''title2'' %> I want to validate these text_field so user can''t insert same title. However, I was stuck how to do it. Or maybe you have another way how to do it.
2007 May 11
4
"validates_presence_of" not working
Hi, guys, I''m learning to use Rails, and, while reading the "Rails: Up And Running" book, I tried to make an insertion validation, using the following code: class Photo < ActiveRecord::Base validates_presence_of :filename end It simply didn''t work, the validation does nothing and an insertion with an empty field returns TRUE. What''s wrong?
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
Hi all I tried and tried and tried, but I still fail in creating a form with proper validation and stuff for foreign keys... So I''d really like to get some help here. I''m creating a booking site for DJ''s, and for every booking one can choose one of different countries: class Booking < ActiveRecord::Base validates_presence_of :country_id
2006 Apr 07
3
Different validation for different users
Hi, I have two types of users; normal user and admin. I have a field called priority in the table task. This priority field is invisible to the normal user, but not to the admin. The admin has to fill in the priority field when he adds a record via filling a form. Thus, i need to add validates_presence_of :priority to the model task. But, if i do this, then the normal user can''t add a
2006 Mar 15
3
Self-referential join model does not work
I have been trying to model a labeled graph using ActiveRecord (trunk version). Basically, I have a ''Node'' model which represents a node linking to other nodes. Links (aka edges) are labeled (i.e., have a ''label'' attribute and other behavior). Thus I decided to model edges as an ''Edge'' model and use a ''has_many :trough''
2006 Jan 02
6
Login_engine - auth against email rather that username?
Hi all, Short of hacking the code apart, is there a method making the login_engine authenticate against email address rather than username? I find that people rarely remember usernames, and would prefer to use email addresses as the identifier. Thanks! Tom
2012 Sep 25
1
Three Stage Sampling of categorical variable using 'survey' in R
For a sanitation project in Bangladesh I need to design a three stage sample survey to be representative of around 40 million people. I find myself suddenly with several challenges with which I struggle and would be gratefully for any help. As the questions are linked I kept them together rather than creating multiple posts 1) SURVEY DESIGN So far I designed mainly two stage cluster surveys but
2012 Aug 04
3
Questionnaire Analysis virtually without continuous Variables
Hello! I am doing an analysis on a questionnaire of hunters taken in 4 different districts of some mysterious foreign country. The aim of the study was to gather info on the factors that determine the hunting success of a peculiarly beautiful bird in that area. All variables are factors, i.e. they are variables such as "Use of Guns - yes / no", "Use of Dogs - yes / no" and
2008 Aug 12
1
Problem with using read.csv with web address
Hello, I have a problem with using read.csv(). I want to read a table from the ONS neighborhood statistics website which has an address: