Forum: Ruby on Rails Issues with acts_as_taggable plugin

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8984c514dc77aaf6b04fc4fd8359584c?d=identicon&s=25 boboroshi (Guest)
on 2006-12-31 00:40
(Received via mailing list)
Not the gem.

I've got something working in console, but not in controller. Any idea

This is the plugin not the gem of acts_as_taggable

<h1>Listing elements</h1>

<% if @elements.blank? %>
	<p>There are currently no elements in the system tagged <%=
"&quot;#{params[:tag_name]}&quot;" %>.</p>
<% else %>
	<p>Currently tracking <%= @elements.size %> elements in the system
tagged <%= "&quot;#{params[:tag_name]}&quot;" %>.</p>


		<%= render :partial => 'element', :collection => @elements %>


<% end %>
<br />

<%= link_to 'New element', new_element_path %>

This returns that the array is empty and there's nothing in the tag in

SO teh view is seeing it, but the controller is not getting it. Because
in the console, using a string in place of params(:tag_name) returns an
actual entry.


  def tagged
    # This should take the :tag_name in the url string and pull
elements that match
    # It does not. I suck as a programmer.
    @elements = Element.find_tagged_with(params[:tag_name])

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @elements.to_xml }


class Element < ActiveRecord::Base



This does work:
soho:~/Sites/work/koji jathayde$ script/console
Loading development environment.
>> @elements = Element.find_tagged_with("spam")
DEPRECATION WARNING: The :dependent => true option is deprecated and
will be removed from Rails 2.0.  Please use :dependent => :destroy
instead.  See for details.  See for details. (called from
has_many at
=> [#<Element:0x330a8d8 @attributes={"name"=>"Koji Test One",
"updated_at"=>"2006-11-30 18:16:40", "id"=>"1", "description"=>"supa
sexy description", "filename"=>nil, "element_type_id"=>"3",

But this does not (because there is no value in params[:tag_list]:

> @elements = Element.find_tagged_with(params[:tag_list])
NameError: undefined local variable or method `params' for
        from (irb):4
        from :0
This topic is locked and can not be replied to.