
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Simplify matching of Rails routes. You are unhappy with the link_to_if
helper?
Then check out this gem! You can now match controllers and actions as they are defined in your routes.rb.
Add this line to your application's Gemfile:
gem 'rails_navigation'
And then execute:
$ bundle
Works like current_page? Example:
matches_page?('controller#action')
with multiple conditions:
matches_page?(['controller#action', 'other_controller#action'])
Uses matches_page?
and creates a link and a li element
Source code, if you want to customize it:
def nav_to(name, path, conditions = nil)
content_tag :li, link_to(name, path), class: ('active' if matches_page?(conditions))
end
You have a webseite full of books and want to show an edit button on the books#show page.
matches_page?('books#show')
Matching controllers:
{ controller: "pages" } becomes 'pages'
Matching controllers and actions:
{ controller: "pages", action: "new" } becomes 'pages#new'
Matching controllers, actions and params:
{ controller: "pages", action: "show", params: { id: 'homepage' } } becomes 'pages#new?id=homepage'
Or even simpler (id is the default):
{ controller: "pages", action: "show", params: { id: 'homepage' } } becomes 'pages#new?homepage'
rails_navigation adds 2 helpers
not
operatorgit checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.