Skip to content

Instantly share code, notes, and snippets.

@petrokoriakin
Created April 20, 2012 11:36
Show Gist options
  • Save petrokoriakin/2427949 to your computer and use it in GitHub Desktop.
Save petrokoriakin/2427949 to your computer and use it in GitHub Desktop.
code sample
class AvailabilityController < ApplicationController
before_filter :set_current_customer
before_filter :update_customer_status
def statuses
statuses_collection = @current_customer.collect_statuses
render :json => {
:partnerStatuses => statuses_collection,
}
end
def actualize
render :nothing => true
end
def set_status
if partner_status = @current_customer.partner_statuses.where(:partner_id => params[:partnerID]).first
partner_status.update_attributes(:status => PartnerStatus.parse_status_string(params[:status]), :recent_activity => Time.now.to_i)
else
@current_customer.partner_statuses.create(:status => PartnerStatus.parse_status_string(params[:status]), :partner_id => params[:partnerID], :recent_activity => Time.now.to_i)
end
render :nothing => true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment