Commit Graph

48590 Commits

Author SHA1 Message Date
Guillermo Iguaran
122f55ced1 Merge pull request #18194 from claudiob/remove-action-controller-model-naming
Remove ActionController::ModelNaming
2014-12-25 23:56:35 -05:00
Zachary Scott
b273c04f15 Add example to get Errored test to pass in Testing guide [ci skip] 2014-12-25 12:21:35 -05:00
Matthew Draper
d8e0b8ab55 Merge pull request #18196 from PavelPenkov/rails_env_instead_of_rails
Check for Rails.env instead of Rails
2014-12-26 00:47:19 +10:30
Pavel Penkov
290e8e117f Check for Rails.env instead of Rails
`Rails` constant is added by rails-html-sanitizer leading to bugs in
non-Rails apps using ActiveRecord and ActionMailer
2014-12-25 16:34:28 +03:00
claudiob
4761d81923 Remove ActionController::ModelNaming
The methods in these modules are not used anywhere. They used to be
invoked in polymorphic_routes.rb but their usage was removed in e821045.

What is your opinion about removing these methods?

They do belong to the public API, but in reality their code has already been duplicated to ActionView::ModelNaming, since they are used by methods like `dom_id` and `dom_class` to associated records with DOM elements (in
ActionView).

Please tell me if you think that removing this module is a good idea and,
in that case, if the PR is okay as it is, or you'd rather start by showing
a deprecation message, and remove the module in Rails 5.1.
2014-12-25 00:30:46 +01:00
Zachary Scott
a2059068c0 Merge pull request #18185 from ivalkeen/add_missing_guides
List the Active Support Instrumentation guide in the index (as WIP)
2014-12-24 16:05:56 -05:00
Zachary Scott
269a2ea08d Correct grammar to fix #18182 [ci skip] 2014-12-24 16:02:01 -05:00
Zachary Scott
e9fd0e9d76 Merge pull request #18190 from ef718/master
Fix grammar in Caching with Rails docs
2014-12-24 15:05:18 -05:00
Elaine Fang
6968ef44e2 Update grammar [ci skip] 2014-12-24 15:01:06 -05:00
Robin Dupret
ef7e440c97 Fix a few typos [ci skip] 2014-12-24 19:56:00 +01:00
Ivan Tkalin
128b0a1d10 List the Active Support Instrumentation guide in the index (as WIP) 2014-12-24 17:47:56 +01:00
Arun Agrawal
5bf56b77c3 Merge pull request #18183 from danbernier/master
Fix bug in ActionMailer guide.
2014-12-24 17:37:21 +01:00
Dan Bernier
65158a6701 Fix bug in ActionMailer guide.
When setting a mailer's default from address, you have to pass a hash
with a `:from` key; you can't pass just an email address.
2014-12-24 16:12:47 +00:00
Sean Griffin
dbdb104076 Merge pull request #18107 from mkdynamic/add-reply-to-mail-to
Add support for Reply-To field in mail_to helper
2014-12-24 07:10:53 -07:00
Sean Griffin
199390f337 Merge pull request #18180 from vipulnsward/remove-unnecessary-name-passing
Removed unused parameter to cookie serialize method
2014-12-24 07:09:10 -07:00
Vipul A M
7b2728cac1 - Removed unused parameter to cookie serialize method and fixed usage of the same elsewhere 2014-12-24 18:45:55 +05:30
Sean Griffin
5a2d85be4d Merge pull request #18159 from M7/docs-active_record-update_query_method_docs_with_full_description
Describe full behaviour of Active Record's attribute query methods
2014-12-23 17:42:29 -07:00
Michael D.W. Prendergast
c9d86d4148 Clarify that query methods have a custom definition of whether a numeric value is present. [ci skip]
The way Active Record query methods handle numeric values is a special case, and is not part of Rails's standard definition of present. This update attempts to make this more clear in the docs, so that people don't expect Object#present? to return false if used on a number that is zero.
2014-12-23 19:32:49 -05:00
Xavier Noria
6dd4c04b71 removes superfluous regexp group 2014-12-23 23:51:42 +01:00
Xavier Noria
7702974281 warn about reading guides in GitHub
References #18148.
2014-12-23 23:32:50 +01:00
Xavier Noria
f2bdca3bf9 third test to warn against reading guides in GitHub 2014-12-23 23:24:06 +01:00
Xavier Noria
82180f4ebd second test to warn against reading guides in GitHub 2014-12-23 23:18:51 +01:00
Xavier Noria
5a877d504e proof of concept, need to check in GitHub 2014-12-23 23:00:27 +01:00
Sean Griffin
a862c39b88 Merge pull request #18174 from bogdan/cleanup_has_many_though_association_count
Remove unneeded special case to calculate size for has_many :through
2014-12-23 13:54:34 -07:00
Bogdan Gusiev
d03da5948c Remove unneeded special case to calculate size for has_many :through
All cases are properly handled in CollectionAssociation
for all subclasses of this association
2014-12-23 21:28:41 +02:00
Sean Griffin
a0e34619b8 Merge pull request #18170 from tgxworld/add_docs_for_rails_application_secrets
[ci skip]
2014-12-23 09:44:12 -07:00
Sean Griffin
e35221cfd9 Don't treat nil as changed in serialized types
We were ignoring the `default_value?` escape clause in the serialized
type, which caused the default value to always be treated as changed.

Fixes #18169
2014-12-23 09:40:01 -07:00
Guo Xiang Tan
2f7b72b793 Rails::Application#secrets should be documented. 2014-12-24 00:32:31 +08:00
Sean Griffin
d26704a15f Refactor a common class to reduce the duplication for references
The code for `TableDefinition#references` and
`SchemaStatements#add_reference` were almost identical both
structurally, and in terms of domain knowledge. This removes that
duplication into a common class, using the `Table` API as the expected
interface of its collaborator.
2014-12-23 09:20:54 -07:00
Sean Griffin
affae7d904 Fix syntax warning
This isn't Seattle.rb, @senny. ;)
2014-12-23 09:13:56 -07:00
Sean Griffin
c81a74c972 Merge pull request #18167 from al2o3cr/checkin_connection_leak
Fix connection leak when a thread checks in additional connections.
2014-12-23 08:37:33 -07:00
Sean Griffin
21289bed3b Merge pull request #18166 from merongivian/search_field_refactor
Remove block from super
2014-12-23 08:37:17 -07:00
Matt Jones
5e024070ab Fix connection leak when a thread checks in additional connections.
The code in `ConnectionPool#release` assumed that a single thread only
ever holds a single connection, and thus that releasing a connection
only requires the owning thread_id.

There is a trivial counterexample to this assumption: code that checks
out additional connections from the pool in the same thread. For
instance:

    connection_1 = ActiveRecord::Base.connection
    connection_2 = ActiveRecord::Base.connection_pool.checkout
    ActiveRecord::Base.connection_pool.checkin(connection_2)
    connection_3 = ActiveRecord::Base.connection

At this point, connection_1 has been removed from the
`@reserved_connections` hash, causing a NEW connection to be returned as
connection_3 and the loss of any tracking info on connection_1. As long
as the thread in this example lives, connection_1 will be inaccessible
and un-reapable. If this block of code runs more times than the size of
the connection pool in a single thread, every subsequent connection
attempt will timeout, as all of the available connections have been
leaked.

Reverts parts of 9e457a8654fa89fe329719f88ae3679aefb21e56 and
essentially all of 4367d2f05cbeda855820e25a08353d4b7b3457ac
2014-12-23 09:54:52 -05:00
Jose Añasco
96f0aad6ec Remove block from super 2014-12-23 09:38:44 -05:00
Sean Griffin
e550bbf8fc Changelog for 99a6f9e60ea55924b44f894a16f8de0162cf2702
Here you go, @senny. 😁
2014-12-23 07:21:43 -07:00
Sean Griffin
b994c0e03d Merge pull request #18145 from georgemillo/patch-2
Add information about "allow_destroy" requiring an ID. [ci skip]
2014-12-23 07:17:01 -07:00
Sean Griffin
a054269ff8 Merge Pull Request #18157
Conflicts:
	activerecord/CHANGELOG.md
2014-12-23 07:13:54 -07:00
Yves Senn
b5bfd6fe52 docs, replace ` with + for proper rdoc output. [ci skip] 2014-12-23 13:36:13 +01:00
Yves Senn
ad783136d7 Replace deprecated #load_schema with #load_schema_for. 2014-12-23 12:07:15 +01:00
George Millo
7476b90e16 Add information about "allow_destroy" requiring an ID. [ci skip]
I just wasted an absurd amount of time trying to figure out why my model
wasn't being deleted even though I was setting `_destroy` to true like
the instructions said. Making the documentation a little bit clear so
that someone like me doesn't waste their time in future.
2014-12-23 10:18:02 +00:00
Yves Senn
0587070391 cleanup CHANGELOGs. [ci skip] 2014-12-23 08:56:17 +01:00
Yves Senn
d56b766056 Merge pull request #18162 from romaimperator/master
Fixing numeric attrs when set to same negative value
2014-12-23 08:52:40 +01:00
Yves Senn
ced687fe71 Merge pull request #18163 from y-yagi/fix_nodoc_typo
fix typo in nodoc [ci skip]
2014-12-23 08:42:51 +01:00
yuuji.yaginuma
2a110fcfc8 fix typo in nodoc 2014-12-23 16:03:17 +09:00
Michael D.W. Prendergast
e35432689e Clarify that the word present refers to Object#present?. [ci skip]
Update Active Record's attribute query methods documentation to clarify that whether an attribute is present is based on Object#present?. This gives people a place to go see what the exact definition of presence is. [ci skip]
2014-12-23 01:54:40 -05:00
Daniel Fox
2859341c38 Fixing numeric attrs when set to same negative value
This bug occurs when an attribute of an ActiveRecord model is an
ActiveRecord::Type::Integer type or a ActiveRecord::Type::Decimal type (or any
other type that includes the ActiveRecord::Type::Numeric module. When the value
of the attribute is negative and is set to the same negative value, it is marked
as changed.

Take the following example of a Person model with the integer attribute age:

    class Person < ActiveRecord::Base
      # age          :integer(4)
    end

The following will produce the error:

    person = Person.new(age: -1)
    person.age = -1
    person.changes
    => { "age" => [-1, -1] }
    person.age_changed?
    => true

The problematic line is here:

    module ActiveRecord
      module Type
        module Numeric
          ...

          def non_numeric_string?(value)
            # 'wibble'.to_i will give zero, we want to make sure
            # that we aren't marking int zero to string zero as
            # changed.
            value.to_s !~ /\A\d+\.?\d*\z/
          end
        end
      end
    end

The regex match doesn't accept numbers with a leading '-'.
2014-12-23 00:19:14 -06:00
Sean Griffin
38e9f5b1d8 Merge pull request #18158 from YayConnolly/master
Describe gotcha for 'status' option [ci skip]
2014-12-22 21:30:09 -07:00
Michael D.W. Prendergast
0ce7840b9b Update Active Record's attribute query methods documentation to describe its full behaviour. [ci skip] 2014-12-22 22:28:45 -05:00
J Connolly
2ad466b867 Describe gotcha for 'status' option [ci skip] 2014-12-22 19:04:57 -08:00
Grey Baker
d318badc26 Don't raise on out-of-range datetimes passed by a user 2014-12-23 02:35:12 +00:00