Sha256: 92fcf519ea7efa322ea5610b1c9ab88b9f8509f593dc73dc98a935e6e4f57573
Contents?: true
Size: 569 Bytes
Versions: 9
Compression:
Stored size: 569 Bytes
Contents
module InferredCrumpets class RouteChecker def initialize(view_context) @view_context = view_context end def linkable?(subject) @view_context.url_for(subject) && true rescue NoMethodError false end def can_route?(subject, action, params = {}) @view_context.url_for({ action: action, controller: subject.class.table_name, }.merge(params)) rescue ActionController::RoutingError # Rails 3 false rescue ActionController::UrlGenerationError # Rails 4+ false end end end
Version data entries
9 entries across 9 versions & 1 rubygems