Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # I think this might be a better abstraction
- class ThingController < ApplicationController
- def create
- seller = Seller.new(current_user)
- @thing = seller.list_thing(params[:thing])
- if @thing.valid?
- redirect_to(user_thing_path(@thing.seller, @thing))
- else
- render :new
- end
- end
- end
- class Seller
- initialize(user)
- @user = user
- end
- def list_thing(thing_attrs)
- @user.things.create(thing_attrs)
- end
- end
Add Comment
Please, Sign In to add comment