core/rails/app/controllers/nodes_controller.rb
# We allow nodes to match on arbitrary node-bound attribs
# as well as native model attributes.
# This makes simple API queries easier to express
We allow nodes to match on arbitrary node-bound attribs
as well as native model attributes.
This makes simple API queries easier to express
We allow nodes to match on arbitrary node - bound attribs as well as native model attributes . This makes simple API queries easier to express
def match
    attrs = model.attribute_names.map{|a|a.to_sym}
    ok_params = params.permit(attrs)
    mv = model.params_to_mv(params)
    objs = case
           when ok_params.empty? && mv.empty?
             model.where('false')
           when ok_params.empty? && !mv.empty?
             visible(model, cap("READ")).where_jsonb(mv)
           when mv.empty? && !ok_params.empty?
             visible(model, cap("READ")).where(ok_params)
           else
             visible(model, cap("READ")).where(ok_params).where_jsonb(mv)
           end
    respond_to do |format|
      format.html {}
      format.json { render api_index model, objs }
    end
  end
def match attrs = model . attribute_names . map { | a | a . to_sym } ok_params = params . permit ( attrs ) mv = model . params_to_mv ( params ) objs = case when ok_params . empty? && mv . empty? model . where ( 'false' ) when ok_params . empty? && ! mv . empty? visible ( model , cap ( "READ" ) ) . where_jsonb ( mv ) when mv . empty? && ! ok_params . empty? visible ( model , cap ( "READ" ) ) . where ( ok_params ) else visible ( model , cap ( "READ" ) ) . where ( ok_params ) . where_jsonb ( mv ) end respond_to do | format | format . html { } format . json { render api_index model , objs } end end
We allow nodes to match on arbitrary node-bound attribs
as well as native model attributes.
We allow nodes to match on arbitrary node - bound attribs as well as native model attributes .