ruby on rails 3 - Coffeescript - inherit parent class from different coffeescript file -


i creating spine-rails application , have 2 coffeescript files in lib folder. wanted inherit parent class in coffeescript file unable so.

#= require coffeescript_file_1 

above statement finds target coffeescript file cannot find parent class.

i found utlity: https://github.com/fairfieldt/coffeescript-concat

just wanted know if using correct way find parent class in coffeescript file inside file in rails app.

i'm not using npm.

you need "export" class. coffeescript uses iife wrapper avoid polluting scope.

in application.js :

#= require coffee_parent #= require coffee_child 

in coffee_parent.js.coffee :

@parent = class parent   dostuff: -> 

in coffee_child.js.coffee :

@child = class child extends @parent   dostuff: -> super 1 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -