Re: [Rails] Re: RSpec: controller POST create
What he wants to say is that you should log or print the error-array of your model and look what exactly doesn't fit into your validations.
Am 12.11.2012 11:13 schrieb "Soichi Ishida" <lists@ruby-forum.com>:
-- > On your controller, use `create!` to see what is preventing the save.
Sorry, I don't quite understand what you mean.
my plans_controller.rb has
def create
@plan = Plan.new(params[:plan])
respond_to do |format|
if @plan.save
format.html { redirect_to @plan, notice: 'Plan was successfully
created.' }
format.json { render json: @plan, status: :created, location:
@plan }
else
format.html { render action: "new" }
format.json { render json: @plan.errors, status:
:unprocessable_entity }
end
end
end
which scaffold generated by default.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home