links should be followable by programs, engines, bots and people without fear of side-effects. It's a basic, fundamental expectation that is weaved into every strand of the Web
It'd be a shame for Web 2.0 to become detached from the linkable, bookmarkable, indexable, cacheable, parallelisable and interoperable Web 1.0 that we've all built.
POST /people/create GET /people/show/1 POST /people/update/1 POST /people/destroy/1
POST /people GET /people/1 PUT /people/1 DELETE /people/1
| CREATE | READ | UPDATE | DESTROY |
| POST | GET | PUT | DELETE |
class PeopleController < ActionController::Base
# GET /people
def index() end
# GET /people;new
def new() end
# POST /people
def create() end
# GET /people/1
def show() end
# GET /people/1;edit
def edit() end
# PUT /people/1
def update() end
# DELETE /people/1
def destroy() end
endCRUD is not a goal, it's an aspiration, a design technique
class Group < ActiveRecord::Base
has_and_belongs_to_many :users
end
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
end
class UsersController < ActionController::Base
# POST /users/1;join_group?group_id=2
def join_group() end
# POST /users/1;leave_group?group_id=2
def leave_group() end
endclass Group < ActiveRecord::Base
has_many :memberships
has_many :users, :through => :memberships
end
class User < ActiveRecord::Base
has_many :memberships
has_many :groups, :through => :memberships
end
class Membership < ActiveRecord::Base
belongs_to :group
belongs_to :user
end
class MembershipsController < ActionController::Base
# POST /memberships?group_id=1&user_id=2
def create() end
# DELETE /memberships/3
def destroy() end
end