Displaying 12 results from an estimated 12 matches for "birth_date".
2012 Feb 01
12
date validation in rails 3
consider scenario,
User model with name, birth_date fields (here birth_date is not mandatory
field)
inside view form birth_date is assigned as ''31/31/1985'' which is invalid
ideally user object should be invalid and while save raise an error on
birth_date field but that''s not happening and user object gets saved with
birt...
2011 Mar 21
1
Trouble with simple R list concatenations
PROBLEM How can I concatenate the following lists into ONE LIST WITHOUT
the unhelpful message "operator is invalid for atomic vectors"? Combine
as a data frame?
EXAMPLE
Birth_Date <- NULL
Birth_Date[1:3] <- c("01/17/1939","01/17/1949", "01/17/1959")
Later_Date <- NULL
Later_Date[1:3] <- c("01/17/2009", NA, NA)
Names <- NULL
Names[1:3] <- c("Martha Smith", "John Doe", "...
2006 Jan 14
11
accessing models from migrations
Ok, so now Users need to be associated with Organizations. I''ve
created a migration and added a ''organization_id'' column to the users
table. I want the default organization_id to be the first
Organization. So I have :default => Organization.find(:first). But
it''s complaining about not being able to find the constant
''Organization''.
Any
2010 Nov 28
2
Dynamic find_by method returning nil in a class method
I have a user Model with a class method that I am using to do some
authentication
basically something like this
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :first_name, :last_name,
:email, :birth_date, :sex,
:password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :first_name, :presence => true,
:length => { :maximum => 50 }
validates :last_name, :presence => true,...
2007 Nov 03
3
Birthdate validation
...ve to read and agree with the Aykall Policies before
signing in."
validates_multiparameter_assignments :message => " is not a valid
date."
age_limit = Date.new(Date.today.year, Date.today.month,
Date.today.day).change(:year => Date.today.year - 18)
validates_numericality_of :birth_date, :less_than =>
age_limit, :message => "is invalid. You have to be at least 18 years
old to sign in."
end
I''m getting the error message "undefined method `change'' for #<Date:
4908815/2,0,2299161>" but, honestly, I don''t know what else to tr...
2006 Jun 12
0
validates_associated -- explicitly setting collection?
...Parent < ActiveRecord::Base
has_many :first_children, :dependent => true
has_many :first_children, :dependent => true
validates_associated :first_children
validates_associated :second_children
end
class FirstChild < ActiveRecord::Base
belongs_to :parent
validates_format_of :birth_date, :with => /^\d{4}\/\d{2}\/\d{2}$/
end
class SecondChild < ActiveRecord::Base
belongs_to :parent
validates_format_of :birth_date, :with => /^\d{4}\/\d{2}\/\d{2}$/
end
The key bit here is the validation -- namely the validates_associated.
If I collect hashes of data from a form for the...
2006 Apr 26
5
Best way to split forms into steps?
I have a form with about 30+ fields, which the client is wanting to
separate into 3 pages/steps - just wondering what is the best way to go
about this, specifically remembering data entered, from one page to
another, and making sure the various bits of data are validated
correclty, error messages outputted etc etc...
is there a best practice method for doing this?
--
Posted via
2007 Jun 24
6
I only want one type of model returned from a multi_search
...e numbers. I want to be able to search by any
fields directly from the person model and search the fields from the
email_address and phone_number models, but I only want to get back
people.
person
has_many email_addresses
has_many phone_numbers
acts_as_ferret :fields => [:firstname, :lastname, :birth_date]
email_address
has_one person
acts_as_ferret :fields => [:email_address]
phone_number
has_one person
acts_as_ferret :fields => [:phone_number, :phone_type]
multi_search(options[:query], ["EmailAddress", "PhoneNumber"], {:limit
=> :all})
Is this the right way of do...
2009 Jan 06
0
Different class for a data_select
Hi,
I am using this syntax : f.date_select :birth_date, :class=>"test"
I want to use a width different for the 3 select, but the class is not
different for the three select.
Is there a way to apply a different width ?
thx
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the...
2010 May 05
0
Auto_complete with has_one association
...complete :user, :ville_name, { :size => 15 },
{ :url => formatted_villes_path(:js), :method => :get, :param_name =>
''search'' } %>
Model:
class User < ActiveRecord::Base
attr_accessible :email, :ville_id, :newsletters, :role, :gender,
:first_name, :last_name, :birth_date
serialize :newsletters
has_one :ville
GENDERS = %w(Homme Femme)
ROLES = %w(Admin Business User)
def full_name
[@first_name, @last_name].join('' '')
end
def ville_name
ville.name if ville
end
def ville_name=(name)
self.ville = Ville.find_or_create_...
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i
have their d.o.b. stored as a date in my db.
cheers
--
Posted via http://www.ruby-forum.com/.
2008 Apr 30
4
Beginner mysql problem
I am new to rails and have come across a problem with a sample
application I was working on.
When trying to use rake migrate I got the error listed below.
my db file contains the following
class ContactDb < ActiveRecord::Migration
def self.up
create_table "people" do |t|
t.column "id", :integer
t.column "name",