Commit Graph

4476 Commits

Author SHA1 Message Date
Santiago Pastorino
60609bb50d Sign cookies using key deriver 2012-11-03 14:57:53 -02:00
Vijay Dev
3b0bb08699 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionpack/lib/action_controller/metal/mime_responds.rb
	activerecord/lib/active_record/attribute_methods.rb
	guides/source/working_with_javascript_in_rails.md
2012-11-03 01:56:16 +05:30
Steve Klabnik
642e1af6f1 Fixed timezone mapping of Solomon Islands.
Fixes #8095.

For reference, here is the discussion about the mapping being
incorrect:
http://rubyforge.org/pipermail/tzinfo-users/2012-November/000114.html
2012-11-01 18:10:48 -07:00
Dmitry Vorotilin
346ccf376c Kernel#capture replaced by version which can catch output from subprocesses 2012-11-01 13:36:40 +04:00
Alexey Gaziev
b955939d55 Make caller attribute in deprecation methods optional 2012-10-30 10:23:41 +08:00
Nikita Afanasenko
0b7067d849 Provide a call stack for deprecation warnings where needed.
It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
2012-10-29 19:22:59 +04:00
Daniele Sluijters
851f8c1023 atomicc.rb: Don't assume we may chown/chmod a file.
Previously this code just assumed it is capable of changing the file
ownership, both user and group. This will fail in a lot of scenario's
unless:
* The process is run as a superuser (root);
* The owning user and group are already set to the user and group we're
  trying to chown to;
* The user chown'ing only changes the group to another group it is a
  member of.
If either of those conditions are not met the filesystem will simply
deny the operation throwing an error.

It is also not always possible to do a chmod, there might be a SELinux
policy or another limitation preventing the user to change the file
mode. To this end the chmod call has also been added to the rescue
block.

I've also added a little comment above the chmod command that doing a
chmod on a file which has an ACL set will cause the ACL to be
recalculated / modified.
2012-10-29 10:04:59 +01:00
Rafael Mendonça França
5bbe245a51 Merge pull request #8046 from pmahoney/exceptions_as_flow_control
Replace flow-control exception with explicit test.
2012-10-28 13:22:45 -07:00
Carlos Antonio da Silva
d46f9e3731 Fix some assert_raise calls containing messages in Active Support 2012-10-28 17:54:24 -02:00
Patrick Mahoney
8d0efcc575 Replace flow-control exception with explicit test.
It was noticed while profiling 'assets:precompile' in JRuby that
exception creation was consuming a large portion of time, and
some of that was due to File.atomic_write.

Testing first with File.exists? eliminates the need for an exception
which should be a perfomrance improvement on both JRuby and MRI.
In this case, the stat() isn't even extra overhead, since it is always
called.
2012-10-27 14:53:10 -05:00
Jeremy Kemper
b79444053c Fix queueing tests that should be consuming the queue rather than draining it 2012-10-26 19:11:19 -07:00
Jeremy Kemper
bf2009f995 Job consumer logs to Rails.logger by default 2012-10-26 16:18:52 -07:00
Jeremy Kemper
26f52b2ac1 Job worker thread logs failed jobs too 2012-10-26 16:18:52 -07:00
Jeremy Kemper
411378efcf Job worker thread logs to stderr if no logger is provided 2012-10-26 16:18:52 -07:00
David Graham
f38e752bdf Implement replace method so key? works correctly. 2012-10-26 11:36:35 -06:00
Carlos Antonio da Silva
7c7a225fbe Remove ActiveRecord::Model consant from AS::TestCase
Fixing the build.
2012-10-26 13:34:00 -02:00
Geoffrey Roguelon
1e593db13a Adding a missing parenthesis in the doc of String#parameterize. 2012-10-24 15:08:58 +02:00
Noah Hendrix
96f5ceaafb make the cache test more @tenderlove(ing) and not depend on internal implentation 2012-10-23 18:42:37 -07:00
Noah Hendrix
81b7112565 pass the key to the block in cache.fetch on misses 2012-10-23 00:04:42 -07:00
Francesco Rodriguez
2ef4d5ed5c fix output messages - docs [ci skip] 2012-10-22 14:27:55 -05:00
AvnerCohen
7fbb21dc80 More changes around 1.9 hash syntax
Added missing space in previous hash related commit
2012-10-21 22:32:43 +02:00
Vijay Dev
f938019da2 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activesupport/lib/active_support/core_ext/hash/slice.rb
	guides/source/active_support_core_extensions.md
2012-10-21 18:49:19 +05:30
AvnerCohen
71c67d1fd8 Hash Syntax changes to 1.9 format 2012-10-20 16:54:43 +02:00
Aaron Patterson
a3ad0a7b67 fix assertions 2012-10-18 13:14:43 -07:00
thedarkone
9f84e60ac9 Make DescendantsTracker thread safe and optimize the #descendants method. 2012-10-18 12:08:01 -07:00
Aaron Patterson
4f106bbb2c some ruby interpreters don't have ruby-prof so just skip the tests
rather than exiting the process.
2012-10-18 12:04:51 -07:00
Xavier Noria
74bf8afb9f Revert "remove unnecessary object/conversions file"
This file is used at least by Active Merchant, its existence
is maybe not necessary but no big deal either.

This reverts commit ae9b3d7cecd77b9ace38671b183e1a360bf632b6.
2012-10-16 12:05:00 +02:00
Jeremy Kemper
c8fe0d58bc Backpedal from class-oriented config.queue. Set an actual queue instance. 2012-10-12 22:27:41 -07:00
Jeremy Kemper
775829869e Remove the queue container. Premature consolidation. Set up and maintain queues in the classes that use them instead. 2012-10-12 19:38:40 -07:00
Rafael Mendonça França
e68b97a4b6 Merge pull request #7007 from Mik-die/hash_extract
make Hash#extract! more symmetric with Hash#slice
2012-10-12 14:29:11 -07:00
Rafael Mendonça França
08f57bfb8f Move the TestQueue tests to the proper file 2012-10-12 14:42:26 -03:00
Xavier Noria
168df24ac8 Merge pull request #7913 from mje113/master
MemCacheStore's move to dalli as a backend broke :race_condition_ttl support
2012-10-12 09:50:24 -07:00
dfens
ab9140ff02 Cleanup trailing whitespaces 2012-10-12 09:56:39 +02:00
Aaron Patterson
b91a90e496 adding a test for b21f24d9807bd161af947cf0f0cc440c9adffb73 2012-10-11 18:26:52 -07:00
Mike Evans
13d8777b63 Padding expires_in by 5 minutes on dalli key write to facilitate :race_condition_ttl working correctly. 2012-10-11 15:46:30 -04:00
Joshua Peek
b21f24d980 Ensure expires_in and created_at timestamps aren't nil when attempting to upgrade cache 2012-10-10 13:46:25 -05:00
Xavier Noria
0787cea3bb let (array|hash)/conversions.rb load the extensions in object/to_(param|query).rb 2012-10-09 21:55:43 +02:00
Xavier Noria
3395633a50 adds a missing require 2012-10-09 19:41:14 +02:00
Xavier Noria
9492cb0257 adds missing require 2012-10-09 18:27:30 +02:00
Xavier Noria
2e0c6173bd keys.include? -> key? 2012-10-09 17:54:24 +02:00
Xavier Noria
2296e74973 Merge pull request #7817 from NARKOZ/object-conversions
remove unnecessary object/conversions file
2012-10-09 08:36:36 -07:00
Mikhail Dieterle
a4b1196163 add more testcases and doc about Hash#extract! 2012-10-08 01:20:37 +03:00
Mikhail Dieterle
5d27338ab0 make Hash#extract! more symmetric with Hash#slice 2012-10-08 01:20:36 +03:00
Xavier Noria
918f7038b3 explains why these requires are in an unusual place 2012-10-07 11:52:47 +02:00
Xavier Noria
e0deb0e89b Merge pull request #7650 from kennyj/fix_warning_20120915
Fix warning: circular require considered harmful.
2012-10-07 02:42:36 -07:00
Jeremy Kemper
b9999c58c2 Ruby 2 compat. Hash[] now raises on bad elements rather than ignoring them. No sense over-testing this MRI-specific behavior. See ruby/ruby@8d6add973e 2012-10-06 20:57:22 -07:00
Francesco Rodriguez
3675cd41f3 rename private method to avoid overriding 2012-10-06 00:49:27 -05:00
Francesco Rodriguez
d91bee80be use Rails backtrace in tests 2012-10-05 21:42:11 -05:00
Francesco Rodriguez
ca519eeb40 bump minitest version ~> 4.1.0 2012-10-05 21:42:02 -05:00
Santiago Pastorino
a0613ad8a9 Revert "Use flat_map { } instead of map {}.flatten"
This reverts commit abf8de85519141496a6773310964ec03f6106f3f.
We should take a deeper look to those cases flat_map doesn't do deep
flattening.

irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten
=> [1, 3, 1, 2]
irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i}
=> [[1, 3], [1, 2]]
2012-10-05 12:07:16 -03:00
Santiago Pastorino
abf8de8551 Use flat_map { } instead of map {}.flatten 2012-10-05 11:52:20 -03:00
Michael Koziarski
0a507925cf Merge pull request #6952 from NZKoz/key_generator
Add ActiveSupport::KeyGenerator as a simple wrapper around PBKDF2
2012-10-02 14:26:16 -07:00
kennyj
8b05cfad11 Fix warning: circular require considered harmful. 2012-10-03 01:39:09 +09:00
Nihad Abbasov
ae9b3d7cec remove unnecessary object/conversions file 2012-10-02 13:37:25 +05:00
Rafael Mendonça França
cfc0ca0516 Merge pull request #7708 from bdurand/optimize_log_subscribers
Optimize log subscribers to check if the log level is sufficient
2012-10-01 20:28:31 -07:00
Rafael Mendonça França
325748d6b5 New CHANGELOG entries always in the top 2012-10-01 23:17:13 -03:00
Arun Agrawal
21051676fc warning fixed: (...) interpreted as grouped expression 2012-10-01 18:25:19 +05:30
Brian Durand
b784900208 fix broken cache tests 2012-09-30 21:56:47 -07:00
Michael Koziarski
def2ccb8e3 Add ActiveSupport::KeyGenerator as a simple wrapper around PBKDF2
This will be used to derive keys from the secret and a salt, in order to allow us to
do things like encrypted cookie stores without using the secret for multiple
purposes directly.
2012-10-01 14:22:19 +13:00
Steve Klabnik
7f1eef9b01 Fix other assertions that were backwards.
This time I used ack.
2012-09-30 12:37:59 -07:00
Steve Klabnik
06d173b382 fix order of assertions. 2012-09-30 11:08:11 -07:00
Brian Durand
37852726c9 Optimize log subscribers to check if the log level is sufficient before performing an operations. 2012-09-30 09:47:24 -07:00
Brian Durand
e3a746b6fc Optimize ActiveSupport::Cache::Entry to reduce memory and processing overhead. 2012-09-30 09:26:04 -07:00
Rafael Mendonça França
f655108c26 Merge pull request #7784 from morgoth/proper_test_names_for_assertions
Changed test names to match proper context
2012-09-28 19:01:51 -07:00
Erik Michaels-Ober
a6e09a53ae Update minitest dependency to ~> 4.0 2012-09-28 18:06:39 -07:00
Wojciech Wnętrzak
b4006db471 Changed test names to match proper context 2012-09-28 22:58:27 +02:00
Vijay Dev
955a72c692 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionpack/lib/action_view/helpers/asset_tag_helper.rb
2012-09-28 23:17:07 +05:30
Grant Hutchins & Sabrina Staedt
5917c6eb28 Improve documentation for subscribe block 2012-09-27 15:38:54 -04:00
Andy Lindeman
ba34110677 ConstantLookup is not needed in every TestCase decendant 2012-09-26 23:21:52 -04:00
Jeremy Kemper
86ebe0bd36 Tests tag the Rails log with the current test class and test case 2012-09-26 11:17:02 -07:00
Jeremy Kemper
107fd8788f Allow wrapping a logger that hasn't set a formatter. Default to our SimpleFormatter. Otherwise we try extending nil with the tagging API. 2012-09-26 11:17:02 -07:00
Jeremy Kemper
d36f57f430 Add logger.push_tags and .pop_tags to complement logger.tagged 2012-09-26 10:16:40 -07:00
Mike Moore
b13400086c Add missing inflector dependency 2012-09-25 15:40:00 -06:00
Mike Moore
52db1f9148 Add register_spec_type test coverage 2012-09-24 14:24:08 -06:00
Mike Moore
4894eef448 Create ActiveSupport::Testing::ConstantLookup
AS::TC::ConstantLookup walks the test's name to find the constant it is describing.
This additional lookup logic is needed to better support minitest's spec DSL.
2012-09-24 13:44:49 -06:00
Adam Stankiewicz
bc87712bc6 String.to_time documentation along examples. 2012-09-24 16:11:29 +02:00
Santiago Pastorino
ec28c059b7 Merge pull request #7726 from jcorcuera/master
Remove '.rb' from require sentences
2012-09-21 16:10:23 -07:00
Santiago Pastorino
008eaebb56 Raise the same exception the code is handling 2012-09-21 19:05:12 -03:00
José Corcuera Z
c60e19bc6d Remove .rb from require sentences 2012-09-21 16:57:15 -05:00
José Corcuera
66bc017849 Update examples in AS::Concern to use correct scope syntax. [ci skip] 2012-09-21 12:29:44 -05:00
Vijay Dev
3b7947ea31 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	actionmailer/lib/action_mailer/base.rb
	activesupport/lib/active_support/configurable.rb
	activesupport/lib/active_support/core_ext/module/deprecation.rb
	guides/source/action_controller_overview.md
	guides/source/active_support_core_extensions.md
	guides/source/ajax_on_rails.textile
	guides/source/association_basics.textile
	guides/source/upgrading_ruby_on_rails.md

While resolving conflicts, I have chosen to ignore changes done in
docrails at some places - these will be most likely 1.9 hash syntax
changes.
2012-09-21 22:49:20 +05:30
Carlos Antonio da Silva
ed05e92239 Update delegate docs with new hash syntax [ci skip] 2012-09-20 18:51:14 -03:00
Carlos Antonio da Silva
1eef814e7a Add changelog entry and docs about class delegation using the symbol :class
See #7613. [ci skip]
2012-09-20 18:50:53 -03:00
Jeremy Kemper
0a7b1319d3 Merge pull request #7613 from marcandre/delegate_to_class
Nice and easy delegation to the class
2012-09-20 11:19:47 -07:00
Jo Liss
920abaa52d Fix indentation and update documentation for Array#wrap for Ruby 1.9 2012-09-20 18:29:12 +02:00
kennyj
105cb3d9e3 Fix #6962. AS::TimeWithZone#strftime responds incorrectly to %:z and %::z format strings. 2012-09-20 00:51:28 +09:00
Francesco Rodriguez
255cefbff4 fix Hash#slice code example [ci skip] 2012-09-18 22:13:49 -05:00
Jeremy Kemper
aebbd4bb4d No need to defensively work jobs in another thread 2012-09-18 15:22:24 -07:00
gregolsen
da26dfbefd Date.beginning_of_week thread local and beginning_of_week application config option added (default is Monday) 2012-09-18 17:18:19 +03:00
kennyj
87321488da Remove unncessary code. 2012-09-17 21:33:43 +09:00
Jeremy Kemper
b881be7331 Always run jobs using a consumer, even in synchronous & test queues, to ensure shared behavior. 2012-09-16 22:37:47 -07:00
Francesco Rodriguez
d71d5ba71f update AS docs [ci skip] 2012-09-17 00:22:18 -05:00
Francesco Rodriguez
c1c9f1c7b9 fix AS::OrderedOptions documentation [ci skip] 2012-09-17 00:12:11 -05:00
Larry Lv
1efe30ebce set up config_accessor with a default value by block
* ActiveSupport::Configurable should allow config_accessor to take
  default value by block, just like cattr_accessor.

    class User
      include ActiveSupport::Configurable
      config_accessor :hair_colors do
        [:brown, :black, :blonde, :red]
      end
    end

    User.hair_colors # => [:brown, :black, :blonde, :red]

* remove trailing whitespaces in configurable.rb and its test file.

* Update ActiveSupport CHANGELOG.
2012-09-17 09:14:21 +08:00
Rafael Mendonça França
1b7894c95b Merge pull request #7643 from steveklabnik/deprecate_silence
Deprecate ActiveSupport::Benchmarkable#silence.
2012-09-15 05:57:08 -07:00
Steve Klabnik
afe9654297 Improve Process::Status#to_json
Because Process::Status has no instance_variables, the
ActiveSupport version of #to_json produces {}, which isn't good.

Therefore, we implement our own #as_json, which makes it useful
again.

Fixes #4857
2012-09-15 16:35:34 +04:00
Francesco Rodriguez
00fef0a76c update AS/values and AS/xml_mini docs [ci skip] 2012-09-14 23:02:37 -05:00
Francesco Rodriguez
b0e943381b update AS/notifications and AS/testing docs [ci skip] 2012-09-14 22:57:38 -05:00
Francesco Rodriguez
d48163c65d update AS/log_subscriber and AS/multibyte docs [ci skip] 2012-09-14 22:54:39 -05:00
Francesco Rodriguez
7ef21d80a3 update AS/json docs [ci skip] 2012-09-14 22:47:21 -05:00
Francesco Rodriguez
5ea3f284a4 update AS/inflector docs [ci skip] 2012-09-14 22:44:06 -05:00
Francesco Rodriguez
8673c2eefb update AS/deprecation docs [ci skip] 2012-09-14 22:28:56 -05:00
Francesco Rodriguez
f210a369d1 add :nodoc: to AS::Autoload#extended [ci skip] 2012-09-14 21:31:49 -05:00
Steve Klabnik
ed2fea908a Deprecate ActiveSupport::Benchmarkable#silence.
Due to its lack of thread safety, we're deprecating this, and it
will be removed in Rails 4.1.

Fixes #4060.
2012-09-15 06:19:55 +04:00
Santiago Pastorino
8577687fcb Move queue classes to ActiveSupport 2012-09-14 14:10:00 -07:00
Arun Agrawal
948a055f23 warning removed: shadowing outer local variable - message 2012-09-14 10:19:10 +05:30
Pranas Kiziela
54575d8797 Allow passing block to deep_merge and deep_merge!
Hash#merge accepts block that you can use to customize how hash values
are merged. This change makes merge and deep_merge compatible.
2012-09-13 23:01:18 +03:00
Rafael Mendonça França
8692db59af Copy-edit deprecation relared documentation [ci skip] 2012-09-13 14:02:18 -03:00
Piotr Niełacny
71993c6f97 Change ActiveSupport::Deprecation to class.
ActiveSupport::Deprecation is now a class rather than a module. You can
get instance of ActiveSupport::Deprecation calling #instance method.

  ActiveSupport::Deprecation.instance

But when you need to get new object od ActiveSupport::Deprecation you
need to just call #new.

  @instance = ActiveSupport::Deprecation.new

Since you can create a new object, you can change the version and the
name of the library where the deprecator concerned.

  ActiveSupport::Deprecation.new('2.0', 'MyGem')

If you need use another deprecator instance you can select it in the
options of deprecate method.

  deprecate :method, :deprecator => deprecator_instance

Documentation has been updated.
2012-09-13 08:42:00 +02:00
Robert Pankowecki
2c690a0f5b extend ActiveSupport::Deprecation with self, allow other objects to extend/include it also.
test local deprecation

deprecator object

Test ActiveSupport::Deprecation when included
2012-09-13 08:42:00 +02:00
Francesco Rodriguez
68a8a298d6 fix AS/core_ext examples [ci skip] 2012-09-12 19:41:03 -05:00
Francesco Rodriguez
794a70f944 update AS/core_ext docs [ci skip] 2012-09-12 18:40:18 -05:00
Francesco Rodriguez
f4e180578c update some AS code examples to 1.9 hash syntax [ci skip] 2012-09-12 13:47:49 -05:00
Marc-Andre Lafortune
ad5f18e6e9 Nice and easy delegation to the class 2012-09-11 23:05:19 -04:00
Bogdan Gusiev
f11fc7308a Revert "Changelog entry for PR #7560"
This reverts commit ca80067bbe4662c60b933188ad3769605742e812.
Entry already added in 895233
2012-09-10 21:57:57 +03:00
Bogdan Gusiev
ca80067bbe Changelog entry for PR #7560 2012-09-10 21:38:12 +03:00
Kalys Osmonov
6b2a24c3bd &#39 dates back to SGML when &#x27 was introduced in HTML 4.0 2012-09-09 19:48:32 +06:00
Carlos Antonio da Silva
f24a5517e9 Fix AS tests due to builder change with nil values / empty strings
Check 0180e090ab6cbe66f7b521a0c03e278a0463accd for more reasoning about
that.
2012-09-07 13:37:04 -03:00
Carlos Antonio da Silva
dcc68fa443 Fix Active Support changelog formatting [ci skip] 2012-09-07 11:12:16 -03:00
Carlos Antonio da Silva
8952339750 Add Changelog entry for #7560: deprecate #filter in AS::Callbacks [ci skip] 2012-09-07 11:12:00 -03:00
Bogdan Gusiev
6777f7b75d AS::Callbacks: deprecate monkey patch of object callbacks 2012-09-07 14:42:31 +03:00
Aaron Renner
8b0d5bfc77 Fixed around callback with lambda example
This is a follow up to issue #7535
2012-09-06 08:21:47 -06:00
Xavier Noria
2ed325a3e9 we already have the module objects, do not constantize
I have also chosen a variable name that matches the
parameter in the definition of load_missing_constant.
2012-09-06 14:11:04 +02:00
Xavier Noria
021cb85b95 restores awesome comment
Those who say source code should be without comments lie.
2012-09-06 13:43:49 +02:00
Xavier Noria
3ee191fd95 no more const_missing combinatorics
Basically, const_missing had a loop to try parent namespaces
if the constant lookup failed, but at the same time delegated
to load_missing_constant which in turn also walks up parent
namespaces calling const_missing by hand. In the case of missing
constants this results in repeated work in some funky nested way.
2012-09-06 13:39:23 +02:00
Leo Cassarani
edab820d9e Extend HashWithIndifferentAccess#update to take an optional block
When a block is passed into the method, it will be invoked for each
duplicated key, with the key in question and the two values as
arguments. The value for the duplicated key in the receiver will
be set to the return value of the block.

This behaviour matches Ruby's long-standing implementation of
Hash#update and is intended to provide a more consistent interface.

HashWithIndifferentAccess#merge is also affected by the change, as it
uses #update internally.
2012-09-05 00:59:29 +01:00
Xavier Noria
5388fee718 revised the exception message "Expected #{file_path} to define #{qualified_name}"
Users need to know the ultimate problem here is that AS was
trying to autoload a constant and it failed.
2012-09-04 01:24:09 +02:00
Vijay Dev
a667499103 Merge branch 'master' of github.com:lifo/docrails 2012-09-01 23:51:23 +05:30
Vijay Dev
831b814a87 copy edits [ci skip] 2012-09-01 23:49:55 +05:30
Jeff Shantz
67fa3e8ddf Expand documentation for change() method in Time, Date, and DateTime 2012-08-29 22:48:46 -04:00
Xavier Noria
3b2c42cb56 fixes a regexp
We need to anchor to remove the extension. In addition to
be the correct way to do that, files in ~/.rbenv get that
.rb removed, so it is a real source of bugs, as reported in

b33700f558 (commitcomment-1781840)
2012-08-29 17:42:43 +02:00
Xavier Noria
810a50dacf CHANGELOGs are now per branch
Changes in old branches needed to be manually synched in CHANGELOGs of newer ones.
This has proven to be brittle, sometimes one just forgets this manual step.
With this commit we switch to CHANGELOGs per branch. When a new major version is
cut from master, the CHANGELOGs in master start being blank.

A link to the CHANGELOG of the previous branch allows anyone interested to
follow the history.
2012-08-28 21:15:16 +02:00
Xavier Noria
b33700f558 detect circular constant autoloading
Nowadays circular autoloads do not work, but the user gets a NameError
that says some constant is undefined. That's puzzling, because he is
normally trying to autoload a constant he knows can be autoloaded.
With this check we can give a better error message.
2012-08-28 20:34:39 +02:00
Xavier Noria
db8ff15a49 fixes a bug in dependencies.rb
loaded stores file names without the .rb extension, but search_for_file
returns file names with the extension.

The solution is hackish, but this file needs a revamp.
2012-08-28 17:19:39 +02:00
Rafael Mendonça França
ea84b0c618 Remove unused variable 2012-08-26 03:56:19 -03:00
Rafael Mendonça França
a1d18ed9cf Merge pull request #7029 from panthomakos/date-and-time
Refactored common date and time calculations.
2012-08-25 18:26:07 -07:00
Xavier Noria
dfb5898b6d simplifies yet another regexp 2012-08-25 03:10:38 +02:00
Xavier Noria
4fbd350dca instead of returning $& if =~ succeeds, use String#[] 2012-08-25 03:08:45 +02:00
Xavier Noria
148e33058c simplifies a regexp
We simplify two things here: First since * is greedy it is enough to go
look for the rightmost ::, no need to ask the regexp engine to match the
rest of the string since we are not validating anything, only capturing.
The second simplification comes from using a look-ahead assertion, that
allows us to have the capture in $&, thus removing the need of a group.
2012-08-25 02:56:59 +02:00
Rafael Mendonça França
2c571b3f05 Merge pull request #7058 from frodsan/fix_as_random_tests
Fix tests that depend on run order
2012-08-24 08:56:16 -07:00
Xavier Noria
6a70f2dd6b simplifies a regexp
The new regexp has less work to do, we anchor a fixed string at the end
and need no group.
2012-08-24 01:17:00 +02:00
Francesco Rodriguez
cc14a3b2c1 Fix ActiveSupport tests that depend on run order 2012-08-23 16:00:58 -05:00
José Valim
891043d5d0 Revert "Use join without default separator"
This reverts commit b0ab8dc0b2b0f580ffe5ac9ff57fd13152e18577
because it was removing the contents of the message when we
did not have any tag. A test case is also committed.
2012-08-23 11:01:55 -03:00
Aaron Patterson
6a79aa7f81 skip the memcache tests if the memcache server is not up 2012-08-22 15:42:48 -07:00
Xavier Noria
8b16ff64f2 revises a brittle test in Active Support
The revised test assumed that the default permissions of a file
matched the umask of the process, but in the general case that
depends also on the file system. This test was failing in the
/vagrant shared folder of Rails development boxes.
2012-08-22 23:10:33 +02:00
Rafael Mendonça França
8c6fcbc2b1 Add CHANGELOG entry for #3578 [ci skip] 2012-08-21 18:39:37 -03:00
Rafael Mendonça França
d65a15dca6 Merge pull request #3578 from amatsuda/remove_j_alias_for_json_escape
Remove j alias for ERB::Util.json_escape
2012-08-21 14:18:38 -07:00
José Valim
2801786e1a Get rid of config.preload_frameworks in favor of config.eager_load_namespaces
The new option allows any Ruby namespace to be registered and set
up for eager load. We are effectively exposing the structure existing
in Rails since v3.0 for all developers in order to make their applications
thread-safe and CoW friendly.
2012-08-21 14:47:19 -03:00
José Valim
a1687e48cb Make ActiveSupport::Autoload local
Previously, ActiveSupport::Autoload was global and reserved
for usage inside Rails. This pull request makes it local,
fixes its test (they were not being run because its file
was named wrongly) and make it part of Rails public API.
2012-08-21 14:46:12 -03:00
Xavier Noria
f298481b36 Revert "removes unused optional argument in AS::Dependencies::Loadable#load"
This argument is there because that's the signature of Kernel#load.

This reverts commit bf3fa34ed0aa33bca3aac9c96165662fe864a7b4.
2012-08-20 23:59:36 +02:00
Xavier Noria
bf3fa34ed0 removes unused optional argument in AS::Dependencies::Loadable#load 2012-08-20 23:55:28 +02:00
Xavier Noria
937a825921 removes the second argument of the AS const_missing hook
Ruby does not pass the nesting to const_missing (unfortunately).
That second argument was there in case that changed, Yehuda
sent a patch to MRI

    http://bugs.ruby-lang.org/issues/2740

but there is not much movement there and Matz told me in
Amsterdam there was no immediate plan to pass the nesting.
So let's go back to implement what happens now, and if
in the future we get the nesting then we will adapt this.

Double-checked this with Mr Katz.
2012-08-19 23:55:54 +02:00
Xavier Noria
30f091b35a no need for AS::Dependencies.(hook!|unhook!) to return anything in particular 2012-08-19 21:33:58 +02:00
Guillermo Iguaran
bd680e3f5f Add test to cover increment/decrement of non-existing key in MemCacheStore 2012-08-17 22:22:55 -05:00
Guillermo Iguaran
82663306f4 Replace deprecated memcache-client gem with dalli in ActiveSupport::Cache::MemCacheStore
memcache-client was deprecated in favour of dalli in 2010.
2012-08-17 22:22:55 -05:00
Eric Saxby
6fe36ba585 Evented notifications take priority over Timed notifications
In cases where a notification subscriber includes methods to support
both Evented and Timed events, Evented should take priority over Timed.
This allows subscribers to be backwards compatible (older Rails only
allows Timed events) while defaulting to newer behavior.
2012-08-11 17:39:20 -07:00
Rafael Mendonça França
8781b266b9 Sync CHANGELOGs [ci skip] 2012-08-11 13:13:58 -03:00
Carlos Antonio da Silva
47b4d13c8d Ensure I18n format values always have precedence over defaults
Always merge I18n format values, namespaced or not, over the default
ones, to ensure I18n format defaults will have precedence over our
namespaced values.

Precedence should happen like this:

    default :format
    default :namespace :format
    i18n    :format
    i18n    :namespace :format

Because we cannot allow our namespaced default to override a I18n
:format config - ie precision in I18n :format should always have higher
precedence than our default precision for a particular :namespace.

Also simplify default format options logic.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
a9dccda936 Fallback to :en locale instead of handling a constant with defaults
Action Pack already comes with a default locale fine for :en, that is
always loaded. We can just fallback to this locale for defaults, if
values for the current locale cannot be found.

Closes #4420, #2802, #2890.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
b6e00c6764 Bring back changelog entries for Active Support
Removed in 0228a73b1094a3e19ad291d2ce4789890c09578a, pull request #7310.
2012-08-11 00:16:42 -03:00
Mark Turner
0228a73b10 Add html_escape note to CHANGELOG 2012-08-09 16:54:52 -07:00
Rafael Mendonça França
7ef56d6419 Add back missing require 2012-08-07 20:04:29 -03:00
Rafael Mendonça França
82fe116051 Fix the deprecation horizon. [ci skip] 2012-08-07 19:39:38 -03:00
Erich Menge
83f2ffcf43 Deprecate ActiveSupport::JSON::Variable
Reason: ActiveSupport::JSON::Variable is not used anymore internally. It
was deprecated in 3-2-stable but we reverted all the deprecation for
point releases.

See #6536 and #6546.
Conflicts:
	activesupport/lib/active_support/json/variable.rb
2012-08-07 19:36:08 -03:00
Xavier Noria
2f58795e78 defines String#indent [closes #7263] [Xavier Noria & Ace Suares] 2012-08-07 16:57:28 +02:00
Rafael Mendonça França
bf39026d56 Merge pull request #7272 from lexmag/string_inquirer
Add AS::StringInquirer#respond_to? method
2012-08-06 09:24:37 -07:00
Aaron Patterson
3a91d44eff let ruby decompose the tuples in the iterator 2012-08-06 08:26:45 -07:00
Aleksey Magusev
a1beec1de0 Add AS::StringInquirer#respond_to? method
Consistently with #method_missing
2012-08-06 16:59:12 +04:00
Xavier Noria
447b6a4e67 removes usage of Object#in? from the code base (the method remains defined by Active Support)
Selecting which key extensions to include in active_support/rails
made apparent the systematic usage of Object#in? in the code base.
After some discussion in

    5ea6b0df9a

we decided to remove it and use plain Ruby, which seems enough
for this particular idiom.

In this commit the refactor has been made case by case. Sometimes
include? is the natural alternative, others a simple || is the
way you actually spell the condition in your head, others a case
statement seems more appropriate. I have chosen the one I liked
the most in each case.
2012-08-06 00:30:02 +02:00
Pan Thomakos
b530fd1083 Refactored common date and time calculations.
* Added the `DateAndTime::Calculations` module that is included in Time
  and Date. It houses common calculations to reduce duplicated code.
* Simplified and cleaned-up the calculation code.
* Removed duplication in tests by adding a behavior module for shared
  tests. I also added some missing tests.
2012-08-04 16:13:03 -07:00
Vijay Dev
3d3fa165e4 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activemodel/lib/active_model/secure_password.rb
	activerecord/lib/active_record/associations/collection_proxy.rb
2012-08-04 15:18:35 +05:30
Xavier Noria
077372b20d load active_support/deprecation in active_support/rails 2012-08-02 21:59:23 +02:00
Xavier Noria
4aee8dd486 load active_support/core_ext/module/delegation in active_support/rails 2012-08-02 21:59:23 +02:00
Xavier Noria
5e1b92044c load active_support/core_ext/class/attribute in active_support/rails 2012-08-02 21:59:23 +02:00
Xavier Noria
64bc8447c2 load active_support/concern in active_support/rails 2012-08-02 21:59:23 +02:00
Xavier Noria
47396a9db8 load active_support/dependencies/autoload in active_support/rails 2012-08-02 21:59:23 +02:00
Xavier Noria
5ea6b0df9a load active_support/core_ext/object/inclusion in active_support/rails 2012-08-02 21:59:22 +02:00
Xavier Noria
8f58d6e507 load active_support/core_ext/object/blank in active_support/rails 2012-08-02 21:59:22 +02:00
Xavier Noria
1a7b2e8fad defines a private require-hub active_support/rails
This is a private place to put those AS features that are used
by every component. Nowadays we cherry-pick individual files
wherever they are used, but that it is not worth the effort
for stuff that is going to be loaded for sure sooner or later,
like blank?, autoload, concern, etc.
2012-08-02 21:59:22 +02:00
Santiago Pastorino
b6ab441772 html_escape should escape single quotes
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
Closes #7215
2012-07-31 22:26:52 -03:00
José Valim
0e3c66691a Update activesupport/CHANGELOG.md 2012-07-31 15:48:17 +03:00
José Valim
13af5aceff Merge pull request #7197 from davidcelis/i18n_inflector
Make ActiveSupport::Inflector locale aware and multilingual
2012-07-31 05:46:25 -07:00
David Celis
7db0b073fe Make ActiveSupport::Inflector locale aware and multilingual
The Inflector is currently not very supportive of internationalized
websites. If a user wants to singularize and/or pluralize words based on
any locale other than English, they must define each case in locale
files. Rather than create large locale files with mappings between
singular and plural words, why not allow the Inflector to accept a
locale?

This patch makes ActiveSupport::Inflector locale aware and uses `:en`` unless
otherwise specified. Users will still be provided a list of English (:en)
inflections, but they may additionally define inflection rules for other
locales. Each list is kept separately and permanently. There is no reason to
limit users to one list of inflections:

    ActiveSupport::Inflector.inflections(:es) do |inflect|
      inflect.plural(/$/, 's')
      inflect.plural(/([^aeéiou])$/i, '\1es')
      inflect.plural(/([aeiou]s)$/i, '\1')
      inflect.plural(/z$/i, 'ces')
      inflect.plural(/á([sn])$/i, 'a\1es')
      inflect.plural(/é([sn])$/i, 'e\1es')
      inflect.plural(/í([sn])$/i, 'i\1es')
      inflect.plural(/ó([sn])$/i, 'o\1es')
      inflect.plural(/ú([sn])$/i, 'u\1es')

      inflect.singular(/s$/, '')
      inflect.singular(/es$/, '')

      inflect.irregular('el', 'los')
    end

    'ley'.pluralize(:es)   # => "leyes"
    'ley'.pluralize(:en)   # => "leys"
    'avión'.pluralize(:es) # => "aviones"
    'avión'.pluralize(:en) # => "avións"

A multilingual Inflector should be of use to anybody that is tasked with
internationalizing their Rails application.

Signed-off-by: David Celis <david@davidcelis.com>
2012-07-30 21:49:18 -07:00
José Valim
8601f733af Revert "DRY class_attribute code"
class_attribute is a building block and using define_method
can be much slower for such basic method definitions.

This reverts commit d59208d7032e2be855a89ad8d4685cc08dd7cdb3.
2012-07-30 08:19:15 +02:00
Aaron Patterson
af0a9f9eef added live responses which can be written and read in separate threads 2012-07-29 21:43:05 -07:00
Aleksandr Zykov
d59208d703 DRY class_attribute code 2012-07-29 22:33:39 +06:00
Francesco Rodriguez
0340493694 update to_param docs [ci skip] 2012-07-27 21:02:08 -05:00
John Firebaugh
e11348063b Don't test language-level exception messages
Ruby implementations should be free to produce exception
messages that are not identical to MRI. For example,
Rubinius produces 'Expected an even number, got 5'.
2012-07-27 12:51:12 -07:00
David Heinemeier Hansson
04998cd0c9 Add Object#try! with the old NoMethodError raising behavior 2012-07-27 12:33:02 -05:00
David Heinemeier Hansson
99ea1a875b will now return nil instead of raise a NoMethodError if the receiving object does not implement the method 2012-07-27 12:22:38 -05:00
Anatoly Makarevich
103a31391b fix typo in documentation 2012-07-26 22:44:36 +04:00
Francesco Rodriguez
12ae9d618e fixing :nodoc:s in AS::JSON::Encoding 2012-07-21 16:38:02 -05:00
Rafael Mendonça França
f5d0e3d760 +"foo"+ doesn't generate code tag [ci skip] 2012-07-21 14:12:01 -03:00
Rafael Mendonça França
f1a317b8e9 Lets be consistent with whitespaces at documentation 2012-07-21 14:05:19 -03:00
Xavier Noria
db4fdb58ef makes a pass over the API of ActiveSupport::HashWithIndifferentAccess 2012-07-21 13:03:19 +02:00
Xavier Noria
98f4aee8da Hash#fetch(fetch) is not the same as doing hash[key] 2012-07-21 08:04:37 +02:00
Piotr Niełacny
b0ab8dc0b2 Use join without default separator
Use lstrip method
2012-07-20 08:16:58 +02:00
Aaron Patterson
e482100d6e Revert "Merge pull request #7084 from LTe/logger_default_separator"
This reverts commit c08f30ff5fcda7e07cd9275a073acb2091e4b3f7, reversing
changes made to e243a8a32eb4c8777f07ca4b974bd7e38d9477d3.
2012-07-18 13:32:21 -07:00
Piotr Niełacny
dc97a9a9dd Don't use default separator
When the default separator is set logger will create incorrect output
2012-07-18 09:44:45 +02:00
kennyj
414008f98e Fix class_eval without __FILE__ and __LINE__. 2012-07-18 01:16:55 +09:00