Created
April 2, 2015 20:57
-
-
Save Agowan/66210e54a2375d7bf4ff to your computer and use it in GitHub Desktop.
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
# encoding: utf-8 | |
class Article | |
attr_accessor :title, :body | |
def initalize(title, body) | |
self.title = title | |
self.body = body | |
end | |
end |
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
# encoding: utf-8 | |
class ArticleRepository < ActiveRecor::Base | |
end |
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
# 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