Restful Form Validations

Does the new Restful features of Edge support form validation?

I have “validates_presence_of :x” in my model, but rails spills it’s
beans with and error: “ActiveRecord::RecordInvalid”

What I’d it to do is return the form with the usual fieldWithErrors divs

Has anyone got this working?

thanks :slight_smile: Jason

Jason B wrote:

Does the new Restful features of Edge support form validation?

I have “validates_presence_of :x” in my model, but rails spills it’s
beans with and error: “ActiveRecord::RecordInvalid”

What I’d it to do is return the form with the usual fieldWithErrors divs

Has anyone got this working?

thanks :slight_smile: Jason

the validates_presence_of :x will raise an ActiveRecord::RecordInvalid
exception if :x is not presence. You would have to catch the exception.

For example:

def test
begin
s = SomeRecord.new
s.save
redirect_back_or_default(:action => ‘done’)
rescue ActiveRecord::RecordInvalid
render :action => ‘test’
end
end