I've been running into an issue with ActiveStorage attachments where making multiple requests for attachments never resolve.
This seems to occur when the server is newly restarted and is replicable until a single attachment is requested, after which all subsequent requests are fine. This only seems to be an issue using the local disk storage. I am returning URLs to the client with rails_blob_url.
Here is a group of requests happening when the client app opens. The server will hang at this point and I am forced to kill the process.
ActiveStorage::Attachment Load (1.5ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_type" = $1 AND "active_storage_attachments"."record_id" IN ($2, $3, $4, $5, $6) AND "active_storage_attachments"."name" = $7 [["record_type", "PlantClassification"], [nil, "efae55e9-09da-4ab8-875a-714e4ae65c69"], [nil, "bd5bb0bc-f15b-46a3-90db-ff56dc10288a"], [nil, "70e5ae23-0cbf-4d4f-a7bf-11c0cae76b23"], [nil, "37c8f87b-19ef-4617-b27b-467760015df6"], [nil, "bedc432c-9b84-4066-ac36-9b1d35f18515"], ["name", "illustration"]]
↳ app/graphql/loaders/active_storage_loader.rb:19:in `perform'
ActiveStorage::Blob Load (1.0ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" IN ($1, $2, $3, $4) [[nil, "ce43a46b-3b91-407a-8d58-bc977d8f14e9"], [nil, "32ab0730-6fdd-4f13-b07f-d1bf9a510baf"], [nil, "f3d02026-ea9a-4ac3-b055-644f40e212c5"], [nil, "c1edc152-0c44-4256-9aff-753052028c24"]]
↳ app/graphql/loaders/active_storage_loader.rb:19:in `perform'
Completed 200 OK in 249ms (Views: 0.6ms | ActiveRecord: 42.1ms | Allocations: 71673)
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqWlRRellUUTJZaTB6WWpreExUUXdOMkV0T0dRMU9DMWlZemszTjJRNFpqRTBaVGtHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--f8d183c94d1d3851a5b4dbc92e3e44ea47c66d2d/Thaumatophyllum%20bipinnatifidum.png" for localhost at 2022-08-23 10:03:36 -0400
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqTVdWa1l6RTFNaTB3WXpRMExUUXlOVFl0T1dGbVppMDNOVE13TlRJd01qaGpNalFHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--6956b9a336f7ebd930d519a5458007096bdba559/Dioscorea%20elephantipes.png" for localhost at 2022-08-23 10:03:36 -0400
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWt6TW1GaU1EY3pNQzAyWm1Sa0xUUm1NVE10WWpBM1ppMWtNV0ptT1dFMU1UQmlZV1lHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--e46cc15d446e6c99255b6a571ece8d7d257671fa/Hevea%20brasiliensis.png" for localhost at 2022-08-23 10:03:36 -0400
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxtTTJRd01qQXlOaTFsWVRsaExUUmhZek10WWpBMU5TMDJORFJtTkRCbE1qRXlZelVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--1bafcabb5204a30aeceb13e71981eb57e3212724/Spathiphyllum%20cochlearispathum.png" for localhost at 2022-08-23 10:03:36 -0400
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxtTTJRd01qQXlOaTFsWVRsaExUUmhZek10WWpBMU5TMDJORFJtTkRCbE1qRXlZelVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--1bafcabb5204a30aeceb13e71981eb57e3212724", "filename"=>"Spathiphyllum cochlearispathum"}
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWt6TW1GaU1EY3pNQzAyWm1Sa0xUUm1NVE10WWpBM1ppMWtNV0ptT1dFMU1UQmlZV1lHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--e46cc15d446e6c99255b6a571ece8d7d257671fa", "filename"=>"Hevea brasiliensis"}
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqWlRRellUUTJZaTB6WWpreExUUXdOMkV0T0dRMU9DMWlZemszTjJRNFpqRTBaVGtHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--f8d183c94d1d3851a5b4dbc92e3e44ea47c66d2d", "filename"=>"Thaumatophyllum bipinnatifidum"}
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqTVdWa1l6RTFNaTB3WXpRMExUUXlOVFl0T1dGbVppMDNOVE13TlRJd01qaGpNalFHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--6956b9a336f7ebd930d519a5458007096bdba559", "filename"=>"Dioscorea elephantipes"}
After restarting the server, I can either grab a URL from the console or act as a user with only one attachment and see the request resolve.
ActiveStorage::Attachment Load (0.7ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_type" = $1 AND "active_storage_attachments"."record_id" = $2 AND "active_storage_attachments"."name" = $3 [["record_type", "PlantClassification"], ["record_id", "bfcb78c3-8195-4c5c-a133-5d1576406bf3"], ["name", "illustration"]]
↳ app/graphql/loaders/active_storage_loader.rb:19:in `perform'
ActiveStorage::Blob Load (0.4ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 [["id", "1ffd9d73-252d-443c-9e3b-3327d36e7945"]]
↳ app/graphql/loaders/active_storage_loader.rb:19:in `perform'
Completed 200 OK in 139ms (Views: 0.2ms | ActiveRecord: 25.5ms | Allocations: 60451)
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWt4Wm1aa09XUTNNeTB5TlRKa0xUUTBNMk10T1dVellpMHpNekkzWkRNMlpUYzVORFVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--defe6fea4a9c4ede750f7ad4ecbd49c7c4e4ccc8/Sansevieria%20trifasciata.png" for localhost at 2022-08-23 10:05:24 -0400
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWt4Wm1aa09XUTNNeTB5TlRKa0xUUTBNMk10T1dVellpMHpNekkzWkRNMlpUYzVORFVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--defe6fea4a9c4ede750f7ad4ecbd49c7c4e4ccc8", "filename"=>"Sansevieria trifasciata"}
ActiveStorage::Blob Load (0.4ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", "1ffd9d73-252d-443c-9e3b-3327d36e7945"], ["LIMIT", 1]]
Disk Storage (599.0ms) Generated URL for file at key: hca1bx77xw2k3u5fbn7scuhk0gsn (http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhR05oTVdKNE56ZDRkekpyTTNVMVptSnVOM05qZFdock1HZHpiZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWTJsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOaGJuTmxkbWxsY21saElIUnlhV1poYzJOcFlYUmhMbkJ1WnlJN0lHWnBiR1Z1WVcxbEtqMVZWRVl0T0NjblUyRnVjMlYyYVdWeWFXRWxNakIwY21sbVlYTmphV0YwWVM1d2JtY0dPd1pVT2hGamIyNTBaVzUwWDNSNWNHVkpJZzVwYldGblpTOXdibWNHT3daVU9oRnpaWEoyYVdObFgyNWhiV1U2Q20xbFpHbGgiLCJleHAiOiIyMDIyLTA4LTIzVDE0OjEwOjI1LjMwM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--181e38b4367576b0639af1b202beaa64696a0870/Sansevieria%20trifasciata.png)
Redirected to http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhR05oTVdKNE56ZDRkekpyTTNVMVptSnVOM05qZFdock1HZHpiZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWTJsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOaGJuTmxkbWxsY21saElIUnlhV1poYzJOcFlYUmhMbkJ1WnlJN0lHWnBiR1Z1WVcxbEtqMVZWRVl0T0NjblUyRnVjMlYyYVdWeWFXRWxNakIwY21sbVlYTmphV0YwWVM1d2JtY0dPd1pVT2hGamIyNTBaVzUwWDNSNWNHVkpJZzVwYldGblpTOXdibWNHT3daVU9oRnpaWEoyYVdObFgyNWhiV1U2Q20xbFpHbGgiLCJleHAiOiIyMDIyLTA4LTIzVDE0OjEwOjI1LjMwM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--181e38b4367576b0639af1b202beaa64696a0870/Sansevieria%20trifasciata.png
Completed 302 Found in 606ms (ActiveRecord: 0.4ms | Allocations: 394334)
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhR05oTVdKNE56ZDRkekpyTTNVMVptSnVOM05qZFdock1HZHpiZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWTJsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOaGJuTmxkbWxsY21saElIUnlhV1poYzJOcFlYUmhMbkJ1WnlJN0lHWnBiR1Z1WVcxbEtqMVZWRVl0T0NjblUyRnVjMlYyYVdWeWFXRWxNakIwY21sbVlYTmphV0YwWVM1d2JtY0dPd1pVT2hGamIyNTBaVzUwWDNSNWNHVkpJZzVwYldGblpTOXdibWNHT3daVU9oRnpaWEoyYVdObFgyNWhiV1U2Q20xbFpHbGgiLCJleHAiOiIyMDIyLTA4LTIzVDE0OjEwOjI1LjMwM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--181e38b4367576b0639af1b202beaa64696a0870/Sansevieria%20trifasciata.png" for localhost at 2022-08-23 10:05:25 -0400
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhR05oTVdKNE56ZDRkekpyTTNVMVptSnVOM05qZFdock1HZHpiZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWTJsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOaGJuTmxkbWxsY21saElIUnlhV1poYzJOcFlYUmhMbkJ1WnlJN0lHWnBiR1Z1WVcxbEtqMVZWRVl0T0NjblUyRnVjMlYyYVdWeWFXRWxNakIwY21sbVlYTmphV0YwWVM1d2JtY0dPd1pVT2hGamIyNTBaVzUwWDNSNWNHVkpJZzVwYldGblpTOXdibWNHT3daVU9oRnpaWEoyYVdObFgyNWhiV1U2Q20xbFpHbGgiLCJleHAiOiIyMDIyLTA4LTIzVDE0OjEwOjI1LjMwM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--181e38b4367576b0639af1b202beaa64696a0870", "filename"=>"Sansevieria trifasciata"}
Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 216)
Now I can make the same group of requests as the first log, but see successful redirects for each request.
ActiveStorage::Attachment Load (0.6ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_type" = $1 AND "active_storage_attachments"."record_id" IN ($2, $3, $4, $5, $6) AND "active_storage_attachments"."name" = $7 [["record_type", "PlantClassification"], [nil, "efae55e9-09da-4ab8-875a-714e4ae65c69"], [nil, "bd5bb0bc-f15b-46a3-90db-ff56dc10288a"], [nil, "70e5ae23-0cbf-4d4f-a7bf-11c0cae76b23"], [nil, "37c8f87b-19ef-4617-b27b-467760015df6"], [nil, "bedc432c-9b84-4066-ac36-9b1d35f18515"], ["name", "illustration"]]
↳ app/graphql/loaders/active_storage_loader.rb:19:in `perform'
ActiveStorage::Blob Load (0.5ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" IN ($1, $2, $3, $4) [[nil, "ce43a46b-3b91-407a-8d58-bc977d8f14e9"], [nil, "32ab0730-6fdd-4f13-b07f-d1bf9a510baf"], [nil, "f3d02026-ea9a-4ac3-b055-644f40e212c5"], [nil, "c1edc152-0c44-4256-9aff-753052028c24"]]
↳ app/graphql/loaders/active_storage_loader.rb:19:in `perform'
Completed 200 OK in 102ms (Views: 0.7ms | ActiveRecord: 8.7ms | Allocations: 24607)
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxtTTJRd01qQXlOaTFsWVRsaExUUmhZek10WWpBMU5TMDJORFJtTkRCbE1qRXlZelVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--1bafcabb5204a30aeceb13e71981eb57e3212724/Spathiphyllum%20cochlearispathum.png" for localhost at 2022-08-23 10:06:00 -0400
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqTVdWa1l6RTFNaTB3WXpRMExUUXlOVFl0T1dGbVppMDNOVE13TlRJd01qaGpNalFHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--6956b9a336f7ebd930d519a5458007096bdba559/Dioscorea%20elephantipes.png" for localhost at 2022-08-23 10:06:00 -0400
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWt6TW1GaU1EY3pNQzAyWm1Sa0xUUm1NVE10WWpBM1ppMWtNV0ptT1dFMU1UQmlZV1lHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--e46cc15d446e6c99255b6a571ece8d7d257671fa/Hevea%20brasiliensis.png" for localhost at 2022-08-23 10:06:00 -0400
Started GET "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqWlRRellUUTJZaTB6WWpreExUUXdOMkV0T0dRMU9DMWlZemszTjJRNFpqRTBaVGtHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--f8d183c94d1d3851a5b4dbc92e3e44ea47c66d2d/Thaumatophyllum%20bipinnatifidum.png" for localhost at 2022-08-23 10:06:00 -0400
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxtTTJRd01qQXlOaTFsWVRsaExUUmhZek10WWpBMU5TMDJORFJtTkRCbE1qRXlZelVHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--1bafcabb5204a30aeceb13e71981eb57e3212724", "filename"=>"Spathiphyllum cochlearispathum"}
ActiveStorage::Blob Load (0.8ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", "f3d02026-ea9a-4ac3-b055-644f40e212c5"], ["LIMIT", 1]]
Disk Storage (0.6ms) Generated URL for file at key: kctramb83yjmxe73y6y4th2snwo9 (http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhMk4wY21GdFlqZ3plV3B0ZUdVM00zazJlVFIwYURKemJuZHZPUVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOd1lYUm9hWEJvZVd4c2RXMGdZMjlqYUd4bFlYSnBjM0JoZEdoMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFOd1lYUm9hWEJvZVd4c2RXMGxNakJqYjJOb2JHVmhjbWx6Y0dGMGFIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNTg5WiIsInB1ciI6ImJsb2Jfa2V5In19--6f956c4338844d0b05141a50b9fcd54ab365bd8a/Spathiphyllum%20cochlearispathum.png)
Redirected to http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhMk4wY21GdFlqZ3plV3B0ZUdVM00zazJlVFIwYURKemJuZHZPUVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOd1lYUm9hWEJvZVd4c2RXMGdZMjlqYUd4bFlYSnBjM0JoZEdoMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFOd1lYUm9hWEJvZVd4c2RXMGxNakJqYjJOb2JHVmhjbWx6Y0dGMGFIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNTg5WiIsInB1ciI6ImJsb2Jfa2V5In19--6f956c4338844d0b05141a50b9fcd54ab365bd8a/Spathiphyllum%20cochlearispathum.png
Completed 302 Found in 6ms (ActiveRecord: 0.8ms | Allocations: 1358)
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhMk4wY21GdFlqZ3plV3B0ZUdVM00zazJlVFIwYURKemJuZHZPUVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOd1lYUm9hWEJvZVd4c2RXMGdZMjlqYUd4bFlYSnBjM0JoZEdoMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFOd1lYUm9hWEJvZVd4c2RXMGxNakJqYjJOb2JHVmhjbWx6Y0dGMGFIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNTg5WiIsInB1ciI6ImJsb2Jfa2V5In19--6f956c4338844d0b05141a50b9fcd54ab365bd8a/Spathiphyllum%20cochlearispathum.png" for localhost at 2022-08-23 10:06:00 -0400
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqTVdWa1l6RTFNaTB3WXpRMExUUXlOVFl0T1dGbVppMDNOVE13TlRJd01qaGpNalFHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--6956b9a336f7ebd930d519a5458007096bdba559", "filename"=>"Dioscorea elephantipes"}
ActiveStorage::Blob Load (0.8ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", "c1edc152-0c44-4256-9aff-753052028c24"], ["LIMIT", 1]]
Disk Storage (0.6ms) Generated URL for file at key: weqbvcjhz76cwpausnzeo02rcae7 (http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhkMlZ4WW5aamFtaDZOelpqZDNCaGRYTnVlbVZ2TURKeVkyRmxOd1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWVdsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtScGIzTmpiM0psWVNCbGJHVndhR0Z1ZEdsd1pYTXVjRzVuSWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkRWFXOXpZMjl5WldFbE1qQmxiR1Z3YUdGdWRHbHdaWE11Y0c1bkJqc0dWRG9SWTI5dWRHVnVkRjkwZVhCbFNTSU9hVzFoWjJVdmNHNW5CanNHVkRvUmMyVnlkbWxqWlY5dVlXMWxPZ3B0WldScFlRPT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYyM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--84b254beeaa2411e5704dd83407a07c8d8dc2797/Dioscorea%20elephantipes.png)
Redirected to http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhkMlZ4WW5aamFtaDZOelpqZDNCaGRYTnVlbVZ2TURKeVkyRmxOd1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWVdsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtScGIzTmpiM0psWVNCbGJHVndhR0Z1ZEdsd1pYTXVjRzVuSWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkRWFXOXpZMjl5WldFbE1qQmxiR1Z3YUdGdWRHbHdaWE11Y0c1bkJqc0dWRG9SWTI5dWRHVnVkRjkwZVhCbFNTSU9hVzFoWjJVdmNHNW5CanNHVkRvUmMyVnlkbWxqWlY5dVlXMWxPZ3B0WldScFlRPT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYyM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--84b254beeaa2411e5704dd83407a07c8d8dc2797/Dioscorea%20elephantipes.png
Completed 302 Found in 6ms (ActiveRecord: 0.8ms | Allocations: 1439)
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWt6TW1GaU1EY3pNQzAyWm1Sa0xUUm1NVE10WWpBM1ppMWtNV0ptT1dFMU1UQmlZV1lHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--e46cc15d446e6c99255b6a571ece8d7d257671fa", "filename"=>"Hevea brasiliensis"}
ActiveStorage::Blob Load (0.5ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", "32ab0730-6fdd-4f13-b07f-d1bf9a510baf"], ["LIMIT", 1]]
Disk Storage (0.7ms) Generated URL for file at key: frmxxn5e9opkrct18suxv1utz5vl (http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhabkp0ZUhodU5XVTViM0JyY21OME1UaHpkWGgyTVhWMGVqVjJiQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpV1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtobGRtVmhJR0p5WVhOcGJHbGxibk5wY3k1d2JtY2lPeUJtYVd4bGJtRnRaU285VlZSR0xUZ25KMGhsZG1WaEpUSXdZbkpoYzJsc2FXVnVjMmx6TG5CdVp3WTdCbFE2RVdOdmJuUmxiblJmZEhsd1pVa2lEbWx0WVdkbEwzQnVad1k3QmxRNkVYTmxjblpwWTJWZmJtRnRaVG9LYldWa2FXRT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYzOVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--1987211a5046bb567ad47cf466a0b4887380b1c8/Hevea%20brasiliensis.png)
Redirected to http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhabkp0ZUhodU5XVTViM0JyY21OME1UaHpkWGgyTVhWMGVqVjJiQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpV1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtobGRtVmhJR0p5WVhOcGJHbGxibk5wY3k1d2JtY2lPeUJtYVd4bGJtRnRaU285VlZSR0xUZ25KMGhsZG1WaEpUSXdZbkpoYzJsc2FXVnVjMmx6TG5CdVp3WTdCbFE2RVdOdmJuUmxiblJmZEhsd1pVa2lEbWx0WVdkbEwzQnVad1k3QmxRNkVYTmxjblpwWTJWZmJtRnRaVG9LYldWa2FXRT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYzOVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--1987211a5046bb567ad47cf466a0b4887380b1c8/Hevea%20brasiliensis.png
Completed 302 Found in 5ms (ActiveRecord: 0.5ms | Allocations: 1383)
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhkMlZ4WW5aamFtaDZOelpqZDNCaGRYTnVlbVZ2TURKeVkyRmxOd1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWVdsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtScGIzTmpiM0psWVNCbGJHVndhR0Z1ZEdsd1pYTXVjRzVuSWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkRWFXOXpZMjl5WldFbE1qQmxiR1Z3YUdGdWRHbHdaWE11Y0c1bkJqc0dWRG9SWTI5dWRHVnVkRjkwZVhCbFNTSU9hVzFoWjJVdmNHNW5CanNHVkRvUmMyVnlkbWxqWlY5dVlXMWxPZ3B0WldScFlRPT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYyM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--84b254beeaa2411e5704dd83407a07c8d8dc2797/Dioscorea%20elephantipes.png" for localhost at 2022-08-23 10:06:00 -0400
Processing by ActiveStorage::Blobs::RedirectController#show as PNG
Parameters: {"signed_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWxqWlRRellUUTJZaTB6WWpreExUUXdOMkV0T0dRMU9DMWlZemszTjJRNFpqRTBaVGtHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6ImJsb2JfaWQifX0=--f8d183c94d1d3851a5b4dbc92e3e44ea47c66d2d", "filename"=>"Thaumatophyllum bipinnatifidum"}
ActiveStorage::Blob Load (0.6ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", "ce43a46b-3b91-407a-8d58-bc977d8f14e9"], ["LIMIT", 1]]
Disk Storage (0.4ms) Generated URL for file at key: m6fa3kbkvwvpy017x1s1eun9g95v (http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhiVFptWVROclltdDJkM1p3ZVRBeE4zZ3hjekZsZFc0NVp6azFkZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxSb1lYVnRZWFJ2Y0doNWJHeDFiU0JpYVhCcGJtNWhkR2xtYVdSMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFSb1lYVnRZWFJ2Y0doNWJHeDFiU1V5TUdKcGNHbHVibUYwYVdacFpIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNjQ5WiIsInB1ciI6ImJsb2Jfa2V5In19--31ea0854ee9e5eb2b85455486c5bce6ce4a0b095/Thaumatophyllum%20bipinnatifidum.png)
Redirected to http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhiVFptWVROclltdDJkM1p3ZVRBeE4zZ3hjekZsZFc0NVp6azFkZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxSb1lYVnRZWFJ2Y0doNWJHeDFiU0JpYVhCcGJtNWhkR2xtYVdSMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFSb1lYVnRZWFJ2Y0doNWJHeDFiU1V5TUdKcGNHbHVibUYwYVdacFpIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNjQ5WiIsInB1ciI6ImJsb2Jfa2V5In19--31ea0854ee9e5eb2b85455486c5bce6ce4a0b095/Thaumatophyllum%20bipinnatifidum.png
Completed 302 Found in 4ms (ActiveRecord: 0.6ms | Allocations: 1313)
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhabkp0ZUhodU5XVTViM0JyY21OME1UaHpkWGgyTVhWMGVqVjJiQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpV1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtobGRtVmhJR0p5WVhOcGJHbGxibk5wY3k1d2JtY2lPeUJtYVd4bGJtRnRaU285VlZSR0xUZ25KMGhsZG1WaEpUSXdZbkpoYzJsc2FXVnVjMmx6TG5CdVp3WTdCbFE2RVdOdmJuUmxiblJmZEhsd1pVa2lEbWx0WVdkbEwzQnVad1k3QmxRNkVYTmxjblpwWTJWZmJtRnRaVG9LYldWa2FXRT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYzOVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--1987211a5046bb567ad47cf466a0b4887380b1c8/Hevea%20brasiliensis.png" for localhost at 2022-08-23 10:06:00 -0400
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhiVFptWVROclltdDJkM1p3ZVRBeE4zZ3hjekZsZFc0NVp6azFkZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxSb1lYVnRZWFJ2Y0doNWJHeDFiU0JpYVhCcGJtNWhkR2xtYVdSMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFSb1lYVnRZWFJ2Y0doNWJHeDFiU1V5TUdKcGNHbHVibUYwYVdacFpIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNjQ5WiIsInB1ciI6ImJsb2Jfa2V5In19--31ea0854ee9e5eb2b85455486c5bce6ce4a0b095/Thaumatophyllum%20bipinnatifidum.png" for localhost at 2022-08-23 10:06:00 -0400
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhhMk4wY21GdFlqZ3plV3B0ZUdVM00zazJlVFIwYURKemJuZHZPUVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxOd1lYUm9hWEJvZVd4c2RXMGdZMjlqYUd4bFlYSnBjM0JoZEdoMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFOd1lYUm9hWEJvZVd4c2RXMGxNakJqYjJOb2JHVmhjbWx6Y0dGMGFIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNTg5WiIsInB1ciI6ImJsb2Jfa2V5In19--6f956c4338844d0b05141a50b9fcd54ab365bd8a", "filename"=>"Spathiphyllum cochlearispathum"}
Completed 200 OK in 2ms (ActiveRecord: 0.0ms | Allocations: 192)
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhkMlZ4WW5aamFtaDZOelpqZDNCaGRYTnVlbVZ2TURKeVkyRmxOd1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpWVdsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtScGIzTmpiM0psWVNCbGJHVndhR0Z1ZEdsd1pYTXVjRzVuSWpzZ1ptbHNaVzVoYldVcVBWVlVSaTA0SnlkRWFXOXpZMjl5WldFbE1qQmxiR1Z3YUdGdWRHbHdaWE11Y0c1bkJqc0dWRG9SWTI5dWRHVnVkRjkwZVhCbFNTSU9hVzFoWjJVdmNHNW5CanNHVkRvUmMyVnlkbWxqWlY5dVlXMWxPZ3B0WldScFlRPT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYyM1oiLCJwdXIiOiJibG9iX2tleSJ9fQ==--84b254beeaa2411e5704dd83407a07c8d8dc2797", "filename"=>"Dioscorea elephantipes"}
Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 190)
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhiVFptWVROclltdDJkM1p3ZVRBeE4zZ3hjekZsZFc0NVp6azFkZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpY1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWxSb1lYVnRZWFJ2Y0doNWJHeDFiU0JpYVhCcGJtNWhkR2xtYVdSMWJTNXdibWNpT3lCbWFXeGxibUZ0WlNvOVZWUkdMVGduSjFSb1lYVnRZWFJ2Y0doNWJHeDFiU1V5TUdKcGNHbHVibUYwYVdacFpIVnRMbkJ1WndZN0JsUTZFV052Ym5SbGJuUmZkSGx3WlVraURtbHRZV2RsTDNCdVp3WTdCbFE2RVhObGNuWnBZMlZmYm1GdFpUb0tiV1ZrYVdFPSIsImV4cCI6IjIwMjItMDgtMjNUMTQ6MTE6MDAuNjQ5WiIsInB1ciI6ImJsb2Jfa2V5In19--31ea0854ee9e5eb2b85455486c5bce6ce4a0b095", "filename"=>"Thaumatophyllum bipinnatifidum"}
Completed 200 OK in 2ms (ActiveRecord: 0.0ms | Allocations: 182)
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhabkp0ZUhodU5XVTViM0JyY21OME1UaHpkWGgyTVhWMGVqVjJiQVk2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpV1dsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SWtobGRtVmhJR0p5WVhOcGJHbGxibk5wY3k1d2JtY2lPeUJtYVd4bGJtRnRaU285VlZSR0xUZ25KMGhsZG1WaEpUSXdZbkpoYzJsc2FXVnVjMmx6TG5CdVp3WTdCbFE2RVdOdmJuUmxiblJmZEhsd1pVa2lEbWx0WVdkbEwzQnVad1k3QmxRNkVYTmxjblpwWTJWZmJtRnRaVG9LYldWa2FXRT0iLCJleHAiOiIyMDIyLTA4LTIzVDE0OjExOjAwLjYzOVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--1987211a5046bb567ad47cf466a0b4887380b1c8", "filename"=>"Hevea brasiliensis"}
Completed 200 OK in 1ms (ActiveRecord: 0.0ms | Allocations: 182)
Related
Running
Rails 6.0.2.1
Ruby 2.6.5
I'm implementing photo upload using ActiveStorage and DropZoneJS but at this point, it throws an error on this particular page /users/2.
Better errors shows this
URI::InvalidURIError at /users/2
bad URI(is not URI?): nil
car model
def cover_photo(size_x, size_y)
if self.photos.length > 0
self.photos[0].variant(resize_to_limit: [size_x, size_y]).processed.service_url
else
"blank.jpg"
end
end
end
My log file
Started GET "/users/2" for ::1 at 2020-05-08 11:39:09 +0000
Processing by UsersController#show as HTML
Parameters: {"id"=>"2"}
[1m[36mUser Load (0.1ms)[0m [1m[34mSELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ?[0m [["id", 2], ["LIMIT", 1]]
↳ app/controllers/users_controller.rb:3:in `show'
Rendering users/show.html.erb within layouts/application
[1m[36mCar Load (0.1ms)[0m [1m[34mSELECT "cars".* FROM "cars" WHERE "cars"."user_id" = ?[0m [["user_id", 2]]
↳ app/views/users/show.html.erb:29
[1m[36mActiveStorage::Attachment Load (0.1ms)[0m [1m[34mSELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = ? AND "active_storage_attachments"."record_type" = ? AND "active_storage_attachments"."name" = ?[0m [["record_id", 1], ["record_type", "Car"], ["name", "photos"]]
↳ app/models/car.rb:14:in `cover_photo'
[1m[36mActiveStorage::Blob Load (0.1ms)[0m [1m[34mSELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = ? LIMIT ?[0m [["id", 26], ["LIMIT", 1]]
↳ app/models/car.rb:15:in `cover_photo'
[36m Disk Storage (0.0ms) [0m[34mChecked if file exists at key: variants/4u0kx27vmugn57zwn96o2t27mr71/36e628c6ec62cc8383a3ee5c0c8433e912780efead13846813a9f63693dd17eb (yes)[0m
[36m Disk Storage (0.5ms) [0m[34mGenerated URL for file at key: variants/4u0kx27vmugn57zwn96o2t27mr71/36e628c6ec62cc8383a3ee5c0c8433e912780efead13846813a9f63693dd17eb ()[0m
Rendered users/show.html.erb within layouts/application (Duration: 18.4ms | Allocations: 4342)
Completed 500 Internal Server Error in 21ms (ActiveRecord: 0.4ms | Allocations: 5357)
URI::InvalidURIError - bad URI(is not URI?): nil:
app/models/car.rb:15:in `cover_photo'
app/views/users/show.html.erb:36
app/views/users/show.html.erb:32
Started POST "/__better_errors/f90fad0cb966afba/variables" for ::1 at 2020-05-08 11:39:09 +0000
How do i fix this? And what is wrong with cover_photo?
Depending on your setup, I had fixed this issue by defining ActiveStorage::Current.host = "http://localhost:3000" right before the use of variant
https://github.com/rails/rails/issues/40855
Okay, i removed .service_url from
self.photos[0].variant(resize_to_limit: [size_x, size_y]).processed.service_url
So it became
self.photos[0].variant(resize_to_limit: [size_x, size_y]).processed
And now the error is gone and the page loads perfectly. Not sure why
Btw, can anyone explain?
I was having the same problem in the rails console, the solution was run this once:
ActiveStorage::Current.host = 'http://localhost:3000'
I got this information from #Jan's answer, and from here.
I'm trying to solve a current issue on my rails app. My rails app is using RailsAdmin and I have an issue after trying to upload files via generic RailsAdmin options.
So this app is using Ruby 2.5.3, RailsAdmin 1.4.2 and Rails 5.2.3.
It seems that I'm running in a silent error ... maybe a kind of model validation or something like that buy I even don't get any relevant output on debug mode.
The problem is that I have no certain idea how I should proceed on debugging this problem because these actions are handled within the rails-admin gem.
Even though I'm using RubyMine with the debugging feature I have no clue where to set the breakpoints because this is handled be the gem. I've tried to break on some initializers but of course that didn't had the intended effect.
So I would appreciate any hints and help which supports me debugging this problem!
Best regards,
Tunnelblick
Debug output:
Started POST "/administrator/document/new" for <src_ip> at 2019-09-03 11:47:46 +0200
Processing by RailsAdmin::MainController#new as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"<token>", "document"=>{"title"=>"Testimage", "description"=>"", "page_ids"=>["", "", "151"], "file"=>#<ActionDispatch::Http::UploadedFile:0x00007f4ebbf196e8 #tempfile=#<Tempfile:/tmp/RackMultipart20190903-3614-gbt3ad.png>, #original_filename="generic_testimage.png", #content_type="image/png", #headers="Content-Disposition: form-data; name=\"document[file]\"; filename=\"generic_testimage.png\"\r\nContent-Type: image/png\r\n">}, "remotipart_submitted"=>"true", "X-Requested-With"=>"IFrame", "X-HTTP-Accept"=>"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01", "model_name"=>"document"}
User Load (0.7ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
↳ config/initializers/rails_admin.rb:97
(0.9ms) SELECT `user_roles`.`role_id` FROM `user_roles` WHERE `user_roles`.`user_id` = 1
↳ app/models/user.rb:236
(0.5ms) SELECT `roles`.`name` FROM `roles` WHERE `roles`.`id` = 1
↳ app/models/user.rb:236
Disk Storage (4.5ms) Uploaded file to key: HsSaBijYwg3JLeR8dV7akmpF (checksum: /QSj27UArM/yWCLulQaTpA==)
(0.3ms) BEGIN
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:38
ActiveStorage::Blob Create (0.6ms) INSERT INTO `active_storage_blobs` (`key`, `filename`, `content_type`, `metadata`, `byte_size`, `checksum`, `created_at`) VALUES ('HsSaBijYwg3JLeR8dV7akmpF', 'generic_testimage.png', 'image/png', '{\"identified\":true}', 2673, '/QSj27UArM/yWCLulQaTpA==', '2019-09-03 09:47:46')
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
(3.6ms) COMMIT
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:42
(0.3ms) BEGIN
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:38
(0.4ms) COMMIT
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:42
Page Load (0.5ms) SELECT `pages`.* FROM `pages` WHERE `pages`.`id` = 151
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
(0.3ms) BEGIN
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:38
(0.2ms) ROLLBACK
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/bundler/gems/activerecord-sqlserver-adapter-1105d02d6284/lib/active_record/connection_adapters/sqlserver/transaction.rb:47
Rendering /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/new.html.haml
Rendered /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_field.html.haml (3.9ms)
Rendered /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_text.html.haml (3.6ms)
Rendered /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_file_upload.html.haml (7.8ms)
(0.5ms) SELECT COUNT(*) FROM `pages`
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
CACHE (0.0ms) SELECT COUNT(*) FROM `pages`
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
Rendered /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_form_filtering_multiselect.html.haml (15.9ms)
Rendered /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/_submit_buttons.html.haml (14.2ms)
Rendered /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/rails_admin-1.4.2/app/views/rails_admin/main/new.html.haml (70.9ms)
Completed 406 Not Acceptable in 124ms (Views: 76.5ms | ActiveRecord: 8.8ms)
<src_ip> - - [03/Sep/2019:11:47:46 CEST] "POST /administrator/document/new HTTP/1.1" 406 5828
http://<dst_ip>:3000/administrator/Page/151/edit -> /administrator/document/new
Started GET "/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066/generic_testimage.png" for <src_ip> at 2019-09-03 11:47:46 +0200
Processing by ActiveStorage::RepresentationsController#show as PNG
Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461", "variation_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066", "filename"=>"generic_testimage"}
ActiveStorage::Blob Load (2.5ms) SELECT `active_storage_blobs`.* FROM `active_storage_blobs` WHERE `active_storage_blobs`.`id` = 901 LIMIT 1
↳ /home/testvm01/.rvm/gems/ruby-2.5.3#<gemset>/gems/activerecord-5.2.3/lib/active_record/log_subscriber.rb:98
Disk Storage (0.1ms) Checked if file exists at key: variants/HsSaBijYwg3JLeR8dV7akmpF/64ff10e27609a8b1f320398d41a1f5791aeb2e108f429b203d5f3c650e0b744d (no)
Disk Storage (0.1ms) Downloaded file from key: HsSaBijYwg3JLeR8dV7akmpF
Disk Storage (0.3ms) Uploaded file to key: variants/HsSaBijYwg3JLeR8dV7akmpF/64ff10e27609a8b1f320398d41a1f5791aeb2e108f429b203d5f3c650e0b744d
Disk Storage (0.8ms) Generated URL for file at key: variants/HsSaBijYwg3JLeR8dV7akmpF/64ff10e27609a8b1f320398d41a1f5791aeb2e108f429b203d5f3c650e0b744d (http://<dst_ip>:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png)
Redirected to http://<dst_ip>:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png
Completed 302 Found in 72ms (ActiveRecord: 2.5ms)
<src_ip> - - [03/Sep/2019:11:47:46 CEST] "GET /rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066/generic_testimage.png HTTP/1.1" 302 863
http://<dst_ip>:3000/administrator/Page/151/edit -> /rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBb1VEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--01b687f90aa49f3bfd52fe06cfb950eef8711461/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lOTVRBd2VERXdNRDRHT2daRlZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--597b84b3c8f143e08ed73e02d88e0aee694d1066/generic_testimage.png
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png" for <src_ip> at 2019-09-03 11:47:46 +0200
Processing by ActiveStorage::DiskController#show as PNG
Parameters: {"content_type"=>"image/png", "disposition"=>"inline; filename=\"generic_testimage.png\"; filename*=UTF-8''generic_testimage.png", "encoded_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9", "filename"=>"generic_testimage"}
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
<src_ip> - - [03/Sep/2019:11:47:46 CEST] "GET /rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png HTTP/1.1" 200 830
http://<dst_ip>:3000/administrator/Page/151/edit -> /rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDRG9JYTJWNVNTSm5kbUZ5YVdGdWRITXZTSE5UWVVKcGFsbDNaek5LVEdWU09HUldOMkZyYlhCR0x6WTBabVl4TUdVeU56WXdPV0U0WWpGbU16SXdNems0WkRReFlURm1OVGM1TVdGbFlqSmxNVEE0WmpReU9XSXlNRE5rTldZell6WTFNR1V3WWpjME5HUUdPZ1pGVkRvUVpHbHpjRzl6YVhScGIyNUpJbFZwYm14cGJtVTdJR1pwYkdWdVlXMWxQU0puWlc1bGNtbGpYM1JsYzNScGJXRm5aUzV3Ym1jaU95Qm1hV3hsYm1GdFpTbzlWVlJHTFRnbkoyZGxibVZ5YVdOZmRHVnpkR2x0WVdkbExuQnVad1k3QmxRNkVXTnZiblJsYm5SZmRIbHdaVWtpRG1sdFlXZGxMM0J1WndZN0JsUT0iLCJleHAiOiIyMDE5LTA5LTAzVDA5OjUyOjQ2LjU4NVoiLCJwdXIiOiJibG9iX2tleSJ9fQ==--c5bcf6d4ef2e2800968e21be38b234711a8d43a9/generic_testimage.png?content_type=image%2Fpng&disposition=inline%3B+filename%3D%22generic_testimage.png%22%3B+filename%2A%3DUTF-8%27%27generic_testimage.png
RailsAdmin MainController
RailsAdmin::Config::Actions.all.each do |action|
class_eval <<-EOS, __FILE__, __LINE__ + 1
def #{action.action_name}
action = RailsAdmin::Config::Actions.find('#{action.action_name}'.to_sym)
#authorization_adapter.try(:authorize, action.authorization_key, #abstract_model, #object)
#action = action.with({controller: self, abstract_model: #abstract_model, object: #object})
fail(ActionNotAllowed) unless #action.enabled?
#page_name = wording_for(:title)
instance_eval &#action.controller
end
EOS
end
I'm currently trying to find a way to change my redirection url upon unlocking an account. Currently when an account is locked the user is getting a email to unlock is account but then the te user get redirect on a default url. Since my rails project is an api it would be nice to redirect to my front-end
Started GET "/api/auth/unlock?unlock_token=YvR4nNssxhB9h8hvDAse" for
127.0.0.1 at 2017-12-04 15:28:08 -0500
Processing by Devise::UnlocksController#show as JSON
Parameters: {"unlock_token"=>"YvR4nNssxhB9h8hvDAse"}
User Load (0.8ms) SELECT "users".* FROM "users" WHERE
"users"."unlock_token" = $1 ORDER BY "users"."id" ASC LIMIT $2
[["unlock_token",
"6f3c4d7aa5254e143f89cd7f187e22ce56b11e6abe1f5eb252e34d86ac101908"],
["LIMIT", 1]]
(0.1ms) BEGIN
SQL (0.7ms) UPDATE "users" SET "locked_at" = $1, "failed_attempts" = $2,
"unlock_token" = $3, "updated_at" = $4 WHERE "users"."id" = $5
[["locked_at", nil], ["failed_attempts", 0], ["unlock_token", nil],
["updated_at", "2017-12-04 20:28:08.783744"], ["id", 1]]
(3.4ms) COMMIT
Redirected to http://localhost:3000/api/auth/sign_in
Completed 302 Found in 17ms (ActiveRecord: 5.0ms)
Started GET "/api/auth/sign_in" for 127.0.0.1 at 2017-12-04 15:28:08
-0500
Processing by DeviseTokenAuth::SessionsController#new as JSON
[active_model_serializers] Rendered ActiveModel::Serializer::Null with
Hash (0.14ms)
Completed 405 Method Not Allowed in 2ms (Views: 0.9ms | ActiveRecord:
0.0ms)
Started GET "/api/auth/sign_in" for 127.0.0.1 at 2017-12-04 15:31:26
-0500
Processing by DeviseTokenAuth::SessionsController#new as JSON
[active_model_serializers] Rendered ActiveModel::Serializer::Null with
Hash (0.11ms)
Completed 405 Method Not Allowed in 1ms (Views: 0.7ms | ActiveRecord:
0.0ms)
To do any customization with Devise, one must override the default controllers by creating a new controller and inheriting from it in your case that would be Devise::UnlocksController
For example:
CustomUnlocksController < Devise::UnlocksController
https://github.com/plataformatec/devise/blob/master/app/controllers/devise/unlocks_controller.rb
Override after_unlock_path_for to the path which you are going to redirect after.
I'm using Capybara 2.13.0 and I've got a test that relies on an Ajax request adding dynamic content into the DOM.
test 'contact data becomes visible when providing the correct password' do
login_as_researcher
visit '/participants/3'
assert page.has_css?("ul#redacted-contact-data")
click_button('Unlock Contact Data')
# Use the correct password
fill_in('enter your password', with: 'password1')
# Ajax happens here. It renders a partial and places it in the dom.
click_button('Submit')
# Test sometimes fails here..
assert page.has_css?("ul#contact-data"), -> { page.body }
end
I've read a lot of articles that say Capybara automatically waits for elements to appear in the HTML and there's no need to manually tell Capybara to wait anymore, but I'm not experiencing this in my case.
75% of the time this test passes and when it does fail and the page is dumped, it contains the content of the partial rendered in the JS response instead of the full HTML page.
Any idea what's going on here? I can only assume it's due to how long it takes the server to respond the Ajax request each time and Capybara not waiting long enough in certain situations.
I've set Capybara.default_max_wait_time = 5 in my test_helper.
I've tried with both the selenium and poltergeist drivers and it makes no difference.
Here's the output from test.log
Started GET "/" for 127.0.0.1 at 2017-05-01 18:09:23 +0100
Processing by HomeController#index as HTML
Researcher Load (0.3ms) SELECT "researchers".* FROM "researchers" WHERE "researchers"."id" IS NULL LIMIT 1
Redirected to http://www.example.com/session/new
Filter chain halted as :researcher_only rendered or redirected
Completed 302 Found in 30ms (ActiveRecord: 0.3ms)
Started GET "/session/new" for 127.0.0.1 at 2017-05-01 18:09:23 +0100
Processing by SessionsController#new as HTML
Rendered sessions/new.html.erb within layouts/application (9.5ms)
Researcher Load (0.1ms) SELECT "researchers".* FROM "researchers" WHERE "researchers"."id" IS NULL LIMIT 1
Completed 200 OK in 248ms (Views: 247.6ms | ActiveRecord: 0.1ms)
Started POST "/session" for 127.0.0.1 at 2017-05-01 18:09:23 +0100
Processing by SessionsController#create as HTML
Parameters: {"utf8"=>"✓", "username"=>"nick1", "password"=>"[FILTERED]", "commit"=>"Enter"}
Researcher Load (0.1ms) SELECT "researchers".* FROM "researchers" WHERE "researchers"."username" = ? LIMIT 1 [["username", "nick1"]]
Redirected to http://www.example.com/
Completed 302 Found in 78ms (ActiveRecord: 0.1ms)
Started GET "/" for 127.0.0.1 at 2017-05-01 18:09:23 +0100
Processing by HomeController#index as HTML
Researcher Load (0.1ms) SELECT "researchers".* FROM "researchers" WHERE "researchers"."id" = ? LIMIT 1 [["id", 2]]
Rendered home/index.html.erb within layouts/application (0.6ms)
Completed 200 OK in 10ms (Views: 8.6ms | ActiveRecord: 0.1ms)
Started GET "/participants/3" for 127.0.0.1 at 2017-05-01 18:09:23 +0100
Processing by ParticipantsController#show as HTML
Parameters: {"id"=>"3"}
Participant Load (1.9ms) SELECT "participants".* FROM "participants" WHERE "participants"."id" = ? LIMIT 1 [["id", 3]]
Researcher Load (0.1ms) SELECT "researchers".* FROM "researchers" WHERE "researchers"."id" = ? LIMIT 1 [["id", 2]]
ContactData Load (0.2ms) SELECT "contact_data".* FROM "contact_data" WHERE "contact_data"."participant_id" = ? LIMIT 1 [["participant_id", 3]]
AlcoholService Load (0.1ms) SELECT "alcohol_services".* FROM "alcohol_services" WHERE "alcohol_services"."id" = ? LIMIT 1 [["id", 16]]
Baseline Load (0.3ms) SELECT "baselines".* FROM "baselines" WHERE "baselines"."participant_id" = ? LIMIT 1 [["participant_id", 3]]
Rendered participants/_unlock_contact_data.html.erb (1.1ms)
Rendered participants/_details.html.erb (52.8ms)
Rendered participants/show.html.erb within layouts/application (58.8ms)
Completed 200 OK in 94ms (Views: 69.9ms | ActiveRecord: 3.0ms)
Started POST "/participants/unlock_contact_data?participant_id=3" for 127.0.0.1 at 2017-05-01 18:09:24 +0100
Processing by ParticipantsController#unlock_contact_data as JS
Parameters: {"utf8"=>"✓", "from"=>"show", "password"=>"[FILTERED]", "commit"=>"Submit", "participant_id"=>"3"}
Researcher Load (0.1ms) SELECT "researchers".* FROM "researchers" WHERE "researchers"."id" = ? LIMIT 1 [["id", 2]]
Participant Load (0.0ms) SELECT "participants".* FROM "participants" WHERE "participants"."id" = ? LIMIT 1 [["id", 3]]
ContactData Load (0.1ms) SELECT "contact_data".* FROM "contact_data" WHERE "contact_data"."participant_id" = ? LIMIT 1 [["participant_id", 3]]
AlcoholService Load (0.1ms) SELECT "alcohol_services".* FROM "alcohol_services" WHERE "alcohol_services"."id" = ? LIMIT 1 [["id", 16]]
Baseline Load (0.0ms) SELECT "baselines".* FROM "baselines" WHERE "baselines"."participant_id" = ? LIMIT 1 [["participant_id", 3]]
Rendered participants/_details.html.erb (4.6ms)
Rendered participants/unlock_contact_data.js.erb (6.7ms)
Completed 200 OK in 81ms (Views: 10.8ms | ActiveRecord: 0.3ms)
(0.1ms) rollback transaction
(0.1ms) begin transaction
Is there anything I might be missing?
I make a get request to http://localhost:3000/cars/1 but server does not reply json data. It says like that
Started GET "/api/cars/1" for 127.0.0.1 at 2016-10-07 12:47:34 +0600
Processing by Api::V1::CarsController#show as HTML
Parameters: {"id"=>"1"}
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."uid" = $1 LIMIT $2 [["uid", "sahidul03#gmail.com"], ["LIMIT", 1]]
Car Load (0.6ms) SELECT "cars".* FROM "cars" WHERE "cars"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
Started GET "/" for 127.0.0.1 at 2016-10-07 12:47:34 +0600
Processing by Rails::WelcomeController#index as HTML
Parameters: {"internal"=>true}
(2.9ms) BEGIN
Rendering /home/sahidul/.rvm/gems/ruby-2.2.3/gems/railties- 5.0.0.1/lib/rails/templates/rails/welcome/index.html.erb
Rendered /home/sahidul/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0.1/lib/rails/templates/rails/welcome/index.html.erb (3.9ms)
Completed 200 OK in 11ms (Views: 10.2ms | ActiveRecord: 0.0ms)
(6.8ms) COMMIT
Completed 200 OK in 25ms (Views: 1.3ms | ActiveRecord: 11.8ms)
My controller method is like that
def show
car= Car.find(params[:id])
render json: car
end
Front-end request is
function getCar(id) {
return $http.get($auth.domain + '/api/cars/' + id);
}
I use devise_token_auth gem in back-end and ng-token-auth in front-end
Append .json to the URL
$http.get($auth.domain + '/api/cars/' + id + '.json');
Hope that helps!