Two forms are being called from one view.One encodes the russian text the doesn't.
Posted
by
Daniel
on Stack Overflow
See other posts from Stack Overflow
or by Daniel
Published on 2011-01-06T10:50:25Z
Indexed on
2011/01/06
10:53 UTC
Read the original article
Hit count: 188
ruby-on-rails3
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??
© Stack Overflow or respective owner