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
GET /configurations GET /configurations.xml
def show @configuration = Configuration.instance respond_to do |format| format.html # show.html.erb format.xml { render :xml => @configuration } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end", "def configuration\n _get(\"/system/configuration\") { |json| json }\n end", "def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend", "def show\n respon...
[ "0.76294637", "0.73736703", "0.72991353", "0.6981205", "0.68772364", "0.6862645", "0.67565966", "0.6753497", "0.67364496", "0.6581991", "0.65626657", "0.6510999", "0.6499977", "0.64951694", "0.6466157", "0.6457752", "0.644615", "0.6425584", "0.64179665", "0.6376922", "0.63670...
0.63659817
22
PUT /configurations PUT /configurations.xml
def update @configuration = Configuration.instance keep_audit_logs = @configuration.keep_audit_logs respond_to do |format| if @configuration.update_attributes(params[:configuration]) or not @configuration.dirty? # reconfigure audit logging if changed if keep_audit_logs != @configuration.keep_audit_logs AuditConfig.reconfigure(Configuration.instance.keep_audit_logs, Rails.root.join('log').to_s + '/audit.log') end flash[:notice] = 'Configuration was successfully updated.' format.html { redirect_to(configuration_url) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @configuration.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_configuration(xml, options = {})\n client = extract_client!(options)\n\n # The Artifactory api requires a content type of 'application/xml'.\n # See http://bit.ly/1l2IvZY\n headers = { \"Content-Type\" => \"application/xml\" }\n client.post(\"/api/system/configuration\...
[ "0.6892215", "0.63629645", "0.62337536", "0.61308825", "0.61114717", "0.6086382", "0.60610765", "0.5990439", "0.59689707", "0.595665", "0.59528214", "0.59371006", "0.5925079", "0.58836585", "0.58033407", "0.57375014", "0.57243186", "0.57161593", "0.567412", "0.5666389", "0.56...
0.53700936
47
Ruote dispatch call to this method in case of user's cancel task request
def cancel(_fei, flavour) # flavour will have 'kill' value if kill_process is invoked instead of cancel_process return if flavour wi = workitem params = get_params(wi) task_id, action, workflow, task, task_start, task_end = %w(task_id action workflow task task_start task_end).map { |k| params[k] } task.add_internal_guards!(workflow.guards[:internal]) log_participant.canceling(task_id) delete_task_info(wi) reply_to_engine(wi) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_cancel_handler; call_handler(:cancel); end", "def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end", "def cancelled_requests; end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n sup...
[ "0.74465376", "0.74217767", "0.7402019", "0.7383459", "0.7374727", "0.7374727", "0.7374727", "0.7373848", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0.73578745", "0...
0.63544846
71
returns either nil if should not skip sync true if shoudl skip sync hash with Boolean key :error
def skip_sync? if R8::Config[:node_agent_git_clone][:mode] == 'skip' return true end skip_sync = nil @head_git_commit_id = nil #nil means dont skip installed_agent_git_commit_id = @node.get_field?(:agent_git_commit_id) begin # TODO: ran into obscure problem when github is down; below does not work @head_git_commit_id = AgentGritAdapter.get_head_git_commit_id() if R8::Config[:node_agent_git_clone][:mode] == 'debug' installed_agent_git_commit_id = @node[:agent_git_commit_id] = nil end rescue => e Log.error("Error trying to get most recent sync agent code (#{e}); skipping the sync") skip_sync = { error: true } end skip_sync || ((@head_git_commit_id == installed_agent_git_commit_id) && { error: false }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def failed_full_sync_required?\n\t\t\treturn request_status == REQUEST_STATUS['failed_full_sync_required']\n\t\tend", "def need_sync?\n if is_ignored || err_count >= MAX_SYNC_ERR\n false\n elsif last_sync == DUMMY_TIMESTAMP\n true\n else\n case sync_type.to_sym\n when :...
[ "0.6264902", "0.6094702", "0.5827929", "0.58164674", "0.5795311", "0.57661176", "0.5717203", "0.5659842", "0.56358916", "0.5545872", "0.5491107", "0.5489838", "0.54891515", "0.54668653", "0.5465773", "0.5437599", "0.54146254", "0.5412291", "0.538771", "0.5379755", "0.53759766...
0.60984695
1
Configures the encoding, verbosity, schema search path, and time zone of the connection. This is called on `connection.connect` and should not be called manually.
def configure_connection #if encoding = config[:encoding] # The client_encoding setting is set by the driver and should not be altered. # If the driver detects a change it will abort the connection. # see http://jdbc.postgresql.org/documentation/91/connect.html # self.set_client_encoding(encoding) #end self.client_min_messages = config[:min_messages] || 'warning' self.schema_search_path = config[:schema_search_path] || config[:schema_order] # Use standard-conforming strings if available so we don't have to do the E'...' dance. set_standard_conforming_strings # If using Active Record's time zone support configure the connection to return # TIMESTAMP WITH ZONE types in UTC. # (SET TIME ZONE does not use an equals sign like other SET variables) if ActiveRecord::Base.default_timezone == :utc execute("SET time zone 'UTC'", 'SCHEMA') elsif tz = local_tz execute("SET time zone '#{tz}'", 'SCHEMA') end unless redshift? # SET statements from :variables config hash # http://www.postgresql.org/docs/8.3/static/sql-set.html (config[:variables] || {}).map do |k, v| if v == ':default' || v == :default # Sets the value to the global or compile default execute("SET SESSION #{k} TO DEFAULT", 'SCHEMA') elsif ! v.nil? execute("SET SESSION #{k} TO #{quote(v)}", 'SCHEMA') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_connection\n if @config[:encoding]\n if @connection.respond_to?(:set_client_encoding)\n @connection.set_client_encoding(@config[:encoding])\n else\n execute(\"SET client_encoding TO '#{@config[:encoding]}'\")\n end\n end\n ...
[ "0.7998572", "0.7628794", "0.7555284", "0.6452159", "0.6262069", "0.6102091", "0.57214516", "0.56570333", "0.5654864", "0.56489587", "0.5599047", "0.5257385", "0.5235285", "0.51999795", "0.5178021", "0.5178021", "0.5169319", "0.51570284", "0.5128442", "0.5107768", "0.50995827...
0.72013974
4
Maps logical Rails types to PostgreSQLspecific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil) case type.to_s when 'binary' # PostgreSQL doesn't support limits on binary (bytea) columns. # The hard limit is 1Gb, because of a 32-bit size field, and TOAST. case limit when nil, 0..0x3fffffff; super(type) else raise(ActiveRecordError, "No binary type has byte size #{limit}.") end when 'text' # PostgreSQL doesn't support limits on text columns. # The hard limit is 1Gb, according to section 8.3 in the manual. case limit when nil, 0..0x3fffffff; super(type) else raise(ActiveRecordError, "The limit on text can be at most 1GB - 1byte.") end when 'integer' return 'integer' unless limit case limit when 1, 2; 'smallint' when 3, 4; 'integer' when 5..8; 'bigint' else raise(ActiveRecordError, "No integer type has byte size #{limit}. Use a numeric with precision 0 instead.") end when 'datetime' return super unless precision case precision when 0..6; "timestamp(#{precision})" else raise(ActiveRecordError, "No timestamp type has precision of #{precision}. The allowed range of precision is from 0 to 6") end else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_type_convertor_map\n super\n @type_convertor_map[Java::JavaSQL::Types::INTEGER] = @type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @basic_type_convertor_map[Java::JavaSQL::Types::INTEGER] = @basic_type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @type_convertor_ma...
[ "0.70281494", "0.6980315", "0.6941677", "0.68005604", "0.6761768", "0.67288387", "0.6717781", "0.66960716", "0.6682115", "0.6573886", "0.6573281", "0.65584755", "0.6548949", "0.65249455", "0.6515135", "0.6484379", "0.64811", "0.64745134", "0.6465557", "0.64557236", "0.6454326...
0.6012735
42
Enable standardconforming strings if available.
def set_standard_conforming_strings if postgresql_version >= 80200 # N/A (or read-only in PG 8.1) self.standard_conforming_strings=(true) end # AR 4.2 no longer does the hustle since its claiming PG >= 8.2 # ... execute('SET standard_conforming_strings = on', 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_standard_conforming_strings\n self.standard_conforming_strings=(true)\n end", "def standard_conforming_strings=(enable)\n client_min_messages = self.client_min_messages\n begin\n self.client_min_messages = 'panic'\n value = enable ? \"on\" : \"off\"\n execute(\"SET ...
[ "0.79340744", "0.76877224", "0.75741845", "0.7502697", "0.7227732", "0.6488168", "0.59982055", "0.5995962", "0.5869915", "0.57447064", "0.56250924", "0.5560862", "0.5484414", "0.5459016", "0.5435972", "0.5430185", "0.5430185", "0.5430185", "0.541068", "0.54017097", "0.5339700...
0.7083372
5
Does PostgreSQL support migrations?
def supports_migrations? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n true\n end", "def supports_migrations?\n false\n end", "def supports_migrations?\n false\n end", "def migration\n end", "def migrate...
[ "0.74455017", "0.74455017", "0.74455017", "0.71099716", "0.71099716", "0.7081053", "0.70517933", "0.70061463", "0.6878439", "0.6753264", "0.6726949", "0.6721073", "0.67103", "0.6654258", "0.6637816", "0.6585741", "0.653311", "0.65126055", "0.65126055", "0.64790964", "0.647123...
0.7510341
1
Does PostgreSQL support finding primary key on nonActive Record tables?
def supports_primary_key? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_primary_key(table)\n query = %q{\n SELECT column_name\n FROM information_schema.table_constraints tc\n INNER JOIN\n information_schema.key_column_usage kcu\n ON tc.constraint_name = kcu.constraint_name\n WHERE constraint_type = 'PRIMARY KEY'\n AND tc.table...
[ "0.7788639", "0.7551639", "0.7414083", "0.7410477", "0.7390688", "0.73888314", "0.7367827", "0.7353364", "0.73317266", "0.7298285", "0.72451895", "0.7220364", "0.7192133", "0.71459764", "0.71459764", "0.71362853", "0.70882165", "0.7069255", "0.704197", "0.70152104", "0.694998...
0.69314265
23
NOTE: handled by JdbcAdapter only to have statements in logs :
def begin_db_transaction # PG driver doesn't really do anything on setAutoCommit(false) # except for commit-ing a previous pending transaction if any log('/* BEGIN */') { @connection.begin } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sql\n @opts[:log_sql]\n end", "def log_connection_execute(conn, sql)\n conn.execute(sql)\n end", "def log_connection_yield(sql, conn, args=nil)\n if !@loggers.empty? && (external_caller = external_caller_for_log)\n sql = \"#{external_caller} #{sql}\"\n end\n...
[ "0.68731165", "0.65085703", "0.64334756", "0.6352595", "0.6284422", "0.628263", "0.62791365", "0.621495", "0.6176913", "0.61721617", "0.61566347", "0.61421806", "0.6134121", "0.61249936", "0.6121345", "0.6101764", "0.60859275", "0.6075139", "0.6069942", "0.6041229", "0.603926...
0.0
-1
Starts a database transaction.
def begin_isolated_db_transaction(isolation) name = isolation.to_s.upcase; name.sub!('_', ' ') log("/* BEGIN */; SET TRANSACTION ISOLATION LEVEL #{name}") do @connection.begin(isolation) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_transaction!\n fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction\n @in_transaction = true\n\n query 'BEGIN'\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begin_db_transaction\n execute(\"BEGIN\")\n end", "def begi...
[ "0.8382846", "0.826889", "0.826889", "0.8138087", "0.807101", "0.80169153", "0.7758959", "0.7638615", "0.7618878", "0.7618878", "0.73823154", "0.72951317", "0.71919847", "0.7191075", "0.71797717", "0.7141438", "0.70849895", "0.7055831", "0.7027031", "0.7020137", "0.7020137", ...
0.6697098
32
NOTE: only since AR4.0 but should not hurt on other versions
def enable_extension(name) execute("CREATE EXTENSION IF NOT EXISTS \"#{name}\"") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def material; end", "def material; end", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first override to #m3\n\t\t\t\tend", "def m3\n\t\t\t\t\tsuper * 2\t\t\t\t\t\t\t\t\t\t\t\t# first ov...
[ "0.59149444", "0.5849186", "0.5849186", "0.5517524", "0.5517524", "0.5517524", "0.54993635", "0.54602414", "0.5436732", "0.5429513", "0.53964394", "0.53964394", "0.53964394", "0.53964394", "0.53523755", "0.53476053", "0.5324366", "0.53194106", "0.52763015", "0.52657574", "0.5...
0.0
-1
Set the authorized user for this session.
def session_auth=(user) execute "SET SESSION AUTHORIZATION #{user}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user\n authorize\n @user = current_user\n end", "def set_user\n UserInfo.current_user = session[:user]\n end", "def set_authorizeduser\n @authorizeduser = Authorizeduser.find(params[:id])\n end", "def user=(the_user)\n authentication.user = the_user\n end", "def set...
[ "0.7867809", "0.7302386", "0.7257887", "0.7225642", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", "0.71937734", ...
0.69758594
43
Returns the configured supported identifier length supported by PostgreSQL, or report the default of 63 on PostgreSQL 7.x.
def table_alias_length @table_alias_length ||= ( postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to_i : 63 ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_identifier_length\n @max_identifier_length ||= select_one('SHOW max_identifier_length', 'SCHEMA'.freeze)['max_identifier_length'].to_i\n end", "def table_alias_length\n @table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to...
[ "0.77626705", "0.7425341", "0.7415166", "0.6890104", "0.6768359", "0.66681993", "0.6570243", "0.6568709", "0.6445401", "0.6145001", "0.6134166", "0.6008519", "0.59177303", "0.584478", "0.5800081", "0.57869506", "0.57863003", "0.5786278", "0.5784538", "0.5777665", "0.56965554"...
0.74968874
1
Resets sequence to the max value of the table's primary key if present.
def reset_pk_sequence!(table, pk = nil, sequence = nil) if ! pk || ! sequence default_pk, default_sequence = pk_and_sequence_for(table) pk ||= default_pk; sequence ||= default_sequence end if pk && sequence quoted_sequence = quote_column_name(sequence) select_value <<-end_sql, 'Reset Sequence' SELECT setval('#{quoted_sequence}', (SELECT COALESCE(MAX(#{quote_column_name pk})+(SELECT increment_by FROM #{quoted_sequence}), (SELECT min_value FROM #{quoted_sequence})) FROM #{quote_table_name(table)}), false) end_sql end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_sequence!(table, column, sequence = nil)\n max_id = select_value(\"select max(#{column}) from #{table}\")\n execute(\"alter sequence #{default_sequence_name(table, column)} restart with #{max_id}\") unless legacy_mode\n execute(\"SET GENERATOR #{default_sequence_name(table, column)} ...
[ "0.8384856", "0.82416755", "0.8170251", "0.8104159", "0.80971086", "0.79939026", "0.78463393", "0.7836316", "0.7816193", "0.7504206", "0.7385607", "0.7374428", "0.7228873", "0.6952464", "0.6952464", "0.67760897", "0.6592716", "0.6577699", "0.6439981", "0.6302244", "0.6139665"...
0.7845104
7
Find a table's primary key and sequence.
def pk_and_sequence_for(table) # try looking for a seq with a dependency on the table's primary key : result = select(<<-end_sql, 'PK and Serial Sequence')[0] SELECT attr.attname, seq.relname FROM pg_class seq, pg_attribute attr, pg_depend dep, pg_constraint cons WHERE seq.oid = dep.objid AND seq.relkind = 'S' AND attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid AND attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1] AND cons.contype = 'p' AND dep.refobjid = '#{quote_table_name(table)}'::regclass end_sql if result.nil? || result.empty? # if that fails, try parsing the primary key's default value : result = select(<<-end_sql, 'PK and Custom Sequence')[0] SELECT attr.attname, CASE WHEN pg_get_expr(def.adbin, def.adrelid) !~* 'nextval' THEN NULL WHEN split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2) ~ '.' THEN substr(split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2), strpos(split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2), '.')+1) ELSE split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2) END as relname FROM pg_class t JOIN pg_attribute attr ON (t.oid = attrelid) JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum) JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1]) WHERE t.oid = '#{quote_table_name(table)}'::regclass AND cons.contype = 'p' AND pg_get_expr(def.adbin, def.adrelid) ~* 'nextval|uuid_generate' end_sql end [ result['attname'], result['relname'] ] rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_key(table)\n pk_and_sequence = pk_and_sequence_for(table)\n pk_and_sequence && pk_and_sequence.first\n end", "def primary_key(table_name)\n pk_and_sequence = pk_and_sequence_for(table_name)\n pk_and_sequence && pk_and_sequence.first\n end", "def primary_key(tab...
[ "0.831182", "0.8211989", "0.82021785", "0.7962566", "0.78982127", "0.78265303", "0.7770917", "0.7733133", "0.7645919", "0.7559004", "0.74288857", "0.7410343", "0.72492987", "0.7226762", "0.721343", "0.72014636", "0.71476775", "0.7131808", "0.70583314", "0.692738", "0.69228405...
0.77366364
7
Returns an array of schema names.
def schema_names select_values( "SELECT nspname FROM pg_namespace" << " WHERE nspname !~ '^pg_.*' AND nspname NOT IN ('information_schema')" << " ORDER by nspname;", 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_names\n select_value(<<-SQL, 'SCHEMA')\n SELECT nspname\n FROM pg_namespace\n WHERE nspname !~ '^pg_.*'\n AND nspname NOT IN ('information_schema')\n ORDER by nspname;\n SQL\n end", "def all_schemas\n query('SE...
[ "0.7825486", "0.755717", "0.7349362", "0.725099", "0.70116794", "0.6907281", "0.6817294", "0.67592704", "0.67592704", "0.6630236", "0.6606849", "0.6363766", "0.6285879", "0.61717385", "0.6136126", "0.60941684", "0.6042356", "0.60274166", "0.6021593", "0.5923801", "0.5906087",...
0.77769697
1
Returns true if schema exists.
def schema_exists?(name) select_value("SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'", 'SCHEMA').to_i > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n schema.exists?(self)\n end", "def schema_exists?(name)\n select_value(\"SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'\", 'SCHEMA').to_i > 0\n end", "def schema_loaded?\n @schema_loaded\n end", "def db_exist?(db_name)\n list_schemas.include?(db_...
[ "0.870376", "0.80718994", "0.7772462", "0.7356496", "0.73484826", "0.7221219", "0.7111925", "0.70547426", "0.70278955", "0.7027433", "0.695713", "0.6954786", "0.69057137", "0.6826998", "0.6826858", "0.67104733", "0.66710407", "0.66590893", "0.6653367", "0.6620029", "0.6575495...
0.8083377
1
Returns the current schema name.
def current_schema select_value('SELECT current_schema', 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_name\n unless @schema_name\n @schema_name = collect_first(&:schema_name)\n end\n return @schema_name\n end", "def current_schema\n exec_query('SELECT current_schema', 'SCHEMA')[0][\"current_schema\"]\n end", "def current_schema\n select_val...
[ "0.8640092", "0.8009799", "0.79457414", "0.7704965", "0.75975", "0.75834477", "0.7218303", "0.70150703", "0.69727236", "0.68999404", "0.6843903", "0.683938", "0.6801867", "0.67965114", "0.6751028", "0.6696837", "0.66711277", "0.66133976", "0.66133976", "0.6557533", "0.6512213...
0.7742299
3
Returns the current database encoding format.
def encoding select_value( "SELECT pg_encoding_to_char(pg_database.encoding)" << " FROM pg_database" << " WHERE pg_database.datname LIKE '#{current_database}'", 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encoding\n select_value(\"SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname LIKE '#{current_database}'\", 'SCHEMA')\n end", "def encoding\n if @connection.respond_to?(:encoding)\n @connection.encoding.to_s\n else\n @connection.execute('PRAGMA ...
[ "0.7547709", "0.74738336", "0.711562", "0.6880602", "0.6549058", "0.6508679", "0.6423461", "0.62985575", "0.62985575", "0.6177421", "0.61548644", "0.61548644", "0.6118205", "0.5982267", "0.5982267", "0.5922049", "0.5922049", "0.5922049", "0.5922049", "0.5922049", "0.5922049",...
0.76479644
0
Returns the current database collation.
def collation select_value( "SELECT pg_database.datcollate" << " FROM pg_database" << " WHERE pg_database.datname LIKE '#{current_database}'", 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collation\n @collation ||= show_variable('collation_connection') || 'utf8_general_ci'\n end", "def collation\n return @collation\n end", "def collation\n show_variable \"collation_database\"\n end", "def collation\n nil\n end", "def collatio...
[ "0.81398416", "0.80906457", "0.80579823", "0.7396513", "0.69218975", "0.6830314", "0.67200565", "0.6189143", "0.6189143", "0.5956802", "0.57898426", "0.5758509", "0.57458913", "0.5637971", "0.5636268", "0.5623454", "0.5547058", "0.5519378", "0.5493942", "0.53833646", "0.53510...
0.80273616
3
Returns the current database ctype.
def ctype select_value( "SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'", 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_type\n @db_type || self.class.db_type\n end", "def db_type\n @db_type || self.class.db_type\n end", "def type_c\n @type_c ||= type[1]\n end", "def database_type(database)\n Contrib::Utils::Database.normalize_vendor(database.database_type.to_s)\n ...
[ "0.7150052", "0.7150052", "0.64715785", "0.64613974", "0.62984645", "0.6184572", "0.6184572", "0.60145676", "0.59682935", "0.5932123", "0.59283537", "0.59283537", "0.586733", "0.5854627", "0.57934284", "0.5772028", "0.5751685", "0.5742475", "0.57380474", "0.57376844", "0.5732...
0.7906427
0
Returns the active schema search path.
def schema_search_path @schema_search_path ||= select_value('SHOW search_path', 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_search_path\n @schema_search_path ||= exec_query('SHOW search_path', 'SCHEMA')[0]['search_path']\n end", "def schema_search_path\n @schema_search_path ||= query('SHOW search_path')[0][0]\n end", "def schema_search_path\n @schema_search_path ||= select_value('SHOW search_...
[ "0.85494596", "0.8532277", "0.83956444", "0.8270538", "0.773296", "0.6705241", "0.6705241", "0.6458512", "0.64180607", "0.6341657", "0.63148767", "0.6311289", "0.6297143", "0.60836124", "0.6014659", "0.5984349", "0.5954951", "0.5946809", "0.5939141", "0.5907227", "0.5868709",...
0.8405031
2
Sets the schema search path to a string of commaseparated schema names. Names beginning with $ have to be quoted (e.g. $user => '$user'). See: This should be not be called manually but set in database.yml.
def schema_search_path=(schema_csv) if schema_csv execute "SET search_path TO #{schema_csv}" @schema_search_path = schema_csv end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_search_path=(schema_csv)\n if schema_csv\n execute \"SET search_path TO #{schema_csv}\"\n @schema_search_path = schema_csv\n end\n end", "def schema_search_path=(schema_csv)\n if schema_csv\n existing_schemas = execute(\"select nspname from pg_c...
[ "0.664544", "0.6510954", "0.6494391", "0.6481454", "0.6366361", "0.6342211", "0.6303578", "0.6296929", "0.62660384", "0.6242768", "0.61604947", "0.6132469", "0.60857606", "0.5717443", "0.5626526", "0.55575526", "0.55575526", "0.5521504", "0.5465776", "0.5443026", "0.5388707",...
0.66266346
2
Take an id from the result of an INSERT query.
def last_inserted_id(result) return nil if result.nil? return result if result.is_a? Integer # <ActiveRecord::Result @hash_rows=nil, @columns=["id"], @rows=[[3]]> # but it will work with [{ 'id' => 1 }] Hash wrapped results as well result.first.first[1] # .first = { "id"=>1 } .first = [ "id", 1 ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_and_id field, value\n id = -1\n sql = \"INSERT INTO #{table_name(field)}(value) VALUES \" +\n \"(?)\"\n @db.connect do\n st = @db.prepared_stmt sql\n st.execute(value)\n ...
[ "0.7450962", "0.7216602", "0.7202708", "0.71535903", "0.71280783", "0.7022289", "0.69916815", "0.69916815", "0.6984965", "0.6927333", "0.6910132", "0.68312216", "0.68112224", "0.6805602", "0.6803985", "0.6802412", "0.67943215", "0.6780155", "0.67709357", "0.6766254", "0.67662...
0.7019374
6
Create a new PostgreSQL database. Options include :owner, :template, :encoding, :collation, :ctype, :tablespace, and :connection_limit (note that MySQL uses :charset while PostgreSQL uses :encoding). Example: create_database config[:database], config create_database 'foo_development', encoding: 'unicode'
def create_database(name, options = {}) options = { :encoding => 'utf8' }.merge!(options.symbolize_keys) option_string = options.sum do |key, value| case key when :owner " OWNER = \"#{value}\"" when :template " TEMPLATE = \"#{value}\"" when :encoding " ENCODING = '#{value}'" when :collation " LC_COLLATE = '#{value}'" when :ctype " LC_CTYPE = '#{value}'" when :tablespace " TABLESPACE = \"#{value}\"" when :connection_limit " CONNECTION LIMIT = #{value}" else "" end end execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_database(name, options = {})\n options = options.reverse_merge(encoding: 'utf8')\n\n option_string = options.symbolize_keys.sum do |key, value|\n case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n when :template\n \" TEMPLATE = \\\"#{v...
[ "0.8003212", "0.79973865", "0.7605278", "0.75508356", "0.7528981", "0.7451401", "0.73724633", "0.7191728", "0.711289", "0.7017425", "0.69746697", "0.69493276", "0.67784595", "0.6747149", "0.672125", "0.6686191", "0.668398", "0.66837573", "0.6682724", "0.66610366", "0.64854896...
0.79701084
2
Creates a schema for the given schema name.
def create_schema(schema_name, pg_username = nil) if pg_username.nil? # AR 4.0 compatibility - accepts only single argument execute "CREATE SCHEMA #{schema_name}" else execute("CREATE SCHEMA \"#{schema_name}\" AUTHORIZATION \"#{pg_username}\"") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_schema schema_name\n execute \"CREATE SCHEMA #{quote_schema_name(schema_name)}\"\n end", "def create_schema(name)\n sql = %{CREATE SCHEMA \"#{name}\"}\n ActiveRecord::Base.connection.execute sql\n end", "def create_schema(schema)\n execute \"CREATE SCHEMA #{schema}\", 'Cr...
[ "0.86316985", "0.8368844", "0.78651893", "0.7739006", "0.7706055", "0.7556822", "0.743865", "0.73532134", "0.7331105", "0.7109655", "0.70657784", "0.7027491", "0.6894043", "0.6764276", "0.66970974", "0.6667969", "0.6446669", "0.6408188", "0.6375067", "0.6355118", "0.6349945",...
0.7770855
3
Drops the schema for the given schema name.
def drop_schema schema_name execute "DROP SCHEMA #{schema_name} CASCADE" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_schema(schema_name)\n execute(\"DROP SCHEMA \\\"#{schema_name}\\\"\")\n end", "def drop_schema(schema_name, options = {})\n execute \"DROP SCHEMA#{' IF EXISTS' if options[:if_exists]} #{quote_schema_name(schema_name)} CASCADE\"\n end", "def drop_schema_sql(name, opts = {})\n ...
[ "0.868982", "0.81105715", "0.80482227", "0.80474216", "0.80239207", "0.79456204", "0.7939613", "0.7935808", "0.7896766", "0.71207494", "0.7069183", "0.6863048", "0.6859939", "0.68088716", "0.6804522", "0.6749315", "0.6711258", "0.66265017", "0.6604161", "0.6492391", "0.648983...
0.82089806
1
Returns the current client message level.
def client_min_messages return nil if redshift? # not supported on Redshift select_value('SHOW client_min_messages', 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level msg\n add_origin msg unless has_key? msg.nick_canon\n\n return self[msg.nick_canon].level\n end", "def level\n return @level\n end", "def level\n return @level\n end", "def level\n @level\n end", "def level\n @level...
[ "0.6826556", "0.66841334", "0.66841334", "0.65763885", "0.65763885", "0.65403616", "0.6373983", "0.63108647", "0.627342", "0.62630314", "0.6251967", "0.6231447", "0.6209035", "0.61373836", "0.6082387", "0.59852076", "0.59768474", "0.5954789", "0.59511787", "0.58867407", "0.58...
0.532292
64
Set the client message level.
def client_min_messages=(level) # NOTE: for now simply ignore the writer (no warn on Redshift) so that # the AR copy-pasted PpstgreSQL parts stay the same as much as possible return nil if redshift? # not supported on Redshift execute("SET client_min_messages TO '#{level}'", 'SCHEMA') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level=(new_level)\n @logger.level=Logger::Severity.const_get(new_level.to_sym.upcase)\n end", "def set_modchat(level)\n send \"/modchat #{level}\"\n end", "def client_min_messages=(level)\n # Not supported on Redshift\n redshift? ? nil : super\n end", "def level=(value)\n ...
[ "0.6183599", "0.6176054", "0.6138289", "0.61173695", "0.6086171", "0.6086171", "0.6045444", "0.60372514", "0.6020798", "0.6020798", "0.60202146", "0.5968639", "0.5922183", "0.5891322", "0.58826494", "0.58706677", "0.58356607", "0.5827471", "0.579654", "0.5785428", "0.5769103"...
0.68401873
0
Gets the maximum number columns postgres has, default 32
def multi_column_index_limit @multi_column_index_limit ||= 32 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def col_max\n return COLUMNS_MAX\n end", "def column_count\n @stkw_config[:max_col]\n end", "def col_max\n return 3\n end", "def col_max\n return 3\n end", "def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end", "def col_max; 1; end", "def max_column\n @co...
[ "0.82210004", "0.8045892", "0.78575754", "0.78575754", "0.7777735", "0.7736931", "0.76469964", "0.75327504", "0.74850196", "0.74296576", "0.72879344", "0.71134454", "0.7041388", "0.6988903", "0.6958766", "0.694709", "0.68892676", "0.6876457", "0.6855992", "0.6836112", "0.6833...
0.65784144
30
Sets the maximum number columns postgres has, default 32
def multi_column_index_limit=(limit) @multi_column_index_limit = limit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multi_column_index_limit\n @multi_column_index_limit ||= 32\n end", "def column_count\n @stkw_config[:max_col]\n end", "def max_columns(fit = T.unsafe(nil)); end", "def col_max\n return COLUMNS_MAX\n end", "def column_size; end", "def col_max\n return 3\n end", "def col_max\...
[ "0.72646683", "0.7222167", "0.7081919", "0.70497626", "0.69742495", "0.6940036", "0.6940036", "0.69376117", "0.6903729", "0.68896174", "0.68542325", "0.6774157", "0.65645534", "0.6507497", "0.6483057", "0.64464056", "0.64464056", "0.64464056", "0.64464056", "0.64464056", "0.6...
0.6283383
45
ORDER BY clause for the passed order option. PostgreSQL does not allow arbitrary ordering when using DISTINCT ON, so we work around this by wrapping the SQL as a subselect and ordering in that query.
def add_order_by_for_association_limiting!(sql, options) return sql if options[:order].blank? order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?) order.map! { |s| 'DESC' if s =~ /\bdesc$/i } order = order.zip((0...order.size).to_a).map { |s,i| "id_list.alias_#{i} #{s}" }.join(', ') sql.replace "SELECT * FROM (#{sql}) AS id_list ORDER BY #{order}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! {|s| $1 if s =~ / (.*)/}\n order = order.zip((0...order.size).to_a).map { |s,i| \"alias_#{i}__ #{s...
[ "0.6134109", "0.60669523", "0.5705502", "0.5665877", "0.5580751", "0.5525618", "0.5510564", "0.5443104", "0.5417115", "0.541378", "0.5389493", "0.53597516", "0.5353679", "0.5350966", "0.5333209", "0.53184986", "0.5309281", "0.53004885", "0.52951705", "0.5287928", "0.5279552",...
0.59793067
4
Changes the column of a table.
def change_column(table_name, column_name, type, options = {}) quoted_table_name = quote_table_name(table_name) quoted_column_name = quote_table_name(column_name) sql_type = type_to_sql(type, options[:limit], options[:precision], options[:scale]) sql_type << "[]" if options[:array] sql = "ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quoted_column_name} TYPE #{sql_type}" sql << " USING #{options[:using]}" if options[:using] if options[:cast_as] sql << " USING CAST(#{quoted_column_name} AS #{type_to_sql(options[:cast_as], options[:limit], options[:precision], options[:scale])})" end begin execute sql rescue ActiveRecord::StatementInvalid => e raise e if postgresql_version > 80000 change_column_pg7(table_name, column_name, type, options) end change_column_default(table_name, column_name, options[:default]) if options_include_default?(options) change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_column(table_name, name, new_type)\n column_functional(table_name) do\n change_table_column(name, new_type)\n end\n end", "def update_table_column(column)\n changes_to_commit << ColumnChange::Update.from_column(column)\n end", "def update_column(name, value)\n update...
[ "0.77239585", "0.7592092", "0.7339102", "0.7339102", "0.7339102", "0.7021388", "0.69154227", "0.6896189", "0.68841517", "0.6877356", "0.6865902", "0.6842818", "0.68283623", "0.68016744", "0.67917764", "0.67917764", "0.66840744", "0.66840744", "0.66828984", "0.6656294", "0.661...
0.65219474
24
Returns the list of all column definitions for a table.
def columns(table_name, name = nil) column_definitions(table_name).map! do |row| # |name, type, default, notnull, oid, fmod| name = row[0]; type = row[1]; default = row[2] notnull = row[3]; oid = row[4]; fmod = row[5] # oid = OID::TYPE_MAP.fetch(oid.to_i, fmod.to_i) { OID::Identity.new } notnull = notnull == 't' if notnull.is_a?(String) # JDBC gets true/false # for ID columns we get a bit of non-sense default : # e.g. "nextval('mixed_cases_id_seq'::regclass" if default =~ /^nextval\(.*?\:\:regclass\)$/ default = nil elsif default =~ /^\(([-+]?[\d\.]+)\)$/ # e.g. "(-1)" for a negative default default = $1 end Column.new(name, default, oid, type, ! notnull, fmod, self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_definitions(table_name)\n select_rows(<<-end_sql, 'SCHEMA')\n SELECT a.attname, format_type(a.atttypid, a.atttypmod),\n pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,\n (SELECT c.collname FROM pg_collation c, pg_type t\n WH...
[ "0.80546963", "0.80455476", "0.8016148", "0.7996285", "0.7994305", "0.78834194", "0.78243035", "0.7761881", "0.7656398", "0.75385654", "0.7536969", "0.7514932", "0.7410929", "0.71379685", "0.7116045", "0.7092843", "0.70138776", "0.69947165", "0.69848806", "0.6975687", "0.6955...
0.70009285
17
Returns the list of a table's column names, data types, and default values. If the table name is not prefixed with a schema, the database will take the first match from the schema search path. Query implementation notes: format_type includes the column size constraint, e.g. varchar(50) ::regclass is a function that gives the id for a table name
def column_definitions(table_name) select_rows(<<-end_sql, 'SCHEMA') SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum end_sql end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_definitions(table_name) #:nodoc:\n query <<-end_sql\nselect\nc.name,\ncase\nwhen t.name in ('char', 'varchar', 'nchar', 'nvarchar') then 'string'\nwhen t.name in ('binary', 'varbinary', 'image') then 'binary'\nwhen t.name in ('int', 'smallint', 'tinyint') then 'integer'\nwhen t.name in ('dateti...
[ "0.6954561", "0.67462045", "0.6560247", "0.6547095", "0.6533019", "0.65266925", "0.65121603", "0.65011084", "0.64240646", "0.63999397", "0.6389897", "0.6355515", "0.63020116", "0.6291003", "0.6288733", "0.6286242", "0.62824994", "0.623786", "0.6224074", "0.61888874", "0.61649...
0.6555478
3
Returns true if table exists. If the schema is not specified as part of +name+ then it will only find tables within the current schema search path (regardless of permissions to access tables in other schemas)
def table_exists?(name) schema, table = extract_schema_and_table(name.to_s) return false unless table binds = [[nil, table]] binds << [nil, schema] if schema sql = "#{TABLE_EXISTS_SQL_PREFIX} AND n.nspname = #{schema ? "?" : 'ANY (current_schemas(false))'}" log(sql, 'SCHEMA', binds) do @connection.execute_query_raw(sql, binds).first['table_count'] > 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_exists?(name)\n return false unless name\n schema ? @connection.table_exists?(name, schema) : @connection.table_exists?(name)\n end", "def table_exists?(name)\n begin \n if respond_to?(:tables)\n tables.include?(name.to_sym)\n else\n from(name).first\n ...
[ "0.8448597", "0.8000776", "0.79579175", "0.7742698", "0.7547951", "0.7493043", "0.74601924", "0.7431377", "0.73941594", "0.7381231", "0.73081815", "0.72593695", "0.7224052", "0.7195111", "0.7169875", "0.7106428", "0.7104358", "0.709668", "0.7078591", "0.69815505", "0.6957576"...
0.8454061
0
Returns an array of indexes for the given table.
def indexes(table_name, name = nil) # NOTE: maybe it's better to leave things of to the JDBC API ?! result = select_rows(<<-SQL, 'SCHEMA') SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid FROM pg_class t INNER JOIN pg_index d ON t.oid = d.indrelid INNER JOIN pg_class i ON d.indexrelid = i.oid WHERE i.relkind = 'i' AND d.indisprimary = 'f' AND t.relname = '#{table_name}' AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) ) ORDER BY i.relname SQL result.map! do |row| index_name = row[0] unique = row[1].is_a?(String) ? row[1] == 't' : row[1] # JDBC gets us a boolean # NOTE: this hack should no longer be needed ... # indkey = row[2].is_a?(Java::OrgPostgresqlUtil::PGobject) ? row[2].value : row[2] # indkey = indkey.split(" ") indkey = row[2].split(' ') inddef = row[3] oid = row[4] columns = select_rows(<<-SQL, "SCHEMA") SELECT a.attnum, a.attname FROM pg_attribute a WHERE a.attrelid = #{oid} AND a.attnum IN (#{indkey.join(",")}) SQL columns = Hash[ columns.each { |column| column[0] = column[0].to_s } ] column_names = columns.values_at(*indkey).compact unless column_names.empty? # add info on sort order for columns (only desc order is explicitly specified, asc is the default) desc_order_columns = inddef.scan(/(\w+) DESC/).flatten orders = desc_order_columns.any? ? Hash[ desc_order_columns.map { |column| [column, :desc] } ] : {} if ::ActiveRecord::VERSION::MAJOR > 3 # AR4 supports `where` and `using` index options where = inddef.scan(/WHERE (.+)$/).flatten[0] using = inddef.scan(/USING (.+?) /).flatten[0].to_sym IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, nil, using) else new_index_definition(table_name, index_name, unique, column_names, [], orders) end end end result.compact! result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_indexes(table)\n ActiveRecord::Base.connection.indexes(table)\n end", "def table_indexes(table)\n ActiveRecord::Base.connection.indexes(table)\n end", "def indexes(_table_name, _name = nil)\n []\n end", "def indexes(table_name)\n idxs = {}\n results = f...
[ "0.7326864", "0.7326864", "0.70605785", "0.6953402", "0.6902476", "0.6902476", "0.68804276", "0.6752953", "0.6717308", "0.6651276", "0.658954", "0.6574899", "0.65557", "0.65557", "0.65130496", "0.6463026", "0.6362401", "0.63197696", "0.6310384", "0.6302736", "0.6284162", "0...
0.5829135
42
TODO: glue code till we migrate Kubernetes Service into Platforms::Kubernetes class
def manages_kubernetes_service? return true unless kubernetes_service&.active? kubernetes_service.api_url == api_url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pods\n\nend", "def deploy_type\n :kubernetes\n end", "def label_base\n 'app.kubernetes.io'\n end", "def cluster(cmd, registry:nil)\n puts(\":: Deploying Kubernetes Cluster...\".colorize(:light_yellow))\n proxy_export = \"[ -f /etc/profile.d/setproxy.sh ] && source /etc/profile.d/setproxy.sh...
[ "0.67726505", "0.63514435", "0.6082713", "0.60078144", "0.59164906", "0.58500886", "0.58333296", "0.57844293", "0.5783632", "0.57833374", "0.5740993", "0.5740443", "0.57242084", "0.5720761", "0.56665915", "0.56338876", "0.5623304", "0.562065", "0.55984944", "0.55722666", "0.5...
0.6011436
3
TODO: test it and fix it
def idp_logout_request logout_request = OneLogin::RubySaml::SloLogoutrequest.new(params[:SAMLRequest], settings: saml_settings) if !logout_request.is_valid? render_logout_failure(logout_request.errors) else session.destroy logout_response = OneLogin::RubySaml::SloLogoutresponse.new.create(saml_settings, logout_request.id, nil, RelayState: params[:RelayState]) redirect_to logout_response end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def suivre; end", "def formation; end", "def terpene; end", "def custom; end", "def custom; end", "def weber; end", "def imp...
[ "0.77457196", "0.6790644", "0.6790644", "0.6790644", "0.6790644", "0.6735703", "0.6710386", "0.64173603", "0.6306021", "0.61606157", "0.6157026", "0.61416304", "0.61416304", "0.6136106", "0.613277", "0.613277", "0.61243415", "0.61105597", "0.60248303", "0.5897691", "0.5881561...
0.0
-1
Return the Google authorization URI
def redirect_uri @client.authorization.authorization_uri.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorization_url\n uri = URI(OAUTH_URL)\n uri.query = {\n client_id: client_id,\n redirect_uri: redirect_uri,\n scope: scope_url,\n response_type: 'code',\n access_type: 'offline'\n }.to_param\n\n uri.to_s\n end", "def authenticate_url\n \"https://accounts.google.c...
[ "0.7913434", "0.7888744", "0.76026654", "0.7590944", "0.7511841", "0.74994844", "0.7441158", "0.742244", "0.7346025", "0.7320332", "0.73193884", "0.7233291", "0.72074896", "0.7188395", "0.7161383", "0.70794725", "0.7060705", "0.7028275", "0.6978434", "0.69714135", "0.6929473"...
0.71163887
15
Attempt to authorize using the given authorization code, return access token TODO: Determine what errors this can throw
def authorize(authcode) @client.authorization.code = authcode @client.authorization.fetch_access_token! @client.authorization.access_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_code(authorization_code)\n client.authorization.code = authorization_code\n client.authorization.fetch_access_token!\n client.authorization.refresh_token ||= oauth_data[:refresh_token]\n oauth_data[:refresh_token] = client.authorization.refresh_token\n end", "def get_access_t...
[ "0.8084547", "0.78736", "0.7850902", "0.77837133", "0.77837133", "0.7754566", "0.76840526", "0.7636256", "0.763521", "0.76308954", "0.7617653", "0.7614504", "0.7613277", "0.7565406", "0.7549716", "0.7549393", "0.7526828", "0.74922484", "0.7442042", "0.74347395", "0.7433079", ...
0.82728106
0
Return current user info, fetch if it does not exist
def user_info @user_info ||= fetch_latest_user_info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end", "def user_info\n @user_info ||= raw_info\n end", "def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n retur...
[ "0.7667246", "0.7362351", "0.732454", "0.72923386", "0.72852415", "0.7163969", "0.7163969", "0.70978266", "0.70874846", "0.7052589", "0.70329577", "0.70177907", "0.7006135", "0.6982538", "0.696204", "0.6957681", "0.69249", "0.6922428", "0.6921659", "0.69210094", "0.69159395",...
0.8045458
0
Fetch and return latest user info
def fetch_latest_user_info @user_info = @client.execute(api_method: @info.userinfo.get).data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend", "def fetch_user(id)\n fetch( :user, id ).last_result_item\n end", "def fetch_user_extended_detail\n @user_extended_detail_obj = UserExtendedDetail.using_client_shard(client: @client).\n get_from_memcache(@user_kyc_detail.us...
[ "0.77316165", "0.71417767", "0.667179", "0.65796137", "0.65777415", "0.65751195", "0.6480807", "0.6464767", "0.643755", "0.64349127", "0.64223015", "0.6402471", "0.63906056", "0.63583046", "0.6332724", "0.6331648", "0.63311136", "0.62712324", "0.62709326", "0.6245452", "0.623...
0.85675085
0
Return current task lists, fetch if it does not exist
def task_lists @task_lists ||= fetch_latest_task_lists end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tasklists\n @tasklists = []\n array = @client.execute(@api.tasklists.list).data.to_hash[\"items\"]\n array.each { |h|\n @tasklists.push Tasklist[h]\n }\n end", "def tasklists\n get gtasks_tasklists_url\n end", "def fetch_latest_task_lists\n\t\tresponse = @client.ex...
[ "0.77946144", "0.7519247", "0.74978673", "0.7494753", "0.7430635", "0.7329773", "0.72395253", "0.70719504", "0.70499635", "0.70225465", "0.6927442", "0.6907527", "0.68976074", "0.689159", "0.6852834", "0.68283844", "0.68044907", "0.67201483", "0.6699318", "0.6694184", "0.6643...
0.8443579
0
Fetch and return latest task lists
def fetch_latest_task_lists response = @client.execute(api_method: @gtasks.tasklists.list) puts "***************** ERROR FETCHING TASK LISTS *****************" if response.status != 200 puts response.body @task_lists = response.data.items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend", "def fetch_latest_everything\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\t\t@task_lists = @client.execute(api_method: @gtasks.tasklists.list).data.items\n\t\t@tasks = Hash.new\n\t\t@task_lists.each do |list|\n\t\t\t...
[ "0.7961965", "0.79400176", "0.79162365", "0.70104474", "0.6898594", "0.6695779", "0.66131246", "0.64955795", "0.64618474", "0.643127", "0.64099044", "0.63433474", "0.63433474", "0.63433474", "0.62394035", "0.6236967", "0.61826205", "0.61590946", "0.6141767", "0.6120137", "0.6...
0.8560403
0
Return the tasks for a list, fetch if it does not exist
def tasks_for(list) @tasks[list] ||= fetch_latest_tasks_for(list) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_latest_tasks_for(list)\n\t\t@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\tend", "def tasks(list)\n list_obj = list.is_a?(Wunderlist::List) ? list : lists[list]\n list = list.id if list.is_a? Wunderlist::List\n\n reques...
[ "0.8088946", "0.76756036", "0.7486368", "0.72100013", "0.7197292", "0.71461475", "0.71006256", "0.7067179", "0.694145", "0.6938234", "0.6799937", "0.67341805", "0.66838557", "0.6632372", "0.6575473", "0.65546745", "0.6546469", "0.65215236", "0.6471903", "0.6462661", "0.640722...
0.8037698
1
Fetch and return latest tasks for a list
def fetch_latest_tasks_for(list) @tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_latest_task_lists\n\t\tresponse = @client.execute(api_method: @gtasks.tasklists.list)\n\t\tputs \"***************** ERROR FETCHING TASK LISTS *****************\" if response.status != 200\n\t\tputs response.body\n\t\t@task_lists = response.data.items\n\tend", "def tasks_for(list)\n\t\t@tasks[list] ||= ...
[ "0.79894245", "0.75466865", "0.7431826", "0.733321", "0.6784899", "0.64888614", "0.6403375", "0.6303735", "0.6271653", "0.6237344", "0.61682165", "0.6163538", "0.6136898", "0.6099376", "0.5972703", "0.5923752", "0.59213805", "0.5901405", "0.5857239", "0.5857239", "0.5857239",...
0.8564092
0
Not sure if the functions below are still needed Fetch user information, task lists, and tasks
def fetch_latest_everything @user_info = @client.execute(api_method: @info.userinfo.get).data @task_lists = @client.execute(api_method: @gtasks.tasklists.list).data.items @tasks = Hash.new @task_lists.each do |list| @tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items end return @user_info, @task_lists, @tasks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_user_tasks\n\t\t@tasks = current_user.get_developer_tasks\n\tend", "def index\n secretary = is_secretary?\n if secretary\n user_ids = [current_user.id]\n cluster_livian_user_ids = @cluster_livian_users.map(&:id)\n else\n cluster_livian_user_ids = @user_ids\n user_ids = get_u...
[ "0.73423994", "0.7002985", "0.6926264", "0.69018227", "0.6771736", "0.66724", "0.6665811", "0.6665607", "0.66279423", "0.66275036", "0.65956444", "0.65941924", "0.65798354", "0.65619224", "0.65557986", "0.6530871", "0.65145993", "0.65111333", "0.6486124", "0.6482184", "0.6481...
0.75269526
0
override this method if you need to initialize more complex RDF assertions (bnodes)
def initialize_fields terms_for_editing.each do |key| # if value is empty, we create an one element array to loop over for output self[key] = [''] if self[key].empty? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_initialize_node\n \tassert_equal @n.id, 0\n \tassert_equal @n.neighbors, []\n \tassert_equal @n.string, \"a\"\n end", "def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end", "de...
[ "0.6109263", "0.6102131", "0.60251534", "0.60044277", "0.60044277", "0.5898908", "0.5842393", "0.5632072", "0.56114507", "0.56022984", "0.5582043", "0.5582043", "0.5575771", "0.5559089", "0.55469656", "0.55179566", "0.5509657", "0.54999053", "0.54869807", "0.54869807", "0.548...
0.0
-1
override this method if you need to initialize more complex RDF assertions (bnodes)
def initialize_fields(file) file.initialize_fields end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_initialize_node\n \tassert_equal @n.id, 0\n \tassert_equal @n.neighbors, []\n \tassert_equal @n.string, \"a\"\n end", "def initialize(*args)\n super\n decorators(Nokogiri::XML::Node) << Nokogiri::Decorators::XBEL\n decorate!\n\n# self.root = '<xbel version=\"1.0\"></xbel>'\n end", "de...
[ "0.61096287", "0.61026096", "0.60258615", "0.6005416", "0.6005416", "0.5899506", "0.58442414", "0.5632908", "0.56105036", "0.5604386", "0.5583266", "0.5583266", "0.55767006", "0.55602187", "0.55477047", "0.5519956", "0.55107015", "0.54999447", "0.5488077", "0.5488077", "0.548...
0.0
-1
GET /rate_ups GET /rate_ups.json
def index @rate_ups = RateUp.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rates; end", "def rates; end", "def get_rates(options={})\n post 'rates/full', options\n end", "def saw\n @rates = Rate.all\n end", "def set_rate_up\n @rate_up = RateUp.find(params[:id])\n end", "def ups_info\n ups_client.find_rates(order.origin, order.destination, order.pa...
[ "0.668675", "0.668675", "0.6684046", "0.6479226", "0.6473042", "0.6435121", "0.6271397", "0.6271397", "0.6271397", "0.6271397", "0.61497074", "0.61411524", "0.61362785", "0.61137503", "0.6081196", "0.60706735", "0.6032721", "0.6031574", "0.6014538", "0.59166175", "0.59119964"...
0.7315471
0
GET /rate_ups/1 GET /rate_ups/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @rate_ups = RateUp.all\n end", "def get_rates(options={})\n post 'rates/full', options\n end", "def set_rate_up\n @rate_up = RateUp.find(params[:id])\n end", "def get_rate(id:)\n @client.http_get(\"/#{@resource}/#{id}/rate\")\n end", "def saw\n @rates = Ra...
[ "0.71263885", "0.6712682", "0.66780967", "0.6554923", "0.65200543", "0.65161306", "0.65161306", "0.6489995", "0.6489995", "0.6489995", "0.6489995", "0.6463618", "0.6283123", "0.62782615", "0.6230171", "0.62040675", "0.61623085", "0.6145185", "0.6093325", "0.6084237", "0.60708...
0.0
-1
POST /rate_ups POST /rate_ups.json
def create user_id = current_user.id review_id = params[:review_id] puts user_id, review_id if RateUp.exists?(user_id: user_id, review_id: review_id) RateUp.find_by(user_id: user_id, review_id: review_id).delete else RateDown.find_by(user_id: user_id, review_id: review_id).delete if RateDown.exists?(user_id: user_id, review_id: review_id) RateUp.create(user_id: user_id, review_id: review_id) end @review = Review.find(review_id) respond_to do |format| format.js { } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rate_up_params\n params.require(:rate_up).permit(:user_id, :review_id)\n end", "def set_rate_up\n @rate_up = RateUp.find(params[:id])\n end", "def create\n @rate = Rate.new(rate_params)\n\n respond_to do |format|\n if @rate.save\n format.html { redirect_to @rate, notice: '...
[ "0.67367816", "0.6412249", "0.62789464", "0.62789464", "0.62789464", "0.6271066", "0.6227276", "0.62187773", "0.61201686", "0.60955435", "0.6078377", "0.60743976", "0.5993365", "0.59051794", "0.5890705", "0.58827657", "0.5878225", "0.58515257", "0.58219117", "0.5818017", "0.5...
0.60439503
12
PATCH/PUT /rate_ups/1 PATCH/PUT /rate_ups/1.json
def update respond_to do |format| if @rate_up.update(rate_up_params) format.html { redirect_to @rate_up, notice: 'Rate up was successfully updated.' } format.json { render :show, status: :ok, location: @rate_up } else format.html { render :edit } format.json { render json: @rate_up.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to @rate, notice: 'Rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rate.errors, stat...
[ "0.6832943", "0.68065256", "0.68061864", "0.68061864", "0.6804451", "0.671245", "0.6548282", "0.6506951", "0.6424184", "0.6413859", "0.6364725", "0.6325781", "0.63136166", "0.6294606", "0.6291954", "0.62176543", "0.61737746", "0.61660653", "0.61460245", "0.6133424", "0.612302...
0.725162
0
DELETE /rate_ups/1 DELETE /rate_ups/1.json
def destroy @rate_up.destroy respond_to do |format| format.html { redirect_to rate_ups_url, notice: 'Rate up was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @run_at_rate = RunAtRate.find(params[:id])\n @run_at_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to r...
[ "0.7090342", "0.69682384", "0.69595873", "0.69362783", "0.69362783", "0.69362783", "0.6928985", "0.69173586", "0.6830869", "0.67984116", "0.6658632", "0.66104424", "0.6567958", "0.65498245", "0.6532136", "0.6531539", "0.6520857", "0.6515044", "0.65133095", "0.65014076", "0.64...
0.7572211
0
Use callbacks to share common setup or constraints between actions.
def set_rate_up @rate_up = RateUp.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Only allow a list of trusted parameters through.
def rate_up_params params.require(:rate_up).permit(:user_id, :review_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69485277", "0.6813547", "0.6799911", "0.6796169", "0.6745757", "0.6741778", "0.6527065", "0.65204644", "0.64925444", "0.64314413", "0.64314413", "0.64314413", "0.6398711", "0.6355623", "0.6355327", "0.6345812", "0.6343951", "0.6338371", "0.6327366", "0.6327366", "0.6327366...
0.0
-1
parameter getters and setters datastore params
def datastore result = splunk_exec("show",["datastore-dir"]) result = result.to_s.split(':')[1].strip return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param(* args)\n if args.length == 2\n key, value = args\n new_params = get_params # get_params needs to return a dup and re-set it so DM knows it's dirty\n new_params[key.to_s] = value\n attribute_set(:params, new_params)\n elsif args.length == 1\n key = args.first\n get_par...
[ "0.7297845", "0.68849945", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68597823", "0.68464476",...
0.0
-1
GET /capitals GET /capitals.json
def index @capitals = Capital.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @capital_account = CapitalAccount.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @capital_account }\n end\n end", "def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html...
[ "0.61255276", "0.60732526", "0.60420364", "0.60246193", "0.6008408", "0.5995294", "0.5935017", "0.5818346", "0.5816992", "0.57894486", "0.5707944", "0.56671935", "0.56671935", "0.56094515", "0.55417603", "0.54989976", "0.54947513", "0.5493647", "0.5491327", "0.5487513", "0.54...
0.72020435
0
GET /capitals/1 GET /capitals/1.json
def show; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @capitals = Capital.all\n end", "def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end", "def show\n @capacite = Capacite.find(params[:id])\n\n respond...
[ "0.699566", "0.69132084", "0.69108444", "0.66981405", "0.6481934", "0.6445642", "0.6243356", "0.62200695", "0.62200695", "0.61373687", "0.61358577", "0.600365", "0.600017", "0.59933406", "0.59920746", "0.59823817", "0.59607345", "0.59575576", "0.59575576", "0.59459305", "0.59...
0.0
-1
POST /capitals POST /capitals.json
def create @capital = Capital.new(capital_params) respond_to do |format| if @capital.save format.html { redirect_to @capital, notice: 'Capital was successfully created.' } format.json { render :show, status: :created, location: @capital } else format.html { render :new } format.json { render json: @capital.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @capacitacion = Capacitacion.new(params[:capacitacion])\n\n respond_to do |format|\n if @capacitacion.save\n format.html { redirect_to @capacitacion, notice: 'Capacitacion was successfully created.' }\n format.json { render json: @capacitacion, status: :created, location: @cap...
[ "0.5806922", "0.57922095", "0.5767812", "0.5743742", "0.56486183", "0.5571623", "0.5560296", "0.55600256", "0.55354446", "0.5509604", "0.5467003", "0.54452866", "0.54282606", "0.54127556", "0.5378213", "0.53546536", "0.53362435", "0.5321196", "0.5315702", "0.5315051", "0.5308...
0.666186
0
PATCH/PUT /capitals/1 PATCH/PUT /capitals/1.json
def update respond_to do |format| if @capital.update(capital_params) format.html { redirect_to @capital, notice: 'Capital was successfully updated.' } format.json { render :show, status: :ok, location: @capital } else format.html { render :edit } format.json { render json: @capital.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capi...
[ "0.6725625", "0.6518976", "0.65039986", "0.6434508", "0.6331531", "0.6330417", "0.6322905", "0.6280592", "0.6259024", "0.6253814", "0.62430626", "0.622729", "0.6154257", "0.6148737", "0.61179936", "0.6101319", "0.60961574", "0.608188", "0.60817695", "0.6079272", "0.6078945", ...
0.6729756
0
DELETE /capitals/1 DELETE /capitals/1.json
def destroy @capital.destroy respond_to do |format| format.html { redirect_to capitals_url, notice: 'Capital was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capa = Capa.find(params[:id])\n @capa.destroy\n\n respon...
[ "0.7183522", "0.71001416", "0.7071206", "0.7071206", "0.7002908", "0.6964451", "0.6943694", "0.6906855", "0.6889307", "0.68581843", "0.6825944", "0.67325497", "0.6714653", "0.6671501", "0.66505015", "0.6623366", "0.6622422", "0.6608271", "0.65936106", "0.65738434", "0.6573587...
0.71858335
0
Use callbacks to share common setup or constraints between actions.
def set_capital @capital = Capital.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def capital_params params.require(:capital).permit(:sum, :user, :local, :deleted) 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
This method gets called when your app is installed. setup any webhooks or services you need on Shopify inside here.
def install shopify_session do # create an uninstall webhook, this webhook gets sent # when your app is uninstalled from a shop. It is good # practice to clean up any data from a shop when they # uninstall your app. uninstall_webhook = ShopifyAPI::Webhook.new({ topic: "app/uninstalled", address: "#{base_url}/uninstall", format: "json" }) uninstall_webhook.save end redirect '/' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_shopify_auth\n shopify_session do |shop_name| # => Shopify hook\n\n ##################################################\n ##################################################\n\n #######################\n ## Uninstall Webhook ##\n #######################\n\n # => Allows us to re...
[ "0.66865647", "0.65800947", "0.6484519", "0.60223085", "0.5997042", "0.59952474", "0.5979839", "0.5829347", "0.58125526", "0.57698256", "0.57695323", "0.57381105", "0.5611748", "0.5538578", "0.54266423", "0.5418646", "0.5403521", "0.54015595", "0.5400087", "0.5398531", "0.538...
0.7315784
0
MVP1a has users using a single profile
def mvp_profile owned_profiles.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_profile?\n return self.profile.present?\n end", "def has_profile?(*profiles)\r\n@has_profiles ||= {}\r\nprofile = profiles.shift\r\nreturn true if self.new_record? && profile == 'Not Logged'\r\n@has_profiles[profile] = case profile\r\nwhen nil\r\n false\r\nwhen Fixnum\r\n self.profile_ids.include?(...
[ "0.6879863", "0.664966", "0.6623213", "0.6534181", "0.65022695", "0.6456362", "0.6454901", "0.6405457", "0.6403929", "0.64032257", "0.63886863", "0.6378293", "0.6378293", "0.6375596", "0.6371771", "0.63553727", "0.63553727", "0.6353823", "0.63503236", "0.6337485", "0.63264585...
0.6114016
53
has_many :reviewers, through: :reviews, source: :user
def avg_score reviews.average(:rating).round(2).to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_reviews\n self.reviews.select do |review|\n review.user.id = self.id \n end \n end", "def user_reviews\n Review.all.select {|review| review.user == self}\n end", "def reviews\n Review.all.select do |r|\n r.user == self\n end\n end", "def reviewers\n revi...
[ "0.7559032", "0.725929", "0.704901", "0.69576526", "0.670105", "0.65472263", "0.6544776", "0.6385618", "0.6371619", "0.6308246", "0.6252142", "0.62368786", "0.62066936", "0.6184977", "0.6176834", "0.6074876", "0.60537916", "0.6029315", "0.5996251", "0.59818065", "0.5956205", ...
0.0
-1
Pass an optional argument of true to get ending month's date (default is false)
def to_date(last_month = false) date_month = last_month ? MONTHS[season].last : MONTHS[season].first date_year = season_code == 15 ? year_code : year_code + 1 if last_month Date.new(date_year, date_month).end_of_month else Date.new(date_year, date_month) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_of_month\n @end_of_month ||= date_calc.end_of_month(year, merch_month)\n end", "def end_date\n weekday = end_of_month.cwday\n offset = weekday == 7 ? 0 : (7 - weekday).days\n end_of_month + offset\n end", "def end_of_year\n change(month: 12).end_of_month\n end", "def...
[ "0.75428784", "0.7512136", "0.73731136", "0.73198795", "0.73016757", "0.7161991", "0.71391475", "0.70286757", "0.6925116", "0.6878292", "0.67871606", "0.6770507", "0.6764843", "0.6741564", "0.66051096", "0.66020876", "0.6601226", "0.6599377", "0.65869915", "0.6583463", "0.653...
0.6140476
54
Returns the number of quarters from the quarter to the given operand
def -(other) other_quarter = Quarter.new(other) seasons = season_difference(other_quarter) years = year_difference(other_quarter) years * 4 + seasons end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quarter\n (month / 3.0).ceil\n end", "def quarter\n (month / 3.0).ceil\n end", "def quarters_since(date)\n\t\t\t(months_since(date) / 3).to_i\n\t\tend", "def quarter\n case merch_month\n when 7,8,9\n return 1\n when 10,11,12\n return 2\n when 1,2,3\n r...
[ "0.7076837", "0.70139486", "0.6930322", "0.67741996", "0.65275544", "0.6454134", "0.62920994", "0.62120205", "0.62120205", "0.61989415", "0.6157433", "0.6077673", "0.6025391", "0.59872025", "0.59167194", "0.5902213", "0.5865544", "0.5865544", "0.57936907", "0.5791417", "0.578...
0.48941508
60
generation_number 1 is parent, 2 is grandparent and so on default is 3 for great grandparent
def ancestor_options(generation_number = 3) ensure_ancestor(generation_number) { |ancestor_context| context_hash(ancestor_context)[:options] || {} } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_childs_number\n @@default_childs_number ||= 1\n end", "def parentage\n get_parents unless @already_fetched_parents\n @already_fetched_parents = true\n super\n end", "def fourth_child\n child 3\n end", "def genus_group_parent\n [ parent_at_rank('subgenus'), paren...
[ "0.71837527", "0.67571026", "0.6626209", "0.65147203", "0.64949656", "0.6397087", "0.6243165", "0.62224036", "0.6193233", "0.6173199", "0.6162608", "0.6151549", "0.6128197", "0.609022", "0.609022", "0.60424185", "0.60416794", "0.59439594", "0.5926671", "0.5915033", "0.5906373...
0.0
-1
Tells the gallery view if it's on the search page or not.
def on_search_page? params['controller'] == 'catalog' && params['action'] == 'index' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search\n redirect_to gallery_path(search_params)\n end", "def search?\n self.rel == \"search\"\n end", "def search?\n type == :search\n end", "def show_search_box?\n (controller.controller_name.eql? \"catalog\")\n end", "def search\n # if the user ha...
[ "0.701925", "0.7015587", "0.6949109", "0.658491", "0.65269554", "0.64708835", "0.63936216", "0.63561875", "0.63561875", "0.63008946", "0.6293054", "0.6252631", "0.6235762", "0.61917084", "0.6182503", "0.614425", "0.6134733", "0.6120621", "0.61142623", "0.6113149", "0.6101574"...
0.69105977
3
Tells the gallery view if it's in the collection dashboard or not.
def on_edit_page? params['controller'] == 'hyrax/dashboard/collections' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if @current_user_permissions.find_by(permission_name: \"View Default Gallery Settings\").value == false\n @not_authorized = true\n end\n if @current_user_permissions.find_by(permission_name: \"Add Default Gallery Settings\").value == false\n @not_authorized_to_add = true\n end\n ...
[ "0.6541047", "0.62627554", "0.62233317", "0.61413676", "0.612785", "0.6075101", "0.6038277", "0.6037156", "0.5998868", "0.59775203", "0.5969652", "0.5960366", "0.5947158", "0.5933259", "0.59278667", "0.59278667", "0.59278667", "0.5920875", "0.59170425", "0.59130955", "0.58960...
0.61191547
5
Helper to get the configured serializer class.
def get_serializer_class return self.class.serializer_class end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_serializer(klass)\n klass.instance_variable_get(SERIALIZER_CLASS)\n end", "def serializer_class\n \"#{self.class.to_s}Serializer\".constantize\n end", "def get_serializer_class\n return self.class.serializer_class || RESTFramework::NativeSerializer\n end", "def serializer_by_opti...
[ "0.79923445", "0.78957826", "0.77884704", "0.76943856", "0.7588404", "0.7242295", "0.7198957", "0.71306235", "0.7098962", "0.70893", "0.69134235", "0.6797844", "0.66329616", "0.6477564", "0.6464672", "0.6384674", "0.63569033", "0.63569033", "0.63545555", "0.6338838", "0.63228...
0.7654012
4
Helper to get filtering backends, defaulting to no backends.
def get_filter_backends return self.class.filter_backends || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filter_backends\n return self.class.filter_backends || [\n RESTFramework::ModelFilter, RESTFramework::ModelOrderingFilter\n ]\n end", "def backends; end", "def merged_backends\n return []\n end", "def backends\n # Lets cache the values and return the cache\n if @backends...
[ "0.77599996", "0.62652385", "0.6212729", "0.6174745", "0.59901464", "0.5923429", "0.5895099", "0.5834676", "0.5815357", "0.5686847", "0.5680805", "0.56532794", "0.5641446", "0.55821127", "0.5556181", "0.55240047", "0.5494901", "0.5485515", "0.54396737", "0.5438238", "0.542687...
0.7855189
0
Helper to filter an arbitrary data set over all configured filter backends.
def get_filtered_data(data) self.get_filter_backends.each do |filter_class| filter = filter_class.new(controller: self) data = filter.get_filtered_data(data) end return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filter_backends\n return self.class.filter_backends || []\n end", "def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end", "def filter_on(values)\n @filters << values\n end", "def get_filter_backends\n return self.class.filter_backends || [\n REST...
[ "0.654663", "0.64333403", "0.6421861", "0.63987684", "0.6263033", "0.6263033", "0.6263033", "0.6214779", "0.6214779", "0.6075352", "0.6073691", "0.60722715", "0.6064449", "0.6044223", "0.60286736", "0.6003177", "0.59896576", "0.5983842", "0.5948163", "0.5943584", "0.5929396",...
0.66097534
0
Helper to render a browsable API for `html` format, along with basic `json`/`xml` formats, and with support or passing custom `kwargs` to the underlying `render` calls.
def api_response(payload, html_kwargs: nil, **kwargs) html_kwargs ||= {} json_kwargs = kwargs.delete(:json_kwargs) || {} xml_kwargs = kwargs.delete(:xml_kwargs) || {} # Raise helpful error if payload is nil. Usually this happens when a record is not found (e.g., # when passing something like `User.find_by(id: some_id)` to `api_response`). The caller should # actually be calling `find_by!` to raise ActiveRecord::RecordNotFound and allowing the REST # framework to catch this error and return an appropriate error response. if payload.nil? raise RESTFramework::NilPassedToAPIResponseError end respond_to do |format| if payload == '' format.json {head :no_content} if self.serialize_to_json format.xml {head :no_content} if self.serialize_to_xml else format.json { jkwargs = kwargs.merge(json_kwargs) render(json: payload, layout: false, **jkwargs) } if self.serialize_to_json format.xml { xkwargs = kwargs.merge(xml_kwargs) render(xml: payload, layout: false, **xkwargs) } if self.serialize_to_xml # TODO: possibly support more formats here if supported? end format.html { @payload = payload if payload == '' @json_payload = '' if self.serialize_to_json @xml_payload = '' if self.serialize_to_xml else @json_payload = payload.to_json if self.serialize_to_json @xml_payload = payload.to_xml if self.serialize_to_xml end @template_logo_text ||= "Rails REST Framework" @title ||= self.controller_name.camelize @route_groups ||= RESTFramework::Utils::get_routes(Rails.application.routes, request) hkwargs = kwargs.merge(html_kwargs) begin render(**hkwargs) rescue ActionView::MissingTemplate # fallback to rest_framework layout hkwargs[:layout] = "rest_framework" hkwargs[:html] = '' render(**hkwargs) end } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(opts = {}, &block)\n \n opts[:status] = 200 if !opts[:status]\n if opts[:to_yaml] then\n headers[\"Content-Type\"] = \"text/plain;\"\n yaml = Hash.from_xml(render_to_string(:template => opts[:to_yaml], :layout => false)).to_yaml\n render :text => yaml, :layout => false, :status =>...
[ "0.69209325", "0.6733052", "0.6704015", "0.66326666", "0.66065663", "0.65437114", "0.64898777", "0.64898777", "0.6460824", "0.6447295", "0.6431436", "0.6395922", "0.6371903", "0.63309443", "0.6326745", "0.6326745", "0.6326745", "0.6326745", "0.63236254", "0.6301992", "0.63000...
0.6726303
2
GET /owners GET /owners.json
def index @owners = Owner.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end", "def owners\n @data['owners']\n end", "def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end", "def get_owner_info(owner)\n get(\"/owners/#{owner}/info\")\n...
[ "0.87634796", "0.76883537", "0.764214", "0.76315665", "0.76141655", "0.74758077", "0.7462815", "0.72669667", "0.72082186", "0.71019614", "0.7001162", "0.6888021", "0.6879324", "0.68341297", "0.6832423", "0.67294383", "0.67027074", "0.6662568", "0.6623365", "0.6611796", "0.659...
0.7514305
5
GET /owners/1 GET /owners/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end", "def get_owner_info(owner)\n get(\"/owners/#{owner}/info\")\n end", "def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end", "def owners\n @data['owners']\n end", "def index\n ...
[ "0.8292748", "0.7701442", "0.75728375", "0.7433085", "0.7425615", "0.7425615", "0.74202394", "0.74068636", "0.72421885", "0.72229606", "0.70718235", "0.6993453", "0.698365", "0.68529195", "0.68367237", "0.6823126", "0.6721507", "0.67023826", "0.66765386", "0.6628654", "0.6610...
0.0
-1
POST /owners POST /owners.json
def create @owner = Owner.new(owner_params) respond_to do |format| if @owner.save format.html { redirect_to @owner, flash: { success: "Owner was successfully created." } } format.json { render action: 'show', status: :created, location: @owner } else format.html { render action: 'new' } format.json { render json: @owner.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @owner = Owner.new(owner_params)\n\n respond_to do |format|\n if @owner.save\n format.html { redirect_to @owner, notice: 'Owner was successfully created.' }\n format.json { render :show, status: :created, location: @owner }\n else\n format.html { render :new }\n ...
[ "0.693688", "0.68319446", "0.6783796", "0.6745546", "0.66276467", "0.66271645", "0.658327", "0.6496273", "0.64793736", "0.6375324", "0.635942", "0.6334309", "0.6308638", "0.62883955", "0.62452996", "0.62452996", "0.6176408", "0.61308974", "0.6129049", "0.61146474", "0.6103661...
0.67687315
3
PATCH/PUT /owners/1 PATCH/PUT /owners/1.json
def update respond_to do |format| if @owner.update(owner_params) format.html { redirect_to @owner, flash: { success: "Owner was successfully updated." } } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @owner.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to owners_path, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.7227713", "0.7104449", "0.7075864", "0.7075864", "0.694313", "0.69174606", "0.68041974", "0.6543467", "0.6489183", "0.6394438", "0.6327567", "0.62104875", "0.61953", "0.61719227", "0.6155692", "0.6154373", "0.61467314", "0.6110235", "0.6068606", "0.6060226", "0.6023277", ...
0.70310074
4
DELETE /owners/1 DELETE /owners/1.json
def destroy @owner.destroy respond_to do |format| format.html { redirect_to owners_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @owner = Owner.find(params[:id])\n @owner.destroy\n\n respond_to do |format|\n format.html { redirect_to owners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url, not...
[ "0.78404737", "0.76345766", "0.7601915", "0.7505621", "0.7505621", "0.7505621", "0.7463591", "0.7370988", "0.71954787", "0.7117315", "0.7089099", "0.7048217", "0.6943018", "0.68213993", "0.6809423", "0.6751331", "0.6738986", "0.6735351", "0.67319787", "0.669673", "0.66813034"...
0.7822245
1
Use callbacks to share common setup or constraints between actions.
def set_owner @owner = Owner.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 owner_params params.require(:owner).permit(:cpf_cnpj, :rg, :data_emissao, :orgao_emissor, :nome, :fantasia, :inscricao_estadual, :instricao_municipal, :endereco, :numero, :complemento, :bairro, :cidade, :estado, :cep, :obs, emails_attributes: [:setor, :contato, :email, :comprovante, :id, :_destroy], contacts_attributes: [:contact, :tipo, :nome, :fone, :complemento, :id, :_destroy], ownerships_attributes: [:vehicle_id, :id, :_destroy] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
Everything below here is private
def initialize(form, field, type) @klass = form.object.class @template = form.template @year = form.object.year @field = field @type = type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def probers; end", "def implementation; end", "def implementation; end", "def private_method\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def custom; end", "def custom; end", "def schubert; end", "def we...
[ "0.89133704", "0.73518765", "0.720192", "0.7188501", "0.7188501", "0.70366126", "0.69270426", "0.69270426", "0.69270426", "0.69270426", "0.6893329", "0.6893329", "0.6804914", "0.6784592", "0.66542155", "0.66542155", "0.66445816", "0.66445816", "0.66445816", "0.66445816", "0.6...
0.0
-1
Groups this user owns.
def owned_groups codes = Hydra::LDAP.groups_owned_by_user(uid) #puts "codes: #{codes}" Group.find_all_by_code(codes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owned_groups\n @owned_groups = Group.where(\"owner_id = ?\", current_user)\n end", "def groups\n Group.groups(user_name)\n end", "def manage_groups\n @other_user = @login_user\n @groups = @login_user.groups\n end", "def group_owner\n User.find_by(id: self.user_id)\n end", "def us...
[ "0.7534486", "0.7166708", "0.68952787", "0.6737783", "0.6594599", "0.65130055", "0.64330447", "0.6432723", "0.6422232", "0.63250864", "0.62647617", "0.62510085", "0.62209505", "0.6183027", "0.6156382", "0.6109577", "0.6096921", "0.60890067", "0.60517853", "0.60022783", "0.598...
0.68925077
3
Method added by Blacklight; Blacklight uses to_s on your user class to get a userdisplayable login/identifier for the account.
def to_s email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user\n\t\treturn Account.find(self.account_id)\n\tend", "def to_s\n username\n end", "def to_s\n username\n end", "def to_s\n \"#{username}\"\n end", "def to_s\n login\n end", "def to_s\n login\n end", "def echo_user\n return find_user.to_s\n end", "def account\n ...
[ "0.67828727", "0.67579544", "0.67579544", "0.67570394", "0.67520905", "0.6727124", "0.67065877", "0.66688704", "0.6659348", "0.66222006", "0.66065735", "0.65915567", "0.6591289", "0.65828073", "0.65728956", "0.6558114", "0.6541468", "0.6541468", "0.65356153", "0.6443363", "0....
0.0
-1
Groups that user is a member of
def groups return @groups if @groups return [] if uid.nil? codes = ["student"] res = Group.where(code: codes) # add eduPersonAffiliation (e.g. student, faculty, staff) to groups that the user is a member of @groups = res + affiliations.map{ |code| Group.new(:code=>code) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups\n Group.groups(user_name)\n end", "def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end", "def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end", "def members\n set_gr...
[ "0.760421", "0.7559152", "0.7516253", "0.74425846", "0.74110776", "0.739739", "0.7378174", "0.72355396", "0.72124636", "0.7181687", "0.7138726", "0.70565647", "0.7034206", "0.70218533", "0.7014228", "0.6969284", "0.6963634", "0.6955721", "0.69355613", "0.6923982", "0.69112587...
0.677359
25
min=arr.first arr.each do |x| nested_min = x arr.each do |y| next if x == y nested_min = y < x ? y : x end min = nested_min < min ? nested_min : min end min end
def my_min(arr) min = arr.first arr.each do |el| min = el if el < min end min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min(arr)\n min = arr.first\n\n arr.each_with_index do |ele1, i| \n arr.each_with_index do |ele2, j|\n next if i == j \n min = ele2 if ele2 < min \n end\n end\n\n min\nend", "def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n...
[ "0.8579323", "0.82871884", "0.8256552", "0.8238026", "0.8160377", "0.8133097", "0.8086237", "0.8051082", "0.80146915", "0.79802245", "0.79316795", "0.7903017", "0.78940135", "0.788772", "0.7884591", "0.7841545", "0.78400475", "0.78066325", "0.7803442", "0.7784945", "0.7737581...
0.7868285
15
TODO: Refactor if possible Linting disabled as this section has been marked for refactor rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def adjacent_tiles(row, col) adj_tiles = [] if row.positive? adj_tiles << tile_at(row - 1, col) adj_tiles << tile_at(row - 1, col - 1) unless col.zero? adj_tiles << tile_at(row - 1, col + 1) unless col == @size - 1 end adj_tiles << tile_at(row, col - 1) unless col.zero? adj_tiles << tile_at(row, col + 1) unless col == @size - 1 if row < @size - 1 adj_tiles << tile_at(row + 1, col - 1) unless col.zero? adj_tiles << tile_at(row + 1, col) adj_tiles << tile_at(row + 1, col + 1) unless col == @size - 1 end adj_tiles end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def before_lint; end", "def probers; end", "def refutal()\n end", "def ignore; end", "def factories_to_lint; end", "def after_lint; end", "def intensifier; end", "def ignores; end", "def raise_deprecations; end", "def myletter\n \n end", "def implementation; end", ...
[ "0.69074094", "0.6297971", "0.5806627", "0.5805709", "0.5794843", "0.5777174", "0.57647914", "0.5693264", "0.56886375", "0.56671214", "0.5645187", "0.56321037", "0.56321037", "0.5627872", "0.5627872", "0.55397546", "0.55363387", "0.55350673", "0.552018", "0.5518494", "0.55071...
0.0
-1
rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
def to_s tiles.map(&:letter).reduce('') { |string, letter| string + letter } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def strategy; end", "def operations; end", "def operations; end", "def refutal()\n end", "def offences_by; end", "def used?; end", "def specie; end", "def specie; end", "d...
[ "0.7227551", "0.61108005", "0.61108005", "0.6077258", "0.5920168", "0.5914571", "0.5778333", "0.5778333", "0.57711697", "0.5770977", "0.5743496", "0.5733229", "0.5733229", "0.5733229", "0.5733229", "0.5714976", "0.5694098", "0.5621249", "0.5621249", "0.5621249", "0.56108224",...
0.0
-1
require 'rubyprof' Profile the code RubyProf.start
def fib(n) if n < 2 n else fib(n-1)+fib(n-2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile(&b)\n result = RubyProf.profile &b\n printer = RubyProf::FlatPrinter.new(result)\n printer.print(OUTPUT.open('w+'))\nend", "def profiler; end", "def profiler; end", "def profiler_start\n start_perf_profiler\n end", "def rprof_sh(script, args, rprof_args = '')\n lib_sh ['ruby-prof', rpr...
[ "0.7720417", "0.7376446", "0.7376446", "0.692858", "0.6732073", "0.64409554", "0.6390003", "0.62792146", "0.62430316", "0.6223343", "0.6180389", "0.6180389", "0.6156405", "0.6113793", "0.6103594", "0.603748", "0.59676427", "0.5957411", "0.5891194", "0.58845556", "0.583746", ...
0.0
-1
GET /pacientes GET /pacientes.json
def index @q = Paciente.search(params[:q]) @pacientes = @q.result.paginate(:page => params[:page], :per_page => 5).order('apellido_paterno ASC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @paciente = Paciente.find(params[...
[ "0.80396825", "0.6993261", "0.6993261", "0.6912315", "0.66658616", "0.66101706", "0.644086", "0.64251", "0.6392918", "0.6378719", "0.6359881", "0.6238388", "0.6235018", "0.6231224", "0.6231086", "0.6184234", "0.6181543", "0.6168288", "0.61605877", "0.6145781", "0.6141878", ...
0.0
-1
GET /pacientes/1 GET /pacientes/1.json
def show @analisis = Am.where(paciente_id: @paciente.id).order('fecha DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end", "def show\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end", "def show\n @paciente = Paciente.find(params[...
[ "0.78042126", "0.72976154", "0.72976154", "0.688273", "0.6772453", "0.6751784", "0.6633244", "0.6583177", "0.65829426", "0.65051746", "0.6492571", "0.6454253", "0.6448899", "0.6421992", "0.6415834", "0.6396599", "0.6351943", "0.6351943", "0.6323775", "0.6314917", "0.6311453",...
0.0
-1
POST /pacientes POST /pacientes.json
def create @paciente = Paciente.new(paciente_params) respond_to do |format| if @paciente.save format.html { redirect_to @paciente, notice: "El paciente " + @paciente.primer_nombre + " " + @paciente.apellido_paterno + " se ha creado exitosamente."} format.json { render :show, status: :created, location: @paciente } else format.html { render :new } format.json { render json: @paciente.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @paciente = Paciente.new(params[:paciente])\n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to pacientes_path, notice: 'Paciente criado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n ...
[ "0.7224678", "0.7119235", "0.709636", "0.70189816", "0.69917876", "0.6880615", "0.6864091", "0.6834187", "0.6803999", "0.6798543", "0.6793972", "0.6713975", "0.6584637", "0.6582317", "0.64871526", "0.64657253", "0.6407225", "0.6315556", "0.6267449", "0.6251007", "0.6238268", ...
0.6754956
11
PATCH/PUT /pacientes/1 PATCH/PUT /pacientes/1.json
def update respond_to do |format| if @paciente.update(paciente_params) format.html { redirect_to @paciente, notice: 'Paciente was successfully updated.' } format.json { render :show, status: :ok, location: @paciente } else format.html { render :edit } format.json { render json: @paciente.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to \"/administrador/pacientes\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.7085039", "0.70421445", "0.70137215", "0.6883451", "0.68589646", "0.6799928", "0.6787844", "0.6786253", "0.66261595", "0.655242", "0.65475917", "0.654451", "0.6533888", "0.65028787", "0.65001273", "0.64724207", "0.6459237", "0.6439521", "0.6414587", "0.6373514", "0.6347850...
0.6893272
4
DELETE /pacientes/1 DELETE /pacientes/1.json
def destroy @paciente.destroy respond_to do |format| format.html { redirect_to pacientes_url, notice: 'Paciente was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to do |format|\n format.html { redirect_to pacientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n\n respond_to...
[ "0.7619529", "0.7591783", "0.75904906", "0.748052", "0.74679756", "0.73377967", "0.72699076", "0.72682005", "0.7252434", "0.7229503", "0.71740127", "0.70983297", "0.7073378", "0.70355505", "0.70216316", "0.7005732", "0.70027465", "0.6984104", "0.6953313", "0.6945482", "0.6932...
0.73097074
8
Use callbacks to share common setup or constraints between actions.
def set_paciente @paciente = Paciente.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 paciente_params params.require(:paciente).permit(:primer_nombre, :segundo_nombre, :apellido_paterno, :apellido_materno, :nacimiento, :dni, :direccion, :distrito, :provincia, :departamento, :email) 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