about summary refs log tree commit diff
path: root/app/controllers/statuses_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/statuses_controller.rb')
-rw-r--r--app/controllers/statuses_controller.rb18
1 files changed, 18 insertions, 0 deletions
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