Class: MicropostsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/microposts_controller.rb

Instance Method Summary collapse

Methods included from SessionsHelper

#preferences_customer_type=, #preferences_customer_type?, #signed_in?, #signed_in_user, #store_location

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/microposts_controller.rb', line 8

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

#destroyObject



19
20
21
22
# File 'app/controllers/microposts_controller.rb', line 19

def destroy
  @micropost.destroy
  redirect_to root_path
end

#indexObject



5
6
# File 'app/controllers/microposts_controller.rb', line 5

def index
end