Commit Graph

11874 Commits

Author SHA1 Message Date
Pratik Naik
284d186cf4 Make sure the relations are always immutable 2009-12-26 14:26:02 +05:30
Pratik Naik
187fbe5cba Add support for multiple arguments to .where finder 2009-12-26 12:57:34 +05:30
Pratik Naik
5f5aa44d2d Add missing changelog entries 2009-12-26 12:43:49 +05:30
Pratik Naik
feb8b20eb5 Add Relation#all as an alias for to_a 2009-12-26 12:39:44 +05:30
Pratik Naik
a73fa9356f Stop supporting blank arguments to AR#relation query methods 2009-12-26 04:07:50 +05:30
Pratik Naik
95274b28d9 Rename Model.conditions and relation.conditions to .where 2009-12-26 03:50:57 +05:30
Pratik Naik
1a99337180 No parentheses for assert_equal 2009-12-26 03:10:55 +05:30
Pratik Naik
a7fd564ab1 Add Model.select/group/order/limit/joins/conditions/preload/eager_load class methods returning a lazy relation.
Examples :

    posts = Post.select('id).order('name') # Returns a lazy relation
    posts.each {|p| puts p.id } # Fires "select id from posts order by name"
2009-12-26 03:06:51 +05:30
Yehuda Katz
8f6da9483b Merge remote branch 'jose/am' 2009-12-25 13:06:11 -08:00
José Valim
9f1c359a20 Fix whiny_nil tests, improve error messages and make CI happy. 2009-12-25 22:00:36 +01:00
José Valim
88ba056043 Refactor multiple parts logic and move Utils to PartContainer. 2009-12-25 21:47:47 +01:00
José Valim
ee70d1b6ad adv_attr_accessors in ActionMailer are not sent to the views, use the mailer object if you need to access the subject, recipients, from, etc. 2009-12-25 21:35:40 +01:00
Pratik Naik
2e79ec71a5 Model.scoped now returns a relation if invoked without any arguments
Example :

    posts = Post.scoped
    posts.size # Fires "select count(*) from  posts" and returns the count
    posts.each {|p| puts p.name } # Fires "select * from posts" and loads post objects
2009-12-26 01:33:20 +05:30
David Heinemeier Hansson
7f5d44bac5 The controller key shouldnt be part of the mapping if its not used 2009-12-25 10:14:44 -08:00
David Heinemeier Hansson
a8f1ee5986 Fix tests 2009-12-25 10:04:26 -08:00
José Valim
135d32c8bd Move i18n to Gemfile. 2009-12-25 15:15:13 +01:00
José Valim
eb8e627c69 Merge branch 'master' of git://github.com/rails/rails 2009-12-25 12:09:13 +01:00
Yehuda Katz
1c66f85eb6 This code was needed to work around http://redmine.ruby-lang.org/issues/show/2494. Since that bug is now closed in Ruby, we can remove it. 2009-12-24 23:48:35 -08:00
Yehuda Katz
3b1642c23c Simplify and improve the performance of output_safety 2009-12-24 22:44:21 -08:00
Yehuda Katz
f3b072189a Instead of marking raw text in templates as safe, and then putting them through String#<< which checks if the String is safe, use safe_concat, which uses the original (internal) String#<< and leaves the safe flag as is. Results in a significant performance improvement. 2009-12-24 21:50:18 -08:00
Yehuda Katz
baaaf2acaa Dead code 2009-12-24 21:50:17 -08:00
David Heinemeier Hansson
0a365d63f6 Translated strings in the view are assumed html_safe (Closes #3401) 2009-12-24 20:32:53 -08:00
David Heinemeier Hansson
6ce5982afa Stray carrier return 2009-12-24 16:13:50 -08:00
David Heinemeier Hansson
b9c0a16655 The new routes shortform now also works for :as 2009-12-24 16:08:03 -08:00
David Heinemeier Hansson
38af368360 Merge 2009-12-24 15:24:57 -08:00
David Heinemeier Hansson
2b7256a42e Extract Mapping class from monster match method 2009-12-24 15:23:39 -08:00
Jeremy Kemper
46b376962f Fix new schema test dependency on Hash#to_xml 2009-12-23 23:30:59 -08:00
Sam Ruby
aa3565f3a6 Allow named_routes to be used with root, and with new DSL short-form.
The real use case it to make all of the following act the same:

  root 'store#index', :as => 'store'
  match '/' => 'store#index', :as => 'store'
  match '/', :to => 'store#index', :as => 'store'

The test case provided deviates from this in order to demonstrate all three
forms in a single set of test routes.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-23 20:55:21 -08:00
Carlhuda
84f1137ef8 Merge remote branch 'origin/master'
Conflicts:
	railties/lib/rails/application.rb
2009-12-23 19:18:11 -08:00
Carlhuda
c4d6d50a46 Rackup config.ru from the correct directory 2009-12-23 19:10:44 -08:00
Carlhuda
af5c3c852e Require active_support/all unless specifically requested to be left out. 2009-12-23 19:00:20 -08:00
Carlhuda
9653599a79 Remove the ActionView::Base autoload because it creates crazy circular autoload insanity 2009-12-23 18:59:49 -08:00
Jeremy Kemper
7a6f73e79b Fix reference to Application#configuration to use #config 2009-12-23 17:47:38 -08:00
Carlhuda
d926fb62e8 Isolation tests intentionally avoid loading any state (because they're often testing things that have their own load path semantics that should not be polluted), so rack/test is not yet on the load path. Moving require "rack/test" into the setup means and after boot_rails means that it'll be required after the laod path has been altered to add in the Rails vendor/gems 2009-12-23 17:46:38 -08:00
Jeremy Kemper
4d3602a8c4 Routing: fix that route shorthand shouldn't ignore other options. Raise if :as option is given to root method since its name is always 'root' 2009-12-23 17:42:30 -08:00
Carlhuda
d2bd71a145 Finish moving config.frameworks-dependent code to the framework plugin 2009-12-23 17:23:29 -08:00
Jeremy Kemper
1ee50e58f6 Fix Rack::Lock middleware condition: use *unless* we allow concurrency 2009-12-23 17:14:21 -08:00
Jeremy Kemper
94bb331635 Shift more responsibility from application class to its singleton instance. Treat instantiation and boot as separate steps. Use app.config rather than app.configuration. 2009-12-23 17:11:17 -08:00
Carlhuda
61af34b001 Make /rails/info/properties work again. Also, the mocked up tests were passing so we added a test that actually tested this functionality. 2009-12-23 16:26:10 -08:00
Carlhuda
83be262b4b Isolation tests intentionally avoid loading any state (because they're often testing things that have their own load path semantics that should not be polluted), so rack/test is not yet on the load path. Moving require "rack/test" into the setup means and after boot_rails means that it'll be required after the laod path has been altered to add in the Rails vendor/gems 2009-12-23 16:14:34 -08:00
Carlhuda
38aeb1528c Moving out some framework specific initializers into the framework libraries. 2009-12-23 16:13:09 -08:00
Carlhuda
fa8dfc7d01 Raise an exception if an initializer is defined without a block 2009-12-23 15:16:38 -08:00
Carlhuda
dc677f7665 tests pass with requiring the frameworks in rails.rb 2009-12-23 15:16:38 -08:00
Jeremy Kemper
24e1b55608 Fix bare string Rack response bodies 2009-12-23 13:06:53 -08:00
Dwayne Litzenberger
808cad2bb4 Fix ActiveSupport::JSON encoding of control characters [\x00-\x1f]
According to RFC 4627, only the following Unicode code points are
allowed unescaped in JSON:

  unescaped = %x20-21 / %x23-5B / %x5D-10FFFF

However, ActiveSupport::JSON did not escape the range %x00-1f.  This caused
parse errors when trying to decode the resulting output.

[#3345 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-12-23 11:46:06 -08:00
Joshua Peek
74b2e00ce8 Require rack-mount 0.3.3
Fixes "Rack-mount boot time is slow as shit" [#3567 state:resolved]
2009-12-22 19:44:38 -06:00
David Heinemeier Hansson
e7ef57dd0d Merge 2009-12-22 17:31:29 -08:00
David Heinemeier Hansson
ec095456d8 Dont auto require rubygems, move dep on rack-test to Gemfile 2009-12-22 17:29:25 -08:00
David Heinemeier Hansson
fe5f660413 Dont encourage __FILE__ bullshit 2009-12-22 17:25:34 -08:00
Joshua Peek
f737c2d69b All AMo modules are safe to defer 2009-12-22 17:39:41 -06:00