Sha256: b3a3f0ff6db46aeab386027d7c33549e70c1a849f14f063b4599b81a61681957
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
module Iatelier module Controllers module Books class Update include Iatelier::Action include Iatelier::Controllers::Books::DbConnector expose :book, :database, :errors 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 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
iatelier-0.5.2 | lib/iatelier/controllers/books/update.rb |
iatelier-0.5.1 | lib/iatelier/controllers/books/update.rb |
iatelier-0.5.0 | lib/iatelier/controllers/books/update.rb |