about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-03-21 18:26:47 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-03-21 18:26:47 +0100
commitf14f462eaf8dcf272db54cd513bf7ffe7dc6a6e3 (patch)
tree2275619996f64b55369e4f35cd228eb52dc48601 /app/controllers
parentc28971c70c3d5caf18a5e931ff345534f1e4cece (diff)
Adding Turbolinks, adding status posting form on homepage
Diffstat (limited to 'app/controllers')
-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