similar to: date helper bug?

Displaying 20 results from an estimated 600 matches similar to: "date helper bug?"

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 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 May 24
0
distance_of_time_in_german_words
Hiall, This could be useful for those of you producing websites in the german language. Basically I copied the definition of the rails builtin distance_of_time_in_words and extracted another method german_words_for_distance_in_seconds. Just put these e.g. into module ApplicationHelper and you can use it in all views. def distance_of_time_in_german_words(from_time, to_time = 0, include_seconds
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
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 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 | " +
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
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 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. #
2011 May 23
4
Distance of time in days
In rails 3 there is distance_of_time_in_words which works fine, but I would like to tweak its output a bit. The thing is that if the dates are exactly the same it will say "Less Than a Minute" I would like it to show "Today" instead. Is that possible? Tiago Veloso ti.veloso-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- You received this message because you are subscribed to
2006 Apr 26
5
accessing created_on causes type error
I assume that this is some newbie stupidity, but I haven''t found my way around this problem. I have an ActiveRecord object fetched from the database, and I need to evaluate the contents of the updated_on field. However, *any* attempt to access that data in the program results in a TypeError with the message ''no implicit conversion from nil to integer''. cust =
2010 Dec 15
4
distance_of_time_in_words shows {{count}} days instead of showing actual days
I have following code in view <% if @next_topic %> Time to show next topic <%= distance_of_time_in_words(Time.now.utc, @next_topic.time_to_show.utc) %> <hr /> <% end %> Output: Time to show next topic {{count}} days -------------------- time_to_show has following value Mon, 20 Dec 2010 12:38:00 UTC +00:00 @next_topic comes from database. I am using SQLITE. I am using
2008 Jun 14
0
Bug and patch for vpim-0.619
On Sat, Jun 14, 2008 at 10:42 AM, Christopher J. Bottaro <cjbottaro at alumni.cs.utexas.edu> wrote: > I noticed two little bugs when using your vpim module in a Rails application. > > 1) The vpim module overwrites Rail''s implementation of Date#to_time. > 2) The vpim module''s implementation of Date#to_time causes > Date.today.to_time to return a Time that is
2012 Oct 31
5
css background not showing
Hi all, for some reason adding the following is doing nothing... .post.hover { background: FAFAFA; I''ve got this in my posts.js coffee file $ -> $(''.post'').hover (event) -> $(this).toggleClass("hover") and my index is <% @posts.each do |post| %> <div class="post"> <strong><%= post.title %></strong>
2006 May 10
3
formatted date down-counter - help!
I''d like to have a count down to a certain date, but display it in words, such as "123 days away" or something. I''m aware of the function "distance_of_time_in_words_to_now()", which will display "about 6 hours" or "12 days" or something like that, but how can I get it to reverse? Pass it a date for future reference, then it will error
2008 Apr 04
0
Date.to_s format with time_ago_in_words
Hello, Following this post''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
2006 Aug 23
11
i18n friendly, plugable Rails Core
In my work with a simple localization plugin, i''m running into a lot of places in the Rails core, where text and other localization specific information is hardcoded. I''ve included some examples in the bottom of this post. It''s hard for an outsider to know, if the hardcoded values are a result of inconsistency in code, or "by design". I hope that we can have
2008 Jun 26
2
Problem with date_select after Rails 2.1 upgrade
Folks, I think I should start a new thread for this, because a similar one I saw is a bit old and the resolution there doesn''t seem to apply to what I''m running into now. Anyway, my date_select calls are bombing on me with the exception: ---- ActionView::TemplateError (wrong number of arguments (3 for 2)) on line #8 of entries/_dates_form.haml: 8: = date_select(
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 15
1
Strange behaviour of dates
Imagine a crud app that tracks people applying for a loan, here is the layout I have: Mysql database: create table apps ( id int auto_increment primary key, primary_id int not null, secondary_id int null, constraint fk_primary_id foreign key(primary_id) references (contacts.id), constraint fk_secondary_id foreign key(secondary_id) references (contacts.id)) create table contacts ( Id int