RJS Error: ReferenceError: refreshed_content_or_update is not defined

54 views
Skip to first unread message

Mel Riffe

unread,
May 13, 2014, 5:36:30 PM5/13/14
to actives...@googlegroups.com
Hopefully someone's seen this before and can direct me to a fix.

Versions:
  • Ruby 1.9.3p484
  • Rails 3.2.18
  • ActiveScaffold 3.2.20

This happens after I submit the form to update one of my models. The model gets updated. The view is not refreshed.

I did notice a newer version of ActiveScaffold but I'm not using jQuery on this project. It would be a much larger change than just updating ActiveScaffold.

At this point I'm not sure where to look or how to debug.

Any help will be greatly appreciated.

Sergio Cambra

unread,
May 14, 2014, 2:39:13 AM5/14/14
to actives...@googlegroups.com

Please, open web inspector in browser and sent response of the request

 

El Martes, 13 de mayo de 2014 14:36:30 Mel Riffe escribió:

> Hopefully someone's seen this before and can direct me to a fix.

>

> Versions:

>

> - Ruby 1.9.3p484

> - Rails 3.2.18

> - ActiveScaffold 3.2.20

Mel Riffe

unread,
May 14, 2014, 12:14:05 PM5/14/14
to actives...@googlegroups.com
Hi Sergio,

Here is the Response:

try {
var action_link = ActiveScaffold.find_action_link('as_admin__products-update-1-form');
action_link.update_flash_messages('');
      action_link.close('\n<tr class=\"record  \" id=\"as_admin__products-list-1-row\" data-refresh=\"/admin/products/1/row?_method=get&utf8=%E2%9C%93\">\n  \n  <td class=\"sku-column  sorted\">\n    SKU_2\n<\/td>\n  <td class=\"price-column  numeric\">\n    400\n<\/td>\n  <td class=\"description-column\">\n    Test Product\n<\/td>\n  <td class=\"actions\"><table cellpadding=\"0\" cellspacing=\"0\">\n  <tr>\n    <td class=\"indicator-container\">\n      <img alt=\"loading indicator\" class=\"loading-indicator\" id=\"as_admin__products-record-1-loading-indicator\" src=\"/assets/active_scaffold/indicator.gif\" style=\"visibility:hidden;\" />\n    <\/td>\n            <td><a href=\"/admin/products/1/edit?utf8=%E2%9C%93\" class=\"edit as_action\" data-action=\"edit\" data-position=\"replace\" data-remote=\"true\" id=\"as_admin__products-__admin__products-edit-1-link\">Edit<\/a><\/td>\n      <td><a href=\"/admin/products/1?utf8=%E2%9C%93\" class=\"show as_action\" data-action=\"show\" data-position=\"replace\" data-remote=\"true\" id=\"as_admin__products-__admin__products-show-1-link\">Show<\/a><\/td>\n\n  <\/tr>\n<\/table>\n<\/td>\n\n\n  \n<\/tr>\n');
      
} catch (e) { alert('RJS error:\n\n' + e.toString());}


Here are the Headers (in case you need to see those too):

  1. Remote Address:
  2. Request URL:
  3. Request Method:
    POST
  4. Status Code:
    200 OK
  5. Request Headersview source
    1. Accept:
      text/javascript, text/html, application/xml, text/xml, */*
    2. Accept-Encoding:
      gzip,deflate,sdch
    3. Accept-Language:
      en-US,en;q=0.8
    4. Connection:
      keep-alive
    5. Content-Length:
      193
    6. Content-type:
      application/x-www-form-urlencoded; charset=UTF-8
    7. Cookie:
      user_credentials=e1c8542d0e295a72a61e0fecfa53f94d6b2bb5accec91138d8651cbe051f15c705f92649af386601967792b8753357bd8f39fee17b0aaed1162542f1d19b8341%3A%3A2289; _thcic_session=22868ccad2a5b4ef12c7c066cb128af0
    8. Host:
    9. Origin:
    10. Referer:
    11. User-Agent:
      Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
    12. X-Prototype-Version:
      1.7
    13. X-Requested-With:
      XMLHttpRequest
  6. Form Dataview sourceview URL encoded
    1. utf8:
    2. _method:
      put
    3. authenticity_token:
      So/SUxqDom6gK7+Ynpf107VxSPfRwekkTxVRpvbjq5Q=
    4. record[sku]:
      SKU_2
    5. record[price]:
      400
    6. record[description]:
      Test Product
    7. commit:
      Update
  7. Response Headersview source
    1. Cache-Control:
      max-age=0, private, must-revalidate
    2. Connection:
      Keep-Alive
    3. Content-Length:
      1359
    4. Content-Type:
      text/javascript; charset=utf-8
    5. Date:
      Wed, 14 May 2014 16:10:14 GMT
    6. Etag:
      "e12a8af119761af1e50566e62f164396"
    7. Server:
      WEBrick/1.3.1 (Ruby/1.9.3/2013-11-22)
    8. X-Request-Id:
      e4d3a3334d20d5db5bb65810f8d93979
    9. X-Runtime:
      0.070894
    10. X-Ua-Compatible:
      IE=Edge


Thanks! :D

Sergio Cambra

unread,
May 15, 2014, 10:40:11 AM5/15/14
to actives...@googlegroups.com, Mel Riffe

After update, can you try finding element with as_admin__products-update-1-form ID? You can use console:

$('as_admin__products-update-1-form')

> 1. Remote Address:

> 127.0.0.1:3000

> 2. Request URL:

> http://lvh.me:3000/admin/products/1

> 3. Request Method:

> POST

> 4. Status Code:

> 200 OK

> 5. Request Headersview source

> 1. Accept:

> text/javascript, text/html, application/xml, text/xml, */*

> 2. Accept-Encoding:

> gzip,deflate,sdch

> 3. Accept-Language:

> en-US,en;q=0.8

> 4. Connection:

> keep-alive

> 5. Content-Length:

> 193

> 6. Content-type:

> application/x-www-form-urlencoded; charset=UTF-8

> 7. Cookie:

>

> user_credentials=e1c8542d0e295a72a61e0fecfa53f94d6b2bb5accec91138d8651cbe05

> 1f15c705f92649af386601967792b8753357bd8f39fee17b0aaed1162542f1d19b8341%3A%3A

> 2289; _thcic_session=22868ccad2a5b4ef12c7c066cb128af0

> 8. Host:

> lvh.me:3000

> 9. Origin:

> http://lvh.me:3000

> 10. Referer:

> http://lvh.me:3000/admin/products

> 11. User-Agent:

> Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36

> (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36

> 12. X-Prototype-Version:

> 1.7

> 13. X-Requested-With:

> XMLHttpRequest

> 6. Form Dataview sourceview URL encoded

> 1. utf8:

> ✓

> 2. _method:

> put

> 3. authenticity_token:

> So/SUxqDom6gK7+Ynpf107VxSPfRwekkTxVRpvbjq5Q=

> 4. record[sku]:

> SKU_2

> 5. record[price]:

> 400

> 6. record[description]:

> Test Product

> 7. commit:

> Update

> 7. Response Headersview source

> 1. Cache-Control:

> max-age=0, private, must-revalidate

> 2. Connection:

> Keep-Alive

> 3. Content-Length:

> 1359

> 4. Content-Type:

> text/javascript; charset=utf-8

> 5. Date:

> Wed, 14 May 2014 16:10:14 GMT

> 6. Etag:

> "e12a8af119761af1e50566e62f164396"

> 7. Server:

> WEBrick/1.3.1 (Ruby/1.9.3/2013-11-22)

> 8. X-Request-Id:

> e4d3a3334d20d5db5bb65810f8d93979

> 9. X-Runtime:

> 0.070894

> 10. X-Ua-Compatible:

Mel Riffe

unread,
May 19, 2014, 11:03:10 AM5/19/14
to actives...@googlegroups.com, Mel Riffe
Hi Sergio,

Sorry for the delay in my response; I only work on this project at the beginning of the week.

As to your inquiry:

Yes, the element is there before I push the Update button.
No, the element is not there after the RJS Error alert is dismissed.

What does that mean?

Thank you, very much, for your help.

Sergio Cambra

unread,
May 21, 2014, 10:02:35 AM5/21/14
to actives...@googlegroups.com, Mel Riffe

what RJS Error alert do you get?

Message has been deleted

Sergio Cambra

unread,
May 23, 2014, 3:22:40 AM5/23/14
to actives...@googlegroups.com, Mel Riffe

This line is using a wrong variable:

https://github.com/activescaffold/active_scaffold/blob/v3.2.20/app/assets/javascripts/prototype/active_scaffold.js#L937

 

refreshed_content_or_update should be refreshed_content_or_reload

 

You can edit that line on your install of activescaffold. It's fixed on 3.3.0, prototype support is not removed but some new features are not added, it's too much work for me testing support for a library which I don't use anymore. Any help is welcome

 

El Miércoles, 21 de mayo de 2014 07:05:35 Mel Riffe escribió:

> Here is a link to a screen

> shot:

> http://f.cl.ly/items/3x3d0h2F1A1d1O3J3a2n/Screen%20Shot%202014-05-13%20at%2

> 04.39.54%20PM.png

>

> To summarize: "ReferenceError: refreshed_content_or_update is not defined"

> > ...

 

Mel Riffe

unread,
May 27, 2014, 2:14:05 PM5/27/14
to actives...@googlegroups.com, Mel Riffe
Thank you for the update and direction.

Unfortunately I don't have enough javascript experience in order to be helpful.

I will be making this change locally.
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-stat...

Sergio Cambra

unread,
May 28, 2014, 3:05:18 AM5/28/14
to actives...@googlegroups.com, Mel Riffe

Testing latests versions and reporting issues should be useful too

Reply all
Reply to author
Forward
0 new messages