top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Require or include page in ruby on rails

+5 votes
97 views

I want to make just simple back End to my first Ruby application, so I want to make header and include it to all of the pages in this back end

So how I can make require or include to simple Html page in ruby (this page just I want to set some links in it)

in Php we just make page and require or include it by
require("my_page_name.php")
or
include("my_page_name.php")

How we can make that in Ruby on Rails.

posted Feb 2, 2014 by Dewang Chaudhary

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Have a look at partials, that should do what you want. If you have not already done so then work through railstutorial.org. The use of partials is covered there, as well as lots of other good stuff.

answer Feb 2, 2014 by Kumar Mitrasen
Similar Questions
+3 votes

In the following code -

 require 'active_record'

 class Order < ActiveRecord::Base
 end

 order = Order.find(1)
 ...

As per http://api.rubyonrails.org/ find() is an instance public method. So why can we call Order.find(1) here? Shouldn't it be Order.new.find(1)?

+1 vote

We recently looked at mongoDB a bit. I was discussing using mongoDB with active record but was told that maybe there are other or better options. Can someone comment on that ?

Also, someone suggested storing a ruby array directly inside of a record where I would have opted for the array to be a separate set of records in active record using has_many and belongs_to .. It seemed to me that how I search on those child records would be a big factor but I soon realized I need to find out what are the options. Do people store arrays and hashes directly in mongo DB fields or is that not the best way to go ?

...