{"action":"created","issue":{"url":"https://api.github.com/repos/gemgento/rails_script/issues/14","repository_url":"https://api.github.com/repos/gemgento/rails_script","labels_url":"https://api.github.com/repos/gemgento/rails_script/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/gemgento/rails_script/issues/14/comments","events_url":"https://api.github.com/repos/gemgento/rails_script/issues/14/events","html_url":"https://github.com/gemgento/rails_script/issues/14","id":155839561,"number":14,"title":"Installation issue: Per controller/view code not firing :-/","user":{"login":"edelgado","id":143209,"avatar_url":"https://avatars.githubusercontent.com/u/143209?v=3","gravatar_id":"","url":"https://api.github.com/users/edelgado","html_url":"https://github.com/edelgado","followers_url":"https://api.github.com/users/edelgado/followers","following_url":"https://api.github.com/users/edelgado/following{/other_user}","gists_url":"https://api.github.com/users/edelgado/gists{/gist_id}","starred_url":"https://api.github.com/users/edelgado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edelgado/subscriptions","organizations_url":"https://api.github.com/users/edelgado/orgs","repos_url":"https://api.github.com/users/edelgado/repos","events_url":"https://api.github.com/users/edelgado/events{/privacy}","received_events_url":"https://api.github.com/users/edelgado/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"kpheasey","id":3934075,"avatar_url":"https://avatars.githubusercontent.com/u/3934075?v=3","gravatar_id":"","url":"https://api.github.com/users/kpheasey","html_url":"https://github.com/kpheasey","followers_url":"https://api.github.com/users/kpheasey/followers","following_url":"https://api.github.com/users/kpheasey/following{/other_user}","gists_url":"https://api.github.com/users/kpheasey/gists{/gist_id}","starred_url":"https://api.github.com/users/kpheasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpheasey/subscriptions","organizations_url":"https://api.github.com/users/kpheasey/orgs","repos_url":"https://api.github.com/users/kpheasey/repos","events_url":"https://api.github.com/users/kpheasey/events{/privacy}","received_events_url":"https://api.github.com/users/kpheasey/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-05-19T21:28:11Z","updated_at":"2016-05-20T14:07:24Z","closed_at":null,"body":"Hi @kpheasey, this gem looks great to organize JS code in Rails and I'd love to use it, but I'm running into an issue; even though every seems that it installed properly, my JS code just won't fire.\r\n\r\n`include_rails_script` seems to be working as I see that my pages generate the proper DIV with the controller name in it:\r\n\r\n```html\r\n<!-- /shipments/1/edit? -->\r\n<div id=\"rails-script\" data-controller=\"Shipments\" data-vars=\"{}\"></div>\r\n```\r\n\r\nMy `app/assets/javascripts/shipments.js.coffee` file has:\r\n\r\n```javascript\r\nwindow.App ||= {}\r\n\r\nclass App.Shipments extends App.Base\r\n\r\n  edit: =>\r\n    console.log \"In Shipments Edit page!\"\r\n```\r\n\r\nIf I inspect the loaded scripts via Chrome's dev console, I see that the generated file (`/assets/shipments.self-d87964dbebfb5ea692519563a08b76f8cbabc30132b4a311cdb4bd1937cbc66c.js?body=1`) is:\r\n\r\n```javascript\r\n(function() {\r\n  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },\r\n    extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },\r\n    hasProp = {}.hasOwnProperty;\r\n\r\n  window.App || (window.App = {});\r\n\r\n  App.Shipments = (function(superClass) {\r\n    extend(Shipments, superClass);\r\n\r\n    function Shipments() {\r\n      this.edit = bind(this.edit, this);\r\n      this.beforeAction = bind(this.beforeAction, this);\r\n      return Shipments.__super__.constructor.apply(this, arguments);\r\n    }\r\n\r\n    Shipments.prototype.beforeAction = function(action) {\r\n      return console.log(\"before \" + action + \" action\");\r\n    };\r\n\r\n    Shipments.prototype.edit = function() {\r\n      return console.log(\"In Shipments Edit page!\");\r\n    };\r\n\r\n    return Shipments;\r\n\r\n  })(App.Base);\r\n\r\n}).call(this);\r\n```\r\n\r\nWhich contains the `console.log` line in the `edit` function, but the console shows nothing 😞 . I've even tried a plain `alert(\"Hello\")`, to no avail. If I place a `console.log` call in `global.js.coffee` that works (but then again that's just loaded by Rails like any other JS file). I've also tried adding alerts and console logs to constructor of `base.js.coffee` like (excerpt):\r\n\r\n```javascript\r\nclass App.Base\r\n\r\n  constructor: ->\r\n    if (window.jQuery) then @setClearEventHandlers() # clearing application event handlers only possible with jQuery\r\n    console.log('boo')\r\n    return this\r\n```\r\n\r\nBut that doesn't fire either. Hope I'm including enough info to help. Any ideas?\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/gemgento/rails_script/issues/comments/220615215","html_url":"https://github.com/gemgento/rails_script/issues/14#issuecomment-220615215","issue_url":"https://api.github.com/repos/gemgento/rails_script/issues/14","id":220615215,"user":{"login":"kpheasey","id":3934075,"avatar_url":"https://avatars.githubusercontent.com/u/3934075?v=3","gravatar_id":"","url":"https://api.github.com/users/kpheasey","html_url":"https://github.com/kpheasey","followers_url":"https://api.github.com/users/kpheasey/followers","following_url":"https://api.github.com/users/kpheasey/following{/other_user}","gists_url":"https://api.github.com/users/kpheasey/gists{/gist_id}","starred_url":"https://api.github.com/users/kpheasey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpheasey/subscriptions","organizations_url":"https://api.github.com/users/kpheasey/orgs","repos_url":"https://api.github.com/users/kpheasey/repos","events_url":"https://api.github.com/users/kpheasey/events{/privacy}","received_events_url":"https://api.github.com/users/kpheasey/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T14:07:24Z","updated_at":"2016-05-20T14:07:24Z","body":"Thanks for the info.  I'm looking into the issue now.  I realized I released v1 missing a large chunk of JS.  I'm doing some reworking to make the setup painless."}}
{"actor":{"display_login":"kpheasey"}}