Commit Graph

32268 Commits

Author SHA1 Message Date
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
José Valim
11bc3487ab Remove allow_concurrency as a flag
The flag was mainly used to add a Rack::Lock middleware to
the stack, but the only scenario the lock is desired is in
development.

If you are deploying on a not-threaded server, the Rack::Lock
does not provide any benefit since you don't have concurrent
accesses. On the other hand, if you are on a threaded server,
you don't want the lock, since it defeats the purpose of using
a threaded server.

If there is someone out there, running on a thread server
and does want a lock, it can be added to your environment
as easy as: `use Rack::Lock`
2012-08-21 14:46:12 -03:00
José Valim
e6747d87f3 Allow users to choose when to eager_load the application or not.
Previously, the eager load behavior was mostly coupled to
config.cache_classes, however this was suboptimal since in
some environments a developer may want to cache classes but
not necessarily load them all on boot (for example, test env).

This pull request also promotes the use of config.eager_load
set to true by default in production. In the majority of the
cases, this is the behavior you want since it will copy most
of your app into memory on boot (which was also the previous
behavior).

Finally, this fix a long standing Rails bug where it was
impossible to access a model in a rake task when Rails was
set as thread safe.
2012-08-21 14:46:12 -03:00
Rafael Mendonça França
df1a5e492a Merge pull request #5210 from Pliny/masteri
Fix for #5200
2012-08-21 14:10:36 -03:00
Dave Desrochers
ff0d9b93b9 reset_counters() was crashing when there were multiple belongs_to associations with the same foreign key.
This closes #5200.
2012-08-21 14:10:11 -03:00
Rafael Mendonça França
684a040437 Add CHANGELOG entry for #7410 2012-08-21 13:43:43 -03:00
Rafael Mendonça França
ce0dd56183 Merge pull request #7410 from sandeepravi/default_options_helper_value
option_tags coerced to "" instead of nil

Closes #7404
2012-08-21 09:37:13 -07:00
Sandeep
99322266b8 option_tags coerced to "" instead of nil 2012-08-21 21:59:05 +05:30
Rafael Mendonça França
5c4fe858d7 Merge pull request #7409 from kennyj/refactor_activerecord_result
Refactor AR::Result or inherits. Because we have redundant codes about column_types.
2012-08-21 09:28:56 -07:00
kennyj
5e47ba0a85 Refactor AR::Result or inherits. Because we have redundant codes about 2012-08-22 01:23:40 +09:00
Carlos Antonio da Silva
8c600e45cd Merge pull request #7408 from yahonda/sqlmode_mysql
Change mysql tests for strict mode disabled to work with new sql_mode default in MySQL 5.6.6-m9.

Since this MySQL version, the sql_mode default value is `NO_ENGINE_SUBSTITUTION`.
2012-08-21 09:01:31 -07:00
Yasuo Honda
babc24c1b0 Rename to test_mysql_strict_mode_disabled_dont_override_global_sql_mode
Reason since MySQL 5.6.6-m9 the `sql_mode` default value is
`NO_ENGINE_SUBSTITUTION`.
This default parameter change is out of control from Rails.

This test verifies Rails not overriding the default `@@GLOBAL.sql_mode` value
by checking if `@@GLOBAL.sql_mode` is the same as `@@SESSION.sql_mode`.
2012-08-22 00:56:23 +09:00
Rafael Mendonça França
7e68e8bcc7 Merge pull request #7406 from janko-m/documentation_fixes
Fixed some documentation mistakes
2012-08-21 08:04:19 -07:00
Janko Marohnić
2033db171a Fix documentation mistakes 2012-08-21 16:58:34 +02:00
Rafael Mendonça França
ace0692528 Merge pull request #7000 from kennyj/fix_6697-3
Use instance_accessor: false instead of instance_writer.
2012-08-21 07:50:35 -07:00
kennyj
57bef99073 Use instance_accessor: false instead of instance_writer. 2012-08-21 23:40:28 +09:00
Rafael Mendonça França
55d943c567 Add CHANGELOG entry for #6986 2012-08-21 10:18:10 -03:00
Rafael Mendonça França
245fb737db Merge pull request #6986 from kennyj/fix_6975
Fix #6975. Round usec when writing timestamp attribute.
2012-08-21 10:14:00 -03:00
kennyj
e9d2ad395e Round usec when writing timestamp attribute. 2012-08-21 10:12:13 -03:00
Carlos Antonio da Silva
15e2b80a27 Minor refactoring in Active Record model schema methods
* Use each_key instead of generating intermediate keys array.
* Use each_with_object instead of inject to build hash.
* Use ternary to return instead of if + assignment.
2012-08-21 00:50:43 -03:00
Aaron Patterson
e7ffa77932 removing dead code 2012-08-20 16:12:59 -07:00
Aaron Patterson
f734ec4807 define singleton methods rather than adding and removing methods 2012-08-20 16:12:09 -07:00
Aaron Patterson
79d21dddd6 remove dead code 2012-08-20 15:32:50 -07:00
Aaron Patterson
503bee0111 initialize instance variables for transactions to remove conditionals 2012-08-20 15:08:49 -07:00
Aaron Patterson
075b91454b This method is useless without a block, so remove test 2012-08-20 15:08:49 -07:00
Aaron Patterson
a4697b0cc3 remove unused variable 2012-08-20 15:08:49 -07:00
Aaron Patterson
73eeb51ea5 initialize instance variables to avoid conditionals 2012-08-20 15:08:48 -07:00
Aaron Patterson
d0d4ef6e8b fix whitespace errors 2012-08-20 15:08:48 -07: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
Carlos Antonio da Silva
85753f13b2 Merge pull request #7401 from frodsan/fix_environments_punctuation
Fix punctuation in config templates [ci skip]
2012-08-20 10:59:48 -07:00
Francesco Rodriguez
bb05d99106 fix punctuation in config templates 2012-08-20 11:57:16 -05:00
Pratik Naik
6a5d1c765f Make sure :via works with mount 2012-08-20 10:25:23 -05:00
Rafael Mendonça França
6904af1db2 Merge pull request #7396 from tomykaira/cleanup_test
Access @rs only through attr_accessor
2012-08-20 06:14:50 -07:00
tomykaira
503c1c04ad Access @rs only through attr_accessor 2012-08-20 21:47:00 +09: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
Carlos Antonio da Silva
7a8aee08b6 Remove private verify readonly attr method
This method was added to be shared between update_attribute and
update_column in 50725cec397d4fa0ecf1dda4e6ae845a993f1ba7, but since
update_attribute was removed, and update_column has changed to delegate
to update_columns, the method is not used anywhere anymore.

Also remove "key.to_s" conversion when raising readonly error, since
the key is being interpolated.
2012-08-19 17:24:12 -03:00
Xavier Noria
30f091b35a no need for AS::Dependencies.(hook!|unhook!) to return anything in particular 2012-08-19 21:33:58 +02:00
Rafael Mendonça França
1dbf1c80ac Merge pull request #7392 from ernie/real-fix-for-last-equality-wins-in-merge
Fix "last equality wins" logic in relation merge
2012-08-19 08:28:57 -07:00
Ernie Miller
bf80522be4 Fix "last equality wins" logic in relation merge
This is a real fix (as compared to the band-aid in b127d86c), which uses
the recently-added equality methods for ARel nodes. It has the side
benefit of simplifying the merge code a bit.
2012-08-19 08:06:31 -04:00
Carlos Antonio da Silva
f9fc26e800 Merge pull request #7377 from brainopia/use_inversed_parent_for_first_and_last_child
Use inversed parent for first and last child of has_many association
2012-08-18 18:11:11 -07:00
Rafael Mendonça França
af26adcffb Merge pull request #7390 from aantix/add_x_content_type_options_to_default_headers
Added X-Content-Type-Options to the header defaults.
2012-08-18 15:36:32 -07:00
Jim Jones
4848bf321b Added X-Content-Type-Options to the header defaults.
With a value of "nosniff", this prevents Internet Explorer from MIME-sniffing a response away from the declared content-type.
2012-08-18 15:29:58 -07:00
brainopia
c9c5566ace Use inversed parent for first and last child of has_many association 2012-08-18 18:11:28 +04:00
Carlos Antonio da Silva
db78e58294 Merge branch 'multiparameter-attributes-refactor'
Refactor multiparameter attributes assignment implementation.
2012-08-18 10:01:11 -03:00
Carlos Antonio da Silva
ec01242a21 Get rid of some arguments by using the accessors
Cleans up a lot of noise from arguments being passed from one method to
another.
2012-08-18 09:55:38 -03:00
Carlos Antonio da Silva
ec31680106 Move multiparameter attribute logic to a class
This should make it easier to refactor and improve this code, and remove
complexity with params going around here and there.
2012-08-18 09:55:38 -03:00
Carlos Antonio da Silva
95f6b1245d Some more cleanup to use Hash#values_at, and some method docs 2012-08-18 09:55:37 -03:00
Carlos Antonio da Silva
022d7b3846 Use cached column information to instantiate time object 2012-08-18 09:55:37 -03:00