Forum: Ruby on Rails problem with Sentry gem

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.
Bill W. (Guest)
on 2007-03-26 02:15
(Received via mailing list)
I need to encrypt passwords for storage in the db and then decrypt them
for use later.  I just generated a sandbox app to try the Sentry gem
which looks perfect for this.  But I'm getting this error when I access
the app:

undefined method `generates_crypted' for Filepassword:Class

I've got the gem installed.

------ Filepassword.rb contains ---------
class Filepassword < ActiveRecord::Base
  generates_crypted :password, :mode => :symmetric
end

--------- create.rb (the scaffolded controller) contains --------
class CreateController < ApplicationController
  require 'sentry'

  def index
    list
    render :action => 'list'
  end
  # etc... it's all just scaffolding right now
end

----- environment.rb contains ---------
require 'sentry'
Sentry::SymmetricSentry.default_key = "secret_password"

-------- the SQL script contains ---------
drop table if exists filepasswords;
create table filepasswords (
        id                    int                  not null
auto_increment,
        password         varchar(50)     null,
        status              varchar(7)      null default '',
        primary key     (id)
) engine=InnoDB;



I'm running Rails 1.2.2 via Instant Rails 1.5

Anybody with any experience with the Sentry gem see something obvious?
It looks like exactly what I need at the moment, if I could just get it
to work.

Thanks,
Bill
Rick O. (Guest)
on 2007-03-26 02:35
(Received via mailing list)
On 3/25/07, Bill W. <removed_email_address@domain.invalid> wrote:
>
>
> I need to encrypt passwords for storage in the db and then decrypt them for
> use later.  I just generated a sandbox app to try the Sentry gem which looks
> perfect for this.  But I'm getting this error when I access the app:
>
> undefined method `generates_crypted' for Filepassword:Class
>
> I've got the gem installed.

Try the plugin.  http://svn.techno-weenie.net/projects/plugins/sentry/

I quit updating the gems a long time ago when a) the upload script i
was using broke, and b) jamis commited the plugins [RESEARCH] patch.
I suppose I should just take those rubyforge projects down then.

--
Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
Bill W. (Guest)
on 2007-03-26 05:22
(Received via mailing list)
Hi Rick,

> Try the plugin.  http://svn.techno-weenie.net/projects/plugins/sentry/
>
> I quit updating the gems a long time ago when a) the upload script i
> was using broke, and b) jamis commited the plugins [RESEARCH] patch.
> I suppose I should just take those rubyforge projects down then.

Thanks.  Will do.  Awsome tool.  Much appreciated.

Best regards,
Bill
Rick O. (Guest)
on 2007-03-26 05:50
(Received via mailing list)
> Hi Rick,
>
> > Try the plugin.  http://svn.techno-weenie.net/projects/plugins/sentry/
> >
> > I quit updating the gems a long time ago when a) the upload script i
> > was using broke, and b) jamis commited the plugins [RESEARCH] patch.
> > I suppose I should just take those rubyforge projects down then.
>
> Thanks.  Will do.  Awsome tool.  Much appreciated.

Cool, hope it still works.  Patches are welcome if you find it needs a
little freshening up to still look appealing next to the young, hip
rails 1.2 plugins.


--
Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
Bill W. (Guest)
on 2007-03-26 19:04
(Received via mailing list)
I uninstalled the Sentry gem and installed the Sentry plugin.  After
creating a database named sentry_plugin_test, I tried to run the tests
using:

C:\InstantRails-1.5\rails_apps\sandbox>rake test DB=mysql --trace

and am getting:

(in C:/InstantRails-1.5/rails_apps/sandbox)
rake aborted!
no such file to load -- sentry
C:/InstantRails-1.5/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
C:/InstantRails-1.5/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
C:/InstantRails-1.5/rails_apps/sandbox/config/../vendor/plugins/sentry/tasks/sentry.rake:1
C:/InstantRails-1.5/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/tasks/rails.rb:8:in
`load'
....

I found this ticket on Trac from a year ago:
http://dev.rubyonrails.org/ticket/3451  In part, the description reads:

"I ran across this after installing the sentry plugin (that's why
technoweenie is cc'd). Once the plugin was installed, I couldn't run any
rake tasks because "require 'sentry'" in task/sentry.rake blows up when
it
is loaded by railties/lib/tasks/rails.rb. It blows up because the
plugin's
lib directory is not in the load path.  I copied the load path munging
for
plugins out of initializer.rb and put it in railties/lib/tasks/rails.rb
and
everything worked fine."

I could use some help understanding a) what the 'railties' directory is
/
contains as I've not run across it before, and b) if this approach would
work on my hosted VPS system.  The limited ability I have to parse the
above
makes it look to me like the equivalent on my setup would have me
modifying
ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/tasks/rails.rb which I'm
pretty
sure I do not have access to on my hosted system.  Is there some other
way
to fix this?

Any help from anybody with experience using this plugin would be really
appreciated.

Thanks,
Bill
Bill W. (Guest)
on 2007-03-28 16:33
(Received via mailing list)
Hi Rick,

Rick O. wrote:
> little freshening up to still look appealing next to the young, hip
> rails 1.2 plugins.

I uninstalled the Sentry gem and installed the Sentry plugin.  After
creating a database named sentry_plugin_test, I tried to run the tests
using:

C:\InstantRails-1.5\rails_apps\sandbox>rake test DB=mysql --trace

Unfortunately, I am getting:

(in C:/InstantRails-1.5/rails_apps/sandbox)
rake aborted!
no such file to load -- sentry
C:/InstantRails-1.5/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
C:/InstantRails-1.5/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
C:/InstantRails-1.5/rails_apps/sandbox/config/../vendor/plugins/sentry/tasks/sentry.rake:1
C:/InstantRails-1.5/ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/tasks/rails.rb:8:in
`load'
....

I found this ticket on Trac from a year ago:
http://dev.rubyonrails.org/ticket/3451  In part, the description reads:

"I ran across this after installing the sentry plugin (that's why
technoweenie is cc'd). Once the plugin was installed, I couldn't run any
rake tasks because "require 'sentry'" in task/sentry.rake blows up when
it
is loaded by railties/lib/tasks/rails.rb. It blows up because the
plugin's
lib directory is not in the load path.  I copied the load path munging
for
plugins out of initializer.rb and put it in railties/lib/tasks/rails.rb
and
everything worked fine."

Does this look like the same problem I'm having?  If so, I could use
some
help understanding a) what the 'railties' directory is / contains as
I've
not run across it before, and b) if this approach would work on my
hosted
VPS system.  My admittedly limited ability to parse the above makes me
think
the equivalent on my setup would have me modifying
ruby/lib/ruby/gems/1.8/gems/rails-1.2.2/lib/tasks/rails.rb which I'm
pretty
sure I do not have access to on my hosted system.  Is there some other
way
to fix this?

Any help using this plugin would be really appreciated.

Thanks,
Bill
This topic is locked and can not be replied to.