Displaying 12 results from an estimated 12 matches for "greater_than_or_equal_to".
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 post to this group, send em...
2011 Sep 04
0
should validate_numericality_of with greater_than_or_equal_to
Hello,
I have this in my spec
it { should
validate_numericality_of(:amount).greater_than_or_equal_to(0) }
but I get error:
Failure/Error: it { should
validate_numericality_of(:amount).greater_than_or_equal_to(0) }
NoMethodError:
undefined method `greater_than_or_equal_to'' for
#<RSpec::Matchers::Matcher:0xef23150>
this page
http://remarkable.rubyforge.org/activerecord/...
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 &q...
2006 Apr 27
0
DRY validation
...dates_uniqueness
end
attribute :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 -...
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
2008 May 11
0
validates_numericality_of and greater_than* doesn't appear to be working
...greater than zero."
But this doesn''t seem to be catching values set to zero or negative
values.
Am I using this correctly?
NOTE: I have the same problem with the "" option so I assume it is
something generally I''m doing wrong.
validates_numericality_of :value, :greater_than_or_equal_to =>
0, :only_integer => true, :allow_nil => true, :message => "Cannot use
a negative or fractional number."
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
T...
2014 Feb 05
0
Solr Search with one to many associations
...ing "AND" condition to
retrieve only the teachers having 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...
2010 Sep 21
1
[PATCH] Introduce ability to select any kind of nic model, not just default or virtio.
...# FIXME make this able to be v4 or v6 address
diff --git a/src/app/models/nic.rb b/src/app/models/nic.rb
index 51425bc..18218a3 100644
--- a/src/app/models/nic.rb
+++ b/src/app/models/nic.rb
@@ -53,6 +53,8 @@ class Nic < ActiveRecord::Base
validates_numericality_of :bandwidth,
:greater_than_or_equal_to => 0
+ NIC_MODELS = ["ne2k_pci","i82551","i82557b","i82559er","rtl8139","e1000","pcnet","virtio"]
+
# Returns whether the nic has networking defined.
def networking?
(network != nil)
diff --git a/src/ap...
2009 Jul 13
0
[PATCH server] remove vm forward vnc and vm host history
...ActiveRecord::Base
validates_format_of :uuid,
:with => %r([a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12})
- FORWARD_VNC_PORT_START = 5901
-
- validates_numericality_of :forward_vnc_port,
- :message => 'must be >= ' + FORWARD_VNC_PORT_START.to_s,
- :greater_than_or_equal_to => FORWARD_VNC_PORT_START,
- :if => Proc.new { |vm| vm.forward_vnc &&
- !vm.forward_vnc_port.nil? &&
- vm.forward_vnc_port != 0 }
-
- validates_uniqueness_of :forward_vnc_port,
- :message => "is already in use&...
2009 Jul 24
1
permit many-to-many vms / networks relationship redux
redux patchset permitting a vm to be associated with
multiple networks and vice-versa. updated patchset so
as to be applicable against current oVirt server HEAD
these patches may be applied in any order, they all
need to be pushed together
2009 Jul 09
2
permit many-to-many vms / networks relationship
This patchset contains changes to the ovirt server
frontend, backend, and tests components, permitting vms
to be associated with multiple networks and vice versa.
Also included are two patches which are required for the frontend
bits; a patch adding collapsable sections to the vm form, which
in itself depends on the second patch that provides default values
for the cpu and memory vm table fields
2009 Jun 30
0
[PATCH server] permit many-to-many vms / networks relationship
...twork.nil? && nic.network.class == Vlan }
+
+ # a vm / host can't have more than one nic on a network
+ validates_uniqueness_of :network_id,
+ :scope => [:host_id, :vm_id],
+ :unless => Proc.new { |nic| nic.network.nil? }
validates_numericality_of :bandwidth,
:greater_than_or_equal_to => 0
- validates_uniqueness_of :physical_network_id,
- :scope => :host_id,
- :unless => Proc.new { |nic| nic.physical_network_id.nil? }
-
# Returns whether the nic has networking defined.
def networking?
- (physical_network != nil)
+ (network != nil)
end
# Re...