You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class App.Element.MainMenu extends App.Utility.Modal
219
222
@@ -224,7 +227,7 @@ class App.Element.MainMenu extends App.Utility.Modal
224
227
Inheritance from the generator can only come from a Utility class. Any custom class you wish to extend should be created as a Utility. The installer adds the line ```//= require_tree ./utilities``` before loading tree to handle this. If you have a utility that extends a utility, you should make sure the extended utility is loaded first by explicitly requiring it before the utilities tree.
225
228
226
229
227
-
### Generating New Controllers
230
+
### Custom Controllers
228
231
229
232
When a new controller is generated, the JavaScript asset file will be generated with RailsScript. However, if you need to manually generate a RailsScript controller you can use:
230
233
@@ -262,6 +265,28 @@ class App.SomeNewController extends App.Base
262
265
None of the pre-defined functions are necessary, you can remove the ones you don't want.
263
266
264
267
268
+
### Generic Classes
269
+
270
+
To generate a generic class that isn't a Utility, Element or Controller, just use the following:
271
+
272
+
$ rails g rails_script:class My::ClassName
273
+
274
+
Which generates:
275
+
276
+
```
277
+
# /app/assets/javascripts/my/class_name.js.coffee
278
+
279
+
window.App ||= {}
280
+
class App.MyClassName
281
+
282
+
constructor: ->
283
+
return this
284
+
285
+
```
286
+
287
+
288
+
289
+
265
290
## Contributing
266
291
267
292
1. Fork it ( https://github.com/[my-github-username]/rails_script/fork )
0 commit comments