autosuggest-rb 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/README.markdown +44 -31
  2. data/Rakefile +10 -0
  3. data/autosuggest-rb.gemspec +7 -6
  4. data/lib/autosuggest/controller_macros.rb +9 -3
  5. data/lib/autosuggest/form_helper.rb +1 -1
  6. data/lib/autosuggest/version.rb +1 -1
  7. data/lib/generators/autosuggest_generator.rb +2 -1
  8. data/test/controller_test.rb +73 -0
  9. data/test/db_stores_test.rb +8 -0
  10. data/test/form_helper_test.rb +22 -0
  11. data/test/support/active_record.rb +43 -0
  12. data/test/test_helper.rb +28 -0
  13. metadata +19 -56
  14. data/integration/.gitignore +0 -4
  15. data/integration/Gemfile +0 -43
  16. data/integration/README +0 -256
  17. data/integration/Rakefile +0 -7
  18. data/integration/app/controllers/application_controller.rb +0 -3
  19. data/integration/app/helpers/application_helper.rb +0 -2
  20. data/integration/app/views/layouts/application.html.erb +0 -14
  21. data/integration/config.ru +0 -4
  22. data/integration/config/application.rb +0 -46
  23. data/integration/config/boot.rb +0 -6
  24. data/integration/config/database.yml +0 -22
  25. data/integration/config/environment.rb +0 -5
  26. data/integration/config/environments/development.rb +0 -26
  27. data/integration/config/environments/production.rb +0 -49
  28. data/integration/config/environments/test.rb +0 -35
  29. data/integration/config/initializers/backtrace_silencers.rb +0 -7
  30. data/integration/config/initializers/inflections.rb +0 -10
  31. data/integration/config/initializers/mime_types.rb +0 -5
  32. data/integration/config/initializers/secret_token.rb +0 -7
  33. data/integration/config/initializers/session_store.rb +0 -8
  34. data/integration/config/locales/en.yml +0 -5
  35. data/integration/config/routes.rb +0 -58
  36. data/integration/db/seeds.rb +0 -7
  37. data/integration/doc/README_FOR_APP +0 -2
  38. data/integration/lib/tasks/.gitkeep +0 -0
  39. data/integration/public/404.html +0 -26
  40. data/integration/public/422.html +0 -26
  41. data/integration/public/500.html +0 -26
  42. data/integration/public/favicon.ico +0 -0
  43. data/integration/public/images/rails.png +0 -0
  44. data/integration/public/index.html +0 -239
  45. data/integration/public/javascripts/application.js +0 -2
  46. data/integration/public/javascripts/controls.js +0 -965
  47. data/integration/public/javascripts/dragdrop.js +0 -974
  48. data/integration/public/javascripts/effects.js +0 -1123
  49. data/integration/public/javascripts/prototype.js +0 -6001
  50. data/integration/public/javascripts/rails.js +0 -191
  51. data/integration/public/robots.txt +0 -5
  52. data/integration/public/stylesheets/.gitkeep +0 -0
  53. data/integration/script/rails +0 -6
  54. data/integration/test/performance/browsing_test.rb +0 -9
  55. data/integration/test/test_helper.rb +0 -13
  56. data/integration/vendor/plugins/.gitkeep +0 -0
  57. data/spec/lib/class_methods_spec.rb +0 -9
  58. data/spec/spec_helper.rb +0 -17
data/README.markdown CHANGED
@@ -1,10 +1,10 @@
1
- # autosuggest
1
+ # autosuggest-rb
2
2
 
3
3
  ## Installing
4
4
 
5
5
  Include the gem on your Gemfile
6
6
 
7
- gem 'autosuggest'
7
+ gem 'autosuggest-rb'
8
8
 
9
9
  Install it
10
10
 
@@ -17,7 +17,7 @@ Run the generator
17
17
  And include jquery.autoSuggest.js and autoSuggest.css on your layouts
18
18
 
19
19
  javascript_include_tag "jquery.autoSuggest.js"
20
- stylsheet_link_tag "autoSuggest.css"
20
+ stylesheet_link_tag "autoSuggest.css"
21
21
 
22
22
  ## Usage
23
23
 
@@ -52,7 +52,16 @@ From the view you can create the autosuggest field like this:
52
52
  f.autosuggest_field :tags, autosuggest_tag_name_recipes_path
53
53
  end
54
54
 
55
+ By default, autosuggest only queries the db for existing tags, but if you want to be able to create new ones, just pass these options:
56
+
57
+ f.autosuggest_field :tags, autosuggest_tag_name_recipes_path, :autosuggest_options => { "newValuesInputName" => recipes[new_tags]" }
58
+
59
+ Then you can do whatever you want from the controller using params[:recipes][:new_tags]
60
+
61
+
55
62
  These are the default options:
63
+
64
+ "queryParam" => "query",
56
65
  "selectedItemProp" => "name",
57
66
  "searchObjProps" => "name",
58
67
  "neverSubmit" => "true",
@@ -62,69 +71,73 @@ But you can pass options in by using the autosuggest_options param
62
71
 
63
72
  f.autosuggest_field :tags, autosuggest_tag_name_recipes_path, :autosuggest_options => {"neverSubmit" => "true"}
64
73
 
65
- Here are the other options you can pass in (pasted from http://code.drewwilson.com/entry/autosuggest-jquery-plugin):
74
+ Here are the other options you can pass in - pasted from http://code.drewwilson.com/entry/autosuggest-jquery-plugin
75
+
76
+ **asHtmlName:** string (false by default) - Enables you to specify your own custom name that will be attributed to the text field
77
+
78
+ **newValuesInputName:** string (false by default) - Enables you to define a name for a hidden field that will catch new names that don't match any in the db
66
79
 
67
- asHtmlID: string (false by default) - Enables you to specify your own custom ID that will be appended to the top level AutoSuggest UL element's ID name. Otherwise it will default to using a random ID. Example: id="CUSTOM_ID". This is also applies to the hidden input filed that holds all of the selected values. Example: id="as-values-CUSTOM_ID"
80
+ **asHtmlID:** string (false by default) - Enables you to specify your own custom ID that will be appended to the top level AutoSuggest UL element's ID name. Otherwise it will default to using a random ID. Example: id="CUSTOM_ID". This is also applies to the hidden input filed that holds all of the selected values. Example: id="as-values-CUSTOM_ID"
68
81
 
69
- startText: string ("Enter Name Here" by default) - Text to display when the AutoSuggest input field is empty.
82
+ **startText:** string ("Enter Name Here" by default) - Text to display when the AutoSuggest input field is empty.
70
83
 
71
- emptyText: string ("No Results" by default) - Text to display when their are no search results.
84
+ **emptyText:** string ("No Results" by default) - Text to display when their are no search results.
72
85
 
73
- preFill: object or string (empty object by default) - Enables you to pre-fill the AutoSuggest box with selections when the page is first loaded. You can pass in a comma separated list of values (a string), or an object. When using a string, each value is used as both the display text on the selected item and for it's value. When using an object, the options selectedItemProp will define the object property to use for the display text and selectedValuesProp will define the object property to use for the value for the selected item. Note: you must setup your preFill object in that format. A preFill object can look just like the example objects laid out above.
86
+ **preFill:** object or string (empty object by default) - Enables you to pre-fill the AutoSuggest box with selections when the page is first loaded. You can pass in a comma separated list of values (a string), or an object. When using a string, each value is used as both the display text on the selected item and for it's value. When using an object, the options selectedItemProp will define the object property to use for the display text and selectedValuesProp will define the object property to use for the value for the selected item. Note: you must setup your preFill object in that format. A preFill object can look just like the example objects laid out above.
74
87
 
75
- limitText: string ("No More Selections Are Allowed" by default) - Text to display when the number of selections has reached it's limit.
88
+ **limitText:** string ("No More Selections Are Allowed" by default) - Text to display when the number of selections has reached it's limit.
76
89
 
77
- selectedItemProp: string ("value" by default) - Name of object property to use as the display text for each chosen item.
90
+ **selectedItemProp:** string ("value" by default) - Name of object property to use as the display text for each chosen item.
78
91
 
79
- selectedValuesProp: string ("value" by default) - Name of object property to use as the value for each chosen item. This value will be stored into the hidden input field.
92
+ **selectedValuesProp:** string ("value" by default) - Name of object property to use as the value for each chosen item. This value will be stored into the hidden input field.
80
93
 
81
- searchObjProps: string ("value" by default) - Comma separated list of object property names. The values in these objects properties will be used as the text to perform the search on.
94
+ **searchObjProps:** string ("value" by default) - Comma separated list of object property names. The values in these objects properties will be used as the text to perform the search on.
82
95
 
83
- queryParam: string ("q" by default) - The name of the param that will hold the search string value in the AJAX request.
96
+ **queryParam:** string ("q" by default) - The name of the param that will hold the search string value in the AJAX request.
84
97
 
85
- retrieveLimit: number (false by default) - If set to a number, it will add a '&limit=' param to the AJAX request. It also limits the number of search results allowed to be displayed in the results dropdown box.
98
+ **retrieveLimit:** number (false by default) - If set to a number, it will add a '&limit=' param to the AJAX request. It also limits the number of search results allowed to be displayed in the results dropdown box.
86
99
 
87
- extraParams: string ("" by default) - This will be added onto the end of the AJAX request URL. Make sure you add an '&' before each param.
100
+ **extraParams:** string ("" by default) - This will be added onto the end of the AJAX request URL. Make sure you add an '&' before each param.
88
101
 
89
- matchCase: true or false (false by default) - Make the search case sensitive when set to true.
102
+ **matchCase:** true or false (false by default) - Make the search case sensitive when set to true.
90
103
 
91
- minChars: number (1 by default) - Minimum number of characters that must be entered into the AutoSuggest input field before the search begins.
104
+ **minChars:** number (1 by default) - Minimum number of characters that must be entered into the AutoSuggest input field before the search begins.
92
105
 
93
- keyDelay: number (400 by default) - Number of milliseconds to delay after a keydown on the AutoSuggest input field and before search is started.
106
+ **keyDelay:** number (400 by default) - Number of milliseconds to delay after a keydown on the AutoSuggest input field and before search is started.
94
107
 
95
- resultsHighlight: true or false (true by default) - Option to choose whether or not to highlight the matched text in each result item.
108
+ **resultsHighlight:** true or false (true by default) - Option to choose whether or not to highlight the matched text in each result item.
96
109
 
97
- neverSubmit: true or false (false by default) - If set to true this option will never allow the 'return' key to submit the form that AutoSuggest is a part of.
110
+ **neverSubmit:** true or false (false by default) - If set to true this option will never allow the 'return' key to submit the form that AutoSuggest is a part of.
98
111
 
99
- selectionLimit: number (false by default) - Limits the number of selections that are allowed to be made to the number specified.
112
+ **selectionLimit:** number (false by default) - Limits the number of selections that are allowed to be made to the number specified.
100
113
 
101
- showResultList: true or false (true by default) - If set to false, the Results Dropdown List will never be shown at any time.
114
+ **showResultList:** true or false (true by default) - If set to false, the Results Dropdown List will never be shown at any time.
102
115
 
103
- start: callback function - Custom function that is run only once on each AutoSuggest field when the code is first applied.
116
+ **start:** callback function - Custom function that is run only once on each AutoSuggest field when the code is first applied.
104
117
 
105
- selectionClick: callback function - Custom function that is run when a previously chosen item is clicked. The item that is clicked is passed into this callback function as 'elem'.
118
+ **selectionClick:** callback function - Custom function that is run when a previously chosen item is clicked. The item that is clicked is passed into this callback function as 'elem'.
106
119
 
107
120
  Example: selectionClick: function(elem){ elem.fadeTo("slow", 0.33); }
108
121
 
109
- selectionAdded: callback function - Custom function that is run when a selection is made by choosing one from the Results dropdown, or by using the tab/comma keys to add one. The selection item is passed into this callback function as 'elem'.
122
+ **selectionAdded:** callback function - Custom function that is run when a selection is made by choosing one from the Results dropdown, or by using the tab/comma keys to add one. The selection item is passed into this callback function as 'elem'.
110
123
 
111
124
  Example: selectionAdded: function(elem){ elem.fadeTo("slow", 0.33); }
112
125
 
113
- selectionRemoved: callback function - Custom function that is run when a selection removed from the AutoSuggest by using the delete key or by clicking the "x" inside the selection. The selection item is passed into this callback function as 'elem'.
126
+ **selectionRemoved:** callback function - Custom function that is run when a selection removed from the AutoSuggest by using the delete key or by clicking the "x" inside the selection. The selection item is passed into this callback function as 'elem'.
114
127
 
115
128
  Example: selectionRemoved: function(elem){ elem.fadeTo("fast", 0, function(){ elem.remove(); }); }
116
129
 
117
- formatList: callback function - Custom function that is run after all the data has been retrieved and before the results are put into the suggestion results list. This is here so you can modify what & how things show up in the suggestion results list.
130
+ **formatList:** callback function - Custom function that is run after all the data has been retrieved and before the results are put into the suggestion results list. This is here so you can modify what & how things show up in the suggestion results list.
118
131
 
119
- beforeRetrieve: callback function - Custom function that is run right before the AJAX request is made, or before the local objected is searched. This is used to modify the search string before it is processed. So if a user entered "jim" into the AutoSuggest box, you can call this function to prepend their query with "guy_". Making the final query = "guy_jim". The search query is passed into this function. Example: beforeRetrieve: function(string){ return string; }
132
+ **beforeRetrieve:** callback function - Custom function that is run right before the AJAX request is made, or before the local objected is searched. This is used to modify the search string before it is processed. So if a user entered "jim" into the AutoSuggest box, you can call this function to prepend their query with "guy_". Making the final query = "guy_jim". The search query is passed into this function. Example: beforeRetrieve: function(string){ return string; }
120
133
 
121
- retrieveComplete: callback function - Custom function that is run after the ajax request has completed. The data object MUST be returned if this is used. Example: retrieveComplete: function(data){ return data; }
134
+ **retrieveComplete:** callback function - Custom function that is run after the ajax request has completed. The data object MUST be returned if this is used. Example: retrieveComplete: function(data){ return data; }
122
135
 
123
- resultClick: callback function - Custom function that is run when a search result item is clicked. The data from the item that is clicked is passed into this callback function as 'data'.
136
+ **resultClick:** callback function - Custom function that is run when a search result item is clicked. The data from the item that is clicked is passed into this callback function as 'data'.
124
137
 
125
138
  Example: resultClick: function(data){ console.log(data); }
126
139
 
127
- resultsComplete: callback function - Custom function that is run when the suggestion results dropdown list is made visible. Will run after every search query.
140
+ **resultsComplete:** callback function - Custom function that is run when the suggestion results dropdown list is made visible. Will run after every search query.
128
141
 
129
142
 
130
143
 
data/Rakefile CHANGED
@@ -1,2 +1,12 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake/testtask'
5
+
6
+ task :default => :test
7
+
8
+ Rake::TestTask.new(:test) do |test|
9
+ test.libs << 'lib' << 'test'
10
+ test.pattern = 'test/**/*_test.rb'
11
+ test.verbose = true
12
+ end
@@ -14,14 +14,15 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "autosuggest-rb"
16
16
 
17
+ s.add_dependency('rails', '~>3.0')
18
+ s.add_dependency('yajl-ruby')
19
+
20
+ s.add_development_dependency('sqlite3-ruby')
21
+ s.add_development_dependency('shoulda', '2.11.3')
22
+ s.add_development_dependency('ruby-debug19')
23
+
17
24
  s.files = `git ls-files`.split("\n")
18
25
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
26
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
27
  s.require_paths = ["lib"]
21
-
22
- s.add_dependency('rails', '~>3.0')
23
- s.add_development_dependency('rspec')
24
- s.add_development_dependency('rspec-rails')
25
- s.add_development_dependency('ruby-debug19')
26
- s.add_development_dependency('mocha')
27
28
  end
@@ -1,14 +1,20 @@
1
+ require 'yajl'
2
+
1
3
  module Autosuggest
2
4
  module ControllerMacros
3
5
  # when called, you must add a custom route for action like this:
4
6
  # resources :products do
5
7
  # get :autosuggest_brand_name, :on => :collection
6
8
  # end
7
- def autosuggest(object, name)
9
+ def autosuggest(object, name, options={})
10
+ display_name = options[:display] || name
11
+ order = options[:order] || "#{name} ASC"
12
+ limit = options[:limit] || 10
13
+
8
14
  define_method "autosuggest_#{object}_#{name}" do
9
15
  # assuming an ActiveRecord mysql backed model for right now
10
- results = objectify(object).where("#{name} LIKE ?", "%#{params[:q]}%")
11
- render :json => results.map{|r| {:name => r.send(:name), :value => r.id}}
16
+ results = objectify(object).where("#{name} LIKE ?", "%#{params[:query]}%").order(order).limit(limit)
17
+ render :json => Yajl::Encoder.encode(results.map{|r| {:name => r.send(display_name), :value => r.id}})
12
18
  end
13
19
  end
14
20
  end
@@ -5,7 +5,7 @@ module ActionView
5
5
  text_field_class = "autosuggest_#{object_name}_#{method}"
6
6
  options[:class] = "#{options[:class].to_s} #{text_field_class}"
7
7
  autosuggest_options = options.delete(:autosuggest_options) || {}
8
- autosuggest_options.reverse_merge!("selectedItemProp" => "name", "searchObjProps" => "name", "neverSubmit" => "true", "asHtmlName" => "#{object_name}[set_#{method}]")
8
+ autosuggest_options.reverse_merge!("queryParam" => "query", "selectedItemProp" => "name", "searchObjProps" => "name", "neverSubmit" => "true", "asHtmlName" => "#{object_name}[set_#{method}]")
9
9
 
10
10
  _out = text_field(object_name, method, options)
11
11
  _out << raw(%{
@@ -1,3 +1,3 @@
1
1
  module Autosuggest
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,8 +1,9 @@
1
1
  require 'rails/generators'
2
2
 
3
3
  class AutosuggestGenerator < Rails::Generators::Base
4
+
4
5
  def install
5
- # Copy the unobtrusive JS file
6
+ # Copy the unobtrusive JS file and CSS file
6
7
  copy_file('jquery.autoSuggest.js', 'public/javascripts/jquery.autoSuggest.js')
7
8
  copy_file('autoSuggest.css', 'public/stylesheets/autoSuggest.css')
8
9
  end
@@ -0,0 +1,73 @@
1
+ require 'test_helper'
2
+
3
+ module Autosuggest
4
+ module TestCase
5
+ include Shoulda::InstanceMethods
6
+ extend Shoulda::ClassMethods
7
+ include Shoulda::Assertions
8
+ extend Shoulda::Macros
9
+ include Shoulda::Helpers
10
+
11
+ context "GET autosuggest action" do
12
+ should "respond succesfully" do
13
+ get :autosuggest_tag_name
14
+ assert_response :success
15
+
16
+ get :autosuggest_tag_name, :query => ''
17
+ assert_response :success
18
+
19
+ get :autosuggest_tag_name, :query => nil
20
+ assert_response :success
21
+
22
+ get :autosuggest_tag_name, :query => 'Ch'
23
+ assert_response :success
24
+ end
25
+
26
+ should "respond with expexted JSON" do
27
+ get :autosuggest_tag_name, :query => 'Ca'
28
+ json_response = JSON.parse(@response.body)
29
+ assert_equal json_response.first["name"], "Cajun"
30
+ end
31
+
32
+ should "return results in alphabetical order by default" do
33
+ get :autosuggest_tag_name, :query => 'Ch'
34
+ json_response = JSON.parse(@response.body)
35
+ assert_equal json_response.first["name"], "Chicken"
36
+ assert_equal json_response.last["name"], "Chinese"
37
+ end
38
+
39
+ should "be able to sort in other ways" do
40
+ @controller.class_eval do
41
+ autosuggest :tag, :name, :order => "name DESC"
42
+ end
43
+
44
+ get :autosuggest_tag_name, :query => 'Ch'
45
+ json_response = JSON.parse(@response.body)
46
+ assert_equal json_response.first["name"], "Chinese"
47
+ assert_equal json_response.last["name"], "Chicken"
48
+ end
49
+
50
+ should "be able to limit the results" do
51
+ @controller.class_eval do
52
+ autosuggest :tag, :name, :limit => 1
53
+ end
54
+
55
+ get :autosuggest_tag_name, :query => 'Ch'
56
+ json_response = JSON.parse(@response.body)
57
+ assert_equal json_response.count, 1
58
+ assert_equal json_response.first["name"], "Chicken"
59
+ end
60
+
61
+ should "be able to customize what is displayed" do
62
+ @controller.class_eval do
63
+ autosuggest :tag, :name, :display => :display_name
64
+ end
65
+
66
+ get :autosuggest_tag_name, :query => 'Ch'
67
+ json_response = JSON.parse(@response.body)
68
+ assert_equal json_response.first["name"], "Tag: Chicken"
69
+ assert_equal json_response.last["name"], "Tag: Chinese"
70
+ end
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+ require 'controller_test'
3
+ require 'support/active_record'
4
+
5
+ class ActiveRecordControllerTest < ActionController::TestCase
6
+ include Autosuggest::TestCase::ActiveRecord
7
+ include Autosuggest::TestCase
8
+ end
@@ -0,0 +1,22 @@
1
+ require 'test_helper'
2
+
3
+ class Tag
4
+ attr_accessor :name
5
+ end
6
+
7
+ class FormHelperTest < ActionView::TestCase
8
+ context "autosuggest_field" do
9
+ should "render properly" do
10
+ output = autosuggest_field(:tag, :name, 'some/path')
11
+ assert_match /class=\" autosuggest_tag_name\"/, output
12
+ assert_match /\$\('.autosuggest_tag_name'\)/, output
13
+ end
14
+ end
15
+
16
+ context "autosuggest_field_tag" do
17
+ should "render properly" do
18
+ raise "implement this"
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,43 @@
1
+ module Autosuggest
2
+ module TestCase
3
+ module ActiveRecord
4
+ def setup
5
+ ::ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
6
+ ::ActiveRecord::Schema.define(:version => 1) do
7
+ create_table :tags do |t|
8
+ t.string :name
9
+ end
10
+ end
11
+
12
+ create_models
13
+
14
+ @controller = RecipesController.new
15
+
16
+ @tag1 = @tag_class.create(:name => 'Chinese')
17
+ @tag2 = @tag_class.create(:name => 'Chicken')
18
+ @tag3 = @tag_class.create(:name => 'Cajun')
19
+ end
20
+
21
+ def teardown
22
+ destroy_models
23
+ ::ActiveRecord::Base.connection.tables.each do |table|
24
+ ::ActiveRecord::Base.connection.drop_table(table)
25
+ end
26
+ end
27
+
28
+ private
29
+ def create_models
30
+ @tag_class = Object.const_set(:Tag, Class.new(::ActiveRecord::Base))
31
+ @tag_class.class_eval do
32
+ def display_name
33
+ "Tag: #{name}"
34
+ end
35
+ end
36
+ end
37
+
38
+ def destroy_models
39
+ Object.send(:remove_const, :Tag)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,28 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'rails/all'
6
+ require 'rails/test_help'
7
+ require 'autosuggest-rb'
8
+ require 'ruby-debug'
9
+ require 'shoulda'
10
+
11
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
12
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+
14
+ module Autosuggest
15
+ class Application < Rails::Application
16
+ end
17
+ end
18
+
19
+ Autosuggest::Application.routes.draw do
20
+ match '/:controller(/:action(/:id))'
21
+ end
22
+
23
+ ActionController::Base.send :include, Autosuggest::Application.routes.url_helpers
24
+
25
+ Ingredient = Class.new
26
+ RecipesController = Class.new(ActionController::Base)
27
+ RecipesController.autosuggest(:tag, :name)
28
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: autosuggest-rb
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Derrick Camerino
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-28 00:00:00 -07:00
13
+ date: 2011-05-30 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -25,7 +25,7 @@ dependencies:
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: yajl-ruby
29
29
  prerelease: false
30
30
  requirement: &id002 !ruby/object:Gem::Requirement
31
31
  none: false
@@ -33,10 +33,10 @@ dependencies:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: "0"
36
- type: :development
36
+ type: :runtime
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: rspec-rails
39
+ name: sqlite3-ruby
40
40
  prerelease: false
41
41
  requirement: &id003 !ruby/object:Gem::Requirement
42
42
  none: false
@@ -47,18 +47,18 @@ dependencies:
47
47
  type: :development
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
50
- name: ruby-debug19
50
+ name: shoulda
51
51
  prerelease: false
52
52
  requirement: &id004 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
- - - ">="
55
+ - - "="
56
56
  - !ruby/object:Gem::Version
57
- version: "0"
57
+ version: 2.11.3
58
58
  type: :development
59
59
  version_requirements: *id004
60
60
  - !ruby/object:Gem::Dependency
61
- name: mocha
61
+ name: ruby-debug19
62
62
  prerelease: false
63
63
  requirement: &id005 !ruby/object:Gem::Requirement
64
64
  none: false
@@ -83,49 +83,6 @@ files:
83
83
  - README.markdown
84
84
  - Rakefile
85
85
  - autosuggest-rb.gemspec
86
- - integration/.gitignore
87
- - integration/Gemfile
88
- - integration/README
89
- - integration/Rakefile
90
- - integration/app/controllers/application_controller.rb
91
- - integration/app/helpers/application_helper.rb
92
- - integration/app/views/layouts/application.html.erb
93
- - integration/config.ru
94
- - integration/config/application.rb
95
- - integration/config/boot.rb
96
- - integration/config/database.yml
97
- - integration/config/environment.rb
98
- - integration/config/environments/development.rb
99
- - integration/config/environments/production.rb
100
- - integration/config/environments/test.rb
101
- - integration/config/initializers/backtrace_silencers.rb
102
- - integration/config/initializers/inflections.rb
103
- - integration/config/initializers/mime_types.rb
104
- - integration/config/initializers/secret_token.rb
105
- - integration/config/initializers/session_store.rb
106
- - integration/config/locales/en.yml
107
- - integration/config/routes.rb
108
- - integration/db/seeds.rb
109
- - integration/doc/README_FOR_APP
110
- - integration/lib/tasks/.gitkeep
111
- - integration/public/404.html
112
- - integration/public/422.html
113
- - integration/public/500.html
114
- - integration/public/favicon.ico
115
- - integration/public/images/rails.png
116
- - integration/public/index.html
117
- - integration/public/javascripts/application.js
118
- - integration/public/javascripts/controls.js
119
- - integration/public/javascripts/dragdrop.js
120
- - integration/public/javascripts/effects.js
121
- - integration/public/javascripts/prototype.js
122
- - integration/public/javascripts/rails.js
123
- - integration/public/robots.txt
124
- - integration/public/stylesheets/.gitkeep
125
- - integration/script/rails
126
- - integration/test/performance/browsing_test.rb
127
- - integration/test/test_helper.rb
128
- - integration/vendor/plugins/.gitkeep
129
86
  - lib/autosuggest-rb.rb
130
87
  - lib/autosuggest/controller_macros.rb
131
88
  - lib/autosuggest/form_helper.rb
@@ -134,8 +91,11 @@ files:
134
91
  - lib/generators/assets/autoSuggest.css
135
92
  - lib/generators/assets/jquery.autoSuggest.js
136
93
  - lib/generators/autosuggest_generator.rb
137
- - spec/lib/class_methods_spec.rb
138
- - spec/spec_helper.rb
94
+ - test/controller_test.rb
95
+ - test/db_stores_test.rb
96
+ - test/form_helper_test.rb
97
+ - test/support/active_record.rb
98
+ - test/test_helper.rb
139
99
  has_rdoc: true
140
100
  homepage: ""
141
101
  licenses: []
@@ -165,5 +125,8 @@ signing_key:
165
125
  specification_version: 3
166
126
  summary: This is a gem that wraps the AutoSuggest javascript plugin
167
127
  test_files:
168
- - spec/lib/class_methods_spec.rb
169
- - spec/spec_helper.rb
128
+ - test/controller_test.rb
129
+ - test/db_stores_test.rb
130
+ - test/form_helper_test.rb
131
+ - test/support/active_record.rb
132
+ - test/test_helper.rb