Skip to content

Instantly share code, notes, and snippets.

@michiels
Created September 11, 2012 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michiels/3698360 to your computer and use it in GitHub Desktop.
Save michiels/3698360 to your computer and use it in GitHub Desktop.
Survey save sample
class Survey
include ActiveModel::AttributeMethods
define_attribute_methods ['code', 'description']
attr_accessor :code, :description
def save
# Roept de API aan via Faraday en update de velden
connection.post do |req|
req.url '/survey'
req.headers['Content-Type'] = 'application/json'
req.body = {:survey => {:code => self.code, :description => self.description}}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment