Displaying 20 results from an estimated 3000 matches similar to: "validates_numericality_of :not_equal_to"
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:
2008 Jan 01
7
in_vertical_groups_of
Hi all,
Here''s another contribution for anyone interested.
In Railscast episode 28, Ryan Bates showed us in_groups_of which
allows you to group array members such as
>> list = [1, 2, 3, 4, 5, 6, 7]
=> [1, 2, 3, 4, 5, 6, 7]
>> list.in_groups_of(3)
=> [[1, 2, 3], [4, 5, 6], [7, nil, nil]]
This allows you to iterate over the groups and, for example, display
a list
2006 Jul 27
9
Introspecting validates_presence_of
Hello people,
I''d like to detect whether an attribute of a model has
vaildates_presence_of applied to it so I can automatically apply a
mandatory (*) to the field...it doesn''t look easy...any ideas?
Cheers,
--
Dan Webb
http://www.danwebb.net
2008 Sep 17
13
Capturing the sql from a statement without executing it?
Hi guys,
Is there an elegant way to capture the sql that would have been
executed by an ActiveRecord statement, without actually executing
it? :)
I''m imagining something like
sql = User.find(1).groups.to_sql
or perhaps
sql = ActiveRecord::Base.capture_sql { User.find(1).groups }
resulting in sql = ''SELECT * FROM groups INNER JOIN memberships....
WHERE users.id =
2008 May 06
12
Why before_filter is not working?
I have been scratching my head on this one for most of the day.
Hopefully someone can help explain why before_filter isn''t working for
my codes.
In my Application controller, I have this:
before_filter :login_required, :except =>
[:newacct, :create_newacct, :passwd_reset ]
def login_required
unless session[:user_id]
flash[:notice] = "Please log in"
2008 Jun 10
7
ActionMailer undefined method `parameters' - Rails 2.1
Hello Rubyists,
I''m currently trying to get email hooked up via ActionMailer, and while
I''ve gotten it to work in the past on Rails 1.2.x, I''m seeing an error
that I''m unfamiliar with.
Right now, I''m just trying to send email from my dev box via the SMTP
server at work.
My development.rb file:
#...snip
config.action_mailer.delivery_method = :smtp
2006 Apr 03
4
validates_numericality_of, :allow_nil => true?
Is there a way to use validates_numericality_of and still allow null
values?
I have a model with some optional values that can be nil, but if they''re
present, they must be numbers. Will I need to construct a custom
valiation for this, or is there some method built in? Seems like it
would be a common enough need.
Jeff
--
Posted via http://www.ruby-forum.com/.
2007 Dec 28
11
LIKE clause in rails
Hello,
I am trying to achieve a search functionality in the following manner
i have an table called people
which has
first_name,last_name,etc...
After the user form to search people is submitted i get the params hash
as params[:persons]={"first_name"=> "%John%","last_name"=>"%Stevens%"}
NOTE : I have changed the params hash to include the %.
Now
2008 Nov 03
17
SQL queries in Rails
Hi...
I want to know the equivalent instructions to insert, update, search
and delete a registry. I know Rails can do it easily Thanks to
ActiveRecord, but here''s the catch: I''m using PostgreSQL. As I''m using
SQL to do the migration (Including the foreign keys), I need to know
if I can use SQL queries to do those actions. Is there an example out
there?
I uncommented
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
2007 Dec 24
5
output link_remote_to in helper
Hi all,
I have a complex link_remote_to link I need to generate often. I want
to DRY up my view and create a helper that generates this
link_remote_to for me.
Is there a way my helper can output the link_remote_to javascript?
Thanks
STijn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Jun 19
3
newbie validation
hi there. Here is the simple scenario:
My active record connects to a table that contains an integer field.
My form contains a text box that allows me to enter a value to get
updated to the integer field.
If anything gets entered that is anything other than a POSITIVE INTEGER,
I want to display an error.
I have noticed that if I create a new active record like
@record =
2006 Jul 05
2
Serialized object behaves weird
Hi!
I got a class named EinsatzFilter which I serialized to session. Before
saving to session it works afterwards I keep getting the message:
"undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from
ActiveRecord::Base inherited class.
Code:
class EinsatzFilter
include ApplicationHelper
attr_reader :personen, :monat, :projekte, :kunde
2006 Feb 03
9
validating phone numbers
Anyone got a good validation for validating a phone number? I just
want to make sure that whatever the user enters is somewhat sensical,
and i''d like to be fairly liberal about what kind of a format it''s in.
Joe
2009 Mar 27
3
ANNOUNCE: Hirb - A gem enhancing your script/console
Hi,
I''m announcing Hirb, a mini view framework which enables script/
console to provide custom views.
Out of the box your activerecord objects come back as ascii tables.
You can also configure your tree-based models to return as ascii
trees:
Numeric
|-- Float
|-- Integer
| |-- Bignum
| `-- Fixnum
|-- Date::Infinity
`-- Rational
I''ve written two tutorials on
2005 Nov 28
4
validates_format_of nil
I''ve noticed that validates_format_of will return invalid if the field
is nil.
Question 1) How should we declare a validation that will validate it
with a regex if it is set, but, if the field is not set, just move on
Question 2) Why is it done this way? The other validators are only
invoked if the field is set . If you want to declare the field
mandatory, you add a
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 Aug 14
3
case insensitive exclusion_of
I have the following validation code, however it will allow variations
in case. Like ''Admin'' and ''admiN'', etc
validates_exclusion_of :login, :in => %w( admin ),
:message => "is reserved for system accounts"
how can I make this validation case insensitive?
--
Posted via http://www.ruby-forum.com/.
2007 Dec 09
5
Browserized Styles Plugin
Browserized Styles provides a dead simple way to create browser-
specific CSS code for use in a Rails application. All you need to do
is create a .css file targeted to a browser by appending an underscore
and identifier to the end.
=== Installation ===
script/plugin install http://svn.intridea.com/svn/public/browserized_styles
=== Example ===
Let''s say I have some complex CSS code
2011 Apr 23
1
rake spec fails where rake spec:(models|controllers|views) pass
I''m still trying to work into Ruby 1.9.2 and am now experiencing
something that makes no sense to me. Using rspec 1.3.2 and rspec-rails
1.3.4 with rails 2.3.11 on ruby 1.9.2-p180, when I
$ rake spec:models
they all pass. When I
$ rake spec:controllers
they all pass. When I
$ rake spec:views
they all pass. But when I
$ rake spec
I get
<path to