Displaying 20 results from an estimated 10000 matches similar to: "Plugin - Redefining Numericality"
2006 Jun 07
1
Validating numericality based on related attribute value?
I have a price attribute in my model which I need to validate as a
positive number if the attribute price_terms.requires_value is equal to
''Y'', otherwise price can be blank or zero. Price_terms is a select list
which my model table belongs_to.
How do I do this? - I tried doing this:
validates_numericality_of :price, :if =>
self.price_term.requires_value.upcase ==
2006 Jan 19
7
validates_numericality_of positive integer
Hi,
What is the simplest way to validate a positive integer?
validates_numericality_of :foo, :integer_only => true
how do I add the positive part? Do I need another validation statement
for pattern matching or do I have to write a validate() funciton for
my model?
Thanks,
Peter
2006 Jan 27
17
Multiple Model Validation
Hey All !
I have a form which contains two models. I would like both models to be
validated, but have their validations aggregated on the page.
If I do:
<%= error_messages_for(:model1) %>
<%= error_messages_for(:model2) %>
It puts two big validation blocks on the page. I would like all the errors
from both models, but only in one validation box.
Is this possible ? All my attempts
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,
2006 Jun 21
3
validation help
I would like to validate a number within a certain range.
To first test that a entry is a valid number i use
validates_numericality_of :my_number, :message =>''sorry, not a number''
to test if the number is within a certain range i use
validates_inclusion of :my_number, :in => min..max, message => ''outside
range!''
If the numericality test fails, I
2006 Jan 26
21
pagination_links help
I want append custom query parameters to my pagination links, like
?page=1&foo=bar. I can''t quite figure out how to do this with the
pagination_links helper, although I believe the API says you should be
able to:
pagination_links(paginator, options={}, html_options={})
options are:
:params: any additional routing parameters for page URLs
Has anyone tried this?
thanks,
jeff
--
2006 Feb 10
3
Quoting table and column names inside AR
There are quite a few tickets asking for quoted table names and field names
to enable reserved words as table or column names.
What is the general consensus regarding this issue?
Bob Silva
http://www.railtie.net/
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core
2006 Feb 06
3
acts_as_threaded plugin
This plugin is related to the acts_as_nested_set functionality but differs
in that it allows multiple roots to exist within your database.
The other benefit, is that when adding a child, it doesn''t perform a full
table update to rebuild the tree, each child insertion only affects the tree
that it is placed in.
It even comes with my first screencast to show how you can build an old
2006 Apr 22
4
How to supress field name in error message?
Hi
How do I supress the reporting of a field name in the full error
message? I want the error to be associated with the field so that the
.fieldWithErrors class is applied to the field but I don''t want it to
add the field name to the actual error message.
For example:
errors.add("occurs_on", "The date can''t be today!") unless occurs_on
!= Date.today
I
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
2005 Aug 21
8
validates_numericality_of
As far as I can tell "numericality" is not a word. Maybe this method
should be renamed.
--
R. Mark Volkmann
Partner, Object Computing, Inc.
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:
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
2010 Jul 10
0
`method_missing': undefined method `i18n' for #<Rails::Railtie::Configuration:0x000001010fce98>
I have recently upgraqded to Ruby 1.9.2-rc1 and reinstalled rails 3
beta 4 with all the dependencies. I have run bundle install in my
rails project. Now I am trying to run some tests...
My test_helper.rb file looks like this:
# test_helper.rb
require ''rubygems''
require ''test/unit''
require ''rails/all''
$ gem list
i18n (0.4.1, 0.3.7)
2008 Mar 28
0
Patch review request: validates_numericality_of does not replace option in custom message like in default message
Hi,
Today someone created a ticket for a defect in
validates_numericality_of, at first sight i thought it wasn''t a defect
but an enhancement. But then i found that validates_length_of accepts
:message => "should be greater than %d", but validates_numericality_of
doesn''t (The output for v_n_o is: "should be greater than %d" instead
of "should be
2012 Feb 06
0
Error ActiveRecord::ConnectionNotEstablished
Hello, this morning I was trying to access my app on my computer, but,
when I initialize the server and access localhost:3000, this message
shows up:
ActiveRecord::ConnectionNotEstablished
So, I try to access via rails console, but again, another error:
felipe@Felipe:~/rails_projects/simple_cms$ rails console
2011 May 02
0
Change from 3.0.6 => Rails 3.0.7 "no such file to load -- action_mailer/railtie"
In my application.rb, I have this:
#require "rails/all"
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "active_model/railtie"
(I didn''t want ActiveRecord) This worked fine up to 3.0.6, but now fails
with:
/Users/jeffdeville/Documents/code/ruby/wg/config/application.rb:6:in
2015 Dec 01
2
mail_log plugin and uid=error in log file
On 01/12/2015 16:31, Timo Sirainen wrote:
>
> Does this help? http://hg.dovecot.org/dovecot-2.2/rev/25d63d9c7f5a
>
Hi Timo,
Sorry about the thread hijacking but, speaking about the mail_log
plugin, what do you think about the ability to add the session number to
the log lines produced by this plugin?
This could be a useful information to have too, especially on a large
traffic
2005 Oct 12
1
[ win32utils-Support Requests-2614 ] warning: redefining constant Struct::Win32ServiceStatus
Support Requests item #2614, was opened at 2005-10-12 10:23
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=412&aid=2614&group_id=85
Category: win32-service
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Scott Harper (sharperct)
Assigned to: Nobody (None)
Summary: warning: redefining constant Struct::Win32ServiceStatus
Initial
2007 Nov 03
3
Birthdate validation
Hello everyone,
I''m almost cracking my head trying to do this birthdate validation. It
turns out that I can only accept users with at least 18 years old and
I''m trying to validate it writing this code on my user.rb fil at app/
models
class User < ActiveRecord::Base
validates_presence_of :full_name
validates_presence_of :street_address
validates_presence_of :city