pg_search

https://github.com/casecommons/pg_search

Ruby

pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search

LabelsHelper#link_to_label

Link to a Label

label   - Label object to link to
subject - Project/Group object which will be used as the context for the
          label's link. If omitted, defaults to the label's own group/project.
type    - The type of item the link will point to (:issue or
          :merge_request). If omitted, defaults to :issue.
block   - An optional block that will be passed to `link_to`, forming the
          body of the link element. If omitted, defaults to
          `render_colored_label`.

Examples:

  # Allow the generated link to use the label's own subject
  link_to_label(label)

  # Force the generated link to use a provided group
  link_to_label(label, subject: Group.last)

  # Force the generated link to use a provided project
  link_to_label(label, subject: Project.last)

  # Force the generated link to point to merge requests instead of issues
  link_to_label(label, type: :merge_request)

  # Customize link body with a block
  link_to_label(label) { "My Custom Label Text" }

Returns a String

Source | Google | Stack overflow

Edit

git clone [email protected]:casecommons/pg_search.git

cd pg_search

open

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-LabelsHelper-link_to_label-for-pr


# Commit to git

git add git commit -m "better docs for LabelsHelper#link_to_label"


# Open pull request

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

hub fork

git push <your name> -your-name--update-docs-LabelsHelper-link_to_label-for-pr

hub pull-request


# Celebrate!