From f14f462eaf8dcf272db54cd513bf7ffe7dc6a6e3 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 21 Mar 2016 18:26:47 +0100 Subject: Adding Turbolinks, adding status posting form on homepage --- app/controllers/statuses_controller.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/controllers/statuses_controller.rb (limited to 'app/controllers') diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb new file mode 100644 index 000000000..a5cb3eae1 --- /dev/null +++ b/app/controllers/statuses_controller.rb @@ -0,0 +1,18 @@ +class StatusesController < ApplicationController + layout 'dashboard' + + before_action :authenticate_user! + + def create + status = PostStatusService.new.(current_user.account, status_params[:text]) + redirect_to root_path + rescue ActiveRecord::RecordInvalid + redirect_to root_path + end + + private + + def status_params + params.require(:status).permit(:text) + end +end -- cgit