Displaying 20 results from an estimated 50 matches for "coreextensions".
2006 Apr 10
0
Plugins & ActiveSupport::CoreExtensions
Is it possible to add to ActiveSupport''s CoreExtension module via a
plugin? The only way I''ve been able to do this is to add my extensions
to a library stored in the lib folder.
Thanks.
--
DeLynn Berry
delynn@gmail.com
http://www.delynnberry.com
2006 Mar 14
21
Changing default date format in Rails
I''ve spent all day digging through the rails api and postgres-pr on
this, I think it''s time to ask the list.
Postgres stores a Date in YYYY-MM-DD format. My users want the dates
in MM/DD/YYYY format.
Sure, I could explicitly convert it on the app level every place where
a date is displayed, but that seemed like a DRY violation.
I thought I''d be clever and simply
2006 Jul 17
2
european date format
...ere 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 @ %H:%M: %p'' )
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.update(
:default => ''%d/%m/%Y'' )
this works great for displaying dates, the only problem is i can''t inp...
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
...ser.to_xml
However, on the client end it is a bit annoying for me to deal with
attributes like first-name. I would much rather have first_name.
Is there any way for me to turn off the behavior of converting _ to -?
This seems to be done by a call to dasherize inside the to_xml of
ActiveSupport::CoreExtensions::Array::Conversions, so I''m a bit out of
my depth...
Thanks,
Peter Armstrong
2006 Mar 23
5
Custom date format
...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!(
:my_format_1 => ''%d/%m/%Y - %H:%M'',
:my_format_2 => ''%l:%M %p, %B %d, %Y''
)
What''s wrong ?
Thanks
--
Posted via http://www.ruby-forum.com/.
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 fine on my machine. However
when I deploy on heroku day and month...
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 May 11
4
string to date/time?
Hey All,
Anyone know of a library for parsing "human" dates, like "this friday"
or "2 days ago"? I used to use strtotime in php, but starting from
here;
http://wiki.rubyonrails.com/rails/pages/PhpStrtotime
and doing lots of googling, I haven''t been able to find anything
similar for ruby. I know of javascript solutions to this, but I''d
need to do
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
2009 Feb 20
3
Years gone by (deprecation of years method)
Can anyone give me some insight as to why the
ActiveSupport::CoreExtensions::Float::Time method ''years'' is being
deprecated? I have an application managing contracts and being able to
manipulate and report on them based on the number of years the contract
lasts, is very convenient.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------...
2006 Mar 18
1
Date formatting and adding question
Hey all,
I''m working on a site for a client that has a scedule im trying to
display that pulls the next events for the upcoming Sunday from a MySQL
table....The table stores the event date as mm/dd/yyyy. I''ve tried to
think of everyway possible to get this thing to change after every
sunday to show the next sunday''s events, but I end up doing it
manually...
Is it
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 which is not an
active record?
Any pointers will be appreicated.
TIA
anand
--~--~---------~--~----~------------~-------~--~-...
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 ''invite.created_at.to_s(:msc_short)'' work
perfectly in all my views during normal operation. However, any
functional tes...
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to...
2009 Jun 18
3
Date.new.to_time.to_i
What''s going on here!?
>> Date.new.to_time.to_i
NoMethodError: undefined method `to_i'' for Mon, 01 Jan -4712 00:00:00
-0800:DateTime
from (irb):25
>> Date.today.to_time.to_i
=> 1245308400
>> RUBY_VERSION
=> "1.8.7"
>> Rails.version
=> "2.1.1"
(I''m not sure if this is a rails thing, or just a ruby thing)
--
2006 Dec 03
0
How to best change the default value of dasherize (using Edge Rails, and knowing about :dasherize => false)?
...ult for :dasherize, since it is never what we want.
def to_xml(options = {:dasherize => false})
XmlSerializer.new(self, options).to_s
end
end
...etc...
end
This works fine.
However, I also have to change the behaviour for two of the other
to_xml methods:
to_xml (ActiveSupport::CoreExtensions::Hash::Conversions)
to_xml (ActiveSupport::CoreExtensions::Array::Conversions)
(The to_xml in ActiveRecord::Errors doesn''t use it.)
Anyway, the source in the Hash::Conversions and Array::Conversions is
larger, so I don''t want to override the method just to change the
default. I...
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 Jan 19
4
Using RoR pluralization rules
Hello,
RoR seems to be aware of plurals like category=>categories etc..I Want to
be able to use this in my application to relate some keywords.Is it possible
?or does RoR itself use some ruby library?
Thanks
Vivek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060119/d5660663/attachment.html
2008 Jun 26
1
Undefined method: camelize
...2.0.2
Active Support version 2.0.2
Application root /home/jhugon/tdf
Environment development
Database adapter sqlite3
Would anyone know where I should start looking? I found one post which
indicates that this "camelize" method lives in
ActiveSupport::CoreExtensions::String::Inflections
but I don''t know enough Rails to interpret how to remedy to the
problem.
Any and all help is appreciated.
Thanks!
-jlh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rail...
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: