Displaying 20 results from an estimated 3000 matches similar to: "Polymorphic Comment notification to Users?"
2006 Mar 31
2
"Owning" a polymorphic
I''m playing around with RoR and I''m having trouble figuring out how to
describe a certain relationship. I''m building a social networking site
where you have users who can comment on other users, photos, videos, and
blogs. I''ve figured out how to have a comment belong to a user or media
item through a polymorphic relationships but I dont'' know how to
2013 Feb 28
2
Create polymorphic resources
Hi
I have created a polymorphic association for comments since I need
commenting functionality on several models. The issue is that when I create
the comment in my Commets#create action, I really don''t know what type the
parent is of.
So, let''s say I have Foo, Bar and Comment. Comment have this:
belongs_to :commentable, polymorphic: true
And Foo and Bar both have:
2009 Apr 29
0
Polymorphic comments table needs associated model
Howdy,
I''ve been banging my head on this problem for a bit.
I''m using the acts_as_commentable plugin which works great.
The scenario, I''m on the user''s dashboard and want to display comments
with commentable_type = Venue. No problem. But, if I want to display
the name of that Venue with the comment... big nasty. The polymorphic
key is a composite key and
2008 Oct 29
5
Polymorphic Associations with inheritance
I have two models, Article and Post, that has many Comments. However,
both Article and Post are inherited from a BaseContent class like so:
class Article < BaseContent
has_many :comments, :as => :commentable
end
class Post < BaseContent
has_many :comments, :as => :commentable
end
and here''s my Comment model:
class Comment < ActiveRecord::Base
belongs_to
2006 Aug 16
0
Creating a comments system for multiple types of
It sounds like you want a polymorphic association -
class Party < ActiveRecord::Base
has_many :comments, :as => :commentable
end
class BlogEntry < ActiveRecord::Base
has_many :comments, :as => :commentable
end
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
end
then include columns ''commentable_id'' and
2009 Jan 02
5
Very odd NoMethodError/stack overflow....
I''m getting this very weird error and I can''t figure out what the
problem is. I''m using acts_as_commentable. Basically, I have a partial
with this code in it:
<div id="<%= ''#{comment.commentable_type}_comment_#
{comment.commentable_id}'' %>" class="comment">
<dl>
<dt><%= link_to comment.user.login,
2006 May 15
33
acts_as_commentable release
I now have the acts_as_commentable plugin up on RubyForge. This
plugin will allow you to add comments to any active_record object in
your Rails application.
So far the directions are simple, and there are only a few features:
To install:
ruby script/plugin install
svn://rubyforge.org//var/svn/commentable/acts_as_commentable
In the readme there is a sample migration you will need to use, with
2009 Jul 22
2
How to build scope for count() & has many polymorphic?
Hello, i have the following models in my application:
class Message < ActiveRecord::Base
has_many :comments, :as => :commentable, :dependent => :destroy,
:order => ''created_at ASC''
end
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
end
I need "commented" named scope, which do the follownig thing:
2010 Oct 11
5
Object lost in memory/trashed?
Hi,
I''ve got a problem on which I''ve spent many hours, and I can''t get a
clue on what is happening... I hope someone here will be able to help
me.
Here is the situation : my Rails app uses acts_as_commentable and
acts_as_bookmarkable on a Diagram model. Everything''s working OK
individually: I can create a comment on a Diagram, bookmark it, and so
on.
Now,
2006 Jun 20
2
Converting from acts_as_tree to acts_as_nested_set
I''m currently using acts_as_tree to display threaded Comments on my
forums-like site. It''s waaay too slow to display a page with 1,000
comments, as it''s issuing a TON of selects.
I''m pretty sure I want to convert to the nested set model, using
acts_as_nested_set or acts_as_threaded. This should give me the
performance I''m looking for.
The problem,
2010 Sep 11
10
Having difficulty with threaded comments, using acts_as_tree
I''ve been having problems making threaded comments for the last few
days. Mainly with creating children and displaying the children.
Currently, I have comments shown at the bottom of my articles show view.
The top level comments work, but I do not really know how to implement a
way for users to "reply" to the top level comments and take them to a
form (the comment
2007 Apr 05
2
best way to maintain dynamic fields?
I have a Topic that has_many comments. In the search results only want
Topics to show up, but I want them to include the text of the comments
that they have when they are indexed. To do this I''ve added a
:comments_text field for acts_as_ferret and the comments_text method
gathers the text from all comments up into a string that can be indexed.
The trick is that when comments are added,
2006 Dec 20
4
undefined method `fullname' for #<User:0x357e380>, BUT works on first view?
Hi all,
Please excuse the long post, but I wanted to make sure you have all the
information....
I have a NewsModel that looks like this:
class News < ActiveRecord::Base
belongs_to :user
validates_associated :user
validates_length_of :title, :description, :minimum => 5, :allow_nil
=> false
acts_as_commentable
acts_as_taggable
def self.find_recent
News.find(:all,
2006 May 24
0
polymorphic url and polymorphic partial helpers
Here are a couple of articles I wrote describing a couple of handy
helpers for dealing with polymorphic objects.
These helpers allow you to generate urls and render partials on objects
without knowing what class they are ahead of time.
http://www.sciwerks.com/blog/2006/05/24/polymorphic-urls/
http://www.sciwerks.com/blog/2006/05/24/polymorphic-partials/
Hopefully you will find them useful.
2007 Dec 16
0
pass the model type to the action via a hidden field?
I have a question about the acts_as_commentable plugin. In the
instructions it says to use hidden fields to pass the model type and
model id. This is somewhat confusing me. I am trying to add comments
to a user object and am not sure how to specify the model type. This
is the link that I am using to get the comment view where one will
enter his/her comments:
<%= link_to "add a
2011 May 03
2
Database performance for polymorphic associations under high load
Hey guys,
I''ve been thinking lately about polymorphic associations, and I
wonder: is there a noticeable or tangible performance "hit" from doing
polymorphic associations when you''ve got your database under really
high query load?
So for example, maybe I have a "message" model, a "user" model and an
"administrator" model, without any
2006 Jul 10
2
Polymorphic associations in reverse?
My app has an association that''s got me scratching my head.
I have Users, and Images. A User has many Images. (Yes, another
picture sharing app, but it''s for a small niche, and it doesn''t end
in -r!)
I would like to express a "Favorite" relationship between both Users
to Users, and Users to Images. This seems like the opposite of the
standard
2010 Mar 01
0
undefined method for Polymorphic association using Searchlogic
I am unable to call a polymorphic scope using the searchlogic plugin
as it keeps on returning ''undefined method''. I am certain it is only a
problem within my project as I created a test project and I was able
to call a polymorphic scope using the searchlogic plugin.
I am hoping someone can provide a suggestion on how to debug this
issue.
My project consists of several gems, and
2008 May 13
0
Polymorphic naming difficulties
Hi all. I''m having a problem naming a polymorphic relationship. Here''s
my thinking...
First, an analogy. You''re walking through the mall. Through a window you
see a game you''re interested. I''m attempting to model the relationship
between your interest and the game you''re interested in.
I have an InterestList. It''s job is to maintain
2006 Mar 19
2
Multiple polymorphic belongs_to declarations
I have the following models:
class Card < ActiveRecord::Base
belongs_to :deck
belongs_to :front, :polymorphic => true
belongs_to :back, :polymorphic => true
end
class TextContent < ActiveRecord::Base
has_one :card, :as => :front
has_one :card, :as => :back
end
The conflicting has_one declarations don''t work. What I need is