-
Tshepang
ruby-on-rails-3 static assets rails-engines
I’m building an engine I’ve bundled as a gem (gmaps4rails). I copied the /public of my engine in the /public of my rails app.Everything works fine in development but fails to work in production: it appears static assets (of my engine & my main app) aren’t found.The logs tell the following (just an abstract):Started GET “/javascripts/application.js?1286294679” for 127.0.0.1 at Wed Nov 24 00:22:20 +0100 2010ActionController::RoutingError (No route matches “/javascripts/application.js”):Rendere
-
abrahamo
ruby-on-rails rails-engines rack-middleware
I assume that if you mount an app in a main rails or use a rails engine. If any of the sub-apps fail/crash than that means the main app and all the sub-app fail/crash. Does anyone know this for sure? I am wondering if I am building a system if I should separate my architecture into multiple standalone application and instances or build Engine/mountable apps instead of a larger app. The worry is what would happen if part of the app ecosystem goes don’t how does it effect the rest of the applicati
-
pablo89
ruby-on-rails facebook omniauth rails-engines
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 this
-
Daniël Zwijnenburg
ruby-on-rails-3 namespaces rubygems rails-engines
I followed the following tutorial: http://www.themodestrubyist.com/2010/03/05/rails-3-plugins—part-2—writing-an-engine/And it all works great. I namespaced the controller using#app/controller/authr/accounts_controller.rbmodule Authrclass AccountsController < ApplicationControllerunloadabledef new@account = Account.newenddef create@account = Account.new(params[:account])if @account.saveredirect_to ‘/’elserender :action => :newendendend endAnd in the tutorial he didn’t namespace the mode
-
Tshepang
ruby-on-rails rspec gem partial-views rails-engines
I’ve spent the last 2 days reading everything I could find on blogs, in books, in other gems’ source, and on SO and I can’t for the life of me figure this out. Admittedly I’m new to writing Ruby gems, Rails engines, and am not entirely familiar with all the RSpec view methods (but I’m learning as much as I can access).I’ve made my project public on Github (albeit in the early stages, but this is based on some markup I’ve been reusing on recent projects that I’m slowly trying to pull into this ge
-
pablo89
ruby-on-rails rails-routing rails-engines
I made a mountable engine. In the engine I made a helper (located in /app/helpers/my_engine) which looks like this:module MyEnginemodule ApplicationHelperdef link_to_login(label = “Login”, options = {})link_to label, some_path, optionsendend endIn the engine.rb I added this code: initializer ‘my_engine.action_controller’ do |app|ActiveSupport.on_load :action_controller dohelper MyEngine::ApplicationHelperendendEverything works fine, but, when I load the engine in another app and use the helper f
-
Spasm
ruby-on-rails-3 ruby-on-rails-3.1 rails-engines
This is more for experimentation – I am aware that I can do this with –full but I wanted the functionality of namespacing in the app to avoid conflicts The idea is to have a main app – which handles authentication, common items, admin screens etc Then creating engines to add further functionality likecrm cms blog wiki forum etc These engines I can pick and choose as I need for whatever kind of app I am building. Is this possible?Is it just the case of applying both –mountable and –full opt
-
Wolfram Arnold
ruby-on-rails-3 rspec rails-engines
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 sche
-
pjmorse
ruby-on-rails ruby-on-rails-3 routes ruby-on-rails-3.2 rails-engines
I have created a Rails Engine (as per the Rails Guides) using:rails plugin new address_book –full –mountableI proceeded to create a controller for the Engine called pages with a single action (called temp) to display a single view, namely app/views/address_book/pages/temp.html.erbThe Engine’s config/routes.rb is:AddressBook::Engine.routes.draw domatch :temp, to: “pages#temp” endIn the parent application I added the following in it’s routes.rb file:mount AddressBook::Engine => “/address_boo
-
Vitaliy Polotskiy
ruby cancan rails-engines
I’m new in rails development, and trying create my first engine. This engine could use CanCan for authorization and restricting user’s permissions. I have some permissions in my engine and I want to inherit them in my main application.For example:File app/models/my_engine/ability.rb in my enginemodule MyEngineclass Abilityinclude CanCan::Abilitydef initialize(user)user ||= MyEngine::User.new # guest userif user.role? “Admin”can :manage, :allelsecan :read, :allendendend endFile app/models/ability
-
A L
ruby-on-rails methods spree rails-engines
I’m trying to use the current_order method defined in the Spree::Core engine: https://github.com/spree/spree/blob/master/core/lib/spree/core/current_order.rbIn my view, I’ve triedSpree::Core::CurrentOrder.current_orderUsing just “current_order” in development works fine though, but not in production.So then I’ve tried to require it in my views file like this:require ‘spree/core/current_order’I’ve also tried permutations of these other solutions:How to incorporate Rails Engine ApplicationControll
-
Mike Campbell
ruby-on-rails rails-engines
I’m writing some decorators to override a Rails Engine as described here. I’m trying to add a simple method to a class from the Engine, here’s my code:# app/decorators/models/my_engine/user_decorator.rbMyEngine::User.class_eval dodef self.find_by_name_or_mis_id strwhere(“CONCAT(#{table_name}.firstname, ‘ ‘, #{table_name}.surname) LIKE CONCAT(‘%’, :s, ‘%’) OR mis_id = :s”, { s: str })end endMy app can’t find the method, and in rails console I try to test it: # rails c MyEngine::User.find_by_name_
-
phoenixwizard
ruby-on-rails ruby-on-rails-3.1 ruby-on-rails-plugins rails-engines
I am making a new mountable engine. It is a part of a bigger application. I am trying to use the layout of another small engine as my engine and that engine need to have same layout. For this purpose my aaplication controller looks like :class ApplicationController < AnotherEngine::ApplicationControllerlayout “AnotherEngine/AnotherEngine” #Pointing to the layout file of other engine endNow the problem is that there are named_paths in the other engine which my engine is not able to recognis
-
Marten Veldthuis
ruby-on-rails ruby rspec rails-engines
I have an application that mounts an engine in its routes.rb like so:mount Quby::Engine => “/quby”, :as => “quby_engine”It has a controller action that does this:def collect_answers# do a bunch of stuff and thenredirect_to quby_engine.edit_questionnaire_answers_path(questionnaire) endThis does work in the browser, but my RSpec controller tests for that action:it ‘should redirect to something’ doget :collect_answers, :key => “honos”response.should redirect_to(“something”) endFail with me
-
juandebravo
ruby-on-rails ruby rails-engines
I’m developing a Rails Engine that handles the Oauth mechanism with a third party. I would like to have all the configuration in a Struct attribute, so all the engine config data is stored together:require ‘rails’module ThirdPartyclass Engine < ::Rails::Engineinitializer “third-party.some_init_task” do |app|ThirdPartyConfig = Struct.new(:uri, :client_id, :client_secret, :redirect_uri)app.config.thirdparty = ThirdPartyConfig.newapp.config.thirdparty.uri = “https://thirdparty.com”app.config.thi
-
Marcus
ruby-on-rails ruby-on-rails-3 mount rails-engines named-routing
I’m making a small rails engine which I mount like this:mount BasicApp::Engine => “/app”Using this answer I have verified that all the routes in the engine are as the should be:However – when I (inside the engine) link to a named route (defined inside the engine) I get this errorundefined local variable or method `new_post_path’ for #<#<Class:0x000000065e0c08>:0x000000065d71d0>Running “rake route” clearly verifies that “new_post” should be a named path, so I have no idea why Rails
-
utahtwo
ruby-on-rails ruby-on-rails-3.1 rails-engines rails-3.1
I have created a simple Rails Engine to provide some general functionality(photo gallery) to an application. I want to be able to override the standard _header partial so that the menu for the gallery matches that of my main application. In my header view I call a helper that is part of application_helpers (main app), but I keep getting “undefined method” errors. From what I can tell the main app application_helpers are not being included (obviously) when I override the engines application la
-
wildDAlex
ruby-on-rails rails-engines
I have Rails application with mounted Engine.#{main_app}/config/routes.rb mount CommentIt::Engine => “/talk”, :as => ‘comment_it’And want to open engine views within main application layout. #{main_app}/app/views/layouts/application.html.erb <html><body><%= link_to “users”, users_path %><%= yield %></body> </html>When accessing engine views(0.0.0.0:3000/talk) I got error ‘undefined method `users_path’ for #<#:0x007f9dbf0f7800>’ users_path works fine i
-
Daniel X Moore
routes ruby-on-rails-3.1 rails-engines
I’m using the forem engine in Rails 3.1, but my application layout references some resource routes such as users_path and new_sprite_path.This all works fine outside the engine, but when I try to navigate to a page in the engine I get undefined local variable or method `new_sprite_path’ for #<#<Class:0x7f4faa4f9240>:0x7f4faa4dc320>How can I get the engine to see the paths in my application correctly?
-
RailinginDFW
ruby-on-rails rails-engines
I have a model named Engine, and I am able to use it in views and controllers without issues. The problem occurs when I use it in a model (for example, in callbacks or even simple instance methods).#inside the vehicle model def add_enginesEngine.all.each do |ngin|…endI get the error: NoMethodError: undefined method ‘all’ for #<Some_mounted_engine_name:0x00000103b48828>I search the web, but I do not see Engine as a reserved word. Note that we use mounted engines in our app.
-
Andrei
ruby-on-rails ruby-on-rails-3 rubygems ruby-on-rails-plugins rails-engines
According to Rails engines extending functionality in Rails 2.x one could doRails::Initializer.new(Rails.configuration).plugin_loader.enginesThis code is not working in Rails 3ActionController::RoutingError (undefined method `new’ for Rails::Initializer:Module):config/application.rb:12:in `require_or_load’What do I need to do in Rails 3 to get such list of engines?This is needed for Extending controllers of a Rails engine in the main app
-
Tiago
ruby-on-rails-3 dependencies gem rails-engines
I’m doing an engine here, it works alright in stand alone.When I transform it into a gem, and load it inside another application, I get a lot of undefined errors, coming from my engine gem’s dependecies.Here is the gemspec:s.add_dependency(‘paperclip’) s.add_dependency(‘jquery-rails’) s.add_dependency(‘rails3-jquery-autocomplete’) s.add_dependency(‘remotipart’) s.add_dependency(‘cancan’)In the application, when I do a bundle install, it lists all these dependencies, but as i run the application
-
Deranger
ruby-on-rails ruby-on-rails-3 rails-engines
I’m new to Ruby on Rails, using rails 3.2.13 and ruby 1.9.3p392. I’m trying to build an engine to be used by an app, which might be contributing to my confusion.Engine name is sales_app. I’ve got a page that posts a bunch of data to sales_app/sales#create to create a Sale. Inside the create action of the sales controller I do a little bit of data processing and try to instantiate a Sale object. Instead of creating an object from a model, I get a NoMethodError exception for a delete method th