<% chosen_class = "chzn-select-#{attribute_id}" %>

<li id="<%= attribute_id %>_li">
  <%= form.label attribute, label_text %>
  <% if values.any? %>
    <%= form.select related_fk, values, options, html_options.merge(:class => chosen_class, :style => "width: 350px;") %>
  <% else %>
    <%= Typus::I18n.t("No entries found.") %>
  <% end %>
</li>

<script type="text/javascript">
  $(document).ready(function () { $(".<%= chosen_class %>").chosen(); });
</script>

<% chosen_class = "chzn-select-#{attribute_id}" %>

<li id="<%= attribute_id %>_li">
  <%= form.label attribute, label_text %>
  <% if values.kind_of?(String) %>
    <%= select_tag related_fk, values.html_safe, options.merge(html_options).merge(:class => chosen_class, :style => "width: 350px;", :id => "#{form.object.class.name.underscore}_#{related_fk}", :name => "#{form.object.class.name.underscore}[#{related_fk}]") %>
  <% elsif values.any? %>
    <%= form.select related_fk, values, options, html_options.merge(:class => chosen_class, :style => "width: 350px;") %>
  <% else %>
    <%= Typus::I18n.t("No %{resources} found.", :resources => related.model_name.human.downcase.pluralize) %>
  <% end %>
</li>

<script type="text/javascript">
  $(document).ready(function () { $(".<%= chosen_class %>").chosen(); });
</script>

Fix view bug when using belongs_to a model that have a tree.
Fix view bug when using belongs_to a model that have a tree.