33 am, David Chelimsky wrote:
> On Jun 9, 2011, at 12:33 PM, Karl wrote:
>
> > Obviously, I'm missing something very simple, can someone please
> > explain how to stub an instance of an AR model method.
>
> > This does not work:
> > @widget = Widget.f
Obviously, I'm missing something very simple, can someone please
explain how to stub an instance of an AR model method.
This does not work:
@widget = Widget.first # Widget has an instance method called
'next_seriel_number'
@widget.stub(:next_serial_number).and_return(43, nil)
I know I could use '
In MoneyOrdersController controller:
def create
@money_order = current_user.money_orders.build(params[:money_order])
if @money_order.save
flash.now[:msg_ok] = "Added money order for:
#{number_to_currency(@money_order.amount)}"
end
respond_with(@money_order)
end
In MoneyOrdersControlle
# controller
def create
@money_order = current_user.money_orders.build(params[:money_order])
if @money_order.save
@money_orders = current_user.money_orders.staged
flash.now[:msg_ok] = "Added money order for:
#{number_to_currency(@money_order.amount)}"
end
respond_with(@money_order)