2011-10-08 21:36:38 +00:00
|
|
|
class KeysController < ApplicationController
|
2011-11-02 15:21:17 +00:00
|
|
|
layout "profile"
|
2012-01-29 21:59:12 +00:00
|
|
|
respond_to :js, :html
|
2011-10-08 21:36:38 +00:00
|
|
|
|
|
|
|
def index
|
|
|
|
@keys = current_user.keys.all
|
|
|
|
end
|
|
|
|
|
2011-12-19 21:32:59 +00:00
|
|
|
def show
|
|
|
|
@key = current_user.keys.find(params[:id])
|
|
|
|
end
|
|
|
|
|
2011-10-08 21:36:38 +00:00
|
|
|
def new
|
|
|
|
@key = current_user.keys.new
|
|
|
|
|
|
|
|
respond_with(@key)
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@key = current_user.keys.new(params[:key])
|
|
|
|
@key.save
|
|
|
|
|
|
|
|
respond_with(@key)
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@key = current_user.keys.find(params[:id])
|
|
|
|
@key.destroy
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { redirect_to keys_url }
|
2012-08-10 22:07:50 +00:00
|
|
|
format.js { render nothing: true }
|
2011-10-08 21:36:38 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|