Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SellersController < ApplicationController
- before_action :set_cookies
- def show
- @seller = Seller.find(params[:id])
- @user = cookies[:user]
- @shop = cookies[:shop]
- @listings = Listing.where(shop: @shop).paginate(page: params[:page])
- end
- private
- def set_cookies
- cookies[:user] = current_user
- cookies[:seller] = Seller.find(params[:id])
- cookies[:shop] = Shop.where(seller: cookies[:seller]).first
- end
- end
- class TitlesController < ApplicationController
- before_action :find_data
- def index
- @titles = Title.last
- end
- private
- def find_data
- @shop = cookies[:shop]
- @seller = cookies[:seller]
- @user = cookies[:user]
- end
- end
- @shop
- => "#<Shop:0x00007f433f785dc8>"
- >>
- @shop.inspect
- => ""#<Shop:0x00007f433f785dc8>""
- >>
- cookies[:shop].class
- => String
Add Comment
Please, Sign In to add comment