diff --git a/CHANGELOG.md b/CHANGELOG.md index 90d2cbf1..6a9074ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Changelog +* 1.0.3 Fixed Formtastic 2.0 + Ruby 1.8.7 compat issue * 1.0.2 Fixed issue #93, #94 * 1.0.1 Formtastic 2.0 compatibility fix * 1.0.0 Rails 3.1 asset pipeline support diff --git a/README.md b/README.md index 72d5a017..7439c608 100644 --- a/README.md +++ b/README.md @@ -50,15 +50,7 @@ And include autocomplete-rails.js on your layouts javascript_include_tag "autocomplete-rails.js" -### Rails 3.1.x - -Just add it to your app/assets/javascripts/application.js file - - //= require jquery - //= require jquery_ujs - //= require autocomplete-rails - -## Upgrading from older versions +#### Upgrading from older versions If you are upgrading from a previous version, run the generator after installing to replace the javascript file. @@ -66,13 +58,22 @@ If you are upgrading from a previous version, run the generator after installing I'd recommend you do this every time you update to make sure you have the latest JS file. -## Uncompressed Javascript file +#### Uncompressed Javascript file If you want to make changes to the JS file, you can install the uncompressed version by running: rails generate autocomplete:uncompressed +### Rails 3.1.x + +Just add it to your app/assets/javascripts/application.js file + + //= require jquery + //= require jquery_ujs + //= require jquery_ui + //= require autocomplete-rails + ## Usage ### Model Example @@ -223,8 +224,8 @@ The previous example would fetch the extra attribute slogan and update jQuery('# A javascript event named *railsAutocomplete.select* is fired on the input field when a value is selected from the autocomplete drop down. If you need to do something more complex than update fields with data, you can hook into this event, like so: $('#my_autocomplete_field').bind('railsAutocomplete.select', function(event, data){ - /* Do something here */ - alert(data.item.id); + /* Do something here */ + alert(data.item.id); }); ## Formtastic diff --git a/integration/Gemfile b/integration/Gemfile index 3ebc73f9..5067c238 100644 --- a/integration/Gemfile +++ b/integration/Gemfile @@ -5,7 +5,7 @@ gem 'rails', '~> 3.0.10' gem 'annotate' gem 'capybara' gem 'cucumber-rails' -gem 'formtastic' #, path: '../../formtastic' +gem 'formtastic'#, :path => '../../formtastic' gem 'rspec-rails' gem 'steak' gem 'database_cleaner' diff --git a/integration/Gemfile.lock b/integration/Gemfile.lock index 8a6e71bf..bb0598f0 100644 --- a/integration/Gemfile.lock +++ b/integration/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: ../ specs: - rails3-jquery-autocomplete (1.0.2) + rails3-jquery-autocomplete (1.0.3) rails (~> 3.0) GEM diff --git a/lib/rails3-jquery-autocomplete/formtastic.rb b/lib/rails3-jquery-autocomplete/formtastic.rb index 7231f89a..4fea6945 100644 --- a/lib/rails3-jquery-autocomplete/formtastic.rb +++ b/lib/rails3-jquery-autocomplete/formtastic.rb @@ -1,15 +1,18 @@ # # Load the formtastic plugin if using Formtastic +# begin require 'formtastic' + begin + require "formtastic/version" + rescue LoadError + end - if Formtastic.constants.include?(:VERSION) - + if defined?(Formtastic::VERSION) # - # Formtastic 2.0 + # Formtastic 2.x # - module Formtastic module Inputs class AutocompleteInput diff --git a/lib/rails3-jquery-autocomplete/version.rb b/lib/rails3-jquery-autocomplete/version.rb index 05af73fe..79a1867a 100644 --- a/lib/rails3-jquery-autocomplete/version.rb +++ b/lib/rails3-jquery-autocomplete/version.rb @@ -1,3 +1,3 @@ module Rails3JQueryAutocomplete - VERSION = '1.0.2' + VERSION = '1.0.4' end