Commit Graph

40543 Commits

Author SHA1 Message Date
Aaron Patterson
c8b566d54d use a set and reject to avoid array allocations 2013-11-06 14:11:37 -08:00
Aaron Patterson
779cd6ec61 each_with_object on the view_assigns hash 2013-11-06 13:54:15 -08:00
Aaron Patterson
9a4adb4b05 use slice to avoid range allocation 2013-11-06 13:53:52 -08:00
Aaron Patterson
697acc4025 these variables are also private 2013-11-06 13:37:24 -08:00
Aaron Patterson
32e94a488f instance_variables returns symbols, so we should use symbols in our list 2013-11-06 13:24:00 -08:00
Xavier Noria
f8e5022c73 Merge pull request #12789 from claudiob/humanize-without-capitalizing
Add +capitalize+ option to Inflector.humanize
2013-11-06 13:17:31 -08:00
claudiob
c61544c781 Add +capitalize+ option to Inflector.humanize
So strings can be humanized without being capitalized:

    'employee_salary'.humanize                    # => "Employee salary"
    'employee_salary'.humanize(capitalize: false) # => "employee salary"
2013-11-06 13:03:46 -08:00
Rafael Mendonça França
256ae7dec5 Merge pull request #12788 from kylefritz/patch-1
rdoc: favicon source shouldn't begin with a slash to reference asset pipeline resource [ci skip]
Conflicts:
	actionview/lib/action_view/helpers/asset_tag_helper.rb
2013-11-06 17:38:34 -02:00
Jeremy Kemper
0f5a36eb4c Merge pull request #12783 from chancancode/eliminate_direct_json_gem_use
Eliminate `JSON.{parse,load,generate,dump}` and `def to_json`
2013-11-06 10:26:02 -08:00
Yves Senn
aeaf3a9d00 bring back constant to expose the enum mapping as HWIA. 2013-11-06 15:27:33 +01:00
Yves Senn
02b6757797 update the AR enum docs to match the actual behavior. [ci skip] 2013-11-06 10:49:22 +01:00
Godfrey Chan
ff1192fea4 Eliminate JSON.{parse,load,generate,dump} and def to_json
JSON.{dump,generate} offered by the JSON gem is not compatiable with
Rails at the moment and can cause a lot of subtle bugs when passed
certain data structures. This changed all direct usage of the JSON gem
in internal Rails code to always go through AS::JSON.{decode,encode}.

We also shouldn't be implementing `to_json` most of the time, and
these occurances are replaced with an equivilent `as_json`
implementation to avoid problems down the road.

See [1] for all the juicy details.

[1]: intridea/multi_json#138 (comment)
2013-11-05 22:26:45 -08:00
Carlos Antonio da Silva
dcee010ce8 Fix AS changelog indent, remove tabs and extra spaces [ci skip] 2013-11-06 03:09:01 -02:00
Jeremy Kemper
aadb8c962a Merge pull request #12782 from chancancode/fix_object_and_struct_as_json
Fixed Object#as_json and Struct#as_json with options
2013-11-05 21:05:52 -08:00
Godfrey Chan
134c1156dd Fixed Object#as_json and Struct#as_json with options
These methods now takes the same options as Hash#as_json, for example:

    struct = Struct.new(:foo, :bar).new
    struct.foo = "hello"
    struct.bar = "world"
    json = struct.as_json(only: [:foo]) # => {foo: "hello"}

This is extracted from PR #11728 from @sergiocampama, see also the
discussion in #11460.
2013-11-05 19:22:03 -08:00
Yves Senn
44406d1e77 store enum mapping using Strings instead of Symbols.
This allows to assign both `String` and `Symbol` values to the enum
without having to call `to_sym`, which is a security problem.
2013-11-05 17:44:08 +01:00
Yves Senn
6c720d18a2 direct enum assignment rasies ArgumentError for unknown values. 2013-11-05 17:44:08 +01:00
Rafael Mendonça França
81a528fc0c Merge pull request #12776 from derekprior/dp-i18n-doc-fix
Clarify HTML Safe Translations
2013-11-05 08:19:37 -08:00
Derek Prior
0e41b0a87a Clarify HTML Safe Translations [ci-skip]
I think it's confusing to say "Use them in views without escaping." We
use all keys in views without escaping - the escaping is done for us
automatically _unless_ we call html_safe or the key ends in _html.
2013-11-05 11:16:04 -05:00
Yves Senn
813c8c0751 define enum methods inside a Module to make them overwritable. 2013-11-05 16:45:34 +01:00
Rafael Mendonça França
5a011409a4 Merge pull request #12390 from kennyj/rename_to_association_methods
Renamed generated_feature_methods to generated_association_methods.

Conflicts:
	activerecord/lib/active_record/associations/builder/association.rb
	activerecord/lib/active_record/associations/builder/singular_association.rb
	activerecord/test/cases/base_test.rb
2013-11-05 13:35:26 -02:00
Rafael Mendonça França
679902b916 Remove private API test 2013-11-05 13:31:31 -02:00
Guillermo Iguaran
abe300a424 Merge pull request #12773 from ptn/use_19_syntax_in_schema_test
Use 1.9 Hash syntax consistently
2013-11-05 06:53:07 -08:00
Pablo Torres
6f788b1d91 Use 1.9 Hash syntax consistently 2013-11-05 08:13:37 -05:00
Yves Senn
7d17b1dedb Merge pull request #12752 from notalex/expand_path_refactoring
Refactor File.expand_path usage to remove additional File.join
2013-11-05 01:35:28 -08:00
Alex Johnson
01ef2c1943 Refactor File.expand_path usage to remove additional File.join 2013-11-05 10:50:03 +05:30
Aaron Patterson
026d055568 ask the fixture set for the sql statements 2013-11-04 16:39:34 -08:00
Aaron Patterson
9f8762f1d5 The enum value constant isn't used, so rm it for now. 2013-11-04 15:55:29 -08:00
Aaron Patterson
238ee10c41 stop doing the same calculation over and over 2013-11-04 15:51:09 -08:00
Aaron Patterson
9104702be6 oops, template replay needs to happen after bundle. :orz: 2013-11-04 15:13:15 -08:00
Aaron Patterson
7eb586f57f application template respects Gemfile entries 2013-11-04 15:00:29 -08:00
Aaron Patterson
8beb42cfbc gems can be added or skipped from the template 2013-11-04 15:00:29 -08:00
Yves Senn
37d4bfbfd9 fix copy & paste test-case naming. [ci skip] 2013-11-04 19:22:53 +01:00
Yves Senn
9c4261351c document BACKTRACE env var usage in testing guide. [ci skip] 2013-11-04 17:43:05 +01:00
Carlos Antonio da Silva
6d540d135f Fix failures related to enum changes
Commit 6e4a810f51b9ed2468b92247ef5568cc9d6dbcc0 changed the implementation
from class_eval to define_method, but missed the access to the constant
versus the access to the constant name.
2013-11-04 13:40:16 -02:00
Carlos Antonio da Silva
28dea539e1 Convert schema file to ruby 1.9 style hash 2013-11-04 13:32:17 -02:00
Carlos Antonio da Silva
a7f3c6944d Style fixes on test schema file 2013-11-04 13:32:17 -02:00
Carlos Antonio da Silva
f669975434 Merge pull request #12755 from cbartlett/master
Remove extra whitespace
2013-11-04 07:32:03 -08:00
Carlos Antonio da Silva
d0d7555e87 Refactor logic to grab the max time of the list of timestamp names in #cache_key
Reuse the already existing logic used for grabbing this information from
the updated columns.
2013-11-04 13:14:07 -02:00
Carlos Antonio da Silva
92c6305954 Respect cache timestamp format when giving timestamps to #cache_key 2013-11-04 13:11:51 -02:00
Colin Bartlett
87205c3ca4 Remove extra whitespace
When generating an app with --skip_active_record, an extra
line of whitespace was included unnecessarily.
2013-11-04 10:06:58 -05:00
Carlos Antonio da Silva
91d72fe652 ✂️ [ci skip] 2013-11-04 13:01:57 -02:00
David Heinemeier Hansson
6e4a810f51 Merge pull request #12754 from ck3g/replace-class-evals-with-define-method-for-enum
Replace `class_eval` with `define_method` for enum
2013-11-04 06:57:37 -08:00
Carlos Antonio da Silva
b5cd187ae4 Fix typo in railties changelog
Also improve the example to show as shell command [ci skip]
2013-11-04 12:53:19 -02:00
Carlos Antonio da Silva
caf2390aee Fix changelog indent [ci skip] 2013-11-04 12:42:47 -02:00
Vitaly Tatarintsev
8264701355 Replace class_eval with define_method for enum
db41eb8a6e (commitcomment-4502683)
2013-11-04 16:42:22 +02:00
Yves Senn
84eac5dab8 BACKTRACE environment variable to show unfiltered backtraces.
We used to support the `BACKTRACE` environment variable but when
we switched to MiniTest it got removed: f9382cd7948

This commit adds back the functionality to show the unfiltered backtrace when needed.
This also works when you run your tests with `rake`:

* `BACKTRACE=1 bin/rake test`
* `BACKTRACE=1 ruby -Itest ...`
2013-11-04 10:00:44 +01:00
Guillermo Iguaran
876fd5a5d4 Merge pull request #12750 from arunagw/webconsole-invite-only
Not adding webconsole by default in new apps
2013-11-03 13:20:28 -08:00
Arun Agrawal
fae08dd9ca No web-console for now 2013-11-03 22:19:17 +01:00
David Heinemeier Hansson
2b66f556ed Line up the comments for aesthetics 2013-11-03 12:53:48 -08:00