Hi everybody,
I’m currently trying to write my own blog on Rails 2. In this way, I had
create 2 models and 3 tables:
- articles
- tags
- articles_tags
After this, I had generated a scaffold of Article in order to use the
blog with an address such as: http://domain.tld/articles/new (for
example)
Now I would like to display a list of tag on every pages on the left
too. But my problem is that:
to do so, I need to use a other controller then articles, even if the
url need to require articles controller.
In my opinion, it’s possible by using this king of line into the
application.html.erb view:
<%= render_component :controller => “tags”, :action => “listing” %>
and this file in views/listing.html.erb:
-
<% for tag in @tags %>
- <%=h tag.name %> <% end %>
But after this, I really do not understand why I got a infinit loop.
Here you can see my log:
Processing ArticlesController#new (for 127.0.0.1 at 2008-05-27 16:49:30)
[GET]
Session ID:
BAh7CDoMY3NyZl9pZCIlMTU2MDg2ZmUzZGIzOGRlM2VjZDViMTZhMWI2MDA0%0AZmIiCmFkbWluVCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6%0AOkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–f08000449ccdeecc8ecd1e5c67f49baad76ebbcc
Parameters: {“action”=>“new”, “controller”=>“articles”}
WARNING: You’re using the Ruby-based MySQL library that ships with
Rails. This library is not suited for production. Please install the
C-based MySQL library instead (gem install mysql).
SQL (0.000221) SET NAMES ‘utf8’
SQL (0.000180) SET SQL_AUTO_IS_NULL=0
Article Columns (0.421418) SHOW FIELDS FROM articles
Rendering template within layouts/application
Rendering articles/new
User Load (0.001248) SELECT * FROM users
User Columns (0.002785) SHOW FIELDS FROM users
Category Load (0.000625) SELECT * FROM categories
Category Columns (0.002134) SHOW FIELDS FROM categories
Start rendering component ({:controller=>“tags”, :action=>“listing”}):
Processing TagsController#listing (for 127.0.0.1 at 2008-05-27 16:49:31)
[GET]
Session ID:
BAh7CDoMY3NyZl9pZCIlMTU2MDg2ZmUzZGIzOGRlM2VjZDViMTZhMWI2MDA0%0AZmIiCmFkbWluVCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6%0AOkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–f08000449ccdeecc8ecd1e5c67f49baad76ebbcc
Parameters: {“action”=>“listing”, “id”=>nil, “controller”=>“tags”}
Tag Load (0.059799) SELECT * FROM tags
Rendering template within layouts/application
Rendering tags/listing
Tag Columns (0.002136) SHOW FIELDS FROM tags
Start rendering component ({:controller=>“tags”, :action=>“listing”}):
Processing TagsController#listing (for 127.0.0.1 at 2008-05-27 16:49:31)
[GET]
Session ID:
BAh7CDoMY3NyZl9pZCIlMTU2MDg2ZmUzZGIzOGRlM2VjZDViMTZhMWI2MDA0%0AZmIiCmFkbWluVCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6%0AOkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–f08000449ccdeecc8ecd1e5c67f49baad76ebbcc
Parameters: {“action”=>“listing”, “id”=>nil, “controller”=>“tags”}
CACHE (0.000000) SELECT * FROM tags
Rendering template within layouts/application
Rendering tags/listing
Start rendering component ({:controller=>“tags”, :action=>“listing”}):
Processing TagsController#listing (for 127.0.0.1 at 2008-05-27 16:49:31)
[GET]
Session ID:
BAh7CDoMY3NyZl9pZCIlMTU2MDg2ZmUzZGIzOGRlM2VjZDViMTZhMWI2MDA0%0AZmIiCmFkbWluVCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6%0AOkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–f08000449ccdeecc8ecd1e5c67f49baad76ebbcc
Parameters: {“action”=>“listing”, “id”=>nil, “controller”=>“tags”}
CACHE (0.000000) SELECT * FROM tags
Rendering template within layouts/application
Rendering tags/listing
Start rendering component ({:controller=>“tags”, :action=>“listing”}):
Processing TagsController#listing (for 127.0.0.1 at 2008-05-27 16:49:31)
[GET]
Session ID:
BAh7CDoMY3NyZl9pZCIlMTU2MDg2ZmUzZGIzOGRlM2VjZDViMTZhMWI2MDA0%0AZmIiCmFkbWluVCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6%0AOkZsYXNoSGFzaHsABjoKQHVzZWR7AA%3D%3D–f08000449ccdeecc8ecd1e5c67f49baad76ebbcc
Parameters: {“action”=>“listing”, “id”=>nil, “controller”=>“tags”}
CACHE (0.000000) SELECT * FROM tags
Rendering template within layouts/application
Rendering tags/listing
Start rendering component ({:controller=>“tags”, :action=>“listing”}):
…and if I don’t stop the server, it continue to loop infinitly like
that :s
Thank you for any help.