Displaying 20 results from an estimated 10000 matches similar to: "Date validation :before -1 day"
2006 Mar 10
19
validates_date plugin for ActiveRecord
This plugin gives ActiveRecord the ability to do stricter date checking.
Example:
class Person < ActiveRecord::Base
validates_date :date_of_birth
end
This will ensure that date_of_birth is a *valid* date. The date can be set
initially as a string in any of the following formats:
"2006-01-01"
"1 Jan 06", or "1 Jan 2006"
"1/1/06" # Day /
2011 Feb 04
5
Date parse - month and day reversed
I am getting the month and day reversed in parsing a date. I am wondering if
there is some intelligence in Ruby that knows that at the moment I am in
Mexico, as the parsing is working as if I was
"6/15/2008".to_date
=> ArgumentError: invalid date
"15/6/2008".to_date
=> Sun, 15 Jun 2008
What I really want is my date to be understood as month/day/year. Is there a
way to
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
2005 Aug 04
0
Rails Date/Time Validation and Parsing
I''m kind of getting my brain around Rails''ey things. Dates are an annoyance
no matter what the language, but in keeping with DRY, I''m looking for
something like:
validates_date :between => 4/8/2002..5/29/2009
Or something like that.
Additionally, it seems someone somewhere must have created a wrapper around
strtotime. What I''m looking for is a way to parse
2007 Nov 02
3
Date Issues + Oracle + RoR
Hi Experts
I''ve a product like this
ID -> 1
Name -> Xyz
Price -> 30
Created_at -> 02-NOV-07
from_date = Date.new(2, 10, 07)
to_date = Date.new(2, 10, 07)
@product = Product.find_by_sql("select * from products where
created_at between from_date and to_date")
code works perfectly, buy my issue is i dont get any data. always says
no record found
but if i use
2008 Oct 11
1
Re: time_ago_in_words is off by a day
Look at your 1.day.from_now and see if it''s like this:
Sun, 12 Oct 2008 02:45:42 UTC +00:00
If you also have the "UTC +00:00", it means that you timezone is the
GMT (and I think that it isn''t your real timezone). For example, my
timezone is 3 hours after the GMT, so the right timezone would be
something like this:
Sat Oct 11 23:48:41 -0300 2008
At your
2006 Mar 31
4
Date magic?
Hi.
When I read Dave and Davids excellent book "Agile Web Development with
Rails" the first time, I was particularly impressed with the following
statement:
1.day.from_now
It was used in a test class to set the date of tomorrow dynamically. Since
it was enclosed in in ERb tags, I assumed this was a normal ruby statement,
but when I tried it in my irb, i get the following error:
2006 Mar 25
0
Oracle driver doesn''t support expressions for default date values
I''m working with a legacy Oracle db which has trunc(SYSDATE) and
TO_DATE(''...'',''...'') as default values for some date columns. The oracle
driver craps out with these default values or sets them to the default Jan
1, 2000 date.
The culprit appears to be the cast_to_time method in oracle_adapter.rb.
Any pointers on how to change the driver to
2006 Jul 06
6
Help with overriding / overwriting date values in ActiveRecord to accept Euro Style Date from a Textbox
Hi guys,
I''m trying to make an AR model which accepts a string data (from a
text input) in euro date format
eg
<input .... value = "23/01/2006"> ( 23 Jan 2006)
Reading the example from RDoc... i tried to
overwrite/overload/override the = function to write in the date..
Cant get it to work because .. i dont knoe what format should it
accept.. i''ve tried
2013 Jan 29
2
Count entries in postgresql grouped by date
Hi!
I have a table with visits with a visited_at: attribute which is a datetime
field. They seem to be stored as UTC. Now I want to count all visits each
day and return something like:
{
2013-01-01: 8,
2013-01-02: 4,
2013-01-07: 9,
...
}
So, I did it like this which kind of works...:
def self.total_grouped_by_day(start_date, end_date)
visits = where(visited_at:
2006 Apr 09
6
Validating a DateTime
Hi,
Does anyone know of a method to validate a DateTime field?
I''ve looked at the validation docs and the validates_date /
validates_time plug-in but I can''t find a method to validate a value in
the format of yyyymmddhhmm. It seems like something that should exist
already, so I''d just like to check before I attempt my own version...
Cheers,
Mark
2009 Feb 04
4
Rails 2.2.2 to_date and to_datetime methods
In the console I see this behaviour:
>> "19270412000000".to_date.methods
=> ["ns?", "mon", "ago", "end_of_month", "months_since",
"default_inspect", "minus_without_duration", ...
>> "19270412000000".to_date.class
=> Date
>> "19270412000000".class
=> String
>>
2009 Dec 14
1
AGI with PHP
Hi All,
I'm having problems getting results from a PHP file. This is what the CLI is showing.
-- Executing [111 at internal:1] AGI("Console/dsp", "GoTalk.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/GoTalk.php
[Dec 14 11:57:25] ERROR[20260]: utils.c:1019 ast_carefulwrite: write() returned error: Broken pipe
If I run the PHP file from
2004 Mar 10
2
Inserting Date Field into Oracle table using ROracle
Hello,
Attached is a mail regarding question how to insert Date field using ROracle
package. I am stuck with this problem and appreciate receiving help from
gurus on this list.
Code used mainly is:
library(ROracle) ### --- Version 0.53
drv <- dbDriver("Oracle")
con <- dbConnect( drv, "user/passwd")
d <- data.frame(CDATE = "2004-03-10 10:12:00")
ps
2006 Feb 24
1
RailsCron: Trigger one time
Hi Kyle,
Thanks for your help so far. Now that I have it up and running, I''ve some
behavior questions.
I want to trigger an event just one time at a future time. I''m using some of
your sample code to try this, but the behavior of some combinations of start,
every, and finish behave in some unpredictable ways.
3 class RailsMaintainer
4 include ActsAsBackground
2009 Feb 22
6
CHECK if param exists? please help
hi folks.
i want to check if a param exists if not to set it to a default value
for my date range filter. in my controller i have:
@from_date = Date.strptime(params[:startdate],"%d/%m/%Y")
@to_date = Date.strptime(params[:enddate],"%d/%m/%Y")
@articles = @results.find(:all,
:conditions => [ "created_at >= ? and
created_at
2006 Feb 23
1
RailsCron: ''every'' in background
Got another question. It''s unclear to me what "every" means in the background
function and how it relates to the RailsCron.create "every":
>From README:
RailsCron.create(
:command => "Object.do_something()",
:start => 2.minutes.from_now,
:every => 12.hours, # default: 1.day
:finish =>
2007 Aug 12
4
Date and Time validator, updater
Can someone point me to a date/time validator or updater.
I have an event start datetime and an event end datetime. I want
to validate that the end datetime is after the start datetime.
Figure there is some code or library out there already, if you
know one, please forward it.
Thank you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2006 Dec 01
2
Mongrel 0.3.18, rails 1.1.6 and cookies
I''ve run into an issue with my rails application being unable to
properly set cookies on Mongrel 0.3.18. If I run the simplified code
below in Mongrel 3.14.4, both cookies are properly sent to and saved
by the browser. With the same code in 0.3.18, only the auth_token
cookie is created (if I switch them, only the userid as it will only
properly create the first cookie in the list.)
2008 Apr 11
7
Net::SMTPAuthenticationError
Hey guys,
I want to send an email via ROR and I have put this code at the very end
in the config/environment.rb file-
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.logger = nil
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
:address => "[my smtp server]",
:port => 25,
:domain