RESTful membership

Posted by FoxDemon on Stack Overflow See other posts from Stack Overflow or by FoxDemon
Published on 2010-05-04T11:26:32Z Indexed on 2010/05/04 11:48 UTC
Read the original article Hit count: 324

Filed under:
|
|

I am currentlly trying to design a RESTful MembershipsController. The controller action update is used only for promoting, banning, approving,... members. To invoke the update action the URL must contain a Parameter called type with the appropriate value. I am not too sure if that is really RESTful design. Should I rather introduce sepearate actions for promoting,... members?

class MembershipsController < ApplicationController
 def update
    @membership= Membership.find params[:id]
    if Membership.aasm_events.keys.include?(params[:type].to_sym) #[:ban, :promote,...]     
      @membership.send("#{params[:type]}!")
      render :partial => 'update_membership'
    end
  end
end

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rest