diaspora/lib/socket_render.rb
2010-07-07 15:27:22 -07:00

40 lines
1 KiB
Ruby

# module SocketRenderer
# require 'app/helpers/application_helper'
# def self.instantiate_view
# @view = ActionView::Base.new(ActionController::Base.view_paths, {})
# class << @view
# include ApplicationHelper
# include Rails.application.routes.url_helpers
# include ActionController::RequestForgeryProtection::ClassMethods
# def protect_against_forgery?
# false
# end
# end
# end
#
# def self.view_hash(object)
# begin
# v = view_for(object) unless object.is_a? Retraction
#
# rescue Exception => e
# puts "in failzord " + v.inspect
# puts object.inspect
# puts e.message
# raise e
# end
#
# {:class =>object.class.to_s.underscore.pluralize, :html => v, :post_id => obj_id(object)}
# end
#
# def self.view_for(object)
# @view.render @view.type_partial(object), :post => object
# end
#
# def self.obj_id(object)
# if object.is_a? Post
# object.id
# else
# object.post_id
# end
# end
# end