Hi Soichi, You can temporarily do `if @plan.save!` to raise an error instead of just having it return false and not give you any feedback. Doing this is okay because you should not bother testing your validations as far as the controller is concerned (you do that on your model). In any case, try to validate your factory first (if you plan to use `FactoryGirl.attributes_for`) to prevent problems such as this.
On Mon, Nov 12, 2012 at 6:48 PM, Norbert Melzer <[email protected]> wrote: > 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" <[email protected]>: > > > 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

