Commit Graph

10635 Commits

Author SHA1 Message Date
Yehuda Katz
ba67e256b8 Remove submodule 2009-08-11 23:44:44 -07:00
Yehuda Katz
27e880729e Made benchmarks submodule so it's easier to keep in sync 2009-08-11 16:49:27 -07:00
Yehuda Katz
ccd1c5e521 Allow superclass_delegating_accessor to take a block for initial set. 2009-08-11 15:03:53 -07:00
Yehuda Katz
4bf516e072 More perf work:
* Move #set_cookie and #delete_cookie inline to optimize. These optimizations should
    almost certainly be sent back upstream to Rack. The optimization involves using
    an ivar for cookies instead of indexing into the headers each time.
  * Was able to use a bare Hash for headers now that cookies have their own joining
    semantics (some code assumed that the raw cookies were an Array).
  * Cache blankness of body on body=
  * Improve expand_cache_key for Arrays of a single element (common in our case)
  * Use a simple layout condition check unless conditions are used
  * Cache visible actions
  * Lazily load the UrlRewriter
  * Make etag an ivar that is set on prepare!
2009-08-11 15:03:53 -07:00
Yehuda Katz
0adbeeb0c9 Got overhead down from 127 to 85. All tests pass:
* Tentatively replaced HeaderHash with SimpleHeaderHash, which does not preserve
    case but does handle converting Arrays to Strings in to_hash. This requires
    further discussion.
  * Moved default_charset to ActionDispatch::Response to avoid having to hop over
    to ActionController. Ideally, this would be a constant on AD::Response, but
    some tests expect to be able to change it dynamically and I didn't want to change
    them yet.
  * Completely override #initialize from Rack::Response. Previously, it was creating
    a HeaderHash, and then we were creating an entirely new one. There is no way to
    call super without incurring the overhead of creating a HeaderHash.
  * Override #write from Rack::Response. Its implementation tracks Content-Length,
    and doing so adds additional overhead that could be mooted if other middleware
    changes the body. It is more efficiently done at the top-level server.
  * Change sending_file to an instance_variable instead of header inspection. In
    general, if a state is important, it should be set as a property of the response
    not reconstructed later.
  * Set the Etag to @body instead of .body. AS::Cache.expand_cache_key handles
    Arrays fine, and it's more efficient to let it handle the body parts, since
    it is not forced to create a joined String.
  * If we detect the default cache control case, just set it, rather than setting
    the constituent parts and then running the normal (expensive) code to generate
    the string.
2009-08-11 15:03:53 -07:00
Yehuda Katz
9e62d6d1c0 Tentatively accept the ":as or :object, but not both" solution 2009-08-11 15:03:53 -07:00
Yehuda Katz
945a7df9f8 Make large_collection 1,000 partials 2009-08-11 15:03:53 -07:00
Yehuda Katz
4945d82239 Further experimentation. Was able to cut the cost of rendering 100 partials in a collection in half.
To discuss: What are the desired semantics (if any) for layouts in a collection. There are no
  tests for it at present, and I'm not sure if it's needed at all.

  Deprecated on this branch: `object` pointing at the current object in partials. You can still
  use the partial name, or use :as to achieve the same thing. This is obviously up for discussion.
2009-08-11 15:03:53 -07:00
Yehuda Katz
bef7576c09 Add a few more benches 2009-08-11 15:03:53 -07:00
Yehuda Katz
02d9dd9000 Add some more caching to the lookup 2009-08-11 15:03:52 -07:00
Yehuda Katz
04d4537cd4 This change causes some failing tests, but it should be possible to make them pass with minimal performance impact. 2009-08-11 15:03:52 -07:00
Pratik Naik
0a558b36eb Add tests for hm:t#push failures 2009-08-11 02:37:04 +01:00
Bryan Helmkamp
d15ddf04ec Allow delegating to nil, because the method might actually exist on it 2009-08-10 18:48:38 -05:00
Pratik Naik
d0f891ae02 Rewrite hm:t#create tests using assert_no_difference and assert_difference 2009-08-10 21:30:44 +01:00
Pratik Naik
ad28e0037b Remove unnecessary scoping for creating hm:t join record 2009-08-10 21:20:01 +01:00
Pratik Naik
50b83984f1 Remove unnecessary scoping and validation checks from hm:t#create 2009-08-10 21:06:49 +01:00
Pratik Naik
d9c4087a9e Unify hm:t#create and create! implementation 2009-08-10 21:02:06 +01:00
Joshua Peek
f97dae5ebe Extract common dirty tracking methods in AMo 2009-08-10 13:51:48 -05:00
Joshua Peek
391f978acd AMo overrides alias_attribute and manages aliasing all known attribute method matchers 2009-08-10 11:58:44 -05:00
Joshua Peek
d574cb31f0 Centralize attr method name concatenation in AttributeMethodMatch 2009-08-10 11:53:10 -05:00
Arthur Zapparoli
55b5cf586a Fixed typo in test name and CHANGELOG [#3017 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 16:13:18 +01:00
Pratik Naik
e202c6c814 Move :with/:without check outside the method generated by validates_format_of 2009-08-10 15:24:48 +01:00
Elliot Winkler
cccb0e6b93 Add validates_format_of :without => /regexp/ option [Elliot Winkler, Peer Allan]
[#430 state:resolved]

  Example :

    validates_format_of :subdomain, :without => /www|admin|mail/

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 15:22:31 +01:00
Kamal Fariz Mahyuddin
600a89f208 find_cmd should return the full path of the db command
[#1488 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-10 00:04:37 -07:00
codeape
8c32248acb Introduce grouped_collection_select helper.
[#1249 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 23:58:43 -07:00
Erik Ostrom
7d16e94d82 Correctly handle offsets in Multibyte::Chars#index and #rindex.
The offset in codepoints was being passed directly to the wrapped string's index/rindex method. Now we translate the offset into bytes first.

[#3028 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 23:30:41 -07:00
Cristi Balan
3e35ba2481 Add tests for scoping schema_migrations index by global table prefix and suffix
[#1543 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:59:04 -07:00
Tim Peters
7eaed4fefe Use table prefix and suffix for schema_migrations index.
[#1543 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:56:37 -07:00
Jeff Dean
22f3398253 Introduce validates_with to encapsulate attribute validations in a class.
[#2630 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:47:56 -07:00
Fabien Jakimowicz
797588543e Add support for errors in JSON format.
[#1956 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:40:20 -07:00
Jay Pignata
793a9f122f Fixing isolation test
[#3022 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:33:23 -07:00
Daniel Sheppard
b3381cacaf Fix that JSON parser fails to read escaped backslashes.
[#973 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:30:44 -07:00
Leonardo Borges
0c391b46fb PostgreSQL: XML datatype support
[#1874 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:24:54 -07:00
Jaime Bellmyer
9c1bac0b7f raises an exception on habtm join table inserts if join table contains a primary key. Caches this check to save time on subsequent inserts.
[#2086 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:19:18 -07:00
Jaime Bellmyer
f0602214e0 raises exception (ActiveRecord::ConfigurationError with message) on habtm association creation if join table contains a primary key
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 22:17:39 -07:00
Morgan Schweers
d2d464e26e Fix that creating a table whose primary key prefix type is :table_name generates an incorrectly pluralized primary key.
[#872 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:57:56 -07:00
Jeremy Kemper
47f7c936a2 Fix test dependency on taggings 2009-08-09 21:30:55 -07:00
Gabe da Silveira
7e3364ac46 Fix that counter_cache breaks with has_many :dependent => :nullify.
[#1196 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:18:16 -07:00
Jatinder Singh
5704ecffad AR should respect default values for MySQL BINARY and VARBINARY columns.
[#1273 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 21:05:26 -07:00
Joshua Peek
734e903af5 Deprecate router generation "best match" sorting 2009-08-09 22:53:16 -05:00
Prem Sichanugrist
82dd725fc1 Fix that irregular plural inflections should not be double-pluralized: 'people'.pluralize should return 'people' not 'peoples'.
[#1183 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 20:28:57 -07:00
Joshua Nichols
84d24cdae8 Only load db/schema.rb if it exists; otherwise, display a message to run db:migrate or remove active_record in environment.rb.
[#3012 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 20:18:56 -07:00
Jeremy Kemper
279b785839 pare down core_ext dependency 2009-08-09 19:32:38 -07:00
Erik Ostrom
4dda9b644d Add rindex to ActiveSupport::Multibyte::Chars.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 19:05:19 -07:00
railsbob
e06a0b03c8 has_many :through create should not raise validation errors
[#2934 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 18:44:45 -07:00
jeem
e4ceea3795 make private_and_public_methods unmemoizable [#2372 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2009-08-09 20:04:48 -05:00
Andrew Moreland
ca92d44e76 Support deep-merging HashWithIndifferentAccess.
[#2732 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-08-09 17:32:04 -07:00
Max Lapshin
0af4b0755f Make sure link_to generates the form with the specified :href if any [#2254 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:58:40 +01:00
Tristan Dunn
a0f69722be Allow ho:through#build when the owner is a new record [#1749 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-08-10 00:46:16 +01:00
Tristan Dunn
0472839d68 Prevent overwriting of table name in merging SQL conditions [#2949 state:resolved] 2009-08-10 00:41:36 +01:00