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