Displaying 20 results from an estimated 1000 matches similar to: "extract month from date column"
2006 Jan 07
4
set date with date_select
when retreiving a date from a DATETIME field in a database, is there a
way to set the date to the value of the DB in the view? It seems to
always default to the current date...
if I have a field called birthdate in the users table and i do
@user = User.find(@params[:id])
in my view i have a <%= date_select ''birthdate'',''user'' %>
but dont know how to
2006 Jan 04
5
How do I set the default value for date fields?
I want my date fields to default to NIL or "", because the presence of a
date means something. My problem is that rails is defaulting the fields
to today''s date automatically when I create a new record through the
scaffold. I tried removing the default ''0000-00-00'' and changing NOT
NULL to NULL, but both columns get today''s date as the default
2006 Feb 22
1
managing dates in forms
Hi,
I have a field for the user which is their birthday. I am letting them
edit it and then save it if they want. However, the form displays the
current date/time, and when they save the form without changing the
birthdate (because they do not wish to set it), the current date/time
gets saved to the db. How do I do this? I thought about having a
hidden field which would be the current date/time
2009 Feb 20
3
mean over previous cells
Dear RUsers,
I guess this is an easy question for someone a little familiar with
programming...(which I am not)...
I've got 2 colummns, one shows just dates(SST_date, Class 'Date' num), the
other one shows the SeaSurfaceTemperature (SST, num) at that certain date.
SST_date SST
2008-01-01 22.2
2008-01-02 21.8
2008-01-03 22.8
2008-01-04 22.9
2008-01-05 23.1
2008-01-06 23.2
...
2006 Jan 19
2
date_select broken
I am using date_select and in some instances it only shows about 10
years worth of choices. Same form on other users shows the whole
range. date_select looks like this
<%= date_select ''user'',''birthdate'' , :start_year => 1940 %>
I would expect to always see 1940-2006 or so , but i dont always do.
Is there a way to force the range or explain why i
2008 Jan 12
2
Problems with date field
Hi, I''m creating a date type field to put birthdate, but the years on
this field only go to 2003, what should I do??
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To
2009 Jul 02
3
Testing for membership in an array of strings
As an R beginner, I feel brain dead today as I can not find the answer
to a relatively simple question.
Given a array of string values, for example lets say "mary", "bob",
"danny", "sue", and "jane".
I am trying to determine how to perform a logical test to determine if
a variable is an exact match for one of the string values in the array
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
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/.
2007 Sep 21
1
calculate age of a person and compare it
how can i calculate the age of a person using database " birth date"
my teble is user and column is bday ....
now i want to calculate the age will some one please tell me how can i
calculate the age..
actually i want to compare my two database fields birthdate and
joining date ......that is why i need this....
will someone please tell me how can i do that
2006 Aug 11
4
date (age) validation
I have an application that requires users to be in a specific age group,
or above a certain age. For simplicity sake lets say they have to be at
least 18.
This is my most recent attempt to produce the desired result:
validates_exclusion_of :birthday, :in => Range.new(Date.today,
Date.parse( (18.years.ago).strftime(''%Y/%m/%d'') )),
:message => "does not meet
2012 Nov 12
2
how to enter a string value
hi,
I want to know just enter a string value
entering a numeric value is make with the function scan () or scan (nmax =
..)
but it does not work for string
my goal is to enter three string: name and surname and date of birth
I try with this code but it shows me errors
print ("enter the name")
name <- scan (nmax = 1)
print ("enter the first name")
firstName <- scan
2006 Jan 19
1
Model Validation & Floating Attributes
Hello all !
I have a model being validated that spits it''s error messages on the
resulting page using:
error_messages_for(:mymodel) .... Basic stuff. It''s working perfectly.
Now, I have something else I want to check on the same page (that isn''t an
attribute to the Model)... and am trying to add it using:
@mymodel.errors.add_to_base("another error here")
2005 Dec 29
0
strange output in http header
Hi there,
I''m experiencing something strange in rails http headers. The response
comes back as text/plain. The http header looks like this:
HTTP/1.1 200 OK
Date: Thu, 29 Dec 2005 15:18:18 GMT
Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16 mod_ruby/1.2.4
Ruby/1.8.4(2005-10-29)
#<#<Class: 0x40a7f818>:0x40a7f778>Content-Type: text/html
Cache-Control: no-cache
2006 Jul 25
1
Node Attributes
So I am designing a railsapp that indexes school organizations such as
clubs and frats/sororities. I have decided to represent this as a graph,
and that each entity is going to be just represented as a node, and the
relationship between each node is going to be an edge.
so basically, a frat such as "Alpha Beta Gamma" is represented as a
node, and its chapters also as seperate nodes,
2007 Jun 20
1
Count_by_content ??
Is there a count_by_content alternative to the find_by_content action?
This is because I''m wanting to do the following in my pagination method:
def list
# step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing a find, just get a count
item_count =
2008 Apr 26
0
moving pagination code to model
Hi
I have the controller code as below
# step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing the full find, just find the
record count
@search_sd_ticket_count_result =
2008 May 19
0
changed to will_paginate
Hi
Till now we used the rails pagination.But now onwards shifting to
will_paginate
The code I use currently is as below .This is with the help of
find_where pluggin..A fantastic pluggin which we still want to use...I
would like to know how can i modify the following code to work with
will_paginate
step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
2008 Mar 06
1
pagination for an object array
def show_details
@sd_ticket = ServiceDeskTicket.find(params[:id])
@servicedesk_cis = @sd_ticket.service_desk_cis
end
What I need is a pagination for @servicedesk_cis using the custom
pagination..How can i give offset and limit to this?
I have successfully done previously custom pagination in another def as
below
def search_sd_ticket
@search_sd_ui_hash=params[:sd_ticket]
2006 Jan 06
0
date_select and sessions
i am using date_select to allow someone to select their birthdate in a
form. however date_select uses 3 wierd labels in the forms like
follows:
<select name="user[birthdate(1i)]">
<option value="1940">1940</option>
<option value="1941">1941</option>
.
and then the month is user[birthdate(2i)] and so on. My issue is i
dont know the