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 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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.