Displaying 1 result from an estimated 1 matches for "find_by_age".
2007 Mar 22
3
assign events on creation of a new user
...events << Event.find(list)
end
#######
####### This doesn''t work... assigning user''s default age specific
items when first created...
def assign_age_items
year = Time.now.year
birthyear = @user.dob.year
age = year - birthyear
events << Events.find_by_age(age)
end
USER CONTROLLER...relevant code
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = ''User was successfully created.''
redirect_to :action => ''list''
else
re...