query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "79793a6d9c3c8d20df8bacef8c9d9f1f",
"score": "0.0",
"text": "def set_mining_operation\n @mining_operation = MiningOperation.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60326946",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6015941",
"text": "de... |
be52e653cae4a37d643459c4f5fabf83 | DELETE /vendors/1 DELETE /vendors/1.json | [
{
"docid": "159d8a0e6f82c0f1f24d812a5898da34",
"score": "0.7292214",
"text": "def destroy\n @vendor.destroy\n render json:Vendor.all\n end",
"title": ""
}
] | [
{
"docid": "c970bf35ec636eb0e766deb6813bcfdc",
"score": "0.7528686",
"text": "def destroy\n @vendor = Vendor.find(params[:id])\n @vendor.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_vendors_url }\n format.json { head :ok }\n end\n end",
"title": ""
},... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "6f9ae1beac2dc9ca45702e8883d0b99e",
"score": "0.0",
"text": "def set_mimi_example\n @mimi_example = MimiExample.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "d... |
7a243ad8127ed24a99f2a8ff014c4c4c | Verifies a given password is equivalent to a user's password | [
{
"docid": "650706a38deb47c50daf87d8a570b421",
"score": "0.7626635",
"text": "def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"title": ""
}
] | [
{
"docid": "0b2a1f5cdf80387642e7782bb85dcfb0",
"score": "0.82363725",
"text": "def valid_password?(password); end",
"title": ""
},
{
"docid": "4b7d10cee42b79e9203e8c36a6779ad8",
"score": "0.79427886",
"text": "def verify_password(password)\n hash_password(password) == @password_... |
03653b68b6c2bee82f2735a232ce1096 | GET /who_prefixes/1 GET /who_prefixes/1.xml | [
{
"docid": "eb54afff7cf22a905f3ea1114a2b16f7",
"score": "0.63743585",
"text": "def show\n @who_prefix = WhoPrefix.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @who_prefix }\n end\n end",
"title": ""
}
] | [
{
"docid": "85a87ab8c8e5aa907642712cf9f982ac",
"score": "0.630334",
"text": "def ns_prefixes\n {\n 'jerm' => JERMVocab.to_uri.to_s,\n 'dcterms' => RDF::Vocab::DC.to_uri.to_s,\n 'owl' => RDF::Vocab::OWL.to_uri.to_s,\n 'foaf' => RDF::Vocab::FOAF.to_uri.to_s,\n ... |
c0002ac76689d23b3cc8f64c95981811 | Initialize the host node | [
{
"docid": "316808442df3b8734526ddc929db2e2c",
"score": "0.0",
"text": "def initialize(id, ip_address, role, state, uptime, load, mem, storage)\n @buffer = ''\n @id = id\n @ip_address = ip_address\n @role = role\n @state = state\n @uptime = uptime\n @load = load\n @mem = mem\n ... | [
{
"docid": "81d424ba1b1c13115da1fef7e457e22e",
"score": "0.71959066",
"text": "def initialize(host)\n @host = host\n end",
"title": ""
},
{
"docid": "016f0d075b1dac5566280a8d660430ab",
"score": "0.7190117",
"text": "def initialize(host='localhost')\n\t\t@host = host\n\tend",
... |
071963f4e80e364962dc839f0ea3c4d2 | Extract message from exception. Set a default if the message raises an error | [
{
"docid": "d21bacadf146de47354791200b627ca7",
"score": "0.64187837",
"text": "def exception_message(exception)\n # App code can stuff all sorts of crazy binary data into the error message\n # that won't convert to JSON.\n exception.message.to_s[0, 10_000]\n rescue\n +\"!!! ERROR ... | [
{
"docid": "1800a0200f72e0bf544918909a1eb7b2",
"score": "0.7226425",
"text": "def exception_message\n @e_m ||= @exception.present? ? @exception.message : ''\n end",
"title": ""
},
{
"docid": "1800a0200f72e0bf544918909a1eb7b2",
"score": "0.7226425",
"text": "def exception_mess... |
cd011356d702e8a00d8686eac408e972 | direction_valid? x xcoordinate y ycoordinate Checks if coordinates are valid. (pixel movement) | [
{
"docid": "9100eeab04122a10468c9f64aa0b14c7",
"score": "0.84087473",
"text": "def direction_valid?(x, y)\n # get pixel movement rate\n pix = BlizzABS.pixel\n # checks if coordinates are valid\n return (x >= 0 && x < width * pix && y >= 0 && y < height * pix)\n end",
"title": ""
}
] | [
{
"docid": "247a9caea652d1cbdec71e1781dd5c97",
"score": "0.7733036",
"text": "def is_valid_move (xpos, ypos, direction)\n\n if direction == 'north'\n\n new_y = ypos + @compass['north'][1]\n if new_y <= @max_y\n true\n else\n false\n end\n\n elsif direction == 'eas... |
9ee088fe0f9eb538b87f6f2be4f53cad | We want to salt and hash to prevent rainbow dictionary exploits | [
{
"docid": "14ab1b98251d6b6066afa14a7ca42b25",
"score": "0.0",
"text": "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end",
"title": ""
}
] | [
{
"docid": "af82c1b143185dcc9b7e00b24d33b070",
"score": "0.8131458",
"text": "def salt; end",
"title": ""
},
{
"docid": "e52d11a823d41a2125ba2badc221ab91",
"score": "0.7728066",
"text": "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end",
"title"... |
1368c62d754213876a3ef87ba2c11723 | game_id and num are used by AIPlayer displays board, then takes input (integer) until it is recognized as a valid move on the board input: board: Board, game_id: (not used), num: (not used) output: int (validated by board) | [
{
"docid": "acd8db2eee9dd6116d30c7d8f3c0f252",
"score": "0.70938224",
"text": "def take_a_turn(board, game_id, num)\n\t\t# Gem.win_platform? ? (system \"cls\") : (system \"clear\")\n\t\tputs \"Your turn #{@name}\\n\"\n\t\tdisplay(board)\n\t\tinput = get_input.to_i\n\t\tloop do\n\t\t\tbreak if board.lega... | [
{
"docid": "5d2164d9f0ca62575a407fda445ca7bc",
"score": "0.7248482",
"text": "def move (board, user_input, token)\n if (valid_move?(board, user_input))\n board[user_input] = token\n else\n until (valid_move?(board, user_input))\n puts \"Invalid Board Position try again with an integer betwe... |
78b776c6c0707551f5b11a568553e846 | GET /student_post_pages/new GET /student_post_pages/new.json | [
{
"docid": "ab338ecda375f413c868b322e10e2dd0",
"score": "0.82568544",
"text": "def new\n @student_post_page = StudentPostPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_post_page }\n end\n end",
"title": ""
}
] | [
{
"docid": "be58a49692ce4ab7bb2ecbfb6dc093ab",
"score": "0.7537931",
"text": "def new\n # @page = Page.new\n @page = current_user.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"title": ""
},
{
"doci... |
42f1aa2d61e366fbc69ea4593607f16e | Called when resource definitions are done loading | [
{
"docid": "e791bf6cf4dd3ca6d4c019d7c65736e3",
"score": "0.74567187",
"text": "def definition_load_complete; end",
"title": ""
}
] | [
{
"docid": "6a26ced8cd53199bc9c6322f1a39d426",
"score": "0.70431983",
"text": "def recipe_load_complete; end",
"title": ""
},
{
"docid": "6a26ced8cd53199bc9c6322f1a39d426",
"score": "0.70431983",
"text": "def recipe_load_complete; end",
"title": ""
},
{
"docid": "42166497... |
8f3ec767bc948dcb607b3c5dd4439378 | DELETE /pkgs/1 DELETE /pkgs/1.xml | [
{
"docid": "f019f1d947a9861668041c2e0f37111f",
"score": "0.69836944",
"text": "def destroy\n @pkg = Pkg.find_by_name(params[:id])\n @pkg.destroy\n\n respond_to do |format|\n format.html { redirect_to(pkgs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
}
] | [
{
"docid": "df26116eb86dbadafed7137f9e3c2f9e",
"score": "0.6774697",
"text": "def delete!\r\n return nil unless exists? \r\n xml = xml_at_top\r\n par = xml.instance_variable_get(:@parent) \r\n par['delete'] = 'delete'\r\n xml_on_delete( xml )\r\n rsp = write_xml_config!( xml.doc.... |
d8a5454756c3106e5f7827862517c4b5 | Create a function where we can add milkshakes to tickets | [
{
"docid": "38600df372752587edc1e629a0349174",
"score": "0.7002215",
"text": "def add_milkshake(milkshake)\n\t\t@milkshakes.push(milkshake)\n\tend",
"title": ""
}
] | [
{
"docid": "f7dba572ea6c6b04fa62d0e9b38607c8",
"score": "0.69063634",
"text": "def price_ticket\n\t\t#The count starts with the base price\n\t\tprice_ticket = @price\n\t\t#Add each milkshake's price\n\t\t@milkshakes.each do |milkshake|\n\t\t\tprice_ticket += milkshake.price_milkshake\n\t\tend\n\t\t#Make... |
258b016c8f0c04f0cc0cb0b56bc99b45 | PUT /admin/rights/1 PUT /admin/rights/1.json | [
{
"docid": "eaa0706a17020936198eeb62785a4b6c",
"score": "0.6751367",
"text": "def update\n @right = Right.find(params[:id])\n\n respond_to do |format|\n if @right.update_attributes(params[:right])\n format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully upd... | [
{
"docid": "6c08fd7f2959f6cb8456b5d463ee3789",
"score": "0.67360616",
"text": "def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"title": ""
},
{
"docid": "49afb76d5a7fd5f1f84438da02c3898c",
"score": "0.66180056",
"text":... |
ffca0bbe707001dc299f0ee96cdb0511 | The line must be broken. Typically, this is done by moving the last word on the current line to the next line. However, it may be possible that certain combinations of words may not be broken (see nobreak_regex for more information). Therefore, it may be necessary to move multiple words from the current line to the nex... | [
{
"docid": "0baa2172178cdaa1cf33554a335d6df6",
"score": "0.7567443",
"text": "def __wrap_line(line, next_word)\n no_break = false\n\n word_index = line.size - 1\n\n @nobreak_regex.each_pair do |first, second|\n if line[word_index] =~ first and next_word =~ second\n no_bre... | [
{
"docid": "c864648fb7442f680ac66970ac9d0778",
"score": "0.57495487",
"text": "def missing_word(original_line, replaced_line)\n word = original_line.dup\n replaced_line.split('%WORD%').reject(&:blank?).each do |part|\n word.sub!(part, '')\n end\n return nil if word[WORD_SEPARATORS_REGEX... |
26932a36eb1ed9961c1589904c8b91af | DELETE /instruments/1 DELETE /instruments/1.json | [
{
"docid": "f88c258807cc180c180a3313221b2221",
"score": "0.7110271",
"text": "def destroy\n @instrument.destroy\n respond_to do |format|\n format.html { redirect_to instruments_url, notice: 'Instrument was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
... | [
{
"docid": "41377e0cfc34702733b402d9c44c730a",
"score": "0.74568176",
"text": "def destroy\n @instrument = Instrument.find(params[:id])\n @instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to instruments_url }\n format.json { head :no_content }\n end\n end",
... |
b5eb6d5ed81ec252aa2c9dddda3699e4 | Fetch both bids and asks in one call, for network efficiency | [
{
"docid": "322dd9d21a9ca7cfa78afb86712d6537",
"score": "0.0",
"text": "def offers\n o = get('/code/data/getDepth.php')\n o['asks'] = o['asks'].sort_by {|x| x[0]}\n o['bids'] = o['bids'].sort_by {|x| x[0]}.reverse\n o\n end",
"title": ""
}
] | [
{
"docid": "bae4e5aaaff4460b707d4fbc9ec19e07",
"score": "0.61021686",
"text": "def bid\n @bid ||= task.bids.find_by(user: current_user)\n end",
"title": ""
},
{
"docid": "e6b4ab31ad967aa65f1bd15ba050b30a",
"score": "0.59707695",
"text": "def process_biddings\n instance = Api... |
f8034e5a35743cbbbc425c984b0c4b4b | DELETE /carrinhos/1 DELETE /carrinhos/1.json | [
{
"docid": "44518a980d02bb91527e4e6a808e3a73",
"score": "0.6870387",
"text": "def destroy\n @carrinho.destroy\n respond_to do |format|\n format.html { redirect_to carrinhos_url, notice: 'Carrinho was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"tit... | [
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.74423367",
"text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end",
"title": ""
},
{
"docid": ... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "4c285a88c1b52a86250a1a7999911e47",
"score": "0.0",
"text": "def set_person\n @person = Person.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "d... |
17db5b102c80b58390176472a395bcaf | shuffle: > Array generates 8 random pokemons using the pokeapi | [
{
"docid": "274782897dcb69c07d75618aba92e670",
"score": "0.7995602",
"text": "def shuffle\n for i in 0..8 do\n num = rand(1..151)\n url_data = \"https://pokeapi.co/api/v2/pokemon/#{num}\"\n poke_data = consume_api(url_data)\n type_data = get_type_data(p... | [
{
"docid": "3a68d6469b9259552b050625813e0a63",
"score": "0.68429404",
"text": "def pokemon_random\n rand(897)\n end",
"title": ""
},
{
"docid": "b8cf3e6b6b7c89a9a141af3a7013f866",
"score": "0.6746847",
"text": "def randomize\n array = []\n (1..1000).each {|num| ar... |
b5e71dd998ead37445919e7b79a9c4ab | exceptions that happen in worker threads simply cause that thread to die and another to be spawned in its place. | [
{
"docid": "627d7f0062772c4e3d7981f293579fde",
"score": "0.0",
"text": "def serve\n @serverTransport.listen()\n\n begin\n while (true)\n @thread_q.push(:token)\n Thread.new do\n begin\n while (true)\n client = @serverTransport.accept()\n ... | [
{
"docid": "81529d81795266be93277f27193c3ad0",
"score": "0.6837942",
"text": "def run_interrupted; end",
"title": ""
},
{
"docid": "bc4d776256b5adb6444b94119fa98ad1",
"score": "0.6800044",
"text": "def spawn_thread\n Thread.new{ run_thread }.tap do |t|\n t.abort_on_except... |
f1db32938e5f3bb512b18ea5c42019d0 | Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/taskrouter/v1/workspace/activity.rb156 | [
{
"docid": "84c2aa104b8a70acbe3f11eca76559b3",
"score": "0.0",
"text": "def to_s; end",
"title": ""
}
] | [
{
"docid": "50ede86bc7688fdc7e80b5fd5eff1bfc",
"score": "0.7232736",
"text": "def human_activity\n puts \"activity: human_activity\"\n # Use the activity_execution_context available to all Activity classes that\n # extend AWS::Flow::Activities to fetch the task token for this activity\n # ta... |
220428e3b2517c0521ebdeef1f0f94a4 | Toggle the light and all adjacent lights | [
{
"docid": "8f2a7138ac4620e44862bf8d392b1368",
"score": "0.0",
"text": "def toggle_all_adjacent(column, row)\n return false if row < 0 || row >= ROWS || column < 0 || column >= COLUMNS\n [ [0, 1],\n [-1, 0], [0, 0], [1, 0],\n [0, -1], ].each do |xo, yo|... | [
{
"docid": "7a078119419cdc7999f2a05d5776fb93",
"score": "0.81453556",
"text": "def toggle_lights\n @lights_on = @lights_on == false\n end",
"title": ""
},
{
"docid": "3ac4dadc80c117a1e1ad35cf45c7afb3",
"score": "0.80970484",
"text": "def toggle_lights\n if @lights == false\n ... |
7d82b230fb64b75c1d51702008e0d6ee | FIXME: add definition comments here TODO: Add comments | [
{
"docid": "4c379e4d3406a371a890163a249d1cf4",
"score": "0.0",
"text": "def current_location\n if session[:user_ll].blank?\n location = nil\n if current_user.present?\n if current_user.lat.present? and current_user.lng.present?\n session[:user_ll] = [current_user.lat,current... | [
{
"docid": "aa80bd6576357b1a196a04c7dd5e1dc7",
"score": "0.7021455",
"text": "def definition; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.68364185",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b086... |
ad5b64e2e20ec05f099f013e41b6b87b | Retrieves the Record data (i.e value) for a given BNF item key. If the record is multiple according to the BNF description, then an array of Record data is returned. Used internally by various grouping accessor methods. | [
{
"docid": "c66ec0a7e3c37e7e73e3bbd99812b3f2",
"score": "0.75123405",
"text": "def get_data(key)\n if bnf_spec[key].multiple?\n get(key).map {|record| record.data_value}\n else\n ((record = get(key)).nil?) ? nil : record.data_value\n end\n end",
"title": ""
}
] | [
{
"docid": "736f0ae440b2be36e5b08b2d8dfebc9c",
"score": "0.7008713",
"text": "def get(key)\n bnf_item = bnf_spec[key]\n if bnf_item.multiple?\n @bnf_records[key] = [] unless @bnf_records.has_key? key\n @bnf_records[key]\n else\n if key.class == Class and @bnf_records[... |
b07f542ed80f63059fd8c641fe7785b8 | GET /ezii_delta_directions/1 GET /ezii_delta_directions/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "8a5873445fd87a675339b9a4f1a21a92",
"score": "0.71828216",
"text": "def index\n @ezii_delta_directions = EziiDeltaDirection.all\n end",
"title": ""
},
{
"docid": "54e9af817eaa540c8365b1c34a1c6ef6",
"score": "0.68805695",
"text": "def index\n @directions = Direction.... |
4a0338cabeafcb8a4f9740741d6a598e | abstraction to allow cached form data to be used in place of default params def params session['params'].nil? ? params : JSON.parse(session['params']) end | [
{
"docid": "a639e10c3591d055451a12f14810e6c1",
"score": "0.0",
"text": "def labels\n params['labels'].join(',') if params['labels']\n end",
"title": ""
}
] | [
{
"docid": "300f1e4f03f0a8826c5ba332f01dcae9",
"score": "0.71603274",
"text": "def params\n read_attribute(:params) || begin \n write_attribute(:params, {} )\n read_attribute(:params)\n end\n end",
"title": ""
},
{
"docid": "22cec6ca2584c903fef9a85c5e466333",
"score": "0... |
d22dd8f63972a0991422fa779653248b | define the arguments that the user will input | [
{
"docid": "206a4b81437c5610c2c925da2c10b9aa",
"score": "0.0",
"text": "def arguments(model)\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for unit living space floor area\n unit_ffa = OpenStudio::Measure::OSArgument::makeDoubleArgument('unit_ffa', true)\n unit_ff... | [
{
"docid": "49665d066ffcf52f2c37b2b1c268e6fd",
"score": "0.73748195",
"text": "def arguments; end",
"title": ""
},
{
"docid": "49665d066ffcf52f2c37b2b1c268e6fd",
"score": "0.73748195",
"text": "def arguments; end",
"title": ""
},
{
"docid": "49665d066ffcf52f2c37b2b1c268e6... |
839253c2e31aa8009881be726b7add0d | string Any string char Any character Examples contains_char("apa", "a") => true Returns true if the string contains char | [
{
"docid": "41cf37c44e7c5573cb5a8603f92924f1",
"score": "0.7427777",
"text": "def contains_char(string, char)\n i = 0\n while i < string.length\n if string[i] == char\n return true\n end\n i += 1\n end\n return false\nend",
"title": ""
}
] | [
{
"docid": "3a2bdf1ee90885171cd40ef7edac4555",
"score": "0.7709768",
"text": "def contains?(char)\r\n any_letter_found = false\r\n each do |letter|\r\n if char.upcase == letter.content\r\n letter.state = :found\r\n any_letter_found = true\r\n end\r\n end\r\n any_lette... |
d1b98b1af8c3f0262a8923caa6381f4f | Create an instance of application config | [
{
"docid": "bb9ec4020cf6e7d266aa92483fe564fe",
"score": "0.0",
"text": "def initialize(root_dir)\n\t\t\tsuper()\n\t\t\treplace DEFAULT_DIRS.merge(\n\t\t\t\troot_dir: File.realpath(root_dir),\n\t\t\t\tenvironment: ENV.fetch('RACK_ENV', 'development')\n\t\t\t)\n\t\tend",
"title": ""
}
] | [
{
"docid": "29c345ce4fe9ebfd6531a2897b3583c4",
"score": "0.7212357",
"text": "def config\n @config ||= new\n end",
"title": ""
},
{
"docid": "ca3946ec94999fb4f33944d0a2beba66",
"score": "0.69735754",
"text": "def create_config\n self.config = {} if !self.config\n end"... |
1ff793d7fce923f1b7070592e2c1954b | get_all_merchants Parameters:: (Page) params:page Return:: All merchants Author:: | [
{
"docid": "85594f76bfd645089ceadc5aa9f5592e",
"score": "0.76007706",
"text": "def get_all_merchants(page)\n while (is_available(page)) do\n get_all_merchants_in_page(page)\n page = get_next_page(page)\n end\nend",
"title": ""
}
] | [
{
"docid": "5e3183c15e161dabf3fd68ab4026d915",
"score": "0.70703053",
"text": "def index\n @merchants = Merchant.includes(:merchant_info, {agent: :agent_info}).page(params[:page])\n end",
"title": ""
},
{
"docid": "7fb729f840344a701e9695ccb4a560ef",
"score": "0.68944526",
"text":... |
359527e1ed180729c399c739cd07e376 | Loading failed. Store a failed object and if requested roll back (destroy) the current load object For use case where object saved early but subsequent required columns fail to process so the load object is invalid | [
{
"docid": "0556e5affd261e46d58bf18935df8b2c",
"score": "0.47407624",
"text": "def failure(failure_data)\n @current_status = :failure\n\n logger.error 'Failure(s) reported :'\n [*failure_data.errors].each { |e| logger.error \"\\t#{e}\" }\n\n add_failed_object(failure_data)\n\n f... | [
{
"docid": "547bb6f24e6aa353eba96efc5d57f947",
"score": "0.65054107",
"text": "def rollback\n objects.clear\n load\n finish_transaction\n end",
"title": ""
},
{
"docid": "670fd0bff1516ce848e23a2a9e53b912",
"score": "0.5968045",
"text": "def retry_if_invalid\n @object... |
3bc66eeee614df6e8305e08fabeb37f9 | GET /proyectos/1 GET /proyectos/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "a33180ad1e17c980214ed6393c7d2653",
"score": "0.69974446",
"text": "def index\n @procesos = Proceso.all\n\n render json: @procesos\n end",
"title": ""
},
{
"docid": "6ba03dc4089de068ac02b8a9fdfe9899",
"score": "0.68437123",
"text": "def show\n @prodotto = Prodott... |
b0a8187e3dc346cc37b062369df19580 | This endpoint is deprecated. | [
{
"docid": "84dd8d9a41cdf24907e5da66385e505a",
"score": "0.0",
"text": "def get_project_device_session_logs_using_get(device_session_id, project_id, run_id, opts = {})\n get_project_device_session_logs_using_get_with_http_info(device_session_id, project_id, run_id, opts)\n nil\n end",
"... | [
{
"docid": "77b0c109415e0f3e761fd3df7d4dff39",
"score": "0.7556771",
"text": "def deprecated; end",
"title": ""
},
{
"docid": "77b0c109415e0f3e761fd3df7d4dff39",
"score": "0.7556771",
"text": "def deprecated; end",
"title": ""
},
{
"docid": "77b0c109415e0f3e761fd3df7d4dff... |
c46357b32dba22e2fec7b51f040e1656 | not a very inspired name... converts an string separated by periods characters to the socalled "Java style" emission.gain becomes emissionGain | [
{
"docid": "00d42ce4921870527600f67fa8241537",
"score": "0.5156121",
"text": "def convertPeriodToUppercase(input)\n\t\t\t\n\t\t\tinput = input.split('.')\n\t\t\toutput = ''\n\t\t\tinput.each_with_index { |value, index|\n\t\t\t\tif input.size > 1\n\t\t\t\t\tif index != 0\n\t\t\t\t\t\toutput = output + in... | [
{
"docid": "a6df21b108f3c29228f88916598941f2",
"score": "0.5398261",
"text": "def to_telegram word5\n word5.gsub! '.', ' STOP'\nend",
"title": ""
},
{
"docid": "23859f47cd99cb5723e3da80998ae306",
"score": "0.53651434",
"text": "def to_price!\n # self.split('.') divides string int... |
7eab331ee0d391965b3efa7915d7b114 | % write: ([to_s: () > String]) > Integer | [
{
"docid": "babb0bb625627c9c1baef6bc05e2de0b",
"score": "0.5986608",
"text": "def write(p0) end",
"title": ""
}
] | [
{
"docid": "d0cd3bbb540a0e432c67b6bedee12b61",
"score": "0.6289829",
"text": "def to_str\n 5\n end",
"title": ""
},
{
"docid": "40cf8b02d68fb61795de5650437754c2",
"score": "0.6274799",
"text": "def write_int(value, stream = @index)\n stream.write([value].pack('L'))\n end"... |
4f854be0f1754106b0f73c453c37e59e | Set the value of the Number input for this Choreo. | [
{
"docid": "e7d889cd8104d1fb33c8e1b1061856db",
"score": "0.7769133",
"text": "def set_Number(value)\n set_input(\"Number\", value)\n end",
"title": ""
}
] | [
{
"docid": "08b39b0c8863f896b351a9c2e9d46445",
"score": "0.8008636",
"text": "def set_Number(value)\n set_input(\"Number\", value)\n end",
"title": ""
},
{
"docid": "08b39b0c8863f896b351a9c2e9d46445",
"score": "0.8008636",
"text": "def set_Number(value)\n set_input... |
c81ae1113607582493886323a76cd321 | Because of all the crazy ways Rails has attempted tags, we need this crazy method. | [
{
"docid": "754a71c6f0c712f96f868418852fefdd",
"score": "0.0",
"text": "def extract_active_support_tagged_logging_tags\n Thread.current[:activesupport_tagged_logging_tags] ||\n Thread.current[tagged_logging_object_key_name] ||\n EMPTY_ARRAY\n end",
"title": ""
... | [
{
"docid": "ca4f77315e19679ba8f407a1bc9cf5be",
"score": "0.728558",
"text": "def complete_tags\n\n end",
"title": ""
},
{
"docid": "15f5bdfa6e41504e37b6c1e165e42554",
"score": "0.7224731",
"text": "def tagged?; end",
"title": ""
},
{
"docid": "9ecb3e21eb0272cf371ebff09e2... |
ccd637f27f502f71a2c8b180aadecce0 | Returns the corresponding block information according to the specified hash or index | [
{
"docid": "12d19843bf261ca6b6242b84215cc97c",
"score": "0.0",
"text": "def get(identifier)\n data = RemoteNode.rpc 'getblock', identifier\n Block.read Utils::DataReader.new(data)\n end",
"title": ""
}
] | [
{
"docid": "36832b930869dee2c5dc5a9a29426132",
"score": "0.8091527",
"text": "def getblockhash(index)\n @api.request 'getblockhash', index\n end",
"title": ""
},
{
"docid": "6126d6b3efaadd4e3d08a0199a54de15",
"score": "0.7859969",
"text": "def [](hash_or_index)\n result = ca... |
470073b8f3a496d8b68300f8ab565b6d | Private: An Array containing files to create. Returns an Array. | [
{
"docid": "4878428dd6e7bcbe9d0e31e8b0c01ede",
"score": "0.0",
"text": "def manifest\n @manifest ||= in_template_directory do\n Dir.glob(\"**/*\", File::FNM_DOTMATCH).reject { |t| File.directory?(t) }\n end\n end",
"title": ""
}
] | [
{
"docid": "f14230249d49fc4bd4b41daa87ccac37",
"score": "0.7615292",
"text": "def create_files\n attach = Array.new\n totalsize = add_new_files(attach)\n return [] if !@error_message.empty?\n check_files_total_size(totalsize)\n destroy_files(attach) and return [] if !@error_message.empty?... |
42d477fa9bd1ef5cb57c28e77efbaddd | Find the rakefile and then load it and any pending imports. source://rake//lib/rake/application.rb102 | [
{
"docid": "969762acb1fdfedb776a0e89701219ad",
"score": "0.8123491",
"text": "def load_rakefile; end",
"title": ""
}
] | [
{
"docid": "2a9a9e2ee0484f68ec9ffbc774bd3898",
"score": "0.785611",
"text": "def load_rakefile\n here = Dir.pwd\n while ! have_rakefile\n Dir.chdir(\"..\")\n if Dir.pwd == here || options.nosearch\n fail \"No Rakefile found (looking for: #{@rakefiles.join(', ')})\"\n ... |
81de13af96573ce00a8c3f90dc01ea2b | Make this piece a copy of another | [
{
"docid": "072e5398ac82d1194503acc571dc4a3e",
"score": "0.0",
"text": "def copy(inpiece)\n assiden(inpiece.identity)\n\n #Flag testing\n inpiece.isbot ? bot : @isbot = false\n inpiece.istop ? top : @istop = false\n inpiece.isleft ? left : @isleft = false\n inpiece.isright... | [
{
"docid": "ba0bf6f1dd579bf850260dfb30637349",
"score": "0.8042355",
"text": "def copy_to(other); end",
"title": ""
},
{
"docid": "07c273f9e3dc0b62c9b18656c8fa9c4d",
"score": "0.7809874",
"text": "def copy; self.clone; end",
"title": ""
},
{
"docid": "07c273f9e3dc0b62c9b1... |
5ff335ac352e01055d8cceed0a8b2a65 | Retrieves the row at the given index | [
{
"docid": "0c2c24a33fdbda26f46f046010b01d04",
"score": "0.8418631",
"text": "def row(index)\n @data[index]\n end",
"title": ""
}
] | [
{
"docid": "0b06efe8d5a0c17b4f029331cb1b61fc",
"score": "0.86705494",
"text": "def row(index)\n @rows[index]\n end",
"title": ""
},
{
"docid": "f4b2033c34d97730dd39cb41d138073a",
"score": "0.863605",
"text": "def get_row_by_idx(idx)\n @row[idx]\n end",
"title"... |
a16c20d53f4fe437e81321e70373e0b0 | Create a MiGA::Dataset object in a +project+ MiGA::Project with a uniquely identifying +name+. +is_ref+ indicates if the dataset is to be treated as reference (true, default) or query (false). Pass any additional +metadata+ as a Hash. | [
{
"docid": "6fffe291c13505392589300232d315b2",
"score": "0.67804474",
"text": "def initialize(project, name, is_ref = true, metadata = {})\n name.miga_name? or\n raise 'Invalid name, please use only alphanumerics and underscores: ' +\n name.to_s\n @project, @name, @metadata = proje... | [
{
"docid": "b811496e54515a4434247ab4dc989c8a",
"score": "0.7050316",
"text": "def initialize(project, name, is_ref=true, metadata={})\n raise \"Invalid name '#{name}', please use only alphanumerics and \" +\n \"underscores.\" unless name.miga_name?\n @project = project\n @name = name\n ... |
44e0ccc51c1533f22692967efbf3b54e | for gift redemption of 1 free month | [
{
"docid": "3cc74ae923adcd1012950517bf9c45d1",
"score": "0.0",
"text": "def extend\n @payment = Merchant.find(merchant_id).payments.new(payment_params)\n @plan1 = Plan.find(1)\n\n if @payment.start_date == nil\n @payment.errors.add(:base, 'Please fill in the start date')\n @upcoming_p... | [
{
"docid": "a1ab6aed68601f673938af5e3e14afff",
"score": "0.64148307",
"text": "def second_premium_collection_month\n return unless initial_draw_date\n initial_draw_date.advance(months: 3).strftime('%m/%Y')\n end",
"title": ""
},
{
"docid": "4b1f1c5588748f568b1753de9d0892fc",
"scor... |
c8033e665822f5710c20f7a33429e937 | Implements the edit method and updates | [
{
"docid": "cf5dff55c46569131fe9f39202efcce6",
"score": "0.0",
"text": "def update()\n\t\t@plantation = Plantation.find(params[:id])\n\n\t\tif @plantation.update_attributes(plantation_params())\n\t\t\tredirect_to :action => 'list'\n\t\telse\n\t\t\trender :action => 'edit'\n\t\tend\n\tend",
"title": ... | [
{
"docid": "394370bce628d740ab5baa628df14724",
"score": "0.86765707",
"text": "def edit\n update\n end",
"title": ""
},
{
"docid": "394370bce628d740ab5baa628df14724",
"score": "0.86765707",
"text": "def edit\n update\n end",
"title": ""
},
{
"docid": "0326... |
7430abc5a6120fee145244bd31a72384 | In addition to the common fields, alias accepts: "alias" | [
{
"docid": "1d167262c6015e51fd598ea7f71349cd",
"score": "0.72282654",
"text": "def parse_for_alias(fields)\n common = parse_common_fields(fields)\n\n distinct_id = common[:distinct_id] # must move to properties...\n\n alias_field = fields[:alias]\n check_presence! alias_field... | [
{
"docid": "8fe3aa9d362609f75f958ab2ea7ac1eb",
"score": "0.7666981",
"text": "def column_alias_for(field); end",
"title": ""
},
{
"docid": "7ee12659c42a254c5e132947e9d6308f",
"score": "0.7525799",
"text": "def alias_name; end",
"title": ""
},
{
"docid": "7ee12659c42a254c5... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "3a4ee8a16971b28f4ce94826d6d48e2c",
"score": "0.0",
"text": "def set_food\n @food = Food.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "d... |
146e3a716e31ce59fe4d288dd11459bf | Disconnect from AMQP broker. | [
{
"docid": "eb9def8d78ad0f402eed1ae8df3eb03f",
"score": "0.0",
"text": "def stop(&callback)\n unless @channel\n yield if block_given?\n return\n end\n\n log \"disconnecting from broker\"\n log \"closing channel #{@channel.id}\"\n\n if @channel.consumers.length > 1\... | [
{
"docid": "8833150c90107e06998754d351a42c6b",
"score": "0.7455245",
"text": "def disconnect\n\t\tqueue = self.queue\n\n\t\tqueue.unsubscribe( :consumer_tag => self.name )\n\t\tqueue.unbind( self.exchange )\n\t\tqueue.delete\n\n\t\tself.exchange.delete\n\tend",
"title": ""
},
{
"docid": "bbb... |
91cd55c1b9edecabf063a216229212bc | Returns the Graylog level for the supplied log message | [
{
"docid": "1d457964ca5b0624156a865104af3e7e",
"score": "0.6286866",
"text": "def map_level(log)\n LEVEL_MAP[log.level]\n end",
"title": ""
}
] | [
{
"docid": "0cc9fad82c49fc77dd777792729b64c2",
"score": "0.65332365",
"text": "def get_level(src)\n\t\tlog_levels[src]\n\tend",
"title": ""
},
{
"docid": "f1c1d6bdae71ad355ab5c2a201767da9",
"score": "0.6449936",
"text": "def log_level\n case @log_level\n when Symbol, String... |
810874719b140b50290a0346cd741412 | Return the string used as key in the Redis database. | [
{
"docid": "83ebd37716f4a7b210bcdbaee5d37c8b",
"score": "0.0",
"text": "def _key\n \"Jormungandr.#{self.class}.#{id}\"\n end",
"title": ""
}
] | [
{
"docid": "8990bb7f05bbd06799660328a3b1ec93",
"score": "0.8497456",
"text": "def redis_key(str)\n \"#{type}:#{id}:#{str}\"\n end",
"title": ""
},
{
"docid": "5391c6fd30ff6699c46a8f052f1c1801",
"score": "0.8391311",
"text": "def redis_key(str)\n \"identity:#{self.id}:#{str... |
0752cf1fd6702ede7f7a3d428a6c6ff7 | Delete a package repository | [
{
"docid": "84629c201ae6acbd0ed87bc8b411a088",
"score": "0.0",
"text": "def unconfigure_ai_pkg_repo(smf_service_name)\n service_name = smf_service_name.split(\":\")[1]\n if $os_name.match(/SunOS/)\n message = \"Checking:\\tIf repository service \"+smf_service_name+\" exists\"\n if smf_service_n... | [
{
"docid": "8aad62dca1f7c7f9ab912a49eb90e9c6",
"score": "0.7843336",
"text": "def delete!\n @repo.delete!\n end",
"title": ""
},
{
"docid": "dbeb1e0626ac333787f0d96b5a17f733",
"score": "0.77638406",
"text": "def delete_repo(r)\n client.delete_repository(r)\n end",... |
02d9f15d67629e5706415d73a0e1ba56 | Tag each line if multiple are passed in. | [
{
"docid": "c9761c0e31e5b1c0b4e53ea444bb6776",
"score": "0.0",
"text": "def add(severity, message = nil, progname = nil, &block)\n message = (block_given? ? block.call : progname) if message.nil?\n if message && message.include?(\"\\n\")\n message.lines{|l| add_original(severity, ... | [
{
"docid": "35d452d40204b27b66079d0c59a60973",
"score": "0.6255267",
"text": "def tag(tag, *lines)\n puts \"no lines given :(\" if lines.empty?\n lines.map {|text| \"<#{tag}>#{text}</#{tag}>\"}\nend",
"title": ""
},
{
"docid": "01d23c0e813f808e59d0d0fce106eb13",
"score": "0.62402326",
... |
90df08de569d2cd23a8005c699ee569e | initialize instance variables with default values, name required | [
{
"docid": "f55d5976ad8a24d8b73596eb8415d9df",
"score": "0.0",
"text": "def initialize(name)\n @planets = []\n @name = name\n @constellation = nil\n @type = nil\n @age = 0\n end",
"title": ""
}
] | [
{
"docid": "8db2960020b49d642089ffe96233fac9",
"score": "0.8038511",
"text": "def initialize\n set_defaults\n end",
"title": ""
},
{
"docid": "8db2960020b49d642089ffe96233fac9",
"score": "0.8038511",
"text": "def initialize\n set_defaults\n end",
"title": ""
},
... |
a765ddada2ad30cf56098d7716c57665 | DELETE /javaques/1 DELETE /javaques/1.json | [
{
"docid": "1a043cf48a421b2f43ab488f11d9f18f",
"score": "0.72620773",
"text": "def destroy\n @javaque.destroy\n respond_to do |format|\n format.html { redirect_to javaques_url, notice: 'Javaque was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title... | [
{
"docid": "a9cdf07abd2f7a88bb3bcc4c652167b8",
"score": "0.68904126",
"text": "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].ea... |
79df9cfdbb69ca053161e54e48f790b0 | Returns a set of only this entry's immediate children | [
{
"docid": "f704e5721dba572a1aecfc2e2e5149e0",
"score": "0.66254944",
"text": "def children\n nested_set_class.find_with_nested_set_scope(:all, :conditions => \"#{nested_set_parent} = #{self.id}\", :order => nested_set_left)\n end",
"title": ""
}
] | [
{
"docid": "6b65745f40752ebef04d57b9545349bd",
"score": "0.7546666",
"text": "def children\n entries\n end",
"title": ""
},
{
"docid": "b532379b993fac601e9588fb128d5265",
"score": "0.741719",
"text": "def all_children(special=nil)\n full_set(special) - [self]\n ... |
f609f8c471e77feaa1da982c2e068804 | Laconically output the discovered issues. This method is used during a pause. | [
{
"docid": "bbb8a4e700444151ddf44744cf6759df",
"score": "0.6229074",
"text": "def print_issues\n super @issues\n end",
"title": ""
}
] | [
{
"docid": "5cbeff90fcc40741e24f7ac03d6f5feb",
"score": "0.7139812",
"text": "def print_issues( issues )\n\n print_line\n print_info( issues.size.to_s + ' issues have been detected.' )\n\n print_line\n issues.each {\n |issue|\n\n print_ok( \"#{issue.name... |
43e8f5a5a2d885919de9606d04391468 | returns the number of TableBodies that exist in the table | [
{
"docid": "d1b8228ba1ce3ffe86176bd1775d8f6c",
"score": "0.73216254",
"text": "def length\n assert_exists\n return @o.tBodies.length\n end",
"title": ""
}
] | [
{
"docid": "5b5607fb15deff552ffcfccff6ffaa9c",
"score": "0.7738362",
"text": "def row_count \n assert_exists\n #return table_body.children.length\n return @o.getElementsByTagName(\"TR\").length\n end",
"title": ""
},
{
"docid": "d84e69dedf3a14affa9e8b3... |
6696b122b20ef0e86fd99e29a1e444e8 | GET /awarenesses/1 GET /awarenesses/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "a1ce3f7cf154c4177b1f38f500310064",
"score": "0.73164165",
"text": "def index\n @awarenesses = Awareness.all\n end",
"title": ""
},
{
"docid": "40bc97f2ccfffcb8a4f0d4be54b0230e",
"score": "0.7058487",
"text": "def index\n @awarenesses_has_informations = AwarenessesH... |
13ca8bea1b3eb393a158c10db1f8a43a | Code related to evaluating the resources. | [
{
"docid": "b799174658e94c064328a6fad9c49191",
"score": "0.0",
"text": "def ancestors\n []\n end",
"title": ""
}
] | [
{
"docid": "f21cac7e9fa2dd09ed7031c7dce7ac3f",
"score": "0.5756564",
"text": "def execute_resources\n logger.info \"Executing plan\" do\n @run_context.execute!\n end\n end",
"title": ""
},
{
"docid": "d70ca6502ef89f21207f9aa16f3f6245",
"score": "0.56806284",
"text... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "e6eae81927236a7876f04cf39ac7d393",
"score": "0.0",
"text": "def set_impact_level\n @impact_level = ImpactLevel.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163163",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045976",
"text": "def action_hook;... |
3db6f509f74ce5bcdfbb34159a2c39a0 | These default service values only are used when a service is created by `ufo` | [
{
"docid": "449afd6d2659cc3eac5119ea05f96c09",
"score": "0.0",
"text": "def default_maximum_percent\n Integer(new_service_setting[\"maximum_percent\"] || 200)\n end",
"title": ""
}
] | [
{
"docid": "2c1dadf64d8cdd96fa4571f2ed6e62fa",
"score": "0.67701805",
"text": "def is_service_default=(value)\n @is_service_default = value\n end",
"title": ""
},
{
"docid": "ac7ea3984f3650f1a3bbb5394c6750ae",
"score": "0.66795856",
"text": "def is_service_d... |
8026706b089b99def41ddfd154106155 | PUT /songs/1 PUT /songs/1.xml | [
{
"docid": "ad8c4221b00dfa962391c268b7c0eac3",
"score": "0.0",
"text": "def update\n @song = Song.find(params[:id])\n\n if @song.update_attributes(params[:song])\n flash[:notice] = 'Song was successfully updated.'\n redirect_to admin_band_path(@song.release.band, :anchor => 'releases')\n... | [
{
"docid": "3b1ab44b948e56706b1ca5578070250c",
"score": "0.67040944",
"text": "def update\n @song.update(song_params)\n respond_with_bip @song\n end",
"title": ""
},
{
"docid": "9f03885c07a60b1971ee09d14d610d7c",
"score": "0.66872936",
"text": "def update\n @song = Song.fin... |
ec79025baac34c666ff4b823fad07931 | Build initialize method to take in parameters with a default fulfillment status. | [
{
"docid": "141859c66625d0dd2baa9c67e5ac15c5",
"score": "0.69266963",
"text": "def initialize(id, products, customer, fulfillment_status = :pending)\n @id = id\n @products = products\n @customer = customer\n\n # Validate that input was among the included possible statuses. Raise error, other... | [
{
"docid": "f6bf9ea2e1ccf3c5bd7dd85ba9e3510b",
"score": "0.6926635",
"text": "def initialize(id, products, customer, fulfillment_status=:pending)\n @id = id\n @products = products\n @customer = customer\n # Setting fulfilmment options\n fulfillment_options = [:pending, :paid, :processing,... |
a7dd1e71e694a7e0fc779bd46213969c | True if this instance has been retrieved from a versioned search | [
{
"docid": "26b51d3e7bb22d26357e3792750b03e6",
"score": "0.6735783",
"text": "def versioned?\r\n @base_version != nil\r\n end",
"title": ""
}
] | [
{
"docid": "5830850af74760bf1ea7af80887a1f85",
"score": "0.7121593",
"text": "def versioned?\n !!self[:versioned]\n end",
"title": ""
},
{
"docid": "5830850af74760bf1ea7af80887a1f85",
"score": "0.7121593",
"text": "def versioned?\n !!self[:versioned]\n end",
... |
efda5aba9272ae6663b7331a74fe9660 | GET /recordpnynts GET /recordpnynts.json | [
{
"docid": "60f4ad9014be2ac8b3e96de18c90e34a",
"score": "0.68878376",
"text": "def index\n @recordpnynts = Recordpnynt.all\n end",
"title": ""
}
] | [
{
"docid": "8b8cc93c8c8cc61c513aefc477528619",
"score": "0.64634603",
"text": "def index\n @recordqnynts = Recordqnynt.all\n end",
"title": ""
},
{
"docid": "99e2570d8e415646fb26d84a3a97b02a",
"score": "0.6410039",
"text": "def index\n @recordpltkts = Recordpltkt.all\n end",
... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "b356ae566870b0fa1ff0a1583fb9a12a",
"score": "0.0",
"text": "def set_platform\n @platform = Platform.find(params[:id])\n\n unless @platform.options.nil? or @platform.options.empty?\n json = JSON.parse @platform.options\n\n @platform.opt_ext = json['ext']\n @platform.opt_s... | [
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60339177",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.60135007",
"text": "d... |
c49ab342fac5f514fa6f311a503d24ed | Use for new tweets. Requires there is a tweet object and allows the user to Update the message and id | [
{
"docid": "0be93d288593003c446aad673196841a",
"score": "0.0",
"text": "def tweet_params\n params.require(:tweet).permit(:message, :user_id)\n end",
"title": ""
}
] | [
{
"docid": "c2d9444721192686367ebb344bc760a2",
"score": "0.7918362",
"text": "def set_new_tweet\n @new_tweet = NewTweet.find(params[:id])\n end",
"title": ""
},
{
"docid": "4c8c5b1db4271ecf7f3d3b1296487827",
"score": "0.7608742",
"text": "def set_tweet\n \t\t@tweet = Twe... |
6f46f8fac6b83706d63dd2877ca1db13 | Generates a random number | [
{
"docid": "2acc874758d3422755014d321ac142e3",
"score": "0.86664605",
"text": "def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"title": ""
}
] | [
{
"docid": "57035f91b51befd74a6e7f849538cadb",
"score": "0.84647816",
"text": "def gen_num\n rand(1..100)\nend",
"title": ""
},
{
"docid": "d3a4fc406e7863721db2541cf48de0da",
"score": "0.82044804",
"text": "def generate_number\r\n \r\n #Generate and return a random number betwee... |
64d4a41b6f9215746a4d8adfeaa6b0d8 | TODO: not used yet could be used for timestamping "not available/old" id list filenames. | [
{
"docid": "d86fc4b839470fe2ce9be74402884d06",
"score": "0.0",
"text": "def getFileDateString\n Time.now.strftime('%Y%m%d-%H%M%S')\n end",
"title": ""
}
] | [
{
"docid": "fbf2e72cce9f9899127796c4f3410fd0",
"score": "0.658253",
"text": "def new_list_id\n pattern = File.join(vocab_path, '*')\n list_filenames = Dir[pattern].map { |filepath| File.basename(filepath) }\n\n ids = list_filenames.map { |filename| filename.scan(/\\d/).join.to_i }\n ids.sort!\n ids... |
1a3f18212bb8ffd58cfbe28fd20c9dae | List the splash login attempts for a network | [
{
"docid": "c6937db169b73df57185622ac14f0d62",
"score": "0.796185",
"text": "def get_network_splash_login_attempts(options = {})\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'id' => options['id']\r\n )\r\n # Prepare query url.\r\n _path_url = '/network... | [
{
"docid": "35f6a6317c486576a83baf20a59e0b76",
"score": "0.5829865",
"text": "def logins\n print_logins(false)\n end",
"title": ""
},
{
"docid": "f262fc26b2a042597faa228e0ff54f16",
"score": "0.5512631",
"text": "def max_login_tries(number_of_tries)\n agent_section[:maxlo... |
51d25abab289e6b66ffdc64e5b267b9f | POST /logtransfers POST /logtransfers.json | [
{
"docid": "8f9e8e70ecde3a58aae3029d4fb45536",
"score": "0.67218363",
"text": "def create\n @logtransfer = Logtransfer.new(params[:logtransfer])\n\n respond_to do |format|\n if @logtransfer.save\n format.html { redirect_to @logtransfer, notice: 'Logtransfer was successfully created.' }... | [
{
"docid": "dadece917f29380bbd0537264a88bea5",
"score": "0.6013539",
"text": "def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was suc... |
05dbfa547f73cd54c0876bdd38a5e45f | just for the sake of RSpec testing | [
{
"docid": "fae10d907450b1ae3ff553a54f7ea1bf",
"score": "0.0",
"text": "def initialize(contenders)\n @contenders = contenders\n @referee = Referee.new\n end",
"title": ""
}
] | [
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.7479604",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.7479604",
"text": "def spec; end",
"title": ""
},
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"sc... |
24c38126988922415d58024cc01bc4f4 | What is this? This causes both of the following methods to become private. If an attempt is made at access them from outside of the class, and an error occurs. What happens if it were cut and pasted above the virus_effects method. Pasting private above the virus_effects method makes all three of the methods below priva... | [
{
"docid": "2253ad7df9c746d7f9c5e32611113997",
"score": "0.0",
"text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).f... | [
{
"docid": "c1437bb6b4f1e60ba95c3709e649a040",
"score": "0.8026713",
"text": "def virus_effects\n \t# Calling private methods defined in class. No arguments needed as \n predicted_deaths\n speed_of_spread\n end",
"title": ""
},
{
"docid": "3f64602d5daa93d93987de57f126e727",
"scor... |
66e4a6d9295fdccf2c27f241abdf78a5 | Inlined version of (cons HD TL) | [
{
"docid": "81c068824b745ee94e44d8267847a712",
"score": "0.0",
"text": "def compile_cons(form, lexical_vars, in_tail_pos)\n if form.count == 3\n hd, tl = destructure_form(form, 2)\n hd_expr = compile(hd, lexical_vars, false)\n tl_expr = compile(tl, lexical_vars, false)\... | [
{
"docid": "752e2844a9f276ee5cfa6836def131a9",
"score": "0.65429",
"text": "def tld; end",
"title": ""
},
{
"docid": "752e2844a9f276ee5cfa6836def131a9",
"score": "0.65429",
"text": "def tld; end",
"title": ""
},
{
"docid": "eb092b97a2e7354eb5478e03a1ef74f6",
"score": ... |
0ed2c874893bbd00b1d71f4cceffa837 | when deleting objects such are client orders, delivery notes, invoices which were used to reduce stock, we need to add the stock back | [
{
"docid": "8b71b58c95a797bf9b8b98e72393d1e5",
"score": "0.6576512",
"text": "def revert_stock (products, actual_model_name, actual_model_id)\n\n products.each do |product|\n #Find which stock objects were updated by the current model so we can revert them\n @spr = StockProductReduction.whe... | [
{
"docid": "fd64e8e98cc790e095f51a1063e49cb3",
"score": "0.7104373",
"text": "def update_stock\n operador = self.notas_creditos_debito.tipo == 'DevolucionCompra' ? -1 : 1\n if deleted?\n MercaderiaExtracto.eliminar_movimiento(self, self.notas_creditos_debito.fecha, cantidad * operador*-1)\n ... |
62f171afef56849e5e58840f5e37e284 | POST /atm_machinees POST /atm_machinees.json | [
{
"docid": "0dcb987436306e5a7f63e698134e6b46",
"score": "0.674566",
"text": "def create\n @atm_machine = AtmMachine.new(atm_machine_params)\n\n respond_to do |format|\n if @atm_machine.save\n format.html { redirect_to @atm_machine, notice: 'Atm mach was successfully created.' }\n for... | [
{
"docid": "1afe13d459980d299a2e718a82eadfa9",
"score": "0.74039465",
"text": "def create\n @atm_machine = AtmMachine.new(atm_machine_params)\n\n respond_to do |format|\n if @atm_machine.save\n format.html { redirect_to @atm_machine, notice: 'Atm machine was successfully created.' }\n ... |
49f1ee70329c30915ab125ebcf159a29 | Test that processing an ascii file works | [
{
"docid": "8801a6f907af61dfbc8607382e57d3f0",
"score": "0.81175953",
"text": "def test_ascii_file\n assert_equal(@ascii_data, @proper_ascii)\n end",
"title": ""
}
] | [
{
"docid": "fb367acae9fca29e0f9e0fd3eecae3a9",
"score": "0.7134188",
"text": "def test_read_file\n\t\tassert_equal(\"\\xd4\\xc3\\xb2\\xa1\", @file_magic) # yep, it's libpcap.\n\tend",
"title": ""
},
{
"docid": "0ee48cca06112da41022b032b8064bc9",
"score": "0.67346627",
"text": "def te... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "17c3570cc97c671118f7e9c5c89b46c1",
"score": "0.0",
"text": "def set_room\n @room = Room.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6165422",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.60457647",
"text": "def action_hook... |
40bb3e62f340548e0f4ecb95aa90a652 | superclass imp so module can call it, noop | [
{
"docid": "6921efd5810f89affe64149a0c048b37",
"score": "0.0",
"text": "def get_facet_pagination(*args)\n end",
"title": ""
}
] | [
{
"docid": "0c860d341b57fa9168894e792350480f",
"score": "0.6771609",
"text": "def missingimpl; end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f83e35d311",
"score": "0.6568262",
"text": "def inherited(base); end",
"title": ""
},
{
"docid": "e21e8506fc488800618fb6f8... |
9b653d0b079e5c95e46b16582dbf7d10 | GET /hairstyles/new GET /hairstyles/new.xml | [
{
"docid": "2af6b68faa491dac8333aa8e3653103c",
"score": "0.7902396",
"text": "def new\n @hairstyle = Hairstyle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hairstyle }\n end\n end",
"title": ""
}
] | [
{
"docid": "2d404827d9a9259f513eda28bd9cb2ae",
"score": "0.7269697",
"text": "def new\n @stylesheet = Stylesheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stylesheet }\n end\n end",
"title": ""
},
{
"docid": "2990352218bf7... |
16ae4ddbdfb5c09bbdaba313cc6d7b4f | Define a function in the library of this class. By default, the function has extern scope. The +name+ is typically a symbol (like :mark) which is used to generate a function name in combination with the shadow struct name. If a class defines a function with +name+, and the child class does not do so (i.e. doesn't insta... | [
{
"docid": "7d7ef5391b5131d50dbebe621becd36f",
"score": "0.60252964",
"text": "def define_inheritable_c_function name,\n subclass = CGenerator::Function, &block\n sf = shadow_library_source_file\n m = sf.define_c_function \"#{name}_#{shadow_struct_name}\", subclass\n c_function_t... | [
{
"docid": "59f27a883ee6ccebdcaf5a254c4071f5",
"score": "0.65453637",
"text": "def define_c_function name, subclass = CGenerator::Function, &block\n sf = shadow_library_source_file\n m = sf.define_c_function name, subclass\n m.scope :extern\n m.instance_eval(&block) if block\n m... |
6ee9ba9e47e88bfc31246aff70192d71 | Insert +node_or_tags+ before this Node (as a sibling). +node_or_tags+ can be a Nokogiri::XML::Node, a ::DocumentFragment, a ::NodeSet, or a string containing markup. Returns the reparented node (if +node_or_tags+ is a Node), or NodeSet (if +node_or_tags+ is a DocumentFragment, NodeSet, or string). Also see related meth... | [
{
"docid": "80ed0bc05f898f647e4c6b9d4cc13846",
"score": "0.7338516",
"text": "def add_previous_sibling(node_or_tags)\n raise ArgumentError,\n \"A document may not have multiple root nodes.\" if parent&.document? && !(node_or_tags.comment? || node_or_tags.processing_instruction?)\n\n ... | [
{
"docid": "1eb29ce611a0de81446253cb8cac7da1",
"score": "0.7988514",
"text": "def before(node_or_tags)\n add_previous_sibling(node_or_tags)\n self\n end",
"title": ""
},
{
"docid": "977f330c4593425fa65ce57855dd29f1",
"score": "0.7636886",
"text": "def prepend_child... |
496b3d19c9d29eda8610aebc8ac23e9d | This returns a codestring that can be used to recreate the Knj::Datetobject. ===Examples code = datet.code => "1985061710000000000" newdatet = Knj::Datet.in(code) => 19850617 10:00:00 +0200 | [
{
"docid": "dbd279d7f1ce4584a3d10646d1209a70",
"score": "0.50258434",
"text": "def code\n return \"#{\"%04d\" % @time.year}#{\"%02d\" % @time.month}#{\"%02d\" % @time.day}#{\"%02d\" % @time.hour}#{\"%02d\" % @time.min}#{\"%02d\" % @time.sec}#{\"%05d\" % @time.usec}\"\n end",
"title": ""
}
] | [
{
"docid": "cc047f473baeb836cd07c4bf3a0aa92c",
"score": "0.53930503",
"text": "def encode_date(date); end",
"title": ""
},
{
"docid": "1aec42a19d67204a1b4c7df430e73353",
"score": "0.5380827",
"text": "def encode_date(codes, date)\n codes << date.strftime(\"%Y-%m-%d\")\n end",... |
b4ec95b3c367a2811ff9f220cb51007c | GET /shipments GET /shipments.json | [
{
"docid": "8703286a542a581faefd73941d9d9ee2",
"score": "0.0",
"text": "def index\n if session[:account_type] == EmployeesController::Driver\n @shipments = Shipment.joins(:drivers).where(employees: { id: session[:user]}, archived: 0).order(departed_at: :asc)\n else\n @shipments = Shipmen... | [
{
"docid": "149ac01c0978d7cc1deb65c5da9ad4ed",
"score": "0.7906014",
"text": "def index\n @shipments = Shipment.all\n render json: @shipments\n end",
"title": ""
},
{
"docid": "714d6df6db6d0b83de4ba200cb7af56e",
"score": "0.7898799",
"text": "def index\n \n @shipment... |
8ed00556d4122e3eccfd9b5389522ebd | PUT /users/1 PUT /users/1.json | [
{
"docid": "73a348926ad9aacbc6a5d5dbb1b6e97d",
"score": "0.0",
"text": "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to \"/users/#{session[:user_id]}\", notice: 'User was successfully updated... | [
{
"docid": "4781fa7337315133553edb54194e6202",
"score": "0.74114245",
"text": "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"title": ""
},
{
"docid": "23a904e6ddd4b6b07c4b53353e78cf93",
"score": "0.73920554",
"text": "def update\n render jso... |
65021a6c6fde7a6a213a9f456c23bb5c | ==== Description Returns enumerable ContentGenerator object representing the new queue ==== Attributes +limit+ Maximum entries that the returned ContentGenerator will hold. For no limit, use nil | [
{
"docid": "92767b7cb5545efba0d60b40944f43ed",
"score": "0.566075",
"text": "def get_new(limit=100)\n\t\treturn ContentGenerator.new('http://www.reddit.com/r/'+@display_name.to_s+'/new.json',limit)\n\tend",
"title": ""
}
] | [
{
"docid": "07c4304adbbf94babace56e44e6273c8",
"score": "0.6477911",
"text": "def limit(limit)\n Collection.new(@batches, limit: limit)\n end",
"title": ""
},
{
"docid": "5ebce66841b9814210cd931e011dea41",
"score": "0.627778",
"text": "def max_queue; end",
"title": ""... |
10a50f975ac4b907e39866cd4462de2a | => false 21 Write a method valid_email that takes in a string and returns a boolean indicating whether or not it is a valid email address. For simplicity, we'll consider an email valid when it satisfies all of the following: | [
{
"docid": "31ef57eb857f68c6edb8b8ef381b7648",
"score": "0.74394614",
"text": "def valid_email(str)\n letters = 'qwertyuiopasdfghjklzxcvbnm'\n arr = str.split('@')\n return false if arr.length != 2\n\n arr[0].each_char do |ele|\n return false unless letters.include?(ele)\n end\n arr[1].split('.... | [
{
"docid": "5df25213b01436717753fa78092bdea1",
"score": "0.86242926",
"text": "def valid_email?(email_str)\n !(email_str =~ VALID_EMAIL_REGEX).nil?\nend",
"title": ""
},
{
"docid": "634ffcd3ef78c7662b1ff95c3ea746f7",
"score": "0.861796",
"text": "def valid_email?(str)\n /\\A([^... |
f6affa4d73f874f699666845f0dc9b37 | POST /post319s POST /post319s.xml | [
{
"docid": "51b46c42f3b241e58e72b17305d7bd2e",
"score": "0.6058041",
"text": "def create\n @post319 = Post319.new(params[:post319])\n\n respond_to do |format|\n if @post319.save\n format.html { redirect_to(@post319, :notice => 'Post319 was successfully created.') }\n format.xml ... | [
{
"docid": "8d244c8e93c271a7e92ea1ee63d3dddc",
"score": "0.601453",
"text": "def POST; end",
"title": ""
},
{
"docid": "fa8fcc23911ab0c33dc007eceacc29f5",
"score": "0.5870325",
"text": "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"appl... |
80677fa02368272b933f3545372f9968 | localize url/path by prepending /intl/LANG if needed | [
{
"docid": "609f01d8dd672ad6b5fb38872b818ac1",
"score": "0.7902237",
"text": "def localize_path(path, lang = current_language)\n\n # no localization for 'special' case\n return path if !lang || EMPTY_LANGUAGE == lang\n\n # we only localize absolute path/url, like /support\n #... | [
{
"docid": "7a7e4f766b2a01caa2c9d66a72b6a952",
"score": "0.7841074",
"text": "def path_format_locale(path, arg_base_url = \"\")\r\n if arg_base_url == \"\"\r\n url = $base_url\r\n else\r\n url = arg_base_url\r\n end\r\n url.to_s + path + \"?locale=\" + $... |
24c580c0c67d0b6f65176d7b9c7f70e8 | returns sum of digits | [
{
"docid": "ab38be11ab13f17cf8675b7d57399943",
"score": "0.0",
"text": "def sum(integer)\n integer.to_s.split('').map { |element| element.to_i }.sum \nend",
"title": ""
}
] | [
{
"docid": "334d05787e0c8b5a8dacf5f9aeafa8b1",
"score": "0.8721527",
"text": "def digit_sum n\n\tn.to_s.chars.map(&:to_i).reduce(:+) # \"chars\" splits up the digits so we can reduce them\nend",
"title": ""
},
{
"docid": "b9e8cddb331611148d6e143130ff78ae",
"score": "0.8700699",
"text... |
db3f8a5012c45b6045c20ab7e2771432 | Fire all handles for which Handletime is less than the given time. | [
{
"docid": "d4c34a81c5bbb53a4c31deee8d3182cb",
"score": "0.69861287",
"text": "def fire(time)\n pop(time).reverse_each do |handle|\n handle.fire(time)\n end\n end",
"title": ""
}
] | [
{
"docid": "23fe17b986d96f8a0fd9c571ea38fac7",
"score": "0.6968376",
"text": "def fire(time)\n pop(time).reverse_each do |handle|\n handle.fire(time)\n end\n end",
"title": ""
},
{
"docid": "bd07e0e694a2960142cb63b8b0b2b4ef",
"score": "0.66932225",
"text":... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "3ffaa5a69614357b8835a360bc5b8079",
"score": "0.0",
"text": "def set_citacao\n @citacao = Citacao.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163927",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6046165",
"text": "def action_hook;... |
8f70dbcadaa656397e540751231e6916 | Track failed login attempts | [
{
"docid": "00249720aff375a9888aac587cedde8e",
"score": "0.711585",
"text": "def note_failed_signin\n flash[:error] = \"Couldn't log you in as '#{params[:login]}'\"\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"title": ""
}
] | [
{
"docid": "26d7c983a7f56089e48a376261f7a2f3",
"score": "0.8288665",
"text": "def failed_login!\n @number_of_bad_logins = increment_bad_login_counter\n throttle_user if should_throttle?\n end",
"title": ""
},
{
"docid": "3303157e7c797bbced0f7e71be640c12",
"score": "0.7961219",
... |
6740c4e322da2e94993ec24384da5d10 | Get the list of status changes for a coaching appointment. Permission not required if you are an attendee, creator or facilitator of the appointment | [
{
"docid": "b52cdd5440b794b0dee7ce10d2856f04",
"score": "0.6257174",
"text": "def get_coaching_appointment_statuses_with_http_info(appointment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CoachingApi.get_coaching_appointment_statuses ...\"... | [
{
"docid": "54d080a71855b0d4ab4b659b904becd6",
"score": "0.624542",
"text": "def patch_coaching_appointment_status(appointment_id, body, opts = {})\n data, _status_code, _headers = patch_coaching_appointment_status_with_http_info(appointment_id, body, opts)\n return data\n end",
"title"... |
9aca0cf05779d933af88557f89433e6d | Public: Starts the bot itself following these steps: Call Slack's API method rtm.start Call Slack's API method auth.test Connects to the WebSocket server Returns the desired documention through the connected WebSocket | [
{
"docid": "0dae5f153895f6eaefc94a2d5ee5e1e7",
"score": "0.5916055",
"text": "def begin_listen!\n url = start['url']\n user_data = auth\n @id = user_data['user_id']\n @name = user_data['user']\n\n connect!(url: url) do |message, channel|\n send_found_documentation(message... | [
{
"docid": "a961bba891c2e494e3d64240e64eff50",
"score": "0.67943984",
"text": "def start_telegram_api\n Telegram::Bot::Client.run(token) do |bot|\n listen(bot)\n end\n end",
"title": ""
},
{
"docid": "03519d1e265d2933d767258408d3d16d",
"score": "0.6746818",
"text": "def i... |
2352babd64a2ae1b8cb8997b09e7f90e | Convert params[:type] which is passed from routes.rb of each content type to ActiveRecord class. | [
{
"docid": "3e59771962bcb4a598de751379aaaa9a",
"score": "0.7579016",
"text": "def prepare_type\n @type = params[:type]\n @klass = @type.constantize\n end",
"title": ""
}
] | [
{
"docid": "76381bddace5d53c8bef13f1bca1b94c",
"score": "0.65908295",
"text": "def find_model(type)\n if type == \"liti_types\"\n modeltype = TypesLiti\n elsif type == \"nonliti_types\"\n modeltype = TypesNonLiti\n elsif type == \"activity_types\"\n modeltype = Physical::Timeande... |
d678533fa487cbebba07bf437f01f690 | Should Always create Playlists with this function Throws exception if something fails. Catch ActiveRecord:InvalidRecord in controller so that the validation errors propagate to the view playlist_params: attributes to be added to playlist creator: User instance of the playlist creator | [
{
"docid": "37d259deaa4c5cdec2584dfb7ae69d18",
"score": "0.61155814",
"text": "def create_playlist!(playlist_params, creator)\n\n self.name = playlist_params[:name]\n self.description = playlist_params[:description]\n self.playlist_type = \"Listed\"\n\n Playlist.transaction do\n self.sa... | [
{
"docid": "83dd9ac40781a7816e397919130c336c",
"score": "0.730993",
"text": "def create\n\n @playlist = Playlist.new\n\n error = false\n begin\n @playlist.create_playlist!(params[:playlist], current_user)\n rescue ActiveRecord::RecordInvalid\n error = true\n end\n\n respond_t... |
d375ce5a631126989b8af587b06bd3bd | exclude_ends removes the first and last items from an array removes the first and last characters from a string | [
{
"docid": "66e7633b937adaa5df4239fb134b9c11",
"score": "0.729285",
"text": "def exclude_ends(input)\n input[1..-2]\nend",
"title": ""
}
] | [
{
"docid": "dad55d60cc21805125a71d05e9f0aa8f",
"score": "0.8158272",
"text": "def exclude_ends array_or_string\n array_or_string[1..-2]\nend",
"title": ""
},
{
"docid": "9fe9a3037aadf6147646936157cca872",
"score": "0.7994712",
"text": "def exclude_ends(arrstring)\n arrstring[1..-2]... |