Rails 3.2.2 Compatibility #2

Open
wants to merge 1 commit into from
View
4 .gitignore
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in us-state-select-plugin.gemspec
+gemspec
View
1 Rakefile
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
View
1 init.rb
@@ -1 +0,0 @@
-require 'us_states'
View
5 lib/..rb
@@ -0,0 +1,5 @@
+require "./version"
+
+module .
+ # Your code goes here...
+end
View
9 lib/us-state-select-plugin/version.rb
@@ -0,0 +1,9 @@
+module Us
+ module State
+ module Select
+ module Plugin
+ VERSION = "1.3.0"
+ end
+ end
+ end
+end
View
8 lib/us_states.rb → lib/us_states_select.rb
@@ -1,8 +1,10 @@
+require "us-state-select-plugin/version"
+
module ActionView
module Helpers
module FormOptionsHelper
def us_state_options_for_select(selected = nil, us_state_options = {})
- state_options = ""
+ state_options = "".html_safe
priority_states = lambda { |state| us_state_options[:priority].include?(state.last) }
us_state_options[:show] = :full if us_state_options[:with_abbreviation]
states_label = case us_state_options[:show]
@@ -14,12 +16,12 @@ def us_state_options_for_select(selected = nil, us_state_options = {})
end
if us_state_options[:include_blank]
- state_options += "<option value=\"\">--</option>\n"
+ state_options += "<option value=\"\">--</option>\n".html_safe
end
if us_state_options[:priority]
state_options += options_for_select(US_STATES.select(&priority_states).collect(&states_label), selected)
- state_options += "<option value=\"\">--</option>\n"
+ state_options += "<option value=\"\">--</option>\n".html_safe
end
if us_state_options[:priority] && us_state_options[:priority].include?(selected)
View
22 us-state-select-plugin.gemspec
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "us-state-select-plugin/version"
+
+Gem::Specification.new do |s|
+ s.name = "us_states_select"
+ s.version = Us::State::Select::Plugin::VERSION
+ s.authors = ["Thincloud", "Jason Rust"]
+ s.email = ["jason@lessonplanet.com"]
+ s.homepage = ""
+ s.summary = %q{State select form helper for Rails}
+ s.description = %q{State select form helper for Rails}
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ # specify any dependencies here; for example:
+ # s.add_development_dependency "rspec"
+ # s.add_runtime_dependency "rest-client"
+end