listly 0.1.4 → 0.1.5

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: 06730e4bf6465e967b61301ae338d24863e58c6a
4
- data.tar.gz: cfd63cdd96c7192d9a1846fc3ca723ea0c5fc692
3
+ metadata.gz: a63289d6cef2f01ec2176bda5392cb6647864d24
4
+ data.tar.gz: 7ba115c2d0729862edcc777b8386877654f6cea2
5
5
  SHA512:
6
- metadata.gz: 2143ec5091d4ac1eb46602ac782b612c34e8067390c6a6059e6e4308a15574a772c706600963428d1b23e19c06f8ace9eb7e571e0aea34f6166d5776cd5a133b
7
- data.tar.gz: 7015231ed9ebbbb9a218aeb8e6787f284efe624cf27ed5209a05d23a3c971c4d84a1b0e4d418920ea559b1473c319b5484dd8e4a89c4aa3c6151106453cdb190
6
+ metadata.gz: 90fb1b1b0e6ac67ca2fcfa426cf2eccc492d37710e140e6b845a683e98ff657a29232c331faa4ecd284802d6b837a147f8ecfde54ae786863cc8fb0d04549414
7
+ data.tar.gz: fecd689192a0d2f16bff4578a53483bab9f0430587473640a9bcf93c8ca977b58fcc5fbd42d79f1018049a04dc933fdfe21f696c6c98a891032a664c5478b474
data/README.md CHANGED
@@ -39,9 +39,13 @@ config/locales. Anywhere will do since they all will be loaded!
39
39
 
40
40
  ```ruby
41
41
 
42
+ # your module needs to be loaded/required before the application starts such as
43
+ require File.dirname(__FILE__) + '/../lib/local_list_constants'
44
+
42
45
  module YourRailsApp
43
46
  class Application < Rails::Application
44
47
  ...
48
+ # Then the settings need to be included in the rails start up process
45
49
  config.listly.listly_store_location = :local_list_store
46
50
  config.listly.listly_constants_module = :local_list_constants # <--- ModuleName as symbol
47
51
  ...
@@ -88,6 +92,28 @@ i.e. "states_hash: code" will be the code attribute on the list etc..
88
92
 
89
93
  ## Usage
90
94
 
95
+ ### To test this in the Rails console:
96
+
97
+ ```ruby
98
+ rails c
99
+
100
+ # Then create a dummy test class & include one of your lists - such as the Sex List above
101
+ class DummyList
102
+ include Listly::SexTypes
103
+ end
104
+
105
+ test_list = DummyList.new
106
+
107
+ # then to see all items in the list
108
+
109
+ test_list.all_sex_types # - this will give you an array of all the sex types..
110
+
111
+ => [#<Listly::SexTypes::MySexTypes:0x000001078a13f0 @list_hash={"sex_types_code"=>"male", "sex_types_name"=>"Male"}, @sex_types_code="male", @sex_types_name="Male">, #<Listly::SexTypes::MySexTypes:0x000001078a0720 @list_hash={"sex_types_code"=>"female", "sex_types_name"=>"Female"}, @sex_types_code="female", @sex_types_name="Female">, #<Listly::SexTypes::MySexTypes:0x0000010789ba18 @list_hash={"sex_types_code"=>"notset", "sex_types_name"=>"Not Set"}, @sex_types_code="notset", @sex_types_name="Not Set">]
112
+
113
+ ```
114
+
115
+ ### How to use this in a view template and or rails form:
116
+
91
117
  To therefore use this in a view template in rails or a form - you simply need to include
92
118
  the module with the list into the view template. I frequently use mustache view wrappers
93
119
  which would look like this:
@@ -103,7 +129,7 @@ module Wrapper
103
129
  include PageHeader
104
130
  include Mustache::FormBuilder
105
131
  include Wrapper::Person::Form
106
- include SexTypes # <------ This is the included list module - see the SEX_TYPES
132
+ include ListLy::SexTypes # <------ This is the included list module - see the SEX_TYPES
107
133
  # constant in the LocalListConstants module above
108
134
 
109
135
  ```
@@ -1,8 +1,6 @@
1
1
  #
2
2
  module Listly
3
3
  class Railtie < Rails::Railtie
4
- #
5
- puts "\n\n Loading Railtie..\n\n"
6
4
  #
7
5
  # enable namespaced configuration in Rails environments
8
6
  config.listly = ActiveSupport::OrderedOptions.new
@@ -1,3 +1,3 @@
1
1
  module Listly
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: listly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Forkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-31 00:00:00.000000000 Z
11
+ date: 2015-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler