I was working through the simply rails book, i have completed up to chapter 10, now i want to add tag clouds to the welcome page ? how to do it ? I have installed acts_as_taggable_on_steroids plugin from here http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids I was going through their readme file as per the readme file i did the following changes 1) in app/helpers/application_helper.rb file module ApplicationHelper include TagsHelper end 2) class StoriesController < ApplicationController def tag_cloud @tags = Story.tag_counts end end now i am getting Story.tag_counts in the script/console 3) in app/views/stories/index.html.erb file i have added <% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %> <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %> <% end %> 4) in /public/stylesheets/style.css i have added .css1 { font-size: 1.0em; } .css2 { font-size: 1.2em; } .css3 { font-size: 1.4em; } .css4 { font-size: 1.6em; } after doing all these when i access http://0.0.0.0:3000/stories/ i am getting the error message as undefined method `tag_cloud'' for #<ActionView::Base:0xb5879a78> can anyone help me to correct this error ? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You are trying to use a controller method like a helped method. Try moving the method to applicationhelper and seeing if that works On 09/12/2008, at 21:56, Sulekha Mariam <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > wrote:> > > I was working through the simply rails book, i have completed up to > chapter 10, > now i want to add tag clouds to the welcome page ? how to do it ? > > I have installed acts_as_taggable_on_steroids plugin from here > http://svn.viney.net.nz/things/rails/plugins/acts_as_taggable_on_steroids > > I was going through their readme file as per the readme file i did the > following changes > > 1) > in app/helpers/application_helper.rb file > > module ApplicationHelper > > include TagsHelper > > end > > > > 2) > class StoriesController < ApplicationController > > def tag_cloud > > @tags = Story.tag_counts > > end > > end > now i am getting Story.tag_counts in the script/console > > > 3) in app/views/stories/index.html.erb file i have added > > > <% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %> > > <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class > => css_class %> > > <% end %> > > 4) in /public/stylesheets/style.css > > i have added > > > > .css1 { font-size: 1.0em; } > > .css2 { font-size: 1.2em; } > > .css3 { font-size: 1.4em; } > > .css4 { font-size: 1.6em; } > > after doing all these when i access http://0.0.0.0:3000/stories/ > > i am getting the error message as > > undefined method `tag_cloud'' for #<ActionView::Base:0xb5879a78> > > can anyone help me to correct this error ? > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg wrote:> You are trying to use a controller method like a helped method. Try > moving the method to applicationhelper and seeing if that works >you mean moving def tag_cloud @tags = Story.tag_counts end to app/helpers/application_helper.rb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sulekha Mariam wrote:> Ryan Bigg wrote: >> You are trying to use a controller method like a helped method. Try >> moving the method to applicationhelper and seeing if that works >> > > you mean moving > > def tag_cloud > > @tags = Story.tag_counts > > end > > to app/helpers/application_helper.rbi moved tag_cloud method from StoriesController to app/helpers/application_helper.rb now i am getting the error Showing stories/index.html.erb where line #4 raised: wrong number of arguments (2 for 0) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tuesday 09 December 2008 10:49:24 Sulekha Mariam wrote:> Sulekha Mariam wrote:[...]> > def tag_cloud > >[...]> > now i am getting the error > > Showing stories/index.html.erb where line #4 raised: > > wrong number of arguments (2 for 0)Your method accepts no argument. Try something like: def tag_cloud(args*) I don''t remember if this is the correct syntax. Search for it. :-) HTH, -- Davi Vidal -- E-mail: davividal arroba siscompar ponto com ponto br MSN : davividal arroba msn ponto com GTalk : davividal arroba gmail ponto com Skype : davividal YIM : davi_vidal ICQ : 138815296 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tuesday 09 December 2008 12:03:55 Davi Vidal wrote:> On Tuesday 09 December 2008 10:49:24 Sulekha Mariam wrote: > > Sulekha Mariam wrote: > > [...] > > > > def tag_cloud > > [...] > > > now i am getting the error > > > > Showing stories/index.html.erb where line #4 raised: > > > > wrong number of arguments (2 for 0) > > Your method accepts no argument. Try something like: > > def tag_cloud(args*) >irb(main):001:0> def foo(*args) irb(main):002:1> puts args irb(main):003:1> end => nil irb(main):004:0> foo "hello" hello => nil irb(main):005:0> foo "hello", "world" hello world => nil irb(main):006:0> foo "hello", "world", "I''m alive" hello world I''m alive => nil HTH, -- Davi Vidal -- E-mail: davividal arroba siscompar ponto com ponto br MSN : davividal arroba msn ponto com GTalk : davividal arroba gmail ponto com Skype : davividal YIM : davi_vidal ICQ : 138815296 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks a lot, but can you give ideas/pointers as on how to implement the tag cloud given in the following page using rails http://blog.mypapit.net/2007/09/lanmap-handy-tool-to-map-your-local-area-network-lan-automatically.html -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---