Created
April 20, 2012 11:36
-
-
Save petrokoriakin/2427949 to your computer and use it in GitHub Desktop.
code sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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