meleyal / backbone-on-rails

A simple gem for using Backbone.js with Rails.
MIT License
805 stars 125 forks source link

Add backbone in Rails Engine #67

Open samarthsikotara opened 9 years ago

samarthsikotara commented 9 years ago

I have 2 engines in rails application. I want to add backbone in 1 engine. how to do it? If I run rails g backbone:install

it will not add backbone to my engine.

meleyal commented 9 years ago

Does this help? https://github.com/meleyal/backbone-on-rails/issues/43

samarthsikotara commented 9 years ago

@meleyal I have added my coffee script files to my rails engine manually and set path in application.js. I t's working. however I am still finding out Is there any proper way to install backbone directly to my rails engine?

meleyal commented 9 years ago

There's an old pull request that needs some tests, I'd be happy to integrate this if you can take a look?

samarthsikotara commented 9 years ago

I have already tried this pull request but It creates nil_class.js.coffee in my assets. I couldn't able to look an engine name cpanel.js.coffee file.

spodlecki commented 9 years ago

@samarthsikotara

as of 1.2.0.0 ( https://github.com/meleyal/backbone-on-rails/pull/70 ) allows you to name the app what you wish.

For the shared engines part -- I know in Rails 4, I have to add requires in my engine's main ruby file... this is true for everything. (such as jquery-rails)

ROOT/lib/shared_assets.rb

require "shared_assets/engine"
require 'coffee-rails'
require 'sass-rails'
require 'bootstrap-sass'
require 'jquery-rails'
require 'backbone-on-rails'
require 'requirejs-rails'

module SharedAssets
end

do a bundle on the main app and bundle exec rails g backbone:scaffold Home --app=App