I’m trying to get a simple authentication system going for a small rails
app.
After much research, it looks like LoginEngine should do exactly what I
want.
Now, the documentation is somewhat confusing to me when looked at in the
light
of reality. There are some places that say you have to install the
“engines”
plugin. But, I cannot find such a beast.
So, I installed the login_engine plugin. When I try to configure it as
it
says, I get: “./script/…/config/…/config/environment.rb:56: undefined
method `config’ for LoginEngine:Module (NoMethodError)”
And sure enough, if I look through the LoginEngine code, I can find no
trace
of a config method. So I must be missing something.
If I need the engines plugin, where can I find a released one? If it’s
something else, what is it?
Thanks.
David
P.S.
I’m using Rails HEAD - one week because of habtm bug that has been
fixed, if
that’s relevant.
The specific issue you are having is because the ‘config’ method is
provided by the engines plugin - you need to install it. Normally
that installation would be the typical one for any plugin, using the
‘script/plugin’ command.
In a nutshell, you can’t use the ‘official’ release – it works with
the ‘official’ Rails release, and things have changed a great deal on
the Edge. You need to do this to get the bleeding edge engines plugin:
Well, all that make sense. However, I continue to have problems. To
keep
thing simple, I’ve rolled back my vendor/rails to stable, and then
applied a
patch for the one bug that was causing me grief (multiple HABTMs in one
model).
Then I installed engines and login_engine plugins in the normal way.
I followed the README to the best of my ability, and when I run any rake
task
(like rake import_login_engine_schema, or rake engine_info) I get this:
undefined method config' for Rails::Initializer::LoginEngine:Module ./config/../vendor/rails/railties/lib/initializer.rb:183:inload_environment’
./config/…/vendor/rails/railties/lib/initializer.rb:155:in load_environment' ./config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/kernel.rb:27:insilence_warnings’
./config/…/vendor/rails/railties/lib/initializer.rb:152:in load_environment' ./config/../vendor/rails/railties/lib/initializer.rb:81:inprocess’
./config/…/vendor/rails/railties/lib/initializer.rb:42:in run' ./config/../config/environment.rb:10 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
./config/…/vendor/rails/railties/lib/tasks/misc.rake:9
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:inexecute’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:179:ininvoke’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:827:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:179:ininvoke’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in run' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:inrun’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7
/usr/bin/rake:18
the config method not being found indicates to me that the engines
plugin itself isn’t being loaded
the fact that the error occurs for the module
Rails::Initializer::LoginEngine makes it sound like you’ve put the
LoginEngine config inside the initializer loop.
Try moving that chunk of code, along with the Engines.start call, to
the very bottom of your environment.rb, and in particular outside of
any blocks.
the config method not being found indicates to me that the engines
plugin itself isn’t being loaded
I’m reasonably sure it is (I added a $stderr.puts), but I might have put
it in
the wrong place.
the fact that the error occurs for the module
Rails::Initializer::LoginEngine makes it sound like you’ve put the
LoginEngine config inside the initializer loop.
I don’t have my code handy to verify, but I think it is outside the
loop. I
also tried saying “::LoginEngine”, and while the module name changed in
the
error, it did not go away.
Try moving that chunk of code, along with the Engines.start call, to
the very bottom of your environment.rb, and in particular outside of
any blocks.
I’ll double check all of that stuff tonight though…
If you want to add configuration in the environment/* files, you
unfortunately need to use the CONFIG hash directly, i.e.
module LoginEngine
CONFIG ||= {}
CONFIG[:salt] = ‘whatever’
end
This is because these files are evaluated before any plugins are
loaded, so the ‘config’ method isn’t available yet. They may also be
evaluated within the context of Rails::Initializer, so you might need
to address the top-level module ::LoginEngine.
this: undefined method config' for ./config/../vendor/rails/railties/lib/initializer.rb:42:in run’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in `run’
that installation would be the typical one for any plugin, using the
cd vendor/plugins
rails app. After much research, it looks like LoginEngine should do
And sure enough, if I look through the LoginEngine code, I can find
I’m using Rails HEAD - one week because of habtm bug that has been
~
–
On Wednesday 01 March 2006 03:12 pm, James A. wrote:
the LoginEngines Mailing list page has been spammed, making it hard
to sign
up (or even know who to tell).
Lastly (hah!), a few questions.
are the created_at and updated_at really necessary? Will it work fine
without them?
I’m going to migrate existing user data to the LoginEngine. I
presume I
should set the salt column to match my configured salt. What I’d like
to do,
is force users to reset their passwords, by having a ‘token’ mailed to
them.
Any tips?
Is role used in any particular manner?
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.