the model


			
validates_confirmation_of :password

the view


			
<%= f.password_field :password %>
<%= f.password_field :password_confirmation %>

a controller


			
@foo = FooModel.new(params[:foo])
@foo.save # true if they match, false if they don't