Forum: Ruby on Rails Two classes in one program.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tushar G. (Guest)
on 2009-01-15 15:27
Hi,
 Is it possible to write two class in one controller?
e.g:-

class ApplicationController < ActionController::Base
  def abc
  end
end
class Hash
 def xyz
 end
end

How it will work?

Thanks,
Tushar.
Frederick C. (Guest)
on 2009-01-15 15:42
(Received via mailing list)
On 15 Jan 2009, at 13:27, Tushar G. wrote:

> def xyz
> end
> end
>

A file can define as many classes as you want. Rails' automatic
loading of files for you will only be able to locate a class if it is
in the file with the appropriate name.

Fred
This topic is locked and can not be replied to.