I have a simple
@redemption = Redemption.new(params[:redemption])
I need to pass :user_id => current_user.id into this new Redem
I have tried:
@redemption = Redemption.new(params[:redemption], :user_id => current_user.id)
this doesn’t build the Redemption with a user_id…
paramsis a Hash, so if you want additional attributes increate, just add them toparams, e.g.:Or, if you want to add multiple attributes at once, use
Hash#merge, e.g.:In this particular case, though, you could probably use a shorter syntax, e.g.: