ransack_ui 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,18 @@
1
1
  module RansackUI
2
2
  module ControllerHelpers
3
3
  # Builds @ransack_search object from params[:q]
4
- # Infers model class from controller name.
4
+ # Model class can be passed in or inferred from controller name.
5
5
  #
6
6
  # Should be used as a before_filter, e.g.:
7
7
  # before_filter :load_ransack_search, :only => :index
8
- def load_ransack_search
9
- klass = controller_name.classify.constantize
8
+ #
9
+ # Can also be called as a function if needed. Will return the search object.
10
+ #
11
+ def load_ransack_search(klass = nil)
12
+ klass ||= controller_name.classify.constantize
10
13
  @ransack_search = klass.search(params[:q])
11
14
  @ransack_search.build_grouping unless @ransack_search.groupings.any?
15
+ @ransack_search
12
16
  end
13
17
  end
14
18
  end
@@ -1,3 +1,3 @@
1
1
  module RansackUI
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: 1635052195290781478
81
+ hash: 3084815049193877844
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
@@ -87,10 +87,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: 1635052195290781478
90
+ hash: 3084815049193877844
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 1.8.24
93
+ rubygems_version: 1.8.21
94
94
  signing_key:
95
95
  specification_version: 3
96
96
  summary: UI Builder for Ransack