Same file in different apps

Well say if i need app/models/abc.rb of an existing application ABC into
new application DEF, then what all i need to do? There are so many files
i need to be shared but did'nt have any fair idea how to get it.

So rubians :), please help me on it. I think writing plugin is a fair
idea.

Hemant Bhargava wrote in post #985888:

So rubians :), please help me on it. I think writing plugin is a fair
idea.

Now, i thought of writing a plugin. So steps i done:-
1) Creates new rails app.
2) Creates plugin using ./script/generate plugin "NAME".
     This will create necessary files in vendor/plugins/"NAME" dir.
3) Changed vendor/plugins/"NAME"/init.rb to include the lib file.
(/lib/"NAME".rb)

4) My lib/"NAME".rb looks like this.
     module "NAME"
       def hello
         return "hello"
       end
       def world
         return "world"
       end
     end
5) Creates a model and included the plugin into that model using
require.
     require "NAME"
I think this all is OK upto now. But after it when i go to console and
type NAME.hello why does'nt it work.. It should work, right? Or i am
missing something.

Can anyone out there light me up :slight_smile:

Why don’t you just copy the model over to your new application?

B.

Falling at the last hurdle - if you want to add a module's method to a
class you need to use include (require just loads the file containing
the module - it doesn't then do anything with that module). You can
then do SomeClass.new.hello

Fred