Guest User

Untitled

a guest
Nov 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. class PagingController < ApplicationController
  2. def index
  3. @pages = Paging.all
  4.  
  5. respond_to do |format|
  6. format.html # index.html.erb
  7. format.json { render json: @pages }
  8. end
  9. end
  10.  
  11. # POST /posts
  12. # POST /posts.json
  13.  
  14. def new
  15. @page = Paging.new
  16. end
  17.  
  18. def create
  19. @page = Paging.new(params[:page])
  20.  
  21. respond_to do |format|
  22. if @page.save
  23. format.html { redirect_to paging_path, notice: 'Post was successfully created.' }
  24. format.json { render json: @page, status: :created, location: @page }
  25. format.js
  26. else
  27. format.html { render action: "index" }
  28. format.json { render json: @page.errors, status: :unprocessable_entity }
  29. end
  30. end
  31. end
  32.  
  33.  
  34. # DELETE /posts/1
  35. # DELETE /posts/1.json
  36. def destroy
  37. @page = Paging.find(params[:id])
  38. @paging.destroy
  39.  
  40. respond_to do |format|
  41. format.html { redirect_to paging_path }
  42. format.json { head :no_content }
  43. format.js
  44. end
  45. end
  46. end
Add Comment
Please, Sign In to add comment