Forum: Ruby on Rails Keyword "Include"

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Feb07800df6c28161148d0aef48b5fca?d=identicon&s=25 Tom (Guest)
on 2007-01-02 19:31
I am using PGPlot in a ruby script.  Ruby has the keywords "require" and
"include" yet Ruby on Rails does not have the "include" keyword.  I want
to insert this script in a controller.  My ruby script starts:

require 'pgplot'
include Pgplot

How do I accomplish the same thing in my RoR controller?
Ac1da5d66d51a1c3b843221032247b30?d=identicon&s=25 Eric Goodwin (Guest)
on 2007-01-02 19:43
(Received via mailing list)
require 'pgplot'
class SomeController < ApplicationController
    include Pgplot
Feb07800df6c28161148d0aef48b5fca?d=identicon&s=25 Tom (Guest)
on 2007-01-02 20:20

Thanks, works perfect now.  I just didn't see that the require keyword
needed to be outside of the controller class.

6d3c187a8b3ef53b08e3e7e8572c4fea?d=identicon&s=25 Jeremy McAnally (Guest)
on 2007-01-02 20:51
(Received via mailing list)
The require keyword includes files in your include path (e.g., lib,
your Ruby load path, and so on).  The include keyword mixes modules
into classes, so it needs to be inside a class to be used. :)


On 1/2/07, Tom <> wrote:
> Posted via
> >

My free Ruby e-book:

My blogs:
This topic is locked and can not be replied to.