commiting so i can pull
This commit is contained in:
parent
2b5cf0d265
commit
5cf2e3c3ea
5 changed files with 23 additions and 19 deletions
|
|
@ -4,6 +4,9 @@ class CommentsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
target = Post.first(:id => params[:comment][:post_id])
|
target = Post.first(:id => params[:comment][:post_id])
|
||||||
text = params[:comment][:text]
|
text = params[:comment][:text]
|
||||||
|
puts params.inspect
|
||||||
|
|
||||||
|
|
||||||
if current_user.comment text, :on => target
|
if current_user.comment text, :on => target
|
||||||
render :text => "Woo!"
|
render :text => "Woo!"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
%div.comments
|
%div.comments
|
||||||
= render "comments/new_comment", :post => post
|
/= render "comments/new_comment", :post => post
|
||||||
%ul.comment_set
|
%ul.comment_set
|
||||||
- for comment in post.comments
|
- for comment in post.comments
|
||||||
= render "comments/comment", :comment => comment
|
= render "comments/comment", :comment => comment
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
= form_for Comment.new, :remote => true do |f|
|
= form_tag("/comments",:remote => true, :class =>"new_comment", :id => "new_comment") do
|
||||||
= f.error_messages
|
|
||||||
%p
|
%p
|
||||||
= f.text_field :text, :value => "dislike!"
|
= text_field_tag "comment_text", 'dislike!', :size => 30, :name => 'comment[text]'
|
||||||
= f.hidden_field :post_id, :value => post.id
|
= hidden_field_tag "comment_post_id", "#{post.id}", :name => "comment[post_id]"
|
||||||
= f.submit 'comment', :class => 'button'
|
= submit_tag 'comment', :id => "comment_submit", :name => "commit"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ module WebSocket
|
||||||
class << @view
|
class << @view
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include Rails.application.routes.url_helpers
|
include Rails.application.routes.url_helpers
|
||||||
|
include ActionView::Helpers::FormTagHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -30,14 +31,14 @@ module WebSocket
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.view_hash(object)
|
def self.view_hash(object)
|
||||||
#begin
|
begin
|
||||||
# puts "I be working hard"
|
puts "I be working hard"
|
||||||
v = WebSocket.view_for(object)
|
v = WebSocket.view_for(object)
|
||||||
#puts view.inspect
|
puts v.inspect
|
||||||
#rescue
|
rescue
|
||||||
# puts "in failzord " + view.inspect
|
puts "in failzord " + v .inspect
|
||||||
# raise "i suck"
|
raise "i suck"
|
||||||
#end
|
end
|
||||||
{:class =>object.class.to_s.underscore.pluralize, :html => v}
|
{:class =>object.class.to_s.underscore.pluralize, :html => v}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,3 @@
|
||||||
# require 'addressable/uri'
|
|
||||||
# require 'eventmachine'
|
|
||||||
# require 'em-http'
|
|
||||||
|
|
||||||
class MessageHandler
|
class MessageHandler
|
||||||
|
|
||||||
NUM_TRIES = 3
|
NUM_TRIES = 3
|
||||||
|
|
@ -17,6 +13,9 @@ class MessageHandler
|
||||||
|
|
||||||
|
|
||||||
def add_post_request(destinations, body)
|
def add_post_request(destinations, body)
|
||||||
|
puts "yay"
|
||||||
|
puts destinations.inspect
|
||||||
|
puts body.inspect
|
||||||
destinations.each{|dest| @queue.push(Message.new(:post, dest, body))}
|
destinations.each{|dest| @queue.push(Message.new(:post, dest, body))}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -25,7 +24,7 @@ class MessageHandler
|
||||||
case query.type
|
case query.type
|
||||||
when :post
|
when :post
|
||||||
http = EventMachine::HttpRequest.new(query.destination).post :timeout => TIMEOUT, :body =>{:xml => query.body}
|
http = EventMachine::HttpRequest.new(query.destination).post :timeout => TIMEOUT, :body =>{:xml => query.body}
|
||||||
http.callback {puts query.inspect; process}
|
http.callback {puts query.body; process}
|
||||||
when :get
|
when :get
|
||||||
http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT
|
http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT
|
||||||
http.callback {send_to_seed(query, http.response); process}
|
http.callback {send_to_seed(query, http.response); process}
|
||||||
|
|
@ -34,6 +33,7 @@ class MessageHandler
|
||||||
end
|
end
|
||||||
|
|
||||||
http.errback {
|
http.errback {
|
||||||
|
puts query.destination + " failed!"
|
||||||
query.try_count +=1
|
query.try_count +=1
|
||||||
@queue.push query unless query.try_count >= NUM_TRIES
|
@queue.push query unless query.try_count >= NUM_TRIES
|
||||||
process
|
process
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue