Forum: Ruby on Rails 'Admin::UsersHelper' is already used problem

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.
13d7a3ab12ec57e0d372d7115362cb91?d=identicon&s=25 comopasta Gr (comopasta)
on 2008-10-07 23:51
Hi,

I'm getting the next error:

The name 'Admin::UsersHelper' is either already used in your application
or reserved by Ruby on Rails.

When trying to run:
ruby script/generate controller Admin::Users

I've done something similar with Rails 2.0 with no problems. I have
Rails 2.1.1 now.

Tried to google but found no hints. Just that I'm not the only one with
similar problem.

Any ideas how to fix it?

Thanks
Eecd295cdec2454c66e2015036a39408?d=identicon&s=25 Scott Nj (scottnj)
on 2008-10-08 03:14
(Received via mailing list)
i had the same problem. i am not sure what is causeing the error. what
i did was use a name different than users. i used
Admin::AccountsHelper which worked fine.

On Oct 7, 5:51 pm, comopasta Gr <rails-mailing-l...@andreas-s.net>
23e4fc3add5443f51e55663cfc245d24?d=identicon&s=25 Erol Fornoles (Guest)
on 2008-10-08 03:52
(Received via mailing list)
On Oct 8, 5:51 am, comopasta Gr <rails-mailing-l...@andreas-s.net>
wrote:
> I've done something similar with Rails 2.0 with no problems. I have
> Rails 2.1.1 now.
>
> Tried to google but found no hints. Just that I'm not the only one with
> similar problem.
>
> Any ideas how to fix it?
>
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.

Try using:

script/generate controller admin/users
A82ba1167f4d4a8d1de63820e576a87f?d=identicon&s=25 Robby Russell (Guest)
on 2008-10-08 07:38
(Received via mailing list)
Do you happen to have a model named Admin?

On Tue, Oct 7, 2008 at 6:51 PM, Erol Fornoles <erol.fornoles@gmail.com>
wrote:
>> When trying to run:
>> Thanks
>> --
>> Posted viahttp://www.ruby-forum.com/.
>
> Try using:
>
> script/generate controller admin/users
> >
>



--
Robby Russell
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting

http://www.planetargon.com/
http://www.robbyonrails.com/
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]
23e4fc3add5443f51e55663cfc245d24?d=identicon&s=25 Erol Fornoles (Guest)
on 2008-10-08 08:03
(Received via mailing list)
On Oct 8, 1:37 pm, "Robby Russell" <ro...@planetargon.com> wrote:
> Do you happen to have a model named Admin?

Nvm what I just said earlier. It's a confirmed bug:

http://rails.lighthouseapp.com/projects/8994/tickets/545

One way I found around it is to temporarily rename the helper with the
same name on the parent namespace before running the script/generate.
2927af2b9ddd2f3f34b316755b8f4dfb?d=identicon&s=25 comopasta Gr (dgj)
on 2008-10-08 08:20
Erol Fornoles wrote:
> On Oct 8, 1:37?pm, "Robby Russell" <ro...@planetargon.com> wrote:
>> Do you happen to have a model named Admin?
>
> Nvm what I just said earlier. It's a confirmed bug:
>
> http://rails.lighthouseapp.com/projects/8994/tickets/545
>
> One way I found around it is to temporarily rename the helper with the
> same name on the parent namespace before running the script/generate.
13d7a3ab12ec57e0d372d7115362cb91?d=identicon&s=25 comopasta Gr (comopasta)
on 2008-10-08 08:23
Hi,

Thanks for the replies.

> One way I found around it is to temporarily rename the helper with the
> same name on the parent namespace before running the script/generate.

Erol how did you actually renamed it? I tried and complains about some
dependencies.

C:\InstantRails\rails_apps\test>ruby script/generate scaffold Problem
bug:string
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/problems
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      exists  public/stylesheets/
      create  app/views/problems/index.html.erb
      create  app/views/problems/show.html.erb
      create  app/views/problems/new.html.erb
      create  app/views/problems/edit.html.erb
      create  app/views/layouts/problems.html.erb
      create  public/stylesheets/scaffold.css
      create  app/controllers/problems_controller.rb
      create  test/functional/problems_controller_test.rb
      create  app/helpers/problems_helper.rb
       route  map.resources :problems
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/problem.rb
      create    test/unit/problem_test.rb
      create    test/fixtures/problems.yml
      create    db/migrate
      create    db/migrate/20081008061905_create_problems.rb

C:\InstantRails\rails_apps\test>ruby script/generate controller
Admin::Problems
  The name 'Admin::ProblemsHelper' is either already used in your
application or reserved by Ruby on Rails.
  Please choose an alternative and run this generator again.

-----------

How would you remane the helper in the above test?

Thanks!
23e4fc3add5443f51e55663cfc245d24?d=identicon&s=25 Erol Fornoles (Guest)
on 2008-10-08 08:39
(Received via mailing list)
On Oct 8, 2:23 pm, comopasta Gr <rails-mailing-l...@andreas-s.net>
wrote:
> C:\InstantRails\rails_apps\test>ruby script/generate scaffold Problem
>       create  app/views/problems/show.html.erb
>       exists    test/unit/
> application or reserved by Ruby on Rails.
>   Please choose an alternative and run this generator again.
>
> -----------
>
> How would you remane the helper in the above test?
>
> Thanks!
>
> --
> Posted viahttp://www.ruby-forum.com/.

I'm assuming you already have non-namespaced ProblemsController - and
corresponding ProblemsHelper.

Rename problems_helper.rb to problems_helper.rb.bak in your app/
helpers directory.
Run your generate script.
Rename problems_helper.rb.bak to its original name.

HTH
13d7a3ab12ec57e0d372d7115362cb91?d=identicon&s=25 comopasta Gr (comopasta)
on 2008-10-08 09:30
> Rename problems_helper.rb to problems_helper.rb.bak in your app/
> helpers directory.
> Run your generate script.
> Rename problems_helper.rb.bak to its original name.

Yeah, now it went through.

Thanks!
A1b97dafea62b11e7b3bef338ce3fe83?d=identicon&s=25 Billy Hsu (cfc)
on 2008-10-23 16:03
(Received via mailing list)
in application.rb

comment "helper :all" and run again.
Like this:

class ApplicationController < ActionController::Base
  #helper :all # include all helpers, all the time
end

On 10$B7n(B8$BF|(B, $B>e8a(B5$B;~(B51$BJ,(B, comopasta Gr
<rails-mailing-l...@andreas-s.net>
19b51771fdf4ddfca60ff7b51b5f42c8?d=identicon&s=25 Dave Furf (furf)
on 2008-12-08 02:54
I had the same problem setting up my categories, so I wiped them out and
then scaffolded the admin before the frontend app and it worked
perfectly.

ruby script/generate scaffold Admin::Categories name:string
parent_id:integer lft:integer rgt:integer

ruby script/generate scaffold Categories name:string parent_id:integer
lft:integer rgt:integer
19b51771fdf4ddfca60ff7b51b5f42c8?d=identicon&s=25 Dave Furf (furf)
on 2008-12-08 03:14
Update... not so perfectly at first...

1. It was Category not Categories

ruby script/generate scaffold Admin::Category name:string
parent_id:integer lft:integer rgt:integer

ruby script/generate scaffold Category name:string parent_id:integer
lft:integer rgt:integer

2. I had to go into the admin controller and views and remove Admin::
and admin_ from everywhere but the controller class declaration.

3. Also... I think I'm gonna delete the generated Admin::Category class.

I have to wonder if there's not a better way... oh well, newbie must
learn.





Dave Furf wrote:
> I had the same problem setting up my categories, so I wiped them out and
> then scaffolded the admin before the frontend app and it worked
> perfectly.
>
> ruby script/generate scaffold Admin::Categories name:string
> parent_id:integer lft:integer rgt:integer
>
> ruby script/generate scaffold Categories name:string parent_id:integer
> lft:integer rgt:integer
This topic is locked and can not be replied to.