Forum: Ruby on Rails undefined local variable or method `current_user' for

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.
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-09 14:03
(Received via mailing list)
Hi All,          I am using a Plugin mdarby-restful_acl with
restful_authentication and I am following the procedure form
http://github.com/mdarby/restful_acl/tree/master , but I am getting some
irritating error "undefined local variable or method `current_user'
for", I
know I am missing something but I dont know what?
Can anybody help me regarding this?

Shahroon
9cf6e7f81d4339295b86e5fb7d7df49b?d=identicon&s=25 Vishwanath Nayak (nayak)
on 2009-01-09 14:05
(Received via mailing list)
Hi,

generally plugins require methods like current_user implemented in
application.rb for integration purposes.
This method should return an object of the user

NAYAK

On Fri, Jan 9, 2009 at 6:33 PM, shahroon ali <shahroon.ali@gmail.com>
wrote:

>
--
- NAYAK
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-09 14:10
(Received via mailing list)
Okay, but could you please explain it in detail, I mean what I have to
define in application.rb and how to define? And whats the whole
procedure?
Thanks in advance
Shahroon
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-09 14:59
(Received via mailing list)
that depends on your plugin. did you follow all the instructions in
README? what's your complete error-trace? where does the error occurr?
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-09 15:10
(Received via mailing list)
undefined local variable or method `current_user' for
#<OpportunityController:0x3c8d02c>

vendor/plugins/mdarby-restful_acl/lib/restful_acl.rb:11:in
`has_permission?'

C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:469:in
`send!'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:469:in
`call'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:441:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:716:in
`run_before_filters'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:695:in
`call_filters'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in
`perform_action'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
`cache'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in
`cache'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
`perform_action'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`send'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
`process_without_filters'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
`process'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in
`process'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
`handle_request'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in
`dispatch'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in
`dispatch'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:76:in
`process'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in
`synchronize'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in
`process'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:159:in
`process_client'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in
`each'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in
`process_client'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
`initialize'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
`new'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in
`initialize'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in
`new'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:282:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:281:in
`each'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:281:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:128:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/command.rb:212:in
`run'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:281
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
`load'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
`load'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
`new_constants_in'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
`load'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
`require'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
`new_constants_in'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
`require'
C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
script/server:3

When I tried to add this row

# In environment.rb:
config.gem "mdarby-restful_acl", :lib => 'restful_acl'

in my environment.rb file it stopped my server. After commenting this
line I got the above mentioned error. I am getting this when ever I
put this line in my controller

before_filter :has_permission?

And this is really disturbing.

Thanks again,

Shahroon
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-09 15:18
(Received via mailing list)
it's always hard to guess, what could be the problem in other people's
code, so excuse me for asking:
did you install the gem "mdarby-restful_acl"? (= does it show up on
"gem list"?)

# In environment.rb:
config.gem "mdarby-restful_acl", :lib => 'restful_acl'
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-09 15:23
(Received via mailing list)
another one:
did you install the restful_athentication plugin first?
http://techno-weenie.net/2006/8/1/restful-authenti...

even if you installed the "mdarby-restful_acl" gem or plugin you'll
need the restful_authentication-plugin anyways.
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-09 15:27
(Received via mailing list)
No problem at all, in fact you are helping me a lot.Well I have
installed
my gem "mdarby-restful_acl" and its installation was completed
successfully.
And I have downloaded the auhthentication_acl as well and I think its
installation had some problems and I just put that whole plugin directly
into my vendor/plugin folder.
Shahroon
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-09 15:43
(Received via mailing list)
> And I have downloaded the auhthentication_acl as well and I think its
> installation had some problems and I just put that whole plugin directly
> into my vendor/plugin folder.

what do you mean by "some problems"? the current_user-functionality is
provided by "restful_authentication"-plugin. if there are unsolved
problems, you should absolutely take care of them.
here is the latest version:
http://github.com/technoweenie/restful-authenticat...
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-09 16:05
(Received via mailing list)
Yeah I checked it was installed properly, there was no error in
installing
it, i was just mistaken.
2adcab94830cc4abd3610984fbe5225c?d=identicon&s=25 Matt Darby (mdarby)
on 2009-01-11 07:34
shahroon ali wrote:
> Yeah I checked it was installed properly, there was no error in
> installing
> it, i was just mistaken.

I wrote RESTful_ACL; are you using restful_authentication (like followed
their directions), or did you just install it a plugin?

This error indicates that you're not actually using
restful_authentication
9a2a53db8e9b4476038c94a64b32833f?d=identicon&s=25 Ryan Bigg (ryan-bigg)
on 2009-01-11 14:56
(Received via mailing list)
He's missing include AuthenticatedSystem from application.rb
-----
Ryan Bigg
Freelancer
http://frozenplague.net
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-12 15:41
(Received via mailing list)
Thanks everyone, you helped me a lot in solving my problem. Now
restful_authentication is working fine but restful_acl isn't, I am
following
the instructions written here
http://github.com/mdarby/restful_acl/tree/master but when ever i add
this
line of code

config.gem "mdarby-restful_acl", :lib => 'restful_acl'

in my environment.rb file my server doesn't start. And whenever I
comment
this line and then restart my server it works but the controller with
has_permission? doesn't work. It takes me to denied page.
   Please help me in solving this issue.
Thanks & Regards,
Shahroon
80e4cb97cae5c8d745f72337d93fd8f2?d=identicon&s=25 MaD (Guest)
on 2009-01-12 16:15
(Received via mailing list)
do you have any console output, error message, log entry or whatsoever?
5b6e58cabeba80bc6faf29b7f45aa622?d=identicon&s=25 shahroon ali (Guest)
on 2009-01-13 12:42
(Received via mailing list)
It has been solved, everything is fine and working now. Once again
thanks
everyone.
Thanks & Regards,

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