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
# == Paperclip without ActiveRecord | |
# | |
# Original: https://gist.github.com/basgys/5712426 | |
require 'active_model/naming' | |
require 'active_model/callbacks' | |
require 'active_model/validations' | |
require 'paperclip' | |
require 'paperclip/glue' |
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
# ---role | |
module BookManager | |
def create_book(attrs) | |
self.books.create! attrs | |
end | |
def update_book(book_id,attrs) | |
book = self.books.find(book_id) | |
book.update_attributes attrs |