sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

String#foreign_key

Creates a foreign key name from a class name.
+separate_class_name_and_id_with_underscore+ sets whether
the method should put '_' between the name and 'id'.

  'Message'.foreign_key        # => "message_id"
  'Message'.foreign_key(false) # => "messageid"
  'Admin::Post'.foreign_key    # => "post_id"

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/inflections.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-String-foreign_key-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/string/inflections.rbgit commit -m "better docs for String#foreign_key"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-String-foreign_key-for-pr

hub pull-request


# Celebrate!