Hi *,
I''m trying to develop a plugin, but I''m having some problems
integrating it in Rails.
The first problem is when I need to load the environment: I would like the
plugin to be installable in the classic way (under /vendor) and as a gem. Right
now I''m using something like
require File.join( File.dirname( __FILE__ ), ''..'',
''..'', ''..'', ''..'',
''config'', ''environment'' )
but of course I don''t think it will work as a gem. How can I require
the env to have it work in both ways ?
The other problem I''m facing is when I try to have the plugin to
include itself inside ActionController (an example can be login_required of
restful authentication).
This is what I''m trying to do:
$:.unshift File.expand_path( File.dirname( __FILE__ ) )
require ''charon/class_methods''
module Charon
#some stuff
end
ActionController::Base.send :include, Charon::CharonClassMethods
and in charon/class_methods
module Charon
module CharonClassMethods
def self.included base
base.send :extend, Charon::CharonClassMethods::ClassMethods
end
module ClassMethods
def authentication_url
# implementation
end
end
end
end
What I don''t understand where I should include the main application,
how to load rails and when (I can require ActionController in the first file but
it doesn''t feel right ...) and what to put inside hte various
initialization files.
If someone knows of a plugin with specs that I can copy I would be very glad.
It''s not that I don''t find them, but every plugin I find does
things in a different way, so it''s not entirely clear which way is the
best one.
TIA,
ngw
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.