Class: Kwipper::PostsController
- Inherits:
-
Controller
- Object
- Controller
- Kwipper::PostsController
- Defined in:
- app/controllers/posts_controller.rb
Constant Summary
Constants inherited from Controller
Constants included from RendersViews
RendersViews::VIEWS_PATH, RendersViews::VIEW_EXT
Instance Attribute Summary
Attributes inherited from Controller
#action, #app, #request, #response
Instance Method Summary collapse
Methods inherited from Controller
add_routes, #home, #initialize, #process
Methods included from RendersViews
Constructor Details
This class inherits a constructor from Kwipper::Controller
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/posts_controller.rb', line 27 def create require_login! post = Post.new params.merge({ 'user_id' => current_user.id, 'created_at' => Time.now.httpdate }) if post.save redirect '/kwips' else redirect '/kwips/new', :bad_request end end |
#new ⇒ Object
22 23 24 25 |
# File 'app/controllers/posts_controller.rb', line 22 def new require_login! render :new_post end |