Guest User

Untitled

a guest
Jul 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. class SellersController < ApplicationController
  2. before_action :set_cookies
  3.  
  4. def show
  5. @seller = Seller.find(params[:id])
  6. @user = cookies[:user]
  7. @shop = cookies[:shop]
  8. @listings = Listing.where(shop: @shop).paginate(page: params[:page])
  9. end
  10.  
  11. private
  12. def set_cookies
  13. cookies[:user] = current_user
  14. cookies[:seller] = Seller.find(params[:id])
  15. cookies[:shop] = Shop.where(seller: cookies[:seller]).first
  16. end
  17. end
  18.  
  19. class TitlesController < ApplicationController
  20. before_action :find_data
  21.  
  22. def index
  23. @titles = Title.last
  24. end
  25.  
  26. private
  27. def find_data
  28. @shop = cookies[:shop]
  29. @seller = cookies[:seller]
  30. @user = cookies[:user]
  31. end
  32. end
  33.  
  34. @shop
  35. => "#<Shop:0x00007f433f785dc8>"
  36. >>
  37. @shop.inspect
  38. => ""#<Shop:0x00007f433f785dc8>""
  39. >>
  40. cookies[:shop].class
  41. => String
Add Comment
Please, Sign In to add comment