ransack_memory 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84da2b6282251a6c2235bb4e88b0439188cd344b
4
- data.tar.gz: 8c672606a1b68252a0fd0bcc6812da4921e7f358
3
+ metadata.gz: 78381a44c0c26cf03921807306297dda0f139738
4
+ data.tar.gz: 9ad84df843202fbb9d70cd3a4ce881fa8a2d179e
5
5
  SHA512:
6
- metadata.gz: ffa3fee99e4c59e0fe6388fc2260932374ad6dea4216c6fc5601fec09a759a4ba7073b56cc0db73d34416b95acc1e468b2cd42fe51c245393ced4ae440b5c941
7
- data.tar.gz: 8f3db8e4b5109f6730282c625eb20b4dcaad7c478e00820ee853fd071acafb65828ead6e97704f082811efa994c86200e12b303a064adc4693348fae6ab73220
6
+ metadata.gz: 8f1c3810e4a3731a04a51a135ef57e157971d7d5ee50ee4a6a0e87bfe2655ee3de3bc0e67074df0943552abe2a21ef4bf9bd5fce9ee14c8ec3011009944f7c47
7
+ data.tar.gz: 8ea4ea7d235af00d2717c500890c573ceed214ac797063fb4c5850f3cbf59f5d58ff2c309ec43abba40a4afc9ac850f2442632fbe8c26b23d6ab0d25c2677651
data/README.md CHANGED
@@ -36,9 +36,16 @@ Create file in config/initializers/ransack_memory.rb with this content:
36
36
 
37
37
  ```ruby
38
38
  RansackMemory::Core.config = {
39
- param: :q # this means the default Ransack param name for searching. You can change it
39
+ param: :q, # this means the default Ransack param name for searching. You can change it
40
+ session_key_format: '%controller_name%_%action_name%_%request_format%' # this means how the key used to store the information to the session will be stored. Currently it interpolates request parameters. You can customize it and use these vars to build a key that fits your needs
40
41
  }
41
42
  ```
42
43
 
43
44
  Or you can generate this config file by running ```rails generate ransack_memory``` in console.
44
45
 
46
+ ## Kaminari issue
47
+
48
+ When you have an issue with Kaminari gem, that you can't go back to the first page, update your kaminari view in `app/views/kaminari/_first_page.html.erb`:
49
+ ```erb
50
+ <%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url_for(params.merge({page: 1, cancel_filter: nil})), remote: remote, class: 'btn btn-secondary' %>
51
+ ```
@@ -3,8 +3,12 @@ module RansackMemory
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def save_and_load_filters
6
-
7
- session_key_base = "ranmemory_#{controller_name}_#{action_name}_#{request.format.symbol.to_s}"
6
+ session_key_identifier = ::RansackMemory::Core.config[:session_key_format]
7
+ .gsub('%controller_name%', controller_name)
8
+ .gsub('%action_name%', action_name)
9
+ .gsub('%request_format%', request.format.symbol.to_s)
10
+
11
+ session_key_base = "ranmemory_#{session_key_identifier}"
8
12
 
9
13
  # permit search params
10
14
  params[::RansackMemory::Core.config[:param]].permit! if params[::RansackMemory::Core.config[:param]].present? && params[::RansackMemory::Core.config[:param]].respond_to?(:permit)
@@ -1,3 +1,3 @@
1
1
  module RansackMemory
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -1,3 +1,4 @@
1
1
  RansackMemory::Core.config = {
2
- param: :q # this means the default Ransack param name for searching. You can change it
2
+ param: :q, # this means the default Ransack param name for searching. You can change it
3
+ session_key_format: '%controller_name%_%action_name%_%request_format%' # this means how the key used to store the information to the session will be stored. Currently it interpolates request parameters. You can customize it and use these vars to build a key that fits your needs
3
4
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ransack_memory
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lapiš
@@ -36,17 +36,17 @@ require_paths:
36
36
  - lib
37
37
  required_ruby_version: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.9.3
42
42
  required_rubygems_version: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  requirements: []
48
48
  rubyforge_project:
49
- rubygems_version: 2.4.8
49
+ rubygems_version: 2.6.13
50
50
  signing_key:
51
51
  specification_version: 3
52
52
  summary: Automatically save and load ransack's filtered params into session