This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# what breaks | |
<% blogs = @story.user.blogs %> | |
# with: | |
Cannot find the child_model Blogadmin for User | |
# the relationship in User | |
# doesn't work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.treeify_comments(clist, pid = 0) | |
chash = Hash.new # comments grouped by parent_id | |
comhash = Hash.new # comments in a hash, w/ comment id as key | |
comments = Array.new # for the ordered comments | |
depth_tree = Hash.new # comment depth | |
clist.collect { |x| comhash[x.id] = x } | |
# ? | |
clist.collect do |c| | |
chash[c.parent_id] ||= Array.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StoryController < ApplicationController | |
#require 'utility' | |
def index | |
@story = Story.get(params[:id]) | |
#@comments = repository(:default).adapter.query('SELECT comments.id, story_id, user_id, parent_id, time, sid, cid, pid, subject, recrate, trollrate, raters, commentip, comment, nickname from comments left join users on comments.user_id = users.id where story_id = ?', @story.id) | |
#@comments = Comment.find_by_sql(['SELECT comments.id, subject, nickname from comments left join users on comments.user_id = users.id where story_id = ?', @story.id]) | |
# experiment... | |
clist = repository(:default).adapter.query('SELECT comments.id, story_id, user_id, parent_id, time, sid, cid, pid, subject, recrate, trollrate, raters, commentip, comment, nickname from comments left join users on comments.user_id = users.id where story_id = ?', @story.id) | |
chash = Hash.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MessageController < ApplicationController | |
def index | |
@messagee = User.by_name(params[:nick]) | |
end | |
def newpmthr | |
if request.post? | |
pmthr = PMThread.new | |
unless (pmthr) | |
raise "Something's wrong" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require "memcached" | |
rescue LoadError | |
require "memcache" | |
rescue LoadError | |
puts "You need the memcache or the memcached gem to use the Memcache moneta store" | |
exit | |
end | |
module Moneta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require "memcached" | |
rescue LoadError | |
puts "You need the memcached (the libmemcached client, not the other one) gem to use the Memcached moneta store" | |
exit | |
end | |
# uses the memcached gem properly, and traps the weirdass exception a get on an undefined key throws. May be worth changing | |
# further to allow the extra flags memcached lets you use, like marshal => true|false or the various memcached flags |
NewerOlder