lib/restpack_activity/models/activity.rb in restpack_activity-0.0.5 vs lib/restpack_activity/models/activity.rb in restpack_activity-0.0.7

- old
+ new

@@ -11,11 +11,11 @@ super(params) end def self.get(id) response = service.get(id) - Activity.new(response.result) + Activity.new(response.result[:activities].first) end def self.destroy(id) service.destroy(id) true @@ -73,10 +73,11 @@ def persisted? !new? end def update_attributes(params) + #TODO: GJ: extract into base class #TODO: whitelist updateble params @title = params[:title] if params[:title] @content = params[:content] if params[:content] @latitude = params[:latitude] if params[:latitude] @longitude = params[:longitude] if params[:longitude] @@ -95,22 +96,23 @@ end private def attributes + #TODO: GJ: extract into base class #TODO: GJ: only those that have changed hash = { id: @id, application_id: @application_id, user_id: @user_id, title: @title, content: @content, - data: @data, tags: @tags.join(','), access: @access.join(',') } hash[:latitude] = @latitude unless @latitude.blank? hash[:longitude] = @longitude unless @longitude.blank? + hash[:data] = @data unless @data.blank? hash end end