# Acts\_as\_authenticated + authorization plugin = Can only rend

**URL:** <https://www.ruby-forum.com/t/acts-as-authenticated-authorization-plugin-can-only-rend/90843>\
**Category:** Rails\
**Created:** [April 2, 2007, 9:55am UTC](https://www.ruby-forum.com/t/acts-as-authenticated-authorization-plugin-can-only-rend/90843 "2007-04-02T09:55:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![razy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@razy](https://www.ruby-forum.com/u/razy)\
**Post date:** [April 2, 2007, 9:55am UTC](https://www.ruby-forum.com/t/acts-as-authenticated-authorization-plugin-can-only-rend/90843/1 "2007-04-02T09:55:37Z")

</div>

Hi all,

I’ve got a strange trouble with those plugins in subject.  
Im new in rails and just trying to get some basic things working  
before proceeding to something more complicated.  
So here is the step-by-step descirption of what i did:  
$ mysqladmin create auth\_development  
$ rails auth  
$ ./script/plugin install  
[http://svn.techno-weenie.net/projects/plugins/acts\_as\_authenticated](http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated)  
$ ./script/plugin install  
[http://svn.writertopia.com/svn/plugins/authorization](http://svn.writertopia.com/svn/plugins/authorization)  
$ ./script/generate authenticated user account  
$ ./script/generate role\_model role  
$ rake db:migrate

added following to my environment.rb:  
AUTHORIZATION\_MIXIN = “object roles”  
DEFAULT\_REDIRECTION\_HASH = { :controller =\> ‘account’, :action =\>  
‘login’ }

added those to my user model:  
acts\_as\_authorized\_user  
acts\_as\_authorizable

and this to my account controller  
def secure\_info  
permit “admin”  
render :text =\> “you’re admin if you can read this.”  
end

def for\_testers  
permit “admin or tester”  
render :text =\> “you’re admin or tester if you can read this.”  
end

def for\_noone  
permit “noone”  
render :text =\> “you shouldnt be able to read this.”  
end

def add\_sample\_roles  
current\_user.has\_role “tester”  
current\_user.has\_role “admin”  
current\_user.save!  
redirect\_to :index  
end

$ ./script/server

(signed up as a new user, login, go to add\_sample\_roles)  
now i can visit secure\_info and for\_testers okay, but when i try to  
visit for\_noone i didnt get the right error message like permission  
denied but this one:  
Can only render or redirect once per action

## with this session dump:

:return\_to:  
:user: 1  
flash: !map:ActionController::Flash::FlashHash  
:notice: Permission denied. Your account cannot access the requested  
page.

so how do i fix that?  
hope i gave enough details on it

---

<div class="post-metadata">

**Author:** ![razy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@razy](https://www.ruby-forum.com/u/razy)\
**Post date:** [April 2, 2007, 10:28am UTC](https://www.ruby-forum.com/t/acts-as-authenticated-authorization-plugin-can-only-rend/90843/2 "2007-04-02T10:28:39Z")

</div>

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/base.rb:708:in `render_with_no_layout' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/layout.rb:256:in`render\_without\_benchmark’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/benchmarking.rb:50:in `render' /usr/local/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/benchmarking.rb:50:in `render' app/controllers/account_controller.rb:56:in`for\_someone’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/base.rb:1095:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:1095:in`perform\_action\_without\_filters’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/filters.rb:632:in `call_filter' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:638:in`call\_filter’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/filters.rb:438:in `call' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:637:in`call\_filter’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/filters.rb:619:in `perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/benchmarking.rb:66:in`perform\_action\_without\_rescue’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/rescue.rb:83:in `perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:430:in`send’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/base.rb:430:in `process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/filters.rb:624:in`process\_without\_session\_management\_support’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/  
action\_controller/session\_management.rb:114:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/base.rb:330:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in  
`dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 78:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb:  
76:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/rails.rb: 76:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:618:in  
`process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in`each’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:617:in  
`process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in  
`initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in`new’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:736:in  
`run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in`initialize’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in  
`new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel.rb:720:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/  
configurator.rb:271:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/ configurator.rb:270:in`each’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/  
configurator.rb:270:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails: 127:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel/command.rb:  
211:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.0.1/bin/mongrel_rails:243 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:488:in`load’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:342:in`new\_constants\_in’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/ mongrel.rb:60 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`gem\_original\_require’  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:495:in`require’  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/  
active\_support/dependencies.rb:342:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:495:in`require’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:  
39  
/usr/local/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
script/server:3
