similar to: Validations based on associations

Displaying 20 results from an estimated 6000 matches similar to: "Validations based on associations"

2008 Jan 27
4
(REST) Nested routes
Hello, I''m in troubles with nested routes. I have three models: Team, Tournament and TeamTournaments class Team < ActiveRecord::Base has_many :tournaments, :through => :team_tournaments has_many :team_tournaments class TeamTournament < ActiveRecord::Base belongs_to :team, :foreign_key => ''team_id'' belongs_to :tournament, :class_name =>
2007 Apr 09
10
changes in 0.8 and greater - should_
Has the should_... syntax changed? I''m getting errors when running the following: should_render(:index) should_be_valid should_not_be_valid should_respond_to should_be should_render I thought the syntax changed to something like the following: obj.should render(:index) but this doesn''t seem to work. Scott
2007 Jan 01
3
Another "how do I spec this?"
I wanted to add a convenience method on my User class to see if he was already signed up for a tournament. Here''s my spec context "A User signed up for one tournament" do setup do @t1 = Tournament.new @t1.save false @t2 = Tournament.new @t2.save false @user = User.new @user.save false @user.registrations << Registration.new(:tournament =>
2006 Nov 29
2
validates_uniqueness w scope
In a one-to-many relationship (domain has_many :categories and category belongs_to :domain) In the category model I use: validates_uniqueness_of :name, :case_sensitive => false but upon creation of a category this validation is performed on ALL domains, can I restrict it only to the categories of the current domain, the to which teh category being saved belongs_to ? if yes ? how ? thanks
2006 Jun 07
3
validates_uniqueness_of two fields
Is it possible to do a validates_uniqueness_of :name, :zip but only in that context? I''d like to be able to have that zip used again, but not in conjunction with a name already with that zip. Does that make sense? -- Posted via http://www.ruby-forum.com/.
2008 Jan 18
8
link_to problem
hi @ all I create a new archiv.html.erb and a archiv method in the controller. Now, I would like to link from index.html.erb to archiv.html.erb. I tried to use <%= link_to ''archive'', archiv_xxx_path %> but it doesn''t run. It appears a error message "SyntaxError in xxx#index". Does anyone know, how I can enhance this problem? thanks a lot... -- Posted
2009 Jul 04
12
save! not allowed after validates_uniqueness
I have this in a model validates_uniqueness_of :aspect, :scope => :user_id In an instance method of the same model I have "save!" but I don''t touch the :aspect attribute in that instance method at all. Whenever that save! command is run however I get this error: ActiveRecord::RecordInvalid: Validation failed: Aspect has already been taken I don''t
2002 Apr 05
1
Unreal Tournament 2003
I've just gotten around to reading the IRC chat with the developers of Unreal Tournament 2003. Looks like Vorbis support is a possibility: [21:53] <Mancubus> Has the idea of a built in mp3 player been introduced? :) [21:53] <Orpheus> Mancubus, wont happen [21:53] <Orpheus> Fraunhofer owns the rights to Mp3. [21:53] <Mancubus> Why not? [21:53] <Orpheus> Epic would
2009 Sep 25
12
uniqueness validation perplexity
I want to write a validate routine to check to enforce that a position must be unique in a category. (In another category, it doesn''t have to and shouldn''t need to be unique.) I write this code which works happily for new items: def position_in_category_not_unique @items = Item.find( :all, :conditions => [ "category_id = ? AND position = ?", category_id,
2007 Feb 22
1
tournaments to dendrograms
Does anyone have (good) experience converting tables of tournament results into dendrogram-like graphics? Tables, for example, like this: read.table(url("http://www.econ.uiuc.edu/~roger/research/ncaa/NCAA.d")) Any pointers appreciated. RK url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker at uiuc.edu Department of Economics vox: 217-333-4558
2006 Jun 14
3
Prevent duplicate HABTM associations
Hi, I am trying to restrict duplicate has_and_belongs_to_many associations. I tried to find support for a association validation for duplicates but couldn''t find anything. I understand I could use :uniq=>true on the model association but this would only prevent it from displaying duplicates, I want to stop duplicate associations being inserted in the first place. I have a vague
2008 Sep 06
5
Unreal Tournament
I installed unreal tournament '99 on WINE and whenever I try to open it, it says "Starting Unreal Tournament" in a new tab at the bottom and then it disappears and nothing happens. Any suggestions? I'm using a x64-Opteron 1.8Ghz Dual-Core, x64 Ubuntu, 2gb of RAM, Nvidia 6150 with Restricted Drivers. P.S. - Please give me a somewhat step-by-step because I'm all-knowledgeable
2007 Aug 23
6
controller spec with model that validates_uniqueness
I want to use mocks and stubs to test the controller, but am having trouble getting my validation not to trigger. Here''s the code: # spec: Image.stub!(:find).and_return(@image) @image.should_receive(:save!).once.with(:any_args) put :update, :id => @image.id, :category_id => @category.id, :image => {:name => ''test'', :image_number =>
2009 Sep 19
1
validations on a field
hi, i have a model with 2 validations on a field example: validates_presence_of :email validates_length_of :email, :within => 6..100 #r@a.wk validates_uniqueness_of :email validates_format_of :email, :with => Authentication.email_regex if i do the submit of form for a new object of the model with a blank mail i receive 4 errors. In this case i want receive
2006 Jul 07
7
Sequencing control with edit method in CRUD examples
I have been playing with the cookbook type of tutorials building a fish tournament scoring piece and am having a bit of a problem with a DB field called "points" in my "catch" table that is not input by the user but is calulated based on a "size" field that is input by the user. I have the following in my catch_controller.db def new @catch = Catch.new @fish =
2009 Aug 23
3
Wine 1.1.28 tests 2 pc config and many games
Phenom AMD 4x 9850 2.5Ghz oveclocked to 2.7Ghz Gygabite GA-MA78G-d3H, 8Gb RAM , 320Hdd UBuntu Linux 9.04 64 bit with wine 1.1.28 Tested 2 videocards test 1 - Radeon HD3200 (inside) 256Mb (wine 1.1.26) drv Ati 9.8 test 2 - Nvidia Geforce 9800 GT 1Gb (wine 1.1.28) drv Nvidia 190 With test i not used other dll's , not used registry files just install and run game (and check
2006 Apr 11
3
Validations and has_many :through (Join Models)
Hello again: I''m hoping that somebody, anybody, can help with this question. How do I make sure that records in a join model are unique? Using the scenario outlined in Chad Fowler''s "Rails Recipies", number 16, "Many to Many Relationships Where the Relationship Iteself Has Data". Here are the tables: create_table :magazines do |t| t.column :title,
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and automatically populate, but it shouldn''t be based on AR. In fact I often have a bunch of small forms that I can''t really justify writing a whole new model class for anyway. I''d like to validate the form input, and then use rails helpers to automatically populate the form if validations fail.
2006 Sep 12
4
ActiveRecord Validations - validates_uniqueness_of
Hello, I''m wanting to use Mocha and Stubba for my tests in place of the default Rails testing with fixtures. I have the following class: class Person < ActiveRecord::Base validates_uniqueness_of :email end and am wondering how I can test to ensure that the validates_uniqueness_of validation is running. Any ideas? -Jonathan
2012 Jan 29
2
loaded Unreal Tournament (GTOY) runs choppy Ubuntu 11.10
I loaded Unreal Tournament in wine 1.3.37 and everything works that I tried but the video is choppy. The sound was not choppy but the video was. It did not matter if I was playing online or the bots on my computer the video was choppy. I tried raising and lowering the video resolutions and it did not seem to effect the problem for better or worse. I am using Ubuntu 64 bit 11.10. I am on an AMD