Commit Graph

49625 Commits

Author SHA1 Message Date
Sean Griffin
f1a0fa9e19 Refactor microsecond precision to be database agnostic
The various databases don't actually need significantly different
handling for this behavior, and they can achieve it without knowing
about the type of the object.

The old implementation was returning a string, which will cause problems
such as breaking TZ aware attributes, and making it impossible for the
adapters to supply their logic for time objects.
2015-02-10 11:55:59 -07:00
Rafael Mendonça França
f926c1c953 Merge pull request #18860 from alex-handley/enhancement/dependent_documentation_fix
Documentation Fix: Corrects explanation of what happens when dependent is not set
2015-02-10 15:15:30 -02:00
Sean Griffin
2f8c596d1b Maintain a consistent order in ActiveRecord::Base#attributes
Fixes #18871
2015-02-10 08:21:46 -07:00
Robin Dupret
d89912b9be Merge pull request #18808 from carlosramireziii/i18n-doc-update
Document lazy lookup behavior for controllers [ci skip]
2015-02-10 15:59:45 +01:00
Sean Griffin
a2c80a8945 Change LockingType to use DelegateClass
Significantly faster than `SimpleDelegator`.
2015-02-09 10:28:54 -07:00
Rafael Mendonça França
20649697ce Merge pull request #18841 from yuki24/remove-warning-from-av-tags-translator
Remove warning from ActionView::Helpers::Tags::Translator
2015-02-09 13:38:19 -02:00
Sean Griffin
bae903440d Merge pull request #18849 from kamipo/array_type_is_a_part_of_sql_type
An array type is a part of `sql_type`
2015-02-09 08:29:10 -07:00
Alex Handley
577a7c6dd1 [ci skip] corrects documentation for the default dependent behaviour
By default the foreign key will remain set with the parent id after
destroy is fired.
2015-02-09 14:15:39 +00:00
Yves Senn
8ba7548877 tests, reset global to previous value.
The default of the global might change. It's better to reset it to
what it was than a hardcoded value.
2015-02-09 10:41:37 +01:00
Yves Senn
c6a36ef9af Merge pull request #18839 from yuki24/remove-warning-from-generators-named-base-test
Remove warning from generator named base test
2015-02-09 10:39:30 +01:00
Yves Senn
300631e08f Merge pull request #18840 from yuki24/remove-warning-from-plugin-generator
Remove warning from Plugin Generator
2015-02-09 10:33:49 +01:00
Yuki Nishijima
f5c27446bf Remove warning from generator named base test
This removes the following warning:

  railties/test/generators/named_base_test.rb:9: warning: method redefined; discarding old pluralize_table_names
  activesupport/lib/active_support/core_ext/class/attribute.rb:86: warning: previous definition of pluralize_table_names was here
  railties/test/generators/named_base_test.rb:9: warning: method redefined; discarding old pluralize_table_names=
  activesupport/lib/active_support/core_ext/class/attribute.rb:83: warning: previous definition of pluralize_table_names= was here
2015-02-08 17:09:12 -08:00
Yuki Nishijima
6b76c2e280 Remove warning from ActionView::Helpers::Tags::Translator
This removes the following warning:

    /GitHub/rails/actionview/lib/action_view/helpers/tags/translator.rb:19: warning: private attribute?
2015-02-08 16:00:19 -08:00
Andrew White
b6dd0c4dde Merge pull request #18764 from tsun1215/master
Explicitly ignored wildcard verbs from head_routes
2015-02-08 23:50:16 +00:00
Yuki Nishijima
39af02aa3c Remove warning from Plugin Generator
This removes the following warning:

  rails/railties/lib/rails/generators/rails/plugin/plugin_generator.rb:321: warning: shadowing outer local variable - content
2015-02-08 15:45:38 -08:00
Terence Sun
b9c63b0aae Explicitly ignored wildcard verbs from head_routes
In match_head_routes, deleted the routes in which request.request_method was empty (matches all HTTP verbs) when responding to a HEAD request. This prevents catch-all routes (such as Racks) from intercepting the HEAD request.

Fixes #18698
2015-02-08 12:03:56 -05:00
Carlos Antonio da Silva
de9a3748c4 Move #18833 changelog to the top [ci skip] 2015-02-08 11:52:47 -02:00
Carlos Antonio da Silva
f636ab75f1 Remove debug code
Added by 101c19f55f5f1d86d35574b805278f11e9a1a48e.
2015-02-08 11:51:22 -02:00
Andrew White
00222bc22a Merge pull request #18850 from kamipo/fix_rounding_problem_for_postgresql_timestamp_column
Fix rounding problem for PostgreSQL timestamp column
2015-02-08 13:41:22 +00:00
Ryuta Kamizono
f983912037 Fix rounding problem for PostgreSQL timestamp column
If timestamp column have the precision, it need to format according to
the precision of timestamp column.
2015-02-08 22:22:55 +09:00
Andrew White
31fafe0a32 Merge pull request #18602 from kamipo/respect_database_charset_and_collation
Respect the database default charset for `schema_migrations` table.
2015-02-08 13:12:01 +00:00
Andrew White
b1e6794238 Merge pull request #18848 from kamipo/add_auto_increment_method
Add `auto_increment?` instead of `extra == 'auto_increment'`
2015-02-08 13:07:53 +00:00
Andrew White
b7e592bd3b Merge pull request #18851 from kamipo/remove_unused_line
Remove unused line
2015-02-08 12:55:27 +00:00
Abdelkader Boudih
d7dad950eb Merge pull request #18852 from kamipo/missing_at
Missing `@` [ci skip]
2015-02-08 12:33:28 +00:00
Ryuta Kamizono
2abde96002 Missing @ [ci skip] 2015-02-08 20:23:46 +09:00
Ryuta Kamizono
1f39b731c1 Remove unused line 2015-02-08 20:14:07 +09:00
Ryuta Kamizono
b199012c4f An array type is a part of sql_type
`sql_type` is reused in `lookup_cast_type`. If making it a part of
`sql_type` when handled array option first, it isn't necessary to do
again.
2015-02-08 19:09:04 +09:00
Ryuta Kamizono
3bd83f016c Add auto_increment? instead of extra == 'auto_increment' 2015-02-08 18:27:35 +09:00
Ryuta Kamizono
0bbff5ee16 Respect the database default charset for schema_migrations table.
The charset of `version` column in `schema_migrations` table is depend
on the database default charset and collation rather than the encoding
of the connection.
2015-02-08 11:19:33 +09:00
Sean Griffin
1492e83e49 rm Type#number?
This predicate is only used in `query_attribute`, and is relatively easy
to remove without adding a bunch of is a checks.
2015-02-07 17:36:22 -07:00
Sean Griffin
16629c099c rm Type#text?
This predicate was only to figure out if it's safe to do case
insensitive comparison, which is only a problem on PG. Turns out, PG can
just tell us whether we are able to do it or not. If the query turns out
to be a problem, let's just replace that method with checking the SQL
type for `text` or `character`. I'd rather not burden the type objects
with adapter specific knowledge.

The *real* solution, is to deprecate this behavior entirely. The only
reason we need it is because the `:case_sensitive` option for
`validates_uniqueness_of` is documented as "this option is ignored for
non-strings". It makes no sense for us to do that. If the type can't be
compared in a case insensitive way, the user shouldn't tell us to do
case insensitive comparison.
2015-02-07 17:23:30 -07:00
Sean Griffin
c4ef73affd Move non-type objects into the Type::Helpers namespace
The type code is actually quite accessible, and I'm planning to
encourage people to look at the files in the `type` folder to learn more
about how it works. This will help reduce the noise from code that is
less about type casting, and more about random AR nonsense.
2015-02-07 14:34:46 -07:00
Sean Griffin
7e93e33c19 rm ActiveRecord::Type::Decorator
It only existed to make sure the subclasses of `Delegator` were YAML
serializable. As of Ruby 2.2, these are YAML dumpable by default, as it
includes
2a4d9568f7
2015-02-07 14:10:58 -07:00
Sean Griffin
631707a572 Push multi-parameter assignement into the types
This allows us to remove `Type::Value#klass`, as it was only used for
multi-parameter assignment to reach into the types internals. The
relevant type objects now accept a hash in addition to their previous
accepted arguments to `type_cast_from_user`. This required minor
modifications to the tests, since previously they were relying on the
fact that mulit-parameter assignement was reaching into the internals of
time zone aware attributes. In reaility, changing those properties at
runtime wouldn't change the accessor methods for all other forms of
assignment.
2015-02-07 13:52:23 -07:00
Rafael Mendonça França
bdeeca84e3 Merge pull request #18842 from yuki24/simplify-NameError#missing_name
NameError#missing_name? can just use NameError#name if the arg is a Symbol
2015-02-07 15:31:08 -02:00
Rafael Mendonça França
70693f08d0 Merge pull request #18574 from aditya-kapoor/silent-actionmailer-tests
remove noise from AM tests
2015-02-07 15:29:14 -02:00
Xavier Noria
ae3e3624c2 Merge pull request #18835 from jtmkrueger/master
Use the Rails favicon.ico instead of the ruby favicon.ico for rails guides [ci skip]
2015-02-07 13:28:02 +01:00
Yuki Nishijima
ebe73abea0 NameError#missing_name? can jsut use NameError#name if the arg is a Symbol
NameError#name returns a missing name as a symbol, so if the given name
is a symbol, it doesn't have to use #missing_name to get the last constant
name in the error message.
2015-02-07 00:14:04 -08:00
Aditya Kapoor
7b58423251 remove noise from AM tests 2015-02-07 13:38:18 +05:30
Arthur Neves
b9ba90d59e Merge pull request #14252 from mcfiredrill/make-zones-map-private
make zones_map private
2015-02-06 22:49:21 -05:00
Tony Miller
89d48fb342 make zones_map private
Conflicts:
	activesupport/lib/active_support/values/time_zone.rb
2015-02-06 22:46:38 -05:00
Arthur Nogueira Neves
cdd3961e2b Merge pull request #18837 from y-yagi/fix-deprecation-warning-in-render-test
use kwargs instead of xhr method. refs #18771.
2015-02-06 21:44:47 -05:00
yuuji.yaginuma
37b36a48b9 use kwargs instead of xhr method. refs #18771. 2015-02-07 09:12:20 +09:00
John Krueger
85400b3384 use rails favicon.ico instead or ruby favicon.ico for rails guides 2015-02-06 15:59:30 -07:00
Rafael Mendonça França
5f5f3a8216 Add link to the show action in the getting started
[ci skip]

Closes #16538
2015-02-06 20:47:39 -02:00
Rafael Mendonça França
4afb55f4e7 Merge pull request #18834 from mfazekas/fix-i18-for-openstruct
Fixed undefined method `i18n_key' for nil:NilClass for labels in non AR ...
2015-02-06 20:22:42 -02:00
Miklos Fazekas
be0875f458 Fixed undefined method `i18n_key' for nil:NilClass for labels in non AR form_for
Refactoring at #18647 broke using non active record objects in form_for. This patch
restores the original behaviour where we only compute i18 key when object.respond_to?(:to_model)
2015-02-06 22:44:48 +01:00
Sean Griffin
254693a39c Document the usage of the default option to attribute 2015-02-06 13:47:51 -07:00
Sean Griffin
009e3d0b29 A symbol can be passed to attribute, which should be documented 2015-02-06 13:44:40 -07:00
Sean Griffin
d2db321360 Grammar and RDoc formatting 2015-02-06 13:40:09 -07:00