Skip to content

Instantly share code, notes, and snippets.

@a-suenami
Created November 25, 2015 10:22
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 a-suenami/f288e9be54b0584ffd5c to your computer and use it in GitHub Desktop.
Save a-suenami/f288e9be54b0584ffd5c to your computer and use it in GitHub Desktop.
class SampleService
extends ActiveModel::Model
validates :name, presence: true
def initialize(attributes)
# ...
end
def run!
return false if invalid?
Sample.create!(attributes)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment