ruby on rails - How to debug a Rails3 model that won't update or create? -


help, i've broken rails3 user model!

i first noticed not update users app itself.

it appears can't rails console.

user.save returns false.

user.create produces record id=nil, not saved database.

i've spent 2 days trying work out problem is. i've taken out cancan , devise validations. i've been through code line line. stumped!

nothing in logs pointing me in obvious direction.

i commented out of user.rb, no joy.

i know vague question, that's impossible answer far.

what i'm hoping can suggest logical steps working through , trying figure out what's happening.

i'm still new rails, , keen learn how works.

thanks ideas!

update:

i've been digging past week. started new rails app scratch , systematically moved old app new app piece piece try , work out problem lies.

i've tracked down custom devise routes.

routes.rb

devise_for :users,  :path_prefix => 'registration', :controllers => {:registrations => 'users/registrations'} 

if remove :controllers line, can update users name using devise user edit form.

however not workable solution. devise edit form provides name , email fields, there several other columns in user model user needs access . hence custom routing.

so i've tracked issue far, i'm not sure yet. tried editing registrations_controller default values, no luck. (i cut pasted code directly devise git repository).

def edit   super end  def update   super    end 

so don't think problem controller.

which leaves form itself. form defined

<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :multipart => true }) |f| %> 

i can't see issue this. , can't think else debug this.

to recap, edit form displays expected, user can edit information, click update, redirected expected, no errors displayed, edited info not saved. tail shows no sql save being called.

very stumped, , i'd appreciate wild ideas or suggestions!

many

try debug in console:

require 'pp' u = user.new u.save pp u.errors 

this should give errors prevent user being saved db.


Comments