새 사용자를 등록하려고 할 때이 오류가 발생합니다. 당신이 주석 이후 말을 자사의 하드,보기 코드를 보지 않고정의되지 않은 메소드 'save'for nil : NilClass
class UsersController < ApplicationController
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => [:show, :edit, :update]
#filter_resource_access
def index
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end
def show
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end
def new
#@user = User.new
@carriers = Carrier.find(:all)
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
end
end
def edit
end
def create
@user = User.new(params[:user])
if @user.save
flash[:notice] = "Account registered!"
redirect_back_or_default account_url
else
render :action => :new
end
end
def profile
@user = User.find(params[:id])
end
def update
respond_to do |format|
if @user.update_attributes(params[:user])
format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end
def destroy
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to(users_url) }
format.xml { head :ok }
end
end
def delete
@user = User.find(params[:user_id])
@user.destroy
redirect_to :users
end
end
app/models/user.rb에서 User 모델 클래스를 붙여 넣을 수 있습니까? – Kunday