Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Add little stars to the required fields in your form
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
MIT-LICENSE
README
Rakefile
init.rb

README

AttributeCop
============

Know those little red stars that appear next to required fields in a form? AttributeCop can automatically add them for you. Just install to vendor/plugins.


Example
=======

Model
-----
    class Person < ActiveRecord::Base
      validates_presence_of :name
    end

View
----
    <%= form_for @person do |f| %>
      <%= f.label :name %>
    <% end %>

HTML (from the view)
--------------------
    ...
    <label for="person_name" class="required">Name</label>
    ...

CSS
---
    label.required:after {
      color: red;
      content: " *";
    }


Copyright (c) 2011 Zach Church, released under the MIT license
Something went wrong with that request. Please try again.