Displaying 20 results from an estimated 30000 matches similar to: "end_of_month()"
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
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
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
2012 Jan 23
0
Problem loading modules through ActiveSupport on_load
Working with modules to group certain methods. Currently I have this
set up and it works:
**# app/models/a.rb**
class A
has_history
end
**# lib/history.rb**
module History
module Model
def self.included(base)
base.send :extend, ClassMethods
end
module ClassMethods
def has_history(options = {})
send :include,
2012 Sep 28
0
Overriding class_attribute writers and order of super/extend C.M./included block eval in ActiveSupport::Concern
I have:
module MySpike
extend ActiveSupport::Concern
included do
class_attribute :foobar, instance_writer: true
end
end
But, I want to be able to override the class attribute writer and/or
instance writer method to do something when the attribute is set via
self.foobar = true before or after calling super to set the attribute.
Unfortunately, I can''t find a clean way
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
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 Dec 03
0
How to best change the default value of dasherize (using Edge Rails, and knowing about :dasherize => false)?
Hi all,
I''m trying to turn off dasherize in all cases, since converting
underscores to hyphens breaks the way that I want to handle XML (with
E4X in Flex 2).
I''ve read the other threads about dasherize on this list. I''m on Edge
Rails, so I can successfully turn off dasherize for a single usage
with something like
render :xml => @task.to_xml(:dasherize => false)
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 Jun 26
5
How can I dynamiclly generate models?
I am trying to write a plugin, ''acts_as_commentable'', for my models -
Image, Book, Music and so on, I do not want to use polymorphic
association, so very model should have its own comment class.
Here is my code
acts_as_commentable.rb
module Commentable
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all,
I am getting ActiveRecord to produce XML with
render :xml => @user.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
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 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
2008 Jun 26
1
Undefined method: camelize
Hi,
I am fairly new at Rails, and attempting to deploy an application
that''s running fine using InstantRails on my PC. On the deployment
server (I use railsplayground.net), I get the following error:
Processing ApplicationController#index (for 220.224.229.156 at
2008-06-25 18:49:34) [GET]
Session ID: 5921e7d789ee3aaa214f2d59aa40986a
Parameters: {"action"=>:index,
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
2008 May 04
3
Rails Configuration in Workers
I override some Rails'' configuration options in my project, like:
config.database_configuration_file = "#{RAILS_ROOT}/local/config/
database.yml"
But they aren''t picked up in BackgroundRB because Rails ActiveRecord
is just initialized directly in MasterWorker#load_rails_env:
db_config_file = YAML.load(ERB.new(IO.read("#{RAILS_HOME}/
2007 Nov 16
1
Missing methods patch for Time::Calculations
Time::Calculations provides methods like "end_of_month",
"beginning_of_year" and so on. But it lacks other related methods like
"end_of_week" and "end_of_year" that I think should be expected to be
there.
Here is a patch adding those methods: http://dev.rubyonrails.org/ticket/9312
+1''s?
Juanjo
--~--~---------~--~----~------------~-------~--~----~
2013 Jun 08
1
ActiveSupport::Concern support Module#prepend?
I''ve monkey patched this behavior into a gem and I was wondering if core
would be interested in a PR to add Module#prepend support to
ActiveSupport#Concern. I''ll add tests of course.
The code is here:
https://github.com/dockyard/easy_auth/blob/master/lib/easy_auth/active_support/concern.rb
My monkey patch work for what I''m trying to do but I suspect a better
2009 Jan 03
0
understanding rails internal architecture
i am currently digging into the rails 2.2.2 source to get a deeper
understanding of some features (in particular model-validation) and a
better overall insight. most of rails features are encapsulated in a
separate module - as far as can see - and wired together through
mixins. this makes sense and following the logic in the single modules
is easy. but i am getting stuck while puzzling to see it
2006 Feb 09
1
(no subject)
My application has one central database + Rails server and many
distributed GUI clients. The remote clients need to read and update
different collections of ActiveRecords. They also need to submit
fairly demanding calculation + database update requests.
Have you designed a similar Ruby application? What did you do?
I''ll try to summarize the approachs I''m considering