
Security News
ESLint Adds Support for Parallel Linting, Closing 10-Year-Old Feature Request
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
CheckPath extends ActionView::Helpers::UrlHelper in Rails application.
It just add some methods, such as root_path?
, post_path?(id: 1)
, and so on.
Add this line to your application's Gemfile:
gem 'check_path'
And then execute:
$ bundle
When you add to Gemfile
and run bundle install
, you can use some methods in view files.
If your config/routes.rb
is follows:
Rails.application.routes.draw do
resources :posts, only: [:index, :new, :edit, :show]
root 'posts#index'
end
Then following methods are available in your view files:
root_path?
posts_path?
new_post_path?
edit_post_path?(:id)
post_path?(:id)
For example, you can check current page is new_post_path
or not in app/views/layouts/application.html.erb
:
<% if new_post_path? %>
<!-- Show only in new_post_path -->
<% end %>
As you know, the logic of these methods are as follows. So you might this gem is not required.
def root_path?
current_page?(root_path)
end
However, using this gem, your code will more clearly.
FAQs
Unknown package
We found that check_path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.