0
我已經呈現在同一個控制器的另一個控制器動作以下控制器代碼:Rails的4.1:不會被調用控制器動作
def create
@school_application = SchoolApplication.new(school_application_params)
@school_application.program_cost = @school_application.calculate_cost_to_charge(params[:school_application][:program], params[:school_application][:duration])
if @school_application.save
Rails.logger.debug("Hey mufugga")
render action: 'view'
else
flash.now[:error] = "There was a problem with your application"
render action: "new"
end
end
時render action: 'view'
被稱爲相應的視圖,view.html.haml
叫,但我Rails.logger.debug
線做不打印在我的服務器日誌中,並且所有其他變量都未在我的視圖中設置(使用變量)。任何人都可以告訴發生了什麼?這是視圖控制器方法。
def view
Rails.logger.debug("Hello")
@school_application =SchoolApplication.find(params[:id])
Rails.logger.debug(@school_application)
@sevic = SchoolApplication.sevic(@school_application.sevic)
@cost = @school_application.program_cost.to_i + @sevic.to_i
Rails.logger.debug(@cost)
session[:cost] = @cost
end
N.B.這裏是Rails lolg到創建請求和全成和unsuccessfull logger
輸出響應:
Started POST "/application/new" for 127.0.0.1 at 2014-08-29 13:56:56 -0700
Processing by SchoolApplicationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"cl9CZCC2numQ1aCckWkXizXESByZxOFrb/pl8vhA6YQ=", "school_application"=>{"first_name"=>"d", "family_name"=>"dfg", "sevic"=>"1", "unaccompanied_minor_option"=>"1", "I_20"=>"1", "fls_center"=>"4", "start_date"=>"2014-07-30", "duration"=>"1", "housing_type"=>"22", "health_insurance"=>"1", "transfer_student"=>"1", "comments"=>"d", "gender"=>"dfg", "address"=>"d", "city_state_province"=>"d", "postal_code"=>"d", "country"=>"d", "phone_number"=>"d", "email"=>"d", "date_of_birth"=>"2014-08-05", "arrival_airport"=>"3", "read_everything"=>"1", "country_of_birth"=>"d", "country_of_citizenship"=>"d", "work_with_ad"=>"1", "pay_application_fee_or_full"=>"1", "agency"=>"d", "fax_number"=>"d", "program"=>"7"}, "commit"=>"Continue"}
Unpermitted parameters: unaccompanied_minor_option
PricePlan Load (0.3ms) SELECT "price_plans".* FROM "price_plans" WHERE "price_plans"."program_id" = 7 ORDER BY "price_plans"."id" ASC LIMIT 1000
(0.1ms) BEGIN
SQL (0.4ms) INSERT INTO "school_applications" ("I_20", "address", "agency", "arrival_airport", "city_state_province", "comments", "country", "country_of_birth", "country_of_citizenship", "created_at", "date_of_birth", "duration", "email", "family_name", "fax_number", "first_name", "fls_center", "gender", "health_insurance", "housing_type", "pay_application_fee_or_full", "phone_number", "postal_code", "program", "program_cost", " read_everything", "sevic", "start_date", "transfer_student", "updated_at", "work_with_ad") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31) RETURNING "id" [["I_20", "t"], ["address", "d"], ["agency", "d"], ["arrival_airport", "3"], ["city_state_province", "d"], ["comments", "d"], ["country", "d"], ["country_of_birth", "d"], ["country_of_citizenship", "d"], ["created_at", "2014-08-29 20:56:56.726865"], ["date_of_birth", "2014-08-05"], ["duration", 1], ["email", "d"], ["family_name", "dfg"], ["fax_number", "d"], ["first_name", "d"], ["fls_center", "4"], ["gender", "dfg"], ["health_insurance", "t"], ["housing_type", "22"], ["pay_application_fee_or_full", "t"], ["phone_number", "d"], ["postal_code", "d"], ["program", "7"], ["program_cost", "475.00"], ["read_everything", "t"], ["sevic", "t"], ["start_date", "2014-07-30"], ["transfer_student", "t"], ["updated_at", "2014-08-29 20:56:56.726865"], ["work_with_ad", "t"]]
(0.8ms) COMMIT
Hey mufugga
Rendered application/view.html.haml within layouts/application (0.3ms)
Rendered shared/_top_nav.html.haml (0.1ms)
Rendered shared/_footer.html.haml (0.4ms)
Completed 200 OK in 40ms (Views: 15.8ms | ActiveRecord: 5.1ms)