
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
This gem provides a few features to a Rails app which aid the production of a mobile-targeted UI.
Firstly, it provides the mobile_only
and mobile_optional
blocks to your routes, these let you define particular routes which can only be accessed via your mobile prefix (default: /mobile
) or ones which will work for both desktop and mobile. For details on customising the prefix, and exact usage of the routes helpers, see the "Usage" section below.
Add this line to your application's Gemfile:
gem "mobile-enhancements"
And then execute:
$ bundle
Or install it yourself as:
$ gem install mobile-enhancements
In your config/routes.rb file:
YourApp::Application.routes.draw do
# accessible via /items and /mobile/items
mobile_optional do
resource :items
end
# only accessible via /mobile/barcode_scanner
mobile_only do
get :barcode_scanner, to: "scans#new"
end
# only accessible via /guides (normal routing)
resource :guides
end
By default the path prefix for mobile routes will be mobile/
. The app will also use layouts/application.mobile.erb
as the root mobile UI template unless specified otherwise.
You can customise these options by creating an initializer, here's an example config/initializers/mobile_enhancements.rb
file (the defaults):
require "mobile_enhancements"
MobileEnhancements.configure do
mobile do
# defines the path prefix used
prefix "mobile"
# defines the global view file
layout "mobile"
# defines the 'format' in view.format.renderer view filenames,
# to use the same HTML as standard actions, simply set to "html"
format "mobile"
end
desktop do
layout "application"
end
end
Note, in your application controller, a determine_layout
method will be defined which will choose which layout file it needs, if you want to override this in your own controllers, you can always use super
to reference the original.
A few helper methods are also provided (accessible both by your views and controllers):
mobile_request?
mobile_path(path_to_convert)
mobile_url(url_to_convert)
desktop_request?
desktop_path(path_to_convert)
desktop_url(url_to_convert)
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that mobile-enhancements 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.