similar to: How can I dynamiclly generate models?

Displaying 20 results from an estimated 400 matches similar to: "How can I dynamiclly generate models?"

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
2008 Jun 05
2
how to add a method without coding it directly into app?
i''m missing something here. how would I code this outside the application to be shared with other Camping apps? module Blog::Controllers module AuthenticationHelper def self.included(base) class << base define_method :authenticate do |*a| a.each do |meth| if method_defined?(meth.to_s)
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,
2007 Sep 18
2
Making attachment_fu polymorphic
I am working on a small model mixin called attachment_kung to make attachment_fu polymorphic, so you no longer need a different table and Model class for every associated attachment (Productimage, Ad_doc, etc). All you really need is one model and table to handel all your attachments - in some cases, anyway. I have the code working, but have run into one small hitch that I can''t seem to
2006 Jul 28
0
reserved words
I''ve seen this topic has been discussed a couple of times. However, I''m wondering if a method exists in rails to test a name against the reserved words listed on the wiki? Just wanted to check before I write this myself (and type in all of those names -- including PostgreSQL). To explain the application: I''ve written a project that manages ldap data. On a fresh
2006 Jun 28
2
NoMethodError when setting session variable
I know this is dumb, but I can not set a session variable. I get the followig error: Processing Base#edit (for 67.174.108.88 at 2006-06-28 17:17:34) [GET] Session ID: 3c4b2bad18c8bc289b719dc056913be7 Parameters: {"action"=>"edit", "id"=>"11", "controller"=>"image",
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]
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
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
2007 Jan 04
5
uninitialized constant oddities
hi there! unfortunately, we are repeatedly having problems with uninitialized constants in our rails app (v1.1.6), which is running on a mongrel cluster behind apache''s mod_proxy_balancer. ---- snip ---- NameError (uninitialized constant Base): [...] /app/models/image.rb:90:in `subclasses'' /app/models/image.rb:98:in `subclass?''
2008 Jan 08
1
add comments to ALL models (ie automatically add has_many)
I have the acts_as_commentable and a bunch of others added to pretty much every model, is there a way to automaically add these to EVERY model ? I tried the following but it fails with an error... ActiveRecord::Base.class_eval do has_many :notes, :as => :model_with_notes, :dependent => true end fails with.... /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/
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
2010 Sep 12
11
Rails Commenting, Plugins?
Hello, I''m looking to add comments to records in my app like Books. So a user can view a Book and then comment on it... As a newbie, is this something that I should build from scratch, or are there any popular Commenting Plug-ins, (Ajax implemented) that might be worth utilizing? Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
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/.
2010 Jan 22
0
Problem with acts_as_commentable Plugin
Hi, i''m trying to use the acts as commentable Plugin, bit it seems not to work: My Commentable Model is the Task Class. if i try to get the Comments of a Task Object , e.g. task.find(:first) task.comments it occurs this error: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''comments.task_id'' in ''where clause'': SELECT * FROM
2006 Sep 04
2
"include" versus "extend" - what's the difference
Hi, Just wondering when one would use "include" over "extend"? Both seem to bring in methods to the class no? The context is I''m just trying to understand why both are used with the acts_as_audited plugin: Full extract from plugin (used within here): ================================================== # Copyright (c) 2006 Brandon Keepers # # Permission is hereby
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