On Feb 17, 2009, at 5:52 PM, Guillaume Loader wrote:

>
> Hi everyone,
>
> I have a problem. I want to display a different select box wether the
> current user is an admin or an user.
>
> So I thought I could do this in my view where my form is displayed :
>
>  <p class="form-input">
>    <%= f.label(:role_id, 'Role:') %>
>  <%

<%=
   ^
  if you want output, you generally need <%= (if you get to the point  
that you know to generate output from <% %>, then you will KNOW when  
to use them)

-Rob

>
>  if (current_user.admin?)
>  then collection_select(:user, :role_id, Role.find(:all, :order =>
> "name desc"), :id, :name)
>  else # Here I would code an another collection_select
>  end
>  %>
>  </p>
>
>
>
> But It doesn't work. Nothing is displayed!
> Could you help me?
>
> Thanks!
> -- 
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to