Guest User

Untitled

a guest
Jan 26th, 2018
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. ## error
  2.  
  3. ActionController::RoutingError in Pages#home
  4.  
  5. Showing /Users/ihal/Desktop/GP_2011/gp_2011/app/views/shared/_feed_item.html.erb where line #3 raised:
  6.  
  7. No route matches {:controller=>"users", :action=>"show", :id=>#<User id: 101, email: "dcbror@gmail.com",
  8.  
  9. encrypted_password: "$2a$10$zciSm1SF5UhnZ//b4M9k6.47e.14UKBtB.I/C4hsddjo...", password_salt: "$2a$10$zciSm1SF5UhnZ//b4M9k6.", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 3, current_sign_in_at: "2011-03-16 23:14:57", last_sign_in_at: "2011-03-14 23:57:53", current_sign_in_ip: "127.0.0.1", last_sign_in_ip: "127.0.0.1", created_at: "2011-03-14 10:42:21", updated_at: "2011-03-16 23:14:57", name: nil, username: nil, avatar: nil>}
  10.  
  11. Extracted source (around line #3):
  12.  
  13. 1: <tr>
  14. 2: <td class="avatar">
  15. 3: <%= link_to avatar_for(feed_item.user), feed_item.user %>
  16. 4: </td>
  17. 5: <td class="supportpost">
  18. 6:
  19.  
  20. Trace of template inclusion: app/views/shared/_feed.html.erb, app/views/pages/home.html.erb
  21.  
  22. Rails.root: /Users/ihal/Desktop/GP_2011/gp_2011
  23. Application Trace | Framework Trace | Full Trace
  24.  
  25. app/views/shared/_feed_item.html.erb:3:in `_app_views_shared__feed_item_html_erb__1921957314978325644_2161868900_3433621597093174608'
  26. app/views/shared/_feed.html.erb:3:in `_app_views_shared__feed_html_erb__3711547774624300244_2162764500_305833199033439038'
  27. app/views/pages/home.html.erb:7:in `_app_views_pages_home_html_erb___3460931149969880935_2163851440_2772392578701987169'
  28.  
  29. ## rake routes
  30.  
  31. user_supportposts GET /:username/supportposts(.:format) {:action=>"index", :controller=>"supportposts"}
  32. user_supportposts POST /:username/supportposts(.:format) {:action=>"create", :controller=>"supportposts"}
  33. new_user_supportpost GET /:username/supportposts/new(.:format) {:action=>"new", :controller=>"supportposts"}
  34. edit_user_supportpost GET /:username/supportposts/:id/edit(.:format) {:action=>"edit", :controller=>"supportposts"}
  35. user_supportpost GET /:username/supportposts/:id(.:format) {:action=>"show", :controller=>"supportposts"}
  36. user_supportpost PUT /:username/supportposts/:id(.:format) {:action=>"update", :controller=>"supportposts"}
  37. user_supportpost DELETE /:username/supportposts/:id(.:format) {:action=>"destroy", :controller=>"supportposts"}
  38. new_user_session GET /users/sign_in(.:format) {:action=>"new", :controller=>"devise/sessions"}
  39. user_session POST /users/sign_in(.:format) {:action=>"create", :controller=>"devise/sessions"}
  40. destroy_user_session GET /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
  41. user_password POST /users/password(.:format) {:action=>"create", :controller=>"devise/passwords"}
  42. new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
  43. edit_user_password GET /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
  44. user_password PUT /users/password(.:format) {:action=>"update", :controller=>"devise/passwords"}
  45. user_registration POST /users(.:format) {:action=>"create", :controller=>"devise/registrations"}
  46. new_user_registration GET /users/sign_up(.:format) {:action=>"new", :controller=>"devise/registrations"}
  47. edit_user_registration GET /users/edit(.:format) {:action=>"edit", :controller=>"devise/registrations"}
  48. user_registration PUT /users(.:format) {:action=>"update", :controller=>"devise/registrations"}
  49. user_registration DELETE /users(.:format) {:action=>"destroy", :controller=>"devise/registrations"}
  50. supportposts GET /supportposts(.:format) {:action=>"index", :controller=>"supportposts"}
  51. supportposts POST /supportposts(.:format) {:action=>"create", :controller=>"supportposts"}
  52. supportpost GET /supportposts/:id(.:format) {:action=>"show", :controller=>"supportposts"}
  53. supportpost DELETE /supportposts/:id(.:format) {:action=>"destroy", :controller=>"supportposts"}
  54. root /(.:format) {:controller=>"pages", :action=>"home"}
  55. user /:id(.:format) {:controller=>"users", :action=>"show"}
  56. contact /contact(.:format) {:controller=>"pages", :action=>"contact"}
  57. about /about(.:format) {:controller=>"pages", :action=>"about"}
  58. help /help(.:format) {:controller=>"pages", :action=>"help"}
  59.  
  60. ## routes.rb
  61.  
  62. Gp2011::Application.routes.draw do
  63.  
  64. scope ":username", :as => "user" do
  65. resources :supportposts
  66. end
  67.  
  68. devise_for :users
  69.  
  70. resources :supportposts, :only => [:create, :destroy, :index, :show]
  71.  
  72. root :to => "pages#home"
  73.  
  74. match '/:id' => 'users#show', :as => 'user'
  75.  
  76. match '/contact', :to => 'pages#contact'
  77. match '/about', :to => 'pages#about'
  78. match '/help', :to => 'pages#help'
  79.  
  80. ## PagesController.rb
  81.  
  82. class PagesController < ApplicationController
  83. def home
  84. @title = "Home"
  85. if user_signed_in?
  86. @user = User.find_by_username!(params[:id])
  87. @supportpost = Supportpost.new
  88. @feed_items = current_user.feed.paginate(:page => params[:page])
  89. end
  90. end
  91.  
  92.  
  93. ## UsersController.rb
  94.  
  95. class UsersController < ApplicationController
  96.  
  97. def show
  98. @user = User.find_by_username!(params[:id])
  99. @supportposts = @user.supportposts.paginate(:page => params[:page])
  100. @title = @user.name
  101. end
  102. end
  103.  
  104.  
  105. ## SupportpostsController.rb
  106.  
  107. class SupportpostsController < ApplicationController
  108.  
  109. before_filter :authenticate_user!, :only => [:create, :edit, :update, :destroy]
  110. before_filter :authorized_user, :only => :destroy
  111.  
  112. def create
  113. @supportpost = current_user.supportposts.build(params[:supportpost])
  114. if @supportpost.save
  115. flash[:success] = "Support created!"
  116. redirect_to root_path
  117. else
  118. @feed_items = []
  119. render 'pages/home'
  120. end
  121. end
  122.  
  123. def index
  124. @supportposts = Supportpost.paginate(:page => params[:page])
  125. end
  126.  
  127. def show
  128.  
  129. end
  130.  
  131. def destroy
  132. @supportpost.destroy
  133. redirect_to root_path
  134. end
  135.  
  136.  
  137. private
  138.  
  139. def authorized_user
  140. @supportpost = Supportpost.find(params[:id])
  141. redirect_to root_path unless current_user?(@supportpost.user)
  142. end
  143. end
Add Comment
Please, Sign In to add comment