GeoRSS aggregator and Layar augmented reality server
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

feeds_controller.rb 1.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. class FeedsController < ApplicationController
  2. before_filter :require_login
  3. # GET /feeds
  4. # GET /feeds.json
  5. def index
  6. @feed = Feed.new
  7. @feeds = Feed.all :order => :title
  8. respond_to do |format|
  9. format.html # index.html.erb
  10. format.json { render json: @feeds }
  11. end
  12. end
  13. # GET /feeds/1
  14. # GET /feeds/1.json
  15. def show
  16. @feed = Feed.find(params[:id])
  17. @posts = @feed.posts.order("published desc").paginate(:page => params[:page], :per_page => 20)
  18. respond_to do |format|
  19. format.html # show.html.erb
  20. format.json { render json: @feed }
  21. end
  22. end
  23. # GET /feeds/new
  24. # GET /feeds/new.json
  25. def new
  26. @feed = Feed.new
  27. respond_to do |format|
  28. format.html # new.html.erb
  29. format.json { render json: @feed }
  30. end
  31. end
  32. # GET /feeds/1/edit
  33. def edit
  34. @feed = Feed.find(params[:id])
  35. end
  36. # Feeds are created through the Subscriptions controller
  37. # PUT /feeds/1
  38. # PUT /feeds/1.json
  39. def update
  40. @feed = Feed.find(params[:id])
  41. respond_to do |format|
  42. if @feed.update_attributes(params[:feed])
  43. format.html { redirect_to @feed, notice: 'Feed updated OK' }
  44. format.json { head :no_content }
  45. else
  46. format.html { render action: "edit" }
  47. format.json { render json: @feed.errors, status: :unprocessable_entity }
  48. end
  49. end
  50. end
  51. # DELETE /feeds/1
  52. # DELETE /feeds/1.json
  53. # def destroy
  54. # @feed = Feed.find(params[:id])
  55. # @feed.destroy
  56. #
  57. # respond_to do |format|
  58. # format.html { redirect_to feeds_url, notice: 'Feed deleted OK' }
  59. # format.json { head :no_content }
  60. # end
  61. # end
  62. def fetch
  63. @feed = Feed.find(params[:id])
  64. @feed.fetch
  65. redirect_to :back, notice: 'Feed fetched OK'
  66. end
  67. def fetch_all
  68. Feed.fetch_all
  69. redirect_to :back, notice: 'All feeds fetched OK'
  70. end
  71. end