similar to: Strange behaviour of dates

Displaying 20 results from an estimated 200 matches similar to: "Strange behaviour of dates"

2005 May 31
2
Form Dates and MultiparameterAssignmentErrors
I''m using the date_select form helper for a date_of_birth field on an ActiveRecord object. When I try to save a date earlier than 1 Jan 1970, ActionController punts with ActiveRecord::MultiparameterAssignmentErrors. The message it gives is "1 error(s) on assignment of multiparameter attributes". I was able to catch the exception and look at it, and it is certainly complaining
2008 Jun 26
2
Problem with date_select after Rails 2.1 upgrade
Folks, I think I should start a new thread for this, because a similar one I saw is a bit old and the resolution there doesn''t seem to apply to what I''m running into now. Anyway, my date_select calls are bombing on me with the exception: ---- ActionView::TemplateError (wrong number of arguments (3 for 2)) on line #8 of entries/_dates_form.haml: 8: = date_select(
2006 Sep 15
1
In datetime_select, :order does not work, but it works for date_select Why
Hi All In my project I am to take date of birth from user so I used datetime_select. It renders three selection boxes, year, month and day. But I want order as day, month and year. I added :order option for datetime_select, it renders normal selection boxes with order year, month and day. Why :order does not work with datetime_select? see my following code <%= datetime_select(:user2,
2007 Apr 14
1
how to add class to date_select helper
Hi, I have this helper and would like to add a html class to each of the select box''s it generates, however I have been unable to find a way? <%= f.date_select ''date_of_birth'', :order => [:day,:month,:year], :start_year => 1940, :end_year => Time.now.year, :include_blank => true %> Any suggestions? thanks john -- Posted via
2006 Jul 15
1
Trouble using date_select with blank options
I want to allow users to enter a day and a month, but not necessarily a year. i.e. it should be optional. If I select the day and month, but a blank year and then submit i get: 1 error(s) on assignment of multiparameter attributes The paramaters regarding the date look like this: {"date_of_birth(2i)"=>"3",
2011 Jan 24
2
Seeing what has changed in ActiveRecord
I have a callback (before_save) that I want to trigger only when certain fields within a record have changed. For example given a user record with ''username'', ''password'' and ''date_of_birth'' I would like the callback to do something only when the ''username'' or ''password'' changes or when the
2006 Jan 04
1
Multiple Associations With The Same Object
I have a Company object which has multiple Contacts (has_many/belongs_to) I would like one of the contacts to be the primary contact. What''s the best way to do this? Right now I have: create table companies ( id int not null auto_increment, name varchar(50) not null, primary_id int null, constraint fk_company_primary_contact foreign key (primary_id) references contacts(id),
2006 May 03
2
Using a helper within another helper?
I am trying to push some view logic into a helper. The thought is that this is a step towards having the business logic in the helper rather than the view. However, I''m essentially wrapping the checks around an eventual call to date_select(). The problem I''m having is that the application complains that it doesn''t know about date_select(). I''m sure (or
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 /
2007 Feb 21
2
date helper bug?
I''ve found an issue when trying to use the time_ago_in_words and distance_of_time_in_words from action view''s date_helper.rb Using SQL Server, I have a datetime column that gets returned as: "2007/02/21 09:54:00". When I pass this to time_ago_in_words (which just passes on to distance_of_time_in_words) it miscalculates the difference as "9 hours" (...um yeah,
2006 Jul 13
3
date_helper megapatch and MultiparameterAssignmentErrors
Hello all, There''s a great patch in trac that fixes a lof of issues with the date helpers. I''m afraid it hasn''t had any attention yet. http://dev.rubyonrails.org/ticket/3811 This fixes all the little date_helper problems, except one: When you choose an invalid date ActiveRecord throws an ActiveRecord::MultiparameterAssignmentErrors. This used to work in 1.0,
2005 Nov 04
0
RE: Why class InstanceTag is defined at 4 different places inRails
In Ruby you can add and modify existing classes at will simply by reopening it. The 4 files you mention add functionalities to the InstanceTag class. This is not a redefinition. The best part is that you can do the same ! An easy way to overwrite an existing method or to add new ones is to create a file under you rails application lib directory and put in it the replacement you want to make:
2005 Mar 12
0
scaffolding issue
i''ve got a little rails app i''m messing with the schema is create table timedatevalidates ( id serial, timedatetovalidate timestamp, primary key (id) ); the mvc was initialized using rails scripts/generate scaffold timedatevalidate i''ve got this in a subdir of webroot and have modified .htaccess and config/routes.rb like so .htaccess :
2005 Dec 01
0
Problem using a date helper
Hi, I''m having trouble getting a date helper working. I was pointed to this by Sean Allen, and it resides at http://theredheadedstepchild.net/articles/2005/08/04/datehelper-fixes It''s meant to fix the bug in Rails which doesn''t allow datetime_select to properly discard the year. So, I''m trying to use the helper''s time_select function. date_helper.rb
2006 Mar 10
14
Oracle Date type errors rails on edit
I have a table with "expires_on" a DATE field. "Show" and "Destroy" work, but "Edit" errors: /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/helpers/date_helper.rb:150:in `select_hour'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/helpers/date_helper.rb:149:in `select_hour'' It only happens when
2006 Dec 18
1
Bad merge of r5686 from trunk to 1.2-pre-release?
I do not closely follow the core source commits, but please bare with me. I will keep it short. Recently, changeset#5685 [1] caught my attention as I''ve been waiting for some date_helper love for a VERY long time. What bothered me is that when this changeset was merged into the 1.2- pre-release branch (at changeset#5686 [2]) a change to caching.rb crept in [3], which was not in
2008 Mar 17
0
Nil dates in selct_date
Can one specify to date_select that a nil value is permitted and is the default value? Is it possible to add nil to the list of permitted values in a date_select call? The code in /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/date_helper.rb seems to treat nil as now. 654 def default_time_from_options(default) 655 case default 656
2006 Jan 23
11
mysql dates
does anyone know of a way to make the date_helper deal with mysql dates with 00 values in them? I have lots of dates that are like the following: 2005-04-00 2005-00-00 and I need to set null values in a date_select for elements that are 00. These are valid dates in mysql. In the absence of an immediate solution to the above, I''ve been trying to find out how InstanceTag.new works so I can
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be working, but.... when i access duration = <%= @enquiry.course_duration %><br> in my final view it''s blank.. course_duration is getting set to null but works for the calculation? controller.. ---------- class EnquiriesController < ApplicationController layout ''welcome''
2005 Dec 18
13
calculate age based on DoB
Hi, I wrote a little helper that calulates someone''s age based on his/her date of birth. def age(dob) diff = Date.today - dob age = (diff / 365.25).floor age.to_s end It works fine, but it''s not completely accurate as it just takes the average days in a year. It should be able to calculate this more accurately, right? I can''t work it out