Hi,

Thanks for the suggestions. I have now included the code to display the 
error messages. Here is the code for my MVC

model
class Record
  include ActiveModel::Validations
  validates: :ipaddress, :name, :presence => true
end

View

    <%= form_for :Record, :url => {:action => 'submit'} do |f| %>
      <%= f.error_messages %>
      <div class="field">
        <%= f.label :ipaddress %><br />
        <%= f.text_field :ipaddress  %>
      </div>
      <div class="field">
        <%= f.label :name %><br />
        <%= f.text_field :name  %>
      </div>
      <div class="actions">
        <%= f.submit "Submit"%>
      </div>
    <% end %>

Controller
Somehow this gets routed to action "create" instead of "submit" when the 
submit button is called. Not sure why it is

def create  -> same for def submit too

  respond_to do |format|
     if PARAM matches so and so
       DEPENDING on params this gets routed to different page
     else
       format.html { redirect_to records_url}
       format.json { head :no_content }
    end
  end

end

Should i write my controller differently to handle the errors?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to