Permalink
Browse files

updates for rails 4 compatability

  • Loading branch information...
1 parent c5e311a commit a22b424f12cb414e286eef03a0f09fb1e77bc4ba @twalpole twalpole committed Jan 24, 2013
@@ -81,6 +81,13 @@ def semantic_fields_for(record_or_name_or_array, *args, &block)
fields_for(record_or_name_or_array, *(args << options), &block)
end
+ def initialize(object_name, object, template, options, block=nil)
+ super
+ if respond_to?('multipart=') && options.is_a?(Hash) && options[:html]
+ self.multipart = options[:html][:multipart]
+ end
+ end
+
end
end
@@ -188,8 +188,11 @@ def position(fragment)
def i18n_date_fragments
order = ::I18n.t(:order, :scope => [:date])
- order = nil unless order.is_a?(Array)
- order
+ if order.is_a?(Array)
+ order.map &:to_sym
+ else
+ nil
+ end
end
def fragments_wrapping(&block)
@@ -198,8 +198,10 @@ def input_html_options
def extra_input_html_options
{
:multiple => multiple?,
- :name => multiple? ? input_html_options_name_multiple : input_html_options_name
+ :name => (multiple? && Rails::VERSION::MAJOR == 3) ? input_html_options_name_multiple : input_html_options_name
}
+
+
end
def input_html_options_name
@@ -152,7 +152,7 @@
it 'is restored to its original value after the form is rendered' do
lambda do
- Formtastic::Helpers::FormHelper.field_error_proc = proc {}
+ Formtastic::Helpers::FormHelper.field_error_proc = proc {""}
semantic_form_for(@new_post, :url => '/hello') { |builder| }
end.should_not change(::ActionView::Base, :field_error_proc)
end
View
@@ -36,7 +36,10 @@ module FormtasticSpecHelper
include ActionView::Helpers::AssetTagHelper
include ActiveSupport
include ActionController::PolymorphicRoutes if defined?(ActionController::PolymorphicRoutes)
-
+ include ActionDispatch::Routing::PolymorphicRoutes
+ include AbstractController::UrlFor if defined?(AbstractController::UrlFor)
+ include ActionView::RecordIdentifier if defined?(ActionView::RecordIdentifier)
+
include Formtastic::Helpers::FormHelper
def default_input_type(column_type, column_name = :generic_column_name)
@@ -17,6 +17,7 @@ class Application < Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
config.active_support.deprecation = :stderr
+ config.secret_key_base = "secret"
end
end
FormtasticTest::Application.initialize!

0 comments on commit a22b424

Please sign in to comment.