has_searcher 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,6 +11,14 @@ class Search < ActiveRecord::Base
11
11
  columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default,
12
12
  sql_type.to_s, null)
13
13
  end
14
+
15
+ def column_defaults
16
+ columns.map(&:name).inject({}) do | hash, name | hash[name] = nil; hash end
17
+ end
18
+
19
+ def columns_hash
20
+ columns.inject({}) do | hash, column | hash[column.name] = column; hash end
21
+ end
14
22
  end
15
23
 
16
24
  def pagination
@@ -1,13 +1,21 @@
1
1
  require 'formtastic'
2
2
 
3
3
  module Formtastic
4
+ module Helpers
5
+ module FormHelper
6
+ def semantic_search_form_for(name, *args, &proc)
7
+ options = args.extract_options!
8
+ options.reverse_merge! :html => {:method => :get}
9
+ url = params[:controller].sub(/\/\w+$/, '').split("/").map(&:underscore)
10
+ options[:url] ||= url.push name.to_s.pluralize
11
+ semantic_form_for searcher_for(name), *(args << options), &proc
12
+ end
13
+ end
14
+ end
15
+
4
16
  module SemanticFormHelper
5
- def semantic_search_form_for(name, *args, &proc)
6
- options = args.extract_options!
7
- options.reverse_merge! :html => {:method => :get}
8
- url = params[:controller].sub(/\/\w+$/, '').split("/").map(&:underscore)
9
- options[:url] ||= url.push name.to_s.pluralize
10
- semantic_form_for searcher_for(name), *(args << options), &proc
17
+ def semantic_search_form_for(*args)
18
+ Formtastic::Helpers::FormHelper.semantic_search_form_for(args)
11
19
  end
12
20
  end
13
21
 
@@ -1,3 +1,3 @@
1
1
  module HasSearcher
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dmitry Lihachev
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-09-14 00:00:00 +07:00
17
+ date: 2011-10-10 00:00:00 +07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20