RE: Linking two HTML SELECT's together

Here’s what I did… Very hastily hacked from an existing program:

View page:

<%=options_from_collection_for_select(@projects, "id", "name", params['pid'].to_i )%> Select a project.


def ajax_project_members
res = “”
p = Project.find(id, :include=>[:teammembers]) rescue nil
if p.nil?
res = ‘Choose a project’
res += "
res += options_from_collection_for_select p.teammembers, “id”,
res +=""
return result


Looking at this now, I notice it could be done a little differently (you
could just use <%select %> instead of options_from_collection… But
this still works. (this was originally for a form that had multiple
tasks that you could move to a different project.)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs