Displaying 20 results from an estimated 1000 matches similar to: "formatted date down-counter - help!"
2006 Jun 18
2
convert timespan to verbose description
Hi,
I always see RoR pages showing the elapsed time like that
''Published 3 days, 23 hour and 5 minutes ago''
''Published less than 3 minutes ago''
I guess this conversion can be done using a Rails function, however I
can''t find it.
Does somebody know its name??
Thanks a lot
Peter
2008 Feb 03
4
Testing helper/view methods from script/console
Hi,
Is it possible to test helper/view methods from script/console. I want
to test the output of methods like distance_of_time_in_words. But it
won''t let me from the console. What am I missing?
TIA
Luke
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on
2013 Jan 02
4
distance_of_time_in_words_to_now
Hi There,
As I have learned the hard way, let me discuss my question, idea or feature
here before doing actual work on it...
distance_of_time_in_words_to_now() seems to be unable to tell if this
distance is in the future or in the past.
I''d really like to see ''in 5 days'' or ''5 days ago'' depending on, well, if
it was 5 days ago or will be in 5
2006 Mar 30
4
Simple Ruby/Rails question, doing posted hours ago
I am not the Ruby aficionado yet, if I have created_on ...timestamp.
What is a ruby way of getting the hours/minutes/seconds ago. is there
some class that has this implemented.
For example:
Posted on 3/28/2006
Show a time with:
posted: 1 day ago
... something along those lines.
--
Berlin Brown
(ramaza3 on freenode)
http://www.newspiritcompany.com
also checkout alpha version of botverse:
2007 Jul 31
11
helper spec not finding rails core helpers
Hi,
My helper specs were going ok until I added a call to a rails
DateHelper method in one of my helpers
http://api.rubyonrails.com/classes/ActionView/Helpers/
DateHelper.html#M000574
The helper runs fine from my view templates, just dies in the spec test.
I boiled my question down to a simple (not too useful) example. I''m
not sure what I''m missing.
#
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 Apr 22
1
Newbie question about using helpers in controllers
I''m trying to display a list of pages in xml. I want to change
page.update_at to distance_of_time_in_words_to_now. However whenever I
run it I get an error saying:
undefined method `distance_of_time_in_words_to_now''
I know I can just go the rails api and copy the source, but there must
be another way.
def list
@page = Page.find(:all, :order => "updated_at desc")
2011 Nov 02
4
undefined method `updated_at' for #<Classified:0x686c5e4>
HEllo, I have the following problem with rails, I am new in this...is
there anyone who explain to me what´s happens?
Thanks
See below:
NoMethodError in Classified#show
Showing app/views/classified/show.rhtml where line #17 raised:
undefined method `updated_at'' for #<Classified:0x686c5e4>
Extracted source (around line #17):
14:
15: <strong>Date Posted:</strong>
2006 Jan 27
2
distance_of_time_in_words_to_now
any idea how to use distance_of_time_in_words_to_now?
--
Posted via http://www.ruby-forum.com/.
2010 Sep 07
2
Help on formatting some HAML
I wondered if anyone could help me with turning the following in ERB
into HAML. I''m VERY new with HAML:
----
<div class="block-element span-7 colborder">
<span class="rightside blue-hue no_decor"><%= link_to "New Order",
new_order_path, :remote => true %></span>
<h3>Today''s Activity</h3>
<hr>
2005 Dec 27
3
created_on & updated_on - helper to display date only
All,
My initial list is rather busy. I would like to shorten the
created_on and updated_on fields to just display the date, not the
time. Best wold be a simple 12/28/05 type of presentation.
I''ve found the format helpers in rdoc. (ie.
distance_of_time_in_words_to_now ), but none seem to be what I''m
looking for.
How do I control the date format of a timestamp field?
Thanks
2006 Jul 07
3
calculate number of months difference between two dates
hi,
Is there an easy way of calculating the difference in months between two
dates in a controller.
thanks
--
Posted via http://www.ruby-forum.com/.
2006 Feb 01
1
distance_of_time_in_words_to_now with "ago" suffix
I wanted the distance_of_time_in_words_to_now method to have '' ago''
suffixed to it when the date is in the past, I assumed this would be the
default behaviour but apparently not. I know of a REALLY messy way that
i could solve this with, but it''s so ugly I can''t be bothered
Does anybody have an easy, elegant solution?
2006 Aug 15
4
Cookies and Ruby???
When someone comments on my site, I would like to store the user''s name
as a cookie, and display it the next time they return. I really don''t
know how to do this. Does this use the cgi library? As most things
with ruby, I would imagine it to be quite simple... could anyone post a
code snippet as to how this would work??? Thanks...
--
Posted via
2006 Mar 29
2
distance_of_time_in_words and Time classes
There is <%= distance_of_time_in_words(Time.now, @a_time) %> before
xzy.<BR />
<!-- ^ this gives 2279 days -->
This does not work because when @a_time is stored, even though it is a
Time field and the class is Time, it includes a date. The Date isn''t
even that days date its the year 2000, hence the 2279 days ago.
So how do I set the date part of @a_time (a Time
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 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 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
2008 Aug 30
3
Working with sessions in beast forum
Hey,
I''m designing an app which displays the events near a user in RoR. I''m
using the beat forum to facilitate user management/sessions/etc. I''ve
edited the sessions table in the Beast database to contain a
"session_location" value and what I''d like to do is to set this to the
users location when they log in. This would allow them to change their
2008 May 27
0
How to find Date and Time difference in controller?
Hi,
I need a method similar to "distance_of_time_in_words_to_now" to be used
in the controller.
"distance_of_time_in_words_to_now" methods work only in view.
Thanks,
Ratnavel.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: