在我的应用程序表单中包含消息草稿,发送消息,在将我的rails应用程序3.2.13升级到4.2.1之后,计划消息功能无法正常工作
如果我从我的表单中制作草稿消息,它将在我的服务器中显示此代码:
Processing by HomeController#share_message as */*
Parameters: {"utf8"=>"✓", "given"=>"draft", "cap"=>["8241044"], "@image"=>{"title"=>"Testing", "desc"=>"hi tester..", "avatar"=>""}, "commit"=>"Shorten url", "date"=>"", "hour"=>"04", "minute"=>"00", "meridian"=>"PM", "time"=>"04:00 PM"}
Can't verify CSRF token authenticity
ServicesTwitter Load (0.2ms) SELECT `services_twitters`.* FROM `services_twitters` WHERE `services_twitters`.`uid` = '8241044' AND `services_twitters`.`provider` = 'twitter' ORDER BY `services_twitters`.`id` ASC LIMIT 1
CompanyPage Load (0.3ms) SELECT `company_pages`.* FROM `company_pages` WHERE `company_pages`.`fb_company_id` = '8241044' AND `company_pages`.`provider` = 'facebook' ORDER BY `company_pages`.`id` ASC LIMIT 1
CompanyPage Load (0.3ms) SELECT `company_pages`.* FROM `company_pages` WHERE `company_pages`.`fb_company_id` = '8241044' AND `company_pages`.`provider` = 'linkedin' ORDER BY `company_pages`.`id` ASC LIMIT 1
(0.2ms) BEGIN
SQL (0.4ms) INSERT INTO `service_schedules` (`service_id`, `provider`, `token`, `secret`, `uid`, `desc`, `fb_company_id`, `if_draft`, `title`, `is_group`, `created_at`, `updated_at`) VALUES (11, 'linkedin', '4eb93d8f-40f6-4d1e-af66-58b2fefae283', '7528bd42-5cf1-4afc-9adf-33cd29d54167', '8241044', 'hi tester..', '8241044', 1, 'Testing', 1, '2015-06-12 10:33:30', '2015-06-12 10:33:30')
(94.9ms) COMMIT
如果我签入草稿选项,我将无法获取已保存的草稿数据。但服务器代码将正常运行:
Started GET "/share/drafts?clientID=1&userID=1&type=admin" for 127.0.0.1 at 2015-06-12 16:09:03 +0530
Processing by HomeController#list_of_drafts as */*
Parameters: {"clientID"=>"1", "userID"=>"1", "type"=>"admin"}
ServiceSchedule Load (0.8ms) SELECT `service_schedules`.* FROM `service_schedules` WHERE `service_schedules`.`client_id` = 1 AND `service_schedules`.`if_draft` = 1 ORDER BY created_at DESC LIMIT 10 OFFSET 0
Rendered home/_list_of_drafts.html.erb (3.0ms)
Rendered home/list_of_drafts.js.erb (8.9ms)
Completed 200 OK in 23ms (Views: 17.6ms | ActiveRecord: 0.8ms)
Started GET "/share/drafts?clientID=1&lead=1&post=1&type=admin&userID=1" for 127.0.0.1 at 2015-06-12 16:09:03 +0530
Processing by HomeController#list_of_drafts as JS
Parameters: {"clientID"=>"1", "lead"=>"1", "post"=>"1", "type"=>"admin", "userID"=>"1"}
ServiceSchedule Load (0.5ms) SELECT `service_schedules`.* FROM `service_schedules` WHERE `service_schedules`.`client_id` = 1 AND `service_schedules`.`if_draft` = 1 ORDER BY created_at DESC LIMIT 10 OFFSET 0
Rendered home/_list_of_drafts.html.erb (3.2ms)
Rendered home/list_of_drafts.js.erb (10.3ms)
Completed 200 OK in 22ms (Views: 19.5ms | ActiveRecord: 0.5ms)
我认为我的代码工作正常,但为什么我没有得到我的草稿数据?升级后我才遇到这个问题。
这是我的草案路由器match "share/drafts" =>"home#list_of_drafts", :as =>:draft, :via => [:get,:post]
我的发送邮件中的同样问题,安排邮件选项。你能帮我吗?谢谢
15/06/2015(today)
大家好,我还有一些关于草稿消息功能的问题。现在我可以查看草稿消息但我无法编辑草稿消息它只显示空白页面并保存草稿时间也显示错误的时间。你能告诉我任何建议吗?
答案 0 :(得分:1)
我刚刚添加了protect_from_forgery
方法
skip_before_action :verify_authenticity_token
我引用了这个链接JSFiddle .html#method-i-form_authenticity_token
谢谢你们