# Seek brilliant Rails programmer to add one field to acts\_as\_

**URL:** <https://www.ruby-forum.com/t/seek-brilliant-rails-programmer-to-add-one-field-to-acts-as/110085>\
**Category:** Rails\
**Created:** [July 22, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/seek-brilliant-rails-programmer-to-add-one-field-to-acts-as/110085 "2007-07-22T22:43:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 22, 2007, 10:43pm UTC](https://www.ruby-forum.com/t/seek-brilliant-rails-programmer-to-add-one-field-to-acts-as/110085/1 "2007-07-22T22:43:49Z")

</div>

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  
acts\_as\_taggable.rb logic and attaches one or more tags to the  
controlling model. The part that kills me is that this procedure  
happens in such a sublime manner that I can’t see where or when the  
record is created or built? Thus I can’t find a place to build and  
apply a method that I would pass before the record is saved.  
I’ve attempted the before\_create event callback but the controller is  
unable to pass a parameter to this tag.rb. It’s as though the tag.rb  
instance is magically created without leaving a trail or sequence of  
events that I can modify.  
I was hoping I could ‘go in the front door’ and simply modify the  
‘tag\_with’ code such as this;  
module InstanceMethods  
def tag\_with(list, project\_id)  
Tag.transaction do  
taggings.destroy\_all  
Tag.parse(list).each do |name|  
if acts\_as\_taggable\_options[:from]

send(acts\_as\_taggable\_options[:from]).tags.create(:name =\>  
name, :project\_id =\> project\_id).on(self)  
else  
unless Tag.find\_by\_name(name)  
Tag.create(:name =\> name, :project\_id =\>  
project\_id).on(self)  
end  
end  
end  
end  
end  
Here is how I call this in the controller:  
def create  
@rateme = Rateme.new(params[:rateme])  
@rateme.user = current\_user  
params[:project\_id] = @portal.project\_id.to\_s  
@rateme.tag\_with(params[:tags], params[:project\_id]) if  
params[:tags]  
respond\_to do |format|  
if @rateme.save

For some reason, Ruby still sees that this ‘tag\_with’ method only  
takes one argument and blasts this error:  
ArgumentError in RatemesController#create  
wrong number of arguments (2 for 1)  
RAILS\_ROOT: ./script/…/config/…  
Application Trace | Framework Trace | Full Trace  
#{RAILS\_ROOT}/app/controllers/ratemes\_controller.rb:46:in `tag\_with’ "

I am happy to pay cash for this solution.  
Thank you,  
Kathy  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 22, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/seek-brilliant-rails-programmer-to-add-one-field-to-acts-as/110085/2 "2007-07-22T22:47:55Z")

</div>

did you restart the server? plugins load at start.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 23, 2007, 4:09pm UTC](https://www.ruby-forum.com/t/seek-brilliant-rails-programmer-to-add-one-field-to-acts-as/110085/3 "2007-07-23T16:09:38Z")

</div>

Mr. Ross,  
You hit the nail on the head. Yes. I didn’t re-start the server.  
Dummy me ☹  
Kathy
