searcher_generator 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e083a1049cb512c50397af9aa504a246fa94f72
4
- data.tar.gz: de324da787d8e75fb18b1817e5fc269966848bb4
3
+ metadata.gz: d1971844b1e1f18766081f200b3854d0ac7e2f1f
4
+ data.tar.gz: 6737e5364750fc2bc4f8fdc4c97f236a047ce036
5
5
  SHA512:
6
- metadata.gz: '095c0828c2f060eb89700cdecaad78276d2374cd35e1b9ae8089daf466c495e53b1dc0f701afa6b76e8c6355b2a7118363c966eca8126ba246f408ca1fc6f494'
7
- data.tar.gz: 478c07aa4d5061d446df9503550962f48eaf623102470a2508ee166078b55090bb52c73c5c34c8c379e57d0d35dab6d789820ec03dcc00ab8108b163a33c439a
6
+ metadata.gz: c7892a58f78cd4e31c760bad7e14ef671562b9c7452392bf26684503390d7a31bbf0ecf943f77c6527d613f241b7bf0a73e2b18c92c3079ccc444a74083642e8
7
+ data.tar.gz: 010dee42c38af8ff97fa50ac11275dee0205e6187108dc8bbd0e5d8fca7c6aa723a2c45ac4a7435d7e1fb5a8c1488c76f34d7acf1b57bc58ea74c7d250d816ff
data/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- rails generate search <ModelName> atrribute:"attribute humanize name"
21
+ rails generate search <ModelName> atrribute:"attribute humanize name" humanize_model@:<model humanize name>
22
22
 
23
23
  This will create:
24
24
  1- searcher class '<ModelSearcher>'
@@ -33,6 +33,7 @@ Or install it yourself as:
33
33
  (iii) e$ - it will create enum type attribute
34
34
  (iv) approval_status@ - it will create approval_status attribute
35
35
  (v) page@ - it will create page attribute
36
+ (vi) humanize_model@ - it will add humanize model name
36
37
 
37
38
  Things to do after running this command
38
39
  1- changes in routes file
@@ -45,7 +45,8 @@ class SearchGenerator < Rails::Generators::Base
45
45
  def symbolize_attribute
46
46
  f = ""
47
47
  get_attributes.each do |k, v|
48
- if k.include?("bet1")
48
+ if k.include?("humanize_model@")
49
+ elsif k.include?("bet1")
49
50
  k = k.chomp("bet1")
50
51
  f = f + ":from_#{k}, "
51
52
  f = f + ":to_#{k}, "
@@ -1,7 +1,7 @@
1
1
  = search_form_for @searcher do |f|
2
2
  = f.standard_fields
3
3
  <% attributes.each do |attr|-%>
4
- <% if attr[0].include?("approval_status@") or attr[0].include?("page@")-%>
4
+ <% if attr[0].include?("approval_status@") or attr[0].include?("page@") or attr[0].include?("humanize_model@")-%>
5
5
  <% elsif attr[0].include?("e$") -%>
6
6
  = f.input :<%=attr[0].chomp('e$')%>, as: :enum
7
7
  <% elsif attr[0].include?("bet1") -%>
@@ -1,11 +1,11 @@
1
1
  en:
2
2
  activerecord:
3
3
  models:
4
- <%= model_name.underscore %>: "<%=model_name%>"
4
+ <%= model_name.underscore %>: "<%=get_attributes["humanize_model@"]%>"
5
5
  attributes:
6
6
  <%= model_name.underscore %>: &attributes
7
7
  <% get_attributes.each do |attr| -%>
8
- <% if attr[0].include?("approval_status@") or attr[0].include?("page@")-%>
8
+ <% if attr[0].include?("approval_status@") or attr[0].include?("page@")or attr[0].include?("humanize_model@")-%>
9
9
  <% elsif attr[0].include?("e$") -%>
10
10
  <%=attr[0].chomp('e$')%>: "<%= attr[1]%>"
11
11
  <% elsif attr[0].include?("bet1") -%>
@@ -16,7 +16,7 @@ en:
16
16
  <% end -%>
17
17
  activemodel:
18
18
  models:
19
- <%= model_name.underscore %>_searcher: '<%=model_name%>'
19
+ <%= model_name.underscore %>_searcher: '<%=get_attributes["humanize_model@"]%>'
20
20
  attributes:
21
21
  <%= model_name.underscore %>_searcher:
22
22
  <<: *attributes
@@ -1,3 +1,3 @@
1
1
  module SearcherGenerator
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searcher_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pawan bora