Class: Certify::CertificatesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Certify::CertificatesController
- Defined in:
- app/controllers/certify/certificates_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /certificates POST /certificates.json.
-
#destroy ⇒ Object
DELETE /certificates/1 DELETE /certificates/1.json.
-
#new ⇒ Object
GET /certificates/new GET /certificates/new.json.
-
#show ⇒ Object
GET /certificates/1 GET /certificates/1.json.
Instance Method Details
#create ⇒ Object
POST /certificates POST /certificates.json
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/controllers/certify/certificates_controller.rb', line 32 def create # get the ca @authority = Authority.find(params[:certify_authority_id]) # create the cert @certificate = @authority.certificates.build() # apply the csr @certificate.csr=params[:csr] # format respond_to do |format| if @certificate.save format.html { redirect_to (@authority), notice: 'Certificate was successfully created.' } format.json { render json: @certificate, status: :created, location: @certificate } else format.html { render action: "new" } format.json { render json: @certificate.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /certificates/1 DELETE /certificates/1.json
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/controllers/certify/certificates_controller.rb', line 56 def destroy # get the ca @authority = Authority.find(params[:certify_authority_id]) # get the certificate @certificate = Certificate.find(params[:id]) @certificate.destroy respond_to do |format| format.html { redirect_to (@authority), notice: 'Certificate removed' } format.json { head :no_content } end end |
#new ⇒ Object
GET /certificates/new GET /certificates/new.json
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/certify/certificates_controller.rb', line 17 def new # get the authority @authority = Authority.find(params[:certify_authority_id]) # generate a new one @certificate = Certificate.new() respond_to do |format| format.html # new.html.erb format.json { render json: @certificate } end end |
#show ⇒ Object
GET /certificates/1 GET /certificates/1.json
6 7 8 9 10 11 12 13 |
# File 'app/controllers/certify/certificates_controller.rb', line 6 def show @certificate = Certificate.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @certificate } end end |