has-scope

Pass current_scopes on to search

两盒软妹~` 提交于 2019-12-08 05:26:22
问题 I'm using the very helpful has_scope gem. I have an index page created by passing scopes in a link. <%= user_collections_path(@user, got: true) %> On that index page I can query the current_scopes. I have a pretty standard ransack search form on that page but using it returns results without any scopes. How can I pass the current_scopes on to the search? I tried using a hidden field but couldn't get it to work. I thought if I could pass the scopes in a link I ought to be able to pass them in

Rails 4 with has_scope: fails silently

给你一囗甜甜゛ 提交于 2019-12-08 04:16:22
问题 I have a Rails 4.0.0 app and want to include the has_scope gem. Very simple and straight resources: Model: class Thing < ActiveRecord::Base resourcify ... belongs_to :client validates_presence_of :name scope :by_client, -> client { where(:client => client)} scope :by_name, -> name { where(:name => name)} Controller: class ThingsController < ApplicationController include Pundit before_filter :authenticate_user! before_action :set_thing, only: [:show, :edit, :update, :destroy] after_action

Pass current_scopes on to search

时光毁灭记忆、已成空白 提交于 2019-12-06 15:41:59
I'm using the very helpful has_scope gem. I have an index page created by passing scopes in a link. <%= user_collections_path(@user, got: true) %> On that index page I can query the current_scopes. I have a pretty standard ransack search form on that page but using it returns results without any scopes. How can I pass the current_scopes on to the search? I tried using a hidden field but couldn't get it to work. I thought if I could pass the scopes in a link I ought to be able to pass them in a form but after googling I'm not sure that is true. Search form <%= search_form_for @search, :html =>