Sha256: 35487b1394e8c640680c6ba63131b234c132e4dbc3b067765ffd3636f1559208
Contents?: true
Size: 662 Bytes
Versions: 2
Compression:
Stored size: 662 Bytes
Contents
class MicropostsController < ApplicationController before_filter :signed_in_user, only: [:create, :destroy] before_filter :correct_user, only: :destroy def index end def create @micropost = current_user.microposts.build(params[:micropost]) if @micropost.save flash[:success] = "Micropost created!" redirect_to root_path else @feed_items = [] render 'static_pages/home' end end def destroy @micropost.destroy redirect_to root_path end private def correct_user @micropost = current_user.microposts.find_by_id(params[:id]) redirect_to root_path if @micropost.nil? end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
guara-0.0.3 | app/controllers/microposts_controller.rb |
guara-0.0.1.rc | app/controllers/microposts_controller.rb |