rails-engines

rails: autoload files inside engine's lib directory

非 Y 不嫁゛ 提交于 2020-06-25 21:34:32
问题 I am working on this rails application with an engine which is sort of sub application adding some more routes to my existing application. The concept is so powerful, thanks to rails. But I am facing this weird challenge to autoload file changes inside my engines lib directory in development mode. Every time I make a change inside app directory of engine be it model or controller , it works flawlessly, but no changes to any files under lib directory get's picked up. Is there a way I can do

rails: autoload files inside engine's lib directory

我的梦境 提交于 2020-06-25 21:33:28
问题 I am working on this rails application with an engine which is sort of sub application adding some more routes to my existing application. The concept is so powerful, thanks to rails. But I am facing this weird challenge to autoload file changes inside my engines lib directory in development mode. Every time I make a change inside app directory of engine be it model or controller , it works flawlessly, but no changes to any files under lib directory get's picked up. Is there a way I can do

rails: autoload files inside engine's lib directory

你离开我真会死。 提交于 2020-06-25 21:33:08
问题 I am working on this rails application with an engine which is sort of sub application adding some more routes to my existing application. The concept is so powerful, thanks to rails. But I am facing this weird challenge to autoload file changes inside my engines lib directory in development mode. Every time I make a change inside app directory of engine be it model or controller , it works flawlessly, but no changes to any files under lib directory get's picked up. Is there a way I can do

Setting `cache_classes` to `false` fixes my bug. What to do next?

陌路散爱 提交于 2020-03-05 06:18:30
问题 I'm adding a mountable engine to my rails app, which provides a forum-like functionality (i.e. adds questions, answers, comments, etc). Everything works fine in development. In staging/production, however, I get an error when trying to create an answer, specifically a CanCan permission error (though I think that may be a red herring). But it feels like ti might be related to namespacing or name collision? At any rate, the issue goes away when I set config.cache_classes = false in my

Rails mountable engine with isolate_namespace but without prefixed namespace on tables

你离开我真会死。 提交于 2020-01-22 13:53:48
问题 Is there a way to configure the isolate_namespace method to not use prefixed table names? class Engine < ::Rails::Engine isolate_namespace MyEngine end Additionally, an isolated engine will set its name according to namespace, so MyEngine::Engine.engine_name will be “my_engine”. It will also set MyEngine.table_name_prefix to “my_engine_”, changing the MyEngine::Article model to use the my_engine_articles table.Isolated Engine Docs When designing a prototype I ran into an issue where I need

Rails mountable engine with isolate_namespace but without prefixed namespace on tables

喜夏-厌秋 提交于 2020-01-22 13:53:44
问题 Is there a way to configure the isolate_namespace method to not use prefixed table names? class Engine < ::Rails::Engine isolate_namespace MyEngine end Additionally, an isolated engine will set its name according to namespace, so MyEngine::Engine.engine_name will be “my_engine”. It will also set MyEngine.table_name_prefix to “my_engine_”, changing the MyEngine::Article model to use the my_engine_articles table.Isolated Engine Docs When designing a prototype I ran into an issue where I need

Rails mountable engine with isolate_namespace but without prefixed namespace on tables

懵懂的女人 提交于 2020-01-22 13:52:33
问题 Is there a way to configure the isolate_namespace method to not use prefixed table names? class Engine < ::Rails::Engine isolate_namespace MyEngine end Additionally, an isolated engine will set its name according to namespace, so MyEngine::Engine.engine_name will be “my_engine”. It will also set MyEngine.table_name_prefix to “my_engine_”, changing the MyEngine::Article model to use the my_engine_articles table.Isolated Engine Docs When designing a prototype I ran into an issue where I need

Sunspot/Solr raketasks not loading in Rails 3 Mountable Engine

泄露秘密 提交于 2020-01-13 07:00:49
问题 I'm trying to add the sunspot_rails gem to my Rails Mountable Engine, so I can use Solr to do full text searches. Like it states in the README file I've added this to my Gemfile: gem "sunspot_rails" gem "sunspot_solr" Then I run rails g sunspot_rails:install which creates sunspot.yml in the config folder of my Rails Engine. To start sunspot I need to run: bundle exec rake sunspot:solr:start But that doesn't work, and gives me the following error message: rake aborted! Don't know how to build

rails prepend_view_path of mountable engine

孤者浪人 提交于 2020-01-13 03:56:12
问题 In one hand, I have a mountable engine let's say Front Front contain my assets and couple of pages It's isolated from MainApp. I don't want it to touch the main app. In the other hand I want my MainApp using layout and partial of the Front. So I setup the layout this way : class ApplicationController < ActionController::Base layout 'front/application' end But the front/application refer to engine partial directly, because of isolation, like this render 'header' # front/ prefix is not required

How can I avoid Devise from requires authentication from within an engine?

﹥>﹥吖頭↗ 提交于 2020-01-05 23:29:36
问题 I'm using Devise for athentication in my main application and I have built an API (for a PABX) using "http_basic_authenticate_with" and it's working well when I add before_action :authenticate_user!, except: [:method_name] to my controller. I'm doing that because except: [:method_name] will not require a logged user session on Devise and I just want to use basic authenticate for those API controllers. config/routes.rb (main application) scope module: 'api' do scope module: 'pabx' do scope '