frontend/app/controllers/gaku/gaku_controller.rb in gaku-0.1.1 vs frontend/app/controllers/gaku/gaku_controller.rb in gaku-0.2.0
- old
+ new
@@ -4,19 +4,30 @@
self.responder = AppResponder
respond_to :html
layout :resolve_layout
+ before_action :require_login
+
def resolve_layout
case action_name
when 'index'
'gaku/layouts/index'
when 'show'
'gaku/layouts/show'
when 'edit'
'gaku/layouts/edit'
else
'gaku/layouts/gaku'
+ end
+ end
+
+
+ private
+
+ def require_login
+ unless current_user
+ redirect_to new_user_session_path
end
end
end
end