rails-engines

Adding sample data to database using rake for a rails engine

Hi, I am trying out Rails engines by creating a classifieds engine where users can view/post/reply to classifieds. The main application contains code for user authentication and profiles while there is an engine which I have created which will deal with the classifieds functionality. Now I want to add some sample data to the datab...

Ruby on Rails plugin development process

I'm considering developing aspects of a website as Rails plugins for reuse. My question is about the development process. Since each of these plugins will provide a "slice" of functionality, should I develop each "slice" as it's own application and then extract the code from each application into a plugin? Or, should I write them as p...

Do I need to require original file when overriding controller from Rails Engine?

I'm trying to override an action in a controller defined by a Rails Engine. It seems like I need to require the original file before reopening the class, like so: require File.join(RAILS_ROOT, 'vendor/plugins/myplugin/app/controllers/some_controller') class SomeController def index render :text => 'this is my index' end end ...

Make Rails 2.3.5 aware of rails engine view path

According to the Ruby on Rails 2.3 Release Notes... if your plugin has an app folder, then app/[models|controllers|helpers] will automatically be added to the Rails load path. Engines also support adding view paths now, and ActionMailer as well as Action View will use views from engines and other plugins. There is supposed to be so...

Autotest not understanding namespacing

Most of my work in a rails application is done with rails engines. When I develop new applications, it usually use a custom built cms. My CMS was inspired by refineryCMS in that there is a core that lives as a rails engine. Features that make up the application are other rails engines that register themselves with the core. For example t...

Routes problem with namespaces in a Rails Engine based plugin

Hi! I'm trying to create a dynamic interface. Where my model classes exist and my controllers are dynamically created when launching the application. Everything happens in my routes file where the resources are created! ActionController::Routing::Routes.draw do |map| map.namespace :admin do |admin| TestAdmin.models.each do |m| ...

Override a Rails Engine controller action

Hello, i'm using a Rails engine, but i need to customize some controllers actions. I actually forked the engine, and implementing those customizations into my own fork, but i was wondering if there is an official way in Rails Engines to override and customize controllers. ...

Rails Engine: Extend model with application class

I Have an engine in vendor/plugins. My problem is, that i seemingly can´t extend the engine-model with a model in the base application. My folder structure: APPNAME -app -models -item.rb -vendor -plugins -image_gallery -app -models -image_gallery.rb Nothing special... in my image_gallery.rb i have just this...

Plugin update strategies

I'm developing a plugin which is used in several applications. This plugin is a rails engine with own controllers, models and routes. The controllers, views and models are being generated via simple generator in plugin. Also generator creates migrations for models' tables. The problem I'm facing now is that on any updates to plugin mode...

Ruby on Rails 3 - Reload lib directory for each request

Hey guys, I'm creating a new engine for a rails 3 application. As you can guess, this engine is in the lib directory of my application. However, i have some problems developing it. Indeed, I need to restart my server each time I change something in the engine. Is there a way to avoid this ? Can I force rails to completely reload the ...

Subclassing ActiveRecord with permalink_fu in a rails engine

This question is related to extending class methods in Ruby, perhaps more specifically in the way that permalink_fu does so. It appears that has_permalink on a model will not be available in a derived model. Certainly I would expect anything defined in a class to be inherited by its derived classes. class MyScope::MyClass < ActiveRecor...

Problem creating Rails 3 Engine

I'm working on creating my first Rails 3 engine and I'm currently getting the following error message is a Railtie/Engine and cannot be installed as plugin (RuntimeError) To give you a bit more background I'm not doing the Engine as a gem, but I've place the Engine files in the vendor/plugins folder. I know there is an issue with load...

How to make a pluggable rails app

Basically, I would like to write a rails 3 app that is embeddable in other rails 3 apps (basically some routes, a controller, and some views, no persisting models) works standalone can be bundled up into a gem and be launched from a command (this one is more a nice to have) From what I have read, rails engines would totally solve my ...

Plugin vs Engine in Rails 3, shipped as a gem

In the documentation for Rails::Plugin (for Rails 3), I'm reading the following: "... you actually cannot declare a Rails::Engine inside your Plugin, otherwise it would cause the same files to be loaded twice. This means that if you want to ship an Engine as gem it cannot be used as plugin and vice-versa." Can anyone be more specific a...

how to override rails 3 engine models and controllers in the main application?

I want to be able to override models and controllers of my rails 3 engine in the base app. Inspecting $LOAD_PATH, I found engine's 'app/{models,controllers}' there, but I can't explicitly require engine's model or controller file: require 'engine_name/model_name' fails with "no such file" (tried with both namespaced(app/controllers/engi...

rails 3 best approach multiple apps within one app

I have a rails 3 app that has 2 different UIs that both share the same model but have different UIs. Lets call these retailers and customers "sites". What is the best approach in rails 3 for creating a monolithic application to keep these two apps in one app. Should I just namespace the controllers, and change routing as such? namesp...