Answer by Ram for Rails select helper. How do I select the default value?
The fix is to explicitly specify the selected option. It now looks likes this and works<%= f.select(:visiting_team_id, Team.all.collect{|t| [t.name, t.id]}, {:selected =>...
View ArticleAnswer by Gareth for Rails select helper. How do I select the default value?
Just ensure that the object you're passing to form_for has the correct visiting_team_id set. Then, so long as there's a team that gets pulled out with that ID, it should work
View ArticleRails select helper. How do I select the default value?
In Rails erb, am using the snippet to show visiting team in a tournament match. How do I get to initially show the current visiting_team? What am I doing wrong?<%= f.select(:visiting_team_id,...
View Article