Files

Class Index [+]

Quicksearch

Ubiquo::RequiredFields

Usage: Add ‘required_fields’ to your ActiveRecord model:

 class YourModel < ActiveRecord::Base
   required_fields :name
 end

If you use ‘validates_pressence_of’ it will automaticaly detected as required field.

Once a field is marked as required, it will show an asterisk(*) in field label inside the form

 <% form_for ... do |form|>
   <%= form.label :name, "Name" %>
 <% end %>

this label will be

 <label for="yourmodel_name">Name *</label>

This extension also provides an optional value for label_tag helper named ‘append_asterisk’ that only appends an asterisk after the label content.

This asterisk can be manually disabled from view, just adding :append_asterisk => false to the helper options:

 <%= form.label :name, "Name", :append_asterisk => false %>

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.