Displaying 20 results from an estimated 600 matches similar to: "Validate two fields so they do not match"
2006 Mar 02
3
validates_uniqeness_of
Hello,
I am trying to understand usage of validates_uniqeness_of.
Say I have, two column ''name'' and ''email'' in my table users
three unique key is possible for these two columns
1. name
2. email
3. name and email together
My question is,
if I write
validates_uniqueness_of :name, :email
what uniqueness is it going to apply,
1 and 2
or,
3 ?
Thanks,
Mohammad
2006 Jun 21
2
error_messages_for not displaying validation errors
Hi all,
I''ve been searching the web and the list archives for help on this and I''ve
found some tips, but I''ve been racking my brain on this for hours.
I have a Model, View, and Controller that are handling the uploading of a
file to my server. I want to make sure that the description is set and that
a file is selected to be uploaded. I have set validates_presence_of
2006 Apr 29
1
Display SVN Revision Number in a View
Is it possible to display the SVN revision number in a view? I''d like for
this to be done automatically and not something that I''d have to update each
time the revision is updated. I know that it is kept in a .svn file or
something, but I am curious if anybody out there has done something similar
in the past.
Thanks,
Ryan
--
Ryan Prins
rprins@gmail.com
http://www.lazyi.net
2006 Apr 21
1
Data access problem in object when using acts_as_authenticated
Hi all,
I''m running into this frustrating issue with the acts_as_authenticated
plugin and one of the additional fields I added to the users table.
I have added a column ''account_type'' to the users table (among several
others) which denotes the type of account it is. This stores an integer
value that is set by the system during account creation. The value is
getting set
2006 Feb 27
8
Change Bit Value To Text When Viewed
Hey All, very simple question for you folks ;)
I have a @commutes object that for each record there is a bit value set
(0/1) to denote if an accident occurred. What I want to do is have it
display "Yes" or "No" when I view the listing of commutes. I can get it to
display the bit value just fine with <%= commute.accident %> but how can I
get it so that when a record with
2006 Apr 18
1
Save item to DB x times (howto)?
Hi All,
I have a pretty simple question. I have a view that offers the user the
following:
1. A text field to enter in a passphrase
2. Another text field to define how many times that phrase is written
to the DB
It probably doesn''t make sense for it to be written to the DB x times, but
this is the first step in a process and the passphrase will become unique.
I currently
2006 Apr 27
2
check_box_tag and :disabled => ''disabled'' problem
I''ve been using the check_box_tag to generate checkboxes for an application
I am working on and I''ve run into a little hiccup.
When I set the options for the checkbox to be { :disabled => "disabled" }
the checkbox becomes disabled, as I would expect. However, if I set the
checked value to true and keep the disabled option, the value for the
checkbox is not returned.
2006 Mar 13
3
Convert line breaks to paragraph tags
Hi All!
I have a small problem with a data conversion that I am doing from WordPress
to a custom app that I am building in rails. In WordPress, line breaks were
handled in the PHP code and converted to <p></p>. What I am wondering is,
how can I add in the paragraph tags around lines of text (e.g. <p>some text
that is line 1</p><p>some text that is line 2</p>
2006 Apr 25
0
Need help making code more rails like!
Hi all, I''ve been a PHP programmer for many years and I''ve recently picked
up ruby and rails and am loving it! However, I''m still learning the "rails
way" of doing things and I''ve got a block of code that I think could use a
face lift. Any help, tips, suggestions, you can offer in making it more
rails-like is greatly appreciated. The only thing that I
2006 May 05
3
OT: Require e-mail during sign up process?
Sorry that this thread is a little off topic, but I''m looking for some
varying opinions on the subject and I think this group has a breadth of
experience on this matter :)
A little background info... the registration process for a web application I
am developing will be targeting those ages 13+ with the bulk of the users
being in the 13-25 age range. We are in the process of developing
2006 Jun 29
9
Handling multiple developers making migrations and using svn
Hey all,
I''ve run into an interesting scenario that I think some of you might have
some suggestions on. I am currently working on a RoR project and we are
making full use of the migrations. We are also using a subversion repository
for our source control. Now, the problem....
We are both making migrations and checking them into SVN. So, if in our
checkout we have migrations up to 10 and
2006 Apr 14
1
Validating Existing Models
I''ve got a user object which has quite a few attributes mapped to the
database. As of right now I''ve got some validations in the model like:
validates_presence_of :password, :message => "You must specify a valid
password."
validates_confirmation_of :password, :message => "Password doesn''t match
the confirmation."
validates_presence_of
2006 Dec 07
2
validate_on_destroy ?
What''s the best way to validate_on_destroy. Rails only seems to include
validate_on_create and validate_on_update methods. I don''t want to
resort to doing:
before_destroy do |j|
raise "There is an error" if j.etc
end
Is there a way of finding out what action (create/update/destroy) is
being performed if I use the ''validate'' method?
--
Posted via
2006 Feb 03
2
validation only on a specific action
Hello again!
I have a action that lists users and that allows an admin user to create
new users. When the admin user creates a new user an e-mail is sent to
the created user telling him to register in the site. I want to validate
the user name and password only when the user register and not when the
admin user creates it. Can anyone tell me how to do this?
Thanks.
Best regards,
Hugo
--
2005 Sep 27
2
No Custom Validation
Hi,
Correct me if I am wrong but there doesn''t seem to be an easy way to add
validation outside the pre-built ones (validates_presence_of,
validates_lenght_of, etc.).
Ideally there should be something like:
Class Person < ActiveRecord::Base
validates :my_method, :on => create, :message => ''was not valid''
def my_method(param)
false unless
2011 Apr 28
3
difference between validate and validate_on_create
i just ran into a problem with some test, and i am not exactly sure why,
but the difference happened when i changed my model validation from:
validate :custom_validation
to:
validate_on_create :custom_validation
can someone give me any ideas on where in the chain the validation takes
place?
thanks!
--
Posted via http://www.ruby-forum.com/.
2006 May 17
1
Renaming controllers/views/models
Hi,
What would be the best way to rename a controller and associated models/views ?
Do we have to do it by hand ?
Is there a tool that could help us renaming pluralized words too ?
Mickael.
On 5/11/06, Ryan Prins <rprins@gmail.com> wrote:
> Following up on this, does this delete the associated tests as well and
> other items that are created when you do script/generate controller
2006 Jan 19
2
Easy way to handle form input without a model class?
I have a couple forms that I''d like to be able to validate and
automatically populate, but it shouldn''t be based on AR. In fact I
often have a bunch of small forms that I can''t really justify writing
a whole new model class for anyway. I''d like to validate the form
input, and then use rails helpers to automatically populate the form
if validations fail.
2007 May 23
6
RESTful RESOURCE PARTIAL UPDATE
I have modified scaffolding code slightly to get three edit actions
and three update actions.
The requirement: to allow users to edit attributes for the same model
from seperate forms instead of one form, while using the given
scaffolding code and performing model validations. I am using
restful_authentication with the login email password validations
defined.
class users_controller
2006 Jun 19
2
call validate functions
Hi
on the code below the validates all the form fields
if @client.save
flash[:notice] = ''Client was successfully created.''
redirect_to :action => ''list''
else
render :action => ''new''
end
how can I do this action without having to save the object?
ie
if validate
#move on to next stage
else
redner