state_pattern 2.0.1 → 2.0.2
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 +7 -0
- data/README.md +8 -4
- data/examples/rails_3_button_example/script/rails +0 -0
- data/examples/rails_4_button_example/Gemfile +46 -0
- data/examples/rails_4_button_example/Gemfile.lock +157 -0
- data/examples/rails_4_button_example/README.rdoc +28 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/Rakefile +2 -6
- data/examples/rails_4_button_example/app/assets/javascripts/application.js +16 -0
- data/examples/rails_4_button_example/app/assets/stylesheets/application.css +15 -0
- data/examples/rails_4_button_example/app/controllers/application_controller.rb +5 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/app/controllers/buttons_controller.rb +3 -8
- data/examples/rails_4_button_example/app/helpers/application_helper.rb +2 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/app/models/button.rb +0 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/app/models/button/off.rb +0 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/app/models/button/on.rb +0 -0
- data/examples/rails_4_button_example/app/views/buttons/_form.html.erb +21 -0
- data/examples/rails_4_button_example/app/views/buttons/edit.html.erb +6 -0
- data/examples/rails_4_button_example/app/views/buttons/index.html.erb +23 -0
- data/examples/rails_4_button_example/app/views/buttons/new.html.erb +5 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/app/views/buttons/show.html.erb +1 -1
- data/examples/rails_4_button_example/app/views/layouts/application.html.erb +12 -0
- data/examples/rails_4_button_example/bin/bundle +3 -0
- data/examples/rails_4_button_example/bin/rails +8 -0
- data/examples/rails_4_button_example/bin/rake +8 -0
- data/examples/rails_4_button_example/bin/setup +29 -0
- data/examples/rails_4_button_example/bin/spring +15 -0
- data/examples/rails_4_button_example/config.ru +4 -0
- data/examples/rails_4_button_example/config/application.rb +26 -0
- data/examples/rails_4_button_example/config/boot.rb +3 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/config/database.yml +0 -0
- data/examples/rails_4_button_example/config/environment.rb +5 -0
- data/examples/rails_4_button_example/config/environments/development.rb +41 -0
- data/examples/rails_4_button_example/config/environments/production.rb +79 -0
- data/examples/rails_4_button_example/config/environments/test.rb +42 -0
- data/examples/rails_4_button_example/config/initializers/assets.rb +11 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/config/initializers/backtrace_silencers.rb +2 -2
- data/examples/rails_4_button_example/config/initializers/cookies_serializer.rb +3 -0
- data/examples/rails_4_button_example/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rails_4_button_example/config/initializers/inflections.rb +16 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/config/initializers/mime_types.rb +0 -1
- data/examples/rails_4_button_example/config/initializers/session_store.rb +3 -0
- data/examples/rails_4_button_example/config/initializers/wrap_parameters.rb +14 -0
- data/examples/rails_4_button_example/config/locales/en.yml +23 -0
- data/examples/rails_4_button_example/config/routes.rb +5 -0
- data/examples/rails_4_button_example/config/secrets.yml +22 -0
- data/examples/{rails_3_button_example → rails_4_button_example}/db/development.sqlite3 +0 -0
- data/examples/rails_4_button_example/db/schema.rb +21 -0
- data/examples/{rails_2_3_8_button_example → rails_4_button_example}/db/seeds.rb +3 -3
- data/examples/rails_4_button_example/db/test.sqlite3 +0 -0
- data/examples/rails_4_button_example/public/404.html +67 -0
- data/examples/rails_4_button_example/public/422.html +67 -0
- data/examples/rails_4_button_example/public/500.html +66 -0
- data/examples/rails_4_button_example/public/favicon.ico +0 -0
- data/examples/rails_4_button_example/public/robots.txt +5 -0
- data/examples/rails_4_button_example/test/test_helper.rb +10 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/0BJF3aE6L9I-CdqfM1vkFjpFBWqYfezN_FW0Lj8RF4A.cache +2 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/25cnngfH_LUdZUzCkWGHXzOa7gYAIbK1KokOftWRmAQ.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/3hl1sZkns5ee8V-i-WR-XsJ9Q1Eb8R4ae2xOpLheBN0.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/AgXtbwKSwhtftp5wI3VQUtwmz6kB4r6m75W7b-iFYZ4.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/BRmY2myye-FTQX-95MjIHm2DL2xKXJlLcGl7Xh1lE_I.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/D4INSAJh2MuaZXOe1khQPTL-_wxRvNDwJb3gTkgnye4.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/ESVS2t_92m256UsCWPucHsMgAf3mK8kYdKuc1047Lwo.cache +3 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/GpmXMnR78YiAOw85MO8NNmw2iLQ79-a_9GExT6Vt0lI.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/GyoBO1Lr-5cRy5clwoTZ5p1jZFNLHymE44cE0tlBKFY.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/IEoe5zOhmWy0JaBQe7z0EuqQ7QyiWkdBzstXZjsEKZo.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/ISkwmSSt8rrkdRL1GwBn9o4ILWaNnOJyixxf4RX94z4.cache +2 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/Im0488zfiXCJH-KMbI4A7h6A1rax9XpKQnC3DFko1Tg.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/LiJ9_nrPkr74731F6YeBknQUCRFqzKeo-P1LntAfTl8.cache +2 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/N7RuW5y7R05Kmq0ismjda4wp0u1UCLE5TqStjtASNMU.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/OuEnX_z_G8Ja1YbbCjd5aQ9O9ry06I8X0EKCdZ0GO04.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/TMI1rsUDvy6QDgEC4o39T2vtzA2PbuzLav-J4rCXSuM.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/VT3u8_h-fkin9_cEH_E8D6BLsz_3vEtZF2KwWX3RZE8.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/X7l7HU-zo5WW5WmIJE9MnY5wKmCphQiqiI0l00JWUA4.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/XU4CHJPKIryEop9D5jhiVfnW-9F5Cxzujoa6zwA9egE.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/aOzh5w6UU36ks31JV_onH2aPBTI5dFTF-zF7-vvKK1c.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/bMj6M9wSBtZfHLG65eW2u9NINz-F2yWF0wvJnx5xBpg.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/c8UWC3Xah91Ham9SSBwpt2O02vgnSIUTWNiCyfI5YJ8.cache +2 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/dHBwAzZ_u-AXSdVdNW0B7bIzniKy2EAWcNcrvMTxh_k.cache +2 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/fZ12J5mB4ihVvZDBTocYdXAen7YEXjkzDkaqa3D1mI8.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/fnePkpq2OgSfrlujhk1_fNG6kjuMZ61mDG0c0Ivit9U.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/g0XgcH-GeMIj0lwPaHV5IqDcQzJvnR3Xw_8dg0DBVho.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/iGYHI6OqKX0w3ivvIXR-boAWL5x81VEM_GqoNJCBr6s.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/l4fHH1Zo47D2G0zAnbfyDyaxlUq4_R6O1R_xNoqmHhw.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/mKQKN_P_8jYD-Q80hhjvo4e3LImaXAMIThYLqa9Apvw.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/mWqYee_LlZoGLCIvrCNU_U1gCixLtE_1c-aRqNkooZE.cache +2 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/my8kgZGxmOFYs4sBIlBx4mPLa3-bz0D1PfUl737ixlU.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/nW-hLkhpsu1Zh2w1u0dXHVkdIslZUKkcvE8CLVIW62Y.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/p_8FlTUmjyxhzHW7PiP9gJydL0GWbtF7zMAsolZQt7s.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/sRmbkRkNO0Rz5igafyTEwypjH6THAj7wiv24NFKOouw.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/uHtYDCLtnVci3xvC8mW10dfUdR20jK-cAPNTSx-uWBg.cache +0 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/vWSj4lAxWQ9AJD4chDHnsj4iDBTcPAQKSVOIqHe_4Pg.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/ychj6_LlHUXHJTPKIinw5cIDiTrudXh6MR_7zO-kpAw.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/zh122yIBAuJyzL1VU2PIldcpbQl7ecXz-EmuWGZYFrk.cache +1 -0
- data/examples/rails_4_button_example/tmp/cache/assets/development/sprockets/v3.0/zo647VN_kDb913bXE7Ta0qarVlYZJ2iCgNNAmquQftQ.cache +0 -0
- data/lib/state_pattern/active_record.rb +1 -1
- data/test/state_pattern/active_record/active_record_test.rb +1 -0
- data/test/test_helper.rb +2 -5
- metadata +309 -233
- data/examples/rails_2_3_8_button_example/README +0 -243
- data/examples/rails_2_3_8_button_example/app/controllers/application_controller.rb +0 -2
- data/examples/rails_2_3_8_button_example/app/helpers/application_helper.rb +0 -3
- data/examples/rails_2_3_8_button_example/app/views/layouts/application.html.erb +0 -12
- data/examples/rails_2_3_8_button_example/config/boot.rb +0 -110
- data/examples/rails_2_3_8_button_example/config/environment.rb +0 -41
- data/examples/rails_2_3_8_button_example/config/environments/development.rb +0 -17
- data/examples/rails_2_3_8_button_example/config/environments/production.rb +0 -28
- data/examples/rails_2_3_8_button_example/config/environments/test.rb +0 -28
- data/examples/rails_2_3_8_button_example/config/initializers/cookie_verification_secret.rb +0 -7
- data/examples/rails_2_3_8_button_example/config/initializers/inflections.rb +0 -10
- data/examples/rails_2_3_8_button_example/config/initializers/new_rails_defaults.rb +0 -21
- data/examples/rails_2_3_8_button_example/config/initializers/session_store.rb +0 -15
- data/examples/rails_2_3_8_button_example/config/locales/en.yml +0 -5
- data/examples/rails_2_3_8_button_example/config/routes.rb +0 -4
- data/examples/rails_2_3_8_button_example/db/development.sqlite3 +0 -0
- data/examples/rails_2_3_8_button_example/db/migrate/20101009073737_create_buttons.rb +0 -13
- data/examples/rails_2_3_8_button_example/db/schema.rb +0 -20
- data/examples/rails_2_3_8_button_example/db/test.sqlite3 +0 -0
- data/examples/rails_2_3_8_button_example/doc/README_FOR_APP +0 -2
- data/examples/rails_2_3_8_button_example/public/images/rails.png +0 -0
- data/examples/rails_2_3_8_button_example/public/javascripts/application.js +0 -2
- data/examples/rails_2_3_8_button_example/public/javascripts/controls.js +0 -963
- data/examples/rails_2_3_8_button_example/public/javascripts/dragdrop.js +0 -973
- data/examples/rails_2_3_8_button_example/public/javascripts/effects.js +0 -1128
- data/examples/rails_2_3_8_button_example/public/javascripts/prototype.js +0 -4320
- data/examples/rails_2_3_8_button_example/public/javascripts/rails.js +0 -175
- data/examples/rails_2_3_8_button_example/script/about +0 -4
- data/examples/rails_2_3_8_button_example/script/console +0 -3
- data/examples/rails_2_3_8_button_example/script/dbconsole +0 -3
- data/examples/rails_2_3_8_button_example/script/destroy +0 -3
- data/examples/rails_2_3_8_button_example/script/generate +0 -3
- data/examples/rails_2_3_8_button_example/script/performance/benchmarker +0 -3
- data/examples/rails_2_3_8_button_example/script/performance/profiler +0 -3
- data/examples/rails_2_3_8_button_example/script/plugin +0 -3
- data/examples/rails_2_3_8_button_example/script/runner +0 -3
- data/examples/rails_2_3_8_button_example/script/server +0 -3
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: fb97a238222cce82bce69fe540c126ca4980b294
|
|
4
|
+
data.tar.gz: 2afedceb46044301794a0c5f9fe16c9a57d2201a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 51bc25d18d1d8f870c750d2cca11dc0d8f6788464bd0054e5b9c2d99ead6c1031ac00cc1eeb36f29f68e92f6f695cec666e6b441d1835f2d6538048374616456
|
|
7
|
+
data.tar.gz: 047a1eb3748217fb59271e2f2c0d400264bb26a2e92fc821826dbe441aae6b0dbe3cdd5a5f304d52b430dccf60fdab83df3f4f27d8cd55bc895d6ac33f42340f
|
data/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
[](http://travis-ci.org/dcadenas/state_pattern)
|
|
2
|
+
[](https://codeclimate.com/github/dcadenas/state_pattern)
|
|
3
|
+
[](http://coderwall.com/dcadenas)
|
|
2
4
|
|
|
3
5
|
# state_pattern
|
|
4
6
|
|
|
@@ -73,7 +75,7 @@ loop do
|
|
|
73
75
|
end
|
|
74
76
|
```
|
|
75
77
|
|
|
76
|
-
Let's now use one nice example from the AASM documentation and translate it to state_pattern.
|
|
78
|
+
Let's now use one nice example from the [AASM](http://github.com/rubyist/aasm) documentation and translate it to state_pattern.
|
|
77
79
|
|
|
78
80
|
```ruby
|
|
79
81
|
require 'state_pattern'
|
|
@@ -163,7 +165,7 @@ end
|
|
|
163
165
|
To use the state pattern in your Rails models you need to:
|
|
164
166
|
|
|
165
167
|
* Add a state column for your model table of type string
|
|
166
|
-
* Include StatePattern::ActiveRecord in your model file
|
|
168
|
+
* Include `StatePattern::ActiveRecord` in your model file
|
|
167
169
|
* Use the state pattern as you would do in a plain Ruby class as shown above
|
|
168
170
|
|
|
169
171
|
Please see the examples folder for a Rails 3 example.
|
|
@@ -254,7 +256,7 @@ set_state_attribute :state_column
|
|
|
254
256
|
### How do I decide? state_pattern or [AASM](http://github.com/rubyist/aasm)?
|
|
255
257
|
|
|
256
258
|
* Lot of state dependent behavior? Lot of conditional logic depending on the state? => state_pattern
|
|
257
|
-
* Not much state dependent behavior? => AASM
|
|
259
|
+
* Not much state dependent behavior? => [AASM](http://github.com/rubyist/aasm)
|
|
258
260
|
|
|
259
261
|
## Thanks
|
|
260
262
|
|
|
@@ -267,10 +269,12 @@ set_state_attribute :state_column
|
|
|
267
269
|
gem install state_pattern
|
|
268
270
|
```
|
|
269
271
|
|
|
272
|
+
To run the tests `bundle` and then `bundle exec rake`
|
|
273
|
+
|
|
270
274
|
## Collaborate
|
|
271
275
|
|
|
272
276
|
[http://github.com/dcadenas/state_pattern](http://github.com/dcadenas/state_pattern)
|
|
273
277
|
|
|
274
278
|
## Copyright
|
|
275
279
|
|
|
276
|
-
Copyright (c) 2009 Daniel Cadenas. See LICENSE for details.
|
|
280
|
+
Copyright (c) 2009 Daniel Cadenas. See [LICENSE](https://raw.github.com/dcadenas/state_pattern/master/LICENSE) for details.
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
gem 'state_pattern', '~>2.0.2'
|
|
5
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
6
|
+
gem 'rails', '4.2.1'
|
|
7
|
+
# Use sqlite3 as the database for Active Record
|
|
8
|
+
gem 'sqlite3'
|
|
9
|
+
# Use SCSS for stylesheets
|
|
10
|
+
gem 'sass-rails', '~> 5.0'
|
|
11
|
+
# Use Uglifier as compressor for JavaScript assets
|
|
12
|
+
gem 'uglifier', '>= 1.3.0'
|
|
13
|
+
# Use CoffeeScript for .coffee assets and views
|
|
14
|
+
gem 'coffee-rails', '~> 4.1.0'
|
|
15
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
|
16
|
+
# gem 'therubyracer', platforms: :ruby
|
|
17
|
+
|
|
18
|
+
# Use jquery as the JavaScript library
|
|
19
|
+
gem 'jquery-rails'
|
|
20
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
21
|
+
gem 'turbolinks'
|
|
22
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
23
|
+
gem 'jbuilder', '~> 2.0'
|
|
24
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
|
25
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
|
26
|
+
|
|
27
|
+
# Use ActiveModel has_secure_password
|
|
28
|
+
# gem 'bcrypt', '~> 3.1.7'
|
|
29
|
+
|
|
30
|
+
# Use Unicorn as the app server
|
|
31
|
+
# gem 'unicorn'
|
|
32
|
+
|
|
33
|
+
# Use Capistrano for deployment
|
|
34
|
+
# gem 'capistrano-rails', group: :development
|
|
35
|
+
|
|
36
|
+
group :development, :test do
|
|
37
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
|
38
|
+
gem 'byebug'
|
|
39
|
+
|
|
40
|
+
# Access an IRB console on exception pages or by using <%= console %> in views
|
|
41
|
+
gem 'web-console', '~> 2.0'
|
|
42
|
+
|
|
43
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
|
44
|
+
gem 'spring'
|
|
45
|
+
end
|
|
46
|
+
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: https://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
actionmailer (4.2.1)
|
|
5
|
+
actionpack (= 4.2.1)
|
|
6
|
+
actionview (= 4.2.1)
|
|
7
|
+
activejob (= 4.2.1)
|
|
8
|
+
mail (~> 2.5, >= 2.5.4)
|
|
9
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
10
|
+
actionpack (4.2.1)
|
|
11
|
+
actionview (= 4.2.1)
|
|
12
|
+
activesupport (= 4.2.1)
|
|
13
|
+
rack (~> 1.6)
|
|
14
|
+
rack-test (~> 0.6.2)
|
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
16
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
|
17
|
+
actionview (4.2.1)
|
|
18
|
+
activesupport (= 4.2.1)
|
|
19
|
+
builder (~> 3.1)
|
|
20
|
+
erubis (~> 2.7.0)
|
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
|
23
|
+
activejob (4.2.1)
|
|
24
|
+
activesupport (= 4.2.1)
|
|
25
|
+
globalid (>= 0.3.0)
|
|
26
|
+
activemodel (4.2.1)
|
|
27
|
+
activesupport (= 4.2.1)
|
|
28
|
+
builder (~> 3.1)
|
|
29
|
+
activerecord (4.2.1)
|
|
30
|
+
activemodel (= 4.2.1)
|
|
31
|
+
activesupport (= 4.2.1)
|
|
32
|
+
arel (~> 6.0)
|
|
33
|
+
activesupport (4.2.1)
|
|
34
|
+
i18n (~> 0.7)
|
|
35
|
+
json (~> 1.7, >= 1.7.7)
|
|
36
|
+
minitest (~> 5.1)
|
|
37
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
38
|
+
tzinfo (~> 1.1)
|
|
39
|
+
arel (6.0.0)
|
|
40
|
+
binding_of_caller (0.7.2)
|
|
41
|
+
debug_inspector (>= 0.0.1)
|
|
42
|
+
builder (3.2.2)
|
|
43
|
+
byebug (4.0.5)
|
|
44
|
+
columnize (= 0.9.0)
|
|
45
|
+
coffee-rails (4.1.0)
|
|
46
|
+
coffee-script (>= 2.2.0)
|
|
47
|
+
railties (>= 4.0.0, < 5.0)
|
|
48
|
+
coffee-script (2.4.1)
|
|
49
|
+
coffee-script-source
|
|
50
|
+
execjs
|
|
51
|
+
coffee-script-source (1.9.1.1)
|
|
52
|
+
columnize (0.9.0)
|
|
53
|
+
debug_inspector (0.0.2)
|
|
54
|
+
erubis (2.7.0)
|
|
55
|
+
execjs (2.5.2)
|
|
56
|
+
globalid (0.3.5)
|
|
57
|
+
activesupport (>= 4.1.0)
|
|
58
|
+
i18n (0.7.0)
|
|
59
|
+
jbuilder (2.2.13)
|
|
60
|
+
activesupport (>= 3.0.0, < 5)
|
|
61
|
+
multi_json (~> 1.2)
|
|
62
|
+
jquery-rails (4.0.3)
|
|
63
|
+
rails-dom-testing (~> 1.0)
|
|
64
|
+
railties (>= 4.2.0)
|
|
65
|
+
thor (>= 0.14, < 2.0)
|
|
66
|
+
json (1.8.2)
|
|
67
|
+
loofah (2.0.1)
|
|
68
|
+
nokogiri (>= 1.5.9)
|
|
69
|
+
mail (2.6.3)
|
|
70
|
+
mime-types (>= 1.16, < 3)
|
|
71
|
+
mime-types (2.4.3)
|
|
72
|
+
mini_portile (0.6.2)
|
|
73
|
+
minitest (5.6.0)
|
|
74
|
+
multi_json (1.11.0)
|
|
75
|
+
nokogiri (1.6.6.2)
|
|
76
|
+
mini_portile (~> 0.6.0)
|
|
77
|
+
rack (1.6.0)
|
|
78
|
+
rack-test (0.6.3)
|
|
79
|
+
rack (>= 1.0)
|
|
80
|
+
rails (4.2.1)
|
|
81
|
+
actionmailer (= 4.2.1)
|
|
82
|
+
actionpack (= 4.2.1)
|
|
83
|
+
actionview (= 4.2.1)
|
|
84
|
+
activejob (= 4.2.1)
|
|
85
|
+
activemodel (= 4.2.1)
|
|
86
|
+
activerecord (= 4.2.1)
|
|
87
|
+
activesupport (= 4.2.1)
|
|
88
|
+
bundler (>= 1.3.0, < 2.0)
|
|
89
|
+
railties (= 4.2.1)
|
|
90
|
+
sprockets-rails
|
|
91
|
+
rails-deprecated_sanitizer (1.0.3)
|
|
92
|
+
activesupport (>= 4.2.0.alpha)
|
|
93
|
+
rails-dom-testing (1.0.6)
|
|
94
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
|
95
|
+
nokogiri (~> 1.6.0)
|
|
96
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
|
97
|
+
rails-html-sanitizer (1.0.2)
|
|
98
|
+
loofah (~> 2.0)
|
|
99
|
+
railties (4.2.1)
|
|
100
|
+
actionpack (= 4.2.1)
|
|
101
|
+
activesupport (= 4.2.1)
|
|
102
|
+
rake (>= 0.8.7)
|
|
103
|
+
thor (>= 0.18.1, < 2.0)
|
|
104
|
+
rake (10.4.2)
|
|
105
|
+
rdoc (4.2.0)
|
|
106
|
+
sass (3.4.13)
|
|
107
|
+
sass-rails (5.0.3)
|
|
108
|
+
railties (>= 4.0.0, < 5.0)
|
|
109
|
+
sass (~> 3.1)
|
|
110
|
+
sprockets (>= 2.8, < 4.0)
|
|
111
|
+
sprockets-rails (>= 2.0, < 4.0)
|
|
112
|
+
tilt (~> 1.1)
|
|
113
|
+
sdoc (0.4.1)
|
|
114
|
+
json (~> 1.7, >= 1.7.7)
|
|
115
|
+
rdoc (~> 4.0)
|
|
116
|
+
spring (1.3.4)
|
|
117
|
+
sprockets (3.0.2)
|
|
118
|
+
rack (~> 1.0)
|
|
119
|
+
sprockets-rails (2.2.4)
|
|
120
|
+
actionpack (>= 3.0)
|
|
121
|
+
activesupport (>= 3.0)
|
|
122
|
+
sprockets (>= 2.8, < 4.0)
|
|
123
|
+
sqlite3 (1.3.10)
|
|
124
|
+
state_pattern (2.0.2)
|
|
125
|
+
thor (0.19.1)
|
|
126
|
+
thread_safe (0.3.5)
|
|
127
|
+
tilt (1.4.1)
|
|
128
|
+
turbolinks (2.5.3)
|
|
129
|
+
coffee-rails
|
|
130
|
+
tzinfo (1.2.2)
|
|
131
|
+
thread_safe (~> 0.1)
|
|
132
|
+
uglifier (2.7.1)
|
|
133
|
+
execjs (>= 0.3.0)
|
|
134
|
+
json (>= 1.8.0)
|
|
135
|
+
web-console (2.1.2)
|
|
136
|
+
activemodel (>= 4.0)
|
|
137
|
+
binding_of_caller (>= 0.7.2)
|
|
138
|
+
railties (>= 4.0)
|
|
139
|
+
sprockets-rails (>= 2.0, < 4.0)
|
|
140
|
+
|
|
141
|
+
PLATFORMS
|
|
142
|
+
ruby
|
|
143
|
+
|
|
144
|
+
DEPENDENCIES
|
|
145
|
+
byebug
|
|
146
|
+
coffee-rails (~> 4.1.0)
|
|
147
|
+
jbuilder (~> 2.0)
|
|
148
|
+
jquery-rails
|
|
149
|
+
rails (= 4.2.1)
|
|
150
|
+
sass-rails (~> 5.0)
|
|
151
|
+
sdoc (~> 0.4.0)
|
|
152
|
+
spring
|
|
153
|
+
sqlite3
|
|
154
|
+
state_pattern (~> 2.0.2)
|
|
155
|
+
turbolinks
|
|
156
|
+
uglifier (>= 1.3.0)
|
|
157
|
+
web-console (~> 2.0)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
2
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
3
|
|
|
4
|
-
require
|
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
require 'rake/testtask'
|
|
8
|
-
require 'rake/rdoctask'
|
|
9
|
-
|
|
10
|
-
require 'tasks/rails'
|
|
6
|
+
Rails.application.load_tasks
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require turbolinks
|
|
16
|
+
//= require_tree .
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
+
* file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
class ButtonsController < ApplicationController
|
|
2
|
-
before_filter
|
|
2
|
+
before_filter do
|
|
3
|
+
@button = Button.first || Button.create!
|
|
4
|
+
end
|
|
3
5
|
|
|
4
6
|
def show
|
|
5
7
|
end
|
|
@@ -8,11 +10,4 @@ class ButtonsController < ApplicationController
|
|
|
8
10
|
flash[:notice] = @button.push!
|
|
9
11
|
redirect_to button_path
|
|
10
12
|
end
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
|
|
14
|
-
def load
|
|
15
|
-
@button = Button.first || Button.create!
|
|
16
|
-
end
|
|
17
13
|
end
|
|
18
|
-
|
|
File without changes
|
data/examples/{rails_2_3_8_button_example → rails_4_button_example}/app/models/button/off.rb
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%= form_for(@button) do |f| %>
|
|
2
|
+
<% if @button.errors.any? %>
|
|
3
|
+
<div id="error_explanation">
|
|
4
|
+
<h2><%= pluralize(@button.errors.count, "error") %> prohibited this button from being saved:</h2>
|
|
5
|
+
|
|
6
|
+
<ul>
|
|
7
|
+
<% @button.errors.full_messages.each do |msg| %>
|
|
8
|
+
<li><%= msg %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
14
|
+
<div class="field">
|
|
15
|
+
<%= f.label :state %><br />
|
|
16
|
+
<%= f.text_field :state %>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="actions">
|
|
19
|
+
<%= f.submit %>
|
|
20
|
+
</div>
|
|
21
|
+
<% end %>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<h1>Listing buttons</h1>
|
|
2
|
+
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<th>State</th>
|
|
6
|
+
<th></th>
|
|
7
|
+
<th></th>
|
|
8
|
+
<th></th>
|
|
9
|
+
</tr>
|
|
10
|
+
|
|
11
|
+
<% @buttons.each do |button| %>
|
|
12
|
+
<tr>
|
|
13
|
+
<td><%= button.state %></td>
|
|
14
|
+
<td><%= link_to 'Show', button %></td>
|
|
15
|
+
<td><%= link_to 'Edit', edit_button_path(button) %></td>
|
|
16
|
+
<td><%= link_to 'Destroy', button, :confirm => 'Are you sure?', :method => :delete %></td>
|
|
17
|
+
</tr>
|
|
18
|
+
<% end %>
|
|
19
|
+
</table>
|
|
20
|
+
|
|
21
|
+
<br />
|
|
22
|
+
|
|
23
|
+
<%= link_to 'New Button', new_button_path %>
|