rails-engines

Devise not working with Rails 4.0

泄露秘密 提交于 2019-12-13 03:15:49
问题 I took the following steps: rails new routing_test in Gemfile I added devise rails devise g user invoke active_record create db/migrate/20130731191051_devise_create_users.rb create app/models/user.rb invoke rspec create spec/models/user_spec.rb invoke factory_girl create spec/factories/users.rb insert app/models/user.rb route devise_for :users and then, with a simple rake db:migrate, I get the following: rake aborted! Rails::Application::RoutesReloader#execute_if_updated delegated to updater

Rails Engines - simple possible engine to (1) add a model and (2) add the association in the containing class

这一生的挚爱 提交于 2019-12-12 21:23:24
问题 I am trying to write my first engine but am having problems with the following scenario. In the host app, I will have User model (this is guaranteed so in the engine I can refer to User class rather than some level of indirection) which has a name. In the engine, I will have a post model and need to create an association between the post model and the user model in the containing app. >rails plugin new abc --mountable ... >rails g model Post header:string body:text user_id:integer ... edit

Initializing object within devolopment.rb envirorment using gem within rails mountable engine

我怕爱的太早我们不能终老 提交于 2019-12-12 03:33:01
问题 Completely lost. I'm following this sample app tutorial https://www.wepay.com/developer/resources/wefarm-tutorial which seems like a simple tutorial to follow except I'm building it inside a rails engine. I'm currently attempting to follow the tutorial and initialize the new object. initialize a new WePay object. add these variables to config/development.rb: wefarm / config / environments / development.rb App specific information CLIENT_ID = 32636 CLIENT_SECRET = "180c800c62" USE_STAGE = true

Rails Engines rendered View

非 Y 不嫁゛ 提交于 2019-12-11 07:14:01
问题 I have a rails engine I'm developing. This is my first one, besides the example in rails documentation, so I don't have a good ref on what works. It has a partial that i'm requiring the Application to render. <%=render partial: 'my_engine/foo/bar'%> That works fine. And i understand why i need to reference the partial through the engine name space. But within the partial, i apparently have to use the name space as well. So when i render a photo <%= image_tag('my_engine/addphoto.jpg') %> that

rails memcached dalli Marshalling error for key

心不动则不痛 提交于 2019-12-11 04:31:45
问题 I have such action in my controller: def my @user = Ads::User.find current_user.id @postings = Rails.cache.fetch("@user.postings.includes(:category)") do @postings = @user.postings.includes(:category) end end I'm trying to cache @postings and get such error: Marshalling error for key '@user.postings.includes(:category)': can't dump anonymous class #<Module:0x000000048f9040> You are trying to cache a Ruby object which cannot be serialized to memcached. If I try to cache @postings without

How do I access all routes, when an App and an included AppEngine gem define controllers with the same name?

白昼怎懂夜的黑 提交于 2019-12-11 03:59:40
问题 I have an engine (developed by me / the company I work for) that we use on several different projects. I just converted it to work with rails 3.1 w/ assets pipeline and everything seems to be working... for the most part. My problem is that I need to extend the functionality of the UsersController with a little bit of app-specific spice, but I'm not sure about the best way to do it. The engine doesn't define a Users#show action, but this app does need it, so I added to the routes file:

Rails3.1 engine: can't get SLIM or HAML to work in test/dummy app

老子叫甜甜 提交于 2019-12-11 03:28:44
问题 I'm developing a Rails 3.1 engine, and to integration test it I want to use SLIM instead of plain ol' ERB. So I tried to simply add s.add_development_dependency "slim" to my .gemspec file, but when renaming my index.html.erb file to index.html.slim , Rails complains: Missing template dummy/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in: * "/Users/josh/Documents/Work/Sientia/iq_menu/full/spec/dummy/app/views" * "/Users/josh/Documents

Rails 5 “gemify” assets manifest file

谁都会走 提交于 2019-12-11 01:44:41
问题 Update Got this in a working state. Gem can be found here: https://github.com/jakehockey10/popcircle Original post: I am trying to "gemify" a jquery plugin as a learning experience. The plugin I'm using also depends on jquery.easing , so in the gem's vendor/assets/javascripts folder, I have both jquery.easing.js as well as the other jquery plugin. Here is what my gem's <name_of_gem>.rb file looks like: require '<name_of_gem>/version' module <NameOfGem> class Engine < ::Rails::Engine class

Importing a react component from a Rails engine into an application

不羁岁月 提交于 2019-12-10 23:11:58
问题 I am using react_on_rails for developing a Rails Engine and an application. I have written a rails engine which has a single component - NewComponent . It uses react_on_rails. This has been tested via the dummy application of the rails engine. I imported and registered the component in dummy application: /new_engine/test/dummy/client/app/Index.jsx : import NewComponent from '../../../../client/app/pages/user_home_page/NewComponent'; ReactOnRails.register({ NewComponent, }); The above worked

Observers in Rails Engines

£可爱£侵袭症+ 提交于 2019-12-10 22:59:28
问题 I'm trying to create an observer in my Rails engine that will observe a model in my main application. My observer (in app/models/my_engine/my_observer.rb) is, module MyEngine class MyObserver < ActiveRecord::Observer observe AppModel def after_create # code to run when callback is observed end end end In order to register the observer, I've modified my engine (in lib/my_engine/engine.rb) to be, module MyEngine class Engine < ::Rails::Engine isolate_namespace MyEngine config.active_record