Two forms are being called from one view.One encodes the russian text the doesn't.
- by Daniel
The menu I want to show to the users changes depending on their rights
After user authentication I redirect to my menu action which calls its view
access/menu.html.erb
<% if admin? %>
<%form_for(:user, :url => {:controller => 'admin_users',:name => session[:username]}) do |admin|%>
<ul><h2>Administrator: <%=session[:username]%></h2></ul>
<%= render(:partial =>'admin_form',:locals => {:admin => admin})%>
<%end%>
<%else%>
<%form_for(:user, :url => {:controller => 'students',:name => session[:username]}) do |student|%>
<ul><h2>???????: <%=session[:surname].to_s + " " + session[:name].to_s%></h2></ul>
<%= render(:partial =>'student_form',:locals => {:student => student})%>
<%end%>
<%end%>
And the forms look:
_student_form:
<table>
<ul>
<li><%=link_to '?????',{:controller => 'students'}%></li>
</ul>
<ul>
<li><%=link_to '?????? ?????????',{:controller => 'students'}%></li>
</ul>
<ul>
<li><%=link_to '???????? ?????? ????',{:controller => 'students'}%></li>
</ul>
<ul>
<li><%=link_to '???????? ??????',{:controller => 'students'}%></li>
</ul>
<ul>
<td> </td>
</ul>
</table>
_admin_form:
<table>
<ul>
<li><%=link_to '?????????? ????????????????',{:controller => 'AdminUsers',:role_id => 1}%></li>
</ul>
<ul>
<li><%=link_to '?????????? ????????',{:controller => 'AdminUsers',:role_id => 2}%></li>
</ul>
<ul>
<li><%=link_to '?????????? ??????????',{:controller => 'AdminUsers',:role_id => 3}%></li>
</ul>
<ul>
<li><%=link_to '?????????? ???????????',:controller => 'subjects'%></li>
</ul>
<ul>
<td> </td>
</ul>
</table>
If a log in as a student I get:
But if I log in as an administrator I get
How can this be posible??