similar to: Date formatting error

Displaying 20 results from an estimated 7000 matches similar to: "Date formatting error"

2006 Jun 24
2
:limit => Parent / Child Relationship
Hi all, I trying to find the best way to do the following and I''ll use a blog with comments for an example. Blog has many comments Comments belongs to blog My question is how to limit the number of comments (child) records read for each blog (parent) record. Most of the solutions I''ve come up with are limiting the number of records displayed within the views but the
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 Feb 14
10
acts_as_versioned and getting authors
Hey guys and gals, I have the following object that has acts_as_versioned: class Note < ActiveRecord::Base acts_as_versioned belongs_to :user end The schema for my notes table is as follows: create_table :notes, :force => true do |t| t.column :id, :integer t.column :noteshare_id, :integer t.column :user_id, :integer t.column :title, :string
2006 Jan 07
1
How to DRY with Fixtures (helper or extend Time class, how)?
I have a test/fixtures/users.yml like so: apa: id: 1 username: apa [...] created_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> updated_at: <%=Time.now.strftime("%Y-%m-%d %H:%M:%S")%> I don''t like how I''m repeating myself with the strftime bit. Is there some shorter Time method to format time for a (MySQL) datetime field that
2006 Jul 12
5
Reverse sorting
I am getting strange results when I reverse sort a query. I am sorting by date, but it doesn''t seem to be related to dates (I have tried just integers). I also paginate the results. Items in the result set are sometimes duplicated and the not ordered at all. When I try a non-reverse sort I don''t see duplicates and the ordering is correct. Any ideas what is going on? Thanks
2006 Mar 16
4
SOMEONE HAS TO KNOW HOW TO DO THIS
I''ve got my site posting comments with ajax, but I can''t seem to handle the callback correctly. Do I just put what I want returned in the "comments.rhtml" file? I''ve been trying to do this, but am having no luck. If I have the parameters for the comments, I should be able to single them out, but I''m not sure how to do it. This is what I mean:
2012 Jun 30
5
Problems with associations
Hello guys, I have two tables, tasks and projects, and each model I put: Task.rb class Task < ActiveRecord::Base attr_accessible :user_id, :project_id, :name belongs_to :project end Project.rb class Project < ActiveRecord::Base attr_accessible :name, :description has_many :tasks end But when I go to my prompt and I make a SELECT with task, none project is returned.
2006 Jan 20
47
SQL Server datetime error
i have a problem with the datetime format of rails. i am unable to save a dataset to the db. here''s the error message -- the original error message was in german, so i translated it -- i get: DBI::DatabaseError: Execute OLE error code:80040E07 in Microsoft OLE DB Provider for SQL Server Couldn''t convert a char-Datatype to datetime HRESULT error code:0x80020009
2010 Mar 04
25
how to share variables in data migrations (up/down)
hi there, How do we share variables in a given data migration? For example, the code below fails to work because "statuses" don''t seem to be in scope for both up and down. class AddDefaultValuesToStatuses < ActiveRecord::Migration statuses = [ { ''details'' => ''details'', }, {
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
2009 Nov 11
4
Schema dump does not reflect column size limit
Hi, Everything is in the title. With Rails 2.3.4 and MySQL 5.0.41: If have a table like this: +----------------+------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL |
2006 Mar 17
1
RSS problem when trying to display ID - HELP
I want to append "#comment-1" or whatever, depending on the id to the end of my xml.link(" ... /#comment-1") attribute in my generated xml. Well, when I put: xml.link(" ... /#comment-" + comment.id) I get an Application error (rails) message when I look at the generated XML. This is what I''m doing without the id on the comments (its working fine):
2006 Jul 14
1
Converting Date string to Time Object
Hi, I have MySQL model with created_on specified as :date. This means that the day the record was created on is stored in the database as a string like "2006-04-28". I want to be able output a something like "5 days ago". From looking in the API I''ve found "strftime" and "*distance_of_time_in_words*". Distance_of_time_in_words only accepts Time
2006 Aug 02
2
mangle ActiveRecord
Dear Gurus on Rails! How do I change the behaviour of one method in ActiveRecord::ConnectionAdapters::SchemaStatements ? Full story: I''d like to mangle ActiveRecord::ConnectionAdapters::SchemaStatements so when it creates a new sql table, it also (optionally) creates my created_at, deleted, key_id, session_id etc columns that I use on basically all tables. It would not be DRY to repeat
2006 Sep 09
13
best way to add "created_by" entries to all tables???
Hi, I want to automate somewhat the addition of created_by/updated_by fields on my models (i.e. to include username). What''s the best/recommended way to do this? Would it be to: a) Find out how to extend the ActiveRecord::Base itself (I haven''t extended a class before yet) b) Use a plugin type approach where you have to add a tag manually to each model file which then
2008 May 06
10
Best way to implement?
So I''m new to all this Rails stuff and this is probably a database design-related question to, but here it is... Just for learning I''m trying to build a little real estate listings application. Of course there is the listings model which will store basic information like name, price, description, and all that jazz. I''m to the point where I want to figure out how to
2006 May 24
1
Automagic number of views/clicks?
Hey, Just wondering.. Are there are any automagic constructs in rails for keeping track of number of views/clicks associated with the record? For example, created_at and updated_at are automagically updated on edit/new actions, are there any similar constructs for clicks/views of the record? Thanks. Ilya -- Posted via http://www.ruby-forum.com/.
2011 Nov 01
2
Railscast 262 different partial in helper
Hi RoR Community, in Ryan Bates Railscasts Episode #262 he put the index code <% for message in @messages %> <div class="message"> <div class="created_at"><%= message.created_at.strftime("%B %d, %Y") %></div> <div class="content"> <%= message.content %> </div> <div
2010 Apr 07
2
rails timezone difference in console and production application
Hi all, I''m on a rails 2.3.5 app. I''ve got my timezone set to ''Brussels''; config.time_zone = ''Brussels'' When I use mysql I see that a date is stored in UTC (as expected); e.g. 2010-04-07 15:03:10 When I use console to print out the date it correctly returns; >> job.created_at.strftime(''%d %b %Y, %H:%M'') =>
2006 Jan 05
2
how to use a helper which is not inside app/helpers/
Hi, I wish to know it is possible to use a helper which is not inside the folder ''app/helpers'', if it is possbile, what should I do? Thanks you very much!!!! Saiho __________________________________________ Yahoo! DSL ? Something to write home about. Just $16.99/mo. or less. dsl.yahoo.com