Hi there guys I''ve been pulling my hair out all night with this one, I thought it would work? If in my controller i do the following class PagesController < ApplicationController attr_accessor :something helper_attr :something def show something = "display this!" respond_to do |format| format.html format.xml { render :xml => @page.to_xml } end end end Then in my view <%= something %> Should "display this!" get displayed? becuase it doesn''t seem to be setting for me Thanks in advance :) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Roderick van Domburg
2007-Aug-04 13:35 UTC
Re: attr_accessor not setting or being displayed in the layo
Camo wrote:> class PagesController < ApplicationController > attr_accessor :something > helper_attr :something > > def show > something = "display this!" > > respond_to do |format| > format.html > format.xml { render :xml => @page.to_xml } > end > end > endTry self.something = "display this!". Calling an assignment on just "something" will assign a variable that is local to that method instead of the object. -- Roderick van Domburg http://www.nedforce.nl -- 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 -~----------~----~----~----~------~----~------~--~---