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 +4 -4
- data/README.md +27 -1
- data/lib/listly/railtie.rb +0 -2
- data/lib/listly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a63289d6cef2f01ec2176bda5392cb6647864d24
|
4
|
+
data.tar.gz: 7ba115c2d0729862edcc777b8386877654f6cea2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
```
|
data/lib/listly/railtie.rb
CHANGED
data/lib/listly/version.rb
CHANGED
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
|
+
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-
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|