I have a model Client which contains an array field.
In the client.rb model I tried something like this :
field :menu_top
...
validates_length_of :menu_top, :maximum => 4
It seems to work but if I put more than 4 item in this array in the form, it sends me this =>
undefined method `admin_client_path' for #<#<Class:0x007fbc80a63cb0>:0x007fbc80b566b8>
Extracted source (around line #1):
1: <%= form_for [:admin, @client], :url => @post_form_path, :html => { :multipart => true } do |f| %>
2: <% if @client.errors.any? %>
3: <div class="alert-message block-message error">
4: <h2 class="dark-red"><%= pluralize(@client.errors.count, t(:error)) %> <%= t(:client_error) %>:</h2>
I don’t understand why it doesn’t render a form error.
You have your menu entries stored in the array and you are rendering the menu entries dynamically out of this array, right?
Now you have specified an menu entry in your array which isn’t defined as such in the
routes.rb. Try to runrake routesand check ifadmin_client_pathis really there.The error has nothing to do with your validation.