class Iatelier::Controllers::Books::Update
Public Instance Methods
call(params)
click to toggle source
# File lib/iatelier/controllers/books/update.rb, line 8 def call(params) # [optional] setting the database @database = params.get(:database) self.set_database @database # setting up the book @book = Object.const_get(params[:book_type].capitalize).find(params[:id]) @book.namespace = @database @book.dimensions.each do |dimension| if @book.public_send(dimension.to_sym) method_name = 'revise_' + dimension else method_name = 'setup_' + dimension end @book.public_send(method_name.to_sym, params) end @book.dimensions.each do |dimension| action = @book.public_send(dimension.to_sym) if !action.save @errors = action.errors.messages self.status = 422 end end @book.sync_keywords params @book.sync_individuals params @book.sync_content params @book.store_attachment params end