Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
Create admin sections
3 Posts
Create admin sections

Hello, i'm just creating my first APP.

i'm folowing this screencast from railscast http://railscasts.com/episodes/19-where-administration-goes i was trying to setup ad administration secition for a pages module:

ruby script/generate scaffold pagina 'admin/paginas'

this is supposed to generate scaffold for "pagina" right? and i get this when tried it:

  exists  app/models/
  exists  app/controllers/
  exists  app/helpers/
  exists  app/views/paginas
  exists  app/views/layouts/
  exists  test/functional/
  exists  test/unit/
  exists  test/unit/helpers/
  exists  public/stylesheets/

wrong number of arguments (1 for 2)

i suppose because this screencast is old, and its not compatible with rails 2.3, right?

can anyone tell mw how to set up an admin section, using the controllers already created? maybe with routes.rb dont know :S

thank you for all.

okay is solved, in part.

maybe in configuration or other file, i can specify wich layout to use on whole admin sections? i mean, in application_controler i have layout 'layout'

but, i want to specify that any controller under 'admin/' use another layout, where i need to specify this?


You can use layout macro in each of the controllers in the admin dir. But you can also create a layout under views/layouts/admin/ if Rails can't find layout by controller name it defaults to the layout that matches current controllers path. You can find details in "Rails Guide":http://guides.rubyonrails.org/layouts_and_rendering.html#creating-responses in first paragraph of section 2.2.12 Finding Layouts

Best of luck,

3 Posts
Login to add your message