Class: ShortDomainsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ShortDomainsController
- Defined in:
- app/controllers/short_domains_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /short_domains POST /short_domains.json.
-
#destroy ⇒ Object
DELETE /short_domains/1 DELETE /short_domains/1.json.
-
#edit ⇒ Object
GET /short_domains/1/edit.
-
#index ⇒ Object
GET /short_domains GET /short_domains.json.
-
#new ⇒ Object
GET /short_domains/new GET /short_domains/new.json.
-
#show ⇒ Object
GET /short_domains/1 GET /short_domains/1.json.
-
#update ⇒ Object
PUT /short_domains/1 PUT /short_domains/1.json.
Instance Method Details
#create ⇒ Object
POST /short_domains POST /short_domains.json
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/short_domains_controller.rb', line 43 def create @short_domain = ShortDomain.new(params[:short_domain]) puts @short_domain.inspect respond_to do |format| if @short_domain.save format.html { redirect_to @short_domain, notice: 'Short domain was successfully created.' } format.json { render json: @short_domain, status: :created, location: @short_domain } else format.html { render action: "new" } format.json { render json: @short_domain.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /short_domains/1 DELETE /short_domains/1.json
76 77 78 79 80 81 82 83 84 |
# File 'app/controllers/short_domains_controller.rb', line 76 def destroy @short_domain = ShortDomain.find(params[:id]) @short_domain.destroy respond_to do |format| format.html { redirect_to short_domains_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /short_domains/1/edit
37 38 39 |
# File 'app/controllers/short_domains_controller.rb', line 37 def edit @short_domain = ShortDomain.find(params[:id], :include => [:short_urls]) end |
#index ⇒ Object
GET /short_domains GET /short_domains.json
5 6 7 8 9 10 11 12 |
# File 'app/controllers/short_domains_controller.rb', line 5 def index @short_domains = ShortDomain.all respond_to do |format| format.html # index.html.erb format.json { render json: @short_domains } end end |
#new ⇒ Object
GET /short_domains/new GET /short_domains/new.json
27 28 29 30 31 32 33 34 |
# File 'app/controllers/short_domains_controller.rb', line 27 def new @short_domain = ShortDomain.new respond_to do |format| format.html # new.html.erb format.json { render json: @short_domain } end end |
#show ⇒ Object
GET /short_domains/1 GET /short_domains/1.json
16 17 18 19 20 21 22 23 |
# File 'app/controllers/short_domains_controller.rb', line 16 def show @short_domain = ShortDomain.find(params[:id], :include => { :short_urls => :short_domain }) respond_to do |format| format.html # show.html.erb format.json { render json: @short_domain } end end |
#update ⇒ Object
PUT /short_domains/1 PUT /short_domains/1.json
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/short_domains_controller.rb', line 60 def update @short_domain = ShortDomain.find(params[:id]) respond_to do |format| if @short_domain.update_attributes(params[:short_domain]) format.html { redirect_to @short_domain, notice: 'Short domain was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @short_domain.errors, status: :unprocessable_entity } end end end |