dismissible_blocks 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +5 -5
  2. data/{LICENSE.text → LICENSE.txt} +0 -0
  3. data/{README.markdown → README.md} +0 -0
  4. data/app/controllers/dismissible_blocks_controller.rb +2 -2
  5. data/app/helpers/dismissible_blocks_helper.rb +1 -1
  6. data/dismissible_blocks.gemspec +33 -0
  7. data/lib/dismissible_blocks/version.rb +1 -1
  8. metadata +35 -126
  9. data/Gemfile +0 -7
  10. data/Rakefile +0 -34
  11. data/test/capybara_helper.rb +0 -34
  12. data/test/controllers/dismissible_blocks_controller_test.rb +0 -18
  13. data/test/dummy/Rakefile +0 -3
  14. data/test/dummy/app/assets/javascripts/application.js +0 -3
  15. data/test/dummy/app/assets/stylesheets/application.css +0 -17
  16. data/test/dummy/app/controllers/application_controller.rb +0 -29
  17. data/test/dummy/app/controllers/landings_controller.rb +0 -6
  18. data/test/dummy/app/controllers/sessions_controller.rb +0 -28
  19. data/test/dummy/app/helpers/application_helper.rb +0 -2
  20. data/test/dummy/app/helpers/landings_helper.rb +0 -2
  21. data/test/dummy/app/helpers/sessions_helper.rb +0 -2
  22. data/test/dummy/app/models/user.rb +0 -9
  23. data/test/dummy/app/views/landings/show.html.erb +0 -10
  24. data/test/dummy/app/views/layouts/application.html.erb +0 -18
  25. data/test/dummy/app/views/sessions/new.html.erb +0 -15
  26. data/test/dummy/bin/bundle +0 -3
  27. data/test/dummy/bin/rails +0 -4
  28. data/test/dummy/bin/rake +0 -4
  29. data/test/dummy/bin/setup +0 -29
  30. data/test/dummy/config.ru +0 -3
  31. data/test/dummy/config/application.rb +0 -13
  32. data/test/dummy/config/boot.rb +0 -4
  33. data/test/dummy/config/database.yml +0 -11
  34. data/test/dummy/config/environment.rb +0 -3
  35. data/test/dummy/config/environments/development.rb +0 -12
  36. data/test/dummy/config/environments/test.rb +0 -13
  37. data/test/dummy/config/initializers/assets.rb +0 -1
  38. data/test/dummy/config/initializers/cookies_serializer.rb +0 -1
  39. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -1
  40. data/test/dummy/config/initializers/session_store.rb +0 -1
  41. data/test/dummy/config/initializers/wrap_parameters.rb +0 -3
  42. data/test/dummy/config/routes.rb +0 -7
  43. data/test/dummy/config/secrets.yml +0 -5
  44. data/test/dummy/db/migrate/20140303154458_create_users.rb +0 -10
  45. data/test/dummy/db/migrate/20140303161500_add_dismissed_blocks_to_users.rb +0 -9
  46. data/test/dummy/db/schema.rb +0 -24
  47. data/test/dummy/db/test.sqlite3 +0 -0
  48. data/test/dummy/log/test.log +0 -442
  49. data/test/dummy/public/404.html +0 -67
  50. data/test/dummy/public/422.html +0 -67
  51. data/test/dummy/public/500.html +0 -66
  52. data/test/dummy/public/favicon.ico +0 -0
  53. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  54. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  55. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  56. data/test/dummy/tmp/cache/assets/test/sprockets/58a8328804a777933d757eb9a448eaf5 +0 -0
  57. data/test/dummy/tmp/cache/assets/test/sprockets/68b2c32b107dd99071629b05c392d6cd +0 -0
  58. data/test/dummy/tmp/cache/assets/test/sprockets/96c147c638b08a4c0178d9c66c3b9c48 +0 -0
  59. data/test/dummy/tmp/cache/assets/test/sprockets/a303e31a3b163f257d2061cd9abb98d2 +0 -0
  60. data/test/dummy/tmp/cache/assets/test/sprockets/ac2d5385dbcd9cea11c510dc83189bba +0 -0
  61. data/test/dummy/tmp/cache/assets/test/sprockets/bec12e1e92fe458e19b5f9869454ac1a +0 -0
  62. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  63. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  64. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  65. data/test/features/dismissible_blocks_test.rb +0 -21
  66. data/test/fixtures/users.yml +0 -9
  67. data/test/helpers/dismissible_blocks_helper_test.rb +0 -73
  68. data/test/lib/controllers/helpers_test.rb +0 -14
  69. data/test/test_helper.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 15f9126e8ff2732e72f4976f0496246de251d144
4
- data.tar.gz: 42c2192d30194d09a00c55942fe08fd2e09532b7
2
+ SHA256:
3
+ metadata.gz: c7f626613af83496fe42408bf4e578a4aa19afaac01889691f60500c5a37cf78
4
+ data.tar.gz: c5cba02f795af41d067fd11bd966168453ca608cd6924accdd804d0838ec92be
5
5
  SHA512:
6
- metadata.gz: 5901bd02a638dba2c5677b5cce17709064b265577d4d73cc1081b06d3370c2c797819ae1f16aff888e4f2ffcb92fd364cd94c599b7cee53aa4bd4431f8d44a96
7
- data.tar.gz: 095db487461acb5f53d6003d4bdc66f9004d2826574fc2bf823dfc8e9da12210bc3552677b5287b61991c25c03a9e39cb4b13ad98aebf8c5939e3220cd3cb94f
6
+ metadata.gz: dff7e203a31bbc6a2249f804df4fe8fc265c6f11c3cf53c8491173ef54da2e498cea472064f050328f9f54a3762b018702285d78d1ee6046cb3f67ca76563b95
7
+ data.tar.gz: 873081056dd3d5a7d461fb417b4ecc4b698b9767c2ae5935ef510f1293ca6987f8912212583f734a90bde3f9007aa951ca87f0a252a8932ca2d97ba532a4534a
File without changes
File without changes
@@ -3,9 +3,9 @@ class DismissibleBlocksController < ApplicationController
3
3
  if current_user_available
4
4
  current_user.dismissed_blocks += [ params[:block].to_s ]
5
5
  current_user.save!
6
- render :json => {}, :status => :ok
6
+ render json: {}, status: :ok
7
7
  else
8
- render :json => {}, :status => :unprocessable_entity
8
+ render json: {}, status: :unprocessable_entity
9
9
  end
10
10
  end
11
11
 
@@ -27,7 +27,7 @@ module DismissibleBlocksHelper
27
27
  end
28
28
 
29
29
  def add_block_name_to_attributes(contents, name)
30
- contents.gsub! /(data-dismissible)(-hide)?(?![-=])/, "\\1\\2='#{name}'"
30
+ contents.gsub!(/(data-dismissible)(-hide)?(?![-=])/, "\\1\\2='#{name}'")
31
31
  contents.html_safe
32
32
  end
33
33
  end
@@ -0,0 +1,33 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ require 'dismissible_blocks/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'dismissible_blocks'
7
+ s.version = DismissibleBlocks::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Patrick Bougie']
10
+ s.email = ['hello@patrickbougie.com']
11
+ s.summary = 'Dismissible HTML blocks for Ruby on Rails'
12
+ s.description = 'Dismiss HTML blocks and save state in the database. Engine for Ruby on Rails.'
13
+ s.homepage = 'https://github.com/pbougie/dismissible_blocks'
14
+ s.license = 'MIT'
15
+
16
+ s.files = Dir[
17
+ '{app,config,lib}/**/*',
18
+ 'dismissible_blocks.gemspec',
19
+ 'README.md',
20
+ 'LICENSE.txt'
21
+ ]
22
+
23
+ s.add_runtime_dependency 'rails', '>= 3.2'
24
+ s.add_runtime_dependency 'jquery-rails'
25
+
26
+ s.add_development_dependency 'bundler'
27
+ s.add_development_dependency 'rake'
28
+ s.add_development_dependency 'sqlite3'
29
+ s.add_development_dependency 'capybara'
30
+ s.add_development_dependency 'selenium-webdriver'
31
+ s.add_development_dependency 'listen'
32
+ s.add_development_dependency 'puma'
33
+ end
@@ -1,3 +1,3 @@
1
1
  module DismissibleBlocks
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dismissible_blocks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Bougie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,6 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: listen
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: puma
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  description: Dismiss HTML blocks and save state in the database. Engine for Ruby on
112
140
  Rails.
113
141
  email:
@@ -116,78 +144,18 @@ executables: []
116
144
  extensions: []
117
145
  extra_rdoc_files: []
118
146
  files:
119
- - Gemfile
120
- - LICENSE.text
121
- - README.markdown
122
- - Rakefile
147
+ - LICENSE.txt
148
+ - README.md
123
149
  - app/assets/javascripts/dismissible_blocks.js
124
150
  - app/assets/javascripts/dismissible_blocks_loader.js
125
151
  - app/controllers/dismissible_blocks_controller.rb
126
152
  - app/helpers/dismissible_blocks_helper.rb
127
153
  - config/routes.rb
154
+ - dismissible_blocks.gemspec
128
155
  - lib/dismissible_blocks.rb
129
156
  - lib/dismissible_blocks/controllers/helpers.rb
130
157
  - lib/dismissible_blocks/engine.rb
131
158
  - lib/dismissible_blocks/version.rb
132
- - test/capybara_helper.rb
133
- - test/controllers/dismissible_blocks_controller_test.rb
134
- - test/dummy/Rakefile
135
- - test/dummy/app/assets/javascripts/application.js
136
- - test/dummy/app/assets/stylesheets/application.css
137
- - test/dummy/app/controllers/application_controller.rb
138
- - test/dummy/app/controllers/landings_controller.rb
139
- - test/dummy/app/controllers/sessions_controller.rb
140
- - test/dummy/app/helpers/application_helper.rb
141
- - test/dummy/app/helpers/landings_helper.rb
142
- - test/dummy/app/helpers/sessions_helper.rb
143
- - test/dummy/app/models/user.rb
144
- - test/dummy/app/views/landings/show.html.erb
145
- - test/dummy/app/views/layouts/application.html.erb
146
- - test/dummy/app/views/sessions/new.html.erb
147
- - test/dummy/bin/bundle
148
- - test/dummy/bin/rails
149
- - test/dummy/bin/rake
150
- - test/dummy/bin/setup
151
- - test/dummy/config.ru
152
- - test/dummy/config/application.rb
153
- - test/dummy/config/boot.rb
154
- - test/dummy/config/database.yml
155
- - test/dummy/config/environment.rb
156
- - test/dummy/config/environments/development.rb
157
- - test/dummy/config/environments/test.rb
158
- - test/dummy/config/initializers/assets.rb
159
- - test/dummy/config/initializers/cookies_serializer.rb
160
- - test/dummy/config/initializers/filter_parameter_logging.rb
161
- - test/dummy/config/initializers/session_store.rb
162
- - test/dummy/config/initializers/wrap_parameters.rb
163
- - test/dummy/config/routes.rb
164
- - test/dummy/config/secrets.yml
165
- - test/dummy/db/migrate/20140303154458_create_users.rb
166
- - test/dummy/db/migrate/20140303161500_add_dismissed_blocks_to_users.rb
167
- - test/dummy/db/schema.rb
168
- - test/dummy/db/test.sqlite3
169
- - test/dummy/log/test.log
170
- - test/dummy/public/404.html
171
- - test/dummy/public/422.html
172
- - test/dummy/public/500.html
173
- - test/dummy/public/favicon.ico
174
- - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
175
- - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
176
- - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
177
- - test/dummy/tmp/cache/assets/test/sprockets/58a8328804a777933d757eb9a448eaf5
178
- - test/dummy/tmp/cache/assets/test/sprockets/68b2c32b107dd99071629b05c392d6cd
179
- - test/dummy/tmp/cache/assets/test/sprockets/96c147c638b08a4c0178d9c66c3b9c48
180
- - test/dummy/tmp/cache/assets/test/sprockets/a303e31a3b163f257d2061cd9abb98d2
181
- - test/dummy/tmp/cache/assets/test/sprockets/ac2d5385dbcd9cea11c510dc83189bba
182
- - test/dummy/tmp/cache/assets/test/sprockets/bec12e1e92fe458e19b5f9869454ac1a
183
- - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
184
- - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
185
- - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
186
- - test/features/dismissible_blocks_test.rb
187
- - test/fixtures/users.yml
188
- - test/helpers/dismissible_blocks_helper_test.rb
189
- - test/lib/controllers/helpers_test.rb
190
- - test/test_helper.rb
191
159
  homepage: https://github.com/pbougie/dismissible_blocks
192
160
  licenses:
193
161
  - MIT
@@ -208,67 +176,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
176
  version: '0'
209
177
  requirements: []
210
178
  rubyforge_project:
211
- rubygems_version: 2.4.6
179
+ rubygems_version: 2.7.6
212
180
  signing_key:
213
181
  specification_version: 4
214
182
  summary: Dismissible HTML blocks for Ruby on Rails
215
- test_files:
216
- - test/capybara_helper.rb
217
- - test/controllers/dismissible_blocks_controller_test.rb
218
- - test/dummy/app/assets/javascripts/application.js
219
- - test/dummy/app/assets/stylesheets/application.css
220
- - test/dummy/app/controllers/application_controller.rb
221
- - test/dummy/app/controllers/landings_controller.rb
222
- - test/dummy/app/controllers/sessions_controller.rb
223
- - test/dummy/app/helpers/application_helper.rb
224
- - test/dummy/app/helpers/landings_helper.rb
225
- - test/dummy/app/helpers/sessions_helper.rb
226
- - test/dummy/app/models/user.rb
227
- - test/dummy/app/views/landings/show.html.erb
228
- - test/dummy/app/views/layouts/application.html.erb
229
- - test/dummy/app/views/sessions/new.html.erb
230
- - test/dummy/bin/bundle
231
- - test/dummy/bin/rails
232
- - test/dummy/bin/rake
233
- - test/dummy/bin/setup
234
- - test/dummy/config/application.rb
235
- - test/dummy/config/boot.rb
236
- - test/dummy/config/database.yml
237
- - test/dummy/config/environment.rb
238
- - test/dummy/config/environments/development.rb
239
- - test/dummy/config/environments/test.rb
240
- - test/dummy/config/initializers/assets.rb
241
- - test/dummy/config/initializers/cookies_serializer.rb
242
- - test/dummy/config/initializers/filter_parameter_logging.rb
243
- - test/dummy/config/initializers/session_store.rb
244
- - test/dummy/config/initializers/wrap_parameters.rb
245
- - test/dummy/config/routes.rb
246
- - test/dummy/config/secrets.yml
247
- - test/dummy/config.ru
248
- - test/dummy/db/migrate/20140303154458_create_users.rb
249
- - test/dummy/db/migrate/20140303161500_add_dismissed_blocks_to_users.rb
250
- - test/dummy/db/schema.rb
251
- - test/dummy/db/test.sqlite3
252
- - test/dummy/log/test.log
253
- - test/dummy/public/404.html
254
- - test/dummy/public/422.html
255
- - test/dummy/public/500.html
256
- - test/dummy/public/favicon.ico
257
- - test/dummy/Rakefile
258
- - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
259
- - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
260
- - test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953
261
- - test/dummy/tmp/cache/assets/test/sprockets/58a8328804a777933d757eb9a448eaf5
262
- - test/dummy/tmp/cache/assets/test/sprockets/68b2c32b107dd99071629b05c392d6cd
263
- - test/dummy/tmp/cache/assets/test/sprockets/96c147c638b08a4c0178d9c66c3b9c48
264
- - test/dummy/tmp/cache/assets/test/sprockets/a303e31a3b163f257d2061cd9abb98d2
265
- - test/dummy/tmp/cache/assets/test/sprockets/ac2d5385dbcd9cea11c510dc83189bba
266
- - test/dummy/tmp/cache/assets/test/sprockets/bec12e1e92fe458e19b5f9869454ac1a
267
- - test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
268
- - test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
269
- - test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
270
- - test/features/dismissible_blocks_test.rb
271
- - test/fixtures/users.yml
272
- - test/helpers/dismissible_blocks_helper_test.rb
273
- - test/lib/controllers/helpers_test.rb
274
- - test/test_helper.rb
183
+ test_files: []
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- # jquery-rails is used by the Dummy app
6
- # https://github.com/rails/rails/commit/007f5670
7
- gem 'jquery-rails'
data/Rakefile DELETED
@@ -1,34 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'DismissibleBlocks'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
- load 'rails/tasks/engine.rake'
19
-
20
-
21
-
22
- Bundler::GemHelper.install_tasks
23
-
24
- require 'rake/testtask'
25
-
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'lib'
28
- t.libs << 'test'
29
- t.pattern = 'test/**/*_test.rb'
30
- t.verbose = false
31
- end
32
-
33
-
34
- task default: :test
@@ -1,34 +0,0 @@
1
- require 'test_helper'
2
- require 'capybara/rails'
3
-
4
- class ActionDispatch::IntegrationTest
5
- include Capybara::DSL
6
- self.fixture_path = File.expand_path('../fixtures', __FILE__)
7
-
8
- def login(user)
9
- visit login_path
10
- fill_in 'Username', with: user.username
11
- fill_in 'Password', with: user.password
12
- click_button 'Login'
13
- assert current_path == landing_path
14
- assert page.has_content? 'You have been logged in.'
15
- end
16
-
17
- def logout
18
- visit logout_path
19
- assert current_path == login_path
20
- assert page.has_content? 'You have been logged out.'
21
- end
22
- end
23
-
24
- # Prevent database locks when testing AJAX features
25
- # https://github.com/jnicklas/capybara#transactions-and-database-setup
26
- class ActiveRecord::Base
27
- mattr_accessor :shared_connection
28
- @@shared_connection = nil
29
-
30
- def self.connection
31
- @@shared_connection || retrieve_connection
32
- end
33
- end
34
- ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@@ -1,18 +0,0 @@
1
- require 'test_helper'
2
-
3
- class DismissibleBlocksControllerTest < ActionController::TestCase
4
-
5
- test "dismiss block via ajax" do
6
- session[:username] = users(:one).username # Login
7
- refute users(:one).dismissed_blocks.include?('lorem')
8
- xhr :post, :create, block: 'lorem', format: 'json'
9
- users(:one).reload
10
- assert users(:one).dismissed_blocks.include?('lorem')
11
- assert_response :ok
12
- end
13
-
14
- test "dismiss block fails via ajax; not logged in" do
15
- xhr :post, :create, block: 'lorem', format: 'json'
16
- assert_response :unprocessable_entity
17
- end
18
- end
data/test/dummy/Rakefile DELETED
@@ -1,3 +0,0 @@
1
- require File.expand_path('../config/application', __FILE__)
2
-
3
- Rails.application.load_tasks
@@ -1,3 +0,0 @@
1
- //= require jquery
2
- //= require dismissible_blocks
3
- //= require dismissible_blocks_loader
@@ -1,17 +0,0 @@
1
- /*
2
- *= require_self
3
- */
4
-
5
- .flash, .block {
6
- border: 2px solid #333;
7
- padding: 10px 20px;
8
- background-color: #eee;
9
- }
10
- .flash-alert {
11
- border-color: #ebccd1;
12
- background-color: #f2dede;
13
- }
14
- .flash-notice {
15
- border-color: #bce8f1;
16
- background-color: #d9edf7;
17
- }
@@ -1,29 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery with: :exception
3
-
4
- def current_user
5
- if session[:username].present?
6
- @current_user ||= User.find_by(username: session[:username])
7
- end
8
- end
9
- helper_method :current_user
10
-
11
- def check_authentication
12
- unless session[:username].present?
13
- raise Dummy::Unauthorized
14
- end
15
- end
16
-
17
- def authenticated?
18
- session[:username].present?
19
- end
20
-
21
-
22
- def signin(username)
23
- session[:username] = username
24
- end
25
-
26
- def signout
27
- reset_session
28
- end
29
- end
@@ -1,6 +0,0 @@
1
- class LandingsController < ApplicationController
2
- before_filter :check_authentication
3
-
4
- def show
5
- end
6
- end