Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def index
- @clients = Client.find(:all, :visible_to => requester)
- respond_to :last_modified_at => @clients.maximum(:updated_at) do |format|
- format.html { }
- format.any(:sskj1, :ssj) { }
- end
- end
- def show
- @client = Client.find(params[:id], :visible_to => requester)
- respond_to :last_modified_at => @client.updated_at do |format|
- format.html { }
- format.any(:sskj1, :ssj) { }
- end
- end
- def new
- @client = Client.new
- raise NotPermittedError unless requester.may_create? Client
- respond_to :html
- end
- def create
- munge_json_params!
- @client = Client.new(params[:client])
- raise NotPermittedError unless requester.may_create? @client
- respond_to do |wants|
- if @client.save
- wants.html { redirect_to client_url(@client) }
- wants.any(:ssj, :sskj1) { head(:created, :location => client_url(@client)) }
- else
- wants.html { render :action => 'new' }
- wants.any(:ssj, :sskj1) { raise ActiveRecord::RecordInvalid, @client }
- end
- end
- end
- def edit
- @client = client
- raise NotPermittedError unless requester.may_modify? @client
- respond_to :html, :last_modified_at => @client.updated_at
- end
- def update
- @client = client
- raise NotPermittedError unless requester.may_modify? @client
- munge_json_params!
- @client.update_attributes!(params[:client])
- respond_to do |wants|
- wants.html { redirect_to client_url(@client) }
- wants.any(:sskj1, :ssj) { head(:ok) }
- end
- end
Add Comment
Please, Sign In to add comment