User.includes(:users_roles).references(:users_roles).where(usesr_roles: { id: 1 })
class DoesntMatch
def initialize(options)
@options = options
end
def matches?(request)
@options.inject(true) { |m, (k,v)|
m && (request.send(k) !~ v)
}
end
end
match "/:url" => "main#article", as: :article, constraints: DoesntMatch.new(path: /^\/favicon\.ico/)
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8