Hello,
I have in my view a select tag that doesnt return the right value, could
anyone point me what am I doing wrong?
Heres whats in my view
<%=select "", "situacao",
{"Open"=>0,"Closed"=>
1},:include_blank=>true%>
Then in my controller I do this
def status
if request.post?
#Do some stuff
@situacao = params[:situacao]
#some more code
end
end
The problem is that params[:situacao] always returns 0, even when I pick
"Closed"
Any help?
coelho
--
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
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
-~----------~----~----~----~------~----~------~--~---
Hi, coelho coelho wrote:> <%=select "", "situacao", {"Open"=>0,"Closed"=> 1},:include_blank=>true%>What is the empty string for? If you put something into it, <%=select "foo", "situacao", {"Open"=>0,"Closed"=> 1},:include_blank=>true%> you can use @situacao = params[:foo][:situacao] Lutz -- 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 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 -~----------~----~----~----~------~----~------~--~---
Hi Lutz Thank you, it worked fine the way said> <%=select "foo", "situacao", {"Open"=>0,"Closed"=> > 1},:include_blank=>true%>But now in the same form I have a date select that is always returning nil ... <label for="data_ini">Data Inicio</label> <%= date_select("foo", "data_ini", :order=>[:day, :month, :year]) %> whats wrong there? Coelho -- 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 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 -~----------~----~----~----~------~----~------~--~---