Reputation: 8154
Just set up ActiveAdmin without any real issues, but when I get to any edit/create forms, I get a small issue:
I have an attribute for my users called "shortcut_url" which defines only the path to the users' page i.e. example.com/userjohn where userjohn would be the shortcut url. Activeadmin recognizes the attribute as a URL and won't let me create a user validating that "userjohn" is nopt a valid URL. I commend ActiveAdmin for being smart enough to catch "url" in the attribute name, but in this case, I'd rather not have this validation. Does anyone know where I can find a place to override this validation? I poked through the documentation, but to no avail... Any help would be appreciated!
Upvotes: 0
Views: 2325
Reputation: 5521
I think it's actually formtastic which determines the input type. To override the validation you just need to change the input type. I had an issue with this with a field called "website" (it kept saying my url wasn't allowed).
Here's an example of app/admin/user.rb:
form do |f|
f.inputs do
f.input :name
f.input :website, :as => :string # sets the input type to type="text"
end
f.buttons
end
It's actually just some styles that come built in with active_admin. I know for sure they have validations on type="url" and type="email". There's probably a better way around it (disabling the style in the stylesheets) but this will get you going.
Ryan
Upvotes: 3