Can any tell me what this should be doing? What does [:sidebar_title] do? <%= ''here is a title''[:sidebar_title] %> Thanks! JB --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That is not correct syntax. It looks like you are missing the name of the hash. I should look something like: <%= ''here is a title '' + some_hash[:sidebar_title] %> Where some_hash is a hash defined in your controller. If you pasted the code from your controller, I could help you further. Jables wrote:> Can any tell me what this should be doing? What does [:sidebar_title] > do? > > <%= ''here is a title''[:sidebar_title] %> > > > Thanks! > JB > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I agree, it doesn''t look like correct syntax. The code is from the beast forum. All the code is available here: http://svn.techno-weenie.net/projects/beast/trunk/ They use syntax like that in the view all over the place: <%= ''What is Beast?''[:beast_sidebar_title] %> The views are in .html.erb files. On Sep 28, 9:38 pm, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote:> That is not correct syntax. It looks like you are missing the name of > the hash. I should look something like: > > <%= ''here is a title '' + some_hash[:sidebar_title] %> > > Where some_hash is a hash defined in your controller. If you pasted the > code from your controller, I could help you further. > > Jables wrote: > > Can any tell me what this should be doing? What does [:sidebar_title] > > do? > > > <%= ''here is a title''[:sidebar_title] %> > > > Thanks! > > JB--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I haven''t looked in depth at the Beast code, but that looks like it''s there for internationalization. Cf. the Gibberish plugin [1], which overrides String#[] for this purpose. :sidebar_title is an index into a translation table (for other languages), while the string is there so that English-speaking developers can modify without breaking too much flow. [1] http://errtheblog.com/post/4396 On Fri, Sep 28, 2007 at 10:45:48PM -0700, Jables wrote:> > I agree, it doesn''t look like correct syntax. The code is from the > beast forum. > All the code is available here: http://svn.techno-weenie.net/projects/beast/trunk/ > They use syntax like that in the view all over the place: > <%= ''What is Beast?''[:beast_sidebar_title] %> > The views are in .html.erb files. > > On Sep 28, 9:38 pm, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote: > > That is not correct syntax. It looks like you are missing the name of > > the hash. I should look something like: > > > > <%= ''here is a title '' + some_hash[:sidebar_title] %> > > > > Where some_hash is a hash defined in your controller. If you pasted the > > code from your controller, I could help you further. > > > > Jables wrote: > > > Can any tell me what this should be doing? What does [:sidebar_title] > > > do? > > > > > <%= ''here is a title''[:sidebar_title] %> > > > > > Thanks! > > > JB--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
FYI - figured this out. This is an example of the syntax used if you are using the Gibberish plugin. It is a localization library used for doing translation to other languages, defining repetition strings, etc. If you want more info there is a really quick and informative introduction here: http://plugins.require.errtheblog.com/browser/gibberish/README On Sep 28, 10:45 pm, Jables <brun3...-Meo6Lv8EUjg3uPMLIKxrzw@public.gmane.org> wrote:> I agree, it doesn''t look like correct syntax. The code is from the > beast forum. > All the code is available here: http://svn.techno-weenie.net/projects/beast/trunk/ > They use syntax like that in the view all over the place: > <%= ''What is Beast?''[:beast_sidebar_title] %> > The views are in .html.erb files. > > On Sep 28, 9:38 pm, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote: > > > That is not correct syntax. It looks like you are missing the name of > > the hash. I should look something like: > > > <%= ''here is a title '' + some_hash[:sidebar_title] %> > > > Where some_hash is a hash defined in your controller. If you pasted the > > code from your controller, I could help you further. > > > Jables wrote: > > > Can any tell me what this should be doing? What does [:sidebar_title] > > > do? > > > > <%= ''here is a title''[:sidebar_title] %> > > > > Thanks! > > > JB--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That makes sense, just looks strange at first glance. I haven''t had to deal with internationalization yet luckily. Jables wrote:> FYI - figured this out. This is an example of the syntax used if you > are using the Gibberish plugin. It is a localization library used for > doing translation to other languages, defining repetition strings, > etc. > > If you want more info there is a really quick and informative > introduction here: > http://plugins.require.errtheblog.com/browser/gibberish/README > > On Sep 28, 10:45 pm, Jables <brun3...-Meo6Lv8EUjg3uPMLIKxrzw@public.gmane.org> wrote: > >> I agree, it doesn''t look like correct syntax. The code is from the >> beast forum. >> All the code is available here: http://svn.techno-weenie.net/projects/beast/trunk/ >> They use syntax like that in the view all over the place: >> <%= ''What is Beast?''[:beast_sidebar_title] %> >> The views are in .html.erb files. >> >> On Sep 28, 9:38 pm, William Pratt <bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org> wrote: >> >> >>> That is not correct syntax. It looks like you are missing the name of >>> the hash. I should look something like: >>> >>> <%= ''here is a title '' + some_hash[:sidebar_title] %> >>> >>> Where some_hash is a hash defined in your controller. If you pasted the >>> code from your controller, I could help you further. >>> >>> Jables wrote: >>> >>>> Can any tell me what this should be doing? What does [:sidebar_title] >>>> do? >>>> >>>> <%= ''here is a title''[:sidebar_title] %> >>>> >>>> Thanks! >>>> JB >>>> > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---