Last active
August 29, 2015 14:06
-
-
Save joelbrewer/7c63573fb222e90400c6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def load_instagram(object) | |
| object_method = self.method("instagram_#{object}") | |
| if object_method.call != nil | |
| object_method.call | |
| elsif instagram_username.nil? || instagram_username.empty? | |
| "" | |
| else | |
| user = Instagram.user_search(instagram_username, {:count => 1}) | |
| if user.empty? | |
| "" | |
| else | |
| # save to db | |
| attribute = user[0].send(object) | |
| update_attribute("instagram_#{object}", attribute) | |
| # return | |
| object_method.call | |
| end | |
| end | |
| end |
havenwood
commented
Sep 5, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment