Sha256: 1096201eb05b457b6d88341230ad8a355ed663fcb3749072eb3ad9677a3de1b9

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

<% if resource.errors.any? %>
  <div id="error_explanation">
    <%= pluralize(resource.errors.count, 'error') %>
    prohibited this resource from being saved:
    <ul>
      <% resource.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
    </ul>
  </div>
<% end %>

<%= form_for(resource, url: resource_form_path) do |f| %>
  <ul>
    <% resource_human_attributes.each do |field| %>
      <li>
        <%= f.label(field) %>
        <%= 
          if resource_class.columns_hash["#{field}"].type == :text
            f.text_area(field) 
          elsif field.match(/_id$/)
            parent_class = field.sub(/_id$/, '').classify
            f.select(field, eval(parent_class).all.map { |p| [p.name, p.id] })
          else
            f.text_field(field) 
          end
        %>
      </li>
    <% end %>
  </ul>
  <%= f.submit %>
<% end %>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
power_resource-0.0.3 app/views/power_resource/builders/_form_for.html.erb
power_resource-0.0.2 app/views/power_resource/builders/_form_for.html.erb