Search code examples
ruby-on-rails-5simple-form

Rails:Automatic Validation of Attribute Accessor


I am new to Rails and I encountered a unique behaviour(seems magick to me for now).

I added an attribute accessor in a models file

attr_accessor :git_url

I am sure I did not add any validation for this accessor.

I am using simple form gem for forms. When I include this accessor in the form and submit the form by entering invalid url, a hint appears (Please enter a URL) and form does not submit

<%= f.input :git_url %>

Its cool but I wanna know from where is this validation coming

Help would be greatly appreciated!


Solution

  • According to readme, git_url ends with url. This is triggering input type=url