From 6610929aaca44401ea739abc1f94549e8dba9f5f Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 10 Nov 2009 23:20:57 -0800 Subject: [PATCH] Rails 3 config.ru, new files, config.to_prepare workaround, activerecord require fix --- config.ru | 5 ++++ config/initializers/10-patches.rb | 3 +-- config/initializers/mime_types.rb | 5 ++++ config/initializers/new_rails_defaults.rb | 19 +++++++++++++ db/seeds.rb | 7 +++++ public/422.html | 27 +++++++++++++++++++ vendor/plugins/open_id_authentication/init.rb | 2 +- 7 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 config.ru create mode 100644 config/initializers/mime_types.rb create mode 100644 config/initializers/new_rails_defaults.rb create mode 100644 db/seeds.rb create mode 100644 public/422.html diff --git a/config.ru b/config.ru new file mode 100644 index 00000000000..509a0da5b7a --- /dev/null +++ b/config.ru @@ -0,0 +1,5 @@ +# Require your environment file to bootstrap Rails +require ::File.expand_path('../config/environment', __FILE__) + +# Dispatch the request +run Rails.application diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index 9aa416f5512..e343a464086 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -1,5 +1,4 @@ - -require 'activerecord' +require 'active_record' module ActiveRecord class Base diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 00000000000..72aca7e441e --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/new_rails_defaults.rb b/config/initializers/new_rails_defaults.rb new file mode 100644 index 00000000000..8ec3186c84d --- /dev/null +++ b/config/initializers/new_rails_defaults.rb @@ -0,0 +1,19 @@ +# Be sure to restart your server when you modify this file. + +# These settings change the behavior of Rails 2 apps and will be defaults +# for Rails 3. You can remove this initializer when Rails 3 is released. + +if defined?(ActiveRecord) + # Include Active Record class name as root for JSON serialized output. + ActiveRecord::Base.include_root_in_json = true + + # Store the full class name (including module namespace) in STI type column. + ActiveRecord::Base.store_full_sti_class = true +end + +# Use ISO 8601 format for JSON serialized times and dates. +ActiveSupport.use_standard_json_time_format = true + +# Don't escape HTML entities in JSON, leave that for the #json_escape helper. +# if you're including raw json in an HTML page. +ActiveSupport.escape_html_entities_in_json = false \ No newline at end of file diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 00000000000..bc8695e6f00 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Mayor.create(:name => 'Daley', :city => cities.first) diff --git a/public/422.html b/public/422.html new file mode 100644 index 00000000000..9c3c96670b0 --- /dev/null +++ b/public/422.html @@ -0,0 +1,27 @@ + + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/vendor/plugins/open_id_authentication/init.rb b/vendor/plugins/open_id_authentication/init.rb index 2055ef70036..90fcb6b5abc 100644 --- a/vendor/plugins/open_id_authentication/init.rb +++ b/vendor/plugins/open_id_authentication/init.rb @@ -9,7 +9,7 @@ end if Object.const_defined?(:OpenID) - config.to_prepare do + ActionDispatch::Callbacks.to_prepare do OpenID::Util.logger = Rails.logger ActionController::Base.send :include, OpenIdAuthentication end