similar to: Polymorphic comments table needs associated model

Displaying 20 results from an estimated 5000 matches similar to: "Polymorphic comments table needs associated model"

2009 Jul 20
0
Polymorphic Comment notification to Users?
Hi, my webapp has registered users and it has articles, blog posts, gossips too. For all these resources I''ve a polymorphic Comment model which is listed below. <pre> id content commentable_id commentable_type user_id created_at updated_at 1 Frist comment 2 Article 1 .... 2 Second comment 3 Post 2 .....
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 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:
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 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
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
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,
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,
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
2006 Jun 26
5
How can I dynamiclly generate models?
I am trying to write a plugin, ''acts_as_commentable'', for my models - Image, Book, Music and so on, I do not want to use polymorphic association, so very model should have its own comment class. Here is my code acts_as_commentable.rb module Commentable def self.included(base) base.extend(ClassMethods) end module ClassMethods def
2006 Jan 31
2
Relationship navigation issue
class Event < ActiveRecord::Base belongs_to :venue belongs_to :category end class Venue < ActiveRecord::Base belongs_to :city end class City < ActiveRecord::Base belongs_to :state end I want to retrieve all event records belonging to a state. Coming from hibernate background I tried something like this: def self.list_for_a_state(state_id) find_by_sql(["select e.*
2008 Sep 26
0
self-referential tags, has_many_polymorphs
Hi, I''m looking to add tagging to an application, and I would like to allow self-referential tags, so that I can tag my tags. With the goal of generating a flexible tag hierarchy. After some googling it looks like acts_as_taggable is not the best piece of code, and I''m hoping to use the has_many_polymorphs plugin from http://github.com/fauna/has_many_polymorphs/tree/master.
2007 Nov 14
1
has_many_polymorphs and acts_as_list ?
First, BRAVO for this wonderful plugin: has_many_polymorphs ! Now my problem: 4 models : Collection, Page, Fragment, Belonging (which is the join table): 1 class Collection < ActiveRecord::Base 2 has_many_polymorphs :elements, 3 :through => :belongings, 4 :from => [:pages, :fragments, :collections], 5 :as => :collector, 6 :parent_order =>
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,
2009 Nov 12
0
Problem with has_many :through, :uniq => true with polymorph
Didn''t have quite enough space to describe it there...basically i''m having a problem with the :uniq option in my tags. I''m using acts_as_taggable_on_steroid which adds these associations to my Resource class: Resource has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag has_many :tags, :through => :taggings, :uniq => true
2007 Jan 30
5
errors while testing resource controller using rpec
I am testing a resource called venue in this piece of code (generated using script/rspec_resource) ==================== context "Requesting /venues using POST" do controller_name :venues setup do @mock_venue = mock(''Venue'') @mock_venue.stub!(:save).and_return(true) @mock_venue.stub!(:to_param).and_return(1) Venue.stub!(:new).and_return(@mock_venue)
2009 Mar 11
12
Eager loading comments associated with user submissions.
Hey everyone, I am working on an application that allows users to submit articles, and also comment on those articles. Pretty much exactly like Digg. Everything works fine except that when there are a lot of comments there are a lot of database queries to both fetch the comments and the users who posted those comments. I have used eager loading in other parts of my application to reduce the
2007 Feb 20
0
counter caching with acts_as_commentable
I find that my app is doing a lot of db queries to get comment counts for various objects, as I reference these counts frequenly in my views. This is using acts_as_commentable. Anyone have any tips for adding counter caching to acts_as_commentable? I assume this is possible with polymorphic associations? Thanks! -- Posted via http://www.ruby-forum.com/.
2006 May 20
7
Polymorphic, many-to-many, self-referential data model
No matter what I try I''ve been unable to work how to get this to work with the cool ActiveRecord helpers. I''m not sure if it''s possible, Josh Susser''s blog suggests it is, but damned if I can work it out... I have: Container which can contain one or more Element. An Element is a polymorph of either a Container or a Chunk. An Element can exist in one or more