Forum: Ruby on Rails LoginEngine problems

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.
David C. (Guest)
on 2006-02-26 18:52
(Received via mailing list)
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.
James A. (Guest)
on 2006-02-26 19:39
(Received via mailing list)
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.

However, because you're tracking the bleeding edge, you need to do a
bit of extra work:
http://rails-engines.org/wiki/pages/Using+Engines+...

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:

  cd vendor/plugins
  svn co http://opensvn.csie.org/rails_engines/engines/trunk engines

Also make *sure* that you follow the instructions in the README (as
goes for anything really) - especially because you are using Edge
Rails.

- james

On 2/26/06, David C. <removed_email_address@domain.invalid> wrote:
>
>
> I'm using Rails HEAD - one week because of habtm bug that has been fixed, if
> that's relevant.
>
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
* J *
  ~
David C. (Guest)
on 2006-03-01 02:55
(Received via mailing list)
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:in
`load_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:in
`silence_warnings'
./config/../vendor/rails/railties/lib/initializer.rb:152:in
`load_environment'
./config/../vendor/rails/railties/lib/initializer.rb:81:in `process'
./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:in `require'
./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:in `execute'
/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:in `invoke'
/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:in `invoke'
/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:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7
/usr/bin/rake:18


Any pointers?
Thanks.
James A. (Guest)
on 2006-03-01 22:12
(Received via mailing list)
Two things:

1) the config method not being found indicates to me that the engines
plugin itself isn't being loaded

2) 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.

- james

On 2/28/06, David C. <removed_email_address@domain.invalid> wrote:
> ./config/../vendor/rails/railties/lib/initializer.rb:183:in `load_environment'
> /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in `execute'
> Any pointers?
> > http://rails-engines.org/wiki/pages/Using+Engines+...
> > Rails.
> > > "engines" plugin.  But, I cannot find such a beast.
> > >
> > > Rails mailing list
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
* J *
  ~
David C. (Guest)
on 2006-03-01 22:51
(Received via mailing list)
On Wednesday 01 March 2006 15:12, James A. wrote:
> Two things:
>
> 1) 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.

> 2) 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...
David C. (Guest)
on 2006-03-02 01:23
(Received via mailing list)
I figured it out.  I also added some configuration to the
environments/development.rb file, which is in fact the source of the
problem.

There are a couple of things that I'd like to vary based on the
environment?
Short of another if statement, any suggestions?
James A. (Guest)
on 2006-03-02 01:52
(Received via mailing list)
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.

- james

On 3/1/06, David C. <removed_email_address@domain.invalid> wrote:
> > plugin itself isn't being loaded
> >
> > > 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
> > > >   ~
> > --
>
--
* J *
  ~
David C. (Guest)
on 2006-03-02 02:04
(Received via mailing list)
On Wednesday 01 March 2006 03:12 pm, James A. wrote:

1) 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.
1) are the created_at and updated_at really necessary? Will it work fine
without them?

2) 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?

3) Is role used in any particular manner?

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