rails-engines

Rails 3.2 Engines - routes not working in test cases

我的未来我决定 提交于 2019-12-24 06:00:57
问题 I mounted in my app the RailsAdmin engine ( according to the instructions from the wiki ) using mount RailsAdmin::Engine => '/backend', :as => 'rails_admin' I had to extend one controller from the engine to add a before_filter. When running my app in development, my extension and the other engine features are working perfectly. However I have an issue in writing functional tests using Test::Unit for my before_filter. The filter kicks in at the right moment and works as expected, but once the

Best practices to mount Rails engine to several apps on production

自作多情 提交于 2019-12-24 05:51:02
问题 I'm a little bit confused about organizing Rails applications and mountable engine in production. I have N apps, which are using 1 mountable engine (it sets some cookies for apps). In development it works this way. Folders: |— app1 |— app2 |— my_engine In apps Gemfile: gem 'my_engine', path: "../my_engine" So all of the apps are mounting it from 1 source. And I'd like to keep this logic in production. On my vps apps organized this way (using Capistrano for deploy): |—apps_folder |— — app1 |—

Best practices to mount Rails engine to several apps on production

守給你的承諾、 提交于 2019-12-24 05:50:03
问题 I'm a little bit confused about organizing Rails applications and mountable engine in production. I have N apps, which are using 1 mountable engine (it sets some cookies for apps). In development it works this way. Folders: |— app1 |— app2 |— my_engine In apps Gemfile: gem 'my_engine', path: "../my_engine" So all of the apps are mounting it from 1 source. And I'd like to keep this logic in production. On my vps apps organized this way (using Capistrano for deploy): |—apps_folder |— — app1 |—

How do I get my dummy app to use the Engine's template engine?

爱⌒轻易说出口 提交于 2019-12-23 12:57:50
问题 I have a Rails Engine I'm working on and the gemspec has this: s.add_development_dependency "rspec-rails" s.add_development_dependency "combustion" s.add_development_dependency "capybara" s.add_development_dependency "factory_girl_rails" s.add_development_dependency "ffaker" s.add_development_dependency "draper" s.add_runtime_dependency "sqlite3" s.add_runtime_dependency "slim-rails" s.add_runtime_dependency "sass-rails" s.add_runtime_dependency "jquery-rails" s.add_runtime_dependency "rails"

Omniauth-Facebook callback does not get initialised in Rails Mountable Engine

巧了我就是萌 提交于 2019-12-23 06:56:58
问题 I'm developing a mountable engine (called SimpleUser) which uses Devise, OmniAuth and OmniAuth-Facebook. First I made a test app with the gems about and every worked fine. Next, I started building the engine from scratch, using the code of the test app as an example. Everything is almost done, except for the connection with Facebook (it uses the Javascript popup). When I click in "log in" the FB popup is displayed, I grant the app, it redirects to the route specified (see routes), but throws

How to develop a Rails3 engine against a real app, using RSpec?

为君一笑 提交于 2019-12-22 08:28:39
问题 A lot has been written about engine development, and using a dummy app for testing. In our case we're developing an engine that is not a stand-alone entity, but has dependencies on a real Rails 3 application. We still want this code to live in an engine, and not become part of the app, because the engine's job is to import data from a legacy system that has its own tables and model mappings, and we want to eventually remove it again. The data mappings between the old legacy tables and the new

Rails engine and devise

六眼飞鱼酱① 提交于 2019-12-21 21:52:54
问题 I have a Rails Engine, where I want to use Devise. I installed devise like normal following this guide. I added this in my engine devise.rb: Devise.setup do |config| config.router_name = :cms_user end I added this in my routes file: Cms::User::Engine.routes.draw do devise_for :users, { class_name: 'Cms::User', module: :devise } end I added this in my routes: devise_for :users, { class_name: 'Cms::User', module: :devise } However I keep getting this error: undefined method 'cms_user' What am I

How to override Rails app routes from an engine?

左心房为你撑大大i 提交于 2019-12-21 17:14:37
问题 I have a Rails app that I am trying to integrate a Rails engine in to. The host app has some catch all routes: # magic urls match '/' => 'admin/rendering#show' match '*path/edit' => 'admin/rendering#show', :defaults => { :editing => true } match '*path' => 'admin/rendering#show' It looks like the engine routes are loaded after the application catches all routes. /sitemap.xml(.:format) {:format=>"xml", :controller=>"admin/sitemaps", :action=>"show"} /(.:format) {:controller=>"admin/rendering",

Making a custom plugin/gem/engine for Rails 3 app

帅比萌擦擦* 提交于 2019-12-21 11:36:27
问题 I am following the guide http://edgeguides.rubyonrails.org/plugins.html and it seems to be slightly outdated. Could you have a look on it and tell me which sections should be done in a different way in Rails 3? EDIT1: Links to alternative tutorials are also very welcome! 回答1: You're right, that guide isn't the best (the last changelog entry is April 2010). Instead, I'd recommend you read: https://github.com/radar/guides/blob/master/gem-development.md 回答2: I bumped into this question, and the

Rails 4 Mountable Engine, couldn't find file 'jquery'

吃可爱长大的小学妹 提交于 2019-12-21 11:09:11
问题 I'm creating a rails mountable engine plugin which uses the gem "jquery-rails". I added this code in .gemspec file s.add_dependency "jquery-rails", "~> 3.0.1" and run bundle install , bundle update . (BTW is this adding necessary? Since rails mountable engine already added "rails 4.0.1" which in turn required "jquery-rails 3.0.4" as its dependency from the start?). In app/assets/javascript/mountable_engine_name/application.js //= require jquery //= require jquery-ujs //= require_tree . But