Rails3 Engines (mountable apps)

H

H.J. Blok

Hello,

I've a question about Rails 3 Engines. I'm looking everywhere for good
documentation on this subject, but didn't find it.

I'm trying to create a mountable app (embedding a Rails application in
another Rails application). Both the 'base' application and the
'embedded' application are created with rails3.0.0.rc. To behave as
Engine the 'embedded' application has the following code in
'lib/my_engine.rb':

# lib/my_engine.rb
require "my_engine"
require "rails"

module MyEngine
class Engine < Rails::Engine
end
end

In the Gemfile of the 'base' application I've included MyEngine as a
gem, using the path directive (to be able to change code without
rebuilding the gem).

# Gemfile
gem "my_engine", :path => "../my_engine"


When I try to start the 'base' application it raises a NameError:

uninitialized constant MyEngine::Application (NameError)


Does anybody have good (Rails3 RC based) documentation on how to create
a mountable app?

And what would be the 'Rails-way' of solving this problem?

Kind regards,

Harm-Jan
 
L

Luis Lavena

Hello,

I've a question about Rails 3 Engines. I'm looking everywhere for good
documentation on this subject, but didn't find it.

I'm trying to create a mountable app (embedding a Rails application in
another Rails application). Both the 'base' application and the
'embedded' application are created with rails3.0.0.rc. To behave as
Engine the 'embedded' application has the following code in
'lib/my_engine.rb':

# lib/my_engine.rb
require "my_engine"
require "rails"

module MyEngine
  class Engine < Rails::Engine
  end
end

In the Gemfile of the 'base' application I've included MyEngine as a
gem, using the path directive (to be able to change code without
rebuilding the gem).

# Gemfile
gem "my_engine", :path => "../my_engine"

When I try to start the 'base' application it raises a NameError:

uninitialized constant MyEngine::Application (NameError)

Does anybody have good (Rails3 RC based) documentation on how to create
a mountable app?

And what would be the 'Rails-way' of solving this problem?

Please look at enginex:

http://github.com/josevalim/enginex

It creates an engine template for rails 3, generate one and take a
look comparing with your version.

Indeed there is no plenty of documentation, so you should inspect by
example.

Also, you will get more help and better responses in a Ruby on Rails
group/mailing list, like ror talk:

http://groups.google.com/group/rubyonrails-talk

HTH,
 
H

H.J. Blok

Luis said:
Please look at enginex:

http://github.com/josevalim/enginex

It creates an engine template for rails 3, generate one and take a
look comparing with your version.

Thanks, I'll try generating a Engine using enginex and compare it with
my version.
Also, you will get more help and better responses in a Ruby on Rails
group/mailing list, like ror talk:

http://groups.google.com/group/rubyonrails-talk

I already did (forgot to select Rails Forum while creating this topic).

HJ
 
H

H.J. Blok

H.J. Blok said:
Thanks, I'll try generating a Engine using enginex and compare it with
my version.

Do you know how to use enginex? I've tried, but there is no
documentation on usage (other than enginex NAME).

HJ
 
L

Luis Lavena

Do you know how to use enginex? I've tried, but there is no
documentation on usage (other than enginex NAME).

That's all, next you need to inspect the output of NAME
 
B

Benoit Daloze

Please look at enginex:

http://github.com/josevalim/enginex

It creates an engine template for rails 3, generate one and take a
look comparing with your version.

Indeed there is no plenty of documentation, so you should inspect by
example.

Also, you will get more help and better responses in a Ruby on Rails
group/mailing list, like ror talk:

http://groups.google.com/group/rubyonrails-talk

HTH,

I wish I saw that earlier.

Anyway, I did not find a lot of documentation about it, and so I did
test myself.

I created today a gem "app2engine" to convert the skeleton of a Rails
app to an Engine.

It seems very similar to enginex about the concept.

I use the standard path (so app/controllers for controllers), and so I
think it is using less configuration stuff.

Please have a look at it and file an issue if something goes wrong ;)

Benoit Daloze

(Sorry for the noise on the Ruby list, I did not find the post on
rubyonrails-talk)
 
H

H.J. Blok

Benoit said:
Anyway, I did not find a lot of documentation about it, and so I did
test myself.

I created today a gem "app2engine" to convert the skeleton of a Rails
app to an Engine.

Yeah this one works. Enginex probably also works, but I simply don't
understand how to use it.
I use the standard path (so app/controllers for controllers), and so I
think it is using less configuration stuff.

Please have a look at it and file an issue if something goes wrong ;)

Great it works, thanks!

Harm-Jan
 
R

Ryan Davis

I've a question about Rails 3 Engines. I'm looking everywhere for good
documentation on this subject, but didn't find it.

please send such queries in the future to the rails mailing list/forum.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top