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
require 'rubygems' require 'oauth' require 'json'
def constantize(string) return string.downcase.gsub(/[^a-z]/i, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_requires()\n require 'rack'\n require './lib/my_thin.rb'\n require './android_translation_helper.rb'\nend", "def require_gems; end", "def initialize\n require 'open-uri'\n require 'json'\n optional_gem 'jsonpath'\n end", "def conscientious_require; end", "def ini...
[ "0.68832314", "0.68214726", "0.6669958", "0.6621294", "0.6595564", "0.6489403", "0.61675406", "0.59948546", "0.5968073", "0.59416384", "0.5909711", "0.584697", "0.58180296", "0.5717908", "0.56910926", "0.56910926", "0.56910926", "0.56513876", "0.5647925", "0.5647925", "0.5640...
0.0
-1
GET /pagina_principals GET /pagina_principals.json
def index @pagina_principals = PaginaPrincipal.all def index if( !(session[:cafe] != nil && session[:cafe] != '') ) redirect_to '/' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @slider_principals = SliderPrincipal.all\n end", "def index\n @usuarios = Usuario.paginate(page: params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @unidades = current_user.empresa.uni...
[ "0.6125944", "0.6043836", "0.6034562", "0.598759", "0.5979556", "0.5865911", "0.5830862", "0.582593", "0.5821607", "0.58168006", "0.58145386", "0.580052", "0.5795285", "0.5793987", "0.577988", "0.5763626", "0.57336086", "0.5721906", "0.57187206", "0.57185656", "0.57099414", ...
0.5646031
28
GET /pagina_principals/1 GET /pagina_principals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pagina_principal\n @pagina_principal = PaginaPrincipal.find(params[:id])\n end", "def index\n @usuarios = Usuario.paginate(page: params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @uni...
[ "0.63806653", "0.6141997", "0.60513455", "0.60486054", "0.599158", "0.5983846", "0.5983029", "0.59639883", "0.59469026", "0.58980966", "0.5894253", "0.5880484", "0.58435124", "0.5840942", "0.583935", "0.58309525", "0.58257216", "0.5815181", "0.58118707", "0.5810231", "0.57995...
0.0
-1
POST /pagina_principals POST /pagina_principals.json
def create @pagina_principal = PaginaPrincipal.new(pagina_principal_params) respond_to do |format| if @pagina_principal.save format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully created.' } format.json { render :show, status: :created, location: @pagina_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_principals; end", "def valid_principals=(_arg0); end", "def set_pagina_principal\n @pagina_principal = PaginaPrincipal.find(params[:id])\n end", "def pagina_principal_params\n params.require(:pagina_principal).permit(:index)\n end", "def principals=(principals)\n if principal...
[ "0.6146954", "0.5881749", "0.58080065", "0.56739277", "0.5511896", "0.54970765", "0.5487306", "0.54829973", "0.54705435", "0.545323", "0.52862793", "0.5257387", "0.5177048", "0.5172978", "0.5170634", "0.5162392", "0.5156691", "0.51498526", "0.51335627", "0.5111573", "0.511022...
0.65687186
0
PATCH/PUT /pagina_principals/1 PATCH/PUT /pagina_principals/1.json
def update respond_to do |format| if @pagina_principal.update(pagina_principal_params) format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully updated.' } format.json { render :show, status: :ok, location: @pagina_principal } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_principal(path, prop_patch)\n end", "def update_principal(path, prop_patch)\n value = nil\n principal_index = nil\n principal = nil\n\n @principals.each_with_index do |value, i|\n principal_index = i\n if value['uri'] == path\n ...
[ "0.70489043", "0.6467016", "0.6143503", "0.6128833", "0.6063074", "0.604816", "0.6046974", "0.6044596", "0.6041435", "0.59922636", "0.5991825", "0.59721786", "0.59666413", "0.59430414", "0.59428984", "0.5942153", "0.5934267", "0.5930359", "0.592473", "0.5901405", "0.58866197"...
0.7072099
0
DELETE /pagina_principals/1 DELETE /pagina_principals/1.json
def destroy @pagina_principal.destroy respond_to do |format| format.html { redirect_to pagina_principals_url, notice: 'Pagina principal was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @princip...
[ "0.7025209", "0.7020778", "0.69988394", "0.69913095", "0.6964188", "0.69519305", "0.6944103", "0.6919521", "0.69168353", "0.6915807", "0.6914297", "0.6909983", "0.6886086", "0.68858635", "0.68801904", "0.68636686", "0.6856292", "0.6855705", "0.68552876", "0.68535185", "0.6851...
0.76799166
0
Use callbacks to share common setup or constraints between actions.
def set_pagina_principal @pagina_principal = PaginaPrincipal.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 pagina_principal_params params.require(:pagina_principal).permit(:index) 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
keep getting http error 500 still needs fix
def create_message(user_id, recipient_id, token , subject, message) response = self.class.post('/messages', body: { "user_id": user_id, "recipient_id": recipient_id,"token": token , "subject": subject, "stripped-text": message }, headers: { "authorization" => @auth_token }) puts response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error\n render plain: '500 Internal Server Error', status: :internal_server_error\n end", "def server_errors; end", "def status_error\n @status = 500\n end", "def status\n 500\n end", "def internal_error\n\t\tself.status = 500\n\t\tself.headers = {}\n\t\tself.content = [\"Inte...
[ "0.72961783", "0.72279507", "0.7225323", "0.72223186", "0.7172752", "0.7141435", "0.7029317", "0.70184904", "0.70069003", "0.69799477", "0.6934629", "0.69206107", "0.6844465", "0.68157524", "0.6799318", "0.67815083", "0.67701286", "0.67473626", "0.6742689", "0.67346585", "0.6...
0.0
-1
type: 0 seed 1 links 2 backlinks
def parsetitle( titles, type, parentid ) apiurl='http://en.wikipedia.org/w/api.php' ## resulthash links=Hash.new #### First query, no plcontinue query = { 'action'=>'query', 'prop'=>'info', 'redirects'=>'', 'inprop'=>'url', 'format'=>'json', } ### Separate by type case type ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def links; end", "def links; end", "def create_links\n end", "def create_links\n end", "def nlink() end", "def backlink; {color: :blue} end", "def my_links\n end", "def links(type = :local)\n @links = type == :all ? @all_links : @local_links\n end", "def links_feed\n end", "def link()...
[ "0.67355895", "0.67355895", "0.6376958", "0.6376958", "0.62172997", "0.6088417", "0.5949736", "0.59450626", "0.5930141", "0.5739786", "0.5739786", "0.5707434", "0.5652366", "0.5619717", "0.55998516", "0.55829835", "0.55727756", "0.55674267", "0.55657953", "0.5540981", "0.5528...
0.0
-1
require all array elements be unique
def unique? @unique end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uniq(array)\nend", "def using_uniq(array)\n\n \nend", "def array_uniq!(a)\n a.uniq!\n end", "def no_mutter(arr)\n arr.uniq\nend", "def array_uniq!(a)\n a.uniq!\n end", "def using_uniq(array)\n array.uniq\n end", "def uniq(array)\n unique_values = []\n array.ea...
[ "0.7609767", "0.7487446", "0.74629664", "0.73676455", "0.73541284", "0.727612", "0.7250225", "0.723578", "0.7235528", "0.72244024", "0.7220144", "0.7186752", "0.7184513", "0.7184513", "0.71772903", "0.71734923", "0.7160817", "0.71586806", "0.71586806", "0.71586806", "0.715245...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.fetch(:post, {}).permit( :title, :firstContent, :secondContent, :thirdContent, :forthContent, :fifthContent, :rname, :is_display, :status ) 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
Steps I need an empty variable to hold the final reversed string I need a variable to hold my iterations I need to concatinate to the front of the final string I need to check if the original string and the new string are equal My Attempt
def is_palindrome(word) reversed = "" i = 0 while i < word.length char = word[i] reversed = char + reversed i += 1 end if word == reversed return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(str)\n str.reverse\nend", "def string_rotation(str1, str2)\n arr1 = str1.split('')\n str1.length.times do |i|\n return true if arr1.unshift(arr1.pop).join == str2\n end\n return false\nend", "def solution(str)\n str.reverse\nend", "def is_palindrome(string)\n joined_str = string.gsu...
[ "0.6819071", "0.68182075", "0.67821515", "0.6779305", "0.6774216", "0.6770996", "0.6744134", "0.6741999", "0.673775", "0.6630879", "0.66058594", "0.6592998", "0.6521769", "0.65190744", "0.65078026", "0.65078026", "0.6504867", "0.6472779", "0.6449276", "0.6448165", "0.6447041"...
0.0
-1
checks the album to see if there is a file with the same def has_same_photo?(album_id, f)
def has_same_photo?(fb_photos, f) # album = Mogli::Album.find(album_id, client) # fb_photos = album.photos has_photo = false fb_photos.each do |p| break if has_photo fb_photo_url = p.source fb_photo_file = get_photo_as_file_from_url(fb_photo_url) # Rails.logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend", "def has_photo?\n File.exists? photo_filename\n end", "def has_photo?\n File.exists? photo_filename\n end", "def has_photo?\n File.exists? photo_filena...
[ "0.692624", "0.6680751", "0.6680751", "0.6680751", "0.65596867", "0.65364087", "0.64193106", "0.6240499", "0.6178675", "0.61408794", "0.61218715", "0.6101617", "0.6097256", "0.6086178", "0.60632247", "0.5990265", "0.59662616", "0.5950601", "0.59047174", "0.59040934", "0.58802...
0.82081425
0
Enlace que se muestra solo si el usuario ha ingresado al sistema
def link_usuario(titulo, enlace) link_to titulo, enlace if not session[:usuario] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inicio_sesion?\n usuario_id.blank?\n end", "def logado?\n !current_user.nil?\n end", "def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend", "def isRegistado?\n if session[:perm] == 0\n return true;\n else\n return false;\n end\n end", "def exibe_para_usuario?\n \t\tif usuar...
[ "0.7026107", "0.69358766", "0.6930118", "0.688014", "0.6853501", "0.6839029", "0.67581594", "0.67500573", "0.67414856", "0.6644328", "0.6589127", "0.65551716", "0.65409815", "0.6535649", "0.6525826", "0.651072", "0.650614", "0.650614", "0.6461955", "0.6448556", "0.6428166", ...
0.0
-1
Enlace que se muestra solo si no hay un usuario logueado
def link_anonimo(titulo, enlace) link_to titulo, enlace if session[:usuario] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logado?\n !current_user.nil?\n end", "def logado?\n !admin_atual.nil?\n end", "def inicio_sesion?\n usuario_id.blank?\n end", "def revisar_usuario\n if session[:usuario].empty?\n flash[:notice] = \"Debe loguearsar para poder seguir\"\n redirect_to \"/login\"\n end\n end", ...
[ "0.7750504", "0.73521215", "0.73299307", "0.71518093", "0.70934534", "0.7092077", "0.7082738", "0.7074484", "0.7066719", "0.70598406", "0.7052937", "0.7017047", "0.6973376", "0.69658285", "0.6925182", "0.6899391", "0.6810334", "0.67826337", "0.67476106", "0.67184323", "0.6696...
0.0
-1
To invalidate token upon logout
def invalidate_token self.update_columns(auth_token: nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout\r\n self.update(token: nil) \r\n end", "def invalidate_token\n update_attribute(:token, nil)\n update_attribute(:token_created_at, Time.now)\n end", "def logout\n current_user.update(valid_jwt: false)\n end", "def invalidate_token\n self.update_columns(auth_token:...
[ "0.8360604", "0.7862523", "0.77508974", "0.7671452", "0.7661084", "0.7619964", "0.7619964", "0.76088196", "0.75917846", "0.7552949", "0.75504", "0.75389063", "0.7469212", "0.74316716", "0.7423723", "0.74120265", "0.7405052", "0.7399541", "0.73699105", "0.73581076", "0.7306731...
0.76320684
5
Accepts a file path to parse mp3 files from e.g. "./spec/fixtures/mp3s"
def initialize(file_path) @path = file_path @files_array = [] self.files end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(path)\n @path = path\n # accepts a file path to parse mp3 files from \n end", "def initialize(path)\n @path = path#accepts a file path to parse MP3 files from\n end", "def parse_file(music_dir_path , path)\n begin\n\n begin\n # Get the relative path of the file\n ...
[ "0.7534987", "0.74295145", "0.714739", "0.6981381", "0.6809124", "0.66446036", "0.66320646", "0.6586375", "0.6549358", "0.6463051", "0.6306905", "0.63020617", "0.6241906", "0.62367743", "0.6211862", "0.61854947", "0.61727965", "0.61481977", "0.61297643", "0.611657", "0.611620...
0.0
-1
Loads all the mp3 files in the path directory Normalizes the filename to just the mp3 filename with no path TEST: music_importer.files.size => 4
def files @files_array = Dir.entries(self.path).select {|f| !File.directory? f} # This returns: # ["Action Bronson - Larry Csonka - indie.mp3", # "Real Estate - Green Aisles - country.mp3", # "Real Estate - It's Real - hip-hop.mp3", # "Thundercat - For Love I Come - dance.mp3"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files # loads all the mp3 files in the path directory / normalizes the filename to just the mp3 filename with no path\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{ |f| f.gsub(\"#{path}/\", \"\") } # then using the .collect method and gsub to just return the filename with out path\n end", "def files\n...
[ "0.80089545", "0.73722214", "0.7262233", "0.72063255", "0.7154327", "0.7137118", "0.7092597", "0.7090557", "0.70861024", "0.7047633", "0.7023163", "0.7004804", "0.69547623", "0.6939964", "0.6929856", "0.6852042", "0.6840113", "0.6838643", "0.6834355", "0.6834068", "0.68048316...
0.5728664
75
GET /customers GET /customers.json
def index @customers = Customer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def index\n @user = current_user\n @customers = @user.custo...
[ "0.80477434", "0.7958279", "0.78736347", "0.7785999", "0.7759871", "0.7743631", "0.7737657", "0.7650475", "0.7650475", "0.7644552", "0.76392215", "0.7563173", "0.7439835", "0.74304175", "0.74225414", "0.7395726", "0.72824943", "0.72764957", "0.7261613", "0.72505057", "0.72505...
0.6973055
49
GET /customers/1 GET /customers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def index\n @user = current_user\n @customers = @user.custom...
[ "0.78554344", "0.78554344", "0.76806945", "0.76002246", "0.75336385", "0.75142324", "0.7499966", "0.7383746", "0.73374355", "0.73374355", "0.73374355", "0.73374355", "0.73374355", "0.73374355", "0.73158854", "0.7307321", "0.7280559", "0.7196479", "0.71882653", "0.7170412", "0...
0.0
-1
POST /customers POST /customers.json
def create coupon_id = params[:customer][:coupon_id] c = Coupon.find(coupon_id) @r = Restaurant.find(c.restaurant_id) @customer_phone = params[:customer][:phone_number] if Customer.find_by_phone_number(@customer_phone).nil? @customer = Customer.new(customer_params) respond_to do |fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n ...
[ "0.7583026", "0.7368963", "0.72758555", "0.7225672", "0.7224766", "0.7142322", "0.7116918", "0.7109281", "0.7102696", "0.70753646", "0.7068943", "0.7054525", "0.70359194", "0.70359194", "0.70350176", "0.703466", "0.70175", "0.7017294", "0.7017294", "0.7017294", "0.7017294", ...
0.0
-1
PATCH/PUT /customers/1 PATCH/PUT /customers/1.json
def update respond_to do |format| if @customer.update(customer_params) format.html { redirect_to @customer, notice: 'Customer was successfully updated.' } format.json { render :show, status: :ok, location: @customer } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #format.html { redirect_to customers_path }\n format.json { head :ok ...
[ "0.6988014", "0.6921667", "0.6921389", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.67379916", "0.6729548", "0.669213", "0.669213", "0.669213", "0.6614732", "0.66107404", "0.6601309", "0.6599307", "0.6581087", "0.65642476", "...
0.6525123
37
DELETE /customers/1 DELETE /customers/1.json
def destroy @customer.destroy respond_to do |format| format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |for...
[ "0.7459997", "0.7459997", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.7435839", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7364333", "0.732843", "0.7298528...
0.7141246
42
Use callbacks to share common setup or constraints between actions.
def set_customer @customer = Customer.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def customer_params params.require(:customer).permit(:phone_number, :latitude, :longitude) 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
A group is not destroyed, it's disbanded!
def disband_group destroy_collection({:table=>'groups', :on_success=>'You disbanded the group.'}) rescue flash[:notice] = "Could not find group." redirect_to :action=>'groups' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend", "def remove_group(group)\n self.groups.destroy group \n end", "def dissolve_groups\n groups.destroy_all\n end", "def refuse_group group\n group_invitations.where(group: grou...
[ "0.75015825", "0.7431315", "0.73753315", "0.7365237", "0.7246178", "0.7246178", "0.7214653", "0.71843475", "0.7062452", "0.7038382", "0.69918215", "0.6975259", "0.6952159", "0.6875535", "0.6863994", "0.6835459", "0.682714", "0.6824124", "0.68159384", "0.6806176", "0.676754", ...
0.75392514
0
The user methods do not use the collection_methods module
def users @user_pages, @users = paginate :users, :per_page => 10 render 'admin/users' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_collection_methods; end", "def collection; end", "def collection; end", "def collection_methods\n (@_collection_methods ||= {})\n end", "def collections; end", "def collection_method name, &block\n collection_methods[name] = block\n end", "def method_missing(method, *args)\n ...
[ "0.7727173", "0.7489798", "0.7489798", "0.742187", "0.7111487", "0.6907021", "0.6797692", "0.67157626", "0.67014515", "0.67014515", "0.67014515", "0.67014515", "0.66918343", "0.656956", "0.6560988", "0.6560988", "0.6510211", "0.6497495", "0.6477487", "0.6399777", "0.635246", ...
0.0
-1
We can use these expectations to assert something affirmative
def test_capybara_can_find_element on_visiting_browserkoans_test_page do assert_equal __(true), page.has_selector?('#mypara') assert_nothing_raised do expect(page).to have_selector(__('#mypara')) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertions; end", "def assertions; end", "def check_expectations\n expectations.each do |subject, matcher|\n expect(subject).to matcher if matcher\n end\n nil\n end", "def test_espresso_more_effective\n hipster = Human.new \"Hipster\"\n espresso = Espresso.new \"E...
[ "0.7289056", "0.7289056", "0.6450548", "0.64220583", "0.639296", "0.63795066", "0.6366299", "0.6363982", "0.63499254", "0.6348415", "0.6346621", "0.634376", "0.6292701", "0.62822247", "0.6271838", "0.6253848", "0.62528414", "0.6246689", "0.62240785", "0.6211107", "0.62091184"...
0.0
-1
We can also use the expectations to ensure a necessary negative
def test_capybara_can_ensure_something_is_not_found on_visiting_browserkoans_test_page do assert_equal __(false), page.has_selector?('#not-there') assert_nothing_raised do expect(page).to_not have_selector(__('#not-there')) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend", "def negative_test\r\n @negative = true\r\n end", "def test_print_books_negative\n\t\tassert_raises(\"Cannot have fewer than 0 books\") { print_books(-1,-1) }\n\tend", "def test_results_negative\r\n assert_raises('Cannot have a nega...
[ "0.7401456", "0.73384684", "0.7017624", "0.7015693", "0.7003195", "0.7003195", "0.7003195", "0.6969293", "0.6895535", "0.6742986", "0.6730589", "0.67154986", "0.67087793", "0.67071533", "0.67053705", "0.67053705", "0.6686283", "0.6631685", "0.6611565", "0.66021687", "0.660190...
0.0
-1
GET /room_plants GET /room_plants.json
def index @room_plants = RoomPlant.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n...
[ "0.6873085", "0.6651381", "0.66009724", "0.6308563", "0.6165632", "0.6165632", "0.6165632", "0.6165536", "0.613408", "0.6129944", "0.61185324", "0.6094506", "0.6074843", "0.6062588", "0.6046237", "0.6040447", "0.60214645", "0.60207134", "0.6010185", "0.59752303", "0.5973547",...
0.7080606
0
GET /room_plants/1 GET /room_plants/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @room_plants = RoomPlant.all\n end", "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def index\...
[ "0.69999033", "0.6849129", "0.6675932", "0.66178566", "0.6617773", "0.6617773", "0.6617773", "0.6593034", "0.6501112", "0.64346147", "0.63713616", "0.6353442", "0.63496196", "0.63173956", "0.6303042", "0.62894815", "0.627759", "0.626709", "0.6259189", "0.6237381", "0.6185674"...
0.0
-1
POST /room_plants POST /room_plants.json
def create @room_plant = RoomPlant.new(room_plant_params) if @room_plant.save render :show, status: :created, location: @room_plant else render json: @room_plant.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n plant = Plant.create(plant_params)\n render json: plant, status: :created\n end", "def create\n @room = Room.new(room_params)\n\n respond_to do |format|\n if @room.save\n format.html { redirect_to hotelprofile_path, notice: 'Room was successfully created.' }\n format....
[ "0.6517727", "0.63890606", "0.6387817", "0.6332335", "0.62932044", "0.62543356", "0.62041664", "0.6199585", "0.6198878", "0.618649", "0.61804456", "0.61730784", "0.61699", "0.61575717", "0.6154553", "0.61489403", "0.61489403", "0.61489403", "0.61406195", "0.61406195", "0.6125...
0.7071688
0
PATCH/PUT /room_plants/1 PATCH/PUT /room_plants/1.json
def update if @room_plant.update(room_plant_params) render :show, status: :ok, location: @room_plant else render json: @room_plant.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @room = Room.find(params[:id])\n\n if @room.update_attributes(params[:room])\n head :ok\n else\n render :json => @room.errors, :status => :unprocessable_entity \n end\n end", "def update\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n\n respond_to do ...
[ "0.6791316", "0.67780656", "0.6730887", "0.6712128", "0.6712128", "0.6681339", "0.6670187", "0.6633799", "0.6629523", "0.6588999", "0.6587691", "0.65767485", "0.65751785", "0.6564573", "0.6511559", "0.650831", "0.6496751", "0.6483593", "0.6483593", "0.6483593", "0.6483593", ...
0.7021614
0
DELETE /room_plants/1 DELETE /room_plants/1.json
def destroy @room_plant.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @restroom.destroy\n respond_to do |format|\n format.html { redirect_to restrooms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_room.destroy\n respond_to do |format|\n format.html { redirect_to admin_rooms_url }\n format.json { head ...
[ "0.7271063", "0.72138345", "0.7201651", "0.71675795", "0.71072954", "0.7099285", "0.70901394", "0.70900524", "0.70890146", "0.7080594", "0.70632714", "0.70386904", "0.70239305", "0.7016282", "0.70043874", "0.6989799", "0.6989799", "0.698088", "0.6963748", "0.69513077", "0.694...
0.72758394
0
Use callbacks to share common setup or constraints between actions.
def set_room_plant @room_plant = RoomPlant.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 room_plant_params params.fetch(:room_plant, {}) 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
get the active tasks
def active_tasks request.method = :get request.uri = '_active_tasks' Couchdbtools.execute(request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_tasks\n @tasks.select { | task | task.active }\n end", "def active_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).active\n end\n output\n end", "def tasks\n task_list.tasks\n end", "def active_tasks(ta...
[ "0.8875768", "0.7871919", "0.7786497", "0.7763841", "0.77072775", "0.77072775", "0.77072775", "0.7630675", "0.7594248", "0.7484615", "0.7460146", "0.7398383", "0.73976403", "0.7374667", "0.736281", "0.7312423", "0.7286491", "0.7282861", "0.7204003", "0.7187266", "0.7170786", ...
0.8051246
1
get all existing databases
def all_dbs request.method = :get request.uri = '_all_dbs' Couchdbtools.execute(request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def databases\n get '_all_dbs'\n end", "def get_all_databases\n databases = ::MySQL::Database.find_all\n names = []\n databases.each do |database|\n names << database.name\n end\n names\n end", "def databases\n CouchRest.get \"#{@uri}/_all_dbs\"\n end", "def...
[ "0.8775021", "0.8339587", "0.8323108", "0.82303756", "0.8091986", "0.8091986", "0.80724907", "0.7886002", "0.76090693", "0.75427943", "0.74113053", "0.73977333", "0.73393494", "0.72764397", "0.7210918", "0.72076946", "0.7204332", "0.7193086", "0.7161016", "0.71276724", "0.710...
0.79987794
7
get the database events
def db_updates(params_hash = {}) begin raise_error_unless_params_is_a_hash(params_hash) request.method = :get request.uri = "_db_updates#{querystring(params_hash)}" Couchdbtools.execute(request) rescue Exception => exception exception.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events(dbname, &block)\n # can't use RestClient.get b/c of :block_response\n RestClient::Request.execute(:method => :get,\n :url => root_url('events', @storage, dbname),\n :headers => {:accept => \"text/event-stream\"},\n :block_response => block, &HANDLE_RESPONSE)\n end", "...
[ "0.7372006", "0.735073", "0.735073", "0.7331979", "0.7262258", "0.72227776", "0.7114683", "0.71044487", "0.699481", "0.6977951", "0.68959826", "0.68478906", "0.6825873", "0.6782902", "0.6773882", "0.6751759", "0.6721162", "0.6703099", "0.66987103", "0.66987103", "0.6693622", ...
0.0
-1
get the log output
def log(params_hash = {}) begin raise_error_unless_params_is_a_hash(params_hash) request.method = :get request.uri = "_log#{querystring(params_hash)}" Couchdbtools.execute(request) rescue Exception => exception exception.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log\n @log_output.string\n end", "def log\n @output || []\n end", "def logger_output; end", "def log_output()\n prefix = @global_opts[:prefix] ? (@global_opts[:prefix] + \"-\") : \"\"\n t = Time.now.strftime(\"%Y%m%d%H%M%S\")\n\n # Check for any returned records\n if (...
[ "0.81865406", "0.7616897", "0.74603134", "0.7017454", "0.69515413", "0.69006777", "0.6805505", "0.6791045", "0.6725854", "0.6725854", "0.6725854", "0.66410315", "0.6615037", "0.6612609", "0.6596438", "0.65742517", "0.65240276", "0.65085435", "0.6457799", "0.6419957", "0.64096...
0.0
-1
Sets the base url for this class. Note that it will not be inherited by subclasses.
def set_base_url(url) base_url = url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_base_url\n uri = URI.parse(@page_url)\n @base_url = \"#{uri.scheme}://#{uri.host}\"\n end", "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def base_url=(uri)\n @base_uri = uri\n end", "def base_url=(url)\n @base_url = url\n Prov.base_u...
[ "0.80746716", "0.79137087", "0.7639439", "0.7569167", "0.74566764", "0.73124325", "0.72121936", "0.718432", "0.7156618", "0.7123073", "0.70852757", "0.7073852", "0.7054508", "0.6979999", "0.6972563", "0.6944093", "0.6938912", "0.6921294", "0.6783741", "0.672607", "0.6711101",...
0.83536834
0
Builds a new HTTP request and adds it to the +Config.hydra+ request queue. Registers a callback that invokes +handle_response+ when the request completes. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_tim...
def queue_request(url_or_path, options = {}, &block) url = absolute_url(url_or_path) headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {})) headers = merge_log_weasel_header(headers) timeout = options.fetch(:timeout, Ladon.default_request_timeout) req...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_and_handle http_method, path, options\n if http_method.is_a?(String) || http_method.is_a?(Symbol)\n http_method = HTTP_METHODS[http_method.to_s]\n raise \"Unknown http method: #{http_method}\" unless http_method\n end\n \n req_options = default_options.dup\n ...
[ "0.5867015", "0.5827443", "0.5689182", "0.56365407", "0.53842497", "0.5358803", "0.53440934", "0.5326121", "0.53191715", "0.5239235", "0.5218071", "0.5206298", "0.5198162", "0.51842266", "0.51709586", "0.5157912", "0.5140975", "0.5109453", "0.5106532", "0.51051325", "0.508206...
0.6955892
0
Sends a synchronous POST request. On success, yields any returned data; on error, yields any provided default data or +nil+. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_timeout+) +default_data+ passes t...
def fire_post(url_or_path, entity, options = {}, &block) url = absolute_url(url_or_path) headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}. merge(options.fetch(:headers, {})) headers = merge_log_weasel_header(headers) timeout = options...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(data = nil, options = nil)\n options ||= {}\n options[:method] = :post\n call data, options\n end", "def post(options={}, &block)\n response = http.post_uri(options.merge(:body => serialize), &block)\n handle_response(response)\n end", "def make_post_request url, body, h...
[ "0.61562717", "0.6011057", "0.59698796", "0.59425735", "0.5935013", "0.59187734", "0.5892428", "0.589223", "0.5851671", "0.5849568", "0.58440095", "0.578222", "0.5756816", "0.57542646", "0.5746432", "0.5741888", "0.57218045", "0.569039", "0.5688466", "0.5648442", "0.5639095",...
0.5492101
41
Sends a synchronous PUT request. On success, yields any returned data; on error, yields any provided default data or +nil+. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_timeout+) +default_data+ passes th...
def fire_put(url_or_path, entity, options = {}, &block) url = absolute_url(url_or_path) headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}. merge(options.fetch(:headers, {})) headers = merge_log_weasel_header(headers) timeout = options....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put options={}, &block\n handle_exceptions do\n Chimps.log.info(\"PUT #{url}\")\n Response.new(super(encoded_body, options, &block))\n end\n end", "def put(data = nil, options = nil)\n options ||= {}\n options[:method] = :put\n call data, options\n end", "def pu...
[ "0.67147917", "0.6701848", "0.6417074", "0.6389762", "0.63164777", "0.62826586", "0.62683374", "0.62661195", "0.62441283", "0.6243208", "0.62368053", "0.62349933", "0.62247276", "0.62232995", "0.6211339", "0.6174047", "0.6174047", "0.6142432", "0.6140279", "0.61127234", "0.61...
0.6257976
8
Sends a synchronous DELETE request. On success, yields any returned data; on error, yields any provided default data or +nil+. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_timeout+) +default_data+ passes...
def fire_delete(url_or_path, options = {}, &block) params = options.fetch(:params, {}) params.merge!(mapped_params(options)) url = absolute_url(url_or_path, params: params) headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {})) headers = merge_log_we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete options={}, &block\n handle_exceptions do\n Chimps.log.info(\"DELETE #{url}\")\n Response.new(super(options, &block))\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n e...
[ "0.69131684", "0.69060266", "0.6822546", "0.67484254", "0.67352724", "0.67244554", "0.67244554", "0.6722736", "0.67103326", "0.6703254", "0.66961753", "0.66961753", "0.6660535", "0.65779996", "0.654648", "0.6512669", "0.65105695", "0.64814013", "0.64459455", "0.64413345", "0....
0.70708954
0
Sends a synchronous PATCH request. On success, yields any returned data; on error, yields any provided default data or +nil+. Recognizes the following options: +headers+ a hash to add or update the request headers +timeout+ the timeout for the request (defaults to +Ladon.default_request_timeout+) +default_data+ passes ...
def fire_patch(url_or_path, entity, options = {}, &block) url = absolute_url(url_or_path) headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON_PATCH}. merge(options.fetch(:headers, {})) headers = merge_log_weasel_header(headers) timeout = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(data = nil, options = nil)\n options ||= {}\n options[:method] = :patch\n call data, options\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response...
[ "0.67690635", "0.66018444", "0.65850794", "0.653295", "0.65206766", "0.64857477", "0.64857477", "0.6412761", "0.6395862", "0.6321682", "0.62371856", "0.6219795", "0.6063059", "0.6035184", "0.6035184", "0.60253274", "0.6017978", "0.59807795", "0.58862245", "0.5858433", "0.5807...
0.6176983
12
Negotiates the murky waters of HTTP response state. On success, parses the response body as a JSON object; on timeout or error, uses the default data instead. If a block is given, the data is yielded to it, and the block's return value is returned. IF no block is given, the data is returned directedly. Recognizes the f...
def handle_response(response, options = {}, &block) request = options[:request] method = (request ? request.method : options[:method]) || '?' url = (request ? request.url : options[:url]) || '?' default_data = options[:default_data] default_data = HashWithIndifferentAcc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(&block)\n # RODA4: Remove\n catch(:halt) do\n r = @_request\n r.block_result(instance_exec(r, &block)) # Fallback\n @_response.finish\n end\n end", "def block_with_http_info(opts = {})\n if @api_client.config.debugging\n @api...
[ "0.58503574", "0.581427", "0.5748257", "0.56917125", "0.5664362", "0.5662406", "0.5619606", "0.560487", "0.55488604", "0.5483149", "0.5476715", "0.5455845", "0.5434253", "0.5422489", "0.5409693", "0.5383195", "0.5377444", "0.5372209", "0.5367742", "0.5367375", "0.5306031", ...
0.57648283
2
Returns a copy of +headers+ that includes a LogWeasel header if a LogWeasel transaction is in progress.
def merge_log_weasel_header(headers) if LogWeasel::Transaction.id headers.merge(LogWeasel::Middleware::KEY_HEADER => LogWeasel::Transaction.id) else headers end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headers\n call_once\n @headers\n end", "def headers\n @headers ||={}\n end", "def headers\n @headers ||= {}\n end", "def get_headers\n @headers = headers\n @headers\n end", "def headers\n @headers ||= {}\n end", "def headers\n @headers.reject {...
[ "0.62355393", "0.6234131", "0.61439174", "0.6142247", "0.6125728", "0.61098045", "0.60988593", "0.60849", "0.608145", "0.60323966", "0.601206", "0.6000462", "0.5993433", "0.59727526", "0.59727526", "0.59727526", "0.5943301", "0.5892086", "0.58480734", "0.58279353", "0.5796364...
0.70551175
0
Returns the URL created by appending +url_or_path+ to the server's base URL, unless +url_or_path+ is alrady absolute.
def absolute_url(url_or_path, options= {}) url = url_or_path =~ /^#{base_url}/ ? url_or_path : "#{base_url}#{url_or_path}" params = options.fetch(:params, {}) query = params.inject([]) do |rv, param| rv.concat((param[1].is_a?(Array) ? param[1] : [param[1]]).map {|v| "#{uri_esca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_url\n File.join(host, path)\n end", "def base_url(operation = nil)\n index = server_operation_index.fetch(operation, server_index)\n return \"#{scheme}://#{[host, base_path].join('/').gsub(/\\/+/, '/')}\".sub(/\\/+\\z/, '') if index == nil\n\n server_url(index, server_operation_va...
[ "0.66544044", "0.65869874", "0.6545508", "0.65320575", "0.63942105", "0.6325804", "0.6305801", "0.63028127", "0.63006556", "0.62917066", "0.62789845", "0.62712216", "0.6268397", "0.6257448", "0.62521595", "0.62189317", "0.6212656", "0.62119657", "0.61598283", "0.6149283", "0....
0.6700565
0
Encodes +entity_ as a JSON string.
def encode_entity(entity) Yajl::Encoder.encode(entity) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize(entity)\n value = entity.attribute(name)\n\n if value.nil?\n value = entity.write_attribute(name, default(entity))\n end\n\n serializer.serialize value, name: name\n end", "def _serialize(entity)\n @collection.serialize(entity)\n end", ...
[ "0.66318667", "0.65506786", "0.65506786", "0.6237487", "0.6177159", "0.61610687", "0.60063857", "0.60053104", "0.5929432", "0.58121765", "0.5761164", "0.5731225", "0.57239187", "0.56732655", "0.56310195", "0.56063277", "0.55532664", "0.5545393", "0.55242205", "0.54877627", "0...
0.7911234
0
Converts +entity+ from a JSON string to an object.
def parse_entity(entity) entity = Yajl::Parser.parse(entity) entity.is_a?(Hash) ? HashWithIndifferentAccess.new(entity) : entity end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_to_obj json_str\n hash_to_obj(parse_json(json_str))\n end", "def _parse_entity(entity_string)\n entity_type = entity_string.split(\"#\").first\n\n # hack - fixes entities with full type\n unless entity_type =~ /::/\n entity_type = \"Intrigue::Entity::#{entity_type}\"\n end\n...
[ "0.7105521", "0.66010773", "0.6512244", "0.6490825", "0.6428207", "0.6293814", "0.6285323", "0.61657053", "0.61343664", "0.61341286", "0.6125743", "0.5979551", "0.5973756", "0.59164816", "0.57833725", "0.57226646", "0.57207406", "0.5691729", "0.56381327", "0.5630607", "0.5616...
0.68498087
1
Converts options to a pager. If none of the below described options is provided, returns +nil+.
def pager(options) pager = if options.include?(:pager) options[:pager] elsif options[:paged] || options[:pre_paged] || options[:page].present? || options[:per].present? Ladon::Pager.new(options) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_paging_options(options, default_opts = {})\n if default_opts.blank?\n # This conditions will order records by directory and name first.\n default_opts = {\n :sort_criteria => DEFAULT_ORDER\n }\n end\n paging_options(options, default_opts)\n ...
[ "0.6366224", "0.6321129", "0.6264103", "0.613818", "0.59587413", "0.5934598", "0.5926572", "0.5889537", "0.5737416", "0.57153875", "0.56498396", "0.5614686", "0.5596935", "0.55710346", "0.55707645", "0.5552049", "0.5524171", "0.5480148", "0.5470236", "0.54599315", "0.5397454"...
0.7431409
0
TODO: chawarong ask P'Phob if payment_term and payment_term_day needs to be present
def validate_on_create @count_client_contact_record = ClientContactRecord.count(:all, :conditions => ['client_contract_id=?',client_contract_id]) if @count_client_contact_record == 0 errors.add_to_base('Please Add Client contact record first') return false else return true end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_term; end", "def term_of_payments\n @term_of_payments ||= TermOfPaymentProxy.new(self)\n end", "def paymentterm\n paymentterms.first\n end", "def create\n @payment = Payment.new(payment_params) \n \n @payment.enterprise_id = current_enterprise.id\n @payment.nombre_empres...
[ "0.7256648", "0.5937413", "0.58850175", "0.5865144", "0.58521664", "0.5812185", "0.57938576", "0.56561565", "0.5629154", "0.55757344", "0.55501074", "0.54809415", "0.5457617", "0.5453679", "0.54233056", "0.539911", "0.53963554", "0.5374325", "0.535959", "0.5348487", "0.533821...
0.0
-1
with an argument, and children maybe
def a(object, arg, *children) b(object.as(:statement) >> space >> arg.as(:argument), *children) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children=(_arg0); end", "def children=(_arg0); end", "def apply_children\n \n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def child...
[ "0.77445525", "0.77445525", "0.7105807", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.7085406", "0.69586897", "0.66827446", "0.655008", "0.6490435", "0.644617", "0.64059067", ...
0.0
-1
Define our authenticate token
def authenticate_token authenticate_with_http_token do |token, options| @current_user = User.find_by(token: token) @current_user end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authentication_token\n generate_token(:authentication_token)\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n token == 'ABC'\n end\n end", "def token_auth(*args, &block); end", "def token\n authenticated\n end", "def toke...
[ "0.80306274", "0.7988433", "0.79778945", "0.78356504", "0.7763641", "0.7677836", "0.76623094", "0.7605179", "0.7595217", "0.75554085", "0.7550475", "0.7494795", "0.7475905", "0.74648124", "0.7432958", "0.7426934", "0.7401358", "0.7401358", "0.73334134", "0.7332143", "0.732110...
0.7236569
31
define what happens If user is unauthorized
def render_unauthorized logger.debug " *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***" self.headers['WWW-Authenticate'] = 'Token realm="Application"' render json: {error: "Bad credentials"}, status: 401 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unauthorized\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def unauthorized\n head :unauthorized\n end", "def unauthenticated\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status:...
[ "0.8591791", "0.8004358", "0.7894204", "0.78164095", "0.77745914", "0.77745914", "0.77708644", "0.7736684", "0.7720517", "0.7718378", "0.77095544", "0.76775473", "0.7623666", "0.75876665", "0.75839794", "0.7555163", "0.7525265", "0.75153214", "0.75013334", "0.75005937", "0.74...
0.0
-1
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.student_notify.notification.subject
def notification(user,fname,grade, comment,labname) @grade = grade @fname = fname @comment = comment @lab_name = labname mail(to: user, subject: 'Lab Grade') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_deta...
[ "0.7157698", "0.7098418", "0.70005596", "0.6957115", "0.67419237", "0.66515714", "0.66185635", "0.6615139", "0.6565871", "0.6501085", "0.6434303", "0.6397224", "0.6366727", "0.6330911", "0.63286847", "0.6312967", "0.63118714", "0.63083154", "0.6276631", "0.62706125", "0.62703...
0.5610621
86
returns lowest sum of the winning and losing teams' scores
def lowest_total_score total_game_scores = games.map { |game| game.home_goals + game.away_goals} total_game_scores.min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winning_scores\n high_score = scores.max{|score| score.total}.total\n scores.select {|score| score.total == high_score}\n end", "def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n ...
[ "0.7851294", "0.74098927", "0.73059714", "0.721409", "0.7213303", "0.7185231", "0.71397245", "0.7136335", "0.71146756", "0.70175725", "0.7000605", "0.6939029", "0.6937342", "0.6914247", "0.69123906", "0.6910729", "0.6878701", "0.6810575", "0.67979", "0.6797448", "0.6790686", ...
0.79345125
0
returns highest score difference
def biggest_blowout score_difference = games.map { |game| (game.home_goals - game.away_goals).abs} score_difference.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highest_score\n sort\n all.first.score\n end", "def highest_score\n sorted_all_scores = self.leaderboard_entries.order(score: :DESC)\n sorted_all_scores[0]\n end", "def best_score\n submissions.min(:score)\n end", "def get_maximum_score()\n max_score = 0\n\n self.scores.each { |sc...
[ "0.7862773", "0.78582394", "0.7702384", "0.757764", "0.7564873", "0.7546964", "0.7512956", "0.74753463", "0.74460906", "0.74084884", "0.73247623", "0.7280755", "0.72600883", "0.7238816", "0.72349036", "0.71750605", "0.7164938", "0.71564656", "0.7105108", "0.7085629", "0.70678...
0.7093493
19
returns venue with most games played
def most_popular_venue venues = @games.group_by { |game| game.venue} venues.max_by { |venue, games| games.count }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def least_popular_venue\n venues = @games.group_by { |game| game.venue}\n venues.min_by { |venue, games| games.count }.first\n end", "def season_with_most_games\n seasons = @games.group_by { |game| game.season }\n seasons.max_by { |season, games| games.count }.first\n end", "def most_hits(seasona...
[ "0.765993", "0.7615187", "0.70569223", "0.69957685", "0.6989212", "0.6966518", "0.68768334", "0.6811023", "0.676626", "0.67556614", "0.67386675", "0.67024064", "0.66293275", "0.6609352", "0.66087717", "0.66087717", "0.6598287", "0.6582044", "0.6576285", "0.65722543", "0.65484...
0.8410583
0
returns venue with least games played
def least_popular_venue venues = @games.group_by { |game| game.venue} venues.min_by { |venue, games| games.count }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season_with_fewest_games\n seasons = @games.group_by { |game| game.season }\n seasons.min_by { |season, games| games.count }.first\n end", "def most_popular_venue\n venues = @games.group_by { |game| game.venue}\n venues.max_by { |venue, games| games.count }.first\n end", "def lowest_total_sco...
[ "0.76161486", "0.7056655", "0.69582653", "0.6757273", "0.6731888", "0.6489541", "0.6412171", "0.63426536", "0.63326377", "0.6292713", "0.6252597", "0.62505406", "0.62498", "0.6233365", "0.62034404", "0.61901", "0.61881024", "0.6171604", "0.6169676", "0.61607593", "0.61607593"...
0.8513803
0
returns percentage of games a home team has won
def percentage_home_wins home_wins = @teams.map { |team| team.home_wins }.sum home_games = @teams.map { |team| team.home_games }.sum (home_wins.to_f / home_games.to_f).round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_win_percentage\n (games_won/user_games)\n end", "def percentage_visitor_wins\n visitor_wins = @teams.map { |team| team.away_wins }.sum\n visitor_games = @teams.map { |team| team.away_games }.sum\n (visitor_wins.to_f / visitor_games.to_f).round(2)\n end", "def percent_wins(wins)\n (...
[ "0.8364513", "0.82717276", "0.801916", "0.79849905", "0.7951478", "0.7703494", "0.7587434", "0.75775856", "0.73771405", "0.73579997", "0.7319697", "0.7281446", "0.72513896", "0.7229507", "0.72288597", "0.71901476", "0.71892023", "0.7121625", "0.7121457", "0.70859313", "0.7085...
0.91415334
0
returns percentage of games an away team has won
def percentage_visitor_wins visitor_wins = @teams.map { |team| team.away_wins }.sum visitor_games = @teams.map { |team| team.away_games }.sum (visitor_wins.to_f / visitor_games.to_f).round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage_home_wins\n home_wins = @teams.map { |team| team.home_wins }.sum\n home_games = @teams.map { |team| team.home_games }.sum\n (home_wins.to_f / home_games.to_f).round(2)\n end", "def player_win_percentage\n (games_won/user_games)\n end", "def coach_win_percent_in_season(coach, game_i...
[ "0.84977627", "0.8304312", "0.79963154", "0.78871727", "0.78340447", "0.7650898", "0.7477629", "0.744048", "0.7373127", "0.7345225", "0.7310578", "0.730852", "0.7298018", "0.72615695", "0.7252617", "0.7251755", "0.7215588", "0.7140742", "0.7140742", "0.71305853", "0.7126685",...
0.84204584
1
returns season with most games played
def season_with_most_games seasons = @games.group_by { |game| game.season } seasons.max_by { |season, games| games.count }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season_with_fewest_games\n seasons = @games.group_by { |game| game.season }\n seasons.min_by { |season, games| games.count }.first\n end", "def most_hits(seasonasstring) # shots in game team stats\n #get a list of all teams that played in that season\n #use above list to sum all shots across all...
[ "0.8302358", "0.74612236", "0.73398393", "0.73084134", "0.72868294", "0.7167453", "0.71511513", "0.69784075", "0.69425094", "0.69318867", "0.67980033", "0.67972773", "0.67909807", "0.66709185", "0.6615492", "0.64948076", "0.64731365", "0.64715165", "0.6459137", "0.64026684", ...
0.90422076
0
returns season with fewest games played
def season_with_fewest_games seasons = @games.group_by { |game| game.season } seasons.min_by { |season, games| games.count }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def season_with_most_games\n seasons = @games.group_by { |game| game.season }\n seasons.max_by { |season, games| games.count }.first\n end", "def fewest_hits(seasonasstring) # shots in game team stats\n #inverse of above\n end", "def count_of_games_by_season\n games_by_season = @games.group_by { ...
[ "0.81187767", "0.7266228", "0.7246461", "0.7089269", "0.7068895", "0.7017991", "0.7016008", "0.6981696", "0.6862327", "0.68551326", "0.68269414", "0.6818776", "0.67922515", "0.6693926", "0.66721785", "0.6660897", "0.6649636", "0.6544526", "0.6537491", "0.6488219", "0.64121807...
0.870494
0
returns a hash with season names as keys and counts of games as values
def count_of_games_by_season games_by_season = @games.group_by { |game| game.season.to_s } games_by_season.each { |season, games| games_by_season[season] = games.count } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_count_of_games_by_season\n\n expected = {\n \"20122013\"=>806,\n \"20162017\"=>1317,\n \"20142015\"=>1319,\n \"20152016\"=>1321,\n \"20132014\"=>1323,\n \"20172018\"=>1355\n }\n assert_equal expected, @stat_tracker.count_of_games_by_season\n\n end", "def matches_p...
[ "0.7383524", "0.7337395", "0.72860044", "0.663687", "0.6600385", "0.6486747", "0.6486122", "0.6407198", "0.63750285", "0.6307263", "0.6301293", "0.6264373", "0.62578285", "0.6215657", "0.61690485", "0.6119021", "0.6094209", "0.60921717", "0.6081048", "0.6075426", "0.6061621",...
0.85778594
0
returns average number of goals scored in a game across all seasons
def average_goals_per_game total_goals = @teams.map {|team| team.total_goals_scored}.sum total_games = @teams.map {|team| team.home_games}.sum (total_goals.to_f / total_games.to_f).round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_goals_by_season\n goals_by_season = @games.group_by { |game| game.season.to_s }\n goals_by_season.each do |season, games|\n season_goals = games.map { |game| game.home_goals + game.away_goals }.sum\n goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2)\n end\n e...
[ "0.8866286", "0.76044863", "0.7357629", "0.7340187", "0.7151395", "0.7151123", "0.709436", "0.7049922", "0.7022711", "0.70215654", "0.701866", "0.7007527", "0.7006993", "0.700472", "0.6991013", "0.6956978", "0.69391805", "0.69037896", "0.6882887", "0.6875325", "0.68327737", ...
0.79668844
1
returns a hash with season names as keys and average goals that season as a value
def average_goals_by_season goals_by_season = @games.group_by { |game| game.season.to_s } goals_by_season.each do |season, games| season_goals = games.map { |game| game.home_goals + game.away_goals }.sum goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_age_for_season(data, season)\n age_total = 0\n num_of_contestants = 0\n data[season].each do |contestant_hash|\n age_total += (contestant_hash[\"age\"]).to_i\n num_of_contestants += 1\n end\n (age_total / num_of_contestants.to_f).round(0)\nend", "def get_average_age_for_season(data, se...
[ "0.755202", "0.74871576", "0.74111605", "0.7379598", "0.73434645", "0.7338489", "0.73198545", "0.72864354", "0.714075", "0.6826755", "0.66681606", "0.6568482", "0.6498531", "0.6463916", "0.6439715", "0.6393833", "0.63890535", "0.635506", "0.63490826", "0.627884", "0.6264705",...
0.8301376
0
returns total number of teams
def count_of_teams @teams.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team_count\n @teams.length\n end", "def team_count\n @teams.length\n end", "def total_num_assignment_teams\n assignment_team_counts.inject(:+)\n end", "def size\n @teams.size\n end", "def wins\n wins = 0\n self.teams.each do |team|\n wins += team.games_won.length\n end\n ...
[ "0.8592525", "0.8592525", "0.8034738", "0.7829387", "0.761724", "0.7573287", "0.7515038", "0.75088435", "0.7387394", "0.7226305", "0.710069", "0.70098764", "0.70098764", "0.6994083", "0.69900537", "0.6964335", "0.69448733", "0.6931533", "0.6913846", "0.6913846", "0.689817", ...
0.86259216
0
returns team with highest average number of goals
def best_offense @teams.max_by { |team| team.average_goals_scored }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n worst_team_goals_avg = 1000\n worst_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value...
[ "0.7896064", "0.77971333", "0.7757615", "0.7737617", "0.77260804", "0.76853526", "0.76414925", "0.7635805", "0.76236326", "0.753786", "0.7494346", "0.74940646", "0.73139346", "0.73136693", "0.73004293", "0.72291195", "0.712955", "0.70123017", "0.6988422", "0.69180375", "0.690...
0.7686035
5
returns team with lowest average number of goals
def worst_offense @teams.min_by { |team| team.average_goals_scored }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end", "def fewest_goals_scored(team_id)\n team_id = team_id.to_i\n goals_per_game = @game_teams.map...
[ "0.7819011", "0.7769936", "0.77371097", "0.7561385", "0.75141984", "0.74485373", "0.73008007", "0.71629214", "0.7153772", "0.7087543", "0.7032626", "0.6950318", "0.6821733", "0.6725882", "0.67237425", "0.66868424", "0.6644543", "0.66217196", "0.6561751", "0.655602", "0.655559...
0.73491526
6
returns team with lowest average goals allowed
def best_defense @teams.min_by { |team| team.average_goals_allowed }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_total_score\n total_game_scores = games.map { |game| game.home_goals + game.away_goals}\n total_game_scores.min\n end", "def fewest_goals_scored(team_id)\n team_id = team_id.to_i\n goals_per_game = @game_teams.map do |game|\n if game.team_id == team_id\n game.goals\n end\...
[ "0.78174543", "0.77868104", "0.7761091", "0.7663627", "0.75829405", "0.7494507", "0.73580366", "0.7258172", "0.7168765", "0.7121664", "0.70700765", "0.6916417", "0.6795183", "0.6791942", "0.6788021", "0.6728191", "0.66309506", "0.6611697", "0.65998656", "0.6596353", "0.658519...
0.7665398
3
returns team with highest average goals allowed
def worst_defense @teams.max_by { |team| team.average_goals_allowed }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n worst_team_goals_avg = 1000\n worst_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value...
[ "0.7942869", "0.7871697", "0.7831481", "0.77460885", "0.7745515", "0.77451336", "0.7736173", "0.7715104", "0.7661803", "0.76352316", "0.7570155", "0.75428635", "0.73730713", "0.735033", "0.7304062", "0.72660065", "0.71962935", "0.70869416", "0.70550275", "0.70122427", "0.7005...
0.7922498
1
returns team with highest average away goals
def highest_scoring_visitor @teams.max_by { |team| team.average_away_goals }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n worst_team_goals_avg = 1000\n worst_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value...
[ "0.8070359", "0.7879713", "0.7840369", "0.7836435", "0.78173316", "0.78173184", "0.77899235", "0.7775409", "0.76927173", "0.7652448", "0.75883156", "0.7549996", "0.74793136", "0.743047", "0.7401185", "0.73860943", "0.7366877", "0.72851044", "0.7222358", "0.7200977", "0.702663...
0.79167306
1
returns team with highest average home goals
def highest_scoring_home_team @teams.max_by { |team| team.average_home_goals }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end", "def worst_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games...
[ "0.80123246", "0.7909811", "0.77517873", "0.77261543", "0.7618676", "0.7615613", "0.7570791", "0.75446874", "0.7477106", "0.7451328", "0.7443151", "0.74076194", "0.7354226", "0.73370004", "0.72952014", "0.72820723", "0.72547835", "0.7205332", "0.71723086", "0.71403384", "0.71...
0.8277581
0
returns team with lowest average away goals
def lowest_scoring_visitor @teams.min_by { |team| team.average_away_goals }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end", "def lowest_total_score\n total_game_scores = games.map { |game| game.home_goals + game.away_goa...
[ "0.78745216", "0.7797572", "0.7740544", "0.77272207", "0.7659458", "0.7543639", "0.74583966", "0.7351377", "0.73151785", "0.72058874", "0.715637", "0.7123159", "0.712085", "0.6971932", "0.6961435", "0.69253594", "0.6876042", "0.68631893", "0.6857849", "0.68461275", "0.6813776...
0.7782403
2
returns team with lowest average home goals
def lowest_scoring_home_team @teams.min_by { |team| team.average_home_goals }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_total_score\n total_game_scores = games.map { |game| game.home_goals + game.away_goals}\n total_game_scores.min\n end", "def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_...
[ "0.8073401", "0.78645605", "0.7827987", "0.7360488", "0.7327204", "0.7295785", "0.72853065", "0.71943265", "0.71651137", "0.71547544", "0.713908", "0.71190727", "0.7097124", "0.7079516", "0.69551605", "0.69438064", "0.6908398", "0.68860847", "0.6848193", "0.68428135", "0.6806...
0.8341824
0
returns team with highest win percentage
def winningest_team @teams.max_by { |team| team.total_win_percentage }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_offense\n @teams.max_by { |team| team.average_goals_scored }.team_name\n end", "def best_fans\n @teams.max_by { |team| team.home_minus_away_percentage }.team_name\n end", "def winning_team\n self.teams.order('score DESC').first\n end", "def highest_scoring_visitor\n @teams.max_by { |t...
[ "0.7832164", "0.77665305", "0.77201337", "0.76693183", "0.7600592", "0.75982714", "0.7582269", "0.7509363", "0.7494715", "0.7465297", "0.74483234", "0.74413943", "0.74051833", "0.73354596", "0.73294055", "0.7321826", "0.7306663", "0.73024404", "0.729635", "0.7288597", "0.7288...
0.85681796
0
returns team with biggest difference between home and away win percentages
def best_fans @teams.max_by { |team| team.home_minus_away_percentage }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winningest_team\n @teams.max_by { |team| team.total_win_percentage }.team_name\n end", "def winning_team\n home_points = collection_by_prop(game_hash[:home], :points).reduce(0, :+)\n away_points = collection_by_prop(game_hash[:away], :points).reduce(0, :+)\n home_points > away_points...
[ "0.8112752", "0.78451234", "0.7827476", "0.7651408", "0.75903213", "0.74962246", "0.74860215", "0.74774885", "0.7475335", "0.744287", "0.7434385", "0.7423453", "0.74211466", "0.7407326", "0.7397977", "0.73921394", "0.73618555", "0.7359654", "0.73264456", "0.72402686", "0.7211...
0.76920617
3
returns array with all teams with better away than home records
def worst_fans teams_with_bad_fans = @teams.find_all { |team| team.home_minus_away_percentage.negative? } teams_with_bad_fans.map { |team| team.team_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_teams\n res = Array.new\n\n @games.each do |g|\n #check if home team is in the result array\n if !res.include?(g.home_team)\n res.push(g.home_team)\n end\n\n #check if away team is in the result array\n if !res.include?(g.away_team)\n res.push(g.away_team)\n ...
[ "0.8108445", "0.76042056", "0.74595654", "0.74204546", "0.7261254", "0.71992743", "0.7165851", "0.7146855", "0.7050696", "0.6960195", "0.69472575", "0.6947156", "0.6926212", "0.69255716", "0.69076914", "0.68787795", "0.6869827", "0.6869329", "0.68567395", "0.68326974", "0.677...
0.702236
9
returns team with biggest decrease between preseason and regular season win percentage
def biggest_bust(season) season = season.to_i @teams.min_by{ |team| team.preseason_to_regular_increase[season] }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_season(team_id)\n team_id = team_id.to_i\n team = @teams.select { |each_team| each_team.team_id == team_id }.first\n team.season_win_percentages.min_by { |season, percentage| percentage }.first.to_s\n end", "def best_season(team_id)\n team_id = team_id.to_i\n team = @teams.select { |eac...
[ "0.78238744", "0.77875507", "0.7736871", "0.7703502", "0.7640446", "0.7188193", "0.7187627", "0.7163401", "0.7148411", "0.7130576", "0.70652765", "0.70518076", "0.70220566", "0.70122427", "0.69603455", "0.69397897", "0.68740314", "0.68569106", "0.68417865", "0.6693621", "0.66...
0.7194257
5
returns team with biggest increase between preseason and regular season win percentage
def biggest_surprise(season) season = season.to_i @teams.max_by{ |team| team.preseason_to_regular_increase[season] }.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_season(team_id)\n team_id = team_id.to_i\n team = @teams.select { |each_team| each_team.team_id == team_id }.first\n team.season_win_percentages.max_by { |season, percentage| percentage }.first.to_s\n end", "def worst_season(team_id)\n team_id = team_id.to_i\n team = @teams.select { |eac...
[ "0.7733624", "0.7723793", "0.77036023", "0.7624202", "0.7428437", "0.7232556", "0.71246934", "0.7100648", "0.7068172", "0.706483", "0.70164055", "0.70026904", "0.69976693", "0.6909588", "0.69074035", "0.68988293", "0.68712324", "0.68307143", "0.68154", "0.6814275", "0.6806212...
0.746648
4
A hash with two keys (:preseason, and :regular_season) each pointing to a hash with the keys :win_percentage, :goals_scored, and :goals_against
def season_summary(season, team_id) season = season.to_i team_id = team_id.to_i season_summary_hash(season, team_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n...
[ "0.6799233", "0.6579108", "0.65554285", "0.64792335", "0.6328934", "0.63089025", "0.6281106", "0.627701", "0.6263929", "0.6234951", "0.62244684", "0.6215755", "0.6213788", "0.62107366", "0.62015295", "0.6201038", "0.61962277", "0.61788225", "0.6172803", "0.6172652", "0.616674...
0.0
-1
returns a hash with key/value pairs for each of the attributes of a team
def team_info(team_id) team_info_hash(team_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team_names\n array = [] \n game_hash.each do |team, attributes|\n attributes.each do |key, value|\n if key == :team_name\n array.push(value)\n \n end\n end\n end\n array\nend", "def team_names\n hash = game_hash\n array = []\n hash.each do |location, attributes|\n attr...
[ "0.7650856", "0.7482051", "0.7402176", "0.7116695", "0.6868259", "0.6865669", "0.68168306", "0.6794725", "0.6773995", "0.67668587", "0.67591715", "0.66435635", "0.6642832", "0.66403997", "0.6618498", "0.6599596", "0.6591629", "0.659084", "0.65677464", "0.65677464", "0.6520581...
0.6650423
11
returns the season with the highest win percentage for a team
def best_season(team_id) team_id = team_id.to_i team = @teams.select { |each_team| each_team.team_id == team_id }.first team.season_win_percentages.max_by { |season, percentage| percentage }.first.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_season(team_id)\n team_id = team_id.to_i\n team = @teams.select { |each_team| each_team.team_id == team_id }.first\n team.season_win_percentages.min_by { |season, percentage| percentage }.first.to_s\n end", "def best_season(id)\n wins = total_wins_per_team_per_season(id)\n totals = ...
[ "0.85101134", "0.81221753", "0.8106581", "0.79300624", "0.78303117", "0.7537648", "0.7438727", "0.74318486", "0.7318221", "0.7310928", "0.72841966", "0.7256713", "0.7243815", "0.71725464", "0.71719307", "0.71607524", "0.7129009", "0.70744485", "0.703709", "0.69910413", "0.695...
0.8627173
0
returns the season with the lowest win percentage for a team
def worst_season(team_id) team_id = team_id.to_i team = @teams.select { |each_team| each_team.team_id == team_id }.first team.season_win_percentages.min_by { |season, percentage| percentage }.first.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_season(team_id)\n team_id = team_id.to_i\n team = @teams.select { |each_team| each_team.team_id == team_id }.first\n team.season_win_percentages.max_by { |season, percentage| percentage }.first.to_s\n end", "def best_season(id)\n wins = total_wins_per_team_per_season(id)\n totals = t...
[ "0.8135413", "0.7703922", "0.7569027", "0.7443136", "0.7322702", "0.72461", "0.699618", "0.69553375", "0.69253457", "0.6865913", "0.67372066", "0.6735379", "0.67120963", "0.66092753", "0.65934414", "0.65934414", "0.65020823", "0.6454325", "0.6442626", "0.6419464", "0.636962",...
0.8291316
0
returns average win percentage of all games for a team
def average_win_percentage(team_id) team_id = team_id.to_i team = @teams.select { |each_team| each_team.team_id == team_id }.first team.total_win_percentage.round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_goals_per_game\n total_goals = @teams.map {|team| team.total_goals_scored}.sum\n total_games = @teams.map {|team| team.home_games}.sum\n (total_goals.to_f / total_games.to_f).round(2)\n end", "def percentage_home_wins\n home_wins = @teams.map { |team| team.home_wins }.sum\n home_games...
[ "0.82220864", "0.81050754", "0.7811368", "0.7612407", "0.7587351", "0.75753987", "0.7478595", "0.73588836", "0.7306268", "0.7217924", "0.7104949", "0.7067641", "0.703548", "0.7023692", "0.6947532", "0.69440997", "0.69225234", "0.68818915", "0.68685067", "0.68294066", "0.68122...
0.8292118
0
returns the highest number of goals a particular team has scored in a game
def most_goals_scored(team_id) team_id = team_id.to_i goals_per_game = @game_teams.map do |game| if game.team_id == team_id game.goals end end goals_per_game.compact.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highest_total_score\n total_goals.max\n end", "def fewest_goals_scored(team_id)\n team_id = team_id.to_i\n goals_per_game = @game_teams.map do |game|\n if game.team_id == team_id\n game.goals\n end\n end\n goals_per_game.compact.min\n end", "def biggest_blowout\n score_...
[ "0.7753501", "0.76269555", "0.73716176", "0.72548187", "0.72235227", "0.7204195", "0.71957093", "0.7175517", "0.7128617", "0.708833", "0.7086374", "0.7078452", "0.7075454", "0.70709544", "0.7035616", "0.7020289", "0.701274", "0.69712836", "0.6949245", "0.6948047", "0.693717",...
0.84425735
0
returns the lowest number of goals a particular team has scored in a game
def fewest_goals_scored(team_id) team_id = team_id.to_i goals_per_game = @game_teams.map do |game| if game.team_id == team_id game.goals end end goals_per_game.compact.min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_total_score\n total_game_scores = games.map { |game| game.home_goals + game.away_goals}\n total_game_scores.min\n end", "def most_goals_scored(team_id)\n team_id = team_id.to_i\n goals_per_game = @game_teams.map do |game|\n if game.team_id == team_id\n game.goals\n end\n ...
[ "0.7822871", "0.72564715", "0.71507573", "0.711415", "0.70092106", "0.69469666", "0.6866441", "0.6851049", "0.68009114", "0.67771", "0.6758502", "0.6734367", "0.67328876", "0.668021", "0.6645249", "0.66174126", "0.66110116", "0.66101235", "0.65892303", "0.65609336", "0.654853...
0.8330991
0
returns the name of the opponent that has the lowest win percentage against the given team
def favorite_opponent(team_id) team_id = team_id.to_i team = @teams.select { |each_team| each_team.team_id == team_id }.first favorite_opponent_id = team.matchup_win_percentage.max_by{|each_team, percentage| percentage}.first @teams.select { |each_team| each_team.team_id == favorite_opponent_id }.first....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_scoring_visitor\n @teams.min_by { |team| team.average_away_goals }.team_name\n end", "def lowest_scoring_home_team\n @teams.min_by { |team| team.average_home_goals }.team_name\n end", "def winningest_team\n @teams.max_by { |team| team.total_win_percentage }.team_name\n end", "def worst...
[ "0.80596846", "0.7952112", "0.78971463", "0.76187414", "0.75939834", "0.72935563", "0.7212153", "0.7100145", "0.7084808", "0.7050331", "0.702519", "0.6839693", "0.6749604", "0.67208624", "0.66996473", "0.66627526", "0.66451025", "0.65876585", "0.65501934", "0.6528336", "0.651...
0.69553727
11
returns the name of the opponent that has the highest win percentage against the given team
def rival(team_id) team_id = team_id.to_i team = @teams.select { |each_team| each_team.team_id == team_id }.first rival_id = team.matchup_win_percentage.min_by{|each_team, percentage| percentage}.first @teams.select { |each_team| each_team.team_id == rival_id }.first.team_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winningest_team\n @teams.max_by { |team| team.total_win_percentage }.team_name\n end", "def best_offense\n @teams.max_by { |team| team.average_goals_scored }.team_name\n end", "def highest_scoring_visitor\n @teams.max_by { |team| team.average_away_goals }.team_name\n end", "def highest_scorin...
[ "0.8780233", "0.8214541", "0.80745155", "0.7930188", "0.7915673", "0.78216046", "0.777723", "0.7762187", "0.74965173", "0.73907983", "0.72995514", "0.7244865", "0.7242243", "0.7241609", "0.7222115", "0.72114503", "0.71903205", "0.7189977", "0.71860856", "0.70977014", "0.70287...
0.6372604
74
returns the biggest difference between team goals and opponent goals for a win for the given team
def biggest_team_blowout(team_id) @games.map do |game| if game.away_team_id.to_s == team_id game.away_goals - game.home_goals elsif game.home_team_id.to_s == team_id game.home_goals - game.away_goals end end.compact.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worst_loss(team_id)\n @games.map do |game|\n if game.away_team_id.to_s == team_id\n game.home_goals - game.away_goals\n elsif game.home_team_id.to_s == team_id\n game.away_goals - game.home_goals\n end\n end.compact.max\n end", "def winningest_team\n @teams.max_by { |te...
[ "0.77380055", "0.7728651", "0.73598915", "0.7259523", "0.7244735", "0.720186", "0.70930254", "0.7074973", "0.70716393", "0.70628035", "0.70560294", "0.7047119", "0.70119333", "0.6950264", "0.69316876", "0.69123924", "0.6862988", "0.68436104", "0.6769966", "0.6761037", "0.6758...
0.7481996
2
returns the biggest difference between team goals and opponent goals for a loss for the given team
def worst_loss(team_id) @games.map do |game| if game.away_team_id.to_s == team_id game.home_goals - game.away_goals elsif game.home_team_id.to_s == team_id game.away_goals - game.home_goals end end.compact.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winningest_team\n @teams.max_by { |team| team.total_win_percentage }.team_name\n end", "def biggest_team_blowout(team_id)\n @games.map do |game|\n if game.away_team_id.to_s == team_id\n game.away_goals - game.home_goals\n elsif game.home_team_id.to_s == team_id\n game.home_goal...
[ "0.7359655", "0.71997166", "0.7125405", "0.7116956", "0.7082419", "0.69981635", "0.6952013", "0.6930093", "0.6922774", "0.6859059", "0.67804253", "0.6644592", "0.6631284", "0.6584522", "0.65740126", "0.6527247", "0.65219086", "0.65129304", "0.65063685", "0.64938587", "0.63986...
0.8180372
0
For each season a team has played, returns a hash that has two keys (:preseason, and :regular_season), that each point to a hash with the following keys: :win_percentage, :total_goals_scored, :total_goals_against, :average_goals_scored, :average_goals_against
def seasonal_summary(team_id) team_id = team_id.to_i seasonal_summary_hash(team_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_goals_by_season\n goals_by_season = @games.group_by { |game| game.season.to_s }\n goals_by_season.each do |season, games|\n season_goals = games.map { |game| game.home_goals + game.away_goals }.sum\n goals_by_season[season] = (season_goals.to_f / games.count.to_f).round(2)\n end\n e...
[ "0.7121842", "0.70724684", "0.6951655", "0.68207276", "0.6794257", "0.6682035", "0.664376", "0.66129464", "0.6571687", "0.6488379", "0.64104545", "0.63874316", "0.63773996", "0.63418156", "0.6329258", "0.6302109", "0.6300947", "0.6289", "0.6213245", "0.6196532", "0.61747855",...
0.57748497
55
returns record (as a hash win/loss) against each opponent
def head_to_head(team_id) team_id = team_id.to_i head_to_head_hash = {} team = @teams.select { |each_team| each_team.team_id == team_id }.first head_to_head_id_hash = team.matchup_win_percentage head_to_head_id_hash.each do |each_team_id, win_percentage| @teams.each do |each_team| if e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player,result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n player...
[ "0.6623447", "0.6613258", "0.6560347", "0.6535278", "0.65263253", "0.6525705", "0.6408602", "0.64023167", "0.6400197", "0.6385025", "0.6358206", "0.63417935", "0.6323447", "0.63146174", "0.6302956", "0.6301062", "0.63010114", "0.6291477", "0.6261969", "0.6261372", "0.6259742"...
0.0
-1
GET /fault_books GET /fault_books.json
def index @fault_books = FaultBook.where(:truck_fleet_id => current_user.truck_fleet.id) @fault_books = FaultBook.belongs_to_truck_fleet(current_user.truck_fleet, @fault_books) if current_user.admin? respond_to do |format| format.html # index.html.erb format.json { render json: @fault_books } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end", "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volu...
[ "0.63696027", "0.6341354", "0.6305479", "0.62837493", "0.6243981", "0.6160719", "0.61571926", "0.6149036", "0.611919", "0.6108336", "0.608437", "0.606763", "0.605276", "0.6035397", "0.60019034", "0.59929997", "0.59777415", "0.5968184", "0.59578407", "0.5952363", "0.5929105", ...
0.72194237
0
GET /fault_books/1 GET /fault_books/1.json
def show if (params[:print]) @fault_book = FaultBook.find(params[:id]) respond_to do |format| format.html { render :layout => 'print' }# show.html.erb format.json { render json: @fault_book, :layout => 'print' } end else @fault_book = FaultBook.find(params[:id]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fault_books = FaultBook.where(:truck_fleet_id => current_user.truck_fleet.id)\n @fault_books = FaultBook.belongs_to_truck_fleet(current_user.truck_fleet, @fault_books) if current_user.admin?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faul...
[ "0.70453316", "0.6452588", "0.64246726", "0.63075763", "0.6263612", "0.6224477", "0.6182557", "0.6142781", "0.61366713", "0.611634", "0.6098845", "0.60978496", "0.60863024", "0.6083412", "0.6044977", "0.6015791", "0.59944427", "0.59824455", "0.5969227", "0.5955293", "0.594650...
0.5961374
19
GET /fault_books/new GET /fault_books/new.json
def new @fault_book = FaultBook.new @fault_book.fault_date = Date.today.strftime("%d-%m-%Y") @drivers = current_user.truck_fleet.drivers @fleets = current_user.truck_fleet.fleets respond_to do |format| format.html # new.html.erb format.json { render json: @fault_book } end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end", "def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json ...
[ "0.7430907", "0.7305153", "0.7304712", "0.7304712", "0.7222088", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.7215761", "0.72094405", "0.71909344", "0.7131054", "0.7104822", "0.7073409", ...
0.7049447
22
POST /fault_books POST /fault_books.json
def create @fault_book = FaultBook.new(params[:fault_book]) @fault_book.truck_fleet_id = @fault_book.fleet.truck_fleet_id respond_to do |format| if @fault_book.save s = Serviceable.find_by_fleet_id(params['fault_book']['fleet_id']) s.next_service_date = @fault_book.fault_date ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fault_books = FaultBook.where(:truck_fleet_id => current_user.truck_fleet.id)\n @fault_books = FaultBook.belongs_to_truck_fleet(current_user.truck_fleet, @fault_books) if current_user.admin?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faul...
[ "0.59933865", "0.59741753", "0.5942001", "0.58830196", "0.58563834", "0.5853052", "0.57975334", "0.5781987", "0.5751532", "0.5688442", "0.5680656", "0.5669777", "0.56482714", "0.56337124", "0.55965096", "0.55886114", "0.55798995", "0.55778706", "0.55567425", "0.5550062", "0.5...
0.62262523
0