Sha256: 2058b74091b9ee7adcc59b2d0e93fea2588d207fa4575316399341f9e7093e66
Contents?: true
Size: 800 Bytes
Versions: 82
Compression:
Stored size: 800 Bytes
Contents
class Admin::LinkablesController < Admin::BaseController layout false def index term = params[:term] type = params[:type] resp = {} if term && term.size > 3 && (linkable = Linkable.get(type)) column = :"#{title_column(linkable)}" linkable.where( linkable.arel_table[column].matches("%#{term}%") ).select([:id, column]).each do |l| resp[l.id] = l.send(column) end end render :json => resp end def fields @linkable = Linkable.get(params[:type]) @target = params[:target] @field_name = params[:field_name] if params[:current_type].present? && params[:current_id].present? @currently_linked = Linkable.get(params[:current_type]).find(params[:current_id]) end end end
Version data entries
82 entries across 82 versions & 1 rubygems