1
0
Fork 0
forked from OpenNeo/impress
impress/app/controllers/item_trades_controller.rb
Emi Matchu 402e3d4afb Basic trade hangers page, just content and without style
We're just getting started but there we go!! No links or styles yet,
just getting it done!
2024-01-21 03:10:06 -08:00

25 lines
534 B
Ruby

class ItemTradesController < ApplicationController
def index
@item = Item.find params[:item_id]
@type = type_from_params
@item_trades = @item.closet_hangers.trading.includes(:user, :list).
user_is_active.order('users.last_trade_activity_at DESC').to_trades
@trades = @item_trades[@type]
render layout: 'items'
end
def type_from_params
case params[:type]
when 'offering'
:offering
when 'seeking'
:seeking
else
raise ArgumentError, "unexpected trades type: #{params[:type].inspect}"
end
end
end