pnhthuan pnhthuan - 4 months ago 10
Ruby Question

How to make a Rails application global?

Currently, I am working on a website using Ruby on Rails, the website has many small applications for example full calendar, chat session, user verification etc. I created a new application recently called Todo list which acts as a reminder very simple. It currently has its own page

my_link/todo_lists
.

How do I make it in such a way that instead of just appearing on the
#index
page it shows up everywhere on the website? I have tried to
require 'todo_lists'
but I get the error:



"cannot load such file -- todo_lists"


I tried copying all the files into the layouts folder (a feeble attempt). That gives me:

"Missing templates ....."


I tried to render partial (Not sure how it works)

Again "Missing templates" or "no_load_to_path" error

If possible I want it to appear like that of a Facebook chat bar, the very least is call the same thing but on a different page.

Answer

You can create an ERB partial inside layouts/_sidebar.html.erb and then in your application.html.erb you render the partial with:

  <%= render 'layouts/sidebar' %>

This will make it appear in all the application (assuming you have only one main layout)

Comments