:fname,:lname,:email,:mob,:gender_male,:gender_female,:country,:state,:郊區,:郵政,:add無法保存在數據庫....請幫忙驗證過如何驗證可以在軌道上使用邪惡的寶石
這是我的用戶控制器
def new
@user = User.new
end
def create
@user = User.new(params[:id])
if @user.save
session[:user_id]= @user.id
redirect_to user_steps_path
else
render :new
end
end
private
def user_params
params.require(:user).permit(:fname, :lname, :email, :mob, :gender_male, :gender_female, :country, :state, :suburb, :postal ,:add, :cmpyname, :abnacn, :cmpyadd, :cmpydet,:cash, :paypal,:bsb,:usrname, :password, :password_confirmation, :selcat, :protit, :prodes)
end
這是我user_steps控制器
include Wicked::Wizard
steps :business, :login, :payment
def show
@user = current_user
render_wizard
end
def update
@user = current_user
if @user.update_attributes(user_params)
render_wizard @user
end
end
private
def user_params
params.require(:user).permit(:fname, :lname, :email, :mob, :gender_male, :gender_female, :country, :state, :suburb, :postal ,:add, :cmpyname, :abnacn, :cmpyadd, :cmpydet,:cash, :paypal,:bsb,:usrname, :password, :password_confirmation, :selcat, :protit, :prodes)
end
我遷移表
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :fname
t.string :lname
t.string :email
t.string :mob
t.string :gender_male
t.string :gender_female
t.string :country
t.string :state
t.string :suburb
t.string :postal
t.string :add
t.string :cmpyname
t.string :abnacn
t.string :cmpyadd
t.string :cmpydet
t.string :cash
t.string :paypal
t.string :bsb
t.string :usrname
t.string :password_hash
t.string :password_salt
t.string :selcat
t.string :protit
t.string :prodes
t.timestamps
end
end
end
邪惡的寶石已經由Ryan貝茨 http://railscasts.com/episodes/346這裏解釋-wizard-形式與 - 邪惡?鑑於= asciicast –
請不要投我失望,這是我的第一個問題,並給出一些建議 –
但他已經用ATTR未在軌道4,5 –