Commit Graph

41738 Commits

Author SHA1 Message Date
Andrew White
3a48b83e5e Allow an absolute controller path inside a module scope
Fixes #12777
2014-01-05 19:58:04 +00:00
Andrew White
a1564d470d Add CHANGELOG entry for #10634 [ci skip] 2014-01-05 19:23:53 +00:00
Andrew White
ffc273577a Merge pull request #10634 from teleological/time_advance_gregorian
Maintain proleptic gregorian in Time#advance
2014-01-05 11:19:00 -08:00
Rafael Mendonça França
6e867a4dfe Merge pull request #13598 from zirni/remove_ar_warnings
Remove method redefined warnings for test suite

Closes #13526
2014-01-05 09:24:34 -08:00
Matthias Zirnstein
bf556880f2 Remove method redefined warnings for test suite
has_many definitions with "name" as singular and as plural e.g.
  has_many :welcome_posts_with_comment
  has_many :welcome_posts_with_comments

Ruby mentions it with:

lib/active_record/associations/builder/collection_association.rb:65:
  warning: method redefined; discarding old welcome_posts_with_comment_ids
lib/active_record/associations/builder/collection_association.rb:65:
  warning: previous definition of welcome_posts_with_comment_ids was here
lib/active_record/associations/builder/collection_association.rb:75:
  warning: method redefined; discarding old welcome_posts_with_comment_ids=
lib/active_record/associations/builder/collection_association.rb:75:
  warning: previous definition of welcome_posts_with_comment_ids= was here
2014-01-05 18:18:07 +01:00
Gaelian Ditchburn
7a085dac2a Switched to use display:none in extra_tags_for_form method.
The use of `display:inline` with the content_tag call in the
extra_tags_for_form method potentially causes display issues with some
browsers, namely Internet Explorer. IE's behaviour of not collapsing
the line height on divs with ostensibly no content means that the
automatically added div containing the hidden authenticity_token, utf8
and _method form input tags may interfere with other visible form
elements in certain circumstances. The use of `display:none` rather
than `display:inline` fixes this problem.

Fixes #6403
2014-01-05 17:16:22 +00:00
Andrew White
6b54883082 Unique the segment keys array for non-optimized url helpers
In Rails 3.2 you only needed pass an argument for dynamic segment once so
unique the segment keys array to match the number of args. Since the number
of args is less than required parts the non-optimized code path is selected.
This means to benefit from optimized url generation the arg needs to be
specified as many times as it appears in the path.

Fixes #12808
2014-01-05 11:57:50 +00:00
Andrew White
892c539591 Show full route constraints in error message
When an optimized helper fails to generate, show the full route constraints
in the error message. Previously it would only show the contraints that were
required as part of the path.

Fixes #13592
2014-01-05 10:27:46 +00:00
Andrew White
b9efc74f9e Simplify arg parameterization 2014-01-05 08:43:12 +00:00
Andrew White
d017e92e1d Use a custom route vistor for optimized route generation
Using a Regexp to replace dynamic segments in a path string is fraught
with difficulty and can lead to odd edge cases like #13349. Since we
already have a parsed representation of the path it makes sense to use
that to generate an array of segments that can be used to build an
optimized route's path quickly.

Tests on a simple route (e.g. /posts/:id) show a speedup of 35%:
https://gist.github.com/pixeltrix/8261932

Calculating -------------------------------------
    Current Helper:       5274 i/100ms
    New Helper:           8050 i/100ms
-------------------------------------------------
    Current Helper:     79263.6 (±3.7%) i/s -     395550 in   4.997252s
    New Helper:        153464.5 (±4.9%) i/s -     772800 in   5.047834s

Tests on a more complex route show even an greater performance boost:
https://gist.github.com/pixeltrix/8261957

Calculating -------------------------------------
    Current Helper:       2367 i/100ms
    New Helper:           5382 i/100ms
-------------------------------------------------
    Current Helper:     29506.0 (±3.2%) i/s -     149121 in   5.059294s
    New Helper:         78815.5 (±4.1%) i/s -     398268 in   5.062161s

It also has the added benefit of fixing the edge cases described above.

Fixes #13349
2014-01-05 00:36:25 +00:00
Rafael Mendonça França
339ce7fe9d Merge pull request #13590 from kuldeepaggarwal/fix-date-helper-doc
provide correct example of `datetime_select` helper [ci skip]
2014-01-04 11:21:53 -08:00
Andrew White
3713e43366 Add preview_path to autoload_paths in after_initialize
Only config.autoload_paths is frozen, so add the preview_path
to ActiveSupport::Dependencies.autoload_paths directly in an
after_initialize block. Also protect against a blank preview_path
being added to autoload_paths which can cause a serious slowdown
as Dir[] tries to load all *_preview.rb files under /

Fixes #13372
2014-01-04 18:42:34 +00:00
Kuldeep Aggarwal
e9bfeb0c79 provide correct example of datetime_select helper [ci skip] 2014-01-04 23:59:20 +05:30
Robin Dupret
81066b1158 Merge pull request #13587 from kud86/change_truncate_examples
Fixed truncate documentation. [ci skip]
2014-01-04 04:04:12 -08:00
Konstantin Wlasow
9882ec4a50 Fixed documentation. [ci skip] 2014-01-04 16:18:16 +06:00
Jon Leighton
27bcec28bf Fix mergefail in changelog
The line was duplicated
2014-01-04 09:30:01 +00:00
Jon Leighton
9ea54b2d8e Add deprecation I accidentally missed 2014-01-04 09:29:20 +00:00
Xavier Noria
77d18edf0d Merge pull request #13584 from tjschuck/cannot_cannot_be_can_not
Change all "can not"s to the correct "cannot"
2014-01-03 14:37:04 -08:00
T.J. Schuck
72bb3fc297 Change all "can not"s to the correct "cannot". 2014-01-03 17:02:31 -05:00
Guillermo Iguaran
88c3fd1ef1 Merge pull request #13583 from arthurnn/mem_cache_store_fix
mem_cache_store requires dalli, so only accept dalli/client
2014-01-03 13:43:16 -08:00
Arthur Neves
e7f56a7fe8 Raise if MemCacheStore doenst receive a Dalli obj
:mem_cache_store should receive a list of hosts or a dalli client,
otherwise raise it.
Also adding a changelog.
2014-01-03 16:39:50 -05:00
Robin Dupret
05a81c5fe2 Minor typo fix [ci skip] 2014-01-03 22:33:21 +01:00
Rafael Mendonça França
19b2188e6c Merge pull request #10134 from derikson/collection_proxy_select_with_multiple_args
Change CollectionProxy#select to take the same arguments as ActiveRecord::select
2014-01-03 13:03:19 -08:00
Arthur Neves
98458eea42 mem_cache_store requires dalli, so only accept dalli/client
:mem_cache_store require dalli, rescue Dalli exceptions, and follow Dalli API.
Memcached gem, for instance, doesnt work anymore, as the API are different.

As we already require one client, we should make sure that client works, and not accept others, and if someone wants to use another memcache client they can write their own store adapter.
2014-01-03 15:39:33 -05:00
Rafael Mendonça França
f89266ace8 No need to use fixed size font [ci skip] 2014-01-03 16:42:30 -02:00
Rafael Mendonça França
0cd7b7ba3b Merge pull request #13579 from prathamesh-sonpatki/issue-13552
Fix documentation for end_year option of date_helper [ci skip]
2014-01-03 16:41:33 -02:00
Rafael Mendonça França
96c4bd69c1 Whitespace [ci skip] 2014-01-03 16:33:49 -02:00
Godfrey Chan
788bb40e38 Building new records with enum scopes now works as expected
Previously, this would give an `ArgumentError`:

   class Issue < ActiveRecord::Base
     enum :status, [:open, :finished]
   end

   Issue.open.build # => ArgumentError: '0' is not a valid status
   Issue.open.create # => ArgumentError: '0' is not a valid status

PR #13542 muted the error, but the issue remains. This commit fixes
the issue by allowing the enum value to be written directly via the
setter:

   Issue.new.status = 0 # This now sets status to :open

Assigning a value directly via the setter like this is not part of the
documented public API, so users should not rely on this behavior.

Closes #13530.
2014-01-03 09:31:01 -08:00
Prathamesh Sonpatki
2126c24af6 Fix documentation for end_year option of date_helper [ci skip]
- While editing an existing record, end_year is equal to current selected year plus 5 by default.
- While editing an existing record, start_year is equal to current selected year value minus 5 by default.
- Fixes #13552

Acked-by: Prathamesh Sonpatki <csonpatki@gmail.com>

Acked-by: Prathamesh Sonpatki <csonpatki@gmail.com>
2014-01-03 21:46:21 +05:30
Yves Senn
97e7ca48c1 Deprecate unused symbolized_base_class and symbolized_sti_name.
These methods were only used for the `IdentityMap` which was removed.
They are no longer used internally and should be removed without replacement.

As they were not `:nodoc:`'ed it's better to deprecate them before removal.
2014-01-03 16:31:20 +01:00
Rafael Mendonça França
5aa869861c Merge pull request #13578 from schneems/schneems/database_url-env-default
Use DATABASE_URL by default
2014-01-02 13:02:28 -08:00
schneems
f642b18c0e Use DATABASE_URL by default
See https://github.com/rails/rails/pull/13463#issuecomment-31480799 for full conversation.
2014-01-02 15:00:30 -06:00
Rafael Mendonça França
96288e83c1 Merge pull request #13573 from kuldeepaggarwal/doc-fix-default-values
provide correct information [ci skip]
2014-01-02 11:52:13 -08:00
Jon Leighton
d74043885a Merge pull request #13528 from jonleighton/maintain_test_schema
Automatically maintain test database schema
2014-01-02 10:05:46 -08:00
Kuldeep Aggarwal
ed62584391 provide correct information [ci skip] 2014-01-02 19:28:28 +05:30
Jon Leighton
ff7ab3bc78 Automatically maintain test database schema
* Move check from generated helper to test_help.rb, so that all
  applications can benefit
* Rather than just raising when the test schema has pending migrations,
  try to load in the schema and only raise if there are pending
  migrations afterwards
* Opt out of the check by setting
  config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
  for maintaining the test schema, so we don't need rake tasks for this.
  This is also a speed improvement since we're no longer reloading the
  test database on every call to "rake test".
2014-01-02 13:49:00 +00:00
Andrew White
a1d0c0fa3d Reverse 821525e and wrap run_generator call
Ruby 2.1.0 includes the json gem 1.8.1 by default so we need bundler 1.5.1
for `bundle install` to work. To fix this reverse the downgrade to 1.3.5
and wrap the `run_generator` call with a block that resets `THOR_DEBUG`.
2014-01-02 10:06:29 +00:00
Rafael Mendonça França
02d366842c Adding missing require 2014-01-02 00:52:47 -02:00
Rafael Mendonça França
f9d854823f Enable fast_finish in the travis configuration
Since rbx and jruby builds are being allowed to fail lets receive the
build information early enabling this option

See http://about.travis-ci.org/blog/2013-11-27-fast-finishing-builds/
2014-01-02 00:35:51 -02:00
Rafael Mendonça França
55dc36b227 Merge pull request #13569 from schneems/schneems/default-url-sub-key
Move default production database to URL sub key
2014-01-01 17:16:56 -08:00
Andrew White
821525eadc Downgrade bundler until 1.5.2 is available
Bundler sets the THOR_DEBUG environment variable causing Thor to
re-raise exceptions on exit. This is breaking the railties tests
for generators where we are trying to capture error output.

The PR bundler/bundler#2794 fixes this by adding a per-instance
config `:debug` but this has not been released yet so to prevent
errors going unnoticed downgrade bundler to 1.3.5 until such a
time that 1.5.2 has been released.
2014-01-01 23:20:57 +00:00
schneems
9749e0efbf Move default production database to URL sub key
By using the URL sub key in the `database.yml` by default we are exposing the ability to set other attributes such as `pool` or `reap_frequency` without need of modifying the URL to contain non-connection specific information.
2014-01-01 17:48:24 -05:00
Rafael Mendonça França
358abe4524 Merge pull request #13542 from robin850/issue-13530
Fix enum writers when using integers
2014-01-01 19:17:59 -02:00
Rafael Mendonça França
f141919974 Add CHANGELOG entry for #13557 [ci skip] 2014-01-01 19:08:28 -02:00
Rafael Mendonça França
a28f1c2793 Merge pull request #13557 from gmarik/patch-1
Use `Array#wrap` instead `Array()`
2014-01-01 19:04:29 -02:00
Mo Omer
6fc59d38d8 Removed elipsis indicating that the reader should have more code than what is pasted.
[ci skip]
2014-01-01 19:00:57 -02:00
Rafael Mendonça França
0b4905d0d5 Make explicit that the view file need to be created [ci skip]
Closes #13566
2014-01-01 18:57:18 -02:00
Rafael Mendonça França
a7094f5c88 Do not highlight rake routes output as ruby code [ci skip]
Closes #13565
2014-01-01 18:54:55 -02:00
Andrew White
75ad0e642c Don't lazy load the tzinfo library
Lazy loading the tzinfo library doesn't really buy us anything because
the gem is installed as a dependency via the gemspec and if a developer
is using Active Support outside of Rails then they can cherry pick which
files to load anyway.

Fixes #13553
2014-01-01 20:29:56 +00:00
Lauro Caetano
e97d48f17e Merge pull request #13563 from vipulnsward/2014-is-here
2014 is here.
2014-01-01 10:47:24 -08:00