bbs 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 090859437ceb4d0c72eba0956b05e6830057579e
4
- data.tar.gz: 8cf36a74c50266e44496bbbef76ff25ebf79c4e1
3
+ metadata.gz: 53f3093c331e334c5e6195734bed223cdc4e9e1a
4
+ data.tar.gz: '067806696393bb6e1efecaf9c491f04ff34b0786'
5
5
  SHA512:
6
- metadata.gz: 46fd87f5a2664447715423efe71d12771a687ac90f51da86294dfcad2fc2ca7cf5f74d6cb488bd327540cad504d6b5075508caf738432e3eecb528ef3cb79198
7
- data.tar.gz: c11d6e7003edd66d725398be23e6380c5ae313d0778fa5d3ed5b3883bfe79f2f4dbb43c0a04da913a242b932ca91b46367180e0d43b85532c553bb228895c581
6
+ metadata.gz: d4627da3dd64d6b6e8e063c92ad15793c857f1f9c2d84cc6cf45bcdc5b8136b0185c9ac01a37a8e6c21211d8dec99e97b5a2793c8ff12d0e5d62612612627b8f
7
+ data.tar.gz: 63770c6ef0462fa226835cfd24c5cf30210f8f85f6e714ed329c4d51dd6393a81de53aa9cda07c49d8bc78c20e3a58c628a6a9aab29efc43935f90260561a1e6
data/README.md CHANGED
@@ -31,7 +31,7 @@ Edit `config/routes.rb`:
31
31
 
32
32
  ```ruby
33
33
  Rails.application.routes.draw do
34
- mount Bbs::Engnie => '/bbs' # choose your mount point arbitrarylly
34
+ mount Bbs::Engine => '/bbs' # choose your mount point arbitrarily
35
35
  end
36
36
  ```
37
37
 
@@ -6,8 +6,8 @@ module Bbs
6
6
 
7
7
  layout 'layouts/application'
8
8
 
9
- def logged_in?; current_user end
9
+ def logged_in?; current_bbs_user end
10
10
 
11
- helper_method :logged_in?
11
+ helper_method :logged_in?, :current_bbs_user
12
12
  end
13
13
  end
@@ -1,6 +1,6 @@
1
1
  module Bbs
2
2
  class CommentsController < Bbs::ApplicationController
3
- before_action :authenticate_user!, only: %i(create)
3
+ before_action :authenticate_bbs_user, only: %i(create)
4
4
  before_action :set_topic
5
5
 
6
6
  def create
@@ -26,7 +26,7 @@ module Bbs
26
26
 
27
27
  def comment_params
28
28
  params.require(:comment).permit(Bbs::Comment.permitted_attributes)
29
- .merge(author: current_user)
29
+ .merge(author: current_bbs_user)
30
30
  end
31
31
 
32
32
  def comments
@@ -4,16 +4,16 @@ module Bbs
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- unless public_instance_methods.include?(Bbs.config.current_user)
8
- define_method(:current_user) do
9
- __send__ Bbs.config.current_user
10
- end
7
+ define_method(:current_bbs_user) do
8
+ raise NoMethodError, "undefined method #{Bbs.config.current_user} in #{self.class.to_s}." unless respond_to?(Bbs.config.current_user)
9
+
10
+ __send__ Bbs.config.current_user
11
11
  end
12
12
 
13
- unless public_instance_methods.include?(Bbs.config.authenticate_user)
14
- define_method(:authenticate_user!) do
15
- __send__ Bbs.config.authenticate_user
16
- end
13
+ define_method(:authenticate_bbs_user) do
14
+ raise NoMethodError, "undefined method #{Bbs.config.authenticate_user} in #{self.class.to_s}." unless respond_to?(Bbs.config.authenticate_user)
15
+
16
+ __send__ Bbs.config.authenticate_user
17
17
  end
18
18
  end
19
19
  end
@@ -1,26 +1,26 @@
1
1
  module Bbs
2
2
  class ProfilesController < Bbs::ApplicationController
3
- before_action :authenticate_user!
3
+ before_action :authenticate_bbs_user
4
4
 
5
5
  def edit
6
- current_user.build_profile unless current_user.profile
6
+ current_bbs_user.build_profile unless current_bbs_user.profile
7
7
  end
8
8
 
9
9
  def create
10
- if current_user.create_profile(profile_params)
10
+ if current_bbs_user.create_profile(profile_params)
11
11
  redirect_to edit_profile_path, notice: t('.success')
12
12
  else
13
- flash.now[:alert] = current_user.profile.errors.full_messages
13
+ flash.now[:alert] = current_bbs_user.profile.errors.full_messages
14
14
 
15
15
  render :edit
16
16
  end
17
17
  end
18
18
 
19
19
  def update
20
- if current_user.profile.update(profile_params)
20
+ if current_bbs_user.profile.update(profile_params)
21
21
  redirect_to edit_profile_path, notice: t('.success')
22
22
  else
23
- flash.now[:alert] = current_user.profile.errors.full_messages
23
+ flash.now[:alert] = current_bbs_user.profile.errors.full_messages
24
24
 
25
25
  render :edit
26
26
  end
@@ -1,6 +1,6 @@
1
1
  module Bbs
2
2
  class TopicsController < Bbs::ApplicationController
3
- before_action :authenticate_user!, only: %i(create)
3
+ before_action :authenticate_bbs_user, only: %i(create)
4
4
  before_action :set_category
5
5
 
6
6
  def new
@@ -29,7 +29,7 @@ module Bbs
29
29
 
30
30
  def topic_params
31
31
  params.require(:topic).permit(Bbs::Topic.permitted_attributes)
32
- .merge(author: current_user)
32
+ .merge(author: current_bbs_user)
33
33
  end
34
34
  end
35
35
  end
@@ -1,4 +1,4 @@
1
- = form_for current_user.profile, url: bbs.profile_path, html: {class: 'bbs-form bbs-form--vertical'} do |f|
1
+ = form_for current_bbs_user.profile, url: bbs.profile_path, html: {class: 'bbs-form bbs-form--vertical'} do |f|
2
2
  .bbs-form-group
3
3
  = f.label :avatar_url
4
4
 
data/lib/bbs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Bbs
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-16 00:00:00.000000000 Z
11
+ date: 2016-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  version: '0'
278
278
  requirements: []
279
279
  rubyforge_project:
280
- rubygems_version: 2.5.1
280
+ rubygems_version: 2.5.2
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: Summary of Bbs.