Skip to content
Browse files

controller with json response

  • Loading branch information...
1 parent ee598c2 commit f5423885b933cee5c9db4be4ab71af990c1fab40 @kevivmatrix committed
Showing with 13 additions and 0 deletions.
  1. +13 −0 app/controllers/companies_controller.rb
View
13 app/controllers/companies_controller.rb
@@ -1,7 +1,20 @@
class CompaniesController < ApplicationController
def index
+ @companies = Company.all
+ respond_to do |f|
+ f.html
+ f.json { render json: @companies }
+ end
end
def show
+ @company = Company.find(params[:id])
+ respond_to do |f|
+ f.html
+ f.json {
+ render json: @company
+ }
+ end
end
+
end

0 comments on commit f542388

Please sign in to comment.
Something went wrong with that request. Please try again.