similar to: validates_uniqueness_of

Displaying 20 results from an estimated 100 matches similar to: "validates_uniqueness_of"

2009 Apr 22
4
help with exceptions
Hello, I was trying to to write a simple ruby program for exceptions. My code is: class ABC begin alpha = ABC.new alpha.foo= [1,2,3] puts foo.inspect.to_s NonExisting raise "all other exceptions" rescue Exception => NoMethodError puts ''Hello'' puts $ERROR_INFO.inspect rescue Exception => NameError puts ''goodbye'' puts $ERROR_INFO.inspect else
2006 Aug 03
3
How to override append method for related attribute?
I have a model that looks something like this: class Person < ActiveRecord::Base has_many :tasks [...] end I''d like to override/overload the append (<<) method for the tasks relational attribute such that I can perform some error checking in the context of a Person.tasks << task operation. Is there any way to do this? I wish I could do this in the context of
2009 Apr 30
1
error with test:functionals
Hello there, I working on my tests but I getting this strange errror: I can see on the database that the object was created but I still got an failure on my test. this is my test code: test "should create artist" do assert_difference(''Artist.count'', difference = 1) do post :create, :artist => { } end assert_redirected_to
2008 Jul 17
2
problems with validation on STI
I have the following STI table: def self.up create_table :distributions do |t| t.string :type t.integer :simulation_id t.string :dist_name t.string :desc, :default=> ''fixed'' t.float :param1, :default => 5.0 t.float :param2, :param3 t.timestamps #fields for RscDist t.integer :resource_id #fields for LoadDist
2008 Dec 11
2
uninitialized constant ActionVie
Hello I am trying to transform my web app into a 2.2 ready app, in my config/environment.rb I wrote Rails::Initializer.run do |config| ..... # disabling the surrounding div if validation error ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| if html_tag.include?("class=") html_tag.sub(%r{(class=["''])}, ''\1invalid '')
2012 Jan 18
3
Cannot redirect to nil!
I need some help please.. when I created web application about books market, i create a cart and using test the message error appear like this on rake test:functionals LineItemsControllerTest > test_should_create_line_item > ERROR > Cannot redirect to nil! and also appear on web side, thats error told that "Cannot redirect to nil!" Then i was checking the code,
2011 Jul 25
4
Rails 3 test database issues
I am having a problem using the test database in Rails 3. It apparently has kept track of aspects of the database that I deleted completely from my migrations at some point. I don''t always use the ''down'' part of a migration and sometimes just recreate the whole database. I did rake db:migrate:reset and rake db:test:prepare, but when I run my test it is trying to access
2006 Jan 09
3
Include with two references of one model of the same table
Hey guys, I just came across this oddity, not sure what to make of it yet, but I think it might be incorrect behavior. When doing a @inst.find(:all, :include => ["hometeam", "awayteam"] ...) hometeam and awayteam are two references from a belongs_to that is of the same model and of the same table. I will get a pgerror stating that "matches", which is
2008 Jan 16
0
[CruiseControl] RubyOnRails build 8649 failed
The build failed. CHANGES ------- Revision 8649 committed by gbuesing on 2008-01-16 20:07:10 Introducing DateTime #utc, #utc? and #utc_offset, for duck-typing compatibility with Time. Closes #10002 M /trunk/activesupport/CHANGELOG M /trunk/activesupport/lib/active_support/core_ext/date_time/calculations.rb M /trunk/activesupport/test/core_ext/date_time_ext_test.rb TEST FAILURES AND
2006 Jan 18
3
retrieving value from select
In my view, I have: <%= select("division_filter", "division_id", Division.find_all.collect {|p| [ p.division, p.id ] }, { :include_blank => true }) %> How do I retrieve the division_id in my controller? -- Posted via http://www.ruby-forum.com/.
2007 Aug 04
1
ActiveRecord gotcha with references?
I have this situation: class Employee < ActiveRecord::Base belongs_to :designation end class Designation < ActiveRecord::Base end I do the following at the irb console: Step 1: Find an employee >> emp = Employee.find 3 => #<Employee:0x35a7d34 @attributes={"designation_id"=>"3", "id"=>"3",
2008 Jan 19
0
[CruiseControl] RubyOnRails build 8671 failed
The build failed. CHANGES ------- Revision 8671 committed by bitsweat on 2008-01-19 03:45:24 Support aggregations in finder conditions. Closes #10572. M /trunk/activerecord/test/cases/finder_test.rb M /trunk/activerecord/CHANGELOG M /trunk/activerecord/lib/active_record/aggregations.rb M /trunk/activerecord/lib/active_record/base.rb TEST FAILURES AND ERRORS -----------------------
2008 Jan 22
0
[CruiseControl] RubyOnRails build 8688 failed
The build failed. CHANGES ------- Revision 8688 committed by nzkoz on 2008-01-22 01:29:10 Add options missing from earlier changeset M /trunk/activerecord/lib/active_record/test_case.rb TEST FAILURES AND ERRORS ----------------------- Name: test_ordering(FirstSecondHelperTest) Type: Failure Message: <"first mail"> expected but was <"">.
2008 Feb 19
1
[CruiseControl] RubyOnRails build 8896 failed
The build failed. CHANGES ------- Revision 8896 committed by bitsweat on 2008-02-19 02:56:05 Don''t assume all records from nested include are of same class. Closes #11154 [acechase] M /trunk/activerecord/lib/active_record/association_preload.rb A /trunk/activerecord/test/cases/associations/eager_load_nested_include_test.rb TEST FAILURES AND ERRORS ----------------------- Name:
2006 Aug 10
2
validates_uniqueness_of problem
hi Could I check to strings for uniqueness together and not individually? That means for me in an example: name: sex: result: ----- ---- ------- miller m unique miller f unique jackson m unique miller m isn''t unique So I want to check the name and sex be together unique. The name isn''t
2006 Jul 28
0
Dreamhost, fastcgi, validates_uniqueness_of.... is not always unique?
Hey everyone, I have an application running on dreamhost with fast cgi (FCGI). I have a model, "Member", that has the following validation: validates_uniqueness_of :email, :if => Proc.new{|member| !member.email.blank?} The :if clause is really not needed because an email address is required and in fact the model also has: validates_presence_of :email
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/.
2006 May 10
1
Validates_uniqueness_of multiple field combo?
Hello, I am new to Ruby on rails and this is therefore probably trivial. Lets say I have 3 tables - users[id,name, age, ...], interests[id,name,description, ...], and finally a table user_interests[id,user_id,interest_id] to link a user to a set of interests. Now there is no problem to put validates_uniqueness_of :name in the user-model to ensure that I only have one Lenny, but how do I
2006 May 18
1
validates_uniqueness_of
I used validates_uniqueness_of it is case insensitive, it takes only admin not Admin. So please help me out how to put validates_uniqueness_of as case sensitive Thanks in Advance Surekha.Matte -- Posted via http://www.ruby-forum.com/.
2006 May 26
2
validates_uniqueness_of but only when exists
I want to validate the uniqueness of a field if the field has a value. Is there anyway to do it? -- Posted via http://www.ruby-forum.com/.