Am 24.10.2012 um 22:32 schrieb Colin Law <clan...@googlemail.com>: Hi Colin..
<%= f.collection_select :parent_id, Project.mainprojects.active, :id, :project_name, :include_blank => 'Partproject?', :allow_nil => true%> the project_id .. 1, 2 etc. or "" "parent_id"=>"1" "parent_id"=>"" Werner > On 24 October 2012 21:01, Werner <webagentur.la...@googlemail.com> wrote: >> Hi.. >> I have a select which I want to validate if a value is selected, otherwise >> not. >> >> <%= f.collection_select :parent_id, Project.mainprojects.active, :id, >> :project_name, :include_blank => 'Partproject?', :allow_nil => true%> >> >> how is the correct way..? >> >> tried..in model >> if :project_id >> if :project_id? >> if :project_id.blank? >> >> >> etc . etc. >> But nothing works.. > > So what is the value of project_id that you are trying to test for? > If you are not sure then have a look at the Rails Guide on debugging > which will show you techniques that you can use to debug your code. > Then you can find out what is the value of project_id and why your > tests are not working. > > Colin > > -- > 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@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > Werner Laude webagentur.la...@gmail.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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.