Class: Atreides::LikesController

Inherits:
PublicController show all
Includes:
Extendable
Defined in:
app/controllers/atreides/likes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
# File 'app/controllers/atreides/likes_controller.rb', line 15

def create
  super do |success, failure|
    success.html { head :ok, :location => post_path(parent) }
    success.js
    failure.wants.html { head :error, :message => "You already liked this" }
    failure.wants.js
  end
end

#indexObject



7
8
9
10
11
12
13
# File 'app/controllers/atreides/likes_controller.rb', line 7

def index
  super do |wants|
    wants.html { head :not_found }
    wants.json { render :json => collection.to_json }
    wants.xml  { render :xml => collection.to_xml }
  end
end