2013-06-24 11:24:14 -04:00
|
|
|
class Profiles::KeysController < ApplicationController
|
2011-11-02 11:21:17 -04:00
|
|
|
layout "profile"
|
2011-10-08 17:36:38 -04:00
|
|
|
|
|
|
|
def index
|
2013-12-14 08:43:48 -05:00
|
|
|
@keys = current_user.keys.order('id DESC')
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2011-12-19 16:32:59 -05:00
|
|
|
def show
|
|
|
|
@key = current_user.keys.find(params[:id])
|
|
|
|
end
|
|
|
|
|
2011-10-08 17:36:38 -04:00
|
|
|
def new
|
|
|
|
@key = current_user.keys.new
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
|
|
|
@key = current_user.keys.new(params[:key])
|
|
|
|
|
2013-06-24 11:24:14 -04:00
|
|
|
if @key.save
|
|
|
|
redirect_to profile_key_path(@key)
|
|
|
|
else
|
|
|
|
render 'new'
|
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@key = current_user.keys.find(params[:id])
|
|
|
|
@key.destroy
|
|
|
|
|
|
|
|
respond_to do |format|
|
2013-06-24 11:24:14 -04:00
|
|
|
format.html { redirect_to profile_keys_url }
|
2012-08-10 18:07:50 -04:00
|
|
|
format.js { render nothing: true }
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|