Skip to content

Instantly share code, notes, and snippets.

@Agowan
Created April 2, 2015 20:57
Show Gist options
  • Save Agowan/66210e54a2375d7bf4ff to your computer and use it in GitHub Desktop.
Save Agowan/66210e54a2375d7bf4ff to your computer and use it in GitHub Desktop.
# encoding: utf-8
class Article
attr_accessor :title, :body
def initalize(title, body)
self.title = title
self.body = body
end
end
# encoding: utf-8
class ArticleRepository < ActiveRecor::Base
end
# encoding: utf-8
class SaveArticle
def initalize(article)
@article = article
end
def call
repos = ArticleRepository.find(@article.id)
repos.body = @article.body
repos.title = @article.title
repos.save!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment