Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ensure reference to Rails is always prefixed with :: #880

Closed
wants to merge 1 commit into from

3 participants

@kristianmandrup

Fixed problem with formtastic-bootstrap gem, in trying to make it work with formtastic 2.2.

@travisbot

This pull request fails (merged 3d1cb89 into 6378c45).

@justinfrench

@kristianmandrup hi, this diff looks okay, but I'm not sure why it's needed. can you go into a little more detail? why is the fix in formtastic instead of formtastic-bootstrap?

@kristianmandrup

At one point it complained that a constant FormtasticBootstrap::X::Y::Z::Rails didn't exist. I later discovered it was because Rails was not defined when running the specs. the FormtasticBootstrap spec_helper.rb simply needed to be changed in order to ensure that a Rails app is defined, much like you do in the formtastic equivalent :)

@justinfrench

I still don't understand why this fix/change is in formtastic instead of formtastic-bootstrap, since you keep talking about formtastic-bootstrap ;)

@justinfrench
Owner

Closing due to lack of activity, still not clear to me if it's a formtastic-bootstrap issue, or ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  lib/formtastic/helpers/input_helper.rb
@@ -321,7 +321,7 @@ def column_for(method) #:nodoc:
def input_class(as)
@input_classes_cache ||= {}
@input_classes_cache[as] ||= begin
- Rails.application.config.cache_classes ? input_class_with_const_defined(as) : input_class_by_trying(as)
+ ::Rails.application.config.cache_classes ? input_class_with_const_defined(as) : input_class_by_trying(as)
end
end
View
2  lib/generators/formtastic/form/form_generator.rb
@@ -14,7 +14,7 @@ module Formtastic
# $ rails generate formtastic:form Post title:string body:text
# @example Generate a form for a specific controller
# $ rails generate formtastic:form Post --controller admin/posts
- class FormGenerator < Rails::Generators::NamedBase
+ class FormGenerator < ::Rails::Generators::NamedBase
desc "Generates a Formtastic form partial based on an existing model."
argument :name, :type => :string, :required => true, :banner => 'MODEL_NAME'
View
2  lib/generators/formtastic/install/install_generator.rb
@@ -8,7 +8,7 @@ module Formtastic
# $ rails generate formtastic:install
#
# @todo Test with Rails 3.0
- class InstallGenerator < Rails::Generators::Base
+ class InstallGenerator < ::Rails::Generators::Base
source_root File.expand_path('../../../templates', __FILE__)
class_option :template_engine
View
2  spec/inputs/custom_input_spec.rb
@@ -11,7 +11,7 @@ def input_args
@method = :title
@options = {}
@proc = Proc.new {}
- if Rails::VERSION::MAJOR == 4
+ if ::Rails::VERSION::MAJOR == 4
@builder = Formtastic::FormBuilder.new(@object_name, @object, @template, @options)
else
@builder = Formtastic::FormBuilder.new(@object_name, @object, @template, @options, @proc)
View
2  spec/spec_helper.rb
@@ -432,7 +432,7 @@ def errors_matcher(method)
# In edge rails (Rails 4) tags store method_name as a string and index the errors object using a string
# therefore allow stubs to match on either string or symbol. The errors object calls to_sym on all index
# accesses so @object.errors[:abc] is equivalent to @object.errors["abc"]
- if Rails::VERSION::MAJOR == 4
+ if ::Rails::VERSION::MAJOR == 4
ToSMatcher.new(method)
else
method
View
2  spec/support/test_environment.rb
@@ -13,7 +13,7 @@
# Create a simple rails application for use in testing the viewhelper
module FormtasticTest
- class Application < Rails::Application
+ class Application < ::Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
config.active_support.deprecation = :stderr
Something went wrong with that request. Please try again.