Sha256: 2a43b102b59424f47b64082ad1312d09e6fbd87c493d826f8dcbe217911eafa1

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

module Ilog
  module Controllers
    module Index
      class Digital
        include Ilog::Action
		expose :namespace, :host
		def set_database database
			tmp_config = ActiveRecord::Base.connection_config
			tmp_config[:database] = database
			ActiveRecord::Base.establish_connection tmp_config
		end
        def call(params)
	        @database = Ilog.configuration.namespaces[params[:domain]]
	        self.set_database @database
	        @namespace = params[:domain]
	        @host = Ilog.configuration.host
	        req = request.env['HTTP_ACCEPT']
			if req.include? 'application/json'
		   		post = ::Post.find(params[:id])
		   		post.namespace = @namespace
		   		self.format = :json
		   		self.body = post.to_json(:include => ::Post::DIMENSIONS + ::Post::GROUPINGS, :methods => [:content])
		   	end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ilog-0.3.3 lib/ilog/controllers/index/digital.rb
ilog-0.3.1 lib/ilog/controllers/index/digital.rb