Skip to content

Instantly share code, notes, and snippets.

@rderoldan1
Created February 21, 2012 01:32
Show Gist options
  • Save rderoldan1/1872821 to your computer and use it in GitHub Desktop.
Save rderoldan1/1872821 to your computer and use it in GitHub Desktop.
admin way

The way to create an admin view

first you have the resource like this /users, but you like admin the resources in that way /admin/users.

rails g controller admin/users Then you get a file like this

class Admin::UsersController < ApplicationController _put your code here_ end

  • config your routes
  • write a view

the links appear like that link_to "View all users", admin_users_path

Thanks to

  1. Purple Works.
  2. RUBY FLEEBIE.
<%form_for [:admin, @user] do |f|%>
<%=f.text_field :title%>
<%=f.submit "Save"%>
<%end%>
resources :users, :only => [:index, :show]
namespace :admin do
resources :users
end
@jvelezpo
Copy link

<%form_for [:admin, @user] do |f|%>
nice nice
rails rulez!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment