query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Restituisce il secondo elemento della lista.
def secondo self[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items\n (rest.elements || []).inject([first]) { |list, el| list << el.item }\n end", "def get_items\r\n @list\r\n end", "def list\n @list.dup\n end", "def get_items\n\t\treturn @list\n\tend", "def get_list\n \t@items\n end", "def list\n @list\n end", "def list\n ...
[ "0.6162099", "0.609335", "0.6055123", "0.6029847", "0.6015067", "0.5855871", "0.5801374", "0.57545817", "0.56842977", "0.5680686", "0.56645155", "0.56031257", "0.5593922", "0.55935556", "0.5592344", "0.55576235", "0.5529979", "0.5529979", "0.5529979", "0.5517792", "0.5510082"...
0.0
-1
Restituisce la lista togliendo gli ultimi n elementi.
def tronca(n = 1) self[0..(-1 - n)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ordenar_for\n\t @lista = self.map{ |a| a }\n\t \tfor i in (0..@lista.count-1)\n\t\t\tfor j in (0..@lista.count-1)\n\t\t\t\tif j+1 != @lista.count\n if @lista[j+1] < @lista[j]\n\t\t\t\t\t\t@lista[j],@lista[j+1] = @lista[j+1],@lista[j]\n \t\t\t\tend\n\n\t\t\t\ten...
[ "0.6269149", "0.6014838", "0.59583116", "0.59583116", "0.59583116", "0.5865234", "0.58580434", "0.57693136", "0.57093656", "0.5705259", "0.5693585", "0.5644706", "0.5627828", "0.5614846", "0.5570325", "0.5570325", "0.5570325", "0.5570325", "0.5570325", "0.5537812", "0.5482743...
0.0
-1
Restituisce la lista saltando il primo elemento.
def salta_il_primo self.drop 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imprimir\n aux = @head\n lista = []\n while (!aux.nil?)\n lista << aux[:value].to_s\n aux = aux[:next]\n end\n return lista\n\n end", "def shopping_list\n self.ingredients.map {|i| i...
[ "0.59449035", "0.59392095", "0.5886283", "0.575966", "0.5756661", "0.57466465", "0.5574112", "0.5509037", "0.5508486", "0.5504133", "0.5504133", "0.5504133", "0.550339", "0.54947776", "0.5445131", "0.5424564", "0.54188937", "0.54157424", "0.5393339", "0.5393339", "0.5393339",...
0.0
-1
GET /reservations GET /reservations.xml
def reservations_to_pdf sort_init 'Utente', 'ASC' sort_update 'Utente' => 'users.lastname', 'Login' => 'users.login', 'N' => 'num_persone', 'Provenienza' => 'comunes.name', 'Tel' => 'users.telefono', 'Id' => 'users.id' respond_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @reservation = Reservation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reservation }\n end\n end", "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def index\n\n if requ...
[ "0.7161182", "0.71253794", "0.7115218", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.70858777", "0.6909708", "0.68175125", ...
0.0
-1
GET /reservations/1 GET /reservations/1.xml
def show @reservation = Reservation.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @reservation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def index\n\n if request.format == Mime::XML\n limit=params[:limit].nil? ? 1000: params[:limit]\n else\n limit=params[:limit].nil? ? 50 : params[:limit]\n end\n\n @reservations = Reservation.pagina...
[ "0.6965331", "0.6929731", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6743783", "0.6633299", "0.65997463", "0.6556294", "0.64896953", ...
0.7289305
0
GET /reservations/new GET /reservations/new.xml
def new @reservation = Reservation.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @reservation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reservation }\n end\n end", "def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render j...
[ "0.7143801", "0.7143801", "0.7143801", "0.7130898", "0.7005288", "0.6814165", "0.6719831", "0.67152464", "0.6712699", "0.6712699", "0.66624767", "0.66624767", "0.66624767", "0.6653465", "0.6651567", "0.6633181", "0.6632868", "0.6617175", "0.6606841", "0.66007656", "0.65915364...
0.7792944
0
POST /reservations POST /reservations.xml
def create @reservation = Reservation.new(params[:reservation]) respond_to do |format| if @reservation.save format.html { redirect_back_or_default home_url } #format.html { redirect_to(@reservation, :notice => 'Reservation was successfully created.') } format.xml { render :xml => ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\r\n @reservation = Reservation.new(reservation_params)\r\n respond_to do |format|\r\n if @reservation.save\r\n format.html { redirect_to reservations_path, notice: 'Reservation was successfully created.' }\r\n format.json { render :show, status: :created, location: @reservation ...
[ "0.66003203", "0.6582662", "0.6582662", "0.64778715", "0.64249355", "0.6417047", "0.63793206", "0.6361036", "0.6361036", "0.6351788", "0.6333636", "0.63305885", "0.63294536", "0.6323282", "0.6235498", "0.62221956", "0.62021583", "0.61912584", "0.61809444", "0.6173125", "0.616...
0.6536515
3
PUT /reservations/1 PUT /reservations/1.xml
def update @reservation = Reservation.find(params[:id]) respond_to do |format| if @reservation.update_attributes(params[:reservation]) format.html { redirect_to(@reservation, :notice => 'Reservation was successfully updated.') } format.xml { head :ok } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def set_reservations\n @reservation = Reservation.find(params[:id])\n end", "def update\n puts @reservation.inspect\n respond_to do |format|\n if @reservation.update(reservation_params)\n format.html ...
[ "0.6461941", "0.6461941", "0.6154555", "0.6145174", "0.6138927", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6081948", "0.6074475", "0.6043802", "0.6043802", "0.6043802", "0.60021114", "0.60021114", ...
0.6406043
2
DELETE /reservations/1 DELETE /reservations/1.xml
def destroy @reservation = Reservation.find(params[:id]) @reservation.destroy respond_to do |format| format.html { redirect_to(reservations_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @reservation = Reservation.find(params[:id])\n @reservation.destroy\n\n respond_to do |format|\n format.html { redirect_to(reservations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end...
[ "0.71827906", "0.67169636", "0.6576343", "0.6576343", "0.6576343", "0.6576343", "0.6572178", "0.65065503", "0.64863217", "0.64863217", "0.64863217", "0.64737564", "0.6466962", "0.6456206", "0.64471173", "0.64390254", "0.64310944", "0.6398783", "0.6392583", "0.63824046", "0.63...
0.7221794
0
GET /submission_results GET /submission_results.json
def index @submission_results = SubmissionResult.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n submission = Submission.find(params[:submission_id])\n @test_case_results = submission.test_case_results\n end", "def index\n @submission_responses = SubmissionResponse.all\n end", "def show\n @submission_result = SubmissionResult.includes(:test_case_results).find(params[:id])\n end"...
[ "0.7390759", "0.7163916", "0.6802032", "0.678928", "0.6757752", "0.6757752", "0.6757752", "0.6757752", "0.66576356", "0.66455895", "0.6622458", "0.660708", "0.6576471", "0.6575907", "0.6555882", "0.6555882", "0.65447015", "0.6471647", "0.64646345", "0.64219725", "0.6420606", ...
0.79684424
0
GET /submission_results/1 GET /submission_results/1.json
def show @submission_result = SubmissionResult.includes(:test_case_results).find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @submission_results = SubmissionResult.all\n end", "def index\n submission = Submission.find(params[:submission_id])\n @test_case_results = submission.test_case_results\n end", "def index\n @submission_responses = SubmissionResponse.all\n end", "def retrieve_submission\n templat...
[ "0.77256924", "0.7251825", "0.6989221", "0.69418555", "0.6871204", "0.68260944", "0.68260944", "0.6802846", "0.6594443", "0.6560964", "0.65606475", "0.65550345", "0.65550345", "0.65550345", "0.65550345", "0.650151", "0.64129335", "0.64045477", "0.6395195", "0.6382146", "0.638...
0.7033453
2
POST /submission_results POST /submission_results.json
def create @submission_result = SubmissionResult.new(submission_result_params) respond_to do |format| if @submission_result.save format.html { redirect_to @submission_result, notice: 'Submission result was successfully created.' } format.json { render action: 'show', status: :created, loc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def index\n @submission_results = SubmissionResult.all\n end", "def create\n submission = Submission.get_submission_by_grouping_id_and_assig...
[ "0.7124225", "0.7064563", "0.6760056", "0.6665677", "0.66495275", "0.6527385", "0.64537793", "0.6412552", "0.6397118", "0.63867646", "0.6342043", "0.63074267", "0.62802935", "0.6249306", "0.6234819", "0.62332344", "0.6211574", "0.62114686", "0.6204302", "0.6204277", "0.616616...
0.7039193
2
PATCH/PUT /submission_results/1 PATCH/PUT /submission_results/1.json
def update respond_to do |format| if @submission_result.update(submission_result_params) format.html { redirect_to @submission_result, notice: 'Submission result was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @submission.update(submission_params)\n format.html { redirect_to @submission}\n format.json { render :show, status: :ok, location: @submission }\n else\n format.html { render :edit }\n format.json { render json: @submission.errors, ...
[ "0.6775156", "0.674475", "0.6743323", "0.67301804", "0.66888374", "0.66888374", "0.6686818", "0.6624133", "0.6586287", "0.65767246", "0.6568425", "0.6561746", "0.6558228", "0.6517533", "0.64941233", "0.64554495", "0.6445699", "0.63986826", "0.6388781", "0.63738143", "0.635423...
0.7154969
0
DELETE /submission_results/1 DELETE /submission_results/1.json
def destroy @submission_result.destroy respond_to do |format| format.html { redirect_to submission_results_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @test_submission = TestSubmission.find(params[:id])\n @test_submission.destroy\n\n respond_to do |format|\n format.html { redirect_to test_submissions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @submission.destroy\n respond_to do |format|\n forma...
[ "0.7619652", "0.7617293", "0.7617293", "0.7617293", "0.7563682", "0.7563682", "0.7563238", "0.73152316", "0.73152316", "0.73152316", "0.73063284", "0.73063284", "0.73063284", "0.73063284", "0.73063284", "0.73063284", "0.73063284", "0.72878647", "0.72745824", "0.7214891", "0.7...
0.79531574
0
Use callbacks to share common setup or constraints between actions.
def set_submission_result @submission_result = SubmissionResult.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def submission_result_params params[:submission_result] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Input: One positive integer Output: Array of digits in the number EXAMPLES: puts digit_list(12345) == [1, 2, 3, 4, 5] => true puts digit_list(7) == [7] => true puts digit_list(375290) == [3, 7, 5, 2, 9, 0] => true puts digit_list(444) == [4, 4, 4] => true DATA STRUCTURE: Array (use Integerdigits to split integer into a...
def digit_list(integer) integer.digits.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digit_list(num)\n int_array = []\n digit_array = num.to_s.split(//)\n digit_array.each do |numb|\n int_array += [numb.to_i]\n end\n int_array\nend", "def digit_list(int)\n string_ints = int.to_s\n array_string_ints = string_ints.split(//)\n ints = Array.new\n array_string_ints.each do |st...
[ "0.8055849", "0.7866037", "0.78503895", "0.78258955", "0.77912396", "0.77899283", "0.7630822", "0.7628536", "0.76197094", "0.76197094", "0.7582936", "0.757754", "0.757512", "0.7560689", "0.7553956", "0.7546049", "0.75367886", "0.75367886", "0.75367886", "0.75367886", "0.75367...
0.65921307
63
list all patients in the index page
def index @patients = Patient.order('last_name ASC') #find the latest patient made @id = Patient.maximum(:id) if(@id != nil) @patient = Patient.find(@id) File.open("public/patient_info.json", "w"){ |f| f << @patient.to_json} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @patients = Patient.all\n end", "def index\n @patients = Patient.all\n end", "def index\n @patients = Patient.all\n end", "def index\n @patients = Patient.all\n end", "def index\n @patients = Patient.all\n end", "def index\n @patients = Patient.paginate(:page => params[...
[ "0.85257894", "0.85257894", "0.85257894", "0.85257894", "0.85257894", "0.8317941", "0.8237451", "0.8109644", "0.80328226", "0.8002199", "0.7989553", "0.7960909", "0.79088813", "0.7866011", "0.78204274", "0.7810586", "0.7796994", "0.77676606", "0.7758299", "0.77255595", "0.771...
0.0
-1
patient to be shown in the show page
def show @patient = Patient.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @patient = @patient_visit.patient\n render layout: \"item_form_metaelements\"\n end", "def show\n @patient = Patient.find(params[:id])\n @emergency_contacts = @patient.patient_emergency_contacts\n @progress_notes = @patient.progress_notes\n @intake_notes = @patient.intake_no...
[ "0.7638247", "0.7635435", "0.7452706", "0.7414806", "0.7414251", "0.72831404", "0.72415596", "0.71131533", "0.70773655", "0.70645773", "0.7062078", "0.7060433", "0.7041235", "0.7026651", "0.70224965", "0.69734967", "0.6951902", "0.6948807", "0.694566", "0.6942364", "0.6940816...
0.74126434
5
route to create new patient
def new @patient = Patient.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @patient = Patient.new(patient_params)\n respond_to do |format|\n if @patient.save\n format.html { redirect_to new_patient_path}\n format.json { render :new, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render j...
[ "0.7659297", "0.75803924", "0.75570935", "0.7514929", "0.74840367", "0.7482527", "0.7482527", "0.7482527", "0.7478006", "0.74771494", "0.74499446", "0.7375884", "0.7375884", "0.73552454", "0.732626", "0.7298761", "0.72977257", "0.7251132", "0.72347605", "0.7198954", "0.717626...
0.73482585
16
create a new patient
def create @patient = Patient.new(patient_params) # @patient.image_url = url_for(@patient.avatar) if @patient.save redirect_to(patients_path, notice: "Added Patient") else render('new') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @patient = current_physician.patients.build(patient_params)\n\n respond_to do |format|\n if @patient.save\n format.html { redirect_to [:physician, @patient], notice: 'Patient was successfully created.' }\n format.json { render :show, status: :created, location: @patient }\n ...
[ "0.7772393", "0.7691569", "0.7685941", "0.76656026", "0.7643986", "0.7642266", "0.7642266", "0.7642266", "0.76074755", "0.7605341", "0.7595641", "0.7595182", "0.7587993", "0.75715077", "0.75273377", "0.75212824", "0.7511519", "0.75025433", "0.74953634", "0.74851763", "0.74379...
0.67008257
83
route to edit patient information
def edit @patient = Patient.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @patients_groups = PatientsGroup.find(params[:id])\n @group = Group.find(@patients_groups.group_id)\n @patient = Patient.find(@patients_groups.patient_id)\n session[:return_to] = request.referer\n @title = \"Edit Patient to Group Relationship\"\n end", "def edit\n\t@hospital = Hospital...
[ "0.769492", "0.73706216", "0.7340549", "0.7300844", "0.72353685", "0.72190934", "0.7132296", "0.71228504", "0.7084782", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", "0.7078926", ...
0.83731943
0
find and update existing patient data
def update @patient = Patient.find(params[:id]) @patient.avatar.attach(params[:avatar]) # @patient.image_url = url_for(@patient.avatar) if @patient.update(patient_params) redirect_to(patients_path, notice: "Updated Patient") else render('edit') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patient_update(pat)\n\t\tputs \"\\n @ Remote patient_update: #{pat.inspect}\\n\"\n\t\tif pat.remote_id\n\t\t\tputs \"Update remote have remote_id\"\n\t\t\tupdate_patient(pat) # patient exists and have reference to it\n\t\telse\n\t\t\trpat = patient_by_mrn(pat.mrn)\n\t\t\tif rpat.nil? # does not exist on rem...
[ "0.73207265", "0.69893426", "0.6825184", "0.68060005", "0.66327435", "0.65974444", "0.65840113", "0.6547092", "0.6547092", "0.6547092", "0.6547092", "0.6547092", "0.6547092", "0.6547092", "0.6547092", "0.6541429", "0.65264523", "0.65264523", "0.65264523", "0.65264523", "0.652...
0.0
-1
route to delete patient information
def delete @patient = Patient.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @patient.destroy\n redirect_to root_path\n end", "def destroy\n @patient = Patient.find(params[:id])\n @patient.destroy\n redirect_to(patients_path, notice: \"Deleted Patient\")\n end", "def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_t...
[ "0.7895338", "0.78867024", "0.7775264", "0.7756209", "0.7753304", "0.7753304", "0.7753304", "0.7753304", "0.7710315", "0.7710315", "0.7710315", "0.7710315", "0.7690658", "0.766966", "0.7663943", "0.76516676", "0.76103246", "0.7604914", "0.7600014", "0.7586258", "0.7586258", ...
0.82833856
0
find and delete existing patient data
def destroy @patient = Patient.find(params[:id]) @patient.destroy redirect_to(patients_path, notice: "Deleted Patient") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_patient_by_id(patient_id)\n patient = Patient.find(patient_id)\n patient.destroy\nend", "def delete\n @patient = Patient.find(params[:id])\n end", "def delete_patient_by_id(patient_id)\n \nend", "def deletePatients(patients = nil)\n if patients == nil \n patients = getPatientList\n ...
[ "0.7177847", "0.7131358", "0.7035541", "0.64820397", "0.63364726", "0.62610084", "0.6187419", "0.61280566", "0.6071223", "0.6065189", "0.6021229", "0.6016937", "0.6003402", "0.59740454", "0.5967532", "0.5967532", "0.5967532", "0.5967532", "0.59589976", "0.5934279", "0.5934279...
0.6437247
4
generate QR Code for selected patient
def qr_code @patient = Patient.find(params[:id]) @record_url = vacc_rec_patient_url(@patient) @qr = RQRCode::QRCode.new(@record_url, size: 10, level: :h) @png = @qr.as_png( bit_depth: 1, border_modules: 4, color_mode: ChunkyPNG::COLOR_GRAYSCALE, color: 'black', file: nil, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upcoming_appointment_qrcode\n @patient = Patient.first\n upcoming_appointment = @patient.upcoming_appointment\n if upcoming_appointment\n url = \"https://www.mdme.us/clinics/#{upcoming_appointment.checkin_key}/checkin\"\n @qrcode = RQRCode::QRCode.new(url)\n respond_to do |format|\n ...
[ "0.7172397", "0.705429", "0.6839858", "0.668018", "0.6671981", "0.6670284", "0.65045905", "0.6486047", "0.64606786", "0.63959736", "0.63945514", "0.6373473", "0.63640535", "0.62935877", "0.62816834", "0.62767935", "0.62219477", "0.6206032", "0.6197715", "0.6181849", "0.611816...
0.8014869
0
patient shown in current vaccination record
def vacc_rec @patient = Patient.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details_view_patient\n @patient = current_user.user_record\n @appointments = Appointment.all(:conditions => { :patient_id => @patient.id })\n find_reports(current_user.id)\n end", "def show\n @patient = Patient.find(params[:id])\n @emergency_contacts = @patient.patient_emergency_contacts\...
[ "0.7230558", "0.6962796", "0.6901647", "0.68303424", "0.68285084", "0.66614175", "0.6607957", "0.6545383", "0.6516423", "0.6512417", "0.6494821", "0.6489632", "0.64636815", "0.6459595", "0.64571923", "0.64154655", "0.6414705", "0.6407168", "0.6393375", "0.6303432", "0.6303054...
0.7478071
0
parameters a patient possesses
def patient_params params.require(:patient).permit( :first_name, :last_name, :dob, :address, :phone_number, :age, :vaccine_type, :state, :city, :gender, :avatar ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patient_params\n params.require(:patient).permit(:abnormal, :fibrosis, :tbx, :hcying, :gg, :ret, :emph, :user_id, :case_number)\n end", "def patient_params\n params.require(:patient).permit(:niid_id, :lab_id, :affiliation, :hosp_id, :gender, :nationarity, :date_of_birth, :date_diagnosed, :edu_ba...
[ "0.740976", "0.72875255", "0.72555906", "0.72372144", "0.7235008", "0.72227824", "0.7197499", "0.7179126", "0.71503454", "0.71232855", "0.71168894", "0.7092935", "0.7092935", "0.70830786", "0.70638967", "0.7049198", "0.70424587", "0.701963", "0.7009109", "0.7008769", "0.70039...
0.6577413
52
GET /short_urls/1 GET /short_urls/1.json
def show @short_url = ShortUrl.where(:shortcode => params[:id]).first @link = Link.find(@short_url.link_id) @click = Click.new(:ip => request.remote_ip, :referer => request.referer, :clickdate => Time.now).save! redirect_to @link.fullurl, :status => 301 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def short_url\n @json[\"shortUrl\"]\n end", "def short_url\n response[\"shortUrl\"]\n end", "def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end", "def index\n @short_urls = @user.short_urls.paginate(:page => params[:page][:number], :per_...
[ "0.78799874", "0.75942236", "0.75860894", "0.75853896", "0.75442904", "0.74402267", "0.7374933", "0.7293479", "0.7257608", "0.7251579", "0.7124274", "0.7087727", "0.7046213", "0.70024234", "0.69995576", "0.69548243", "0.6950367", "0.69412047", "0.6938584", "0.69221497", "0.68...
0.0
-1
Queries all comments for a post
def comments descendants.arrange(order: 'votes DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @post = Post.find params[:post_id]\n @comments = @post.comments.all\n end", "def index\n @comments = Comment.all\n @post = Post.find(params[:post_id])\n end", "def get_all_comments_for_post(currentpostid)\n return Post.where(:parent_id => currentpostid)\n end", "def get_all_comm...
[ "0.73309994", "0.72264063", "0.71683806", "0.71220976", "0.7064641", "0.7049801", "0.7026517", "0.69897866", "0.6972573", "0.6950994", "0.6934997", "0.691573", "0.69118583", "0.68181854", "0.68173736", "0.6791966", "0.67846084", "0.67846084", "0.6742235", "0.6731559", "0.6706...
0.0
-1
do we have a connection to the main node and archive node
def connect_ok? connect['main'] == 'ok' && connect['archive'] == 'ok' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stage_over_connection?\n\t\tfalse\n\tend", "def vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end", "def link_alive?\n !!socket && !socket.closed? && !@dead && @disabled_tx == 0\n end", "def ...
[ "0.63982975", "0.610025", "0.6062402", "0.5989322", "0.5967845", "0.5922091", "0.5899605", "0.5805313", "0.5789957", "0.5789957", "0.5726894", "0.5726894", "0.5709779", "0.5702174", "0.5667057", "0.5663732", "0.56620604", "0.56594884", "0.56586355", "0.5647293", "0.5642963", ...
0.68360376
0
does our cluster have enough free disk space
def free_space_ok? #todo: need real heuristic free_space['main']['inodes'] > 100000 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_required_disk_space\n old_data_dir_size = Du.du(old_data_dir)\n # new_data_dir might not exist at the point of making this check.\n # In that case check the first existing directory above it.\n new_dir = dir_or_existing_parent(new_data_dir)\n free_disk_space = Statfs.new(new_dir)...
[ "0.73158205", "0.7289374", "0.72333694", "0.6980046", "0.6916264", "0.68823034", "0.66485476", "0.66457516", "0.6571037", "0.64332324", "0.6412572", "0.63743484", "0.63648003", "0.6336475", "0.62938035", "0.6291011", "0.6286848", "0.6284666", "0.6281281", "0.6275215", "0.6265...
0.8261084
0
is the archive ok
def archive_ok? #todo, we lack any real heuristic for this. true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archival?\n false\n end", "def archival?\n false\n end", "def verify_archive\n if Dir[BuildCommandGenerator.archive_path + \"/*\"].count == 0\n ErrorHandler.handle_empty_archive\n end\n end", "def no_archive?\n false\n end", "def valid_gzip? archive\n return unl...
[ "0.71779376", "0.71779376", "0.6833447", "0.67110276", "0.6703346", "0.66437423", "0.6598316", "0.6574828", "0.6529145", "0.65098274", "0.6473335", "0.6360164", "0.6344798", "0.6344798", "0.63210773", "0.6286964", "0.62731767", "0.6264129", "0.62434304", "0.6239002", "0.62159...
0.862698
0
Use callbacks to share common setup or constraints between actions.
def set_redention @redention = Redention.find(params[:redention_id].to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def redention_details_params params.require(:redention_details).permit(:id, :redention_id, :item_id, :item_description, :number, :quantity, :price, :_destroy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
TODO: review method name
def roll RollResult.new(temp_roll + temp_roll) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def schubert; end", "def specie; end", ...
[ "0.77257204", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.70886314", "0.6981388", "0.6904286", "0.6904286", "0.6904286", "0.6904286", "0.6791152", "0.67675495", "0...
0.0
-1
GET /premium_subscriptions GET /premium_subscriptions.json
def index @premium_subscriptions = PremiumSubscription.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_s...
[ "0.71200716", "0.7088911", "0.7047173", "0.6983847", "0.6947713", "0.6824605", "0.67914134", "0.67894197", "0.6785881", "0.6785881", "0.67763585", "0.67724204", "0.6763303", "0.6743809", "0.67288876", "0.665427", "0.6644048", "0.66427195", "0.66427195", "0.66427195", "0.66212...
0.76236385
0
GET /premium_subscriptions/1 GET /premium_subscriptions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @premium_subscriptions = PremiumSubscription.all\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription ...
[ "0.7470108", "0.69290763", "0.69290763", "0.6901113", "0.68829477", "0.6846414", "0.67767745", "0.6773094", "0.6773094", "0.6773094", "0.6773094", "0.6732958", "0.67247057", "0.67053926", "0.6701672", "0.67009443", "0.67006505", "0.66785526", "0.66197103", "0.6606481", "0.658...
0.0
-1
POST /premium_subscriptions POST /premium_subscriptions.json
def create @premium_subscription = PremiumSubscription.new(premium_subscription_params) respond_to do |format| if @premium_subscription.save format.html { redirect_to @premium_subscription, notice: 'Premium subscription was successfully created.' } format.json { render :show, status: :cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n megam_rest.post_subscriptions(to_hash)\n end", "def create_new_subscription\n @subscription_offers = Subscription.get_subscription_list\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n if @subscription.save\n render json: @subscriptio...
[ "0.73165745", "0.71102864", "0.7106641", "0.7104329", "0.6997693", "0.698101", "0.69557065", "0.6949187", "0.6941108", "0.68819666", "0.68692446", "0.6853831", "0.68457735", "0.68150675", "0.67828107", "0.67571", "0.67335445", "0.67025876", "0.6681426", "0.66636837", "0.66563...
0.7504515
0
PATCH/PUT /premium_subscriptions/1 PATCH/PUT /premium_subscriptions/1.json
def update respond_to do |format| if @premium_subscription.update(premium_subscription_params) format.html { redirect_to @premium_subscription, notice: 'Premium subscription was successfully updated.' } format.json { render :show, status: :ok, location: @premium_subscription } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n \n # TODO: Modify subscription (refund remainder of current, prorate new)\n \n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to subscriptions_url, success: 'Subscription was successfully updated.' }\n format.json { head :n...
[ "0.7059584", "0.70447683", "0.6946399", "0.6929062", "0.6910195", "0.69062006", "0.6814237", "0.6814237", "0.6814237", "0.67922497", "0.67780936", "0.6774715", "0.6769944", "0.67668", "0.6756424", "0.6756424", "0.6747708", "0.66948086", "0.6678237", "0.66488755", "0.6646591",...
0.7495232
0
DELETE /premium_subscriptions/1 DELETE /premium_subscriptions/1.json
def destroy @premium_subscription.destroy respond_to do |format| format.html { redirect_to premium_subscriptions_url, notice: 'Premium subscription was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_conten...
[ "0.7603295", "0.7563605", "0.7548388", "0.7528737", "0.75225747", "0.74932975", "0.74932975", "0.74932975", "0.74932975", "0.7472375", "0.74445117", "0.7405231", "0.7394545", "0.7376432", "0.7357437", "0.7347615", "0.7331523", "0.73045635", "0.73045635", "0.73045635", "0.7304...
0.77783936
0
Use callbacks to share common setup or constraints between actions.
def set_premium_subscription @premium_subscription = PremiumSubscription.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def premium_subscription_params params.require(:premium_subscription).permit(:shirt_size, :user_id, :subscription_length, :shipped, :shipping_address) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Store the number of requests to the XLS decode in REDIS
def store_xlsdata_requests #TODO Add redis.incr "xlsdata_count" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_n_save(url, redis)\n scrape_page_for_zip_hrefs(url).each do |zip_url|\n save_single_zip_to_redis(zip_url, redis)\n end\nend", "def counter_cache; end", "def update_stats_when_done(downloader, bytes)\n timestamp = Time.now.utc.to_i\n total_bytes = bytes.values.inject(0) { |sum,b| s...
[ "0.593358", "0.5704241", "0.54428667", "0.5393681", "0.5354747", "0.5333779", "0.53220016", "0.53057164", "0.52980345", "0.5271525", "0.5224401", "0.52042514", "0.5192012", "0.51622677", "0.51512206", "0.51457983", "0.5141876", "0.5137891", "0.5137052", "0.5136821", "0.512957...
0.83000016
0
:callseq: str.unicode_normalize!(form=:nfc) Destructive version of Stringunicode_normalize, doing Unicode normalization in place.
def unicode_normalize!(form = :nfc) require 'unicode_normalize/normalize.rb' unless defined? UnicodeNormalize # String.send(:define_method, :unicode_normalize!, ->(form = :nfc) { replace(unicode_normalize(form)) } ) replace(unicode_normalize(form)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nfc\n @input = @input.unicode_normalize(:nfc)\n end", "def normalize(string, form=nil)\n form ||= @default_normalization_form\n # See http://www.unicode.org/reports/tr15, Table 1\n codepoints = string.codepoints.to_a\n case form\n when :d\n reorder_char...
[ "0.70814174", "0.69771206", "0.65089726", "0.6465305", "0.6435305", "0.63932896", "0.6272111", "0.61524785", "0.5932669", "0.59299684", "0.59052134", "0.5819653", "0.5813678", "0.5709144", "0.5686625", "0.56628454", "0.56319773", "0.5576469", "0.5549203", "0.55411965", "0.552...
0.8617896
0
Finds the altitude for a given pair of geographic coordinates.
def altitude_for(lon, lat) AltitudeResponse.new(altitude(lon, lat)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitudes\n return @altitudes if defined?(@altitudes)\n\n @altitudes = { \n self.vertices[0] => self.sides[1].perpendicular_segment(self.vertices[0]),\n self.vertices[1] => self.sides[2].perpendicular_segment(self.vertices[1]),\n self.vertices[2] => self.sides[0].per...
[ "0.6230351", "0.6185613", "0.5540941", "0.5529016", "0.5466769", "0.5342554", "0.52412057", "0.5219918", "0.52033573", "0.5199363", "0.5199363", "0.5167161", "0.51665735", "0.51470834", "0.5130861", "0.51187503", "0.5076714", "0.5041852", "0.5011798", "0.50074875", "0.5004621...
0.6254914
0
Builds the profile for a given route, possibly interpolating points along the way in order to avoid abrupt changes in height. The resolution of interpolation is determined by the max_dist parameter (i.e. the higher it is, the more points you potentially have).
def route_profile(route, interpolate: true, dist_factor: 100.0) coordinates = as_vertices(route.fetch("coordinates")) path = interpolate ? interpolate_path(coordinates, dist_factor) : coordinates ProfileResponse.new(Array(path).map do |p| Point.new(p.x, p.y, altitude(p.x, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpolate_route(coords, dist_factor = 100.0)\n return coords if dist_factor <= 0\n\n length = line_length(coords)\n min_res = length / dist_factor\n\n coords.each_cons(2).inject([]) do |route, (a, b)|\n segment = add_extra_points(a, b, min_res)\n route + segment\n end\...
[ "0.5333812", "0.49873874", "0.45784923", "0.44375998", "0.43778324", "0.43450123", "0.43433133", "0.43178043", "0.42970803", "0.42948234", "0.41751617", "0.4169893", "0.41610202", "0.41529113", "0.4141307", "0.40974623", "0.40822527", "0.40479034", "0.40345323", "0.403422", "...
0.7143279
0
A convenient way to enable or disable these dropdown links based on permissions.
def maybe_enabled_dropdown_item(condition, body, url, html_options={}) if condition link_to(body, url, html_options.merge({class: "dropdown-item"})) else link_to(body, "", html_options.merge({class: "dropdown-item disabled"})) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_admin_menu_items?\n can?(:read, :admin_dashboard)\n end", "def can_org_admin?\n return self.can_grant_permissions? || self.can_modify_guidance? ||\n self.can_modify_templates? || self.can_modify_org_details?\n end", "def selectable_access_types\n [['Unrestricted Access', 'open...
[ "0.612231", "0.60203415", "0.5970808", "0.5898633", "0.5894957", "0.588269", "0.58586663", "0.5843646", "0.5838536", "0.58320135", "0.5823424", "0.57530785", "0.5729759", "0.57110184", "0.5703755", "0.5696916", "0.5677051", "0.5669664", "0.5636789", "0.56335694", "0.5597314",...
0.61694807
0
before_action :redirect_signed_in_users, except:[:new, :create, :registration]
def create @user = User.new(user_params) if @user.save redirect_to edit_user_path(@user.id) else redirect_to sign_up_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_unless_signed_in\n unless signed_in?\n flash[:notice] = \"You must be logged in to access #{request.fullpath}\"\n redirect_to users_path\n end\n end", "def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end", "def signed_in_user\n redirect_to...
[ "0.7753612", "0.7736412", "0.7470948", "0.73742706", "0.73704517", "0.7325538", "0.7321119", "0.7318885", "0.72568023", "0.7247977", "0.72462773", "0.72440326", "0.7238926", "0.72211814", "0.7173465", "0.7166668", "0.71518856", "0.7149141", "0.7149141", "0.71470547", "0.70980...
0.0
-1
Use to validate only authorized user is viewing page
def is_admin unless signed_in? && (current_user == User.first || current_user.admin? || current_user.operator?) redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkUserPageAccess(user, pagePath)\n return false\n end", "def show\n authorize @page\n end", "def show\n authorize @page\n end", "def restricted?\n page.restricted?\n end", "def validate_access\n if @user_logged_in != @answer.user\n render status: :forbidden\...
[ "0.7403274", "0.7380221", "0.72679335", "0.72308123", "0.7123197", "0.7116623", "0.7061006", "0.7057711", "0.7019233", "0.700891", "0.70083374", "0.6968303", "0.6939144", "0.69183755", "0.6899388", "0.68993515", "0.688889", "0.68352216", "0.6816657", "0.6808324", "0.68026495"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:email, :first_name, :last_name, :hashtag, :birthday, :password, :password_confirmation, :bio, :avatar, :phone_number, :title, :remove_avatar, :facebook, :instagram, :linkedin, :title_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
When a new reply is created, record it in the user's stats and update the response cache
def after_create Stat.increment_counter(:reply_count, self.user.stat.id) if self.yes? Question.increment_counter(:yes_count, question.id) else Question.increment_counter(:no_count, question.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_add_reply( m, params )\n # lame auth check\n # TODO: need to get a look into new auth system\n\n name = params[:name].downcase\n reply = params[:reply].to_s\n\n # check whether good is in database\n# status( name, @stock )\n# if @inreg == false\n# m.reply( \"#{name} doe...
[ "0.65464795", "0.6229121", "0.6188382", "0.6126158", "0.5957202", "0.595675", "0.59365296", "0.5934273", "0.5926328", "0.587288", "0.5827117", "0.5821581", "0.5781178", "0.576486", "0.5762321", "0.5727377", "0.57118106", "0.5697725", "0.56938976", "0.5659772", "0.5658321", ...
0.64393073
1
When a reply is destroyed, update the user's stats
def before_destroy if self.yes? Question.decrement_counter(:yes_count, question.id) else Question.decrement_counter(:no_count, question.id) end Stat.decrement_counter(:reply_count, self.user.stat.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_destroy(following)\n decrement_counter(following)\n end", "def destroy\n @user_response.destroy\n respond_to do |format|\n format.html { redirect_to user_responses_url, notice: 'User response was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def ...
[ "0.60564166", "0.60303116", "0.59999007", "0.59237355", "0.5914343", "0.5875463", "0.5856728", "0.5848595", "0.583224", "0.58219016", "0.58177876", "0.578128", "0.57745826", "0.57541853", "0.5741827", "0.569828", "0.56737167", "0.5669172", "0.5659102", "0.5657572", "0.5656648...
0.64199024
0
Returns whether the user is logging in for the first time. Useful to have to display firsttime welcome messages or such.
def first_login? last_login_at.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_first_login\n return @is_first_login\n end", "def is_first_login=(value)\n @is_first_login = value\n end", "def first_login?\n self.sign_in_count==1 && 10.seconds.ago < current_sign_in_at\n end", "def first_user?\n return false unless opti...
[ "0.82273734", "0.7604082", "0.7476592", "0.73395807", "0.7117483", "0.7117483", "0.7056616", "0.6920411", "0.69194233", "0.6915984", "0.68048394", "0.67621106", "0.6757546", "0.67073536", "0.6696694", "0.6676522", "0.6672223", "0.6672223", "0.6671719", "0.66693234", "0.664855...
0.74113363
3
Activates the user account. The perishable token is also reset.
def activate! @activated = true self.active = true # Authlogic resets the perishable token by default on save, but I'm leaving the call # to reset_perishable_token! here directly to help reveal intent (which's is kinda a # dead purpose after this long comment, but who cares). # # This ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has been reactivated\")\r\n end", "def activate\n @user = User.find(params[:id])\n\n...
[ "0.775669", "0.77459085", "0.77250856", "0.772499", "0.7692508", "0.7600545", "0.7329314", "0.73005074", "0.7264827", "0.7210777", "0.71587044", "0.7139481", "0.71193343", "0.70857966", "0.7081987", "0.7059591", "0.70086", "0.6992772", "0.69798255", "0.6975402", "0.6973116", ...
0.7409379
6
Returns true if the user was activated in this instance.
def recently_activated? @activated end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activated?\n self.user && self.user.activated?\n end", "def activated?\n activation_token && activation_token.confirmed?\n end", "def user_active?\n\t\treturn true if teacher? && !activated\n\tend", "def activated_current_user?\n unless current_user.activated?\n flash[...
[ "0.84049445", "0.77769834", "0.741545", "0.7354614", "0.7345078", "0.72586435", "0.7238126", "0.72346973", "0.7216796", "0.7197607", "0.7197607", "0.71921474", "0.71409315", "0.7108039", "0.70995677", "0.7091258", "0.7075528", "0.7030004", "0.70066255", "0.6998646", "0.698883...
0.7045836
64
has_and_belongs_to_many :games, join_table: :roles_users u.user_roles.build(role: r, game: g) def permissions_for(game) def role_for(game) or just custom sql to get permissions
def permissions_for(game) self.permissions.where("user_roles.game_id = ?", game.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permissions( force_reload = false )\n\n # Two levels of joins here, so can't use has_many :through\n if force_reload\n @permissions = nil \n @permissions_by_class_and_op = {}\n end\n\n cond_str = 'role_id in ' + self.class.role_assigned_cond( '?' )\n if !instance_variable_defined?(\"@p...
[ "0.5499259", "0.5432232", "0.54135364", "0.53945374", "0.534758", "0.5336524", "0.53209805", "0.530832", "0.53029084", "0.5292574", "0.5205246", "0.5179168", "0.5156856", "0.51537895", "0.5142676", "0.5139269", "0.51375365", "0.51124144", "0.5085712", "0.5082856", "0.5075245"...
0.764302
0
Remembers a user in the database for use in persistent sessions.
def remember self.remember_token = User.new_token # Writes token to db update_attribute(:remember_digest, User.digest(remember_token)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end", "def change_password\n @user = User.find_by_id(session[:remember_token])\n end", "def set_user\n zeus = User.find(@zeus_user.id)\n ...
[ "0.68847036", "0.65202016", "0.6288528", "0.6221299", "0.6220095", "0.6177217", "0.6141952", "0.61285347", "0.61285347", "0.6122638", "0.6121868", "0.6121868", "0.61191475", "0.6094944", "0.6088155", "0.6087507", "0.6085413", "0.6080089", "0.6078", "0.6067664", "0.604671", ...
0.5801462
66
Returns true if the given token matches the digest.
def authenticated?(attribute, token) digest = send("#{attribute}_digest") return false if digest.nil? BCrypt::Password.new(digest).is_password?(token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest does not exist in the database.\n BCrypt::Password.new(digest).is_password?(token)\n ...
[ "0.7842081", "0.7615829", "0.7405977", "0.7287336", "0.7142467", "0.7142002", "0.7142002", "0.7026453", "0.69846994", "0.6963337", "0.69044995", "0.6858958", "0.68421906", "0.6823546", "0.6796351", "0.67875767", "0.6773826", "0.67642915", "0.6750196", "0.67455924", "0.6742652...
0.67157704
70
Creates and assigns the activation token and digest.
def create_reset_digest self.reset_token = User.new_token update_attributes(reset_digest: User.digest(reset_token), reset_sent_at: Time.zone.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_activation_digest\n # Create the token and digest.\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activati...
[ "0.862457", "0.8615071", "0.86041135", "0.8602518", "0.85908353", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.85580...
0.0
-1
Returns true if a password reset has expired.
def password_reset_expired? reset_sent_at < 2.hours.ago end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_reset_expired?\n reset_sent_at < Settings.timeout_reset_password.hours.ago\n end", "def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end", "def password_reset_expired?\n reset_sent_at < 2.hours.ago # password reset sent earlier than two hours ago.\n end", "def password...
[ "0.8868087", "0.8744046", "0.87419695", "0.86920106", "0.8689273", "0.86616915", "0.8659473", "0.8658822", "0.8658822", "0.8658822", "0.8658822", "0.8658822", "0.8658822", "0.8658822", "0.8658822", "0.865339", "0.86504006", "0.862233", "0.86214966", "0.8609769", "0.8609244", ...
0.85556585
80
Defines a protofeed. See "Following users" for the full implementation.
def feed Micropost.where("user_id = ?", id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed\n FeedItem.from_users_followed_by(self)\n end", "def feed_to\n @feed_to_users ||= [self] | self.friends | self.followers # prevent duplicates in the array\n end", "def manage_friend(user, destination_user, verb)\n f = Feed.new({:title => 'New friend',:description => \"You have #...
[ "0.596254", "0.5871191", "0.5620648", "0.56078655", "0.5585272", "0.5552937", "0.5552937", "0.5469914", "0.5469914", "0.5469914", "0.5469914", "0.54321945", "0.54121745", "0.53969514", "0.5379362", "0.5349583", "0.5349583", "0.5346442", "0.5332902", "0.5332902", "0.5332902", ...
0.0
-1
Converts email to all lowercase.
def downcase_email self.email = email.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downcase_email\n\t email.downcase!\n\t end", "def downcase_email\n email.downcase!\n end", "def lowercase_email\n email.downcase! if email.present?\n end", "def downcase_email\n email.downcase!\n end", "def downcase_email\n email.downcase!\n end", "def do...
[ "0.8380517", "0.8339932", "0.8242504", "0.82153374", "0.82153374", "0.82153374", "0.82153374", "0.8192566", "0.8161937", "0.8131639", "0.8121609", "0.8112856", "0.80987734", "0.80987734", "0.80987734", "0.80724174", "0.80567265", "0.80567265", "0.80567265", "0.80567265", "0.7...
0.78515804
85
Creates and assigns the activation token and digest.
def create_activation_digest self.activation_token = User.new_token self.activation_digest = User.digest(activation_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_activation_digest\n # Create the token and digest.\n self.activation_token = User.new_token\n self.activation_digest = User.digest(activation_token)\n end", "def create_activation_digest\n self.activation_token = Golfer.new_token\n self.activation_digest = Golfer.digest(activati...
[ "0.862457", "0.8615071", "0.86041135", "0.8602518", "0.85908353", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.85622764", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.8561228", "0.85580...
0.85576075
48
The button method used to pass the input text and make a new screen
def openTranslate @hesky = Hesky.new @hesky.text = @edit_label.text # Instantiate a version of the new view controller with self create init method final = EndtextViewController.alloc.initWithText(@hesky) self.navigationController.pushViewController(final, animated: true) # present_mod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_text_input\n end", "def on_input_ok\n @@text = @edit_window.text\n return_scene\n end", "def ask_input(text, color=nil, *args)\n self.ask(\"#{text}\", color, *args)\n end", "def scaffold_button_to(text, url, options={})\n \"#{scaffold_form(url, options)}\\n<input type='...
[ "0.6664677", "0.650371", "0.60935694", "0.59546965", "0.5936455", "0.58767074", "0.58721596", "0.57838297", "0.57802826", "0.57444316", "0.57408696", "0.57234037", "0.5698224", "0.5684452", "0.567184", "0.5594656", "0.55885", "0.5558799", "0.55474126", "0.55468494", "0.552832...
0.54516655
31
The method that is called in order to drop off the keyboard from the screen
def backgroundTouched @edit_label.resignFirstResponder end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_keyboard\n self.get.sendAction(:resignFirstResponder, to:nil, from:nil, forEvent:nil)\n end", "def disable_keyboard\n\t\treturn enable_keyboard(false)\t\n\tend", "def disable_keyboard\n\t\treturn enable_keyboard(false)\t\n\tend", "def ****_hidekeyboard\r\n begin\r\n\tif $driver.is_keybo...
[ "0.7331622", "0.68552536", "0.68552536", "0.68133956", "0.6654317", "0.66297305", "0.6579797", "0.6519819", "0.6432083", "0.63813937", "0.637674", "0.6312746", "0.6312746", "0.6237078", "0.6237078", "0.61070675", "0.6097956", "0.6054323", "0.60462934", "0.60394996", "0.599631...
0.0
-1
Causes any events to be dumped to stdout. If arguments are specified, then only those arguments are dumped. Example: class MyController < Engine::Controller::Base dump_events will dump all events to stdout dump_events :mouse_clicked, :mouse_pressed, :mouse_released end
def dump_events(*events) events = ['any'] if events.empty? events.collect! { |i| i.to_s } define_method :dump_events do |which| return false unless events.include?('any') || events.include?(which.to_s) true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_events(events)\n events.each do |name, description|\n puts \"Event: #{name}\"\n puts \"Description: #{description} \\n\\n\"\n end\n end", "def droby_write_event(method_name, *args, time: Time.now)\n @__event_logger.dump(method_name, time, args)\n end", "def ...
[ "0.6394791", "0.5784925", "0.5766176", "0.5722252", "0.5613955", "0.55794835", "0.55258524", "0.54822546", "0.5453706", "0.54007405", "0.5358021", "0.53521425", "0.53144675", "0.53107464", "0.5304606", "0.52823085", "0.5260617", "0.5239521", "0.5184818", "0.51553476", "0.5142...
0.67084455
0
Causes all methods listed to cause a redirect to the specified action. Example: redirect :mouse_moved, :mouse_dragged, :to => :movement_detected
def redirect(*actions) options = actions.extract_options! to = options.delete :to raise "Expected a :to option to point to an action" unless to actions.each do |action| define_method action do redirect_to :action => to end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirects; end", "def redirect(url, method: nil, **keyword_args)\n append(Redirect.new(url, method: method, **keyword_args))\n end", "def redirect(url, method: nil, **keyword_args)\n append(Redirect.new(url, method: method, **keyword_args))\n end", "def redirect(url, method: nil, ...
[ "0.6041335", "0.6006547", "0.6006547", "0.6006547", "0.5968439", "0.59331703", "0.5877843", "0.5862824", "0.574358", "0.57329166", "0.5650863", "0.56264186", "0.5593681", "0.5576682", "0.55699074", "0.5551871", "0.54969305", "0.5477525", "0.54429406", "0.5433918", "0.5365393"...
0.75261116
0
Makes all the (instance) methods in the helper plugin available to views rendered through this controller.
def add_template_helper(helper_module) #:nodoc: master_helper_module.module_eval { include helper_module } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helpers\n unless @helper_proxy\n @helper_proxy = Engine::View::Base.new(self)\n @helper_proxy.extend master_helper_module\n else\n @helper_proxy\n end\n end", "def helpers; end", "def helpers; end", "def helpers; end", "def helpers\n @_helper_proxy ||= view_c...
[ "0.72962624", "0.7281248", "0.7281248", "0.7281248", "0.7194998", "0.71894944", "0.71812856", "0.7151624", "0.7149706", "0.7076487", "0.6976508", "0.6965673", "0.6960944", "0.6960944", "0.69514257", "0.690879", "0.690879", "0.69067633", "0.69067633", "0.69012374", "0.6858274"...
0.0
-1
Declare a controller method as a helper. For example, the following makes the +current_user+ controller method available to the view: class ApplicationController < Engine::Controller::Base helper_method :current_user, :logged_in? def current_user
def helper_method(*methods) methods.flatten.each do |method| master_helper_module.module_eval <<-end_eval def #{method}(*args, &block) # def current_user(*args, &block) controller.send(%(#{method}), *args, &block) # controller.send(%(current_user), *args, &block...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helper_method(*meths)\n meths.flatten!\n self._helper_methods += meths\n\n meths.each do |meth|\n _helpers.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1\n def #{meth}(*args, &blk) # def current_user(*args, &blk)\n controller....
[ "0.73770016", "0.726429", "0.7083675", "0.70355046", "0.6874294", "0.6738243", "0.6676999", "0.6676999", "0.6620623", "0.6620623", "0.65676785", "0.6309758", "0.6309586", "0.62829524", "0.626195", "0.62444115", "0.62444115", "0.6116439", "0.6115391", "0.6084385", "0.60801625"...
0.70729965
3
Declares helper accessors for controller attributes. For example, the following adds new +name+ and name= instance methods to a controller and makes them available to the view: helper_attr :name attr_accessor :name
def helper_attr(*attrs) attrs.flatten.each { |attr| helper_method(attr, "#{attr}=") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helper_attr(*attrs); end", "def helper_attr(*attrs)\n attrs.flatten.each { |attr| helper_method(attr, \"#{attr}=\") }\n end", "def helper_attr(*attrs)\n attrs.flatten.each { |attr| helper_method(attr, \"#{attr}=\") }\n end", "def add_accessors(name, opts)\n name_equals = (n...
[ "0.6636348", "0.6092852", "0.6092852", "0.58358246", "0.5762181", "0.57153136", "0.56889856", "0.56834966", "0.5633658", "0.5611489", "0.5582186", "0.55178344", "0.55128783", "0.5509272", "0.54834276", "0.54834276", "0.54834276", "0.54502964", "0.5406716", "0.53630805", "0.53...
0.6168274
1
Provides a proxy to access helpers methods from outside the view.
def helpers unless @helper_proxy @helper_proxy = Engine::View::Base.new(self) @helper_proxy.extend master_helper_module else @helper_proxy end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helpers\n @_helper_proxy ||= view_context\n end", "def helpers\n unless @helper_proxy\n @helper_proxy = ActionView::Base.new\n @helper_proxy.extend master_helper_module\n else\n @helper_proxy\n end\n end", "def helpers\n ActionController::Base.h...
[ "0.8095182", "0.77141094", "0.75326204", "0.7491049", "0.7485671", "0.7485671", "0.7476486", "0.737916", "0.737916", "0.737916", "0.7347896", "0.7267553", "0.7253911", "0.7253911", "0.71759427", "0.71759427", "0.7140787", "0.7117104", "0.70105284", "0.7006528", "0.6993145", ...
0.77218443
1
Extract helper names from files in app/helpers//.rb
def all_application_helpers map = [] helpers_dirs.each do |helpers_dir| extract = /^#{Regexp.quote(helpers_dir)}\/?(.*)_helper.rb$/ map += Dir["#{helpers_dir}/**/*_helper.rb"].map { |file| file.sub extract, '\1' } end map end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_application_helpers\n extract = /^#{Regexp.quote(helpers_dir)}\\/?(.*)_helper.rb$/\n Dir[\"#{helpers_dir}/**/*_helper.rb\"].map { |file| file.sub extract, '\\1' }\n end", "def helper_files\n glob = File.join(config[:test_base_path], 'helpers', '*/**/*')\n Dir.glob(g...
[ "0.799805", "0.745099", "0.7412567", "0.73193234", "0.73193234", "0.73193234", "0.73193234", "0.7281184", "0.70517", "0.6980188", "0.6859662", "0.6846971", "0.6829441", "0.6819588", "0.67757976", "0.6772316", "0.6738521", "0.6630772", "0.6630729", "0.6611574", "0.6587399", ...
0.75822943
1
Prevent CSRF attacks by raising an exception. For APIs, you may want to use :null_session instead.
def store_location # store last url as long as it isn't a /users path session[:previous_url] = request.fullpath unless request.fullpath =~ /\/users/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_null_session\n ActionController::RequestForgeryProtection::ProtectionMethods::NullSession.new(self)\n .handle_unverified_request\n end", "def disable_request_forgery_protection; end", "def disable_request_forgery_protection=(_arg0); end", "def allow_forgery_protection\n true\n end", ...
[ "0.7299086", "0.7150628", "0.69828576", "0.6798196", "0.6728446", "0.6688517", "0.66670275", "0.6641761", "0.66321534", "0.66321534", "0.6613181", "0.6588417", "0.65875393", "0.6584385", "0.6584385", "0.6583921", "0.6505893", "0.6485701", "0.63672894", "0.63294345", "0.629702...
0.0
-1
Overwriting the sign_out redirect path method
def after_sign_out_path_for(resource_or_scope) "/masuk" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end", "def after_sign_out_path_for(_resource_or_scope)\n '/'\n end", "def after_sign_out_path_for(resource_or_scope); end", "def signout_url\n {:controller => 'auth', :action => 'signout'}\n end", "def after_sign_out_path_for(reso...
[ "0.810295", "0.80080146", "0.7984702", "0.7932176", "0.7898378", "0.7889713", "0.7875249", "0.7868933", "0.7858404", "0.78444934", "0.78444934", "0.78444934", "0.78444934", "0.78418577", "0.78224355", "0.7789247", "0.7749128", "0.77378696", "0.77322626", "0.7729615", "0.77296...
0.0
-1
fill the queue with a frequent peer
def fill_aggregator_queue(type) case type when :chat 15.times do |day| data_in = {'from' => handle, 'rcpt' => 'sender', 'incoming' => 1, 'program' => 'skype', 'content' => 'test message'} evidence_in = Evidence.target(target.id).create!(da: Time.now.to_i + day*86400, aid: agent.id,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_queue\n if @queue.num_waiting > 0\n Thread.new do\n while @queue.num_waiting > 0 && (conn = try_make_new)\n @queue.push(conn)\n end\n end\n end\n end", "def initialize\n @queue = []\n end", "def queue; end", "def queue; end", "def flush_url_distrib...
[ "0.6394151", "0.631287", "0.61876595", "0.61876595", "0.6080664", "0.6060533", "0.6031434", "0.58741057", "0.5872744", "0.58644915", "0.5850247", "0.581059", "0.581059", "0.5787445", "0.5772599", "0.5724756", "0.5721533", "0.5698039", "0.5637027", "0.56196225", "0.56026995", ...
0.54159594
38
the value of the primary key for this object
def scaffold_id get_key_array_safe(self.key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_key_value(obj)\n obj.pk\n end", "def primary_key_value\n send(self.class.primary_key)\n end", "def primary_key\n self[:primary_key]\n end", "def primary_key\n @attributes[self.primary_key_attribute]\n end", "def primary_key\n @primary_key\n ...
[ "0.87133825", "0.8608511", "0.86066604", "0.8594596", "0.85331017", "0.8406231", "0.83675677", "0.83652586", "0.8215068", "0.8215068", "0.8215068", "0.8202722", "0.8145916", "0.813886", "0.79947674", "0.79947674", "0.7978128", "0.79744744", "0.795173", "0.7884283", "0.7880323...
0.0
-1
Add the associated object to the object's association
def scaffold_add_associated_object(association, object, associated_object) ap = object.send(association) ap << associated_object unless ap.include?(associated_object) object.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_associated_object(opts, o)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n raise(Sequel::Error, 'associated object does not have a primary key') if opts.need_associated_primary_key? && !o.pk\n return if run_association_callbacks(opts, :before_add, o) == false\n...
[ "0.7427592", "0.7372177", "0.71541566", "0.7125288", "0.70186245", "0.6929796", "0.682001", "0.64200103", "0.6408851", "0.63952106", "0.6389396", "0.63830924", "0.63747066", "0.635752", "0.6351735", "0.633062", "0.62025225", "0.61933935", "0.61547655", "0.612407", "0.60615003...
0.74281037
0
Array of all association reflections for this model only shows the associations that are scaffolding_enabled
def scaffold_all_associations relationships.values.select { |v| v.send(:target_model).respond_to?(:scaffold_name) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaffold_associations\n @scaffold_associations ||= reflect_on_all_associations.collect{|r|r.name.to_s unless (r.options.include?(:through) || r.options.include?(:polymorphic))}.compact.sort\n end", "def scaffold_habtm_reflections\n @scaffold_habtm_reflections ||= (scaffold_associations.col...
[ "0.7812688", "0.7695163", "0.7436519", "0.7354284", "0.712793", "0.6841226", "0.6764999", "0.6753157", "0.6712462", "0.6706548", "0.6706548", "0.66681", "0.66681", "0.66681", "0.66681", "0.66260254", "0.6610642", "0.6590484", "0.6543052", "0.65428793", "0.6507556", "0.65000...
0.76907766
2
The class that this model is associated with via the association
def scaffold_associated_class(association) relationships[association].target_model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associated_class\n self[:class] ||= self[:class_name].constantize\n end", "def class\n @model.class\n end", "def associated_class\n self[:class] ||= self[:class_name].constantize\n end", "def klass\n @klass ||= association ? association.klass : model\n end", ...
[ "0.8166022", "0.8047829", "0.8043099", "0.80364895", "0.78710043", "0.78394586", "0.76683867", "0.76180536", "0.7609751", "0.75114006", "0.75044084", "0.74945676", "0.74612373", "0.7450302", "0.74478716", "0.74478716", "0.7386917", "0.73281914", "0.7308063", "0.7307124", "0.7...
0.70427585
48
The association reflection for this association
def scaffold_association(association) relationships[association] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def association_reflection\n @opts[:association_reflection]\n end", "def association_reflection(name)\n association_reflections[name]\n end", "def all_association_reflections\n association_reflections.values\n end", "def reflect_on_association(association)\n ...
[ "0.8825661", "0.8551029", "0.79345167", "0.7744085", "0.7744085", "0.75685924", "0.7416059", "0.7393063", "0.73260045", "0.72509325", "0.7083267", "0.70061177", "0.69199306", "0.6904529", "0.68413436", "0.6820723", "0.67246634", "0.67034936", "0.660918", "0.6520619", "0.64727...
0.0
-1
The type of association, either :new for :one_to_many (as you can create new objects associated with the current object), :edit for :many_to_many (since you can edit the list of associated objects), or :one for :many_to_one.
def scaffold_association_type(association) if relationships[association].class == DataMapper::Associations::OneToMany::Relationship :new elsif relationships[association].class == DataMapper::Associations::ManyToMany::Relationship :edit else :one end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def association_type(assoc)\n case model.association_reflection(assoc)[:type]\n when :many_to_one, :one_to_one\n :one\n when :one_to_many\n :new\n when :many_to_many\n :edit\n end\n end", "def type\n @type ||= case\n when is_many?, is_m...
[ "0.8664896", "0.7017485", "0.6821589", "0.665651", "0.6562054", "0.649369", "0.6487494", "0.6390464", "0.6367899", "0.63343716", "0.6317339", "0.6317112", "0.62744236", "0.62515396", "0.62418276", "0.62307334", "0.62075555", "0.61922944", "0.61572886", "0.6156769", "0.6135389...
0.7005783
2
List of symbols for associations to display on the scaffolded edit page. Defaults to all associations for which the scaffolding is enabled. Can be set with an instance variable.
def scaffold_associations @scaffold_associations ||= relationships.keys.select { |v| relationships[v].send(:target_model).respond_to?(:scaffold_name) }.sort_by{|name| name.to_s} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaffold_associations\n @scaffold_associations ||= reflect_on_all_associations.collect{|r|r.name.to_s unless (r.options.include?(:through) || r.options.include?(:polymorphic))}.compact.sort\n end", "def scaffold_auto_complete_associations\n @scaffold_auto_complete_associations ||= scaffold_fie...
[ "0.7068053", "0.67369187", "0.634516", "0.6330614", "0.62562144", "0.6127931", "0.6095064", "0.60764766", "0.59862727", "0.58840585", "0.58701205", "0.57551986", "0.5749198", "0.573938", "0.5733905", "0.5728244", "0.5592468", "0.55851173", "0.5581153", "0.55716914", "0.557008...
0.66648555
2
The error to raise, should match other errors raised by the underlying library.
def scaffold_error_raised DataMapper::ObjectNotFoundError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def underlying_exception; end", "def error!\n throw NotImplementedError\n end", "def raise_error(error)\n # @todo: log error\n raise error\n end", "def underlying_exception=(_arg0); end", "def raise_error(msg)\n raise Error.new(msg)\n end", "def error\n raise Exception, ...
[ "0.7407145", "0.7352609", "0.72352505", "0.71368206", "0.7114008", "0.70801926", "0.7038475", "0.702098", "0.7018524", "0.701503", "0.701503", "0.701503", "0.70020515", "0.69689345", "0.69689345", "0.6931575", "0.6857862", "0.6828347", "0.67566663", "0.6751618", "0.66756034",...
0.0
-1
Returns the list of fields to display on the scaffolded forms. Defaults to displaying all columns with the exception of the primary key column. Also includes :many_to_one associations, replacing the foriegn keys with the association itself. Can be set with an instance variable.
def scaffold_fields(action = :default) return @scaffold_fields if @scaffold_fields fields = (properties.map {|a| a.name}) - [scaffold_primary_key] scaffold_all_associations.each do |reflection| next unless reflection.class == DataMapper::Associations::ManyToOne::Relationship fields.delete(get_ke...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaffold_fields\n return @scaffold_fields if @scaffold_fields\n @scaffold_fields = columns.reject{|c| c.primary || c.name =~ /_count$/ || c.name == inheritance_column }.collect{|c| c.name}\n reflect_on_all_associations.each do |reflection|\n next if reflection.macro != :belongs_to...
[ "0.72794497", "0.69958293", "0.6668174", "0.66596234", "0.6627362", "0.66012347", "0.637323", "0.6281078", "0.6262439", "0.6240629", "0.62360036", "0.62294984", "0.61779714", "0.6164103", "0.6162591", "0.6128692", "0.6128692", "0.6128692", "0.6091909", "0.6087671", "0.6067409...
0.659672
6
The foreign key for the given reflection
def scaffold_foreign_key(reflection) get_key_array_safe(reflection.child_key).name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foreign_key(clazz=nil)\n @foreign_key || begin\n if @type == :t_belongs_to\n belongs_to_foreign_key\n elsif @type == :t_has_one || @type == :t_has_many\n has_x_foreign_key(clazz)\n end\n end\n end", "def link_belongs_to(reflection)\n reflection.forei...
[ "0.7576191", "0.75490063", "0.74595064", "0.7313524", "0.7262501", "0.7243485", "0.71671134", "0.70865524", "0.7074293", "0.70623034", "0.7011211", "0.6989084", "0.6989084", "0.6946353", "0.6942739", "0.69349223", "0.691765", "0.6902137", "0.6901996", "0.6833195", "0.6818318"...
0.74805945
2
Retrieve a single model object given an id
def scaffold_get_object(id) self.get(id) || (raise scaffold_error_raised) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find id\n model.find id\n end", "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end"...
[ "0.85001373", "0.8308999", "0.80954754", "0.80833274", "0.7890183", "0.7857561", "0.7699828", "0.7699828", "0.76204", "0.760316", "0.7593703", "0.75073415", "0.7501066", "0.74956757", "0.7491744", "0.74908835", "0.74824846", "0.7477606", "0.7457039", "0.74223644", "0.73996353...
0.70289445
49
All objects that are currently associated with the given object. This method does not check that the returned associated objects meet the associated class's scaffold_session_value constraint, as it is assumed that all objects currently assocated with the given object have already met the criteria. If that is not the ca...
def scaffold_associated_objects(association, object, options) object.send(association,:order => get_ordering_options(scaffold_select_order_association(association))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scaffold_association_find_objects(association, options)\n klass = scaffold_associated_class(association)\n klass.scaffold_get_objects(:order=>scaffold_select_order_association(association), :include=>scaffold_include_association(association), :conditions=>klass.scaffold_session_conditions(options[:sessio...
[ "0.63429904", "0.6126464", "0.59522176", "0.5620744", "0.5580364", "0.54725426", "0.5349613", "0.5328185", "0.53231174", "0.5275009", "0.5274007", "0.52613556", "0.5240852", "0.5227374", "0.5154813", "0.5142867", "0.51362365", "0.5134416", "0.51269287", "0.51260924", "0.51197...
0.47134894
60
Retrieve multiple objects given a hash of options
def scaffold_get_objects(options) optionshash = {} data = self.all if options[:conditions] conditions = options[:conditions] if conditions && Array === conditions && conditions.length > 0 if String === conditions[0] data = data.all(:conditions => conditions) else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_get_with_objects(path, options, klass)\n perform_request_with_objects(:get, path, options, klass)\n end", "def all(opts={})\n find_many(::Hashie::Mash.new(opts))\n end", "def sel_opts_from_objs(objs, options = {})\n # set default method names\n id_m = options[:id_metho...
[ "0.6564922", "0.6460634", "0.6202106", "0.6182088", "0.6142465", "0.6045466", "0.6028214", "0.6009776", "0.6001488", "0.5885392", "0.58838445", "0.58812445", "0.58663887", "0.585956", "0.58573467", "0.5854892", "0.5840121", "0.5829973", "0.5829973", "0.58143437", "0.5812792",...
0.65495765
1
Return the class, left foreign key, right foreign key, and join table for this habtm association
def scaffold_habtm_reflection_options(association) habtm = relationships[association] [ habtm.target_model, get_key_array_safe(habtm.through.child_key).name, get_key_array_safe(habtm.via.child_key).name, habtm.send(:through_model).storage_name ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_for_join_association(join_ass)\n r = \"#{join_ass.type} :#{join_ass.name}\"\n r << \", class: :#{model_class_name(join_ass.associated_table)}\" unless join_ass.name_is_conventional?\n r << \", right_key: :#{join_ass.right_foreign_key}\" unless join_ass.name_and_right_forei...
[ "0.7248469", "0.67913765", "0.66180694", "0.66180694", "0.66153395", "0.65431166", "0.6505221", "0.6500779", "0.6447895", "0.6435167", "0.6426545", "0.6373392", "0.63647515", "0.6300254", "0.6285454", "0.62808347", "0.6230022", "0.6212613", "0.6210118", "0.6185358", "0.618340...
0.5767626
56
Returns a hash of values to be used as url parameters on the link to create a new :has_many associated object. Defaults to setting the foreign key field to the record's primary key.
def scaffold_new_associated_object_values(association, record) {scaffold_foreign_key(scaffold_association(association))=>record.scaffold_id} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_many_params\n resource.reflect_on_all_associations(:has_many).map do |many|\n relation_param(many)\n end.compact\n end", "def _many_to_many_hash\n @_many_to_many_hash ||= {}\n end", "def references_with_foreign_key(*args)\n # Don't pop, unlike extract_options!, becaus...
[ "0.6069349", "0.6062821", "0.5864019", "0.58144397", "0.58120817", "0.5724729", "0.5681505", "0.5671535", "0.5661395", "0.5597279", "0.5545719", "0.5509606", "0.55029064", "0.54899925", "0.54694754", "0.54647547", "0.5461252", "0.54472744", "0.54112226", "0.5404761", "0.54022...
0.58819836
2
The primary key for the given table
def scaffold_primary_key get_key_array_safe(key).name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_key(table)\n pk_and_sequence = pk_and_sequence_for(table)\n pk_and_sequence && pk_and_sequence.first\n end", "def primary_key table\n return nil unless table\n table = self[table]\n pk = table.column_names.find{ |c| table[c].primary_key? }\n end", "def p...
[ "0.8930076", "0.88920057", "0.8846239", "0.8614813", "0.8608685", "0.8399473", "0.83273065", "0.809406", "0.80805266", "0.8060173", "0.7993409", "0.7989406", "0.7970821", "0.7924407", "0.79155463", "0.79116905", "0.79116905", "0.77857363", "0.7769599", "0.7769273", "0.7739119...
0.66001445
68
The column type for the given table column, or nil if it isn't a table column
def scaffold_table_column_type(c) column = self.properties[c] if column then if column.type == DataMapper::Property::Text :text else column.class.to_s.split("::").last.downcase.intern end else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_type(col)\n column(col).type || nil\n end", "def type(column)\n column_named(column).type || nil\n end", "def column_type(col)\n self.class.column_type(col)\n end", "def column_type(column)\n (sch = model.db_schema[column]) && sch[:type]\n end", "def c...
[ "0.9024599", "0.8659914", "0.8587097", "0.8499272", "0.8429747", "0.81365836", "0.7997774", "0.78081447", "0.7729442", "0.77001196", "0.75383115", "0.7522369", "0.747457", "0.7422543", "0.73684055", "0.7323402", "0.732145", "0.7316486", "0.7316486", "0.72888786", "0.727756", ...
0.7374629
14
The name of the underlying table
def scaffold_table_name storage_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _table_name\n self.class.table_name\n end", "def table_name\n self.class.table_name\n end", "def table_name\n @table_name ||= self.class.const_get(class_name).table_name\n end", "def table_name\n\t\tself.table_name\n\tend", "def table_name\n if qualified? && meta[:qualifi...
[ "0.8390785", "0.8311812", "0.83104044", "0.82566875", "0.818372", "0.81818146", "0.8082669", "0.7999224", "0.78976595", "0.7896676", "0.77737665", "0.7769304", "0.77628857", "0.7702764", "0.7702764", "0.7698515", "0.7693932", "0.7681432", "0.76623905", "0.7655972", "0.7613594...
0.0
-1
Updates associated records for a given reflection and from record to point to the to record
def scaffold_reflection_merge(reflection, from, to) if reflection.class == DataMapper::Associations::OneToMany::Relationship foreign_key = get_key_array_safe(reflection.target_key).name table = reflection.target_model elsif reflection.class == DataMapper::Associations::ManyToMany::Relationsh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reflection_merge(reflection, from, to)\n foreign_key = reflection.options[:foreign_key] || table_name.classify.foreign_key\n sql = case reflection.macro\n when :has_one, :has_many\n \"UPDATE #{reflection.klass.table_name} SET #{foreign_key} = #{to} WHERE #{foreign_key} = #{fro...
[ "0.6799918", "0.636962", "0.59378374", "0.5885622", "0.5850617", "0.5833436", "0.5750976", "0.5744125", "0.5699789", "0.5692902", "0.56194", "0.5547624", "0.55385506", "0.54889286", "0.5470662", "0.54702383", "0.5458846", "0.54399025", "0.54171664", "0.5411613", "0.54059035",...
0.6307753
2
Remove the associated object from object's association
def scaffold_remove_associated_object(association, object, associated_object) object.send(association).delete(associated_object) object.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_associated_object(opts, o)\n raise(Sequel::Error, 'model object does not have a primary key') unless pk\n raise(Sequel::Error, 'associated object does not have a primary key') if opts.need_associated_primary_key? && !o.pk\n return if run_association_callbacks(opts, :before_remove, o) == f...
[ "0.76195276", "0.74533606", "0.7325521", "0.72011954", "0.7068474", "0.7046802", "0.7004643", "0.69484454", "0.6850236", "0.68072575", "0.68047714", "0.67906296", "0.67621326", "0.6744923", "0.6712524", "0.6679416", "0.65803117", "0.6540139", "0.6531441", "0.64942014", "0.646...
0.7837434
0
Set the object's attributes with the given attributes
def scaffold_set_attributes(object, attributes) attributes.each do |k,v| v = nil if v.empty? and (scaffold_table_column_type(k) == :boolean or scaffold_table_column_type(k) == :integer) object.send("#{k}=", v) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setAttributes _obj, _args\n \"_obj setAttributes _args;\" \n end", "def assign_attributes( args = {} )\n args.each do |attr, value|\n send(\"#{attr}=\", value)\n end unless args.blank?\n end", "def set(attributes)\n attributes.each do |k, v|\n sen...
[ "0.8279015", "0.75592744", "0.753438", "0.7435316", "0.7363525", "0.7308499", "0.7276676", "0.7265228", "0.725403", "0.7239479", "0.7213338", "0.72131014", "0.7155017", "0.7143629", "0.7136712", "0.7119446", "0.71157336", "0.7095034", "0.7083572", "0.70760715", "0.7072585", ...
0.6942586
29
Get a list of all the paintings by a specific artists
def paintings Painting.all.select {|p| p.artist == self} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def artists\n paintings.map do |painting|\n painting.artist\n end\n end", "def artists\n paintings.collect do |p|\n p.artist \n end\n end", "def artists\n paintings.map{|art| art.artist.name}\n\n end", "def artists\n self.paintings.map do |painting|\n painting.artist\n ...
[ "0.8409658", "0.8373926", "0.8249646", "0.8116813", "0.7832785", "0.7727487", "0.76775134", "0.76775134", "0.76775134", "0.76550114", "0.7644857", "0.7627373", "0.7627373", "0.76258355", "0.7621444", "0.7596008", "0.7595891", "0.75678223", "0.75579643", "0.7444956", "0.711457...
0.7818721
5
Get a list of all the galleries that a specific artist has paintings in
def galleries paintings.map {|p| p.gallery} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries\n Painting.all.map do |painting_instance| \n if painting_instance.artist == self\n painting_instance.gallery\n end\n end.compact.uniq\n end", "def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |pai...
[ "0.84810704", "0.8325805", "0.80628324", "0.80291814", "0.79440737", "0.79334384", "0.79334384", "0.79334384", "0.7931513", "0.79093874", "0.78827155", "0.78453654", "0.7817554", "0.7720016", "0.7657598", "0.7621689", "0.7353315", "0.7324328", "0.7261281", "0.7208339", "0.718...
0.8212049
2