This repository was archived by the owner on Nov 13, 2020. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 4 files changed +147
-3
lines changed Expand file tree Collapse file tree 4 files changed +147
-3
lines changed Original file line number Diff line number Diff line change 11class  BespokeController  < ApplicationController 
2+   # GET /posts 
3+   # GET /posts.json 
4+   def  index 
5+     @posts  =  Post . all 
6+ 
7+     render  json : @posts 
8+   end 
9+ 
10+   # GET /posts/1 
11+   # GET /posts/1.json 
12+   def  show 
13+     @post  =  Post . find ( params [ :id ] ) 
14+ 
15+     render  json : @post 
16+   end 
17+ 
18+   # POST /posts 
19+   # POST /posts.json 
20+   def  create 
21+     @post  =  Post . new ( params [ :post ] ) 
22+ 
23+     if  @post . save 
24+       render  json : @post ,  status : :created ,  location : @post 
25+     else 
26+       render  json : @post . errors ,  status : :unprocessable_entity 
27+     end 
28+   end 
29+ 
30+   # PATCH/PUT /posts/1 
31+   # PATCH/PUT /posts/1.json 
32+   def  update 
33+     @post  =  Post . find ( params [ :id ] ) 
34+ 
35+     if  @post . update ( params [ :post ] ) 
36+       head  :no_content 
37+     else 
38+       render  json : @post . errors ,  status : :unprocessable_entity 
39+     end 
40+   end 
41+ 
42+   # DELETE /posts/1 
43+   # DELETE /posts/1.json 
44+   def  destroy 
45+     @post  =  Post . find ( params [ :id ] ) 
46+     @post . destroy 
47+ 
48+     head  :no_content 
49+   end 
250end 
Original file line number Diff line number Diff line change 11class  IdstyleController  < ApplicationController 
2+   # GET /posts 
3+   # GET /posts.json 
4+   def  index 
5+     @posts  =  Post . all 
6+ 
7+     render  json : @posts 
8+   end 
9+ 
10+   # GET /posts/1 
11+   # GET /posts/1.json 
12+   def  show 
13+     @post  =  Post . find ( params [ :id ] ) 
14+ 
15+     render  json : @post 
16+   end 
17+ 
18+   # POST /posts 
19+   # POST /posts.json 
20+   def  create 
21+     @post  =  Post . new ( params [ :post ] ) 
22+ 
23+     if  @post . save 
24+       render  json : @post ,  status : :created ,  location : @post 
25+     else 
26+       render  json : @post . errors ,  status : :unprocessable_entity 
27+     end 
28+   end 
29+ 
30+   # PATCH/PUT /posts/1 
31+   # PATCH/PUT /posts/1.json 
32+   def  update 
33+     @post  =  Post . find ( params [ :id ] ) 
34+ 
35+     if  @post . update ( params [ :post ] ) 
36+       head  :no_content 
37+     else 
38+       render  json : @post . errors ,  status : :unprocessable_entity 
39+     end 
40+   end 
41+ 
42+   # DELETE /posts/1 
43+   # DELETE /posts/1.json 
44+   def  destroy 
45+     @post  =  Post . find ( params [ :id ] ) 
46+     @post . destroy 
47+ 
48+     head  :no_content 
49+   end 
250end 
Original file line number Diff line number Diff line change 11class  UrlstyleController  < ApplicationController 
2+   # GET /posts 
3+   # GET /posts.json 
4+   def  index 
5+     @posts  =  Post . all 
6+ 
7+     render  json : @posts 
8+   end 
9+ 
10+   # GET /posts/1 
11+   # GET /posts/1.json 
12+   def  show 
13+     @post  =  Post . find ( params [ :id ] ) 
14+ 
15+     render  json : @post 
16+   end 
17+ 
18+   # POST /posts 
19+   # POST /posts.json 
20+   def  create 
21+     @post  =  Post . new ( params [ :post ] ) 
22+ 
23+     if  @post . save 
24+       render  json : @post ,  status : :created ,  location : @post 
25+     else 
26+       render  json : @post . errors ,  status : :unprocessable_entity 
27+     end 
28+   end 
29+ 
30+   # PATCH/PUT /posts/1 
31+   # PATCH/PUT /posts/1.json 
32+   def  update 
33+     @post  =  Post . find ( params [ :id ] ) 
34+ 
35+     if  @post . update ( params [ :post ] ) 
36+       head  :no_content 
37+     else 
38+       render  json : @post . errors ,  status : :unprocessable_entity 
39+     end 
40+   end 
41+ 
42+   # DELETE /posts/1 
43+   # DELETE /posts/1.json 
44+   def  destroy 
45+     @post  =  Post . find ( params [ :id ] ) 
46+     @post . destroy 
47+ 
48+     head  :no_content 
49+   end 
250end 
Original file line number Diff line number Diff line change 22  root  "homepage#index" 
33
44  namespace  "bespoke"  do 
5-     resources  :posts 
5+     resources  :posts ,   except :  [ :new ,   :edit ] 
66  end 
77
88  namespace  "idstyle"  do 
9-     resources  :posts 
9+     resources  :posts ,   except :  [ :new ,   :edit ] 
1010  end 
1111
1212  namespace  "urlstyle"  do 
13-     resources  :posts 
13+     resources  :posts ,   except :  [ :new ,   :edit ] 
1414  end 
1515end 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments