It may be a bit trivial question, but always bothered me:
Are there any specific reasons for Rails to use double quoted strings instead of single quoted strings (as rubocop suggests) in schema.rb?
It may be a bit trivial question, but always bothered me:
Are there any specific reasons for Rails to use double quoted strings instead of single quoted strings (as rubocop suggests) in schema.rb?
You may find it useful to exclude the schema file from Rubocop's inspections by adding it to the .rubocop.yml
file:
AllCops:
Exclude:
- db/schema.rb
The reason schema.rb
is using double quotes is that most of the formatting is done by calling #inspect
on a number of predefined strings, e.g.:
# schema_dumper.rb:91
stream.puts " enable_extension #{extension.inspect}"
And String#inspect
prints the string with surrounding double quotes, i.e.:
"foo".inspect
#=> "\"foo\""
That said, RuboCop is there to catch human mistakes, so there's no need to include files generated by the framework, which are not meant to be edited manually. (You would still want to inspect application files created using the Rails generators.)