similar to: How to DRY with Fixtures (helper or extend Time class, how)?

Displaying 20 results from an estimated 6000 matches similar to: "How to DRY with Fixtures (helper or extend Time class, how)?"

2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on this, I think it''s time to ask the list. Postgres stores a Date in YYYY-MM-DD format. My users want the dates in MM/DD/YYYY format. Sure, I could explicitly convert it on the app level every place where a date is displayed, but that seemed like a DRY violation. I thought I''d be clever and simply
2006 Jun 14
5
display formatted date
Hi, In my form I have date field set as ''datetime_select'' which is fine as I wanted it in the same format. But while displaying (list action) it displays date in long format i.e. ''Tue May 30 15:39:00 Central Daylight Time 2006''. How can I format it so that it will just be diaplyed as ''dd/mm/yyyy'' format? Thanks -- Posted via
2006 Jul 17
2
european date format
hi, overhere users go nuts if they have to enter the date in iso format, so i have to make my applications in such a way that not only dates are displayed in the "dd-mm-yyy" format but also can be entered in that way. somewhere i found this code to put in the environment script: ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update( :default => ''%d/%m/%Y
2006 Mar 23
5
Custom date format
Hi, I''ve followed these directions : http://railswiki.pdxruby.org/HowToDefineYourOwnDateFormat.html It seems pretty straightforward but obviously it doesn''t work for me... article.date_edited.to_formatted_s(:my_format_1) produce a default formatted date, not the one I''ve defined in environment.rb : ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
2006 May 21
5
model methods
Hello everyone, In my model, I have def leave_at_formatted leave_at.strftime("%I:%M %p") end I was wondering if there were any way to define to_s for leave_at in order to get the same result? Thanks!
2006 Apr 04
11
Date/Time format and syntax
Hi, Just wondering how I get both the current date and time to display here (so far I can only get the date OR the time): @tblregisteredphone.txtregisterdatetime = Date.today Also, how can I change the format of the date and time from: Tue Apr 04 00:00:00 GMT Daylight Time 2006 to 2006-04-04 12:04:00 ?? I''m sure it''s very simple, I just don''t know how
2009 Jun 15
1
calendardateselect problem
I am using http://code.google.com/p/calendardateselect/ for my date time picker. I am using dd.mm.yyyy format (:finnish) and i am using ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge! (:default => "%d.%m.%Y") ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge! (:default => "%d.%m.%Y %H:%M") in my enviroment. Everything is working
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
2010 Aug 13
4
Rails and Oracle - can select date but cannot save
I''m seeing a behavior in Rails that I find very strange. Having worked quite a bit with Oracle with other languages I would always dutifully do ALTER SESSION SET NLS_DATE_FORMAT = <my_date_format> and ensure I use that date format in my application. With Rails I still have not figured out how to execute an ALTER SESSION statement after connecting to the database (I''m using
2012 Mar 22
1
Rspec not loading fixtures
I am taking over a code base and am trying to run the tests. I am somewhat new to RSpec so this might be a trivial problem. Basically I can tell that the fixtures are not getting loaded. All 100 tests fail with a similar error. But I don''t know why. Below is the code, with my narrative with *** before it... Can you see anything or give me a clue where to look. So far I am coming up
2006 Jan 23
3
date.to_s trimming
When I convert a datetime to a string, it prints out something like this Jan 20 12:00:00 EST 2006 I want to trim off the last twelve characters, i.e. :00 EST 2006 I tried to do it like so: @date = @meeting.date.to_s.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp.chomp but the chomps seem to do nothing. I''d love to use regex, but I don''t know which
2006 Mar 20
2
Testing Models And Fixtures
I have finally decided to look into testing and I am going through the examples in the AWDWR book and I tried the following and it does not work... even though I don''t see why it shouldn''t. =========== posts.yml =========== basic_post: id: 1 title: Title body: Body created_at: 2006-02-01 00:00:00 updated_at: 2006_02-02 00:00:00
2006 Jan 09
5
Formatting timestamp objects
I want to print my timestamp objects in a specific format. I want to print a date like this: Sunday, January 8 2006 I don''t want it to print January 08. For the time, I want it to look like this: 9:08 pm Not 09:08 and lower case PM. I created these methods: def format_date(date) date.strftime("%A, %B #{date.day} #{date.year}") end def format_time(date) if
2008 Jul 25
3
[LLVMdev] Analysis Passes
Devang Patel wrote: > On Jul 25, 2008, at 12:58 PM, Marc de Kruijf wrote: > > I'd like to write a pass that does both: implements a code transformation and saves information that can be accessed by subsequent passes. > > Ideally, we want to use two separate pass. However, it is quiet possible that your requirement is unique. Would it be possible to provide more info. on what
2006 Jan 28
3
DRY conflict with "Updated at" "Created at" "Deleted at" in view
Hi all, Are there any helpers or so for listview routines that suppres the three above mentioned columns? I''m currently exploring something like the code below. But it feels like I''m doing Rails'' work. # just for test purposes <div id="debug"> <% for col in Product.columns.map %> <%= col.name %> - <%= col.type %><br/> <%
2010 Dec 13
9
created_at, updated_at and MSSQL
Hello, I am running into a little issue. There is a considerable time difference between the time that the console is giving me and the time I am seeing in the created_at and updated_at column in the DB. The difference is about 5 hours. I don''t think the problem is in the DB, but I could be wrong. Am I missing something obvious? Any clues? -- You received this message because you are
2015 Oct 08
2
Pool allocator + safecode
Thanks for the fast response John. On Thu, Oct 1, 2015, at 04:51 PM, John Criswell wrote: > Dear Ed, > > First, someone has updated the DSA code in the poolalloc project to LLVM > 3.7, and a Master's student worked for me over the summer to update a > large chunk of SAFECode to LLVM 3.7. However, the update to LLVM 3.7 > isn't finished (we need to finish integrating
2006 Oct 09
1
error running 'ruby script/console' => "uninitialized constant RAILS_ROOT" ??
Hi, Anyone suggest why when I try to run the console via ''ruby script/console'' I get the following "uninitialized constant RAILS_ROOT" ?? Error: ================================ V:\Source\testapp>ruby script\console Loading development environment. ./script/../config/../config/environment.rb:3:NameError: uninitialized constant RAILS_ROOT
2007 Oct 21
13
[ANN/RFC] Rathole, a fixtures extension plugin
Like lots of other folks, I''ve been searching for a way to scratch my fixture itches. Rathole is my extraction of a few techniques we''ve successfully applied at my day job. We''ve been using Rathole for a month or so now, but I''d really like some feedback from a wider audience. Rathole tackles: * Conflicting PK''s (no more id''s in fixture
2015 Oct 09
2
llvm-dev Digest, Vol 136, Issue 22
(Note to self: learn to scan the full digest for later messages in a thread before replying to an earlier message.) Ed, Your reply to John answered some of my questions, but not all, and raised a new one: > Maybe I should have been a bit clearer; we're really interested in full > memory and type safety. We want to harden the system against memory > corruption vulnerabilities.