Displaying 20 results from an estimated 400 matches similar to: "Date.to_s format with time_ago_in_words"
2006 Aug 17
4
using time_ago_in_words() in a controller?
I''m getting this error when I try to update a list using ajax after
submitting some data:
undefined method `time_ago_in_words'' for #<IdeaController:0x3a38ae8>
the LOC is this:
render_text "<li>" + @params[:idea][:title] + "<br />by " +
@params[:idea][:author] + " | " & time_ago_in_words(Time.now) & " ago |
" +
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
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
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
2007 Nov 02
0
DATE_FORMATS and functional tests
I have the following in my environments.rb file:
my_formats = { :msc => ''%d %b %Y %I:%M %p'', :msc_short => ''%d %b %Y'' }
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!
(my_formats)
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!
(my_formats)
With this, things like
2006 Sep 12
1
Less verbose than time_ago_in_words method?
I''m trying to keep a Last Modified column in my record lists a fixed
width and as narrow as possible.
<td><%=time_ago_in_words record.updated_at%></td>
However, making room for certain values like "less than a minute" force
me to make the column twice as wide than, say, "12 hours" or "10 days".
I would prefer "0
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 04
2
Building a FAQ
I''m new in Rails, and I''m building my first application. I''m trying to make
a FAQ for this application, organized by product (questions about each
product) and category (questions of different categories or topics), and
there is something I can''t figure it out how to do.
I have these tables:
create_table "faqs" do |t|
t.column "question",
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
2006 May 10
2
Rails, Postgres and the Date Field.
Hi guys,
I''m having problems with my app. First of all, I created a date_select
with the code:
<%= date_select(''contact'', ''birthday'', :order => [''day'',''month'',''year'']) %>
In the contacts table, I create a date field:
birthday DATE
When I save the values goes wrong into the database.
2006 Jan 24
0
to_formatted_s(:rfc822) doesn''t work
I do ''@item.datetime.to_formatted_s(:rfc822)'' and it
outputs:
2003-08-06T04:12:00-0600
'':db'' doesn''t work either, but '':short'' does. How can
I output rfc822 without actually putting all that
awful % code in my templates? I''ve also tried this in
environment.rb, but it still doesn''t work:
2009 Mar 22
0
DhtmlCalendarHelper
Hi RoR community,
for my webapp I need the german date format.
To display the german date format like 31.12.2009, I implemented in the
environment.rb following:
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
:default => '' %d.%m.%Y ''
)
If I use the DhtmlCalendarHelper "calendar_field" the date in edit-mode
is diplayed in german
2006 Apr 13
5
Changing class data in environmrnt.rb
Greetings,
I have a class that should allow you define some default values. It
seems to make the most sense to do this environment.rb since its the
default app configuration. It currently looks like this:
Settings::DEFAULT_VALUES.merge!({
:setting_one => ''foo'',
:settings_two => ''bar''
})
The problem is in development mode, the values are only
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 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 May 05
1
Configuration Generator
Where is this ConfigurationGenerator that is posted in the Rails wiki
(http://wiki.rubyonrails.com/rails/pages/ConfigurationGenerator)?
I''ve been searching around and I can?t find a way to use it.
Jes?s.-
--
Posted via http://www.ruby-forum.com/.
2010 Apr 09
9
gem install rails (Errno::ENOENT) No such file or directory
I have two PCs, one with Windows XP and another with Windows Vista. I''m
working as an administrator in both computers. I''m using Ruby 1.8.7 and
Rubygems 1.3.6. When I try to install Rails I get this error:
C:\>gem install rails
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - C:/Users/Jesús Dugarte
I have installed Rails several times before
2008 May 20
2
DateHelpers .. don' display.. ?
HI
I don''t understand what happen ..
if I use the script/console :
>> include ActionView::Helpers::DateHelper
=> Object
>> include GLoc
=> Object
>> time_ago_in_words(Time.now, include_seconds = false)
=> "moins d''une minute"
I get the correct answer..
but I I write in my view
<%= time_ago_in_words(Time.now, include_seconds = false)
2006 Sep 28
1
[Newbie] Trying to use Inflections in a non active record class
Hi
Sorry if this is too silly to ask. I did RTFM and didn''t find anything
obvious.
I have a helper class for my controller which needs to singularize
words. I need to access methods in the
ActiveSupport/CoreExtensions/String/Inflections class. Doing a require
''ActiveSupport/CoreExtensions/String/Inflections'' fails.
How do I add this specific class to a helper class
2008 Jul 23
1
how to get day name using ActiveSupport libraries
Is there any way to get the name of the day (i.e. mon, tue...) using
the ActiveSupport libraries. I looked through these two libraries but
can''t seem to find it:
http://api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Numeric/Time.html#M000421
http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Calculations.html#M000308