Fix scaffold view generator templates for reference attributes

Rails generates field with an _id suffix for reference attributes, see
https://github.com/rails/rails/blob/master/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb#L24-L30

This commit should fix this case by using attribute.column_name instead of
attribute.name as used by the Rails generator template.
Invoke #column_name when available, use #name otherwise

Thanks @cupakromer for the suggestion

Note: include tests only for Rails >= 4.0.0
Setup local variable for attribute name; simpler check for Rails version

See also:

* https://github.com/rspec/rspec-rails/pull/937#commitcomment-6170626
* https://github.com/rspec/rspec-rails/pull/937#commitcomment-6170693
Merge pull request #937 from potomak/fix-scaffold-view-generator-templates

Fix scaffold view generator templates for reference attributes in Rails 4.x