Revision 6ee71201
Added by Marc Dequènes over 14 years ago
- ID 6ee712016eb9afd6a30d1602b507ba512b82f826
app/controllers/application_controller.rb | ||
---|---|---|
# Filters added to this controller apply to all controllers in the application.
|
||
# Likewise, all the methods added will be available for all controllers.
|
||
|
||
require 'gettext_rails'
|
||
require 'exif'
|
||
require 'utils'
|
||
require 'mycyma'
|
||
|
||
#Mime::Type.register "image/svg+xml", :svg
|
||
|
||
class ApplicationController < ActionController::Base
|
||
helper :all # include all helpers, all the time
|
||
|
config/environment.rb | ||
---|---|---|
# config.i18n.default_locale = :de
|
||
end
|
||
|
||
require 'fixes'
|
||
require 'rails_addons'
|
||
|
config/initializers/app_deps.rb | ||
---|---|---|
require 'gettext_rails'
|
||
require 'exif'
|
||
require 'utils'
|
||
require 'mycyma'
|
config/initializers/rails_changes.rb | ||
---|---|---|
|
||
require 'rails_fixes'
|
||
require 'rails_addons'
|
||
|
lib/fixes.rb | ||
---|---|---|
# needed for gettext
|
||
# see http://zargony.com/2008/02/12/edge-rails-and-gettext-undefined-method-file_exists-nomethoderror
|
||
module ActionView
|
||
class Base
|
||
delegate :file_exists?, :to => :finder unless respond_to?(:file_exists?)
|
||
end
|
||
end
|
||
|
||
# fix collection_select ignoring :selected option
|
||
# needs to bug, see http://dev.rubyonrails.org/ticket/1125
|
||
module ActionView::Helpers
|
||
class InstanceTag
|
||
def to_collection_select_tag(collection, value_method, text_method, options, html_options)
|
||
html_options = html_options.stringify_keys
|
||
add_default_name_and_id(html_options)
|
||
value = value(object)
|
||
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
||
content_tag(
|
||
"select", add_options(options_from_collection_for_select(collection, value_method, text_method, selected_value), options, selected_value), html_options
|
||
)
|
||
end
|
||
end
|
||
end
|
lib/rails_fixes.rb | ||
---|---|---|
# needed for gettext
|
||
# see http://zargony.com/2008/02/12/edge-rails-and-gettext-undefined-method-file_exists-nomethoderror
|
||
module ActionView
|
||
class Base
|
||
delegate :file_exists?, :to => :finder unless respond_to?(:file_exists?)
|
||
end
|
||
end
|
||
|
||
# fix collection_select ignoring :selected option
|
||
# needs to bug, see http://dev.rubyonrails.org/ticket/1125
|
||
module ActionView::Helpers
|
||
class InstanceTag
|
||
def to_collection_select_tag(collection, value_method, text_method, options, html_options)
|
||
html_options = html_options.stringify_keys
|
||
add_default_name_and_id(html_options)
|
||
value = value(object)
|
||
selected_value = options.has_key?(:selected) ? options[:selected] : value
|
||
content_tag(
|
||
"select", add_options(options_from_collection_for_select(collection, value_method, text_method, selected_value), options, selected_value), html_options
|
||
)
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] reorganized config/includes a bit