Created
September 11, 2012 13:13
-
-
Save michiels/3698360 to your computer and use it in GitHub Desktop.
Survey save 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 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