jeudi 13 août 2015

how to show html in rails options_from_collection_for_select

I used rails options_from_collection_for_select for select

options_from_collection_for_select(@tenants, :id, :tenant_text_value, current_tenant.try(:id))```

def tenant_text_value
    "<a href='http://www.google.com'>google</a>".html_safe
  end

I want <option value="215"><a href='http://www.google.com'>google</option> and when I click a and go to google.

however, I just got <option value="215">google</option>

If I use "<a href='http://www.google.com'>google</a>".to_s and I got <option value="215"><a href='http://www.google.com'>google</a></option> just a text not a link.

What should I do ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire