In my app Form contain message draft, send message, Schedule message functions are not working properly after upgraded my rails app 3.2.13 to 4.2.1
If I make a draft message from my form it will be showing this code in my server:
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
If I check in my Draft option I won't get my saved drafted data.But server code will be working fine:
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)
I think my code are working fine but why I didn't get my draft data? After upgrade only I get this problem.
This my draft router match "share/drafts" =>"home#list_of_drafts", :as =>:draft, :via => [:get,:post]
That same problem in my send message, schedule message options. Can you help me please? Thank you
15/06/2015(today)
Hi all, again I have some issue for Draft message function.Now I can view draft message But I can't edit draft message it just displaying empty page and saved Draft time also Displaying wrong time. Can you tell me any suggestions please??
I just added
protect_from_forgery
method toskip_before_action :verify_authenticity_token
I referred this link http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html#method-i-form_authenticity_tokenThank you guys