mappable 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -82,6 +82,8 @@ Now you can map strings in either direction using the following grammar
|
|
82
82
|
|
83
83
|
## TODO ##
|
84
84
|
|
85
|
+
Move rebuilding of maps to an initializer and/or add notes to readme about why Map.all gets called on every request in development
|
85
86
|
Better indexing in migrations
|
86
87
|
Rake task for installing views
|
87
88
|
Add security features
|
89
|
+
Deal with going from/to when there's more than one to with the same name
|
@@ -1,52 +1,52 @@
|
|
1
1
|
module Mappable
|
2
2
|
class MappingsController < ::ApplicationController
|
3
3
|
before_filter :load_map!, only: [:index, :new]
|
4
|
-
|
4
|
+
|
5
5
|
def index
|
6
6
|
@mappings = @map.mappings
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def show
|
10
10
|
@mapping = Mapping.find(params[:id])
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def new
|
14
14
|
@mapping = Mapping.new(map: @map)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
def edit
|
18
18
|
@mapping = Mapping.find(params[:id])
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def create
|
22
22
|
@mapping = Mapping.new(params[:mapping])
|
23
|
-
|
23
|
+
|
24
24
|
if @mapping.save
|
25
|
-
redirect_to
|
25
|
+
redirect_to mappings_path(subject: @mapping.parent_map.subject, attr: @mapping.parent_map.attr.pluralize), notice: 'Mapping was successfully created.'
|
26
26
|
else
|
27
27
|
render action: "new"
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def update
|
32
32
|
@mapping = Mapping.find(params[:id])
|
33
|
-
|
33
|
+
|
34
34
|
if @mapping.update_attributes(params[:mapping])
|
35
|
-
redirect_to
|
35
|
+
redirect_to mappings_path(subject: @mapping.parent_map.subject, attr: @mapping.parent_map.attr.pluralize), notice: 'Mapping was successfully updated.'
|
36
36
|
else
|
37
37
|
render action: "edit"
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def destroy
|
42
42
|
@mapping = Mapping.find(params[:id])
|
43
43
|
@mapping.destroy
|
44
|
-
|
45
|
-
redirect_to
|
44
|
+
|
45
|
+
redirect_to mappings_path
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
private
|
49
|
-
|
49
|
+
|
50
50
|
def load_map!
|
51
51
|
@map = Map.find_by_subject_and_attr!(params[:subject], params[:attr].try(:singularize))
|
52
52
|
end
|
@@ -3,44 +3,44 @@ module Mappable
|
|
3
3
|
def index
|
4
4
|
@maps = Map.all
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
def show
|
8
8
|
@map = Map.find(params[:id])
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def new
|
12
12
|
@map = Map.new
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def edit
|
16
16
|
@map = Map.find(params[:id])
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def create
|
20
20
|
@map = Map.new(params[:map])
|
21
|
-
|
21
|
+
|
22
22
|
if @map.save
|
23
|
-
redirect_to
|
23
|
+
redirect_to maps_path, notice: 'Map was successfully created.'
|
24
24
|
else
|
25
25
|
render action: "new"
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def update
|
30
30
|
@map = Map.find(params[:id])
|
31
|
-
|
31
|
+
|
32
32
|
if @map.update_attributes(params[:map])
|
33
|
-
redirect_to
|
33
|
+
redirect_to maps_path, notice: 'Map was successfully updated.'
|
34
34
|
else
|
35
35
|
render action: "edit"
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def destroy
|
40
40
|
@map = Map.find(params[:id])
|
41
41
|
@map.destroy
|
42
|
-
|
43
|
-
redirect_to
|
42
|
+
|
43
|
+
redirect_to maps_path
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= form_for(@mapping, url:
|
1
|
+
<%= form_for(@mapping, url: mappings_path(subject: @mapping.parent_map.subject, attr: @mapping.parent_map.attr.pluralize)) do |f| %>
|
2
2
|
<% if @mapping.errors.any? %>
|
3
3
|
<div id="error_explanation">
|
4
4
|
<h2><%= pluralize(@mapping.errors.count, "error") %> prohibited this mapping from being saved:</h2>
|
data/lib/mappable/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mappable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-30 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70211475888860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70211475888860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &70211475888280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.3.4
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70211475888280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &70211475887740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.6.1
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70211475887740
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: capybara
|
49
|
-
requirement: &
|
49
|
+
requirement: &70211475887280 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.1.1
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70211475887280
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mocha
|
60
|
-
requirement: &
|
60
|
+
requirement: &70211475886720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.10.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70211475886720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: launchy
|
71
|
-
requirement: &
|
71
|
+
requirement: &70211475886260 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 2.0.5
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70211475886260
|
80
80
|
description: Lightweight string mappings engine for Rails
|
81
81
|
email:
|
82
82
|
- mikebannister@gmail.com
|
@@ -137,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
segments:
|
139
139
|
- 0
|
140
|
-
hash:
|
140
|
+
hash: -719282748366311490
|
141
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
142
|
none: false
|
143
143
|
requirements:
|
@@ -146,10 +146,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
segments:
|
148
148
|
- 0
|
149
|
-
hash:
|
149
|
+
hash: -719282748366311490
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
|
-
rubygems_version: 1.8.
|
152
|
+
rubygems_version: 1.8.10
|
153
153
|
signing_key:
|
154
154
|
specification_version: 3
|
155
155
|
summary: Lightweight string mappings engine for Rails
|