Class: Kwipper::PostFavoritesController
- Inherits:
-
Controller
- Object
- Controller
- Kwipper::PostFavoritesController
- Defined in:
- app/controllers/post_favorites_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
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/post_favorites_controller.rb', line 5 def create require_login! post = Post.find params['id'] fave = PostFavorite.create({ 'user_id' => current_user.id, 'post_id' => post.id }) redirect "/kwips/show?id=#{post.id}" end |