Displaying 20 results from an estimated 1200 matches similar to: "add comments to ALL models (ie automatically add has_many)"
2008 Feb 21
1
polymorphic has_many from ActiveRecord::Base????
I have a polymorphic thingy called fields and I need to on each and
every model, so I''d like to do the has_many from the base class, like
this...
ActiveRecord::Base.class_eval do
has_many :fields, :as => :model, :dependent => true
end
It fails with this no method error (class_of_active_record_descendant)
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/
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
2009 Dec 27
5
Difficulties in understanding Rail-Plugins in depth
Hi,
i try to understand how plugins work in detail.
Often you see stuff like:
class Post < ActiveRecord::Base
acts_as_commentable
end
I wonder what''s happen all there.
What kind of language-feature is behind this call "acts_as_commentable" ?
In my opinion you need some kind of extend or include to extend the
functionality of a model. And exactly this is which i found
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
2007 Jan 25
2
render .rhtmlx if present, otherwise render .rhtml
We have a product where our customer is "allowed" to make minor changes
to the .rhtml views.
Obviously, this can be an issue when updating the software, as changes
need to be merged in. Also, sometimes the customer wants to back out
there change but no longer has the original file.
SOOO....
I''d like to tell them
- if you want to change a .rhtml file
- just copy it to
2011 Apr 18
2
acts_as_commentable validations
Hi all,
I recently started back up with Rails and things are going well up until
now.
I''ve set up acts_as_commentable in my Post model and it''s working great.
Problem is users are able to create a "blank" comment. I''ve added the
following validations in the comment.rb file generated by
acts_as_commentable to limit the comment length:
[code]
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,
2008 Aug 30
4
acts_as_commentable: find Post by date of comment
Hello,
I am using acts_as_commentable (related to Post) and I would like to
know how to get the list the posts ordered by date of comment (i.e.
post with recent comment first).
in addition if a post has no comment, i would it to be inserted based
on its creation date.
Thanks for your help
Nicolas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2012 Oct 18
1
mean value calculation
Dear all,
I want to calculate mean values for multiple rows:
structure(list(Name = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L), .Label = c("AKT", "CKT"), class = "factor"), val1 = c(2,
3, 2, 2, 2, 5, 3, 8, 2), val2. = c(4, 5, 4, 8, 4, 8, 4, 7, 4),
val3 = c(5, 6, 5, 9, 5, 9, 5, 9, 5)), .Names = c("Name",
"val1", "val2.",
2007 Sep 23
9
Code reviews: my dumb use of acts_as_commentable (newbie)
With the help of several heroes here yesterday I beat my way into a
working solution to adding comments to one or more models in my
application using acts_as_comentable. Great plugin, but my
implementation is lame. I need enlightenment.
I have users who log in. For several views I want to let them add
comments. Enter act_as_commentable which does just this -- it''s
polymorphic, so you
2009 Mar 15
3
Capistrano deploy errors
Hi, when I do cap deploy:cold I get this error:
rake aborted!
undefined local variable or method `acts_as_commentable'' for #<Class:
0x7fa1c34a2f10>
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/
base.rb:1833:in `method_missing_without_paginate''
/usr/local/lib/ruby/gems/1.8/gems/mislav-will_paginate-2.3.8/lib/
will_paginate/finder.rb:170:in
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/.
2013 Sep 17
1
[PATCH] xen: numa-sched: leave node-affinity alone if not in "auto" mode
If the domain''s NUMA node-affinity is being specified by the
user/toolstack (instead of being automatically computed by Xen),
we really should stick to that. This means domain_update_node_affinity()
is wrong when it filters out some stuff from there even in "!auto"
mode.
This commit fixes that. Of course, this does not mean node-affinity
is always honoured (e.g., a vcpu
2006 May 11
9
acts_as_commentable plugin
I''ve just about finished up work on a plugin similar to
acts_as_taggable, but for comments instead which would allow you to
attach comments (possibly even a threaded discussion if conbined with
acts_as_tree) to any object. Is there anyone that would be interested
in it? I don''t want to go throug the trouble of finding some way to
distribute it unless I know that there is a
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
2009 May 12
2
STI good or bad for my problem?
Hi. I am currently developing a small course system for student and
teachers. The system is divided in sections and sections have many
messages, comments, documents and schedules. Pretty easy to set up
using ROR, just add some belongs_to and has_many relations. But
everything becomes much more complicated when the section items
(message, comment and so on...) all has comments. And they can also be
2012 Mar 07
6
Can't find the PostgreSQL client library (libpq)
When i try it start my ruby server i get a error that looks like
rails server Could not find pg-0.12.2 in any of the sources
Run `bundle install` to install missing gems.
I dont know what to do
Thanks for all the help
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this
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,
2008 Jun 06
1
Need help with Decryption using blowfish CBC
Hello all,
Hoping someone can help me out here. I''ve burned almost a week trying
to figure out how to decrypt
an image file that has been encrypted using Blowfish CBC.
I found some code on the net and have modified as follows:
require ''openssl''
require ''digest/sha1''
ivArr = [0x0D,
0x0E,
0x0A,
0x0D,
0x0F,
0x0A,
0x0C,
0x0E
]
2012 Jul 25
0
Rails3-default_scope throws exception: undefined method abstract_class? for Object:Class
I would like to apply logical delete in my application(Instead of
permanently deleting a record just have been marked as deleted). I have
Added *available* column to all tables with default value *true*. Now I
want common place to write the following code for all models.
1.
Write the instance method which make ''available'' column value false when user clicks on