before_actions 1.0.2 → 1.0.3

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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +106 -0
  3. data/Rakefile +13 -19
  4. data/app/controllers/before_actions/foo_controller.rb +8 -0
  5. data/lib/before_actions.rb +7 -1
  6. data/lib/before_actions/controller.rb +29 -20
  7. data/lib/before_actions/engine.rb +7 -0
  8. data/lib/before_actions/version.rb +1 -1
  9. data/spec/controllers/admin_foos_controller_spec.rb +78 -0
  10. data/spec/controllers/foos_controller_spec.rb +139 -0
  11. data/{test → spec}/dummy/README.rdoc +0 -0
  12. data/{test → spec}/dummy/Rakefile +0 -0
  13. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -3
  14. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
  15. data/spec/dummy/app/controllers/admin_foos_controller.rb +53 -0
  16. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  17. data/spec/dummy/app/controllers/foos_controller.rb +92 -0
  18. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  19. data/spec/dummy/app/models/admin_foo.rb +2 -0
  20. data/spec/dummy/app/models/foo.rb +3 -0
  21. data/spec/dummy/app/views/admin_foos/_form.html.erb +21 -0
  22. data/spec/dummy/app/views/admin_foos/edit.html.erb +6 -0
  23. data/spec/dummy/app/views/admin_foos/index.html.erb +25 -0
  24. data/spec/dummy/app/views/admin_foos/new.html.erb +5 -0
  25. data/spec/dummy/app/views/admin_foos/show.html.erb +9 -0
  26. data/spec/dummy/app/views/foos/_form.html.erb +21 -0
  27. data/spec/dummy/app/views/foos/edit.html.erb +6 -0
  28. data/spec/dummy/app/views/foos/index.html.erb +25 -0
  29. data/spec/dummy/app/views/foos/new.html.erb +5 -0
  30. data/spec/dummy/app/views/foos/show.html.erb +9 -0
  31. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  32. data/{test → spec}/dummy/bin/bundle +0 -0
  33. data/{test → spec}/dummy/bin/rails +0 -0
  34. data/{test → spec}/dummy/bin/rake +0 -0
  35. data/{test → spec}/dummy/config.ru +0 -0
  36. data/{test → spec}/dummy/config/application.rb +8 -0
  37. data/{test → spec}/dummy/config/boot.rb +0 -0
  38. data/{test → spec}/dummy/config/database.yml +0 -0
  39. data/{test → spec}/dummy/config/environment.rb +0 -0
  40. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  41. data/{test → spec}/dummy/config/environments/production.rb +0 -0
  42. data/{test → spec}/dummy/config/environments/test.rb +0 -0
  43. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  44. data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
  45. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  46. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  47. data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
  48. data/spec/dummy/config/initializers/session_store.rb +3 -0
  49. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  50. data/{test → spec}/dummy/config/locales/en.yml +0 -0
  51. data/{test → spec}/dummy/config/routes.rb +4 -0
  52. data/spec/dummy/db/development.sqlite3 +0 -0
  53. data/spec/dummy/db/migrate/20140912040816_create_foos.rb +9 -0
  54. data/spec/dummy/db/migrate/20140912042735_create_admin_foos.rb +9 -0
  55. data/spec/dummy/db/schema.rb +28 -0
  56. data/spec/dummy/db/test.sqlite3 +0 -0
  57. data/spec/dummy/lib/templates/rails/scaffold_controller/controller.rb +97 -0
  58. data/spec/dummy/log/development.log +15 -0
  59. data/spec/dummy/log/test.log +1590 -0
  60. data/{test → spec}/dummy/public/404.html +0 -0
  61. data/{test → spec}/dummy/public/422.html +0 -0
  62. data/{test → spec}/dummy/public/500.html +0 -0
  63. data/{test → spec}/dummy/public/favicon.ico +0 -0
  64. data/spec/rails_helper.rb +54 -0
  65. data/spec/spec_helper.rb +85 -0
  66. metadata +168 -74
  67. data/README.rdoc +0 -60
  68. data/lib/before_actions/command.rb +0 -15
  69. data/test/before_actions_test.rb +0 -7
  70. data/test/dummy/config/initializers/session_store.rb +0 -3
  71. data/test/integration/navigation_test.rb +0 -10
  72. data/test/test_helper.rb +0 -15
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,54 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ SPEC_ROOT=File.dirname(__FILE__)
4
+ require 'spec_helper'
5
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
6
+ require 'rspec/rails'
7
+ # Add additional requires below this line. Rails is not loaded until this point!
8
+
9
+
10
+
11
+
12
+ # Requires supporting ruby files with custom matchers and macros, etc, in
13
+ # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
14
+ # run as spec files by default. This means that files in spec/support that end
15
+ # in _spec.rb will both be required and run as specs, causing the specs to be
16
+ # run twice. It is recommended that you do not name files matching this glob to
17
+ # end with _spec.rb. You can configure this pattern with the --pattern
18
+ # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
19
+ #
20
+ # The following line is provided for convenience purposes. It has the downside
21
+ # of increasing the boot-up time by auto-requiring all files in the support
22
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
23
+ # require only the support files necessary.
24
+ #
25
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
26
+
27
+ # Checks for pending migrations before tests are run.
28
+ # If you are not using ActiveRecord, you can remove this line.
29
+ ActiveRecord::Migration.maintain_test_schema!
30
+
31
+ RSpec.configure do |config|
32
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
33
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
34
+
35
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
36
+ # examples within a transaction, remove the following line or assign false
37
+ # instead of true.
38
+ config.use_transactional_fixtures = true
39
+
40
+ # RSpec Rails can automatically mix in different behaviours to your tests
41
+ # based on their file location, for example enabling you to call `get` and
42
+ # `post` in specs under `spec/controllers`.
43
+ #
44
+ # You can disable this behaviour by removing the line below, and instead
45
+ # explicitly tag your specs with their type, e.g.:
46
+ #
47
+ # RSpec.describe UsersController, :type => :controller do
48
+ # # ...
49
+ # end
50
+ #
51
+ # The different available types are documented in the features, such as in
52
+ # https://relishapp.com/rspec/rspec-rails/docs
53
+ config.infer_spec_type_from_file_location!
54
+ end
@@ -0,0 +1,85 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, consider making
10
+ # a separate helper file that requires the additional dependencies and performs
11
+ # the additional setup, and require it from the spec files that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # rspec-expectations config goes here. You can use an alternate
19
+ # assertion/expectation library such as wrong or the stdlib/minitest
20
+ # assertions if you prefer.
21
+ config.expect_with :rspec do |expectations|
22
+ # This option will default to `true` in RSpec 4. It makes the `description`
23
+ # and `failure_message` of custom matchers include text for helper methods
24
+ # defined using `chain`, e.g.:
25
+ # be_bigger_than(2).and_smaller_than(4).description
26
+ # # => "be bigger than 2 and smaller than 4"
27
+ # ...rather than:
28
+ # # => "be bigger than 2"
29
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
30
+ end
31
+
32
+ # rspec-mocks config goes here. You can use an alternate test double
33
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
34
+ config.mock_with :rspec do |mocks|
35
+ # Prevents you from mocking or stubbing a method that does not exist on
36
+ # a real object. This is generally recommended, and will default to
37
+ # `true` in RSpec 4.
38
+ mocks.verify_partial_doubles = true
39
+ end
40
+
41
+ # The settings below are suggested to provide a good initial experience
42
+ # with RSpec, but feel free to customize to your heart's content.
43
+ =begin
44
+ # These two settings work together to allow you to limit a spec run
45
+ # to individual examples or groups you care about by tagging them with
46
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
47
+ # get run.
48
+ config.filter_run :focus
49
+ config.run_all_when_everything_filtered = true
50
+
51
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
+ # For more details, see:
53
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
+ config.disable_monkey_patching!
57
+
58
+ # Many RSpec users commonly either run the entire suite or an individual
59
+ # file, and it's useful to allow more verbose output when running an
60
+ # individual spec file.
61
+ if config.files_to_run.one?
62
+ # Use the documentation formatter for detailed output,
63
+ # unless a formatter has already been configured
64
+ # (e.g. via a command-line flag).
65
+ config.default_formatter = 'doc'
66
+ end
67
+
68
+ # Print the 10 slowest examples and example groups at the
69
+ # end of the spec run, to help surface which specs are running
70
+ # particularly slow.
71
+ config.profile_examples = 10
72
+
73
+ # Run specs in random order to surface order dependencies. If you find an
74
+ # order dependency and want to debug it, you can fix the order by providing
75
+ # the seed, which is printed after each run.
76
+ # --seed 1234
77
+ config.order = :random
78
+
79
+ # Seed global randomization in this process using the `--seed` CLI option.
80
+ # Setting this allows you to use `--seed` to deterministically reproduce
81
+ # test failures related to randomization by passing the same `--seed` value
82
+ # as the one that triggered the failure.
83
+ Kernel.srand config.seed
84
+ =end
85
+ end
metadata CHANGED
@@ -1,15 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: before_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pinto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-01 00:00:00.000000000 Z
11
+ date: 2014-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.7'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.7'
13
47
  - !ruby/object:Gem::Dependency
14
48
  name: sqlite3
15
49
  requirement: !ruby/object:Gem::Requirement
@@ -24,17 +58,31 @@ dependencies:
24
58
  - - ">="
25
59
  - !ruby/object:Gem::Version
26
60
  version: '0'
27
- description: Organize your controllers by grouping your before and after filters.
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec-rails
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ description: Organize your controllers by grouping your before and after filter.
28
76
  email:
29
77
  - tjamespinto@gmail.com
30
78
  executables: []
31
79
  extensions: []
32
80
  extra_rdoc_files: []
33
81
  files:
34
- - README.rdoc
82
+ - README.md
35
83
  - Rakefile
84
+ - app/controllers/before_actions/foo_controller.rb
36
85
  - lib/before_actions.rb
37
- - lib/before_actions/command.rb
38
86
  - lib/before_actions/controller.rb
39
87
  - lib/before_actions/engine.rb
40
88
  - lib/before_actions/version.rb
@@ -42,40 +90,63 @@ files:
42
90
  - lib/generators/before_actions/install_generator.rb
43
91
  - lib/generators/before_actions/templates/controller.rb
44
92
  - lib/tasks/before_actions_tasks.rake
45
- - test/before_actions_test.rb
46
- - test/dummy/README.rdoc
47
- - test/dummy/Rakefile
48
- - test/dummy/app/assets/javascripts/application.js
49
- - test/dummy/app/assets/stylesheets/application.css
50
- - test/dummy/app/controllers/application_controller.rb
51
- - test/dummy/app/helpers/application_helper.rb
52
- - test/dummy/app/views/layouts/application.html.erb
53
- - test/dummy/bin/bundle
54
- - test/dummy/bin/rails
55
- - test/dummy/bin/rake
56
- - test/dummy/config.ru
57
- - test/dummy/config/application.rb
58
- - test/dummy/config/boot.rb
59
- - test/dummy/config/database.yml
60
- - test/dummy/config/environment.rb
61
- - test/dummy/config/environments/development.rb
62
- - test/dummy/config/environments/production.rb
63
- - test/dummy/config/environments/test.rb
64
- - test/dummy/config/initializers/backtrace_silencers.rb
65
- - test/dummy/config/initializers/filter_parameter_logging.rb
66
- - test/dummy/config/initializers/inflections.rb
67
- - test/dummy/config/initializers/mime_types.rb
68
- - test/dummy/config/initializers/secret_token.rb
69
- - test/dummy/config/initializers/session_store.rb
70
- - test/dummy/config/initializers/wrap_parameters.rb
71
- - test/dummy/config/locales/en.yml
72
- - test/dummy/config/routes.rb
73
- - test/dummy/public/404.html
74
- - test/dummy/public/422.html
75
- - test/dummy/public/500.html
76
- - test/dummy/public/favicon.ico
77
- - test/integration/navigation_test.rb
78
- - test/test_helper.rb
93
+ - spec/controllers/admin_foos_controller_spec.rb
94
+ - spec/controllers/foos_controller_spec.rb
95
+ - spec/dummy/README.rdoc
96
+ - spec/dummy/Rakefile
97
+ - spec/dummy/app/assets/javascripts/application.js
98
+ - spec/dummy/app/assets/stylesheets/application.css
99
+ - spec/dummy/app/controllers/admin_foos_controller.rb
100
+ - spec/dummy/app/controllers/application_controller.rb
101
+ - spec/dummy/app/controllers/foos_controller.rb
102
+ - spec/dummy/app/helpers/application_helper.rb
103
+ - spec/dummy/app/models/admin_foo.rb
104
+ - spec/dummy/app/models/foo.rb
105
+ - spec/dummy/app/views/admin_foos/_form.html.erb
106
+ - spec/dummy/app/views/admin_foos/edit.html.erb
107
+ - spec/dummy/app/views/admin_foos/index.html.erb
108
+ - spec/dummy/app/views/admin_foos/new.html.erb
109
+ - spec/dummy/app/views/admin_foos/show.html.erb
110
+ - spec/dummy/app/views/foos/_form.html.erb
111
+ - spec/dummy/app/views/foos/edit.html.erb
112
+ - spec/dummy/app/views/foos/index.html.erb
113
+ - spec/dummy/app/views/foos/new.html.erb
114
+ - spec/dummy/app/views/foos/show.html.erb
115
+ - spec/dummy/app/views/layouts/application.html.erb
116
+ - spec/dummy/bin/bundle
117
+ - spec/dummy/bin/rails
118
+ - spec/dummy/bin/rake
119
+ - spec/dummy/config.ru
120
+ - spec/dummy/config/application.rb
121
+ - spec/dummy/config/boot.rb
122
+ - spec/dummy/config/database.yml
123
+ - spec/dummy/config/environment.rb
124
+ - spec/dummy/config/environments/development.rb
125
+ - spec/dummy/config/environments/production.rb
126
+ - spec/dummy/config/environments/test.rb
127
+ - spec/dummy/config/initializers/backtrace_silencers.rb
128
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
129
+ - spec/dummy/config/initializers/inflections.rb
130
+ - spec/dummy/config/initializers/mime_types.rb
131
+ - spec/dummy/config/initializers/secret_token.rb
132
+ - spec/dummy/config/initializers/session_store.rb
133
+ - spec/dummy/config/initializers/wrap_parameters.rb
134
+ - spec/dummy/config/locales/en.yml
135
+ - spec/dummy/config/routes.rb
136
+ - spec/dummy/db/development.sqlite3
137
+ - spec/dummy/db/migrate/20140912040816_create_foos.rb
138
+ - spec/dummy/db/migrate/20140912042735_create_admin_foos.rb
139
+ - spec/dummy/db/schema.rb
140
+ - spec/dummy/db/test.sqlite3
141
+ - spec/dummy/lib/templates/rails/scaffold_controller/controller.rb
142
+ - spec/dummy/log/development.log
143
+ - spec/dummy/log/test.log
144
+ - spec/dummy/public/404.html
145
+ - spec/dummy/public/422.html
146
+ - spec/dummy/public/500.html
147
+ - spec/dummy/public/favicon.ico
148
+ - spec/rails_helper.rb
149
+ - spec/spec_helper.rb
79
150
  homepage: https://github.com/before-actions-gem/before_actions
80
151
  licenses:
81
152
  - MIT
@@ -99,39 +170,62 @@ rubyforge_project:
99
170
  rubygems_version: 2.2.2
100
171
  signing_key:
101
172
  specification_version: 4
102
- summary: Rails Gem to organize your controllres
173
+ summary: Rails Gem to organize your controllers
103
174
  test_files:
104
- - test/before_actions_test.rb
105
- - test/dummy/app/assets/javascripts/application.js
106
- - test/dummy/app/assets/stylesheets/application.css
107
- - test/dummy/app/controllers/application_controller.rb
108
- - test/dummy/app/helpers/application_helper.rb
109
- - test/dummy/app/views/layouts/application.html.erb
110
- - test/dummy/bin/bundle
111
- - test/dummy/bin/rails
112
- - test/dummy/bin/rake
113
- - test/dummy/config/application.rb
114
- - test/dummy/config/boot.rb
115
- - test/dummy/config/database.yml
116
- - test/dummy/config/environment.rb
117
- - test/dummy/config/environments/development.rb
118
- - test/dummy/config/environments/production.rb
119
- - test/dummy/config/environments/test.rb
120
- - test/dummy/config/initializers/backtrace_silencers.rb
121
- - test/dummy/config/initializers/filter_parameter_logging.rb
122
- - test/dummy/config/initializers/inflections.rb
123
- - test/dummy/config/initializers/mime_types.rb
124
- - test/dummy/config/initializers/secret_token.rb
125
- - test/dummy/config/initializers/session_store.rb
126
- - test/dummy/config/initializers/wrap_parameters.rb
127
- - test/dummy/config/locales/en.yml
128
- - test/dummy/config/routes.rb
129
- - test/dummy/config.ru
130
- - test/dummy/public/404.html
131
- - test/dummy/public/422.html
132
- - test/dummy/public/500.html
133
- - test/dummy/public/favicon.ico
134
- - test/dummy/Rakefile
135
- - test/dummy/README.rdoc
136
- - test/integration/navigation_test.rb
137
- - test/test_helper.rb
175
+ - spec/controllers/admin_foos_controller_spec.rb
176
+ - spec/controllers/foos_controller_spec.rb
177
+ - spec/dummy/app/assets/javascripts/application.js
178
+ - spec/dummy/app/assets/stylesheets/application.css
179
+ - spec/dummy/app/controllers/admin_foos_controller.rb
180
+ - spec/dummy/app/controllers/application_controller.rb
181
+ - spec/dummy/app/controllers/foos_controller.rb
182
+ - spec/dummy/app/helpers/application_helper.rb
183
+ - spec/dummy/app/models/admin_foo.rb
184
+ - spec/dummy/app/models/foo.rb
185
+ - spec/dummy/app/views/admin_foos/_form.html.erb
186
+ - spec/dummy/app/views/admin_foos/edit.html.erb
187
+ - spec/dummy/app/views/admin_foos/index.html.erb
188
+ - spec/dummy/app/views/admin_foos/new.html.erb
189
+ - spec/dummy/app/views/admin_foos/show.html.erb
190
+ - spec/dummy/app/views/foos/_form.html.erb
191
+ - spec/dummy/app/views/foos/edit.html.erb
192
+ - spec/dummy/app/views/foos/index.html.erb
193
+ - spec/dummy/app/views/foos/new.html.erb
194
+ - spec/dummy/app/views/foos/show.html.erb
195
+ - spec/dummy/app/views/layouts/application.html.erb
196
+ - spec/dummy/bin/bundle
197
+ - spec/dummy/bin/rails
198
+ - spec/dummy/bin/rake
199
+ - spec/dummy/config/application.rb
200
+ - spec/dummy/config/boot.rb
201
+ - spec/dummy/config/database.yml
202
+ - spec/dummy/config/environment.rb
203
+ - spec/dummy/config/environments/development.rb
204
+ - spec/dummy/config/environments/production.rb
205
+ - spec/dummy/config/environments/test.rb
206
+ - spec/dummy/config/initializers/backtrace_silencers.rb
207
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
208
+ - spec/dummy/config/initializers/inflections.rb
209
+ - spec/dummy/config/initializers/mime_types.rb
210
+ - spec/dummy/config/initializers/secret_token.rb
211
+ - spec/dummy/config/initializers/session_store.rb
212
+ - spec/dummy/config/initializers/wrap_parameters.rb
213
+ - spec/dummy/config/locales/en.yml
214
+ - spec/dummy/config/routes.rb
215
+ - spec/dummy/config.ru
216
+ - spec/dummy/db/development.sqlite3
217
+ - spec/dummy/db/migrate/20140912040816_create_foos.rb
218
+ - spec/dummy/db/migrate/20140912042735_create_admin_foos.rb
219
+ - spec/dummy/db/schema.rb
220
+ - spec/dummy/db/test.sqlite3
221
+ - spec/dummy/lib/templates/rails/scaffold_controller/controller.rb
222
+ - spec/dummy/log/development.log
223
+ - spec/dummy/log/test.log
224
+ - spec/dummy/public/404.html
225
+ - spec/dummy/public/422.html
226
+ - spec/dummy/public/500.html
227
+ - spec/dummy/public/favicon.ico
228
+ - spec/dummy/Rakefile
229
+ - spec/dummy/README.rdoc
230
+ - spec/rails_helper.rb
231
+ - spec/spec_helper.rb
@@ -1,60 +0,0 @@
1
- = BeforeActions {<img src="https://badge.fury.io/rb/before_actions.png" alt="Gem Version" />}[http://badge.fury.io/rb/before_actions] {<img src="http://inch-ci.org/github/yakko/before_actions.png" alt="Inline docs" />}[http://inch-ci.org/github/yakko/before_actions] {<img src="https://gemnasium.com/yakko/before_actions.svg" alt="Dependency Status" />}[https://gemnasium.com/yakko/before_actions]
2
-
3
- Wiki[https://github.com/before-actions-gem/before_actions/wiki] | RubyGems[https://rubygems.org/gems/before_actions]
4
-
5
- BeforeActions an elegant way of loading resorces in your restful controllers.
6
-
7
- == Installation
8
-
9
- In <b>Rails 3</b> and <b>Rails 4</b>, add this to your Gemfile and run the +bundle+ command.
10
-
11
- gem "before_actions"
12
-
13
- bundle
14
-
15
- == Instructions
16
-
17
- == 1. Using the command
18
-
19
- class ContactsController < ApplicationController
20
-
21
- # load and authorize resources
22
- before_actions do
23
- # all actions
24
- # actions { }
25
-
26
- # list actions
27
- actions(:index) { @contacts = Contact.all }
28
-
29
- # building actions
30
- actions(:new) { @contact = Contact.new }
31
- actions(:create) { @contact = Contact.new(contact_params) }
32
-
33
- # member actions, will raise a 404 if the model is not found
34
- actions(:show, :edit, :update, :destroy) { @contact = Contact.find(params[:id]) }
35
-
36
- # all actions
37
- # actions { }
38
- end
39
-
40
- def contact_params
41
- params.require(:contact).permit(:name)
42
- end
43
-
44
-
45
- == 2. Enjoy your clean controller
46
-
47
- {contacts_controller.rb}[https://github.com/before-actions-gem/before_actions/blob/master/readme_images/contacts_controller.rb]
48
-
49
- {<img src="readme_images/controller.jpg" alt="image" />}[https://github.com/before-actions-gem/before_actions]
50
-
51
-
52
- == 3. Nested Routes
53
-
54
- {<img src="readme_images/nested.png" alt="image" />}[https://github.com/before-actions-gem/before_actions]
55
-
56
-
57
-
58
- == License
59
-
60
- Before Actions is released under the {MIT License}[http://www.opensource.org/licenses/MIT].