Hi Everyone,

I've been using Ruby roughly since 2003, but I never could understand
Rails nor do something meaningful with them.
At last thanks to wonderful people from Rails Guides at
http://guides.rubyonrails.org/getting_started.html I began to
understand Rails.

At the moment I am trying to do Rails version of a website I made
recently using PHP.

I am trying to make series of tabs linking to other pages on the site.
An I have put following code in views/partials/_partail1 which is used
by view of each page, eg. views/page/page.html.erb

<%
def checkclass(path)
  uri=request.env['REQUEST_URI']
  if path==uri
    cl='current'
    #cl - class attribute in HTML <A> tag
  else
    cl='other'
  end
end
tabs=[['Home page','/'],
['How we work','/howwework'],
['Contact Us', '/contactus']]
%>
<!--**tabs start**-->
<%
x=0
tabs.each do |tab| %>
<%= link_to tab[0],tab[1], :id=>x+=1, :class => checkclass(tab[1]) %>
<!-- ^^^^^^^^^^^^-->
<%
end
%>

So here are my questions:
1 Is it appropriate to put such code here?
2 how can I display the link  in the line above <!-- ^^^^^^^^^^^^-->
without using too many tag like this <%= %>. render :text and
render :inline don't seem to work, I either get error messages or
nothing at all.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to