lib/ruboss4ruby.rb in dima-ruboss4ruby-1.1.0 vs lib/ruboss4ruby.rb in dima-ruboss4ruby-1.1.1
- old
+ new
@@ -1,10 +1,14 @@
+# Sets up all the relevant configuration options and brings together
+# patches for Rails, Merb, ActiveRecord and Data Mapper.
+#
+# Loads Ruboss specific rake tasks if appropriate.
module Ruboss4Ruby
# :stopdoc:
- VERSION = '1.1.0'
- RUBOSS_FRAMEWORK_VERSION = '1.1.0'
+ VERSION = '1.1.1'
+ RUBOSS_FRAMEWORK_VERSION = '1.1.1'
LIB_DIR = File.join(File.dirname(__FILE__), 'ruboss4ruby/')
# :startdoc:
# Returns the version string for the library.
#
@@ -52,11 +56,14 @@
['active_foo', 'active_record_default_methods', 'rails/swf_helper'].each { |lib| require Ruboss4Ruby::LIB_DIR + lib }
ActionView::Base.send :include, SWFHelper unless ActionView::Base.included_modules.include?(SWFHelper)
+ # We mess with default +render+ implementation a bit to add support for expressions
+ # such as format.fxml { render :fxml => @foo }
module ActionController
+ # Override render to add support for render :fxml
class Base
alias_method :old_render, :render unless method_defined?(:old_render)
# so that we can have handling for :fxml option and write code like
# format.fxml { render :fxml => @projects }
@@ -70,10 +77,12 @@
end
end
end
end
+ # It is possible to pass metadata with any Ruboss model. This module adds support for
+ # extracting that metadata into the standard params hash.
module Ruboss4RubyController
private
# Extract any keys named _metadata from the models in the params hash
# and put them in the root of the params hash.
@@ -87,10 +96,14 @@
params.merge!(metadata) unless metadata.empty?
end
end
module ActiveRecord
+ # ActiveRecord named scopes are computed *before* ruboss4ruby gem gets loaded
+ # this patch addresses that and makes sure +to_fxml+ calls are properly
+ # delegated
module NamedScope
+ # make sure we properly delegate +to_fxml+ calls to the proxy
class Scope
delegate :to_fxml, :to => :proxy_found
end
end
end
\ No newline at end of file