similar to: Need help with extending a plugin

Displaying 20 results from an estimated 300 matches similar to: "Need help with extending a plugin"

2006 Feb 16
1
[PATCH] acts_as_taggable plugin
hi, I started today to use the acts as taggable plugin and it''s working as expected. I added a method find_tagged_with_all since I needed to find the elements tagged with all the items in a list while find_tagged_with finds all the elements tagged with any of the list terms. Attached to this mail there''s a patch which adds the find_tagged_with_all method and which solves 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 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 Mar 28
0
How to set session variable in plug-ins
I''m working on a plug-in which has to manipulate some session varibles Unfortunately I end up with "Symbol as array index" errors. Probably the error occurs in a point that I never think about but here''s an abstract plug-in which generates the same error. It fails in the line of assignment "session[:aaa_uid] = uid" with "Symbol as array index"
2006 Feb 28
0
acts_as_taggable vulnerable to attacks ?
Hi all ! I''d like to confirm if I''m reading correctly. It seems ActiveRecord::Acts::Taggable::SingletonMethods#find_tagged_with is vulnerable to SQL injection attacks: def find_tagged_with(options = {}) options = { :separator => '' '' }.merge(options) tag_names = ActiveRecord::Acts::Taggable.split_tag_names(options[:any] || options[:all],
2008 Jun 13
1
Polymorphic :through associations
Could someone please help me with this association scheme? I am familiar with habtm as well as the :through association but this one has me stumped. Here is an example DB. Tags Table: ------------------------- id name Taggables Table: -------------------------- id tag_id taggble_type taggable_id For purposes of this example say that there are 2 other tables that can be tagged and their model
2011 Sep 17
0
joining and array with a table in ActiveRecord
Hey I am pretty new to Ruby on Rails and I have no idea how to solve the following: I have a join query on a table like this: def mytags Taggable.joins("JOIN taggables as filter ON taggables.tag_id = filter.tag_id WHERE filter.taggable_type = ''User'' AND filter.taggable_id = 1").all end this works perfectly fine. then I want to join the result on another
2009 Feb 26
2
detecting acts_as_x?
I''m writing an acts_as_x type plugin/gem and I need to know how to detect which other acts_as plugins are installed so I can avoid name conflicts. What''s a simple way to do this? Thanks John Small -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby
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
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
2006 May 06
3
Extending Rails plugins?
Gents, I''m using the acts_as_taggable rails plugin (not gem), and would like to add some additional methods to it. For example, the find_tagged_with methods essentially does a find tag in a list (effectively an OR), while I''d like to implement a find_tagged_with_all method that would implement an AND (so if I specified 4 tags, it would only return items that were
2006 May 26
1
access a ActionControllers protected method from plugin?
I can''t belive I fit that in as the subject! I''m writing a plugin that will allow me to grab some text from a database and call the render method from ActionController on part of the text. I can''t seem to figure out how to access the render method of ActionController::Base. I keep getting the "uninitialized constant Execute" error. How can I do this?
2005 Dec 29
3
Why do plugins use class_eval?
I''m writing my own plugin and all the plugins I''ve seen use class_eval in the method that is called in the including module. For example: http://wiki.rubyonrails.com/rails/pages/HowToWriteAnActsAsFoxPlugin module Foo module Acts #:nodoc: module Fox #:nodoc: def self.included(base) base.extend(ClassMethods) end # declare the class level
2012 Sep 08
3
Polymorphic has_and_belongs_to_many association
Hi, I''m currently having the situation where I have to implement a polymorphic has_and_belongs_to_many by introducing an in between model that handles all the "has_many :as" and "belongs_to :polymorphic" association implementations... and is not doing anything else. Thing I don''t like it here is, I am unnecessarily loading AR instances only to execute SQL
2007 Apr 23
3
Troubles with using gems in Rails
Hi! I''m observing some problems using gem inside Rails. My understanding is that after following sequence in irb: $ irb irb(main):001:0> require ''rubygems'' => true irb(main):002:0> require ''active_record'' => true irb(main):003:0> gem ''acts_as_taggable'' => true I should have access to acts_as_tagable mixins, like:
2006 Apr 06
0
How to use polymorphic in a beautiful way in such a case?
class User<ActiveRecord::Base has_many :taggings, :as=>:taggable,:dependent=>true has_many :tags,:through=>:taggings end class Article<ActiveRecord::Base has_many :taggings, :as=>:taggable,:dependent=>true has_many :tags,:through=>:taggings end class Tagging<ActiveRecord::Base belongs_to :tag belongs_to :taggable,:polymorphic=>true end class Tag<ActiveRecord::Base
2010 Aug 19
3
Help: "500 Internal Server Error"
Hi guys, I am a completely ruby & rails newbie. i have being struggling on this issue for almost 2 days, still can not figure out the problem. there are two websites i''m trying to set up a development environment on my pc running windows xp 32 bit version. a front-end customer facing page & back-end admin page. the procedure i have gone through is: 1. install ruby version 1.8.6
2007 Nov 27
1
Plugin - How to access object from instance method
Quick question: Given a basic plugin... how can I access an object that I instantiated in the acts_as method from an instance method? Probably some sort of accessor... but where? def self.included(base) base.extend ClassMethods end module ClassMethods def acts_as_test object = Object.new ## This object needs to be accessible from the Instance Methods end include
2006 Jun 21
1
Plugin Panic! - no accessing a model''s class methods?
Hi plugin-authors. So this is a little bit of take two on this question, but why can''t I access a singleton on the model calling my plugin? The crux of the full plugin below is: #logger.info self.class.to_s new_copy = self.class.new( @copyable_attributes ) the logger spits out "Datatype", but I get an error from rails saying: undefined method `datatype'' for
2012 Jan 23
0
Problem loading modules through ActiveSupport on_load
Working with modules to group certain methods. Currently I have this set up and it works: **# app/models/a.rb** class A has_history end **# lib/history.rb** module History module Model def self.included(base) base.send :extend, ClassMethods end module ClassMethods def has_history(options = {}) send :include,