Commit Graph

8744 Commits

Author SHA1 Message Date
Matt Jones
a9422cc1db Fix preloading of has_one :through associations on belongs_to [#1507 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2008-12-18 19:19:36 +00:00
Manfred Stienstra
8326b95169 Free MySQL::Result objects after a call to execute [#1416 state:resolved]
No freeing Result objects causes the MySQL driver to free result sets
at undefined times, this can lead to erratic performance in your
application.

Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2008-12-18 19:19:36 +00:00
Frederick Cheung
9c7fe7c672 Don't include table_name twice 2008-12-18 19:19:36 +00:00
Frederick Cheung
c9ab7098be Ensure :include checks joins when determining if it can preload [#528 state:resolved] 2008-12-18 19:19:36 +00:00
Emilio Tagua
9cf6b1b15e Add missing model files so tests can run isolated [#1506 state:resolved]
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
2008-12-18 19:19:36 +00:00
Frederick Cheung
707d0dd3e1 Fix preloading of belongs_to with null foreign key generating useless query [#1027 state:resolved] 2008-12-18 19:19:35 +00:00
Frederick Cheung
428e77bf0f Make exceptions raise from find_by_foo! have a more helpful message [#1567 state:resolved] 2008-12-18 19:19:35 +00:00
Joshua Peek
a9fde9a2ab Cleanup dispatch path 2008-12-18 13:14:09 -06:00
Joshua Peek
3b35366d5d Use more generic test env flag 2008-12-18 12:57:37 -06:00
Joshua Peek
2e22c7fda0 Conditionally inject session middleware instead of using session management 2008-12-18 12:56:18 -06:00
Joshua Peek
2eb2ec9e63 Move gaint lock into middleware 2008-12-18 12:00:54 -06:00
Lourens Naude
3ff6b00ee3 Persistent session identifier support for CookieSessionStore and API compat. with the server side stores [#1591 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-18 11:33:53 -06:00
Brady Bouchard
33f76bb25a Ensure error file is sent with a 'text/html' content type [#1478 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-17 10:23:59 -06:00
Joshua Peek
f23c2796ee When checking for the wrong routing method, ensure the environment is passed to recognize optimize [#1406 state:resolved] 2008-12-17 10:20:19 -06:00
Joshua Peek
175cb7a963 Fix metal tests 2008-12-17 10:10:24 -06:00
Joshua Peek
61a41154f7 Make generated Metal bits a pure rack endpoint application (not middleware)
Instead of calling super to pass the request on, return a 404.
The modified app looks like this:

  # app/metal/poller.rb
  class Poller
    def self.call(env)
      if env["PATH_INFO"] =~ /^\/poller/
        [200, {"Content-Type" => "text/html"}, "Hello, World!"]
      else
        [404, {"Content-Type" => "text/html"}, "Not Found"]
      end
    end
  end

But you aren't locked in to just Rails:

  # app/metal/api.rb
  require 'sinatra'
  Sinatra::Application.default_options.merge!(:run => false, :env => :production)
  Api = Sinatra.application unless defined? Api

  get '/interesting/new/ideas' do
    'Hello Sinatra!'
  end
2008-12-17 09:53:56 -06:00
Jesse Newland
97a178bfa4 Decorate responses from Rack Middleware and Rails Metal for the purposes of integration testing. A test for the following Metal:
class Poller < Rails::Rack::Metal
      def call(env)
        if env["PATH_INFO"] =~ /^\/poller/
          [200, {"Content-Type" => "text/plain"}, "Hello World!"]
        else
          super
        end
      end
    end

might be tested like so:

  class PollerTest < ActionController::IntegrationTest
    test "poller returns hello world" do
      get "/poller"
      assert_response 200
      assert_response :success
      assert_response :ok
      assert_equal "Hello World!", response.body
    end
  end

[#1588 state:committed]

Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-12-17 15:59:47 +01:00
Joshua Peek
1bcfce0130 Remove set_cookie hack from rack response since we dont use cgi sessions anymore 2008-12-16 20:21:27 -06:00
Joshua Peek
246b582ddf Remove CGI::Session memory leak patch 2008-12-16 19:56:09 -06:00
Joshua Peek
ec1bd98705 Session Fixation tests have been rolled into the session cookie tests 2008-12-16 16:28:39 -06:00
Joshua Peek
8c3a543664 Introduce Rails Metal
# app/metal/poller.rb
  class Poller < Rails::Rack::Metal
    def call(env)
      if env["PATH_INFO"] =~ /^\/poller/
        [200, {"Content-Type" => "application/json"}, Message.recent.to_json]
      else
        super
      end
    end
  end

* There is a generator to help you get started
    `script/generate metal poller`

* Also, metal bits can be ran standalone with rackup
    `rackup app/metal/poller.rb`
2008-12-16 13:15:06 -06:00
Daniel Luz
c4023cbe20 Update documentation for default_scope
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-12-16 14:34:02 +01:00
Xavier Noria
46c7dd2348 normalize author names in changelogs [#1495 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-12-16 14:33:32 +01:00
Hongli Lai (Phusion
9e2b4a10f7 Do not output an ETag header if response body is blank or when sending files with send_file(... :xsendfile => true) [#1578 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2008-12-16 12:30:28 +01:00
Joshua Peek
7c09050999 Lazy load flash access 2008-12-16 01:00:48 -06:00
Joshua Peek
9a733f6c64 Don't write nil values to default session options hash 2008-12-16 00:04:04 -06:00
Joshua Peek
95c839bd2a Session objects are always a hash, so we need to ensure a flash hash is always assigned to the session 2008-12-15 20:43:01 -06:00
Jeremy Kemper
89056885b0 Merge branch 'master' of git@github.com:rails/rails 2008-12-15 18:22:35 -08:00
Jeremy Kemper
19be3d35b3 Revert "Make constantize look into ancestors"
[#410 state:open]

This reverts commit 262fef7ed57520b857605a0105fe7ba9265654f6.
2008-12-15 18:20:18 -08:00
Joshua Peek
43ac42c46a Clear empty nil values in session hash before saving 2008-12-15 19:25:31 -06:00
Joshua Peek
ed70830713 Switch to Rack based session stores. 2008-12-15 16:33:31 -06:00
Nathan Weizenbaum
e8c1915416 Auto-load template handlers based on unmatched extensions [#1540 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 14:49:38 -06:00
Hongli Lai (Phusion)
a392f34fb4 Require mocha >= 0.9.3, older versions don't work anymore [#1579 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 14:47:19 -06:00
Jeremy Kemper
0d48408dcc Merge branch 'master' of git@github.com:rails/rails 2008-12-15 11:05:29 -08:00
Frederick Cheung
262fef7ed5 Make constantize look into ancestors
[#410 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-15 11:01:04 -08:00
Seth Fitzsimmons
4966076d35 Use Mime::JS in place of explicit 'text/javascript' [#1573 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 12:18:45 -06:00
Seth Fitzsimmons
f36dafa492 Implement Mime::Type.=~ to match all synonyms against arg [#1573 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 12:00:55 -06:00
Frederick Cheung
7c18518105 Properly parenthasize calls to defined?(Rails) in 75fa82418 [#1563 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 11:49:08 -06:00
Dan Pickett
38412ecb5d Fixed ActionView::TestCase current url context [#1561 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-15 11:47:39 -06:00
David Heinemeier Hansson
07326b38ec Merge branch 'master' of git@github.com:rails/rails 2008-12-15 15:37:47 +01:00
David Heinemeier Hansson
f9a02b12d1 Added gem backtrace pretty priting (Juan Lupión) [#1497 state:committed] 2008-12-15 15:37:27 +01:00
Frederick Cheung
4dcd8f01af Make delete_if/reject faster and fix other mutators
[#1559 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-15 15:34:29 +01:00
Frederick Cheung
6eed6cf5c6 Make delete_if/reject faster and fix other mutators
[#1559 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-12 10:19:07 -08:00
mark
49306ccacf Add :partial option to assert_template [#1550 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-11 11:06:35 -06:00
Frederick Cheung
5ede4ce188 Fixed session related memory leak [#1558 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-11 10:20:33 -06:00
Joshua Peek
7cfa6c535b Fixed template lookups from outside the rails root [#1557 state:resolved] 2008-12-11 10:17:29 -06:00
Eloy Duran
7394d12dc7 Fixed ActiveSupport::OrderedHash #delete_if, #reject!, and #reject, which did not sync the @keys after the operation.
This probably holds true for other mutating methods as well.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-12-11 14:32:20 +01:00
Christos Zisopoulos
69387ce016 Fix for Integration::Session follow_redirect! headers['location'] bug with Rack [#1555 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-12-10 18:38:28 -06:00
Joshua Peek
75fa82418d Prefer Rails.logger over RAILS_DEFAULT_LOGGER 2008-12-10 18:08:14 -06:00
Frederick Cheung
455c7f9e37 Don't use the transaction instance method so that people with has_one/belongs_to :transaction aren't fubared
[#1551 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-12-10 15:11:42 -08:00