简体   繁体   中英

How can I add my controllers and views in a plugin for rails

I am trying to make a test plugin . Although I am able to add methods to activerecord from my plugin , but I am not able to define a controller and view in my plugin .
I thought , I would just inherit from ActionController::Base and then define a route and it would reach my plugin but that does not seems to work .

Do I need to do anything special to have requests come to the controller class written in my plugin and be able to render views with javascript etc from my plugin itself ?

I see that there are a lot of plugin like newrelic etc that do this , so it should be possible . I tried to explore newrelics , but it seems to a lot of thing and is quite complicated .

Please advise .

This can be done with rails engines. There is a railscast about this topic: http://railscasts.com/episodes/149-rails-engines

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM