Commit 6c4e5dc4 by tady

ログアウト

parent 2bade347
......@@ -3,4 +3,12 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def require_login
unless user_signed_in?
flash[:alert] = 'You need Login!'
redirect_to root_path
end
end
end
class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
before_action :require_login, except: [:index]
include ApplicationHelper
......
......@@ -3,7 +3,7 @@ module PostsHelper
# @param {ActiveRecord::Relation} node
def h_display_tree(node)
_html = '<ul>'
_html << %Q{<li><a href="#{ root_path(q: '#' + node.name) }">#{node.name}<a/></li>}
_html << %Q{<li><a href="#{ root_path(q: '#' + node.name) }">#{node.name}</a></li>}
node.children.each do |_child|
_html << h_display_tree(_child)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment