Displaying 20 results from an estimated 900 matches similar to: "Works in model but not in mixin"
2007 Jul 22
2
Seek brilliant Rails programmer to add one field to acts_as_taggable
I''m on the downhill side of a large project that requires an
additional integer field to be added to the tag.rb in
acts_as_taggable. I feel I have a good understanding of ActiveRecord
and have performed the correct migrations.
(As a short background for those following this thread) when one wants
to add tags to a model they call the ''tag_with'' method that jumps into
2006 Apr 20
2
acts_as_taggable magic.... please explain
Hi,
There is a line in acts_as_taggable plugin:
send(acts_as_taggable_options[:from]).tags.find_or_create_by_name(name).on(self)
could someone explain what is:
send(xxx)
and
.on(self)
I cannot find it rDoc
--
Posted via http://www.ruby-forum.com/.
2006 Jun 25
1
Having Trouble Using ActsAsTaggable
I''ve installed the acts_as_taggable plugin and modifed it according to
the tutorial form making it user specific
(http://www.slashdotdash.net/blog/articles/2006/04/29/acts_as_taggable-per-user-tagging
).
I keep getting errors when I try to tag things, however, and have traced
the problem to the line of the tag_with function that calls the
find_or_create_by_name function. So I fired
2006 Jun 30
0
find_by_sql not quoting properly (in acts_as_taggable plugin)
I have run into a very strange problem discovered through the use of
the acts_as_taggable plugin, but related to quoting/sanitizing the
interpolated list in a find_by_sql. Apologies for the length, but I
wanted to be complete. ;-)
The method from acts_as_taggable.rb is:
def find_tagged_with(list)
find_by_sql(["SELECT #{table_name}.* FROM #{table_name},
tags,
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 Apr 03
5
Newbie question about acts_as_taggable
I installed the acts_as_taggable plugin that DHH wrote.
Now I have met problems on using it:
class Book < ActiveRecord::Base
acts_as_taggable
end
mybook = Book.new
mybook.tag_with(''red library book'')
But the system tell the wrong message:
undefined method `parse'' for Tag:Class
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1123:in
2006 Feb 12
7
ROR Recipes Beta: Why use taggings instead of tags_contacts? NoMethodError tag_with?
I have gotten acts_as_taggable to work for a test application as documented on taggable.rubyforge.org
I am following Chad''s excellent examples in ROR Recipes Beta book.
I have a few questions and hope that Chad or some other expert can help clarify them.
1. Why is the book suggesting to use taggings table instead of tags_contacts, as mentioned on taggable.rubyforge.org?
2006 Nov 11
0
acts_as_taggable plugin - paging through tagged model
Hi,
I''m using the acts_as_taggable plugin & wanted to page through all a
model''s records taggged with a particular tags.
i.e. page through all Model records that have been tagged with "artist"
I could not work out how to do this with the plugin, so I made the
changes outlined below.
Did I need to do this..? & does anyone else find this useful?
2008 Feb 26
1
problem with posting with acts as taggable on steroids
hi all
i''m trying to have a post with tags included but i''m getting
undefined method `tag_with''
i''ve already added acts_as_taggable to the model
and on the controller the code for creating the post is:
def create
@post = Post.new(params[:post])
@post.tag_with(params[:tag_list])
@post.user = current_user
if @post.save
redirect_to
2006 Apr 07
1
Acts_as_Taggable
A couple of quick acts_as_taggable (the Rails 1.1 plugin version)
1. Can you update tags on an existing record?
If I execute the tag_with statement twice it creates two rows in the taggings column, instead of updating the value of the existing tag
2. Can you delete tags? I didn''t see a method for this. If I can delete tags, problem #1 goes away.
scott.
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 Apr 13
0
Model with file uploads
I''m working on a model for a videos table that include the video info
(title, description) and a couple of uploads (video file, thumb image)
I was going to use the file_column plugin but I dont like the idea of
storing the file names in the database when I dont need to, plus I dont
think it is very flexible.
Here''s what I done. What do you think of this? Any suggestions?
2006 Aug 07
3
Acts_as_taggable / Rails Recipes bug?
I''m following the acts_as_taggable chapter from the Rails Recipes book.
I want my view form to have a text_field that correlates to an attribute
in the Model that accepts a string of space delimited tags. The book
uses tag-_list, but from what I can tell this attribute can''t be written
to. I''ve added this to the plugin code itself - am I missing something,
is there a
2006 Sep 27
1
acts_as_taggable with single-table inheritance?
Does anyone have any experience making this work? I installed the
plugin and tried the following:
class SomeClass < ActiveRecord::Base
acts_as_Taggable
end
class SubClass1 < SomeClass
end
class SubClass2 < SomeClass
end
SubClass1.tag_with("tag")
and notice that taggable_type = SomeClass
when I do SubClass2.find_tagged_with("tag") a SubClass1 object is
2006 May 17
3
Help mixin in class methods
Starting to feel more confident and code is DRYing up nicely, but I''ve
hit a brick wall here and hoping someone can help me.
I''ve got a module, TrustRanking, which extends a number of model''s
instance methods, and I want to extend their class methods too, but I
can seem to work out how to do it.
Simply including the module from the class works a treat for the
2006 Apr 30
0
populating model attribute from one of many lists
I have a model named Project which contains a name attribute, and I
have a second model named Booking which has, among other things, a
date and a Project. (has_many :bookings, belongs_to :project).
When a user creates a new Booking, they have the option of using an
existing Project or creating a new Project. As an added complexity,
when choosing from existing Projects, they can either choose from
2006 May 10
1
model mixin module madness
If I have several models which exhibit the same functionality, it seems
makes sense to create a mixin, ''include'' it in each model and save
myself some work and repeated code.
Where can I define a module which will be available to all models? I
can''t seem to find a documented place for them.
Alternatively, is there a Rails-standard way of achieving the effect?
Ben
2006 Feb 22
5
Auditing mixin for model classes. Small problem
I want to include common auditing functionality in my models. This
involves storing the changes made to a model in a seperate table :
I have created the functions in an Audit module :
module Audit
before_update :before_changes
after_update :after_changes
def before_changes
old=self.class.find(id).attributes
@changes=[]
attributes.each do |key, val|
if val != old[key]
2006 Feb 19
1
NOOB: ratings/voting mixin or code example?
so as to not reinvent the wheel, are there any exisiting examples or
mixins for a star rating system?
basically what i''m looking to do is show pictures of local models which
will be voted on by users, and the model with the most votes will get
her photo in a calendar.
anyone able to point me in the right direction... tutorials, code,
whatever would be greatly appreciated!
-A
--
2007 Apr 13
0
mixin behavior
Hi, all,
I need to DRY up some code in a few models. My first inclination,
having come from the Java world, was to go with an abstract class.
After a bit of reading, I then decided to follow the mixin route
instead. Now I''m running into trouble, most likely from a few basic
misunderstandings.
There are three models I will be using to average and count rating
data by executing a