How Do I use redirect and pass an object to the edit action? The following code does not work:
def edit
@promotion = Promotion.find_by_id(@params['promo_id'])
end
def update
promotion = Promotion.find(params[:promotion_profile][:promotion_id])
promo_perfil = promotion.profile
if promo_perfil.update_attributes(params[:promotion_profile])
redirect_to admin_edit_path(promotion.id => @params[:promo_id])
else
end
The edit action is looking for
params['promo_id'](why@params['promo_id']?).So pass
:promo_idthis way: