similar to: should validate_numericality_of with greater_than_or_equal_to

Displaying 20 results from an estimated 1000 matches similar to: "should validate_numericality_of with greater_than_or_equal_to"

2008 May 11
0
validates_numericality_of and greater_than* doesn't appear to be working
I''m using Rails 2.0.2 and I have been trying to take advantage of the "validates_numericality_of" with the ":greater_than" option with something like this: validates_numericality_of :users, :greater_than => 0, :only_integer => true, :allow_nil => true, :message => "The number of allowed users must be a whole number greater than zero." But this
2006 Apr 27
0
DRY validation
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, A few months ago someone posted a message about specifying validates_* constraints on a per-attribute basis. I just created a small plugin that allows you to do this. Here''s an example from one of my models: class Country < ActiveRecord::Base attribute :name, :string do |a| a.validates_length :within =>
2014 Feb 05
0
Solr Search with one to many associations
I have a 2 entities which have many to many relation say teacher and slot. Each teacher has many classes he/she takes up and each class is a slot. I want to perform search on teacher by sunspot solr for all the teacher who takes classes for different days in specific time. Say model structures and relations as follows class Teacher < ActiveRecord::Base attr_accessible - name,
2011 Sep 07
4
rspec testing inheritance
Hello, Is there any way to test model inheritance in spec? something like.. it { ChildModel.should < ParentModel } thanks.
2008 May 17
12
validates_numericality_of with greater_than* less_than* simply don't work
It seems that the validations for: greater_than greater_than_or_equal_to less_than less_than_or_equal_to equal_to odd even Simply do not work (Rails 2.0.2). I''ve tried every combination I can think of and these never seem to fire. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2011 Sep 14
1
rspec and should have_many through
Hi, Anyone can help me with rspec shoulda validations please. I can''t get the syntax right for these validations. Please correct me it { should have_one :tradable, :through => :trade_order} it { should belong_to :source, :polymorphic => true } it { should have_many :transfers, :as => :source } this is for Rspec 2, rails 3.1, gem "rspec-rails" gem
2011 Aug 28
1
troubles running rspec..
developing a 3.1 app. trying to run spec on and get this error: bundle exec rake spec ***************************************************************** DEPRECATION WARNING: you are using a deprecated constant that will be removed from a future version of RSpec. /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/ runtime.rb:68:in `require'' * Rspec is deprecated. *
2013 Sep 07
0
[shoulda-matchers gem] validate_numericality_of_matcher strange behaviour
Hello I have Vacancy model and vacancy_spec test with validates_numericality_of :salary, greater_than: 1 in the model and validate_numericality_of(:salary).is_greater_than(2) in the _spec. When i run rspec spec command tests pass (in some cases and in other they don''t) Why? vacancy.rb ------------------------ class Vacancy < ActiveRecord::Base validates_presence_of :name,
2009 Jul 13
0
[PATCH server] remove vm forward vnc and vm host history
since the introduction of ovirt-vnc-proxy and the updating of ovirt-viewer to user it the forward vnc functionality is no longer necessary / and incompatable w/ the current system. --- src/app/controllers/vm_controller.rb | 2 - src/app/models/host.rb | 9 - src/app/models/vm.rb | 36 ----
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:
2011 Feb 02
6
how to set default_scope for the whole application?
I know I can set default_scope for individual active record model, but can I set one up for the whole application? thanks -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to
2006 Aug 14
1
What fields_for really for?
Hello everyone! I have 3 models: === 1 === class Region < ActiveRecord::Base has_many :districts end === 2 === class District < ActiveRecord::Base belongs_to :region has_many :suburbs end === 3 === class Suburb < ActiveRecord::Base belongs_to :district validates_numericality_of :region_id, :only_integer => true end In edit.rhtml for SuburbController I need to specify
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
2011 Jun 19
10
validates_numercality_of with allow_nil.
In the model I have: validates :square_meters_public_land, :barrier_meters, :numericality => { :greater_than_or_equal_to => 0 }, :allow_nil => true but if, in the field, on create, I don''t insert a value I have the error "field is not a number". -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To
2011 Oct 12
1
`require': no such file to load -- rspec/rails (LoadError)
Getting strange loading problem.. >> bundle exec rspec -p spec/models/* give error: .. .rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/ dependencies.rb:240:in `require'': no such file to load -- rspec/rails (LoadError) from /home/slava/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/ lib/active_support/dependencies.rb:240:in `block in require'' from
2007 Jan 18
2
Conditional validates_inclusion_of execution problem
All, I have a field that I''m validating with validates_numericality_of on as well as validates_inclusion_of, like so: validates_numericality_of :number_of_owners, :only_integer => true, :message => ''must be a whole number'' validates_inclusion_of :number_of_owners, :in => 1..3,
2009 Sep 28
1
filter activeresource response body
Hello, I have an ActiveResource model that loads imperfectly structured json from a third party service. I need to catch response before its parsed by the model and make a few corrections on the json. How should I go about doing this? thanks, Slava
2010 Feb 10
6
validation problems
Hi, there. I have two validations in the model: validates_numericality_of :value, :only_integer=>true, :allow_blank=>true validates_size_of :value, :is=>9, :message=>"must be 5-digit number", :if=>Proc.new{|u| u.value.is_a?(Numeric)} They work as expected except when the :value is character/string like "a" "abc", the second validation will also output
2007 May 01
2
Problem validating boolean
Hi I''ve got a problem validating a boolean and I can''t see what the problem is. Here''s my model: class FinanceAgreement < ActiveRecord::Base belongs_to :asset validates_presence_of :finance_company validates_inclusion_of :balance, :in => 0.01..10_000_000 validates_inclusion_of :term, :in => 1..600 validates_numericality_of
2005 Dec 17
0
bug? saving (valid) updated object results in validation error
Hi! I have an error that I don''t understand. It shouldn''t be happening, according to the documentation! I have a class, defined as below. > class Coupon < ActiveRecord::Base > belongs_to :product > belongs_to :account > validates_presence_of :product > validates_associated :product > validates_presence_of :voucher > validates_presence_of