Displaying 20 results from an estimated 23 matches for "time_ago_in_word".
Did you mean:
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 |
" + "</li>"
Is there...
2008 Apr 04
0
Date.to_s format with time_ago_in_words
...st''s instructions (http://railspikes.com/tags/date) I''m
trying to define a Date format like this:
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.update(:date_ago
=> lambda { |date| date.strftime(''%a, %d %b, %I:%M%p'') + '' ('' +
time_ago_in_words(date) + '')'' } )
But it keeps giving this error message:
undefined method ''time_ago_in_words'' for main:Object
It works if I do it as a application helper:
# application_helper.rb
def fecha_completa(date)
date.strftime(''%a, %d %b, %I:%M%p'')...
2008 Oct 11
1
Re: time_ago_in_words is off by a day
...m just missing something silly.
> I have a Task model that has a due_date. In my migration it''s set to
> a date:
>
> t.date :due_date
>
> I want to display both the actual date and a friendly format in the
> application, so in my view I have:
>
> <p><%= time_ago_in_words(@task.due_date) %> (<%=
> @task.due_date.to_s(:long) %>)</p>
>
> I have a sample task that has a due date set to October 12th, and
> @task.due_date.to_s(:long) confirms this. However, time_ago_in_words
> says that it''s "1 day", when today is the 10...
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 minutes" or "0 hours" instead of "less than...
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...
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) -%>
I get an error :wrong number of arguments (0 for 1)
trace
app/helpers/application_helper.r...
2007 Jan 13
6
nice date function
Hi:
you know the way the google and this forum presents dates? How it''s
measure from the current date/time and presents nicely as "39 minutes
ago", 2 days ago, etc.? Has anyone done a gem or other library object
that I can get to do those types of dates?
Thanks so much in advance!
Mike
--
Posted via http://www.ruby-forum.com/.
2006 Aug 01
2
Date length in english plugin/built in?
Is there a plugin or built in function for converting a date interval
into the English equivalent? For example, "So and so posted this 45
minutes ago".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060801/e33b04d1/attachment.html
2012 Oct 31
5
css background not showing
...39;).hover (event) ->
$(this).toggleClass("hover")
and my index is
<% @posts.each do |post| %>
<div class="post">
<strong><%= post.title %></strong>
<p><%= post.content %></p>
<div class="meta">
<%= link_to time_ago_in_words(post.created_at) + " ago", post %>
<span class="admin">
| <%= link_to "Edit", edit_post_path(post) %> |
<%= link_to "Delete", post, :confirm => "Are you sure you want to delete
this post?", :method => :delete %> |
</s...
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
...t;
<%= comment.title -%>
</div>
<div class="comment.text">
<%= h comment.comment -%>
</div>
<div class="comment_author">
<%= comment.user.fullname -%> <%=
time_ago_in_words(comment.created_at) -%> ago
</div>
<hr>
</div>
As you can see, the comments partial calls comment.user.fullname, which
is defined in the UserModel:
class User < ActiveRecord::Base
has_many :documents
has_many :events
has_many :news
has_many :comme...
2006 Jul 20
1
Outputting date as "1 day ago" or "53 minutes ago"
When printing out the results of my "updated_at" field, I''d like to be
able to print it as "Updated 5 days ago" instead of "Updated on
7/14/06."
I''ve seen many blogs do this, is there an easy way to do it through
rails / ruby?
--
Posted via http://www.ruby-forum.com/.
2006 Jan 26
0
Noob: format column in scaffold (i.e. - datetime)
This is my first RoR project so go easy. It''s a simple directory with
contacts. I have two datetime columns in my database (created_at and
updated_at). In the list view (changed very little from default
generated by scaffold) I want them to display as time_ago_in_words or
:long or :short (not sure yet). The default just takes up too much
space. In the show view this is fine and even preferred. I can''t figure
out how to change this before I render the list view. Presumably this
would be done in my directory controller, but I''m not sure and...
2005 Oct 01
0
How to customize build-in messages into i18n?
Hi Railer,
I''m developing a multilingual website by rails.
I choose ri18n to customize i18n messages.
However, for messages which are generated from build-in methods, such as
ActiveRecord validation error message, time_ago_in_words() ...
Any suggestion how to make these build-in message multilingual?
Thanks.
Gary
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
2010 Jan 05
0
Problem with associating comments with blog posts on same page
...very easy page to
navigate I can''t use the same code associations and my comments fail.
app/views/posts/index.html.erb
<% div_for( post ) do %>
<h3><%= link_to_unless_current h(post.title), statemant %></h3>
<p class="timestamp">
Posted <%=h time_ago_in_words(post.created_at) %> ago
</p>
<p>
Approved: <%= h(post.approved) %>
</p>
<p class="post_post">
<%= simple_format h(post.body) %>
</p>
<% randomNumber = rand(100000) %>
<img src="/images/add_comment.jpg" class="add_...
2010 Oct 11
5
Object lost in memory/trashed?
...gt; cycle("odd", "even")}
= render :partial => "/comments/comment_content", :locals => {
:comment => comment}
## _comment_bookmark.html.haml
= image_tag "/images/iLight/icon.png"
== #{bookmark.user.display_name} lit this diagram
<small>(#{time_ago_in_words bookmark.created_at} ago)</small>
The problem happens in this last file, when calling
bookmark.user.display_name. It raises a Template error:
ActionView::TemplateError (You have a nil object when you didn''t expect
it!
You might have expected an instance of Array.
The error occurred...
2012 Jul 19
6
Rendering Partial
I am a bit confused when coming from layout and partials.
To start of I have a file called application.html.erb which has my
layout such has follow
<html>
<head>
<body>
<%= render ''layouts/footer'' %>
</body
</html>
This call a new file _footer.html.erb
This file his has follow
<footer class="footer">
<nav>
<%=
2006 Jul 14
5
Newbie Formating output
Hi, am a rails newbie. I had problems with 2 tasks
i have created a guestbook app just to try out rails
users sign guestbook by leaving name and message
currently, the list action shows plain text like this:
Joe Smith
love your guestbook
but i would like to add formating to the name field, say different
colour, bold, and add time eg:
Joe Smith (in red colour) wrote 5 days ago
love your
2007 Jul 19
7
NoMethodError in partial driving me mad
...ategory.title %></
h1>
<p>
<%= bbcodeize news.content %>
</p>
<p>
<span class="author">
erstellt von <%=link_to news.user.login, :controller =>
"user", :action => "show", :id => news.user.id %>
vor <%= time_ago_in_words news.created_at %>.
<%= "zuletzt geƤndert vor " + time_ago_in_words(news.updated_at)
unless news.updated_at.nil? %></span>
</p>
</div>
ERROR:
-------------------
NoMethodError in News#show_category
Showing app/views/news/_news.rhtml where line #2 raised:...
2011 Dec 16
3
PROBLEN IN AJAX USING RJS
...page.insert_html :bottom, :comment, :partial => ''comment'', :object
=> @comment
page[:comment_comment].reset
page.replace_html :notice, flash[:notice]
_comment.html.erb
-------------------
<%= comment.user.email %>
<%= comment.comment %>
<%= time_ago_in_words(comment.created_at) %> ago
so problem is when I submit the form entry is made in database but
view article page not show any change and whe i refresh the page then
change is seen.
please do the needful.
Thanks.
--
You received this message because you are subscribed to the Google Groups &qu...
2011 Nov 12
4
No route matches [GET] "/microposts/304"
...#top) but I got no
route matches when I try to delete one micropost.
the _micropost html is...
<tr>
<td class="micropost">
<span class="content"><%= micropost.content %></span>
<span class="timestamp">
Posted <%= time_ago_in_words(micropost.created_at) %> ago.
</span>
</td>
<% if current_user?(micropost.user) %>
<td>
<%= link_to "delete", micropost, :method => :delete,
:confirm => "You sure?",
:title => m...