Displaying 5 results from an estimated 5 matches for "less_than_or_equal_to".
2006 Apr 27
0
DRY validation
...bute :code_alpha3, :string do |a|
a.validates_length :is => 3
a.validates_format :with => /\A[A-Z]+\z/
a.validates_uniqueness
end
attribute :phone_code, :integer, :allow_nil => true do |a|
a.validates_numericality :greater_than_or_equal_to =>
1, :less_than_or_equal_to => 9999
end
end
The advantage of this it DRYs up the validation rules since you
don''t have to specify the name of the attribute over and over.
Plus it automatically sets validates_presence_of for the attribute
unless you set allow_nil as true -- as shown in the phone_code
attri...
2011 Sep 04
0
should validate_numericality_of with greater_than_or_equal_to
...MethodError:
undefined method `greater_than_or_equal_to'' for
#<RSpec::Matchers::Matcher:0xef23150>
this page
http://remarkable.rubyforge.org/activerecord/classes/Remarkable/ActiveRecord/Matchers.html
has method
it { should validate_numericality_of(:age).only_integer }
and :less_than_or_equal_to is a valid option..
I am confused. How do I spec this? thanks.
2014 Feb 05
0
Solr Search with one to many associations
...classes all 3 days rather taking as
"OR" condition.
Sunspot.search(Teacher) do
with(:day, "Monday")
with(:day, "Tuesday")
with(:day, "Wednesday")
with(:start_time).greater_than_or_equal_to("2:00pm")
with(:end_time).less_than_or_equal_to("5:00pm")
end.results
I am using solr version 3.5 and sunspot_rails (2.0.0) and sunspot_solr
(2.0.0) gems for solr in rails and my rails version is 3.2.6
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "R...
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: Talk" gr...
2009 Jul 13
0
[PATCH server] remove vm forward vnc and vm host history
...;is already in use",
- :if => Proc.new { |vm| vm.forward_vnc &&
- !vm.forward_vnc_port.nil? &&
- vm.forward_vnc_port != 0 }
-
-
validates_numericality_of :needs_restart,
:greater_than_or_equal_to => 0,
:less_than_or_equal_to => 1,
@@ -408,18 +384,6 @@ class Vm < ActiveRecord::Base
super
end
- # find the first available vnc port
- def self.available_forward_vnc_port
- i = FORWARD_VNC_PORT_START
- Vm.find(:all,
- :conditions => "forward_vnc_port is not NULL",
- :...