validation for models in ruby on rails <p>I have a model:</p> <pre><code>class HelloRails &lt; ActiveRecord::Base attr_accessible :filename, :filevalidate include In4systemsModelCommon validates :filename, presence: true def update parameters = [self.filename, @current_user] parameters.map!{|p| ActiveRecord::Base.connection.quote p} sql = "call stored_procedure(#{parameters.join(',')})" ActiveRecord::Base.connection.execute(sql) end end </code></pre> <p>In the view I have a <code>text_field</code> called as <code>:filename</code>. When I click the submit button it calls this update method in model to call the stored proc to execute. Now validations are not working. </p> <p>I dont want to accept <code>nil</code> for filename. How can I do this?</p>