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 respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @configurations }\n end\n end",
"def configuration(options = {})\n client = extract_client!(options)\n response = client.get(\"/api/system/configuration\")\n\n REXML::Document.new(response)\n end",
"def index\n @configurations = ::Configuration.all\n end",
"def show\n @configuration = current_host.configuration_parameters.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @configuration.to_xml }\n end\n end",
"def get_config(url_prefix)\n request = Net::HTTP::Get.new(\"#{@jenkins_path}#{url_prefix}/config.xml\")\n @logger.debug \"GET #{url_prefix}/config.xml\"\n response = make_http_request(request)\n handle_exception(response, \"body\")\n end",
"def config\n respond_to { |format| format.xml }\n end",
"def index\n @graphium_configurations = Graphium::Configuration.all\n end",
"def index\n @configs = Config.all\n end",
"def get_config(url_prefix)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Get.new(\"#{url_prefix}/config.xml\")\n puts \"[INFO] GET #{url_prefix}/config.xml\" if @debug\n request.basic_auth @username, @password\n response = http.request(request)\n response.body\n end",
"def configurations\n @configurations ||= []\n end",
"def index\n @configurations = Configuration.search_paginated(params, params[:page])\n flash_on_empty @configurations\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @configurations }\n end\n end",
"def index\n @configurations = Configuration.find(:all)\n @languages = Language.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @configurations }\n end\n end",
"def all\n JSON.parse(@client.call('config.get'))\n end",
"def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @app_config }\n end\n end",
"def index\n @configuration_files = ConfigurationFile.all\n end",
"def config\n overview[\"config\"]\n end",
"def get(base_url, options)\n System::GeneralConfiguration.new(\"#{base_url}/api/system/configuration\", options)\n end",
"def index\n @devis_configurations = DevisConfiguration.all\n end",
"def index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end",
"def show\n @global_config = AppConfig.where(:section => params[:sect])\n @global_config.each do |conf|\n puts conf.confkey\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @global_config }\n end\n end",
"def configuration\n Configuration::get\n end",
"def configuration\n Configuration::get\n end",
"def index\n @app_configs = AppConfig.all\n end",
"def index\n @config_elements = ConfigElement.all\n end",
"def show\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_config }\n end\n end",
"def get_config\n\t\tend",
"def show\n @configuration_set = ConfigurationSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configuration_set }\n end\n end",
"def index\n @cdg_configurations = CdgConfiguration.all\n end",
"def get(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('configurations', 'get', 'KalturaConfigurations', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def index\n @api_configs = ApiConfig.all\n end",
"def fetch_configuration\n url = @url + \"?type=configuration&dataset=#{@name}\"\n document = REXML::Document.new( request( :url => url ) )\n\n # Top-Level filters...\n REXML::XPath.each( document, '//FilterDescription' ) do |f|\n unless f.attributes[\"displayType\"].eql? \"container\"\n @filters[ f.attributes[\"internalName\"] ] = Filter.new( f.attributes )\n end\n end\n \n # Filters nested inside containers...\n REXML::XPath.each( document, '//FilterDescription/Option' ) do |f|\n if f.attributes[\"displayType\"] != nil\n @filters[ f.attributes[\"internalName\"] ] = Filter.new( f.attributes )\n end\n end\n \n # Attributes are much simpler...\n REXML::XPath.each( document, '//AttributeDescription' ) do |a|\n @attributes[ a.attributes[\"internalName\"] ] = Attribute.new( a.attributes )\n end\n end",
"def index\n @app_configs = AppConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_configs }\n end\n end",
"def index\n @system_configurations = SystemConfiguration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @system_configurations }\n end\n end",
"def load_config()\n @config = get_xml(@xml_api_config_path)\n @config_doc = REXML::Document.new(@config)\n \n @config_doc = REXML::Document.new(@config)\n if !@config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].nil?\n @repository_url = @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text || \"\"\n end\n @repository_urls = []\n if !@config_doc.elements[\"/project/scm/locations\"].nil?\n @config_doc.elements.each(\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation\"){|e| @repository_urls << e.elements[\"remote\"].text }\n end\n if !@config_doc.elements[\"/project/scm/browser/location\"].nil?\n @repository_browser_location = @config_doc.elements[\"/project/scm/browser/location\"].text\n end\n if !@config_doc.elements[\"/project/description\"].nil?\n @description = @config_doc.elements[\"/project/description\"].text || \"\"\n end\n end",
"def get_importers_configuration\n return @client.raw(\"get\", \"/config/importers/configuration\")\n end",
"def list_config\n configs = store :get, 'configs'\n (configs.error?) ? 'No config vars set yet.' : configs.to_s\n end",
"def config\r\n @configuration\r\n end",
"def configurations; end",
"def load_config()\n @config = get_xml(@xml_api_config_path)\n @config_doc = REXML::Document.new(@config)\n\n @config_doc = REXML::Document.new(@config)\n if !@config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].nil?\n @repository_url = @config_doc.elements[\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation/remote\"].text || \"\"\n end\n @repository_urls = []\n if !@config_doc.elements[\"/project/scm/locations\"].nil?\n @config_doc.elements.each(\"/project/scm/locations/hudson.scm.SubversionSCM_-ModuleLocation\") { |e| @repository_urls << e.elements[\"remote\"].text }\n end\n if !@config_doc.elements[\"/project/scm/browser/location\"].nil?\n @repository_browser_location = @config_doc.elements[\"/project/scm/browser/location\"].text\n end\n if !@config_doc.elements[\"/project/description\"].nil?\n @description = @config_doc.elements[\"/project/description\"].text || \"\"\n end\n end",
"def list_respond_to_atom\n @configurations = Configuration.find(:all, :order => 'configurations.id DESC', :limit => Configuration.find_retry(:name => \"atom.max_entries\", :namespace => \"Configuration\").to_i)\n\n respond_to do |format|\n format.atom\n end\n end",
"def scanConfig()\n configFile = @basePath + \".config.json\" ;\n open(configFile,\"r\"){|strm|\n @config = JSON.load(strm.read()) ;\n }\n return @config ;\n end",
"def config\n @config_file\n end",
"def config( untrusted: false )\n\t\toptions = { untrusted: untrusted }\n\t\tconfig = self.server.run_with_json_template( :showconfig, **options )\n\t\treturn Hglib::Config.new( config )\n\tend",
"def show\n @my_configuration = MyConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_configuration }\n end\n end",
"def config\n configuration\n end",
"def config(host, port)\n uri = URI::HTTP.build(host: host, port: port, path: '/config')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.get(uri.path, \"Accept\" => \"application/json\")\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def get_config\n if @resource[:section]\n return node.get_config(params: \"section #{@resource[:section]}\", as_string: true)\n end\n node.running_config\n end",
"def config_get(id)\n Configuration.get(id)\n end",
"def show\r\n @mainconfig = Mainconfig.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @mainconfig }\r\n end\r\n end",
"def config\n site.config\n end",
"def get\n if File.exist?(@config_file)\n file = File.read(@config_file)\n @config = JSON.parse(file)\n end\n @config\n end",
"def index\n @system_configs = SystemConfig.all\n end",
"def configuration\n JSON.parse @gapi.configuration.to_json\n end",
"def configs\n @configuration.ids\n end",
"def index\n @configuration = ProjectConfiguration.first\n end",
"def show\n\t\t@list_config = current_user.list_configs.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.xml { render :xml => @list_config }\n\t\t\tformat.json { render :json => @list_config }\n\t\t\tformat.yaml { render :text => @list_config.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def index\n @cfgs = Cfg.all\n end",
"def index\n @a_serverconfigurations = AServerconfiguration.all\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def config\r\n Configuration\r\n end",
"def index\n @wx_configs = WxConfig.all\n end",
"def index\n\t\t@list_configs = current_user.list_configs.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @list_configs }\n\t\t\tformat.json { render :json => @list_configs }\n\t\t\tformat.yaml { render :text => @list_configs.to_yaml, :content_type => 'text/yaml' }\n\t\tend\n\tend",
"def c\n configuration\n end",
"def index\n @portal_configs = Portal::Config.all\n end",
"def index\n @docker_cfgs = DockerCfg.all\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def get_settings\n request :get, \"_settings\"\n end",
"def show\n @sys_config = SysConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @sys_config.to_xml }\n end\n end",
"def show\n @config_file = ConfigFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @config_file }\n end\n end",
"def index\n @confs = Conf.all\n end",
"def index\n @confs = Conf.all\n end",
"def show\n @clientconfig = Clientconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def config\n info['Config']\n end",
"def show\n @configuracion = Configuracion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @configuracion }\n end\n end",
"def index\n find_settings\n respond_to do |format|\n format.html # index.html.erb\n format.xml {\n render :xml => @contexts\n }\n end\n end",
"def show\n @configure = Configure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @configure }\n end\n end",
"def configuration\n application.config\n end",
"def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def show\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_configuration }\n end\n end",
"def show\n @tconfiguration = Tconfiguration.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tconfiguration }\n end\n end",
"def config\n\tYAML.load(File.open(\"config.yaml\"))\nend",
"def list(filter)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('configurations', 'list', 'KalturaConfigurationsListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def index\n @configuration_details = ConfigurationDetail.all\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def configuration\n cfg = []\n @entries.each {|e| cfg.push(e.configuration)}\n return(cfg)\n end",
"def show\n @node_config = NodeConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @node_config }\n format.xml { render :xml => @node_config }\n end\n end",
"def index\r\n @site_configs = SiteConfig.all\r\n end",
"def index\n @system_configs = SystemConfig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @system_configs }\n end\n end",
"def config_files\n @config_files\n end",
"def c\n configuration\n end"
] |
[
"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.63670033",
"0.63661563",
"0.6353977",
"0.63383704",
"0.63383704",
"0.6330857",
"0.631785",
"0.63027245",
"0.6276937",
"0.62716717",
"0.6262743",
"0.62357825",
"0.62297064",
"0.6221019",
"0.6208333",
"0.6208321",
"0.61869144",
"0.6166768",
"0.6153123",
"0.61521375",
"0.6149235",
"0.61482143",
"0.61123335",
"0.6103531",
"0.61016876",
"0.60854787",
"0.6066582",
"0.6060287",
"0.6055622",
"0.6045338",
"0.60379845",
"0.6024037",
"0.60223496",
"0.6006892",
"0.5977105",
"0.5973662",
"0.5972605",
"0.5963599",
"0.59634507",
"0.59618926",
"0.5953479",
"0.59459424",
"0.5940105",
"0.5940105",
"0.5940105",
"0.5940105",
"0.5940105",
"0.5940105",
"0.59358037",
"0.5929686",
"0.5919688",
"0.5912003",
"0.59066206",
"0.58962613",
"0.58962613",
"0.5895481",
"0.5893036",
"0.5888636",
"0.5888636",
"0.5870621",
"0.58633953",
"0.58537364",
"0.58536285",
"0.58525825",
"0.58519036",
"0.5851487",
"0.5849919",
"0.5849919",
"0.5847017",
"0.58441365",
"0.5839469",
"0.5825103",
"0.58183527",
"0.58183527",
"0.58183527",
"0.58093613",
"0.58086807",
"0.5806005",
"0.5805301",
"0.5794716"
] |
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\", xml, headers)\n end",
"def update(config=nil)\n @config = config if !config.nil?\n response = send_xml_post_request(@xml_api_config_path, @config)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def update(config=nil)\n @config = config if !config.nil?\n response = send_xml_post_request(@xml_api_config_path, @config)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def update\n @configuration = Configuration.find_by_id(params[:id])\n\n respond_to do |format|\n if @configuration.update_attributes(params[:configuration])\n flash[:notice] = t('configuration.updated')\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @configuration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @configuration = current_host.configuration_parameters.find(params[:id])\n\n respond_to do |format|\n if @configuration.update_attributes(params[:configuration])\n flash[:notice] = 'hostConfiguration was successfully updated.'\n format.html { redirect_to host_url(current_host) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @configuration.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @configuration.update_attributes(params[:configuration])\n flash[:notice] = 'Configuration was successfully updated.'\n format.html { redirect_to(@configuration) }\n format.xml { head :ok }\n else\n logger.error @configuration.errors.full_messages.join('; ')\n flash[:error] = 'Error updating configuration: '\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @configuration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @app_config.update(app_config_params)\n format.html { redirect_to @app_config, notice: 'App config was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_config }\n else\n format.html { render :edit }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n if @app_config.update_attributes(params[:app_config])\n format.html { redirect_to @app_config, notice: 'App config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @config.update(config_params)\n format.html { redirect_to @config, notice: \"Config was successfully updated.\" }\n format.json { render :show, status: :ok, location: @config }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @node_config = NodeConfig.find(params[:id])\n\n respond_to do |format|\n if @node_config.update_attributes(params[:node_config])\n format.html { redirect_to(@node_config, :notice => 'NodeConfig was successfully updated.') }\n format.json { render :json => @node_config, :status => :ok }\n format.xml { render :xml => @node_config, :status => :ok }\n else\n format.xml { render :xml => @node_config.errors, :status => :unprocessable_entity }\n format.any { render :json => @node_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @concerto_config\n params[:concerto_config].each do |k,v|\n ConcertoConfig.set(k,v) #only set this if the config already exists\n end\n redirect_to :action => :index\n end",
"def put_configuration\n\n return if get('configurations', 'engine')\n\n put({ '_id' => 'engine', 'type' => 'configurations' }.merge(@options))\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @api_configuration.update(api_configuration_params)\n\t\t\t\tformat.html { redirect_to api_configurations_path, notice: 'Api configuration was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @api_configuration }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @api_configuration.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def configure(params)\n request(Resources::RESOURCE_CONFIGURE, HTTP_METHOD_POST, params)\n end",
"def update\n respond_to do |format|\n if @api_config.update(api_config_params)\n format.html { redirect_to @api_config, notice: 'Api config was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_config }\n else\n format.html { render :edit }\n format.json { render json: @api_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event_configurations.update(event_configuration_params)\n render json: @event_configurations.to_json, status: :ok\n else\n render json: @event_configurations.errors, status: :unprocessable_entity\n end\n end",
"def update\n @configure = Configure.find(params[:id])\n\n respond_to do |format|\n if @configure.update_attributes(params[:configure])\n format.html { redirect_to @configure, notice: 'Configure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @configure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @configuration_file.update(configuration_file_params)\n format.html { redirect_to @configuration_file, notice: 'Configuration file was successfully updated.' }\n format.json { render :show, status: :ok, location: @configuration_file }\n else\n format.html { render :edit }\n format.json { render json: @configuration_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_configuration = MyConfiguration.find(params[:id])\n\n respond_to do |format|\n if @my_configuration.update_attributes(params[:my_configuration])\n format.html { redirect_to @my_configuration, notice: 'My configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_config(url_prefix, xml)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Post.new(\"#{url_prefix}\")\n puts \"[INFO] PUT #{url_prefix}\" if @debug\n request.basic_auth @username, @password\n request.body = xml\n request.content_type = 'application/xml'\n response = http.request(request)\n response.code\n end",
"def update\n @app_config = AppConfig.find(params[:id])\n\n respond_to do |format|\n if @app_config.update_attributes(params[:app_config])\n format.html {\n flash.now[:notice] = \"更新しました。\"\n render :action => \"edit\" \n #redirect_to(@app_config, :notice => 'App config was successfully updated.') \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @app_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @config_element.update(config_element_params)\n format.html { redirect_to @config_element, notice: 'Config element was successfully updated.' }\n format.json { render :show, status: :ok, location: @config_element }\n else\n format.html { render :edit }\n format.json { render json: @config_element.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @system_configuration = SystemConfiguration.find(params[:id])\n\n respond_to do |format|\n if @system_configuration.update_attributes(params[:system_configuration])\n format.html { redirect_to @system_configuration, notice: 'System configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @system_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kernel_config.update(kernel_config_params)\n format.html { redirect_to @kernel_config, notice: \"Kernel config was successfully updated.\" }\n format.json { render :show, status: :ok, location: @kernel_config }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @kernel_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @config_file = ConfigFile.find(params[:id])\n\n respond_to do |format|\n if @config_file.update_attributes(params[:config_file])\n flash[:notice] = 'ConfigFile was successfully updated.'\n format.html { redirect_to(@config_file) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @config_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sync_configuration\n end",
"def update\n respond_to do |format|\n if @task_config.update(task_config_params)\n format.html { flash[:success] = I18n.t('task_config.update.notice.success'); redirect_to @task_config }\n format.json { render :show, status: :ok, location: @task_config }\n else\n format.html { render :edit }\n format.json { render json: @task_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_config config = { 'room' => [ { 'name' => 'default-room', 'device' => [ 'light' => { 'name' => 'default-device' } ] } ] }\n File.open( self.get_config_file, 'w' ) do | handle |\n handle.write YAML.dump( config )\n end\n self.get_config_file\n end",
"def update\n respond_to do |format|\n if @jenkins_app_config.update(jenkins_app_config_params)\n format.html { redirect_to @jenkins_app_config, notice: 'Jenkins app config was successfully updated.' }\n format.json { render :show, status: :ok, location: @jenkins_app_config }\n else\n format.html { render :edit }\n format.json { render json: @jenkins_app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @conf.update(conf_params)\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { render :show, status: :ok, location: @conf }\n else\n format.html { render :edit }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @conf.update(conf_params)\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { render :show, status: :ok, location: @conf }\n else\n format.html { render :edit }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @config_file = ConfigFile.find(params[:id])\n\n respond_to do |format|\n if @config_file.update_attributes(params[:config_file])\n format.html { redirect_to @config_file, notice: 'Config file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @config_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sys_config.update(sys_config_params)\n format.html { redirect_to root_path, notice: 'Configuration was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.save!\n\n respond_to do |format|\n if @config_xml.update_attributes(params[:config_xml])\n flash[:notice] = 'ConfigXml was successfully updated.'\n format.html { redirect_to(@config_xml) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @config_xml.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def update\n @system_config = SystemConfig.find(params[:id])\n\n respond_to do |format|\n if @system_config.update_attributes(params[:system_config])\n format.html { redirect_to system_configs_url, :notice => 'System config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @system_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_config(options)\n return @api.do_request(\"POST\", get_base_api_path() + \"/config\", options)\n end",
"def update\n @configuration.user_id = current_user.id\n respond_to do |format|\n if @configuration.update(configuration_params)\n format.html { redirect_to @configuration, notice: 'Configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @configuration }\n else\n format.html { render :edit }\n format.json { render json: @configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n if @site_config.update_attributes(site_config_params)\n format.html { redirect_to @site_config, notice: 'Site config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @site_config.update(site_config_params)\r\n format.html { redirect_to action: :index, notice: t('Site config was successfully updated.') }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def config\n respond_to { |format| format.xml }\n end",
"def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @siteconfig.update(siteconfig_params)\n\t\t\t\tformat.html { redirect_to @siteconfig, notice: 'Siteconfig was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @siteconfig }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @siteconfig.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @conf = Conf.find(params[:id])\n\n respond_to do |format|\n if @conf.update_attributes(params[:conf])\n format.html { redirect_to @conf, notice: 'Conf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @devis_configuration.update(devis_configuration_params)\n format.html { redirect_to admin_path, notice: 'Devis configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_path }\n else\n format.html { render :edit }\n format.json { render json: @devis_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sysconfig = Sysconfig.find(params[:id])\n\n respond_to do |format|\n if @sysconfig.update_attributes(params[:sysconfig])\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sysconfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_config.update(system_config_params)\n format.html { redirect_to system_configs_path, notice: \"#{@system_config.description} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @system_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def configuration_params\n params.require(:configuration).permit(:name, :value)\n end",
"def update_configs!(config_params)\n config_params.each do |config|\n value = config[1].to_s\n #find the config\n configuration = UniversalAr::Configuration.find(config[0])\n if !configuration.nil?\n configuration.create_or_update_config(self, config[1])\n end\n end\n end",
"def update\n @configuracion = Configuracion.find(params[:id])\n\n respond_to do |format|\n if @configuracion.update_attributes(params[:configuracion])\n flash[:notice] = 'Configuracion was successfully updated.'\n format.html { redirect_to(@configuracion) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @configuracion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_all_config\n @admin.updateConfiguration\n end",
"def sync_configuration!\n load_configuration_if_needed! and save\n save_configuration_if_needed!\n end",
"def update_config\n if File.directory?(yolo_dir) and File.exist?(yaml_path)\n @yaml = YAML::load_file yaml_path\n update_yaml_setting(@yaml, \"deployment\", \"api_token\", \"example\")\n update_yaml_setting(@yaml, \"deployment\", \"team_token\", \"example\")\n end\n end",
"def update_notification_config(cfg)\n http_put(notification_config_url(), cfg)\n end",
"def update\n respond_to do |format|\n if @project_configuration.update(project_configuration_params)\n format.html { redirect_to project_configurations_path, notice: 'Project configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @mainconfig = Mainconfig.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @mainconfig.update_attributes(params[:mainconfig])\r\n format.html { redirect_to(niveaus_path) }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @mainconfig.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update_solr_config\n [:solr, :blacklight].each do |key|\n say_status(\"warning\", \"COPYING #{key}.YML\".upcase, :yellow)\n\n remove_file \"config/#{key}.yml\"\n copy_file \"config/solr.yml\", \"config/#{key}.yml\"\n end\n end",
"def create\n @app_config = AppConfig.new(app_config_params)\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render :show, status: :created, location: @app_config }\n else\n format.html { render :new }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scrape_config.update(scrape_config_params)\n format.html { redirect_to @scrape_config, notice: 'Scrape config was successfully updated.' }\n format.json { render :show, status: :ok, location: @scrape_config }\n else\n format.html { render :edit }\n format.json { render json: @scrape_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @google_app_config = Google::AppConfig.the_app_config\n\n respond_to do |format|\n if @google_app_config.update_attributes(params[:google_app_config])\n format.html { redirect_to @google_app_config, notice: 'App config was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update!(**args)\n @configs = args[:configs] if args.key?(:configs)\n end",
"def set_config\n @config = AppConfig.find(params[:id])\n end",
"def update\n\n respond_to do |format|\n if @sys_config.update_attributes(params[:sys_config])\n flash[:notice] = 'SysConfig was successfully updated.'\n format.html { redirect_to user_system_sys_configs_path(@user, @system) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sys_config.errors.to_xml }\n end\n end\n end",
"def create\n @api_config = ApiConfig.new(api_config_params)\n\n respond_to do |format|\n if @api_config.save\n format.html { redirect_to @api_config, notice: 'Api config was successfully created.' }\n format.json { render :show, status: :created, location: @api_config }\n else\n format.html { render :new }\n format.json { render json: @api_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @configuration_key.update(configuration_key_params)\n format.html { redirect_to @configuration_key, notice: 'Configuration key was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @configuration_key.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_config\n # hier könnte man nur bestime Sachen erlauben\n #config/set?framerate=2\n url = Rails.application.config.motion_api_base_path + '0/config/set?' + params[:key] + '=' + params[:value]\n result = HTTParty.get(url)\n # Hi er könnte man die Rückgabe noch anschauen und ggf ein Fehler schmeissen\n redirect_to :back\n end",
"def update\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n categories = [:general, :menu, :topic, :note, :smtp, :feed, :user, :log]\n\n yaml = ApplicationHelper.get_config_yaml\n\n categories.each do |cat|\n next if params[cat].nil? or params[cat].empty?\n\n yaml[cat] = Hash.new if yaml[cat].nil?\n\n params[cat].each do |key, val|\n if cat == :general\n case key\n when 'symbol_image'\n ConfigHelper.save_img('symbol.png', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n elsif cat == :topic\n case key\n when 'src'\n ConfigHelper.save_html('topics.html', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n elsif cat == :note\n case key\n when 'src'\n ConfigHelper.save_html('note.html', val) if val.size > 0\n else\n yaml[cat][key] = val\n end\n else\n if params[:smtp]['auth_enabled'] == '0'\n val = nil if ['auth', 'user_name', 'password'].include?(key)\n end\n yaml[cat][key] = val\n end\n end\n end\n\n ApplicationHelper.save_config_yaml(yaml)\n\n flash[:notice] = t('msg.update_success')\n redirect_to(:controller => 'config', :action => 'edit')\n end",
"def config_params\n params.require(:app_config).permit(:name, :value)\n end",
"def update\n respond_to do |format|\n if @car_config.update(car_config_params)\n format.html { redirect_to @car_config, notice: 'Config was successfully updated.' }\n format.json { render :show, status: :ok, location: @car_config }\n else\n format.html { render :edit }\n format.json { render json: @car_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @configuration_detail.update(configuration_detail_params)\n format.html { redirect_to @configuration_detail, notice: 'Configuration detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @configuration_detail }\n else\n format.html { render :edit }\n format.json { render json: @configuration_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def config_update( name )\n @ndev_res.update name\n @@netdev.edit_config( @ndev_res, \"xml\" )\n end",
"def update\n @car_configuration = CarConfiguration.find(params[:id])\n\n respond_to do |format|\n if @car_configuration.update_attributes(params[:car_configuration])\n format.html { redirect_to @car_configuration, notice: 'Car configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @car_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend",
"def update\n respond_to do |format|\n if @seat_configuration.update(seat_configuration_params)\n format.html { redirect_to @seat_configuration, notice: 'Seat configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @seat_configuration }\n else\n format.html { render :edit }\n format.json { render json: @seat_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n if @konfig.update_attributes(params[:konfig])\n format.html { redirect_to admin_konfig_path(@konfig), notice: 'Config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @konfig.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @blacklight_configuration.update(blacklight_configuration_params)\n format.html { redirect_to blacklight_configurations_url, notice: 'Blacklight configuration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blacklight_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flush\n File.open(config_file, 'w') do |f|\n f.puts JSON.pretty_generate(@conf)\n end\n end",
"def flush\n File.open(config_file, 'w') do |f|\n f.puts JSON.pretty_generate(@conf)\n end\n end",
"def update\n if @configuracion.update(configuracion_params)\n redirect_to configuraciones_path, notice: t('messages.configuracion_saved')\n else\n redirect_to configuraciones_path, alert: t('messages.configuracion_not_saved')\n end\n end",
"def set_api_config\n @api_config = ApiConfig.find(params[:id])\n end",
"def ensure_config\n if ! in_sync?\n File.open(configfile,\"w\") do |f|\n f.write(@config.to_json)\n end\n end\n end",
"def update\n respond_to do |format|\n if @scf_configuration.update(scf_configuration_params)\n format.html { redirect_to @scf_configuration, notice: 'Scf configuration was successfully updated.' }\n format.json { render :show, status: :ok, location: @scf_configuration }\n else\n format.html { render :edit }\n format.json { render json: @scf_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n Configurations.create ( configurations_params)\n end",
"def update\n respond_to do |format|\n if @tournament_config.update(tournament_config_params)\n format.html { redirect_to @tournament_config, notice: 'Tournament config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tournament_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_configuration_params\n\t\tparams.require(:api_configuration).permit(:client_id, :client_secret)\n\tend",
"def update\n respond_to do |format|\n if @cfg.update(cfg_params)\n format.html { redirect_to @cfg, notice: 'Cfg was successfully updated.' }\n format.json { render :show, status: :ok, location: @cfg }\n else\n format.html { render :edit }\n format.json { render json: @cfg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_configuration_file\n @configuration_file = ConfigurationFile.find(params[:id])\n end",
"def update\n @configtable = Configtable.find(params[:id])\n\n respond_to do |format|\n if @configtable.update_attributes(params[:configtable])\n format.html { redirect_to @configtable, notice: 'Configtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @configtable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @config_set_value.update(config_set_value_params)\n format.html { redirect_to @config_set_value, notice: 'Config set value was successfully updated.' }\n format.json { render :show, status: :ok, location: @config_set_value }\n else\n format.html { render :edit }\n format.json { render json: @config_set_value.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @app_config = AppConfig.new(params[:app_config])\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to(@app_config, :notice => 'App config was successfully created.') }\n format.xml { render :xml => @app_config, :status => :created, :location => @app_config }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @app_config.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n response = JSON.parse(response.body)\n replicate_data(response)\n end\n respond_to do |format|\n format.json { render :json => { :configuration => @@dynamo_nodes } }\n end\n end",
"def create\n @app_config = AppConfig.new(params[:app_config])\n\n respond_to do |format|\n if @app_config.save\n format.html { redirect_to @app_config, notice: 'App config was successfully created.' }\n format.json { render json: @app_config, status: :created, location: @app_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @doc_type_am_configuration = DocTypeAmConfiguration.find(params[:id])\n\n respond_to do |format|\n if @doc_type_am_configuration.update_attributes(params[:doc_type_am_configuration])\n format.html { redirect_to @doc_type_am_configuration, notice: 'Doc type am configuration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @doc_type_am_configuration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_configuration\n @configuration = Configuration.find(params[:id])\n end",
"def salesforce_configuration_params\n params.require(:salesforce_configuration).permit(:client_id, :client_secret, :username, :password, :security_token, :user_id)\n end",
"def write_config\n info(\"writing config.yml\")\n AIPP.config.write! config_file\n end",
"def destroy\n @app_config = AppConfig.find(params[:id])\n @app_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_configs_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"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.5662211",
"0.56287795",
"0.5574392",
"0.5563284",
"0.55632526",
"0.5562239",
"0.555247",
"0.5544819",
"0.55402136",
"0.55287915",
"0.5528207",
"0.5520855",
"0.55119354",
"0.5500669",
"0.5494671",
"0.5492516",
"0.54896796",
"0.54888004",
"0.5452195",
"0.54343027",
"0.5433548",
"0.5421072",
"0.54174864",
"0.54106414",
"0.53914475",
"0.5383894",
"0.5373755",
"0.53612936",
"0.53543186",
"0.5354315",
"0.5352935",
"0.5348096",
"0.53378725",
"0.5332661",
"0.53276956",
"0.5319712",
"0.53086495",
"0.5306816",
"0.53037566",
"0.5290212",
"0.52765924",
"0.527612",
"0.5272721",
"0.52685666",
"0.5262476",
"0.52594286",
"0.5254162",
"0.5253504",
"0.52510154",
"0.52500516",
"0.5232701",
"0.5227937",
"0.52251077",
"0.52242905",
"0.522401",
"0.522401",
"0.52219355",
"0.52147186",
"0.52144814",
"0.5213332",
"0.5213332",
"0.52132946",
"0.52121204",
"0.5208143",
"0.5202137",
"0.5200914",
"0.51845336",
"0.51839316",
"0.51824963",
"0.5177005",
"0.51737833",
"0.5167274",
"0.516652",
"0.5165147",
"0.51607305",
"0.5160095",
"0.51564676",
"0.51474005",
"0.51457447",
"0.513857"
] |
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 super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n # Define this later\n end",
"def cancel\n end",
"def cancel\n end",
"def cancel; end",
"def cancel; end",
"def cancel!\n update(request_cancelled: true)\n end",
"def cancel\n super\nend",
"def cancel(*)\n super.tap do\n __debug_sim('USER has decided to withdraw the submission.')\n end\n end",
"def cancel!; end",
"def cancelled?; end",
"def on_cancel &b\n @cancel_proc = b\n self\n end",
"def handle_external_workflow_execution_cancel_requested(event)\n # NOOP\n end",
"def cancel\n @error = :cancelled\n end",
"def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end",
"def cancel\n self.solved(:abort)\n end",
"def handle_activity_task_cancel_requested(event)\n activity_id = event.attributes[:activity_id]\n @decision_helper[activity_id].consume(:handle_cancellation_initiated_event)\n end",
"def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end",
"def cancel(params={})\n self.request(__method__, params)\n end",
"def cancel(id); end",
"def cancel_enabled?; handle?(:cancel); end",
"def cancel\n throw(:abort)\n end",
"def cancel\n self.update_status :cancelled\n end",
"def cancel\n self.class.cancel(self)\n end",
"def cancelled!\n @cancelled = true\n end",
"def cancel\n # Context is already cleared in before_action\n end",
"def __cancel__(what, &blk)\n req = Request.new\n req.verb = Request::Verb::CANCEL\n req.id = what.tag\n\n # Hold on to the tag as unavaiable for reuse until the cancel succeeds.\n @cbx[what.tag] = nil\n\n send(req) do |res|\n # Do not send any more responses from the server to this request.\n @cbx.delete(what.tag)\n blk.call(res) if blk\n end\n end",
"def handle_workflow_execution_cancel_requested(event)\n @workflow_async_scope.cancel(CancellationException.new(\"Cancelled from a WorkflowExecutionCancelRequested\"))\n @cancel_requested = true\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel?(id); end",
"def cancel\n redirect_to checkid_request.cancel_url\n end",
"def cancel_old_tasks\n if disposition == \"granted\"\n old_docket_stream.cancel_active_tasks\n else\n docket_switchable_tasks.reject(&:post_distribution?).each(&:cancel_task_and_child_subtasks)\n end\n end",
"def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n result = begin\n\n Ruote.participant_send(\n participant,\n [ :on_cancel, :cancel ],\n 'fei' => Ruote::FlowExpressionId.new(msg['fei']),\n 'flavour' => flavour)\n\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem']\n ) if result != false\n end",
"def onCancel flag, view\n ## puts \"onCancel called\"\n\t\tself.reset(view)\n\tend",
"def cancel()\n @callback = nil\n @cancelled = true\n end",
"def cancel\n return unless @running\n @running = false\n end",
"def cancel!\n\t\t\t\t# The simplest way to keep track of cancelled status is to nullify the\n\t\t\t\t# callback. This should also be optimal for garbage collection.\n\t\t\t\t@callback = nil\n\t\t\tend",
"def cancel_work\n rpc(:work_cancel, :hash).empty?\n end",
"def cancel()\n if current_user.state == 'requesting'\n current_user.change_state('online')\n else\n # Notify student that he is not in requesting state\n msg = I18n.t('students.errors.appointment.cancel')\n MessageBroadcastJob.perform_later(msg, 'error',\n student_id: current_user.id)\n end\n end",
"def cancel!\n @callback = nil\n end",
"def cancel_multi ()\n raise Exception, 'not implemented'\n end",
"def cancel\n @__status = TaskStatus::CANCELED\n TaskScheduler.remove_task(self)\n Process.kill('QUIT', @__pid) if @__pid&.positive?\n end",
"def handle_request_cancel_activity_task_failed(event)\n handle_event(event, {\n :id_methods => [:activity_id],\n :consume_symbol => :handle_cancellation_failure_event\n })\n end",
"def cancel!\n # The simplest way to keep track of cancelled status is to nullify the\n # callback. This should also be optimal for garbage collection.\n @callback = nil\n end",
"def cancel\n return unless pending?\n \n @cancelled = true\n @observers = []\n\n execute_pool.promise_cancelled(self)\n end",
"def handle_request_cancel_external_workflow_execution_initiated(event)\n handle_event(event, {\n :id_methods => [:workflow_id],\n :consume_symbol => :handle_cancellation_initiated_event\n })\n end",
"def handle_request_cancel_activity_task_failed(event)\n event_double = SimpleTestHistoryEvent.new(\"Activity1\")\n self.send(:old_handle_request_cancel_activity_task_failed, event_double)\n end",
"def dispatch_cancel(msg)\n\n flavour = msg['flavour']\n\n participant = @context.plist.instantiate(msg['participant'])\n\n begin\n participant.cancel(Ruote::FlowExpressionId.new(msg['fei']), flavour)\n rescue => e\n raise(e) if flavour != 'kill'\n end\n\n @context.storage.put_msg(\n 'reply',\n 'fei' => msg['fei'],\n 'workitem' => msg['workitem'])\n end",
"def cancel\n @procedure&.cancel\n @cancel = true\n self\n end",
"def cancel!\n # Context is already cleared in action_for_message\n end",
"def cancel_work\n rpc(action: :work_cancel, param_name: :hash).empty?\n end",
"def cancel\n if @event.cancel\n render :json => @event.to_json, :status => :ok\n else\n render :nothing => true, :status => :unprocessable_entity\n end\n end",
"def cancel\n @client.call('unrecur', @jid)\n end",
"def cancel(_fei, flavour)\n # flavour will have 'kill' value if kill_process is invoked instead of cancel_process\n return if flavour\n\n begin\n wi = workitem\n params = get_params(wi)\n task_id, action, workflow, task, task_start, task_end = %w(task_id action workflow task task_start task_end).map { |k| params[k] }\n task.add_internal_guards!(workflow.guards[:internal])\n Log.info_pp([\"Canceling task #{action.class}: #{task_id}\"])\n callbacks = {\n on_msg_received: proc do |msg|\n inspect_agent_response(msg)\n # set_result_canceled(wi, task)\n # delete_task_info(wi)\n # reply_to_engine(wi)\n end\n }\n receiver_context = { callbacks: callbacks, expected_count: 1 }\n workflow.initiate_cancel_action(task, receiver_context)\n rescue Exception => e\n Log.error(\"Error in cancel ExecuteOnNode #{e}\")\n end\n end",
"def canceled?\n @__status == TaskStatus::CANCELED\n end",
"def cancel\n @order.cancel\n render_update @order\n end",
"def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end",
"def cancel_request\n if params.key?(:tutor_id) && params.key?(:student_id) && params.key?(:tutor_subject_id)\n pending_request = PendingTutorRequest.where('tutor_id = ? AND student_id = ? AND tutor_subject_id = ?',\n params[:tutor_id],\n params[:student_id],\n params[:tutor_subject_id]).first\n course = Course.find(TutorSubject.find(params[:tutor_subject_id]).course_id)\n else\n pending_request = PendingTutorRequest.find(params[:request_id])\n # Look into see if there is another way to do this.\n course = Course.find(TutorSubject.find(pending_request.tutor_subject_id).course_id)\n end\n\n pending_request.destroy\n course_code = course.course_prefix + course.course_code\n notifcation_params = { 'user_id' => params[:tutor_id],\n 'title' => 'Request Cencelled',\n 'body' => 'A request for ' + course_code + ' has been cancelled.',\n 'icon' => 'request_cancelled',\n 'color' => 'lightgrey',\n 'type' => 'cancel' }\n Notifications.send_notification(notifcation_params)\n\n head :ok\n end",
"def send_email_request_cancelled\n send_email_request_approved\n end",
"def on_workflow_cancel\n restore_status\n end",
"def on_cancelled(&block)\n @handlers[:cancelled] = block\n self\n end",
"def cancellation_handler(&block)\n @cancellation_task = lambda { |cause| block.call(@handle, cause) }\n end",
"def cancel\n __log_activity\n __debug_route\n __debug_request\n super\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def cancel\n redirect_to( default_path ) if params[:commit] == 'cancel'\n end",
"def cancel\n to_run.clear\n reset\n current_self\n end",
"def cancelled?\n false\n end",
"def cancel(*args)\n commit('cancel', *args)\n end",
"def destroy\n appointment_request = current_user.pending_requests\n .find(params[:request_id])\n if appointment_request.cancel!\n redirect_to root_path\n else\n render status: 500\n end\n end",
"def canceled?\n @state == :cancel\n end",
"def cancelSimpleTaskDestination _args\n \"cancelSimpleTaskDestination _args;\" \n end",
"def rejected?\n self.status == Task::Status::CANCELLED\n end",
"def onCancel(flag, view)\n self.reset(view)\nend",
"def cancel\n @order.cancel_by_location\n render 'status'\n end",
"def cancel?\n self.type == :cancel\n end",
"def onCancel(flag, view)\n self.reset(view)\n end"
] |
[
"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.73578745",
"0.73578745",
"0.73578745",
"0.73578745",
"0.73578745",
"0.7353183",
"0.7338352",
"0.7338352",
"0.73070776",
"0.73070776",
"0.7278905",
"0.7245835",
"0.7238465",
"0.7217821",
"0.7191568",
"0.70622355",
"0.7031199",
"0.7028069",
"0.7007273",
"0.7003987",
"0.6991222",
"0.69852555",
"0.6929044",
"0.6898306",
"0.6894786",
"0.68739647",
"0.68307203",
"0.6669433",
"0.6658022",
"0.66292036",
"0.6606646",
"0.6592412",
"0.6566735",
"0.6566735",
"0.6550462",
"0.6511428",
"0.6509507",
"0.64954484",
"0.6485732",
"0.64847535",
"0.648175",
"0.64569175",
"0.64493483",
"0.64341336",
"0.6414778",
"0.64039344",
"0.6394333",
"0.6388888",
"0.63813394",
"0.6376575",
"0.63672537",
"0.63195163",
"0.6316851",
"0.63157386",
"0.6295762",
"0.62924516",
"0.6291684",
"0.62821835",
"0.6278031",
"0.6272086",
"0.6241525",
"0.6235063",
"0.6227232",
"0.6227092",
"0.6224604",
"0.6213077",
"0.6198911",
"0.6184513",
"0.61624396",
"0.615593",
"0.614561",
"0.6143585",
"0.6136228",
"0.6130819",
"0.6108688",
"0.6108184",
"0.61042345",
"0.60991275",
"0.60982084",
"0.60937214"
] |
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 :SYNC_UP\n clab_id.nil? || ext_last_update > last_sync\n when :SYNC_DOWN\n ext_obj_id.nil? || clab_last_update > last_sync\n else\n raise SyncError, 'sync mode not supported'\n end\n end\n end",
"def insync?(is)\n return true\n end",
"def _synced?(foreign_key)\n !!_synced[foreign_key]\n end",
"def insync?(is)\n is.delete_if {|k, v| true if not @should[0].has_key?(k)} if is.is_a? Hash\n super(is)\n end",
"def ps_skip_sync?(_action)\n false\n end",
"def hash_chain_broken?\n @valid_chain === false\n end",
"def insync?\n unless properties[:ensure] == :absent\n properties.each do |k, v|\n if resource[k].to_s != v\n resource[:ensure] = :modified\n break false\n end\n end\n end\n end",
"def supports_outdated_sync?\n updated_at_field = root.child_hash[outdated_sync_field] if outdated_sync_field\n !!updated_at_field && updated_at_field.value.nil?\n end",
"def insync?(context, name, attribute_name, _is_hash, should_hash)\n context.debug(\"Checking whether #{attribute_name} is up-to-date\")\n uri = URI.parse(should_hash[:url])\n\n # This callback provides the exception that was raised in the current try, the try_number, the elapsed_time for all tries so far, and the time in seconds of the next_interval.\n do_this_on_each_retry = proc do |exception, try, elapsed_time, next_interval|\n context.info(\"#{exception.class}: '#{exception.message}' - #{try} tries in #{elapsed_time} seconds and #{next_interval} seconds until the next try.\") unless exception.nil?\n end\n\n Retriable.retriable(tries: should_hash[:retries], max_elapsed_time: should_hash[:request_timeout], max_interval: should_hash[:max_backoff],\nmultiplier: should_hash[:exponential_backoff_base], on_retry: do_this_on_each_retry) do\n response = Net::HTTP.get_response(uri)\n\n unless should_hash[:expected_statuses].include? response.code.to_i\n raise Puppet::Error, \"check_http response code check failed. The return response '#{response.code}' is not matching with the expected_statuses '#{should_hash[:expected_statuses]}.to_s'\"\n end\n context.debug(\"The return response '#{response.code}' is matching with the expected_statuses '#{should_hash[:expected_statuses]}'\")\n unless response.body.match(should_hash[:body_matcher])\n raise Puppet::Error, \"check_http response body check failed. The return response body '#{response.body[0..99]}' is not matching body_matcher '#{should_hash[:body_matcher]}'\"\n end\n context.debug(\"The return response body '#{response.body[0..99]}' is matching with body_matcher '#{should_hash[:body_matcher]}'\")\n context.debug(\"Successfully connected to '#{name}'\")\n return true\n end\n false\n end",
"def def_ensure_insync?\n define_singleton_method(:insync?) { |is| rs_value.to_s == is.to_s }\n end",
"def insync?(is)\n ##Find unique entries\n is_unique = is - should\n should_unique = should - is\n ##Combine variables and check if empty\n diff = is_unique + should_unique\n diff.length == 0 ? true : false\n end",
"def previous_hash_valid?\n\t\treturn self.previous_hash == self.previous_block.block_hash\n\tend",
"def is_not_pending_recovery!\n self.update_attribute(:verification_key, nil) if self.is_pending_recovery?\n end",
"def build_failed_fast?\n if fail_fast.nil? || fail_fast.zero?\n return false\n end\n\n @redis.multi do\n @redis.hlen(key_failures)\n @redis.hlen(key_errors)\n end.inject(:+) >= fail_fast\n end",
"def old_sync; end",
"def need_state_sync?(vm_ref, state)\n !@previous_vm_states[vm_ref] or !@previous_vm_states[vm_ref][:state].eql? state\n end",
"def sync\n self.disabled_reason = nil\n if valid?\n execute_sync\n true\n else\n false\n end\n end",
"def check_for_missing_enabled_option(hash); end",
"def insync?(is)\n munge(is) == should\n end",
"def insync?(is)\n synced = true\n provider.attributes_to_update = Hash.new\n @should[0].each do |k, v|\n unless is[k] == v\n synced = false\n provider.attributes_to_update[k] = v\n end\n end\n synced\n end",
"def failed?; failed_to_start? || (@success == false) end",
"def error?\n get_last_error['err'] != nil\n end",
"def error?\n get_last_error['err'] != nil\n end",
"def broken?\n @broken == :broken \n\tend",
"def mediaspot_set_syncing_status client\r\n\r\n\t\t# time since last sync\r\n\t\tclient['synced_ago'] = nil\r\n\t\tclient['synced_date'] = nil\r\n\t\tbegin\r\n\t\t\trepoSyncLastCompletedTime = client['RepoSyncLastCompletedTime']['_value']\r\n\t\t\tif repoSyncLastCompletedTime != '' and repoSyncLastCompletedTime != 'No Info'\r\n\t\t\t\tclient['synced_ago'] = time_ago_in_words(repoSyncLastCompletedTime, include_seconds: true) + ' ago'\r\n\t\t\t\tclient['synced_date'] = repoSyncLastCompletedTime\r\n\t\t\tend\r\n\t\trescue\r\n\t\tend\r\n\r\n\t\tlog = ''\r\n\t\tbegin\r\n\t\t\tlog = client['RepoSyncLog']['_value']\r\n\t\trescue\r\n\t\tend\r\n\r\n\t\t# is it syncing now?\r\n\t\tclient['syncing'] = false\r\n\r\n\t\tif client.key?('IsSyncing') and client['IsSyncing'].key?('_value')\r\n\r\n\t\t\tclient['syncing'] = client['IsSyncing']['_value'] == 'true' or\r\n\t\t\t\tclient['IsSyncing']['_value'] == true or\r\n\t\t\t\tclient['IsSyncing']['_value'] == 'stuck'\r\n\t\t\t\t\r\n\t\telse\r\n\t\t\tunless (log||'').strip == '' or\r\n\t\t\t\tlog.lines.last.include?('ERROR:') or\r\n\t\t\t\tlog.lines.last.include?('error:') or\r\n\t\t\t\tlog.lines.any?{|line| line.start_with?('Done.') or line.start_with?('INFO: Done.') }\r\n\t\t\t\tclient['syncing'] = true\r\n\t\t\tend\r\n\t\tend\r\n\r\n\r\n\t\t# were there an error?\r\n\t\tclient['sync_error'] = false\r\n\t\tbegin\r\n\t\t\tlastLine = log.split(\"\\n\").last\r\n\t\t\tif lastLine.include?('ERROR:') or\r\n\t\t\t\tlastLine.include?('error:')\r\n\t\t\t\tclient['sync_error'] = true\r\n\t\t\tend\r\n\t\trescue\r\n\t\tend\r\n\r\n\tend",
"def in_progress?\n $redis.keys(redis_key).present?\n end",
"def salesforce_skip_sync?\n return true if ::SfDbSync.config[\"SYNC_ENABLED\"] == false\n return (salesforce_skip_sync || !self.class.sf_db_sync_enabled || send(self.class.salesforce_skip_sync_method)) if self.class.salesforce_skip_sync_method.present?\n return (salesforce_skip_sync || !self.class.sf_db_sync_enabled)\n end",
"def perform?\n !song.synced?\n end",
"def synced?\n contabilium_id.present? && ucrm_id.present?\n end",
"def success?\n !error\n end",
"def synced?(record)\n record.synced?\n end",
"def remote_sync_if_necessary(options={})\n false\n end",
"def lock_status?\n return @unlocked == true\n end",
"def sync_options; @sync_options ||= table_sync.sync_options; end",
"def sync_state_exists?\n session.left.tables.include? \"#{options[:rep_prefix]}_sync_state\"\n end",
"def test_prev_hash_correct_false\n assert_equal(false, @bv.prev_hash_correct?(0, \"abcd\", \"efgh\"))\n end",
"def error?\n !@data['error'].nil?\n end",
"def error?\n !@data['error'].nil?\n end",
"def msg_not_boolean(parent, key, value); end",
"def improper_pair?\n @cdr != NULL\n end",
"def error?\n return !ok?\n end",
"def insync?(is)\n (is == :present and should == :present and (provider.value == provider.value_saved)) or\n (is == :absent and should == :absent)\n\n end",
"def insync?(is)\n # Loop through each nic\n should.each do | nic_number, settings |\n # loop through each one of its settings\n settings.each do | name, value |\n if should[nic_number][name] != is[nic_number][name]\n return false\n end\n end\n end\n end",
"def if_needs_rekey?; end",
"def insync?(is)\n ((@should - is).length == 0)\n end",
"def error?\n !@error.equal?(NOT_SET)\n end",
"def error?()\n #This is a stub, used for indexing\n end",
"def missing?; false; end",
"def synchronous?\n !@asynchronous\n end",
"def insync?(_is)\n case @resource['enable']\n when :true\n # If a transition should occur, the resource is not insync.\n !@resource.provider.transition?\n else\n # Return true, since a disabled transition is always insync.\n true\n end\n end",
"def locked?\n\t\t#puts \"Came to check locked.\"\n\t\tif $redis.get(get_race_condition_key_name).blank?\n\t\t\t#puts \"the key is blank\"\n\t\t\tfalse\n\t\telse\n\t\t #puts \"key is not blank\"\n\t\t #puts \"key is: #{$redis.get(get_race_condition_key_name)}\"\n\t\t $redis.get(get_race_condition_key_name) == LOCKED\n\t\tend\n\tend",
"def success?() end",
"def failed?\n not @ok\n end",
"def cycle_complete?\n !self.sf_integrity_hash.nil? and !self.acf_integrity_hash.nil?\n end",
"def are_synced\n where(sync_status: true).to_a\n end",
"def asynchronous?() false end",
"def error?\n last_error.present?\n end",
"def scm_pair?; SCM_FALSE; end",
"def ensure_sync_state\n create_sync_state unless sync_state_exists?\n end",
"def error?\n !success?\n end",
"def cache_errors?\n options[:cache_errors]\n end",
"def error?\n !success?\n end",
"def error?\n status[:error] || false\n end",
"def insync?(is)\n is.sort! == should.sort!\n end",
"def verify_prev_hash(prev_block)\r\n unless prev_block.nil?\r\n hash = prev_block.computed_hash\r\n raise \"Line #{total_block_number}: previous hash was #{hash}, should be #{@prev_hash}\" unless @prev_hash == hash\r\n\r\n end\r\n true\r\n end",
"def synchronized?; end",
"def error?\n error = (self[:error_upgrade] & 0b1111111)\n return error != 0\n end",
"def error?\n task_result_field if States::Error.include?(task_state)\n end",
"def conn_error?(key)\n c = get_connection_by_key(key)\n c && c.error?\n end",
"def check(hash)\n # not implemented\n end",
"def error_msg\n return nil if result\n\n if !github_user.last_sync_at\n \"GitHub has never been synchronized\"\n else\n \"Last GitHub synchronization is too old\"\n end\n end",
"def semact?; false; end",
"def insync?(is)\n should_itview = RubyMethods.array_of_arrays_to_it_view_v21(should)\n is_itview = RubyMethods.array_of_arrays_to_it_view_v21(is)\n missing = RubyMethods.find_it_view_v21_to_create_lun(should_itview,is_itview)\n extra = RubyMethods.find_it_view_v21_to_delete_lun(should_itview,is_itview)\n ##Combine variables and check if empty\n diff = missing + extra\n diff.length == 0 ? true : false\n end",
"def insync?(is)\n key = 'PayloadType'\n i, s = [is, should].each do |a|\n a.sort! { |x, y| x[key] <=> y[key] }\n end\n i.eql? s\n end",
"def insync?(currentvalue)\n if stat = @resource.stat and stat.ftype == \"link\" and @resource[:links] != :follow\n self.debug \"Not managing symlink mode\"\n return true\n else\n return super(currentvalue)\n end\n end",
"def playlist_updated?(playlist)\n !changes[\"playlists\"][\"update\"][playlist[\"id\"]].nil?\nend",
"def check_previous_hash_zero(block)\n unless block.previous_hash.eql? '0'\n puts \"Line #{block.block_number}: Previous hash was #{block.previous_hash.strip}, should be 0\"\n return false\n end\n true\n end",
"def broken?\n\t\t@broken\n\tend",
"def schema_error?(key)\n schema_result.error?(key)\n end",
"def error?\n\t\tEventMachine::report_connection_error_status(@signature) != 0\n\tend",
"def remove_result_ok?(remove_result)\n remove_result.is_a?(Hash) && remove_result[\"err\"] == nil && remove_result[\"n\"] == 1\n end",
"def missing?\n\t\treturn self.status == '!'\n\tend",
"def error?\n !success?\n end",
"def failed?(_syncP = false, _nth = :all, _mode = :and)\n return checkRunStatus(:failed, _syncP, _nth, _mode) ;\n end",
"def error?\n false\n end",
"def has_error?\n status == ERROR \n end",
"def insync?(is)\n (is.size == should.size && is.sort == should.sort)\n end",
"def insync?(currentvalue)\n if stat = @resource.stat and stat.ftype == \"link\" and @resource[:links] != :follow\n self.debug \"Not managing symlink mode\"\n return true\n else\n return super(currentvalue)\n end\n end",
"def settled?\n return !self.pending?\n end",
"def ok?\n skip? || @result\n end",
"def non_blocking?()\n #This is a stub, used for indexing\n end",
"def retry_update(x, hash_code, was_uncontended); end",
"def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end",
"def ok?\n !@error\n end",
"def locked? key\n ! ! data(key, LOCKED)\n end",
"def _rh_merge_ok?(result, key)\n if result.is_a?(Hash)\n control = result[:__protected]\n else\n control = result[0][:__protected]\n key -= 1\n end\n\n return false if control.is_a?(Array) && control.include?(key)\n\n true\n end",
"def __force__\n if @result.equal?(NOT_SET)\n @mutex.synchronize do\n if @result.equal?(NOT_SET)\n begin\n @result = @promise.wait_for_result(@timeout)\n @result = @result[@attr] if @attr && !@result[\"error\"]\n rescue ::Exception => exc\n @result = ::Delorean::Engine.grok_runtime_exception(exc)\n end\n end\n end\n end\n\n # FIXME: the logic for shape of exceptions from Delorean is spread\n # all over the place.\n @result.is_a?(::Hash) &&\n @result[\"error\"] ? ::Kernel.raise(@result[\"error\"]) : @result\n end",
"def in_progress?\n result.nil?\n end",
"def previously_existed?\n true\n end"
] |
[
"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.53606576",
"0.53434426",
"0.53434426",
"0.5306163",
"0.52985525",
"0.5297272",
"0.529003",
"0.5277983",
"0.5275064",
"0.52619225",
"0.5259356",
"0.5243727",
"0.5222558",
"0.52009493",
"0.51965266",
"0.51744115",
"0.51597166",
"0.51597166",
"0.51525974",
"0.5149013",
"0.5119429",
"0.5112609",
"0.51121664",
"0.5100659",
"0.5097398",
"0.5075344",
"0.5070665",
"0.50682926",
"0.50633097",
"0.5058761",
"0.5057677",
"0.50564265",
"0.5046661",
"0.50465417",
"0.5035834",
"0.5035302",
"0.50279766",
"0.50261676",
"0.50241256",
"0.50207853",
"0.5018235",
"0.5016569",
"0.50121933",
"0.5005407",
"0.50023615",
"0.49992174",
"0.49785042",
"0.49731576",
"0.497136",
"0.4963125",
"0.49629912",
"0.49609524",
"0.4959192",
"0.4957062",
"0.49569753",
"0.49546033",
"0.4949413",
"0.4945603",
"0.49429592",
"0.49415627",
"0.4941525",
"0.49394536",
"0.4938953",
"0.49382174",
"0.4933932",
"0.4933565",
"0.4931171",
"0.49273375",
"0.49202436",
"0.4919401",
"0.49188933",
"0.49187246",
"0.49177155",
"0.4916075",
"0.4900549",
"0.48940712",
"0.48909166",
"0.48817316",
"0.48805162"
] |
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 self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings if available so we don't have to do the E'...' dance.\n set_standard_conforming_strings\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n if ActiveRecord::Base.default_timezone == :utc\n execute(\"SET time zone 'UTC'\")\n elsif @local_tz\n execute(\"SET time zone '#{@local_tz}'\")\n end\n end",
"def configure_connection\n if @config[:encoding]\n @connection.set_client_encoding(@config[:encoding])\n end\n self.client_min_messages = @config[:min_messages] || \"warning\"\n self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings so we don't have to do the E'...' dance.\n set_standard_conforming_strings\n\n variables = @config.fetch(:variables, {}).stringify_keys\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n unless variables[\"timezone\"]\n if ActiveRecord.default_timezone == :utc\n variables[\"timezone\"] = \"UTC\"\n elsif @local_tz\n variables[\"timezone\"] = @local_tz\n end\n end\n\n # NOTE(joey): This is a workaround as CockroachDB 1.1.x\n # supports SET TIME ZONE <...> and SET \"time zone\" = <...> but\n # not SET timezone = <...>.\n if variables.key?(\"timezone\")\n tz = variables.delete(\"timezone\")\n execute(\"SET TIME ZONE #{quote(tz)}\", \"SCHEMA\")\n end\n\n # SET statements from :variables config hash\n # https://www.postgresql.org/docs/current/static/sql-set.html\n variables.map do |k, v|\n if v == \":default\" || v == :default\n # Sets the value to the global or compile default\n\n # NOTE(joey): I am not sure if simply commenting this out\n # is technically correct.\n # execute(\"SET #{k} = DEFAULT\", \"SCHEMA\")\n elsif !v.nil?\n execute(\"SET SESSION #{k} = #{quote(v)}\", \"SCHEMA\")\n end\n end\n end",
"def configure_connection\n if @config[:encoding]\n @connection.set_client_encoding(@config[:encoding])\n end\n # self.client_min_messages = @config[:min_messages] || 'warning'\n self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings so we don't have to do the E'...' dance.\n # set_standard_conforming_strings\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n # (SET TIME ZONE does not use an equals sign like other SET variables)\n # if ActiveRecord::Base.default_timezone == :utc\n # execute(\"SET time zone 'UTC'\", 'SCHEMA')\n # elsif @local_tz\n # execute(\"SET time zone '#{@local_tz}'\", 'SCHEMA')\n # end\n\n # SET statements from :variables config hash\n # http://www.postgresql.org/docs/8.3/static/sql-set.html\n variables = @config[:variables] || {}\n variables.map do |k, v|\n if v == ':default' || v == :default\n # Sets the value to the global or compile default\n execute(\"SET SESSION #{k} TO DEFAULT\", 'SCHEMA')\n elsif !v.nil?\n execute(\"SET SESSION #{k} TO #{quote(v)}\", 'SCHEMA')\n end\n end\n end",
"def configure_connection\n # For sql server 2008+ we want it to send an actual time otherwise comparisons with time columns don't work\n @connection.connection.setSendTimeAsDatetime(false)\n end",
"def configure_connection\n super\n execute(\"SET SESSION IntervalStyle TO 'iso_8601'\", 'SCHEMA')\n end",
"def connection_configuration_sqls\n sqls = super\n sqls << \"SET DateStyle = 'ISO'\" if @use_iso_date_format\n sqls\n end",
"def set_default_options\n self.format = :csv\n self.type_system = nil\n self.conn_options = {}\n self.io_options = Hash.new{|h,k| h[k] = {}}\n end",
"def setup_encoding\n\t\t\t# TODO: Deprecate and remove this setup - it should be the responsibility of the server to set this correctly.\n\t\t\tif @external_encoding and Encoding.default_external != @external_encoding\n\t\t\t\twarn \"Updating Encoding.default_external from #{Encoding.default_external} to #{@external_encoding}\" if $VERBOSE\n\t\t\t\tEncoding.default_external = @external_encoding\n\t\t\tend\n\t\tend",
"def configure_connection\n end",
"def initialize(connection, logger, connection_parameters, config)\n super(connection, logger)\n @connection_parameters, @config = connection_parameters, config\n\n # @local_tz is initialized as nil to avoid warnings when connect tries to use it\n @local_tz = nil\n @table_alias_length = nil\n @vertica_version = nil\n\n # Initialize the Arel visitor\n @visitor = BindSubstitution.new(self)\n\n connect\n @local_tz = execute('SHOW TIME ZONE')[0][0]\n end",
"def configure_connection\n end",
"def adapter_initialize\n @use_iso_date_format = typecast_value_boolean(@opts.fetch(:use_iso_date_format, Postgres.instance_variable_get(:@use_iso_date_format))) # , true)) # SEQUEL5\n initialize_postgres_adapter\n add_conversion_proc(17, method(:unescape_bytea)) if USES_PG\n add_conversion_proc(1082, TYPE_TRANSLATOR.method(:date)) if @use_iso_date_format\n self.convert_infinite_timestamps = @opts[:convert_infinite_timestamps]\n end",
"def prepare_column_options(column)\n super.tap do |spec|\n spec[:encoding] = \"'#{column.sql_type_metadata.encoding}'\" if column.sql_type_metadata.encoding.present?\n end\n end",
"def setup_timezone\n timezone = config.dig(\"timezone\").split(\"-\").first.chomp(\" \")\n\n application nil do\n <<~CONFS\n # Default timezone\n config.time_zone = \"#{timezone}\"\n\n CONFS\n end\n end",
"def meta_encoding=(encoding); end",
"def meta_encoding=(encoding); end",
"def connection_settings\n \"\\0%s\\0%s\\0%s/%d\\0\" % [\n @client_user_name, @server_user_name, @terminal_type, @speed\n ]\n end",
"def connection_options(data)\n opts = super.merge! data\n\n opts.merge! logger: logger if !opts.key? :logger\n\n opts\n end",
"def configure_charsets \n\theaders[\"Content-Type\"] = \"text/html; charset=utf-8\" \n\tsuppress(ActiveRecord::StatementInvalid) do \n\t ActiveRecord::Base.connection.execute 'SET NAMES UTF8' \n\tend\n end",
"def setup_connection(conn)\n conn = super(conn)\n conn.extend(Sequel::Swift::Postgres::AdapterMethods)\n conn.db = self\n conn.apply_connection_settings\n conn\n end",
"def connect\n @connection = Vertica::Connection.new(@config)\n Vertica.translate_results = false if Vertica.respond_to?(:translate_results=)\n\n # Ignore async_exec and async_query when using postgres-pr.\n @async = @config[:allow_concurrency] && @connection.respond_to?(:async_exec)\n\n # All vertica money columns have precision 18\n VerticaColumn.money_precision = 18\n\n configure_connection\n end",
"def configure_charsets\n content_type = headers[\"Content-Type\"] || 'text/html'\n if /^text\\//.match(content_type)\n headers[\"Content-Type\"] = \"#{content_type}; charset=utf-8\" \n end\n ActiveRecord::Base.connection.execute 'SET NAMES UTF8'\n end",
"def fix_options(passed_options)\n return passed_options unless passed_options.nil? || passed_options.is_a?(Hash)\n opts = OptionsHash.new(passed_options || {}).to_hash\n sequelizer_options = db_config(opts).merge(opts)\n\n if sequelizer_options[:adapter] =~ /^postgres/\n sequelizer_options[:adapter] = 'postgres'\n paths = %w(search_path schema_search_path schema).map { |key| sequelizer_options.delete(key) }.compact\n\n unless paths.empty?\n sequelizer_options[:search_path] = paths.first\n sequelizer_options[:after_connect] = after_connect(paths.first)\n end\n end\n\n if sequelizer_options[:timeout]\n # I'm doing a merge! here because the indifferent access part\n # of OptionsHash seemed to not work when I tried\n # sequelizer_options[:timeout] = sequelizer_options[:timeout].to_i\n sequelizer_options.merge!(timeout: sequelizer_options[:timeout].to_i)\n end\n\n sequelizer_options.merge(after_connect: make_ac(sequelizer_options))\n end",
"def default_encoding=(_arg0); end",
"def initialize(options={})\n @logger = options.delete(:logger) || self.class.default_logger\n @options = options\n options.host = '127.0.0.1' if options.host.nil? || options.host == 'localhost'\n options.port ||= 9312\n\n # If you use localhost, MySQL insists on a socket connection, but Sphinx\n # requires a TCP connection. Using 127.0.0.1 fixes that.\n # so does passing in the socket file e.g. socket:'/usr/local/sphinx/var/run/sphinx.sock'\n # nb: sphinx.conf listen definition must specify mysql41 as the protocol, e.g.,\n # listen = localhost:9312:mysql41\n\n super( { symbolize_keys: true, database_timezone: :utc, application_timezone: :local }.merge( options ) )\n end",
"def default_encoding; end",
"def default_encoding; end",
"def connection_options\n {\n headers: {\n accept: default_media_type,\n user_agent: user_agent\n }\n }\n end",
"def connection_options\n {\n headers: {\n accept: default_media_type,\n user_agent: user_agent\n }\n }\n end",
"def setup_connection(conn)\n conn = super(conn)\n statement(conn) do |stmt|\n connection_pragmas.each{|s| log_connection_yield(s, conn){stmt.execute(s)}}\n end\n conn\n end",
"def configure(conf)\n compat_parameters_convert(conf, :inject)\n super\n\n if @format == 'json'\n @format_proc = Proc.new{|tag, time, record| record.to_json}\n else\n @key_names = @key_names.split(/\\s*,\\s*/)\n @format_proc = Proc.new{|tag, time, record| @key_names.map{|k| record[k]}}\n end\n\n if @columns.nil? and @sql.nil?\n raise Fluent::ConfigError, \"columns or sql MUST be specified, but missing\"\n end\n if @columns and @sql\n raise Fluent::ConfigError, \"both of columns and sql are specified, but specify one of them\"\n end\n end",
"def migration_keys\n super + [:encoding]\n end",
"def dbconnection_params\n params.require(:dbconnection).permit(:adapter, :mode, :host, :port, :username, :password, :database, :encoding)\n end",
"def connection_options\n {\n :headers => {\n :accept => default_media_type,\n :user_agent => user_agent\n },\n :builder => middleware\n }\n end",
"def initialize options\n self.db_host, self.db_port = options[:uri].to_s.split(':')\n super options\n end",
"def default_options\n {\n acceleration: true,\n auto_row_sep_chars: 500,\n chunk_size: nil,\n col_sep: :auto, # was: ',',\n comment_regexp: nil, # was: /\\A#/,\n convert_values_to_numeric: true,\n downcase_header: true,\n duplicate_header_suffix: nil,\n file_encoding: 'utf-8',\n force_simple_split: false,\n force_utf8: false,\n headers_in_file: true,\n invalid_byte_sequence: '',\n keep_original_headers: false,\n key_mapping: nil,\n quote_char: '\"',\n remove_empty_hashes: true,\n remove_empty_values: true,\n remove_unmapped_keys: false,\n remove_values_matching: nil,\n remove_zero_values: false,\n required_headers: nil,\n required_keys: nil,\n row_sep: :auto, # was: $/,\n silence_missing_keys: false,\n skip_lines: nil,\n strings_as_keys: false,\n strip_chars_from_headers: nil,\n strip_whitespace: true,\n user_provided_headers: nil,\n value_converters: nil,\n verbose: false,\n with_line_numbers: false,\n }\n end",
"def encoding= new_encoding\n frozen_check!\n @gapi.csv_options.encoding = new_encoding\n end",
"def encoding= new_encoding\n frozen_check!\n @gapi.csv_options.encoding = new_encoding\n end",
"def configure_connection(conn)\n conn.headers['Accept'] = [JSON_TYPE]\n\n conn.response :json, content_type: JSON_TYPE\n end",
"def connection_options\n {\n :headers => {\n # :accept => default_media_type,\n :user_agent => user_agent\n }\n }\n end",
"def force_default_encoding=(_arg0); end",
"def connection_options\n {\n :headers => {\n :accept => default_media_type,\n :user_agent => user_agent\n }\n }\n end",
"def connection_options\n {\n :headers => {\n :accept => default_media_type,\n :user_agent => user_agent\n }\n }\n end",
"def sync_timezone_changes(raw_connection)\n end",
"def set_persistent_connection_options!(connection)\n [:ca_file, :read_timeout, :open_timeout, :verify_mode].each do |connection_method|\n connection_option_name = \"connection_#{connection_method}\".to_sym\n next unless @data[:options].has_key?(connection_option_name)\n connection.__send__(\"#{connection_method}=\", @data[:options][connection_option_name])\n end\n if @data[:credentials].has_key?(:cert)\n connection.cert = OpenSSL::X509::Certificate.new(@data[:credentials][:cert])\n end\n if @data[:credentials].has_key?(:key)\n connection.key = OpenSSL::PKey::RSA.new(@data[:credentials][:key])\n end\n connection\n end",
"def charset=(charset); end",
"def set_encoding\n Encoding.default_external = Encoding::UTF_8\n Encoding.default_internal = Encoding::UTF_8\n nil\n end",
"def force_default_encoding; end",
"def set_db_options(options)\n\t\t\t\toptions[:collection]=options[:collection] || MongoozHash.get_class_name_without_namespace(self)\n\t\t\t\toptions[:db]=options[:db] || Mongooz.DEFAULT_DB\n\t\t\t\toptions[:host]=options[:host] || Mongooz.DEFAULT_HOST\n\t\t\t\toptions[:port]=options[:port] || Mongooz.DEFAULT_PORT\n\t\t\tend",
"def set_external_encoding(encoding = Encoding::UTF_8)\n\t\t\t# TODO: Deprecate and remove this setup - it should be the responsibility of the server to set this correctly.\n\t\t\tif Encoding.default_external != encoding\n\t\t\t\twarn \"Updating Encoding.default_external from #{Encoding.default_external} to #{encoding}\" if $VERBOSE\n\t\t\t\tEncoding.default_external = encoding\n\t\t\tend\n\t\tend",
"def configure_connection(config, connection)\n variables = config.fetch(:variables, {}).stringify_keys\n\n # By default, MySQL 'where id is null' selects the last inserted id.\n # Turn this off. http://dev.rubyonrails.org/ticket/6778\n variables['sql_auto_is_null'] = 0\n\n # Increase timeout so the server doesn't disconnect us.\n wait_timeout = config[:wait_timeout]\n wait_timeout = 2147483 unless wait_timeout.is_a?(Fixnum)\n variables['wait_timeout'] = self.type_cast_config_to_integer(wait_timeout)\n\n # Make MySQL reject illegal values rather than truncating or blanking them, see\n # http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_strict_all_tables\n # If the user has provided another value for sql_mode, don't replace it.\n unless variables.has_key?('sql_mode')\n variables['sql_mode'] = strict_mode?(config) ? 'STRICT_ALL_TABLES' : ''\n end\n\n # NAMES does not have an equals sign, see\n # http://dev.mysql.com/doc/refman/5.0/en/set-statement.html#id944430\n # (trailing comma because variable_assignments will always have content)\n encoding = \"NAMES #{config[:encoding]}, \" if config[:encoding]\n\n # Gather up all of the SET variables...\n variable_assignments = variables.map do |k, v|\n if v == ':default' || v == :default\n \"@@SESSION.#{k.to_s} = DEFAULT\" # Sets the value to the global or compile default\n elsif !v.nil?\n \"@@SESSION.#{k.to_s} = #{connection.escape(v.to_s)}\"\n end\n # or else nil; compact to clear nils out\n end.compact.join(', ')\n\n # ...and send them all in one query\n connection.query \"SET #{encoding} #{variable_assignments}\", async: false\n end",
"def default_adapter_options=(_arg0); end",
"def default_adapter_options=(_arg0); end",
"def connection_information\n super\n end",
"def connection_options\n opts = {}\n\n if @wtimeout\n warn \"Using wtimeout in a URI is deprecated, please use wtimeoutMS. It will be removed in v2.0.\"\n opts[:wtimeout] = @wtimeout\n end\n opts[:wtimeout] = @wtimeoutms if @wtimeoutms\n\n opts[:w] = 1 if @safe\n opts[:w] = @w if @w\n opts[:j] = @journal if @journal\n opts[:fsync] = @fsync if @fsync\n\n opts[:connect_timeout] = @connecttimeoutms if @connecttimeoutms\n opts[:op_timeout] = @sockettimeoutms if @sockettimeoutms\n opts[:pool_size] = @pool_size if @pool_size\n opts[:read] = @readpreference if @readpreference\n\n if @slaveok && !@readpreference\n unless replicaset?\n opts[:slave_ok] = true\n else\n opts[:read] = :secondary_preferred\n end\n end\n\n if replicaset.is_a?(String)\n opts[:name] = replicaset\n end\n\n opts[:db_name] = @db_name if @db_name\n opts[:auths] = @auths if @auths\n opts[:ssl] = @ssl if @ssl\n opts[:connect] = connect?\n\n opts\n end",
"def default_options\n { :charset => nil, :line_break => nil, :nomunge => nil,\n :preserve_semi => nil, :disable_optimizations => nil }\n end",
"def before_setup\n @original_time_zone = Time.zone\n super\n end",
"def setup_connection(conn)\n conn = super(conn)\n statement(conn) do |stmt|\n connection_configuration_sqls.each{|sql| log_yield(sql){stmt.execute(sql)}}\n end\n conn\n end",
"def default_adapter_options; end",
"def default_adapter_options; end",
"def default_options\n {\n :host => 'localhost',\n :port => Mongo::Connection::DEFAULT_PORT\n }\n end",
"def set_default_options\n end",
"def set_puppetdb_path(connection=self.connection)\n set_url_prefix\n connection.url_prefix.path = '/pdb'\n connection.url_prefix.port = 8081\n end",
"def initialize(options = {})\n reset_values\n\n @options = {}\n options.each { |key, value| @options[key.to_s.to_sym] = value }\n @options[:port] ||= 5433\n\n @row_style = @options[:row_style] ? @options[:row_style] : :hash\n unless options[:skip_startup]\n startup_connection\n initialize_connection\n end\n end",
"def setDefaultEncoding(encoding)\n @fields['default_encoding'] = encoding\n self\n end",
"def setDefaultEncoding(encoding)\n @fields['default_encoding'] = encoding\n self\n end",
"def init\n adapter.setup_connection_specification_name\n adapter.process_excluded_models\n end",
"def default_options\n {\n open_timeout: 300,\n read_timeout: 300,\n raise_errors: false,\n endpoint: @server,\n namespace: \"urn:schemas-microsoft-com:xml-analysis\"\n }\n end",
"def set_defaults\n\t\t@headers[:server] = Mongrel2.version_string( true )\n\tend",
"def initialize\n @enable_compiler = false\n @auto_rack_format = true\n end",
"def initialize(options = {})\n self.output_dir = options[:output_dir]\n self.mysql_options = options[:mysql_options]\n self.db_connection = options[:db_connection]\n self.column_filters = (options[:column_filters] || {}).stringify_keys!\n self.table_filters = (options[:table_filters] || []).map(&:to_s)\n\n self.post_dump_command = options[:post_dump_command]\n self.file_extension = options[:file_extension] || \".sql\"\n end",
"def configure_charsets # was: set_charset\n content_type = headers[\"Content-Type\"] || \"text/html\"\n if /^text\\//.match(content_type)\n headers[\"Content-Type\"] = \"#{content_type}; charset=utf-8\" \n end\n end",
"def configure\n yield(configuration) if block_given?\n\n self.logger = configuration.logger\n\n # remove :// from scheme\n configuration.scheme.sub!(/:\\/\\//, '')\n\n # remove http(s):// and anything after a slash\n configuration.host.sub!(/https?:\\/\\//, '')\n\n # Add leading and trailing slashes to base_path\n configuration.base_path = \"\" if configuration.base_path == \"/\"\n end",
"def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end",
"def opts\n adapter_connection.opts\n end",
"def initialize\n super\n configure_logging\n detect_platform()\n detect_resolver()\n load_config()\n end",
"def params_encoding\n @params_encoding ||= query_options.fetch(:params_encoding, :typhoeus)\n end",
"def connection_options\n CONNECTION_OPTIONS\n end",
"def force_encoding(*args) settings.force_encoding(*args) end",
"def initialize()\n super\n @odata_type = \"#microsoft.graph.customTimeZone\"\n end",
"def setcharup(*)\n super\n end",
"def initialize(...)\n super()\n configure(...)\n end",
"def meta_encoding; end",
"def meta_encoding; end",
"def activate_default\n ActiveRecord::Base.connection.schema_search_path = self.initial_search_path\n end",
"def configure(conf)\n super\n end",
"def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend",
"def load_settings\n %w(user password database collections additional_options backup_method).each do |attribute|\n send(:\"#{attribute}=\", procedure.get_adapter_configuration.attributes[attribute])\n end\n \n %w(host port).each do |attribute|\n send(:\"#{attribute}=\", procedure.get_adapter_configuration.get_options.attributes[attribute])\n end\n \n self.backup_method ||= :mongodump\n end",
"def determine_encodings!(*)\n @encoding ||= super\n end",
"def options\n original_options = super\n defaults = Thor::CoreExt::HashWithIndifferentAccess.new(\n {\n width: 72,\n count: 200,\n },\n )\n\n config_path = File.expand_path(ENV.fetch('AUGURY_CFG_PATH', '~/.augury.yml'))\n if File.file?(config_path)\n config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {})\n defaults = defaults.merge(config_options)\n end\n\n # Enforce implied options\n defaults[:links] = true if original_options[:remove_links] || defaults[:remove_links]\n\n Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def connection_options\n {\n :headers => {\n :accept => media_type,\n :user_agent => user_agent\n }\n }\n end",
"def manage_meta_set_encoding encoding\n @manage_meta_encoding = encoding\n end",
"def default_options\n {\n chunk_size: 500,\n recursive: false,\n validate: true,\n value_converters: csv_value_converters,\n wrap_in_transaction: true\n }.merge(column_mapping_options)\n end",
"def setup\n @config[\"syntax_highlighter\"] ||= highlighter\n @config[\"syntax_highlighter_opts\"] ||= {}\n @config[\"syntax_highlighter_opts\"][\"default_lang\"] ||= \"plaintext\"\n @config[\"syntax_highlighter_opts\"][\"guess_lang\"] = @config[\"guess_lang\"]\n @config[\"coderay\"] ||= {} # XXX: Legacy.\n modernize_coderay_config\n make_accessible\n end",
"def configure\n # If the thing is entirely absent, then we need to create the config.\n # Is there someway to get this on one line?\n str = \"create -b #{@resource[:create_args]}\\nset zonepath=#{@resource[:path]}\\n\"\n\n # Then perform all of our configuration steps. It's annoying\n # that we need this much internal info on the resource.\n @resource.send(:properties).each do |property|\n str += property.configtext + \"\\n\" if property.is_a? ZoneConfigProperty and ! property.safe_insync?(properties[property.name])\n end\n\n str += \"commit\\n\"\n setconfig(str)\n end",
"def set_options\n options[:header] = @header unless @header.nil?\n options[:body] = @body unless @body.nil?\n options[:query] = @query unless @query.nil?\n end",
"def set_defaults \n @options.test = 'simple'\n @options.min = 0\n @options.max = 5\n @options.host = 'localhost'\n @options.port = 27017\n @options.db = 'mongobench_test'\n @options.time = 300\n @options.threads = 1\n @options.documents = 20000\n @options.iterations = 0\n @options.step = :all\n end",
"def finalize_config!(kitchen_instance)\n super kitchen_instance\n\n kitchen_instance\n .transport\n .tap do |transport|\n configure_inspec_connection_options(\n transport_connection_options:\n transport\n .send(\n :connection_options,\n transport.diagnose\n )\n .dup\n )\n end\n\n configure_inspec_miscellaneous_options\n end"
] |
[
"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.505079",
"0.5004803",
"0.5003833",
"0.4989149",
"0.4981049",
"0.4981049",
"0.49810484",
"0.49810484",
"0.49691543",
"0.49613938",
"0.49599212",
"0.49382785",
"0.49010995",
"0.489422",
"0.48929322",
"0.4885374",
"0.4885374",
"0.48771194",
"0.4861559",
"0.48590308",
"0.48586664",
"0.48586664",
"0.48574132",
"0.48444125",
"0.48438582",
"0.48393458",
"0.48368353",
"0.4825558",
"0.48253256",
"0.48143366",
"0.48131013",
"0.48131013",
"0.48110005",
"0.4801972",
"0.4792004",
"0.4783364",
"0.47813827",
"0.47783542",
"0.47783542",
"0.47718436",
"0.47605097",
"0.47422448",
"0.4738514",
"0.47195166",
"0.47195166",
"0.47188792",
"0.47027984",
"0.4682355",
"0.46769115",
"0.46703002",
"0.4647899",
"0.46304208",
"0.46284705",
"0.4618257",
"0.46151236",
"0.46069247",
"0.46060792",
"0.45944485",
"0.458534",
"0.45731336",
"0.45724258",
"0.45584708",
"0.45584708",
"0.4548173",
"0.45454103",
"0.45400766",
"0.4532578",
"0.45285612",
"0.45184353",
"0.45170516",
"0.45167",
"0.45160398",
"0.45120278",
"0.45107463",
"0.44979215",
"0.4490432",
"0.4487694",
"0.4487521"
] |
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_map[Java::JavaSQL::Types::DATE] = lambda do |r, i|\n if v = r.getString(i)\n Sequel.string_to_date(v)\n end\n end\n @type_convertor_map[Java::JavaSQL::Types::BLOB] = lambda do |r, i|\n if v = r.getBytes(i)\n Sequel::SQL::Blob.new(String.from_java_bytes(v))\n elsif !r.wasNull\n Sequel::SQL::Blob.new('')\n end\n end\n end",
"def native_database_types\n {\n :primary_key => \"integer not null primary key\",\n :string => { :name => \"varchar\", :limit => 255 },\n :text => { :name => \"blob sub_type text\" },\n :integer => { :name => \"integer\" },\n :float => { :name => \"float\" },\n :decimal => { :name => \"decimal\" },\n :datetime => { :name => \"timestamp\" },\n :timestamp => { :name => \"timestamp\" },\n :time => { :name => \"time\" },\n :date => { :name => \"date\" },\n :binary => { :name => \"blob\" },\n :boolean => { :name => boolean_domain[:name] }\n }\n end",
"def dbms_type_cast(columns, values)\n int_column = {}\n columns.each_with_index do |c, i|\n int_column[i] = c.type == 3 && c.scale == 0\n end\n\n float_column = {}\n columns.each_with_index do |c, i|\n float_column[i] = c.type == 3 && c.scale != 0\n end\n\n values.each do |row|\n row.each_index do |idx|\n val = row[idx]\n if val\n if int_column[idx]\n row[idx] = val.to_i\n elsif float_column[idx]\n row[idx] = val.to_f\n elsif val.is_a?(String)\n row[idx] = val.force_encoding('UTF-8')\n end\n end\n end\n end\n end",
"def native_database_types\n @native_database_types ||= super.merge(boolean: { name: 'bool' })\n end",
"def schema_column_type(db_type)\n if convert_smallint_to_bool && db_type =~ /smallint/i \n :boolean\n else\n super\n end\n end",
"def column_schema_to_ruby_type(schema)\n case t = schema[:db_type].downcase\n when /\\A(?:medium|small)?int(?:eger)?(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Integer}\n when /\\Atinyint(?:\\((\\d+)\\))?\\z/o\n {:type =>schema[:type] == :boolean ? TrueClass : Integer}\n when /\\Abigint(?:\\((?:\\d+)\\))?(?: unsigned)?\\z/o\n {:type=>Bignum}\n when /\\A(?:real|float|double(?: precision)?)\\z/o\n {:type=>Float}\n when 'boolean'\n {:type=>TrueClass}\n when /\\A(?:(?:tiny|medium|long|n)?text|clob)\\z/o\n {:type=>String, :text=>true}\n when 'date'\n {:type=>Date}\n when /\\A(?:small)?datetime\\z/o\n {:type=>DateTime}\n when /\\Atimestamp(?:\\((\\d+)\\))?(?: with(?:out)? time zone)?\\z/o\n {:type=>DateTime, :size=>($1.to_i if $1)}\n when /\\Atime(?: with(?:out)? time zone)?\\z/o\n {:type=>Time, :only_time=>true}\n when /\\An?char(?:acter)?(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1), :fixed=>true}\n when /\\A(?:n?varchar|character varying|bpchar|string)(?:\\((\\d+)\\))?\\z/o\n {:type=>String, :size=>($1.to_i if $1)}\n when /\\A(?:small)?money\\z/o\n {:type=>BigDecimal, :size=>[19,2]}\n when /\\A(?:decimal|numeric|number)(?:\\((\\d+)(?:,\\s*(\\d+))?\\))?\\z/o\n s = [($1.to_i if $1), ($2.to_i if $2)].compact\n {:type=>BigDecimal, :size=>(s.empty? ? nil : s)}\n when /\\A(?:bytea|(?:tiny|medium|long)?blob|(?:var)?binary)(?:\\((\\d+)\\))?\\z/o\n {:type=>File, :size=>($1.to_i if $1)}\n when 'year'\n {:type=>Integer}\n else\n {:type=>String}\n end\n end",
"def revert_postgres_type( type )\n case type\n when /\\Acharacter varying/\n return :String, :default_size => 255\n when /\\Acharacter/\n return :String, :fixed => true, :default_size => 255\n when /\\Atext\\z/\n return :String, :text => true\n when /\\Abytea\\z/\n return :blob\n when /\\Atimestamp/\n return :timestamp\n end\n end",
"def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end",
"def map_types!(column_mapping)\n\t\tself.column_mapping = column_mapping\n\t\tself\n\tend",
"def schema_column_type(db_type)\n case db_type\n when /\\Ainterval\\z/io\n :interval\n when /\\Acitext\\z/io\n :string\n else\n super\n end\n end",
"def type_map\n @type_map ||= PG::BasicTypeMapForResults.new(connection.raw_connection)\n end",
"def map_value(column_type)\n case column_type\n when :datetime then :timestamp\n when :json then :string\n else column_type\n end\n end",
"def map_data_types(hsh)\n hsh.each_with_object({}) { |(column_name, column_type), hash| hash[column_name] = map_value(column_type) }\n end",
"def schema_column_type(db_type)\n case db_type\n when 'json'\n :json\n when 'jsonb'\n :jsonb\n else\n super\n end\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\Atinyint/\n Sequel.convert_tinyint_to_bool ? :boolean : :integer\n when /\\A(int(eger)?|bigint|smallint)/\n :integer\n when /\\A(character( varying)?|varchar|text)/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when \"boolean\"\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric(\\(\\d+,\\d+\\))?|decimal|money)\\z/\n :decimal\n when \"bytea\"\n :blob\n end\n end",
"def simplified_type(field_type)\r\n return :boolean if field_type =~ /logical/i\r\n return :string if field_type =~ /varchar/i\r\n return :binary if field_type =~ /long binary/i\r\n return :datetime if field_type =~ /timestamp/i\r\n return :integer if field_type =~ /short|integer/i\r\n return :integer if field_type =~ /autoinc/i\r\n super\r\n end",
"def column_type(type_indicator)\n case type_indicator\n when :eval; :text\n when :text; :text\n when :string; :string\n when :sec; :double\n when :msec; :double\n when :duration; :double\n when :float; :double\n when :double; :double\n when :integer; :integer\n when :int; :int\n when :timestamp; :datetime\n when :datetime; :datetime\n when :date; :date\n else :string\n end\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\A(int(eger)?|bigint|smallint)\\z/\n :integer\n when /\\A(character( varying)?|varchar|text)\\z/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when /\\A(boolean|tinyint)\\z/\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric|decimal|money)\\z/\n :decimal\n end\n end",
"def native_database_types #:nodoc:\r\n {\r\n :primary_key => 'AUTOINC PRIMARY KEY CONSTRAINT NOT NULL',\r\n :string => { :name => \"varchar\", :limit => 255 },\r\n :text => { :name => \"memo\" },\r\n :integer => { :name => \"integer\" },\r\n :float => { :name => \"float\" },\r\n :decimal => { :name => \"numeric\" },\r\n :datetime => { :name => \"timestamp\" },\r\n :timestamp => { :name => \"timestamp\" },\r\n :time => { :name => \"time\" },\r\n :date => { :name => \"date\" },\r\n :binary => { :name => \"blob\" },\r\n :boolean => { :name => \"logical\"}\r\n }\r\n end",
"def initialize_type_map(m = type_map) # :nodoc:\n register_class_with_limit m, 'int2', Type::Integer\n register_class_with_limit m, 'int4', Type::Integer\n register_class_with_limit m, 'int8', Type::Integer\n m.alias_type 'oid', 'int2'\n m.register_type 'float4', Type::Float.new\n m.alias_type 'float8', 'float4'\n m.register_type 'text', Type::Text.new\n register_class_with_limit m, 'varchar', Type::String\n m.alias_type 'char', 'varchar'\n m.alias_type 'name', 'varchar'\n m.alias_type 'bpchar', 'varchar'\n m.register_type 'bool', Type::Boolean.new\n m.alias_type 'timestamptz', 'timestamp'\n m.register_type 'date', Type::Date.new\n\n m.register_type 'timestamp' do |_, _, sql_type|\n precision = extract_precision(sql_type)\n OID::DateTime.new(precision: precision)\n end\n\n m.register_type 'numeric' do |_, fmod, sql_type|\n precision = extract_precision(sql_type)\n scale = extract_scale(sql_type)\n\n # The type for the numeric depends on the width of the field,\n # so we'll do something special here.\n #\n # When dealing with decimal columns:\n #\n # places after decimal = fmod - 4 & 0xffff\n # places before decimal = (fmod - 4) >> 16 & 0xffff\n if fmod && (fmod - 4 & 0xffff).zero?\n # Remove this class, and the second argument to lookups on PG\n Type::DecimalWithoutScale.new(precision: precision)\n else\n OID::Decimal.new(precision: precision, scale: scale)\n end\n end\n end",
"def schema_column_type(db_type)\n db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end",
"def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/\n :float\n # Monetary types\n when 'money'\n :decimal\n when 'hstore'\n :hstore\n when 'ltree'\n :ltree\n # Network address types\n when 'inet'\n :inet\n when 'cidr'\n :cidr\n when 'macaddr'\n :macaddr\n # Character types\n when /^(?:character varying|bpchar)(?:\\(\\d+\\))?$/\n :string\n when /^citext(?:\\(\\d+\\))?$/\n :citext\n # Binary data types\n when 'bytea'\n :binary\n # Date/time types\n when /^timestamp with(?:out)? time zone$/\n :datetime\n when /^interval(?:|\\(\\d+\\))$/\n :string\n # Geometric types\n when /^(?:point|line|lseg|box|\"?path\"?|polygon|circle)$/\n :string\n # Bit strings\n when /^bit(?: varying)?(?:\\(\\d+\\))?$/\n :string\n # XML type\n when 'xml'\n :xml\n # tsvector type\n when 'tsvector'\n :tsvector\n # Arrays\n when /^\\D+\\[\\]$/\n :string\n # Object identifier types\n when 'oid'\n :integer\n # UUID type\n when 'uuid'\n :uuid\n # JSON type\n when 'json'\n :json\n # Small and big integer types\n when /^(?:small|big)int$/\n :integer\n when /(num|date|tstz|ts|int4|int8)range$/\n field_type.to_sym\n # Pass through all types that are not specific to PostgreSQL.\n else\n super\n end\n end",
"def schema_column_type(db_type)\n convert_tinyint_to_bool && db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end",
"def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/ then :float\n # Monetary types\n when 'money' then :decimal\n # Character types\n when /^(?:character varying|bpchar)(?:\\(\\d+\\))?$/ then :string\n # Binary data types\n when 'bytea' then :binary\n # Date/time types\n when /^timestamp with(?:out)? time zone$/ then :datetime\n when 'interval' then :string\n # Geometric types\n when /^(?:point|line|lseg|box|\"?path\"?|polygon|circle)$/ then :string\n # Network address types\n when /^(?:cidr|inet|macaddr)$/ then :string\n # Bit strings\n when /^bit(?: varying)?(?:\\(\\d+\\))?$/ then :string\n # XML type\n when 'xml' then :xml\n # tsvector type\n when 'tsvector' then :tsvector\n # Arrays\n when /^\\D+\\[\\]$/ then :string\n # Object identifier types\n when 'oid' then :integer\n # UUID type\n when 'uuid' then :string\n # Small and big integer types\n when /^(?:small|big)int$/ then :integer\n # Pass through all types that are not specific to PostgreSQL.\n else\n super\n end\n end",
"def cast_types; end",
"def oracle_data_type_conversion(in_var, data_type, data_scale)\n \n case\n when data_type == \"VARCHAR2\"\n if in_var.nil? or in_var.empty?\n in_var = \"\"\n end\n this_in_var = in_var.to_s\n this_data_type = String\n \n when data_type == \"CHAR\"\n if in_var.nil? or in_var.empty?\n in_var = \"\"\n end\n this_in_var = in_var.to_s\n this_data_type = String\n \n when data_type == \"NUMBER\"\n if !data_scale.nil? and data_scale > 0\n \n this_in_var = in_var.to_f\n this_data_type = Float\n else\n this_in_var = in_var.to_i\n this_data_type = Fixnum\n end\n \n when data_type == \"TIMESTAMP\"\n this_in_var = in_var\n this_data_type = DateTime\n \n when data_type == \"DATE\"\n this_in_var = in_var\n this_data_type = DateTime\n \n else nil\n end \n \n return this_in_var, this_data_type \n end",
"def column_type(type)\n case type\n when :integer then Integer\n when :float, :decimal then Float\n when :string, :text, :uuid then String\n when :datetime, :timestamp, :time then DateTime\n when :date then Date\n when :boolean then Virtus::Attribute::Boolean # Boolean is not a standard Ruby class\n else\n raise \"Could not match column type '#{type}' for #{model_name}\"\n end\n end",
"def schema_column_type(db_type)\n case db_type\n when 'inet', 'cidr'\n :ipaddr\n else\n super\n end\n end",
"def schema_column_type(db_type)\n Sequel::Mysql2.convert_tinyint_to_bool && db_type == 'tinyint(1)' ? :boolean : super\n end",
"def schema_column_type(db_type)\n case db_type\n when 'inet', 'cidr'\n :ipaddr\n else\n super\n end\n end",
"def initialize_type_map(m)\n m.register_type %r{.*}, SQLServer::Type::UnicodeString.new\n # Exact Numerics\n register_class_with_limit m, 'bigint(8)', SQLServer::Type::BigInteger\n m.alias_type 'bigint', 'bigint(8)'\n register_class_with_limit m, 'int(4)', SQLServer::Type::Integer\n m.alias_type 'integer', 'int(4)'\n m.alias_type 'int', 'int(4)'\n register_class_with_limit m, 'smallint(2)', SQLServer::Type::SmallInteger\n m.alias_type 'smallint', 'smallint(2)'\n register_class_with_limit m, 'tinyint(1)', SQLServer::Type::TinyInteger\n m.alias_type 'tinyint', 'tinyint(1)'\n m.register_type 'bit', SQLServer::Type::Boolean.new\n m.register_type %r{\\Adecimal}i do |sql_type|\n scale = extract_scale(sql_type)\n precision = extract_precision(sql_type)\n SQLServer::Type::Decimal.new precision: precision, scale: scale\n end\n m.alias_type %r{\\Anumeric}i, 'decimal'\n m.register_type 'money', SQLServer::Type::Money.new\n m.register_type 'smallmoney', SQLServer::Type::SmallMoney.new\n # Approximate Numerics\n m.register_type 'float', SQLServer::Type::Float.new\n m.register_type 'real', SQLServer::Type::Real.new\n # Date and Time\n m.register_type 'date', SQLServer::Type::Date.new\n m.register_type 'datetime', SQLServer::Type::DateTime.new\n m.register_type %r{\\Adatetime2}i do |sql_type|\n precision = extract_precision(sql_type)\n SQLServer::Type::DateTime2.new precision: precision\n end\n m.register_type %r{\\Adatetimeoffset}i do |sql_type|\n precision = extract_precision(sql_type)\n SQLServer::Type::DateTimeOffset.new precision: precision\n end\n m.register_type 'smalldatetime', SQLServer::Type::SmallDateTime.new\n m.register_type %r{\\Atime}i do |sql_type|\n scale = extract_scale(sql_type)\n precision = extract_precision(sql_type)\n SQLServer::Type::Time.new precision: precision\n end\n # Character Strings\n register_class_with_limit m, %r{\\Achar}i, SQLServer::Type::Char\n register_class_with_limit m, %r{\\Avarchar}i, SQLServer::Type::Varchar\n m.register_type 'varchar(max)', SQLServer::Type::VarcharMax.new\n m.register_type 'text', SQLServer::Type::Text.new\n # Unicode Character Strings\n register_class_with_limit m, %r{\\Anchar}i, SQLServer::Type::UnicodeChar\n register_class_with_limit m, %r{\\Anvarchar}i, SQLServer::Type::UnicodeVarchar\n m.alias_type 'string', 'nvarchar(4000)'\n m.register_type 'nvarchar(max)', SQLServer::Type::UnicodeVarcharMax.new\n m.register_type 'ntext', SQLServer::Type::UnicodeText.new\n # Binary Strings\n register_class_with_limit m, %r{\\Abinary}i, SQLServer::Type::Binary\n register_class_with_limit m, %r{\\Avarbinary}i, SQLServer::Type::Varbinary\n m.register_type 'varbinary(max)', SQLServer::Type::VarbinaryMax.new\n # Other Data Types\n m.register_type 'uniqueidentifier', SQLServer::Type::Uuid.new\n m.register_type 'timestamp', SQLServer::Type::Timestamp.new\n end",
"def type_cast(value)\r\n @column_definition.type_cast(value)\r\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n \n if limit.nil? || limit == 4\n 'integer'\n elsif limit < 4\n 'smallint'\n else\n 'bigint'\n end\n end",
"def schema_data_type\n case type\n when \"N\", \"F\"\n decimal > 0 ? \":float\" : \":integer\"\n when \"I\"\n \":integer\"\n when \"D\"\n \":date\"\n when \"T\"\n \":datetime\"\n when \"L\"\n \":boolean\"\n when \"M\"\n \":text\"\n else\n \":string, :limit => #{length}\"\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless NO_LIMIT_TYPES.include?(t = type.to_s.downcase.to_sym)\n\n native_type = NATIVE_DATABASE_TYPES[t]\n native_type.is_a?(Hash) ? native_type[:name] : native_type\n end",
"def set_native_database_types\n @native_types = {}\n end",
"def type_to_sql(type, limit: nil, precision: nil, scale: nil, **) # :nodoc:\n # MSSQL's NVARCHAR(n | max) column supports either a number between 1 and\n # 4000, or the word \"MAX\", which corresponds to 2**30-1 UCS-2 characters.\n #\n # It does not accept NVARCHAR(1073741823) here, so we have to change it\n # to NVARCHAR(MAX), even though they are logically equivalent.\n #\n # See: http://msdn.microsoft.com/en-us/library/ms186939.aspx\n #\n type = type.to_sym if type\n native = native_database_types[type]\n\n if type == :string && limit == 1_073_741_823\n 'nvarchar(max)'\n elsif NO_LIMIT_TYPES.include?(type)\n super(type)\n elsif %i[int integer].include?(type)\n if limit.nil? || limit == 4\n 'int'\n elsif limit == 2\n 'smallint'\n elsif limit == 1\n 'tinyint'\n else\n 'bigint'\n end\n elsif type == :uniqueidentifier\n 'uniqueidentifier'\n elsif %i[datetime time].include?(type)\n precision ||= 7\n column_type_sql = (native.is_a?(Hash) ? native[:name] : native).dup\n if (0..7).include?(precision)\n column_type_sql << \"(#{precision})\"\n else\n raise(\n ArgumentError,\n \"No #{native[:name]} type has precision of #{precision}. The \" \\\n 'allowed range of precision is from 0 to 7, even though the ' \\\n 'sql type precision is 7 this adapter will persist up to 6 ' \\\n 'precision only.'\n )\n end\n else\n super\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false)\n case type.to_s\n when 'binary'\n case limit\n when 0..0xfff; \"varbinary(#{limit})\"\n when nil; \"blob\"\n when 0x1000..0xffffffff; \"blob(#{limit})\"\n else raise(ActiveRecordError, \"No binary type has character length #{limit}\")\n end\n when 'integer'\n case limit\n when 1\n 'tinyint' + (unsigned ? ' unsigned' : '')\n when 2\n 'smallint' + (unsigned ? ' unsigned' : '')\n when 3\n 'mediumint' + (unsigned ? ' unsigned' : '')\n when nil, 4, 11 # compatibility with MySQL default\n if unsigned\n 'int(10) unsigned'\n else\n 'int(10)'\n end\n when 5..8\n 'bigint' + (unsigned ? ' unsigned' : '')\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}\")\n end\n when 'text'\n case limit\n when 0..0xff; 'tinytext'\n when nil, 0x100..0xffff; 'text'\n when 0x10000..0xffffff; 'mediumtext'\n when 0x1000000..0xffffffff; 'longtext'\n else raise(ActiveRecordError, \"No text type has character length #{limit}\")\n end\n else\n super\n end\n end",
"def dbms_type_cast(columns, rows)\n # Cast the values to the correct type\n columns.each_with_index do |column, col_index|\n #puts \" #{column.name} type #{column.type} length #{column.length} nullable #{column.nullable} scale #{column.scale} precision #{column.precision} searchable #{column.searchable} unsigned #{column.unsigned}\"\n rows.each do |row|\n value = row[col_index]\n\n new_value = case\n when value.nil?\n nil\n when [ODBC::SQL_CHAR, ODBC::SQL_VARCHAR, ODBC::SQL_LONGVARCHAR].include?(column.type)\n # Do nothing, because the data defaults to strings\n # This also covers null values, as they are VARCHARs of length 0\n value.is_a?(String) ? value.force_encoding(\"UTF-8\") : value\n when [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(column.type)\n column.scale == 0 ? value.to_i : value.to_f\n when [ODBC::SQL_REAL, ODBC::SQL_FLOAT, ODBC::SQL_DOUBLE].include?(column.type)\n value.to_f\n when [ODBC::SQL_INTEGER, ODBC::SQL_SMALLINT, ODBC::SQL_TINYINT, ODBC::SQL_BIGINT].include?(column.type)\n value.to_i\n when [ODBC::SQL_BIT].include?(column.type)\n value == 1\n when [ODBC::SQL_DATE, ODBC::SQL_TYPE_DATE].include?(column.type)\n value.to_date\n when [ODBC::SQL_TIME, ODBC::SQL_TYPE_TIME].include?(column.type)\n value.to_time\n when [ODBC::SQL_DATETIME, ODBC::SQL_TIMESTAMP, ODBC::SQL_TYPE_TIMESTAMP].include?(column.type)\n value.to_datetime\n # when [\"ARRAY\"?, \"OBJECT\"?, \"VARIANT\"?].include?(column.type)\n # TODO: \"ARRAY\", \"OBJECT\", \"VARIANT\" all return as VARCHAR\n # so we'd need to parse them to make them the correct type\n\n # As of now, we are just going to return the value as a string\n # and let the consumer handle it. In the future, we could handle\n # if here, but there's not a good way to tell what the type is\n # without trying to parse the value as JSON as see if it works\n # JSON.parse(value)\n when [ODBC::SQL_BINARY].include?(column.type)\n # These don't actually ever seem to return, even though they are\n # defined in the ODBC driver, but I left them in here just in case\n # so that future us can see what they should be\n value\n else\n # the use of @connection.types() results in a \"was not dropped before garbage collection\" warning.\n raise \"Unknown column type: #{column.type} #{@connection.types(column.type).first[0]}\"\n end\n\n row[col_index] = new_value\n end\n end\n rows\n end",
"def typecast_attributes\n @attributes.each_pair do |name,value|\n # skip primary key columns\n # ajay Singh --> skip the loop if attribute is null (!name.present?)\n next if (name == \"id\") or (!name.present?)\n attr_type = attr_type_for(name)\n \n # empty attributes should stay empty (e.g. an empty int field shouldn't be typecast as 0)\n if [:datetime, :datetimecombo, :int].include? attr_type && (value.nil? || value == '')\n @attributes[name] = nil\n next\n end\n \n case attr_type\n when :bool\n @attributes[name] = (value == \"1\")\n when :datetime, :datetimecombo\n begin\n @attributes[name] = DateTime.parse(value)\n rescue\n @attributes[name] = value\n end\n when :int\n @attributes[name] = value.to_i\n end\n end\n @attributes\n end",
"def database_column_type\n :string\n end",
"def from_database_type(obj)\n case obj\n when String, Float, Integer, NilClass, TrueClass, FalseClass\n obj\n when java.sql.Date, java.sql.Time, java.sql.Timestamp\n Time.at(obj.time/1000)\n when java.sql.Blob\n String.from_java_bytes(obj.get_bytes(1,obj.length))\n when java.sql.Clob\n obj.get_sub_string(1, obj.length)\n when java.math.BigDecimal\n BigDecimal.new(obj.to_s)\n else\n raise \"Can't find correct type to convert #{obj.inspect} into\"\n end\n end",
"def convert_type_proc(v)\n case v\n when Java::OrgPostgresqlJdbc4::Jdbc4Array\n PGArrayConverter.new(method(:convert_type_proc))\n when Java::OrgPostgresqlUtil::PGobject\n PG_OBJECT_METHOD\n else\n super\n end\n end",
"def finalize_datatypes_for_csv\n csv_column_datatypes.map { |column_name, possible_datatypes|\n #If there is string type even atleast 1 there is no other option but to set the datatype to string => varchar\n if possible_datatypes.has_key?(:string)\n csv_column_datatypes[column_name] = :string\n else\n #set the max occurance datatype as the datatype of column\n csv_column_datatypes[column_name] = possible_datatypes.key(possible_datatypes.values.max)\n end\n }\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:\r\n if native = native_database_types[type]\r\n if type == :integer\r\n column_type_sql = 'integer'\r\n elsif type == :string and !limit.nil?\r\n \"varchar (#{limit})\"\r\n else\r\n super(type, limit, precision, scale)\r\n end\r\n else\r\n super(type, limit, precision, scale)\r\n end\r\n end",
"def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/\n :float\n # Monetary types\n when 'money'\n :decimal\n # Character types\n when /^(?:character varchar|varying|bpchar)(?:\\(\\d+\\))?$/\n :string\n # Binary data types\n when 'bytea'\n :binary\n when 'binary'\n :binary\n # Date/time types\n when /^timestamp with(?:out)? time zone$/\n :datetime\n when 'interval'\n :string\n # Geometric types\n when /^(?:point|line|lseg|box|\"?path\"?|polygon|circle)$/\n :string\n # Network address types\n when /^(?:cidr|inet|macaddr)$/\n :string\n # Bit strings\n when /^bit(?: varying)?(?:\\(\\d+\\))?$/\n :string\n # XML type\n when 'xml'\n :xml\n # Arrays\n when /^\\D+\\[\\]$/\n :string\n # Object identifier types\n when 'oid'\n :integer\n # UUID type\n when 'uuid'\n :string\n # Small and big integer types\n when /^(?:small|big)int$/\n :integer\n # Pass through all types that are not specific to Vertica.\n else\n super\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false, auto_increment = false)\n case type.to_s\n when 'integer'\n case limit\n when 1\n 'tinyint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when 2\n 'smallint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when 3\n 'mediumint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n when nil, 4, 11 # compatibility with MySQL default\n if unsigned\n 'int(10) unsigned' + (auto_increment ? ' AUTO_INCREMENT' : '')\n else\n 'int(10)'\n end\n when 5..8\n 'bigint' + (unsigned ? ' unsigned' : '') + (auto_increment ? ' AUTO_INCREMENT' : '')\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}\")\n end\n when 'text'\n case limit\n when 0..0xff; 'tinytext'\n when nil, 0x100..0xffff; 'text'\n when 0x10000..0xffffff; 'mediumtext'\n when 0x1000000..0xffffffff; 'longtext'\n else raise(ActiveRecordError, \"No text type has character length #{limit}\")\n end\n else\n super\n end\n end",
"def types\n @types ||= {\n Boolean => GraphQL::BOOLEAN_TYPE,\n ::Mongoid::Boolean => GraphQL::BOOLEAN_TYPE,\n BSON::ObjectId => GraphQL::STRING_TYPE,\n }\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:\n if type == :enum\n native = native_database_types[type]\n column_type_sql = native[:name] || 'enum'\n \n column_type_sql << \"(#{limit.map { |v| quote(v) }.join(',')})\"\n column_type_sql \n else\n # Edge rails fallback for Rails 1.1.6. We can remove the\n # rescue once everyone has upgraded to 1.2.\n begin\n __type_to_sql_enum(type, limit, precision, scale)\n rescue ArgumentError\n __type_to_sql_enum(type, limit)\n end\n end\n end",
"def value_types; end",
"def type_literal_generic_trueclass(column)\n :boolean\n end",
"def type_to_sql(*args); connection.type_to_sql(*args); end",
"def convert_to_type(val)\n case type\n when 'NilClass'\n if val != false && val.blank?\n # Leave the type of the Column open. Unfortunately, false counts as\n # blank and we don't want it to. It should be classified as a boolean.\n new_val = nil\n else\n # Only non-blank values are allowed to set the type of the Column\n bool_val = convert_to_boolean(val)\n new_val =\n if bool_val.nil?\n convert_to_date_time(val) ||\n convert_to_numeric(val) ||\n convert_to_string(val)\n else\n bool_val\n end\n @type =\n if [true, false].include?(new_val)\n 'Boolean'\n elsif new_val.is_a?(Date) || new_val.is_a?(DateTime)\n 'DateTime'\n elsif new_val.is_a?(Numeric)\n 'Numeric'\n elsif new_val.is_a?(String)\n 'String'\n else\n msg = \"can't add #{val} of type #{new_val.class.name} to a column\"\n raise UserError, msg\n end\n end\n new_val\n when 'Boolean'\n if val.is_a?(String) && val.blank? || val.nil?\n nil\n else\n new_val = convert_to_boolean(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'DateTime'\n if val.blank?\n nil\n else\n new_val = convert_to_date_time(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'Numeric'\n if val.blank?\n nil\n else\n new_val = convert_to_numeric(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n when 'String'\n if val.nil?\n nil\n else\n new_val = convert_to_string(val)\n if new_val.nil?\n msg = \"attempt to add '#{val}' to a column already typed as #{type}\"\n raise UserError, msg\n end\n new_val\n end\n else\n raise UserError, \"Mysteriously, column has unknown type '#{type}'\"\n end\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n if type == :decimal\n # Force an explicit scale if none supplied to specify the fixed\n # point form of Virtuoso's DECIMAL type. If no scale is specified,\n # the Virtuoso DECIMAL type stores floating point values.\n precision ||= 32\n scale ||= 0\n end\n super(type, limit, precision, scale)\n end",
"def type_literal_generic_string(column)\n if column[:text]\n :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n elsif column[:text] == false || column[:size]\n \"varchar(#{column[:size]||default_string_column_size})\"\n else\n :text\n end\n end",
"def type_literal_generic_boolean(column)\n :boolean\n end",
"def type_cast_with_composite_types(value, column)\n case value\n when PostgresCompositeType\n PostgreSQLColumn.composite_type_to_string(value, self)\n when Array, Hash\n if (klass = column.composite_type_class)\n value = klass.new(value)\n PostgreSQLColumn.composite_type_to_string(value, self)\n else\n type_cast_without_composite_types(value, column)\n end\n\t else\n type_cast_without_composite_types(value, column)\n end\n end",
"def native_type_mapping(abstract, rows)\n # The appropriate SQL for :primary_key is hard to derive as\n # ODBC doesn't provide any info on a DBMS's native syntax for\n # autoincrement columns. So we use a lookup instead.\n return adapter.class::PRIMARY_KEY if abstract == :primary_key\n selected_row = rows[0]\n\n # If more than one native type corresponds to the SQL type we're\n # handling, the type in the first descriptor should be the\n # best match, because the ODBC specification states that\n # SQLGetTypeInfo returns the results ordered by SQL type and then by\n # how closely the native type maps to that SQL type.\n # But, for :text and :binary, select the native type with the\n # largest capacity. (Compare SQLGetTypeInfo:COLUMN_SIZE values)\n selected_row = rows.max_by { |row| row[2] } if %i[text binary].include?(abstract)\n result = { name: selected_row[0] } # SQLGetTypeInfo: TYPE_NAME\n\n create_params = selected_row[5]\n # Depending on the column type, the CREATE_PARAMS keywords can\n # include length, precision or scale.\n if create_params && !create_params.strip.empty? && abstract != :decimal\n result[:limit] = selected_row[2] # SQLGetTypeInfo: COL_SIZE\n end\n\n result\n end",
"def sql_type=(val)\n self['sql_type'] = val\n end",
"def sql_type_for_class(klass)\n @typemap[klass]\n end",
"def typecast_value(column_type, value)\n return nil if value.nil?\n case column_type\n when :integer\n Integer(value)\n when :string\n value.to_s\n when :float\n Float(value)\n when :decimal\n case value\n when BigDecimal\n value\n when String, Float\n value.to_d\n when Integer\n value.to_s.to_d\n else\n raise ArgumentError, \"invalid value for BigDecimal: #{value.inspect}\"\n end\n when :boolean\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i\n false\n else\n value.blank? ? nil : true\n end\n when :date\n case value\n when Date\n value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when String\n value.to_date\n else\n raise ArgumentError, \"invalid value for Date: #{value.inspect}\"\n end\n when :time\n case value\n when Time\n value\n when String\n value.to_time\n else\n raise ArgumentError, \"invalid value for Time: #{value.inspect}\"\n end\n when :datetime\n raise(ArgumentError, \"invalid value for #{tc}: #{value.inspect}\") unless value.is_one_of?(DateTime, Date, Time, String)\n if Sequel.datetime_class === value\n # Already the correct class, no need to convert\n value\n else\n # First convert it to standard ISO 8601 time, then\n # parse that string using the time class.\n (Time === value ? value.iso8601 : value.to_s).to_sequel_time\n end\n else\n value\n end\n end",
"def column_types\n @column_types ||= @columns.values\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super if defined?(::Jdbc::H2) || type.to_s != 'integer' || limit == nil\n\n type\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n case type.to_s\n when 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when nil, 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n else\n super\n end\n end",
"def datatype\n @options[:datatype] || (@column ? @column.type : nil)\n end",
"def geometry_simplified_type(sql_type)\n case sql_type\n when /geography\\(point/i then :point\n when /geography\\(linestring/i then :line_string\n when /geography\\(polygon/i then :polygon\n when /geography\\(multipoint/i then :multi_point\n when /geography\\(multilinestring/i then :multi_line_string\n when /geography\\(multipolygon/i then :multi_polygon\n when /geography\\(geometrycollection/i then :geometry_collection\n when /geography/i then :geometry\n else\n super\n end\n end",
"def type_cast(value, type)\n case value\n when Array\n value.collect { |v| type_cast(v, type) }\n else\n # Let's leverage ActiveRecord's type casting, so that casting is consistent\n # with the other models.\n column_for_type_cast = ::ActiveRecord::ConnectionAdapters::Column.new(\"\", nil)\n column_for_type_cast.instance_variable_set(:@type, type)\n value = column_for_type_cast.type_cast(value)\n Time.zone && value.is_a?(Time) ? value.in_time_zone : value\n end\n end",
"def datatypes\n value.document.fetch(\"#{value.key}_type\", [])\n end",
"def type_literal_specific(column)\n type = column[:type]\n type = \"double precision\" if type.to_s == 'double'\n column[:size] ||= default_string_column_size if type.to_s == 'varchar'\n elements = column[:size] || column[:elements]\n \"#{type}#{literal(Array(elements)) if elements}#{' UNSIGNED' if column[:unsigned]}\"\n end",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1, 2; 'smallint'\n when 3, 4; 'integer'\n when 5..8; 'bigint'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end",
"def add_pg_decoders\n if @config[:use_follower_reads_for_type_introspection]\n @default_timezone = nil\n @timestamp_decoder = nil\n\n coders_by_name = {\n \"int2\" => PG::TextDecoder::Integer,\n \"int4\" => PG::TextDecoder::Integer,\n \"int8\" => PG::TextDecoder::Integer,\n \"oid\" => PG::TextDecoder::Integer,\n \"float4\" => PG::TextDecoder::Float,\n \"float8\" => PG::TextDecoder::Float,\n \"numeric\" => PG::TextDecoder::Numeric,\n \"bool\" => PG::TextDecoder::Boolean,\n \"timestamp\" => PG::TextDecoder::TimestampUtc,\n \"timestamptz\" => PG::TextDecoder::TimestampWithTimeZone,\n }\n\n known_coder_types = coders_by_name.keys.map { |n| quote(n) }\n query = <<~SQL % known_coder_types.join(\", \")\n SELECT t.oid, t.typname\n FROM pg_type as t AS OF SYSTEM TIME '-10s'\n WHERE t.typname IN (%s)\n SQL\n\n coders = execute_and_clear(query, \"SCHEMA\", []) do |result|\n result\n .map { |row| construct_coder(row, coders_by_name[row[\"typname\"]]) }\n .compact\n end\n\n map = PG::TypeMapByOid.new\n coders.each { |coder| map.add_coder(coder) }\n @connection.type_map_for_results = map\n\n @type_map_for_results = PG::TypeMapByOid.new\n @type_map_for_results.default_type_map = map\n @type_map_for_results.add_coder(PG::TextDecoder::Bytea.new(oid: 17, name: \"bytea\"))\n @type_map_for_results.add_coder(MoneyDecoder.new(oid: 790, name: \"money\"))\n\n # extract timestamp decoder for use in update_typemap_for_default_timezone\n @timestamp_decoder = coders.find { |coder| coder.name == \"timestamp\" }\n update_typemap_for_default_timezone\n else\n super\n end\n rescue ActiveRecord::StatementInvalid => e\n raise e unless e.cause.is_a? PG::InvalidCatalogName\n # use original if database is younger than 10s\n super\n end",
"def normalise_type(type, length)\n sql_type = case type\n when /^Auto ?Counter$/\n 'int'\n\n when /^Unsigned ?Integer$/,\n /^Signed ?Integer$/,\n /^Unsigned ?Small ?Integer$/,\n /^Signed ?Small ?Integer$/,\n /^Unsigned ?Tiny ?Integer$/\n s = case\n when length == nil\n 'int'\n when length <= 8\n 'tinyint'\n when length <= 16\n 'smallint'\n when length <= 32\n 'int'\n else\n 'bigint'\n end\n length = nil\n s\n\n when /^Decimal$/\n 'decimal'\n\n when /^Fixed ?Length ?Text$/, /^Char$/\n 'char'\n when /^Variable ?Length ?Text$/, /^String$/\n 'varchar'\n when /^Large ?Length ?Text$/, /^Text$/\n 'text'\n\n when /^Date ?And ?Time$/, /^Date ?Time$/\n 'datetime'\n when /^Date$/\n 'datetime' # SQLSVR 2K5: 'date'\n when /^Time$/\n 'datetime' # SQLSVR 2K5: 'time'\n when /^Auto ?Time ?Stamp$/\n 'timestamp'\n\n when /^Guid$/\n 'uniqueidentifier'\n when /^Money$/\n 'decimal'\n when /^Picture ?Raw ?Data$/, /^Image$/\n 'image'\n when /^Variable ?Length ?Raw ?Data$/, /^Blob$/\n 'varbinary'\n when /^BIT$/\n 'bit'\n when /^BOOLEAN$/\n 'boolean'\n else type # raise \"SQL type unknown for standard type #{type}\"\n end\n [sql_type, length]\n end",
"def is_datatype?(); @type == GRT_DATATYPE; end",
"def value_column\n case value_type\n when 'integer' then 'value_integer'\n when 'float' then 'value_float'\n when 'string' then 'value_string'\n else raise_invalid_type\n end\n end",
"def choose_sql_type(type_name, value_constraint, component, options)\n case MM::DataType.intrinsic_type(type_name)\n when MM::DataType::TYPE_Boolean\n data_type_context.boolean_type\n\n when MM::DataType::TYPE_Integer\n # The :auto_assign key is set for auto-assigned types, but with a nil value in foreign keys\n length = options[:length]\n if options.has_key?(:auto_assign)\n options[:default] ||= ' GENERATED ALWAYS AS IDENTITY' if options[:auto_assign]\n length = data_type_context.default_autoincrement_length\n type_name = 'int'\n end\n if chosen = MM::DataType.choose_integer(type_name, length, value_constraint, data_type_context)\n options.delete(:length)\n chosen\n else # No available integer seems to suit. Use the defined type and length\n type_name\n end\n\n when MM::DataType::TYPE_Real\n 'Double'\n\n when MM::DataType::TYPE_Decimal\n 'Decimal'\n\n when MM::DataType::TYPE_Money\n 'Currency'\n\n when MM::DataType::TYPE_Char\n data_type_context.default_char_type\n\n when MM::DataType::TYPE_String\n data_type_context.default_varchar_type\n\n when MM::DataType::TYPE_Text\n options[:length] ||= 'MAX'\n data_type_context.default_text_type\n\n when MM::DataType::TYPE_Date\n 'Date'\n\n when MM::DataType::TYPE_Time\n 'Time'\n\n when MM::DataType::TYPE_DateTime\n 'DateTime'\n\n when MM::DataType::TYPE_Timestamp\n 'Binary'\n\n when MM::DataType::TYPE_Binary\n # If it's a surrogate, that might change the length we use\n binary_surrogate(type_name, value_constraint, options)\n if options[:length]\n 'Binary' # Fixed length\n else\n 'Binary'\n end\n else\n type_name\n end\n end",
"def type_cast_with_gis(*args)\n value, column, _ = args\n if value.nil?\n column.spatial? ? value : type_cast_without_gis(*args)\n elsif value.kind_of?(GeoRuby::SimpleFeatures::Geometry)\n #geometry_to_string(value)\n value.as_hex_ewkb\n else\n type_cast_without_gis(*args)\n end\n end",
"def normalise_type(type, length)\n sql_type = case type\n when /^Auto ?Counter$/\n 'int'\n\n when /^Unsigned ?Integer$/,\n /^Signed ?Integer$/,\n /^Unsigned ?Small ?Integer$/,\n /^Signed ?Small ?Integer$/,\n /^Unsigned ?Tiny ?Integer$/\n s = case\n when length == nil\n 'int'\n when length <= 8\n 'tinyint'\n when length <= 16\n 'smallint'\n when length <= 32\n 'int'\n else\n 'bigint'\n end\n length = nil\n s\n\n when /^Decimal$/\n 'decimal'\n\n when /^Fixed ?Length ?Text$/, /^Char$/\n 'char'\n when /^Variable ?Length ?Text$/, /^String$/\n 'varchar'\n when /^Large ?Length ?Text$/, /^Text$/\n 'text'\n\n when /^Date ?And ?Time$/, /^Date ?Time$/\n 'datetime'\n when /^Date$/\n 'datetime' # SQLSVR 2K5: 'date'\n when /^Time$/\n 'datetime' # SQLSVR 2K5: 'time'\n when /^Auto ?Time ?Stamp$/\n 'timestamp'\n\n when /^Guid$/\n 'uniqueidentifier'\n when /^Money$/\n 'decimal'\n when /^Picture ?Raw ?Data$/, /^Image$/\n 'image'\n when /^Variable ?Length ?Raw ?Data$/, /^Blob$/\n 'varbinary'\n when /^BIT$/\n 'bit'\n else type # raise \"SQL type unknown for standard type #{type}\"\n end\n [sql_type, length]\n end",
"def type_literal_generic_falseclass(column)\n type_literal_generic_trueclass(column)\n end",
"def column_type\r\n @type\r\n end",
"def type_to_sql_with_notext(*args)\n type = type_to_sql_without_notext(*args)\n if type =~ /(text|blob)/\n 'varchar(2500)' # If this is bigger than about 21000 it always fails, and sometimes hits a row limit anyway if too large\n else\n type\n end\n end",
"def set_types(column_types)\n raise NotImplementedError.new\n end",
"def type_literal_generic_trueclass(column)\n :bit\n end",
"def map_type type\n type\n end",
"def map_type type\n type\n end",
"def type_column\n arel_table[polymorphic_type.to_sym] if polymorphic_type\n end",
"def sql_type\n self['sql_type']\n end",
"def user_defined_types(*categories)\n category_condition = categories.present? \\\n ? \"AND t.typtype IN ('#{categories.join(\"', '\")}')\" \\\n : \"AND t.typtype NOT IN ('b', 'd')\"\n\n select_all(<<-SQL, 'SCHEMA').rows.to_h\n SELECT t.typname AS name,\n CASE t.typtype\n WHEN 'e' THEN 'enum'\n END AS type\n FROM pg_type t\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')\n #{category_condition}\n AND NOT EXISTS(\n SELECT 1\n FROM pg_catalog.pg_type el\n WHERE el.oid = t.typelem\n AND el.typarray = t.oid\n )\n AND (t.typrelid = 0 OR (\n SELECT c.relkind = 'c'\n FROM pg_catalog.pg_class c\n WHERE c.oid = t.typrelid\n ))\n ORDER BY t.typtype DESC\n SQL\n end",
"def type_cast(value, type)\n return nil if value.nil?\n case type\n when :string then value\n when :text then value\n when :money then string_to_money(value)\n when :integer then value.to_i rescue value ? 1 : 0\n when :float then value.to_f\n when :datetime then string_to_time(value)\n when :timestamp then string_to_time(value)\n when :time then string_to_dummy_time(value)\n when :date then string_to_date(value)\n when :boolean then value_to_boolean(value)\n else value\n end\n end",
"def assert_type(type, length, precision, scale)\n if type == 'longvarchar'\n return \"character varying(#{length})\"\n end\n\n if type == 'time'\n return \"time with time zone\"\n end\n\n if type == 'tinyint' || type == 'integer'\n return \"integer\"\n end\n\n if type == 'char'\n return \"\\\"char\\\"\"\n end\n\n if type == 'decimal'\n return \"numeric(#{precision},#{scale})\"\n end\n\n if type == 'date'\n return \"date\"\n end\n\nend",
"def map_datapackage_column_types(datapackage_json, csv_name)\n csv_dp_detail = datapackage_json[\"resources\"].detect{ |a| a[\"path\"] == csv_name }\n dp_column_types = {}\n csv_dp_detail[\"schema\"][\"fields\"].each do |sf|\n dp_column_types[sf[\"name\"]] = DATAPACKAGE_TYPE_MAP[sf[\"type\"]]\n end\n dp_column_types\n end",
"def simple_value_type_code\n value_type_code\nend",
"def type_literal_base(column)\n TYPES[column[:type]]\n end",
"def convert_to_native_type(data_type, s)\r\n return kb_nil if s == KB_NIL\r\n\r\n # I added this line to keep KBTable#import_csv working after I made\r\n # the kb_nil changes.\r\n return nil if s.nil?\r\n\r\n case data_type\r\n when :String\r\n if s =~ UNENCODE_RE\r\n return s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&', \"&\")\r\n else\r\n return s\r\n end\r\n when :Integer\r\n return s.to_i\r\n when :Float\r\n return s.to_f\r\n when :Boolean\r\n if ['false', 'False', nil, false].include?(s)\r\n return false\r\n else\r\n return true\r\n end\r\n when :Time\r\n return Time.parse(s) \r\n when :Date\r\n return Date.parse(s)\r\n when :DateTime\r\n return DateTime.parse(s)\r\n when :YAML\r\n # This code is here in case the YAML field is the last\r\n # field in the record. Because YAML normally defines a\r\n # nil value as \"--- \", but KirbyBase strips trailing\r\n # spaces off the end of the record, so if this is the\r\n # last field in the record, KirbyBase will strip the\r\n # trailing space off and make it \"---\". When KirbyBase\r\n # attempts to convert this value back using to_yaml,\r\n # you get an exception.\r\n if s == \"---\"\r\n return nil\r\n elsif s =~ UNENCODE_RE\r\n y = s.gsub('&linefeed;', \"\\n\").gsub('&carriage_return;',\r\n \"\\r\").gsub('&substitute;', \"\\032\").gsub('&pipe;', \"|\"\r\n ).gsub('&', \"&\")\r\n return YAML.load(y)\r\n else\r\n return YAML.load(s)\r\n end\r\n when :Memo\r\n memo = KBMemo.new(@tbl.db, s)\r\n memo.read_from_file\r\n return memo\r\n when :Blob\r\n blob = KBBlob.new(@tbl.db, s)\r\n blob.read_from_file\r\n return blob\r\n else\r\n raise \"Invalid field type: %s\" % data_type\r\n end\r\n end",
"def convert_to_ruby_types(hash) \n hash.keys.each do |key|\n value = hash[key]\n next unless value # Leave nils as nils\n case key\n when 'uid', 'aid'; hash[key] = value.to_i\n when 'created_at'; hash[key] = DateTime.parse(value)\n when 'deleted'; hash[key] = value == 't'\n when 'value'; hash[key] = BigDecimal.new(value)\n when 'count'; hash[key] = value.to_i\n when 'period'\n value =~ /\"(.*?)\",\"(.*?)\"/\n hash[key] = [DateTime.parse($1), DateTime.parse($2)]\n end\n end\n hash\nend",
"def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1..8; 'integer'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with precision 0 instead.\")\n end\n end",
"def stradivari_type(column_name)\n raise NotImplementedError\n end",
"def types\n @types ||= {\n String => GraphQL::STRING_TYPE,\n\n Fixnum => GraphQL::INT_TYPE,\n Integer => GraphQL::INT_TYPE,\n Float => GraphQL::FLOAT_TYPE,\n\n Date => GraphQL::STRING_TYPE,\n Time => GraphQL::STRING_TYPE,\n DateTime => GraphQL::STRING_TYPE,\n\n Array => GraphQL::STRING_TYPE,\n Object => GraphQL::STRING_TYPE,\n Hash => GraphQL::STRING_TYPE,\n }\n end",
"def convert_to_data_type_from_string(type, value)\n case type\n when \"boolean\"\n # Since we've determined this is a boolean data type, we can assume that:\n # If the value as an int is 1, return true\n # If the value as an int is 0 (not 1), return false\n value.to_i == 1\n when \"integer\"\n value.to_i\n when \"float\"\n value.to_f\n when \"string\", \"dictionary\"\n value\n when nil\n \"\"\n else\n raise \"Unknown or unsupported data type: #{type.class}\"\n end\n end",
"def replace_late_bound_types_with_built_in(types)\n GraphQL::Schema::BUILT_IN_TYPES.each do |scalar_name, built_in_scalar|\n existing_type = types[scalar_name]\n if existing_type.is_a?(GraphQL::Schema::LateBoundType)\n types[scalar_name] = built_in_scalar\n end\n end\n end",
"def type_literal(column)\n case column[:type]\n when Class\n type_literal_generic(column)\n when :Bignum\n type_literal_generic_bignum_symbol(column)\n else\n type_literal_specific(column)\n end\n end"
] |
[
"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.64543265",
"0.6443502",
"0.64143866",
"0.638477",
"0.6354706",
"0.6351226",
"0.6274018",
"0.6273318",
"0.6273318",
"0.6273318",
"0.62193036",
"0.61701643",
"0.616902",
"0.6164717",
"0.61437106",
"0.60953367",
"0.60776544",
"0.6069268",
"0.6062682",
"0.6044078",
"0.6025269",
"0.60229063",
"0.6010479",
"0.59917057",
"0.5984922",
"0.5983972",
"0.5968553",
"0.5967543",
"0.5957472",
"0.592616",
"0.59101737",
"0.5906694",
"0.58969057",
"0.58835995",
"0.58814615",
"0.5880282",
"0.5871803",
"0.58639413",
"0.5849157",
"0.5833192",
"0.58299977",
"0.5824481",
"0.5824191",
"0.5817593",
"0.5809661",
"0.57926095",
"0.57821524",
"0.57775927",
"0.57456064",
"0.572944",
"0.57212746",
"0.57186055",
"0.5715295",
"0.5703531",
"0.5691417",
"0.56878656",
"0.5683815",
"0.5664355",
"0.56528443",
"0.5647275",
"0.5635315",
"0.5614699",
"0.56054926",
"0.56054926",
"0.5600141",
"0.55962825",
"0.55954266",
"0.5593632",
"0.5590652",
"0.5588555",
"0.55853665",
"0.5577542",
"0.5569335",
"0.5563386",
"0.5560274",
"0.55545115",
"0.55531836",
"0.5546707",
"0.5537734",
"0.5534992"
] |
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 standard_conforming_strings = #{value}\", 'SCHEMA')\n @standard_conforming_strings = ( value == \"on\" )\n rescue\n @standard_conforming_strings = :unsupported\n ensure\n self.client_min_messages = client_min_messages\n end\n end",
"def set_standard_conforming_strings\n execute('SET standard_conforming_strings TO ON') rescue nil\n end",
"def supports_standard_conforming_strings?\n true\n end",
"def supports_standard_conforming_strings?\n standard_conforming_strings?\n @standard_conforming_strings != :unsupported\n end",
"def supports_standard_conforming_strings?\n # Temporarily set the client message level above error to prevent unintentional\n # error messages in the logs when working on a PostgreSQL database server that\n # does not support standard conforming strings.\n client_min_messages_old = client_min_messages\n self.client_min_messages = 'panic'\n\n # postgres-pr does not raise an exception when client_min_messages is set higher\n # than error and \"SHOW standard_conforming_strings\" fails, but returns an empty\n # PGresult instead.\n has_support = select('SHOW standard_conforming_strings').to_a[0][0] rescue false\n self.client_min_messages = client_min_messages_old\n has_support\n end",
"def fmtstr_detect_caps\n\t\t@use_dpa = fmtstr_detect_cap_dpa\n\t\t@use_fpu = fmtstr_detect_cap_fpu\n\t\t#print_status(\"support dpa:#{@use_dpa.to_s}, fpu:#{@use_fpu.to_s}\")\n\tend",
"def frozen_string_literal_specified?; end",
"def supports_inflection(str)\n str.is_a?(String) &&\n (str.production? || true)\n rescue\n false\n end",
"def fmtstr_set_caps(fpu, dpa)\n\t\t@use_fpu = fpu\n\t\t@use_dpa = dpa\n\tend",
"def make_compatible_with_env\n # Check whether environment supports Unicode\n # FIXME this is ugly, and there most likely are better ways to do this\n is_unicode_supported = %w( LC_ALL LC_CTYPE LANG ).any? { |e| ENV[e] =~ /UTF/ }\n return self if is_unicode_supported\n\n # Decompose if necessary\n # FIXME this decomposition is not generally usable\n self.gsub(/“|”/, '\"').gsub(/‘|’/, '\\'').gsub('…', '...')\n end",
"def check_and_set_string_type\n key = self.key.to_sym\n if KEY_TO_STRING_OPTIONS.key?(key)\n # If there are explicit string options, match the value to one of them.\n matched = false\n options = KEY_TO_STRING_OPTIONS[key]\n options.each do |opt|\n if Metadatum.str_to_basic_chars(text_raw_value) == Metadatum.str_to_basic_chars(opt)\n # Ex: Match 'neb ultra-iifs dna' to 'NEB Ultra II FS DNA'\n # Ex: Match '30-day mortality' to \"30 Day Mortality\"\n self.text_validated_value = opt\n matched = true\n break\n end\n end\n unless matched\n errors.add(:text_raw_value, \"#{text_raw_value} did not match options #{options.join(', ')}\")\n end\n else\n self.text_validated_value = text_raw_value\n end\n end",
"def sanitize_string(string)\n return string unless string\n\n # HACK the #to_s is in here because RSpec has an Array of Arrays of\n # Strings for authors. Need a way to disallow bad values on gemspec\n # generation. (Probably won't happen.)\n string.to_s\n end",
"def frozen_string_literal?; end",
"def convert_boolean_strings\n %i{ambiguous_ref_bases use_all_contigs include_low_hmes polyploidy}.each do | symbol |\n if @options.key?(symbol)\n @options[symbol] = @options[symbol] == 'false' ? false : true\n end\n end\n end",
"def force_utf32; end",
"def force_utf32; end",
"def force_utf32; end",
"def set_string_enforcer\n @string_enforcer = ExampleUser.find(params[:id])\n end",
"def string_enforcer_params\n params.fetch(:string_enforcer, {})\n end",
"def double_quotes_required?(string); end",
"def double_quotes_required?(string); end",
"def prefer_unicode\n context[:prefer_unicode]\n end",
"def force_utf32=(_arg0); end",
"def force_utf32=(_arg0); end",
"def force_utf32=(_arg0); end",
"def apply_validations_for_string\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a String\") if value && (! value.kind_of?(String)) && (! value.kind_of?(Symbol))\n end\n end",
"def param_check_string(_param, _display, _value)\n critical_error('the param_check_string method was not overridden after being included in a database class')\n end",
"def enforce_available_locales!(locale); end",
"def force_encoding(*args) settings.force_encoding(*args) end",
"def include?(str)\n fa.accepts?(str)\n end",
"def RelaxNG(string_or_io, options = T.unsafe(nil)); end",
"def RelaxNG(string_or_io, options = T.unsafe(nil)); end",
"def is_strtype?(); @type == GRT_STRTYPE; end",
"def modify_strings\n [:name, :nickname, :character_name, :face_name].each do |s|\n cs = instance_variable_get(\"@#{s}\")\n if SES::ExternalText::Uninstall && cs.is_a?(SES::ExternalText::TextWrapper)\n instance_variable_set(\"@#{s}\", cs.to_s)\n else\n wrapper = SES::ExternalText::TextWrapper.new(s, self.actor)\n instance_variable_set(\"@#{s}\", wrapper)\n end\n end\n end",
"def enable_strict!\n @strict = true\n end",
"def minimal_set_encoding\n res1=self.hyphenated_set_encoding\n res2=self.set_escaped\n res1.size < res2.size ? res1 : res2\n end",
"def frozen_string_literal; end",
"def frozen_string_literal; end",
"def encode_default_external(string)\n string.encode(Encoding.default_external)\n end",
"def add_restricted_string(string)\n @restricted_strings.push(string)\n end",
"def encode_string_ex; end",
"def utf8_enforcer_tag; end",
"def expand_strings(value=false)\n @strings_expansion = value\n end",
"def set_string_args\n if @option_string\n log \"setting string options #{@option_string} ...\"\n\n if @op.set_from_string(@option_string) != 0\n raise Error\n end\n end\n end",
"def contains_forbidden?(string)\n string.dup.force_encoding('UTF-8').include?(\"\\u2019\")\n end",
"def autofinish; end",
"def canonize str\n\n case support(\"CASEMAPPING\", \"rfc1459\").downcase\n\n when \"ascii\"\n str.upcase\n\n when \"rfc1459\", nil\n str.upcase.tr(\"|{}^\", \"\\\\\\\\[]~\")\n\n when \"strict-rfc1459\"\n str.upcase.tr(\"|{}\", \"\\\\\\\\[]\")\n\n else\n str.upcase.tr(\"|{}^\", \"\\\\\\\\[]~\")\n\n end\n\n end",
"def acts_like_string?\n true\n end",
"def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end",
"def strict \n @lenient = false \n end",
"def strict \n @lenient = false \n end",
"def str_early_hints(headers); end",
"def language_aware!\n\t\traise_if_error C.glyr_opt_lang_aware_only(to_native, true)\n\tend",
"def sanitize string, compact: true\n string = string.gsub SanitizeXMLRx, '' if string.include? '<'\n string = string.gsub(CharRefRx) { $1 ? BuiltInNamedEntities[$1] : ([$2 ? $2.to_i : ($3.to_i 16)].pack 'U1') } if string.include? '&'\n compact ? (string.strip.tr_s ' ', ' ') : string\n end",
"def get_true( string, non_significants = /[\\s',\\.\\-\\_]/ )\n string.gsub(non_significants, '').upcase\n end",
"def sanitize(string, options = {})\n Engine.clean(string)\n end",
"def unify_string str\n\t\t\t@strings_dictionary[str] ||= str\n\t\tend",
"def str_d_enabled\n str_od_enabled(d)\n end",
"def full_sanitizer=(_arg0); end",
"def full_sanitizer=(_arg0); end",
"def full_sanitizer=(_arg0); end",
"def localize_present?\n false\n end",
"def metaphone(str, options = T.unsafe(nil)); end",
"def add_string_protected_status(string)\r\n string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'\r\n string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'\r\n return string \r\n end",
"def add_string_protected_status(string)\r\n string.concat(@PARAM_HASH['AMOUNT']) if @PARAM_HASH['PROTECT_AMOUNT'] == 'Yes'\r\n string.concat([@PARAM_HASH['REBILLING'], @PARAM_HASH['REB_CYCLES'], @PARAM_HASH['REB_AMOUNT'], @PARAM_HASH['REB_EXPR'], @PARAM_HASH['REB_FIRST_DATE']].join('')) if @PARAM_HASH['REB_PROTECT'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID']) if @PARAM_HASH['PROTECT_CUSTOM_ID'] == 'Yes'\r\n string.concat(@PARAM_HASH['CUSTOM_ID2']) if @PARAM_HASH['PROTECT_CUSTOM_ID2'] == 'Yes'\r\n return string \r\n end",
"def canonicalize=(v)\n @string_rule.canonicalize = v\n end",
"def replace_invalid_characters(str)\n utf8_string = SUPPORTED_ENCODINGS.include?(str.encoding)\n return str if utf8_string && str.valid_encoding?\n\n temp_str = str.dup\n temp_str.encode!(TEMP_ENCODING, **ENCODING_OPTIONS) if utf8_string\n temp_str.encode!('utf-8', **ENCODING_OPTIONS)\n end",
"def use_i18n=(value); end",
"def str_o_enabled\n str_od_enabled(o)\n end",
"def Extension=(v) Axlsx::validate_string",
"def strict; end",
"def string_replacements\nend",
"def can_encode?(str)\n str.nil? || !(GSM_REGEX =~ str).nil?\n end",
"def can_encode?(str, charset: BASIC_CHARSET)\n !str || !!(regex(charset) =~ str)\n end",
"def strict_mode=(value); end",
"def authen_type_ascii!()\n @authen_type = TAC_PLUS_AUTHEN_TYPE_ASCII\n end",
"def fix_encoding(str)\n str.force_encoding(Encoding.default_external) if str.respond_to?(:force_encoding)\n str\nend",
"def force_encoding(string)\n string.force_encoding(encoding)\n end",
"def set_str(x)\n @str = x\n end",
"def enable_language_autodetect\n put \"languages/enable_autodetect\", nil\n end",
"def sweetist_safe_string(string)\n string.nil? ? \"\" : string.gsub(/'/, {\"'\" => \"\\\\'\"})\n end",
"def unicode_filter_encode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str\n end",
"def coerce_string(value, options = {})\n if options.fetch(:allow_nil, true)\n return if value.nil?\n value = value.to_s\n return if value.empty? && options.fetch(:nil_when_empty, false)\n end\n\n value = value.to_s.dup.force_encoding(Encoding::UTF_8)\n\n # TODO: Instead of providing unconfigurable defaults like this, use\n # set_default_attribute_options at the gem level or consumer level.\n value.strip! if options.fetch(:strip, true)\n value.upcase! if options.fetch(:upcase, false)\n\n value\n end",
"def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end",
"def string?; end",
"def html_sanitizer(string, set=:basic)\n if set == :basic\n $htmlmap = MAPPINGS[:base]\n else\n $htmlmap = MAPPINGS[:base].merge!(MAPPINGS[:title])\n end\n\n string = string.split(\"\")\n string.map! { |char|\n ( $htmlmap.has_key?(char.unpack('U')[0]) ) ? $htmlmap[char.unpack('U')[0]] : char\n }\n\n\n return string.join\nend",
"def str(str)\n Atoms::Str.new(str)\n end",
"def is_string?(); @type == GRT_STRING; end",
"def strict_wkt11?\n @strict_wkt11\n end",
"def safe_parameterize(str)\n if str.chars.all? { |c| c.bytes.count == 1 }\n str.parameterize\n else\n # At least change spaces to dashes\n str.gsub(/\\s+/, '-')\n end\n end",
"def good(str = '')\n show(\"Good for #{str}\")\n true\n end",
"def str_od_enabled(od)\n od ? OD_TEXT_TRUE : OD_TEXT_FALSE\n end",
"def plugin_prefix=(str) \n self[:plugin_prefix] = compact_string(str)\n end",
"def validate_and_sanitize\n super\n end",
"def force_encoding(*); self; end",
"def coerce_str_to_bool(*keys)\n coerce(*keys){ |str_bool| (str_bool == 'on' || str_bool == 'true')}\n end",
"def reserved_word?(str)\n RESERVED_WORDS.include?(str.downcase)\n end",
"def standard?\n self.syntax = :invalid\n self.valid_size? or return false\n self.valid_encoding? or return false\n if self.local =~ STANDARD_LOCAL_REGEX\n self.syntax = :standard\n true\n else\n false\n end\n end",
"def allow_short_words\n not @emphasis[:ignore_short_words]\n end"
] |
[
"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.53397006",
"0.53397006",
"0.5315558",
"0.524317",
"0.524317",
"0.524317",
"0.5212578",
"0.51940334",
"0.51910096",
"0.5178883",
"0.51700443",
"0.5125848",
"0.5125848",
"0.50837225",
"0.5073928",
"0.50649",
"0.50476944",
"0.5036595",
"0.5036595",
"0.5026627",
"0.5022083",
"0.50044394",
"0.4998123",
"0.49944952",
"0.49944812",
"0.4983968",
"0.49713686",
"0.49669704",
"0.4960014",
"0.4957641",
"0.49476206",
"0.49476206",
"0.49184164",
"0.48975182",
"0.48877037",
"0.48844394",
"0.48699054",
"0.4863371",
"0.48563156",
"0.48467356",
"0.48467356",
"0.48467356",
"0.48422846",
"0.48263007",
"0.4813824",
"0.4813824",
"0.48081395",
"0.47987103",
"0.479686",
"0.4792456",
"0.478429",
"0.47802532",
"0.47781977",
"0.4775303",
"0.4769079",
"0.4768892",
"0.4757616",
"0.47509605",
"0.47352144",
"0.47339958",
"0.47248265",
"0.47242725",
"0.47242525",
"0.47192296",
"0.47192237",
"0.47177953",
"0.47110185",
"0.47080722",
"0.47066233",
"0.47033426",
"0.47022048",
"0.47001284",
"0.4693702",
"0.4689718",
"0.46865785",
"0.4682879",
"0.46787426",
"0.46784517",
"0.46723992",
"0.4671275"
] |
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\n raise NotImplementedError\n end",
"def migrate\n run_migrations pending_migrations, :up\n end",
"def target_postgresql_version; end",
"def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end",
"def migrate?\n raise NotImplementedError\n end",
"def migrate\n maintenance = Heroku::PgMigrate::Maintenance.new(api, app)\n scale_zero = Heroku::PgMigrate::ScaleZero.new(api, app)\n rebind = Heroku::PgMigrate::RebindConfig.new(api, app)\n provision = Heroku::PgMigrate::Provision.new(api, app)\n foi_pgbackups = Heroku::PgMigrate::FindOrInstallPgBackups.new(api, app)\n transfer = Heroku::PgMigrate::Transfer.new(api, app)\n check_shared = Heroku::PgMigrate::CheckShared.new(api, app)\n release_num = Heroku::PgMigrate::ReleaseNumber.new(api, app)\n\n mp = Heroku::PgMigrate::MultiPhase.new()\n mp.enqueue(check_shared)\n mp.enqueue(foi_pgbackups)\n mp.enqueue(provision)\n mp.enqueue(release_num)\n mp.enqueue(maintenance)\n mp.enqueue(scale_zero)\n mp.enqueue(transfer)\n mp.enqueue(rebind)\n\n mp.engage()\n end",
"def check_schema_migrations\n return if column_family_exists?('schema_migrations')\n say 'Creating schema_migrations column family'\n DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').primary_key('cf')\n .columns(cf: :text, digest: :text, solrconfig: :text, stopwords: :text).execute\n end",
"def migrate!\n connect! unless connected?\n Sequel.extension :migration\n Sequel::Migrator.run(db, File.join(__dir__, \"../../db/migrations\"), table: schema_table)\n end",
"def migrate\n ActiveRecord::Schema.define do\n self.verbose = true # or false\n\n enable_extension \"plpgsql\"\n #enable_extension \"pgcrypto\"\n\n create_table(:access_lines, force: true) do |t|\n t.string :line, null: false\n t.datetime :timestamp, null: false\n t.string :username, null: false\n t.string :peer_id, null: false\n end\n\n # A backup for the uniqueness validation in AccessLine\n add_index :access_lines, [:timestamp, :username], unique: true\n end\n end",
"def pre_migrate_database\n old_schema_version = get_schema_version\n new_schema_version = File.read(File.join(source_directory,'db','schema_version')).to_i\n \n return unless old_schema_version > 0\n \n # Are we downgrading?\n if old_schema_version > new_schema_version\n message \"Downgrading schema from #{old_schema_version} to #{new_schema_version}\"\n \n in_directory install_directory do\n unless system(\"rake -s migrate VERSION=#{new_schema_version}\")\n raise InstallFailed, \"Downgrade migrating from #{old_schema_version} to #{new_schema_version} failed.\"\n end\n end\n end\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def migrate\n migrations_path = File.join(File.dirname(__FILE__), \"#{backend_name}/migrations\")\n Sequel.extension :migration\n unless Sequel::Migrator.is_current?(@db, migrations_path)\n store = self; log = @log; @db.instance_eval { @log = log; @store = store }\n Sequel::Migrator.run(@db, migrations_path)\n unless (v = @db[:schema_info].first) && v[:magic] && v[:backend]\n @db[:schema_info].update(\n magic: Bitcoin.network[:magic_head].hth, backend: backend_name)\n end\n end\n end",
"def target_postgresql_version=(_arg0); end",
"def generate_migrations\n versions = []\n versions << generate_migration(\"create_users\", <<-EOF\nHanami::Model.migration do\n change do\n create_table :users do\n primary_key :id\n column :name, String\n end\n end\nend\nEOF\n)\n\n versions << generate_migration(\"add_age_to_users\", <<-EOF\nHanami::Model.migration do\n change do\n add_column :users, :age, Integer\n end\nend\nEOF\n)\n versions\n end",
"def connect_to_migration_db\n ActiveRecord::Base.establish_connection(\n adapter: 'postgresql',\n encoding: 'unicode',\n pool: 10,\n url: ENV['MIGRATION_DB_URL']\n )\n ActiveRecord::Base.connection.execute(\n \"SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY;\"\n )\n end",
"def postgresql_version\n 100000\n end",
"def migrate\n with_maintenance do\n backup if backup?\n run_migration\n restart\n end\n end",
"def migrate version = nil\n if @migrations\n schema = meta_schema\n version = __check_migration_version(version)\n __create_meta_data_table_for(schema)\n\n s = schema.first || schema.new(version: 0)\n unless s.version == version\n @migrations.sort_by { |migration| migration.version }.each do |m|\n m.migrate(:up) if s.version < m.version and m.version <= version\n\n if s.version >= m.version and m.version > version\n m.migrate(:down)\n else # Handle migrate(0)\n m.migrate(:down) if s.version >= m.version and version.zero?\n end\n end\n s.update_attribute :version, version\n end\n version = s.version\n end\n version\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def initialize_schema_migrations_table\n unless table_exists?('schema_migrations')\n execute(\"CREATE TABLE schema_migrations (version string primary key INDEX using plain)\")\n end\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def migrate!\n Migrator.migrate(name)\n end",
"def do_migrations\n migration_path = File.join(\"generators\", \"talia\", \"templates\", \"migrations\")\n ActiveRecord::Migrator.migrate(migration_path, ENV[\"VERSION\"] ? ENV[\"VERSION\"].to_i : nil )\n end",
"def migrations\n rake 'admin:install:migrations'\n rake 'db:migrate SCOPE=admin'\n end",
"def migrated_up(migration)\n column_family.insert({\n data: {\n version: migration.version.to_s,\n name: migration.name,\n migrated_at: Time.now.utc,\n },\n })\n end",
"def dump_schema_migration(options={})\n ts = tables(options)\n <<END_MIG\nSequel.migration do\n up do\n#{ts.sort_by{|t| t.to_s}.map{|t| dump_table_schema(t, options)}.join(\"\\n\\n\").gsub(/^/o, ' ')}\n end\n \n down do\n drop_table(#{ts.sort_by{|t| t.to_s}.inspect[1...-1]})\n end\nend\nEND_MIG\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n /^(?<version>\\d{3,})/ =~ File.basename(version_or_filename)\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_path, version.to_i)\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def migrate\n ActiveRecord::Migrator.migrate(File.join(db_dir, \"migrate\"))\n end",
"def migrations\n raise(ArgumentError, \"Can't set migrations while using :version option\") if @using_deprecated_version_setting\n yield\n end",
"def check_schema_migrations\n unless column_family_exists?('schema_migrations')\n say \"Creating schema_migrations column family\"\n connection.execute_cql_query(DatastaxRails::Cql::CreateColumnFamily.new('schema_migrations').key_type(:text).columns(:digest => :text, :solrconfig => :text, :stopwords => :text).to_cql)\n end\n \n check_key_name('schema_migrations')\n end",
"def create_tables!\n migrate(:up)\n end",
"def after_restore\n change_ownership(\"postgres\")\n change_permissions($seven_zero_zero)\n create_symlink\n start_postgres\nend",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as the schema_migrations table will not exist.\n SchemaMigration.find_or_create_by_version(version) rescue nil\n end\n end",
"def run_migrations(migrations)\n migrations.each do |direction, version_or_filenames|\n Array.wrap(version_or_filenames).each do |version_or_filename|\n version = File.basename(version_or_filename)[/\\d{3,}/]\n\n if defined? ActiveRecord::MigrationContext # >= 5.2\n ActiveRecord::Base.connection.migration_context.run(direction, version.to_i)\n else\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version.to_i)\n end\n end if version_or_filenames\n end\n if ActiveRecord::Base.schema_format == :ruby\n File.open(ENV['SCHEMA'] || \"#{Rails.root}/db/schema.rb\", 'w') do |file|\n ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)\n end\n end\n #TODO unload migraion classes\n end",
"def migrate(key, options); end",
"def install_migrations\n migrations = [\n \"create_blogelator_posts.rb\",\n \"create_blogelator_authors.rb\",\n \"create_blogelator_tags.rb\",\n \"create_blogelator_posts_tags.rb\",\n \"create_blogelator_posts_posts.rb\"\n ]\n migration_path = \"db/migrate\"\n migrations.each do |file|\n migration_template \"#{migration_path}/#{file}\", \"#{migration_path}/#{file}\"\n end\n end",
"def migrate\n DataMapper.auto_migrate!\n end",
"def up\n ActiveRecord::Base.transaction do\n migrate_cause\n migrate_messages\n end\n end",
"def test_adding_pigs_to_the_farm_with_t_dot_references_farm_foreign_key_true\n premigrate\n table = \"pigs\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\)/, schema(table))\n end",
"def dbmigrate!\n ActiveRecord::Base.establish_connection(PuppetHerald.database.spec)\n ActiveRecord::Migrator.up 'db/migrate'\n ActiveRecord::Base.clear_active_connections!\n nil\n end",
"def upgrade(migrations, context, meta_node)\n migrations.each do |m|\n Neo4j.logger.info \"Running upgrade: #{m}\"\n m.execute_up(context, meta_node)\n end\n end",
"def only_correct_postgres_version\n %w(8.4 9.0 9.1 9.2 9.3 9.4 9.5 9.6).each do |version|\n if version != postgresql_version.to_s # need to_s, because YAML may think it's a float\n package \"postgresql-#{version}\", :ensure => :absent\n package \"postgresql-contrib-#{version}\", :ensure => :absent\n end\n end\n end",
"def migrate(_key, _options); end",
"def postgresql_database\n # FIXME work in progress\n #encoding = \"-E #{configuration[:postgresql][:encoding]}\" if configuration[:postgresql][:encoding]\n encoding = ''\n template = \"-T #{configuration[:postgresql][:template_database]}\" if configuration[:postgresql][:template_database]\n\n exec \"postgresql_database\",\n :command => \"/usr/bin/createdb -O #{database_environment[:username]} #{encoding} #{template} #{database_environment[:database]}\",\n :unless => \"/usr/bin/psql -l | grep #{database_environment[:database]}\",\n :user => 'postgres',\n :require => exec('postgresql_user'),\n :before => exec('rake tasks')#,\n # :notify => exec('rails_bootstrap') # TODO make this configurable to work with multi_server\n end",
"def migrate_database\n RFlow.logger.debug 'Applying default migrations to config database'\n migrations_path = File.join(File.dirname(__FILE__), 'configuration', 'migrations')\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate migrations_path\n end",
"def migrations\n @migrations ||= {}\n end",
"def migrate(schema, to_version = nil)\n conn = ActiveRecord::Base.connection\n return false unless conn.schema_exists? schema\n current_search_path = conn.schema_search_path\n conn.schema_search_path = schema\n ActiveRecord::Migrator.migrate('db/migrate', to_version)\n conn.schema_search_path = current_search_path\n end",
"def migration_railties; end",
"def migration_railties; end",
"def psql(args)\n \"psql -X -q #{args}\"\nend",
"def in_migration?(node)\n dirname(node).end_with?('db/migrate', 'db/geo/migrate') || in_post_deployment_migration?(node)\n end",
"def migrate\n puts \"Migrating your database\"\n version = `ls db/migrate | wc -l`.to_i\n ActiveRecord::Base.establish_connection(Play.config['db'])\n ActiveRecord::Migrator.migrate(\"#{File.dirname(__FILE__)}/../db/migrate/\", version)\nend",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def schema_migrations_cleanup\n # Read all schema_migrations values from the dump.\n values = dump.scan(/^(\\(\\'\\d{14}\\'\\))[,;]\\n/).flatten.sort\n\n # Replace the schema_migrations values.\n dump.sub!(\n /(?<=INSERT INTO \"schema_migrations\" \\(version\\) VALUES).+;\\n*/m,\n \"\\n #{values.join(\"\\n,\")}\\n;\\n\\n\"\n )\n end",
"def test_adding_sheep_to_the_farm_with_t_dot_foreign_key_farm_column_id_shearing_farm_id\n premigrate\n table = \"sheep\"\n migrate table\n assert_match(/FOREIGN KEY \\(\\\"shearing_farm_id\\\"\\) REFERENCES \\\"farms\\\"\\(id\\)/, schema(table))\n end",
"def migrate( target_version = nil )\n base = File.join( LIB_DIR, '..', '..', 'db' )\n\n profiles = Hooker.apply( [ :iudex, :migration_profiles ], [] )\n\n ext = profiles.compact.map { |p| \"/#{p}\" }.join(',')\n base += \"{#{ext},}\" unless ext.empty?\n ActiveRecord::Migrator.migrate( base, target_version )\n end",
"def run_db_migrate_rake_task(rollback = false)\n run_custom_build_steps :before_database_migrations\n\n old_schema_version = 0\n old_schema_version = @metadata.read(schema_version_cache).chomp.to_i if @metadata.exists?(schema_version_cache)\n rollback = true if old_schema_version > schema_version\n old_schema_version = @metadata.read(rollback_schema_version_cache).chomp if @metadata.exists?(rollback_schema_version_cache) && rollback\n return true if schema_same_since?(old_schema_version)\n\n instrument \"rails3.run_db_migrate_rake_task\" do\n log(\"db_migrate\") do\n\n migrate = rake.task(\"db:migrate\")\n migrate = rake.task(\"db:rollback\") if rollback\n\n return true unless migrate.is_defined?\n\n if ENV['FORCE_DATABASE_MIGRATIONS']\n topic(\"Forcing database migrations.\")\n else\n topic(\"Running database migrations\") unless rollback\n topic(\"Rolling back database to version #{old_schema_version}\") if rollback\n end\n\n if user_env_hash.empty?\n default_env = {\n \"DATABASE_URL\" => ENV[\"DATABASE_URL\"] || default_database_url\n }\n else\n default_env = {\n \"DATABASE_URL\" => default_database_url\n }\n end\n\n default_env['VERSION'] = old_schema_version if rollback\n\n cache.load migrations_cache if rollback # we need the newer migrations to be able to rollback\n\n migrate.invoke(env: default_env.merge(user_env_hash).merge(\"RAILS_ENV\" => \"migrations\"))\n\n if migrate.success?\n log \"db_migrate\", :status => \"success\"\n puts \"Database migrations completed (#{\"%.2f\" % migrate.time}s)\" unless rollback\n puts \"Database rollback completed (#{\"%.2f\" % migrate.time}s)\" if rollback\n\n FileUtils.mkdir_p(heroku_metadata)\n @metadata.write(rollback_schema_version_cache, old_schema_version, false)\n @metadata.write(schema_version_cache, schema_version, false) unless rollback\n @metadata.write(schema_version_cache, old_schema_version, false) if rollback\n @metadata.save\n\n cache.store migrations_cache\n\n run_custom_build_steps :after_database_migrations\n else\n log \"db_migrate\", :status => \"failure\"\n error \"Database migrations failed.\" unless rollback\n error \"Database rollback failed.\" if rollback\n end\n end\n end\n end",
"def generate_migration(tables)\n return if tables.empty? && @db_tables.empty?\n result.clear\n\n add_line \"Sequel.migration do\"\n indent do\n generate_migration_body(tables)\n end\n add_line \"end\\n\"\n\n result.join(\"\\n\")\n end",
"def copy_migrations\n rake 'hyrax:install:migrations'\n end",
"def migrate(verbose = false)\n\t\tbegin\n\t\t\tmigrate_dir = ::File.join(Msf::Config.install_root, \"data\", \"sql\", \"migrate\")\n\t\t\tActiveRecord::Migration.verbose = verbose\n\t\t\tActiveRecord::Migrator.migrate(migrate_dir, nil)\n\t\trescue ::Exception => e\n\t\t\tself.error = e\n\t\t\telog(\"DB.migrate threw an exception: #{e}\")\n\t\t\tdlog(\"Call stack:\\n#{e.backtrace.join \"\\n\"}\")\n\t\t\treturn false\n\t\tend\n\t\treturn true\n\tend",
"def migrate!(opts)\n raise NotSupportedError, \"Unable to migrate using `#{self}`\"\n end",
"def migration\n options[:migration] != false\n end",
"def migrate(path, version = nil)\n # Establish a connection for migration.\n ActiveRecord::Base.establish_connection(@connection_config)\n ActiveRecord::Migration.verbose = false\n # Namespace definition for the current database.\n # This will ensure that each database is migrated independently.\n ActiveRecord::Base.table_name_prefix = base_model.table_name_prefix\n ActiveRecord::Migrator.migrate(path, version)\n # Clean-up once done.\n ActiveRecord.send(:remove_const, :SchemaMigration)\n load 'active_record/schema_migration.rb'\n ActiveRecord::Base.table_name_prefix = ''\n ActiveRecord::Base.connection.close\n end",
"def run_active_record_migrations!\n ActiveRecord::Migration.verbose = false\n ActiveRecord::Migrator.migrate([\"test/fixtures/migrate\"])\n end",
"def setup_db\n ActiveRecord::Schema.define(:version => 1) do\n create_table :users do |t|\n t.string :login\n t.string :email\n t.boolean :change\n end\n end\nend",
"def migrate(version = nil)\n @logger.fine('Running test migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'test/database/migrations'), version)\n end",
"def run_migration\n return unless allow_migrations && db_migration_schema != DefaultMigrationSchema\n\n puts \"Running migration from #{db_migration_dirname}\"\n Rails.logger.warn \"Running migration from #{db_migration_dirname}\"\n\n Timeout.timeout(60) do\n # Outside the current transaction\n Thread.new do\n ActiveRecord::Base.connection_pool.with_connection do\n self.class.migration_context(db_migration_dirname).migrate\n # Don't dump until a build, otherwise differences in individual development environments\n # force unnecessary and confusing commits\n # pid = spawn('bin/rake db:structure:dump')\n # Process.detach pid\n end\n end.join\n end\n\n self.class.tables_and_views_reset!\n\n true\n rescue StandardError => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n rescue FphsException => e\n FileUtils.mkdir_p db_migration_failed_dirname\n FileUtils.mv @do_migration, db_migration_failed_dirname\n raise FphsException, \"Failed migration for path '#{db_migration_dirname}': #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def career_migration_data\n<<RUBY\nt.string :title\n t.string :position\n t.string :location\n t.text :description\n t.text :questions\n t.boolean :status,default: true\n\nRUBY\n end",
"def migrate(version = nil)\n ActiveRecord::ConnectionAdapters::SchemaStatements.class_eval do\n include Goldberg::SchemaStatements\n end\n\n version && (version = version.to_i)\n super(\"#{RAILS_ROOT}/vendor/plugins/#{plugin_name}/db/migrate\", version)\n end",
"def copy_migrations\n # Can't get this any more DRY, because we need this order.\n better_migration_template \"create_searches.rb\"\n better_migration_template \"create_bookmarks.rb\"\n better_migration_template \"remove_editable_fields_from_bookmarks.rb\"\n better_migration_template \"add_user_types_to_bookmarks_searches.rb\"\n end",
"def psql\n uri = generate_ingress_uri(\"Connecting\")\n ENV[\"PGPASSWORD\"] = uri.password\n ENV[\"PGSSLMODE\"] = 'require'\n system \"psql -U #{uri.user} -h #{uri.host} -p #{uri.port || 5432} #{uri.path[1..-1]}\"\n end",
"def copy_migrations\n [\n 'change_audit_log_pid_to_generic_file_id.rb',\n 'change_proxy_deposit_request_pid_to_generic_file_id.rb'\n ].each do |file|\n better_migration_template file\n end\n end",
"def setup\n setup_test_database\n drop_and_create_schema_migrations_table\n end",
"def pending_migrations?\n ROM::SQL.with_gateway(self) {\n migrator.pending?\n }\n end",
"def run_migrations\n return unless pending_migrations?\n callback(:run_migrations) do\n notify(:run_migrations)\n heroku.run_migrations\n end\n end",
"def generate_migration\n generate('migration enable_pgcrypto_extension')\n end",
"def target_sql_mode; end",
"def migration_exists?(table_name)\n Dir.glob(\"#{File.join(destination_root, migration_path)}/[0-9]*_*.rb\").grep(/\\d+_add_heimdallr_#{table_name}.rb$/).first\n end",
"def migrate options = {}\n options.to_options!\n chroot do\n util.spawn \"rake RAILS_ENV=#{ Bj.rails_env } db:migrate\", options\n end\n end",
"def migrate_configuration\n puts \"migrating configuration\"\n ActiveRecord::Base.connection.execute('truncate table configuration')\n Configuration.create name: 'home', data: {headlines: [], today: [], tracklists: []}\n Configuration.create name: 'home_components', data: {headlines: 5, today: 3, tracklists: 3}\n Configuration.create name: 'navigation', data: {categories: []}\n Configuration.create name: 'about', data: {hebrew: nil, english: nil}\nend",
"def drop_and_create_schema_migrations_table\n sql = [\n \"USE #{@database}\",\n 'DROP TABLE IF EXISTS schema_migrations',\n 'CREATE TABLE schema_migrations ( version varchar(255) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY unique_schema_migrations (version)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'\n ]\n\n run_commands(sql)\n end",
"def dump_schema_migration(options=OPTS)\n options = options.dup\n if options[:indexes] == false && !options.has_key?(:foreign_keys)\n # Unless foreign_keys option is specifically set, disable if indexes\n # are disabled, as foreign keys that point to non-primary keys rely\n # on unique indexes being created first\n options[:foreign_keys] = false\n end\n\n ts = sort_dumped_tables(_dump_tables(options), options)\n skipped_fks = if sfk = options[:skipped_foreign_keys]\n # Handle skipped foreign keys by adding them at the end via\n # alter_table/add_foreign_key. Note that skipped foreign keys\n # probably result in a broken down migration.\n sfka = sfk.sort.map{|table, fks| dump_add_fk_constraints(table, fks.values)}\n sfka.join(\"\\n\\n\").gsub(/^/, ' ') unless sfka.empty?\n end\n\n <<END_MIG\nSequel.migration do\n change do\n#{ts.map{|t| dump_table_schema(t, options)}.join(\"\\n\\n\").gsub(/^/, ' ')}#{\"\\n \\n\" if skipped_fks}#{skipped_fks}\n end\nend\nEND_MIG\n end",
"def migration\n migration_template 'migration.rb', 'db/migrate/create_seo_landing_pages.rb'\n end",
"def migration?(migration)\n @migrations.include?(migration)\n end",
"def install_migrations\n rake(\"maintenance_tasks:install:migrations\")\n rake(\"db:migrate\")\n end",
"def psql_on_app_db(*args)\n psql_on_db(fetch(:pg_database), *args)\n end",
"def apply\n migration.up\n end",
"def migrate_ar_to_sequel( opts )\n\n columns = ( db.table_exists?( :schema_migrations ) &&\n db.schema( :schema_migrations ).map { |sr| sr[0] } )\n\n if columns == [ :version ] # Old format AR schema_migrations\n db.transaction do\n versions = db.from( :schema_migrations ).\n map { |r| r[ :version ].to_i }\n\n if ( versions & AR_REQUIRED ) != AR_REQUIRED\n missing = AR_REQUIRED - ( versions & AR_REQUIRED )\n raise( ARNotComplete,\n \"Missing AR migrations #{missing.inspect}; \" +\n \"Use 'iudex-migrate _1.2.1_' first\" )\n end\n\n migrations_map = AR_TO_SEQUEL_MIGRATIONS.\n merge( opts[ :ar_to_sequel_migrations ] || {} )\n\n db.drop_table( :schema_migrations )\n db.create_table( :schema_migrations ) do\n String :filename, :null => false\n primary_key [ :filename ]\n end\n\n sm = db[:schema_migrations]\n sm.insert( :filename => '20111012173757_base.rb' )\n\n migrations_map.each do | version, filename |\n sm.insert( :filename => filename ) if versions.include?( version )\n end\n end\n end\n end",
"def install_migrations\n\t\tsay_status :copying, \"migrations\"\n\t\trake 'railties:install:migrations'\n\tend",
"def generate!\n ::ActiveRecord::Base.establish_connection 'production'\n Schemaless::MigrationsGenerator.new(all_tables).invoke_all\n end",
"def copy_migrations\n [\n \"acts_as_follower_migration.rb\",\n \"add_social_to_users.rb\",\n \"add_ldap_attrs_to_user.rb\",\n \"add_avatars_to_users.rb\",\n \"add_groups_to_users.rb\",\n \"create_local_authorities.rb\",\n \"create_trophies.rb\",\n 'add_linkedin_to_users.rb',\n 'create_tinymce_assets.rb',\n 'create_content_blocks.rb',\n 'create_featured_works.rb',\n 'add_external_key_to_content_blocks.rb'\n ].each do |file|\n better_migration_template file\n end\n end"
] |
[
"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.6471234",
"0.64518535",
"0.64324105",
"0.6391854",
"0.6350485",
"0.63327533",
"0.63327533",
"0.63327533",
"0.63290685",
"0.6329032",
"0.6293818",
"0.62932414",
"0.625144",
"0.62360984",
"0.620294",
"0.6167597",
"0.61449665",
"0.61396915",
"0.61378074",
"0.6121014",
"0.60366017",
"0.60357994",
"0.60285884",
"0.60021025",
"0.59990966",
"0.599366",
"0.59931886",
"0.59835094",
"0.5955738",
"0.5952736",
"0.5942035",
"0.5934953",
"0.5928362",
"0.59060436",
"0.59059006",
"0.5904551",
"0.5904551",
"0.58966017",
"0.5885546",
"0.58816636",
"0.5860724",
"0.5860724",
"0.5859322",
"0.5859106",
"0.58569777",
"0.58459055",
"0.58457685",
"0.5839807",
"0.5839141",
"0.58359194",
"0.5835328",
"0.5826447",
"0.5822081",
"0.58141804",
"0.58105665",
"0.5788781",
"0.57820934",
"0.57764316",
"0.5767419",
"0.576397",
"0.575866",
"0.5742757",
"0.57409924",
"0.57301927",
"0.5729381",
"0.5721304",
"0.571927",
"0.5701488",
"0.5697354",
"0.5696624",
"0.56933427",
"0.5689172",
"0.56839025",
"0.5682636",
"0.567954",
"0.5677475",
"0.56772316",
"0.5671751",
"0.5660873"
] |
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_catalog = 'reaktor'\n AND tc.table_schema = 'public'\n AND tc.table_name = ?\n ORDER BY ordinal_position;\n }\n\n sth = $dbh_pg.prepare(query)\n begin\n sth.execute(table.to_s)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not find primary key. Message: #{$!}. query: #{get_query_string(sth)}\")\n raise\n exit\n end\n pk = []\n while row = sth.fetch\n pk << row[0]\n end\n return pk\nend",
"def primary_key\n select(&:primary_key?)\n end",
"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 'id' # table.primary_key || 'id'\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(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_keys[quoted_table] if @primary_keys.has_key?(quoted_table)}\n value = _select_pk_ds.where_single_value(Sequel[:pg_class][:oid] => regclass_oid(table, opts))\n Sequel.synchronize{@primary_keys[quoted_table] = value}\n end",
"def pkey\n table = self.class.table_name\n key = get_primary_key_values.first\n return key\n end",
"def primary_key(table_name)\n pk_and_sequence_for(table_name)[0]\n rescue\n nil\n end",
"def primary_key\n return @primary_key if @primary_key\n return 'id' if @id\n \n candidates = @columns.find_all { |col| col.unique }.map { |col| col.name }\n return 'id' if candidates.include? 'id'\n candidates.find { |c| c =~ eval(\"/^#{@name}.*id$/i\") } ||\n candidates.find { |c| c =~ eval(\"/^#{singularize}.*id$/i\") } ||\n candidates.find { |c| c =~ eval(\"/^#{pluralize}.*id$/i\") } ||\n candidates.first\n end",
"def primary_key(table_name)\n stmt = @connection.primary_keys(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop unless stmt.nil?\n result[0] && result[0][3]\n end",
"def primary_key(table_name)\n pk = super\n\n if pk == CockroachDBAdapter::DEFAULT_PRIMARY_KEY\n nil\n else\n pk\n end\n end",
"def find_primary_key_by_table(table_name)\n @opts[:primary_key].values_at(table_name).first\n end",
"def primary_key table\n return nil unless table\n table = self[table]\n pk = table.column_names.find{ |c| table[c].primary_key? }\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_key(table_name)\n # TODO: Change this to be a pure mongo lookup by digging into document definitions\n # TODO: Manage _id and id\n id_definition = Mongo::DocumentDefinition.fields_for(table_name).find { |_, field_definition| field_definition['primary_key'] }\n Array(id_definition).first # && id_definition.first || '_id'\n end",
"def primary_key(table_name) #:nodoc:\r\n sql = \"SELECT COLUMN_NAME FROM (EXECUTE PROCEDURE sp_GetBestRowIdentifier( NULL, NULL, '#{table_name}', NULL, FALSE)) as gbri\"\r\n rs = select(sql)\r\n if !rs.nil? and !rs[0].nil?\r\n strip_or_self(rs[0]['COLUMN_NAME'])\r\n else\r\n nil\r\n end\r\n end",
"def primary_key(table)\n t = dataset.send(:input_identifier, table)\n @primary_keys.fetch(t) do\n pk = fetch(\"SELECT RDB$FIELD_NAME FROM RDB$INDEX_SEGMENTS NATURAL JOIN RDB$RELATION_CONSTRAINTS WHERE RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' AND RDB$RELATION_NAME = ?\", t).single_value\n @primary_keys[t] = dataset.send(:output_identifier, pk.rstrip) if pk\n end\n end",
"def primary_key?\n schema && schema[:primary_key]\n end",
"def primary_key_name\n @primary_key_name ||= @connection.schema[@table_name.to_s][:primary_key]\n end",
"def key\n get_primary_key_value_map[self.class.table_name]\n end",
"def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n elsif dataset.joined_dataset?\n # SEQUEL5: Remove as joined model datasets are not allowed\n dataset.first(qualified_primary_key_hash(pk))\n else\n dataset.first(primary_key_hash(pk))\n end\n end",
"def primary_keys(table)\n row = exec_query(<<-end_sql, 'SCHEMA').rows.map do |row|\n SELECT DISTINCT(attr.attname)\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1]\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n row && row.first\n end\n end",
"def primary_keys(table)\n pks = query(<<-end_sql, 'SCHEMA')\n SELECT DISTINCT attr.attname\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey)\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n pks.present? ? pks[0] : pks\n end",
"def primary_key\n fail NotImplementedError\n end",
"def has_primary_key(db, table, key)\n return db.primary_key(table) == key.to_s if db.respond_to?(:primary_key)\n\n pk_column_info = db.schema(table).find { |column_info| column_info[0] == key }\n return false if pk_column_info.nil?\n\n pk_column_info[1][:primary_key] == true\nend",
"def supports_primary_key?\n true\n end",
"def primary_key\n @primary_key ||= :id\n end",
"def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n else\n dataset.first(primary_key_hash(pk))\n end\n end",
"def primary_key\n 'id'\n end",
"def primary_key(_table_name)\n []\n end",
"def primary_key_constraint_sql_fragment(_)\n 'PRIMARY KEY'\n end",
"def primary_keys(field)\n sql = \"SELECT #{field.primary_key_col} from #{field.table} \"\n sql += \"#{where_and(sql)} #{field.column} IS NOT NULL \" if field.leave_null\n field.where&.each_pair do |column, value|\n sql += \"#{where_and(sql)} #{column} = #{value} \"\n end\n sql += \"ORDER BY #{field.primary_key_col};\"\n execute(sql).split(\"\\n\")\nend",
"def primary_key(table_name, opts=OPTS)\n quoted_table = quote_schema_table(table_name)\n Sequel.synchronize{return @primary_keys[quoted_table] if @primary_keys.has_key?(quoted_table)}\n out_identifier, in_identifier = identifier_convertors(opts)\n schema, table = schema_or_current_and_table(table_name, opts)\n dataset = metadata_dataset.\n select(:kc__column_name).\n from(Sequel.as(:information_schema__key_column_usage, 'kc')).\n join(Sequel.as(:information_schema__table_constraints, 'tc'),\n [:table_name, :table_schema, :constraint_name]).\n where(:kc__table_name => in_identifier.call(table),\n :kc__table_schema => schema,\n :tc__constraint_type => 'PRIMARY KEY')\n value = dataset.map do |row|\n out_identifier.call(row.delete(:column_name))\n end\n value = case value.size\n when 0 then nil\n when 1 then value.first\n else value\n end\n Sequel.synchronize{@primary_keys[quoted_table] = value}\n end",
"def primary_key\n @primary_key || 'id'\n end",
"def primary_key\n send( self.class.primary_key )\n end",
"def primary_key_type\n \"integer PRIMARY KEY\"\n end",
"def orchestrate_primary_key\n id\n end",
"def pk_and_sequence_for(table_name)\n (owner, table_name) = @connection.describe(table_name)\n\n # RSI: changed select from all_constraints to user_constraints - much faster in large data dictionaries\n pks = select_values(<<-SQL, 'Primary Key')\n select cc.column_name\n from user_constraints c, user_cons_columns cc\n where c.owner = '#{owner}'\n and c.table_name = '#{table_name}'\n and c.constraint_type = 'P'\n and cc.owner = c.owner\n and cc.constraint_name = c.constraint_name\n SQL\n\n # only support single column keys\n pks.size == 1 ? [oracle_downcase(pks.first), nil] : nil\n end",
"def primary_key\n '_id'\n end",
"def full_primary_key(klass)\n \"#{klass.quoted_table_name}.#{klass.quoted_primary_key}\"\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n @primary_key\n end",
"def primary_key\n unless @primary_key\n pk_column_names = Set.new( primary_key_columns.collect { |c| c.name } )\n unique_indexes = indexes.values.find_all { |i| i.unique? }\n\n pk_result = []\n\n unique_indexes.each do |idx|\n idx_column_names = Set.new( idx.columns.collect { |c| c.name } )\n r = idx_column_names ^ pk_column_names\n if r.size == 0 then\n pk_result = idx.columns\n break\n end\n end\n\n # no joy, see about just using all the columns that say the are primary\n # keys\n if pk_result.empty? then\n pk_result = self.primary_key_columns\n end\n @primary_key = pk_result\n end\n return @primary_key\n end",
"def _select_pk_ds\n @_select_pk_ds ||= metadata_dataset.\n from(:pg_class, :pg_attribute, :pg_index, :pg_namespace).\n where{[\n [pg_class[:oid], pg_attribute[:attrelid]],\n [pg_class[:relnamespace], pg_namespace[:oid]],\n [pg_class[:oid], pg_index[:indrelid]],\n [pg_index[:indkey].sql_subscript(0), pg_attribute[:attnum]],\n [pg_index[:indisprimary], 't']\n ]}.\n select{pg_attribute[:attname].as(:pk)}\n end",
"def _with_pk_loader\n cached_placeholder_literalizer(:_with_pk_loader) do |pl|\n table = model.table_name\n cond = case primary_key = model.primary_key\n when Array\n primary_key.map{|key| [SQL::QualifiedIdentifier.new(table, key), pl.arg]}\n when Symbol\n {SQL::QualifiedIdentifier.new(table, primary_key)=>pl.arg}\n else\n raise(Error, \"#{model} does not have a primary key\")\n end\n\n where(cond).limit(1)\n end\n end",
"def _with_pk_loader\n cached_placeholder_literalizer(:_with_pk_loader) do |pl|\n table = model.table_name\n cond = case primary_key = model.primary_key\n when Array\n primary_key.map{|key| [SQL::QualifiedIdentifier.new(table, key), pl.arg]}\n when Symbol\n {SQL::QualifiedIdentifier.new(table, primary_key)=>pl.arg}\n else\n raise(Error, \"#{model} does not have a primary key\")\n end\n\n where(cond).limit(1)\n end\n end",
"def primary_key_columns\n @columns.values.find_all { |c| c.primary_key? }\n end",
"def primary_key\n primary_key = attributes.find { |a| a.primary_key? }\n error(\"Unable to locate primary key for #{self.name}, attributes => #{attributes.collect { |a| a.name }}\") unless primary_key\n primary_key\n end",
"def qualified_primary_key\n cached_fetch(:qualified_primary_key){qualify_cur(primary_key)}\n end",
"def supports_primary_key? #:nodoc:\n true\n end",
"def insert_pk\n if (f = opts[:from]) && !f.empty?\n case t = f.first\n when Symbol, String, SQL::Identifier, SQL::QualifiedIdentifier\n if pk = db.primary_key(t)\n pk\n end\n end\n end\n end",
"def primary_key\n return @primary_key if @primary_key\n @primary_key = dimension_table.to_s.camelize.constantize.primary_key.to_sym\n rescue NameError => e\n ETL::Engine.logger.debug \"couldn't get primary_key from dimension model class, using default :id\"\n @primary_key = :id\n end",
"def primary_key(table_name)\n table_name = table_name.to_s\n\n @primary_keys ||= {}\n @primary_keys[table_name] ||= if @registration[:primary_key].present?\n @registration[:primary_key].call(@connection, table_name)\n else\n @connection.primary_key(table_name)\n end\n end",
"def primary_key?\n self.primary_key\n end",
"def primary_key_lookup(pk)\n return super unless use_prepared_statements_for_pk_lookup?\n # SEQUEL5: Remove\n prepared_lookup.call(primary_key_hash(pk))\n end",
"def primary_key\n self[:primary_key]\n end",
"def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end",
"def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end",
"def primary_key(name, type = :primary_key, **options)\n column(name, type, **options.merge(primary_key: true))\n end",
"def primary_keys\n ::Kernel.raise Errors::NotImplemented\n end",
"def primary_key(table, field)\n execute \"ALTER TABLE #{table} ADD PRIMARY KEY(#{field_list(field)})\"\n end",
"def primary_key_attribute\n :id\n end",
"def pk_and_sequence_for(table_name, with_seq_schema = false)\n result = select_rows(\n \"SELECT kc.column_name, \"+\n (with_seq_schema ? \"c.sequence_schema, \" : \"\") +\n \" c.sequence_name \"+\n \"FROM information_schema.table_constraints tc \"+\n \"INNER JOIN information_schema.key_column_usage kc \"+\n \" ON tc.table_schema = kc.table_schema \"+\n \" AND tc.table_name = kc.table_name \"+\n \" AND tc.constraint_name = kc.constraint_name \"+\n \"LEFT JOIN information_schema.columns c \"+\n \" ON kc.table_schema = c.table_schema \"+\n \" AND kc.table_name = c.table_name \"+\n \" AND kc.column_name = c.column_name \"+\n \"WHERE tc.table_schema = CURRENT_SCHEMA \"+\n \" AND tc.table_name = '#{table_name}' \"+\n \" AND tc.constraint_type = 'PRIMARY KEY'\",\n SCHEMA_LOG_NAME\n )\n (result.length == 1) ? result[0] : nil\n rescue\n nil\n end",
"def primary_key\n cached_fetch(:primary_key){associated_class.primary_key || raise(Error, \"no primary key specified for #{associated_class.inspect}\")}\n end",
"def primary_key\n @primary_key ||= @klass.primary_key.to_s\n end",
"def pk_and_sequence_for(table) #:nodoc:\n # First try looking for a sequence with a dependency on the\n # given table's primary key.\n result = select(<<-end_sql, 'PK and serial sequence')[0]\n SELECT attr.attname, seq.relname\n FROM pg_class seq,\n pg_attribute attr,\n pg_depend dep,\n pg_namespace name,\n pg_constraint cons\n WHERE seq.oid = dep.objid\n AND seq.relkind = 'S'\n AND attr.attrelid = dep.refobjid\n AND attr.attnum = dep.refobjsubid\n AND attr.attrelid = cons.conrelid\n AND attr.attnum = cons.conkey[1]\n AND cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n\n if result.nil? or result.empty?\n # If that fails, try parsing the primary key's default value.\n # Support the 7.x and 8.0 nextval('foo'::text) as well as\n # the 8.1+ nextval('foo'::regclass).\n result = select(<<-end_sql, 'PK and custom sequence')[0]\n SELECT attr.attname,\n CASE\n WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN\n substr(split_part(def.adsrc, '''', 2),\n strpos(split_part(def.adsrc, '''', 2), '.')+1)\n ELSE split_part(def.adsrc, '''', 2)\n END as relname\n FROM pg_class t\n JOIN pg_attribute attr ON (t.oid = attrelid)\n JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)\n JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])\n WHERE t.oid = '#{quote_table_name(table)}'::regclass\n AND cons.contype = 'p'\n AND def.adsrc ~* 'nextval'\n end_sql\n end\n\n [result[\"attname\"], result[\"relname\"]]\n rescue\n nil\n end",
"def need_associated_primary_key?\n true\n end",
"def primary_key?\n false\n end",
"def pk_and_sequence_for(table)\n # try looking for a seq with a dependency on the table's primary key :\n result = select(<<-end_sql, 'PK and Serial Sequence')[0]\n SELECT attr.attname, seq.relname\n FROM pg_class seq,\n pg_attribute attr,\n pg_depend dep,\n pg_constraint cons\n WHERE seq.oid = dep.objid\n AND seq.relkind = 'S'\n AND attr.attrelid = dep.refobjid\n AND attr.attnum = dep.refobjsubid\n AND attr.attrelid = cons.conrelid\n AND attr.attnum = cons.conkey[1]\n AND cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n\n if result.nil? || result.empty?\n # if that fails, try parsing the primary key's default value :\n result = select(<<-end_sql, 'PK and Custom Sequence')[0]\n SELECT attr.attname,\n CASE\n WHEN pg_get_expr(def.adbin, def.adrelid) !~* 'nextval' THEN NULL\n WHEN split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2) ~ '.' THEN\n substr(split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2),\n strpos(split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2), '.')+1)\n ELSE split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2)\n END as relname\n FROM pg_class t\n JOIN pg_attribute attr ON (t.oid = attrelid)\n JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)\n JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])\n WHERE t.oid = '#{quote_table_name(table)}'::regclass\n AND cons.contype = 'p'\n AND pg_get_expr(def.adbin, def.adrelid) ~* 'nextval|uuid_generate'\n end_sql\n end\n\n [ result['attname'], result['relname'] ]\n rescue\n nil\n end",
"def primary_key\n @attributes[self.primary_key_attribute]\n end",
"def primary_key(name, type = :primary_key, options = {})\n return super unless type == :uuid\n options[:default] = options.fetch(:default, 'uuid_generate_v4()')\n options[:primary_key] = true\n column name, type, options\n end",
"def primary_key(name, type = :primary_key, options = {})\n return super unless type == :uuid\n options[:default] = options.fetch(:default, 'uuid_generate_v4()')\n options[:primary_key] = true\n column name, type, options\n end",
"def need_associated_primary_key?\n true\n end",
"def primary_key_sequence(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_key_sequences[quoted_table] if @primary_key_sequences.has_key?(quoted_table)}\n cond = {Sequel[:t][:oid] => regclass_oid(table, opts)}\n value = if pks = _select_serial_sequence_ds.first(cond)\n literal(SQL::QualifiedIdentifier.new(pks[:schema], pks[:sequence]))\n elsif pks = _select_custom_sequence_ds.first(cond)\n literal(SQL::QualifiedIdentifier.new(pks[:schema], LiteralString.new(pks[:sequence])))\n end\n\n Sequel.synchronize{@primary_key_sequences[quoted_table] = value} if value\n end",
"def primary_key\n case primary_key_prefix_type\n when :table_name\n Inflector.foreign_key(class_name_of_active_record_descendant(self), false)\n when :table_name_with_underscore\n Inflector.foreign_key(class_name_of_active_record_descendant(self))\n else\n \"id\"\n end\n end",
"def quoted_primary_key\n @quoted_primary_key ||= connection.quote_column_name(primary_key)\n end",
"def association_primary_key(klass = nil)\n active_record.primary_key\n end",
"def primary_key\n self[:primary_key] ||= self[:model].primary_key\n end",
"def primary_key(value=nil)\n self.primary_key = value unless value.nil?\n \n @primary_key ||= :id\n end",
"def missing_primary_key(source_row:, node_id:)\n # nothing\n end",
"def pk_hash\n model.primary_key_hash(pk)\n end",
"def insert_pk\n (f = opts[:from]) && !f.empty? && (t = f.first)\n case t\n when Symbol, String, SQL::Identifier, SQL::QualifiedIdentifier\n if pk = db.primary_key(t)\n Sequel::SQL::Identifier.new(pk)\n end\n end\n end",
"def key\n stores_foreign_key? ? foreign_key : primary_key\n end",
"def get_pkey_fields(table_struct)\n pkeys = []\n\n table_struct.each do | row |\n pkeys << row[:field] if row[:key] == 'PRI'\n end\n\n pkeys\nend",
"def primary_key\n fields.select { |f| f.key }.map(&:name)\n end",
"def need_associated_primary_key?\n false\n end",
"def pk_field(klass)\n pk = klass.primary_key\n return klass.ann(pk, :field) || pk\n end",
"def need_associated_primary_key?\n false\n end",
"def dataset_need_primary_key?\n true\n end",
"def original_primary_key\n if sourceRD.naturalKey == \"id\"\n \"original_id\"\n else\n sourceRD.naturalKey\n end\n end",
"def pk\n raise(Error, \"No primary key is associated with this model\") unless key = primary_key\n case key\n when Array\n key.collect{|k| @values[k]}\n else\n @values[key]\n end\n end",
"def autoincrementing_primary_key\n primary_key\n end",
"def autoincrementing_primary_key\n primary_key\n end",
"def relation_primary_key(relation)\n relation_reflect(relation).association_primary_key\n end",
"def with_pk(pk)\n primary_key_lookup(pk)\n end",
"def with_pk(pk)\n primary_key_lookup(pk)\n end",
"def schema_autoincrementing_primary_key?(schema)\n !!(schema[:primary_key] && schema[:auto_increment])\n end"
] |
[
"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.6949984",
"0.69393384",
"0.6938704",
"0.69263524",
"0.69202405",
"0.6914157",
"0.68213135",
"0.6812285",
"0.6808052",
"0.6806193",
"0.6804756",
"0.6788865",
"0.6783292",
"0.678109",
"0.6779819",
"0.6769789",
"0.67534167",
"0.67523855",
"0.6735375",
"0.67266345",
"0.6726431",
"0.67165536",
"0.67165536",
"0.67165536",
"0.6713223",
"0.6711096",
"0.6706183",
"0.669607",
"0.669607",
"0.6663911",
"0.665645",
"0.66537356",
"0.6646002",
"0.66426384",
"0.6631079",
"0.6605191",
"0.6600504",
"0.6593073",
"0.6583094",
"0.65825766",
"0.65825766",
"0.65730083",
"0.65689826",
"0.65667856",
"0.6552904",
"0.6520009",
"0.65169126",
"0.6515615",
"0.64632726",
"0.64628726",
"0.6460239",
"0.6452047",
"0.64478093",
"0.64466643",
"0.64466643",
"0.64384085",
"0.6434894",
"0.64264584",
"0.64227104",
"0.6409319",
"0.64018166",
"0.63757145",
"0.6371545",
"0.63521785",
"0.6341115",
"0.63292754",
"0.6311463",
"0.6304901",
"0.62936056",
"0.6285828",
"0.6281633",
"0.62466425",
"0.6244392",
"0.624335",
"0.6234511",
"0.6234511",
"0.62338537",
"0.62331975",
"0.62331975",
"0.62173635"
] |
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 super\n end",
"def log_sql(log_sql = true)\n if log_sql\n Sierra::DB.db.loggers << Sierra::Logging.logger\n else\n Sierra::DB.db.loggers.delete(Sierra::Logging.logger)\n end\n end",
"def sql(event)\n payload = crypt_keeper_payload_parse(event.payload[:sql])\n event.payload[:sql] = crypt_keeper_filter_postgres_log(payload)\n super(event)\n end",
"def jdbc_exception; @jdbc_exception end",
"def log_connection_execute(conn, sql)\n conn.execute(sql)\n end",
"def enable_sql_logging(&block)\n sql_logging(enabled: true, &block)\n end",
"def snapshots_redact_sql_queries; end",
"def log_row(row)\n #overwrite this class\n end",
"def set_logging_statement(opts)\n opts = check_params(opts,[:statement])\n super(opts)\n end",
"def sql_text_log\n @sql_text_log ||= ''\n end",
"def append_to_sql_diff( data_import_session, resulting_row )\n if resulting_row.kind_of?( ActiveRecord::Base )\n # Append also to the session log file:\n append_to_log_file(\n data_import_session,\n \"New #{ resulting_row.class.name } created, ID:#{ resulting_row.id }.\\r\\n\"\n )\n # Append/update the SQL DB-diff text:\n sql_diff_text_log << to_sql_insert( resulting_row, false )\n end\n end",
"def log_sql(query, params = {})\n if @debug\n message = \"#{colorize(\"[#{@name}]\", :cyan)} #{query.gsub(/\\s+/, \" \").strip}\"\n message = \"#{message} #{params.inspect}\" if params.any?\n log message\n end\n end",
"def setup_connection(conn)\n conn = super(conn)\n statement(conn) do |stmt|\n connection_configuration_sqls.each{|sql| log_yield(sql){stmt.execute(sql)}}\n end\n conn\n end",
"def exec_query(sql, name = 'SQL', binds = [])\n if name == :skip_logging\n #execute(sql, name)\n hash_query(sql, name, binds)\n else\n log(sql, name) do\n #execute(sql, name)\n hash_query(sql, name, binds)\n end\n end \n end",
"def prepare_sql; raise \"Define #prepare_sql in your subclass\"; end",
"def sql_state; end",
"def execute(sql, name = nil) \n # Only skip select statements from logging \n unless /^(select|show|begin|commit)/i.match(sql.strip) \n\t\tFile.open( File.join(RAILS_ROOT, 'db', 'ddl.sql'),'a') {|f|\n\t\t\ttemp_sql = sql.gsub(\"\\n\",\"\") \n\t\t\ttemp_sql = temp_sql + ';' if adapter_name != 'IBM_DB2' or adapter_name != 'IBM_DB'\n\t\t\tf.puts temp_sql\n\t\t}\n end\n\t old_execute sql, name\n end",
"def sql_state; jdbc_exception ? jdbc_exception.getSQLState : nil end",
"def log_query(sql)\n pad = ' '\n puts Paint[pad + sql, :cyan, :bold]\n # @loggers[0]&.debug(' ' + sql)\n end",
"def execute(sql, name = nil, binds = []) #:nodoc:\r\n if name == :skip_logging\r\n query(sql, binds)\r\n else\r\n log(sql, name, binds) { query(sql, binds) }\r\n end\r\n end",
"def setup_connection(conn)\n conn = super(conn)\n statement(conn) do |stmt|\n connection_pragmas.each{|s| log_connection_yield(s, conn){stmt.execute(s)}}\n end\n conn\n end",
"def enable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 0\nend",
"def snapshots_redact_sql_queries=(_arg0); end",
"def result_log\n end",
"def result_log\n end",
"def result_log\n end",
"def info_sql\n INFO_SQL\n end",
"def log_current_test_query\n qc_current_inspection = get_current_inspection_record( session[:user_id].id, session[:qc_inspection_type_code] )\n if qc_current_inspection.nil?\n ActiveRecord::Base.connection.execute(\"INSERT INTO qc_current_inspections\n (user_id, qc_inspection_type_code, qc_tests_query, tests_columns_list)\n VALUES(#{session[:user_id].id}, '#{session[:qc_inspection_type_code]}',\n '#{dm_session[:search_engine_query_definition].gsub(/'/, \"''\")}', '#{session[:columns_list].to_yaml}')\")\n else\n ActiveRecord::Base.connection.execute(ActiveRecord::Base.extend_update_sql_with_request(\"UPDATE qc_current_inspections\n SET qc_tests_query = '#{dm_session[:search_engine_query_definition].gsub(/'/, \"''\")}',\n tests_columns_list = '#{session[:columns_list].to_yaml}'\n WHERE user_id = #{session[:user_id].id} AND qc_inspection_type_code = '#{session[:qc_inspection_type_code]}' \"))\n end\n end",
"def sql_modes; end",
"def subscribe_sql_active_record; end",
"def execute(sql, *args, &block)\n @db.log_yield(sql){super}\n rescue SwiftError => e\n @db.send(:raise_error, e)\n end",
"def disable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 1\nend",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def log; end",
"def query(statement, *params) #Use of splat(*) parameter used with methods where you don't know how many arguements it will take \n @logger.info \"#{statement}: #{params}\" #Funtionailty for the ability to see in the local host terminal d-bug output from sinatra showing all of the requests it's accepting; this will alow us to see the SQL queries that are being executed in the db to help troubleshoot \n @db.exec_params(statement, params)\n end",
"def delete_logging_statement\n super\n end",
"def custom_sql(q)\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n query.each { |x| print_line(\"#{x.join(',')}\") } unless query.empty?\n end",
"def execute(sql)\n @db.send(:_execute, self, sql, :log=>false) \n end",
"def do_execute(sql, name = 'SQL')\n log(sql, name) { raw_connection_do(sql) }\n end",
"def initialize\n ActiveRecord::Base.logger = Logger.new(STDOUT)\n end",
"def perform_query\n Rails.logger.info queries.to_sql\n queries\n end",
"def disable_sql_logging(&block)\n sql_logging(enabled: false, &block)\n end",
"def setup_database_logger\n ActiveRecord::Base.logger = PuppetHerald.logger\n nil\n end",
"def execute(sql, name = nil, skip_logging = false)\n translate(sql) do |sql, args|\n if (name == :skip_logging) or skip_logging\n @connection.execute(sql, *args)\n else\n log(sql, args, name) do\n @connection.execute(sql, *args)\n end\n end\n end\n end",
"def sql\n @stmt_api.sql\n end",
"def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end",
"def subscribe_sql_active_record=(_arg0); end",
"def sql_diff_text_log\n @sql_diff_text_log ||= ''\n end",
"def sql_diff_text_log\n @sql_diff_text_log ||= ''\n end",
"def autoflush_log; end",
"def autoflush_log; end",
"def viewlogs args=nil\n db = get_db\n id = args[0].nil? ? db.max_bug_id : args[0]\n row = db.sql_select_rowid \"bugs\", id\n die \"No data found for #{id}\" unless row\n puts \"[#{row['type']} \\##{row['id']}] #{row['title']}\"\n puts row['description'] if row['description']\n puts \n ctr = 0\n db.select_where \"log\", \"id\", id do |r|\n ctr += 1\n puts \"(#{r['date_created']}) #{r['field']} \\t #{r['log']}\"\n #puts \"(#{r['date_created']}) #{r['log']}\"\n end\n message \"No logs found\" if ctr == 0\n 0\n end",
"def sql\n @context.sql\n end",
"def fire\n PassiveRecord::Adapter.execute to_sql\n end",
"def execute(sql, name = nil) #:nodoc:\n log(sql, name) { @connection.exec sql }\n end",
"def execute_dui(sql, opts=OPTS, &block)\n super(prepared_statement_name, opts, &block)\n end",
"def test_basic_read_write\n DbIo::Updates.new_update(@connForge,\n 'insert into db_io.logs (when, msg, level, logger_name, thread) values (?, ?, ?, ?, ?)',\n Timestamp.new(@now),\n 'test msg',\n 'DEBUG',\n 'test.logger',\n 'test.thread')\n .run\n\n result = @query.run(DbIo::LogRecord.java_class, 'select * from db_io.logs')\n\n refute_equal(result.size, 0)\n assert_equal(result.first.msg, 'test msg')\n assert_equal(result.first.level, 'DEBUG')\n assert_equal(result.first.logger_name, 'test.logger')\n assert_equal(result.first.thread, 'test.thread')\n assert_equal(result.first.when, Timestamp.new(@now))\n assert_instance_of(Fixnum, result.first.id)\n end",
"def execute(sql, opts=OPTS, &block)\n super(prepared_statement_name, opts, &block)\n end",
"def sql sql\n @master.puts \"#{sql};\"\n end",
"def log_writer; end",
"def target_sql_mode; end",
"def after_update(record)\n contents = to_sql_update(record)\n to_logfile(contents)\n end",
"def set_record_sql(should_record) # THREAD_LOCAL_ACCESS\n state = Tracer.state\n prev = state.record_sql\n state.record_sql = should_record\n prev.nil? || prev\n end",
"def fetch_log\n raise NotImplementedError\n end",
"def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend",
"def execute(sql)\n @logger.debug(\"SQL: #{sql}\") if @logger\n retrieve_connection.query(sql)\n end",
"def populate\n old_logger = ActiveRecord::Base.logger\n ActiveRecord::Base.logger = nil\n\n begin\n write_data\n \n rc = true\n rescue StandardError => e\n errors[:base] << e.message\n rc = false\n ensure\n ActiveRecord::Base.logger = old_logger \n end\n\n return rc\n end",
"def populate\n old_logger = ActiveRecord::Base.logger\n ActiveRecord::Base.logger = nil\n\n begin\n write_data\n \n rc = true\n rescue StandardError => e\n errors[:base] << e.message\n rc = false\n ensure\n ActiveRecord::Base.logger = old_logger \n end\n\n return rc\n end",
"def query(q)\n begin\n DEBUG_SQL && logger.debug(q)\n super(q)\n rescue\n raise \"MySQL query error, query was :\\n#{q}\\nOriginal message: #{$!.message}\"\n end\n end",
"def post_sql_statements( table_name, options ) # :nodoc:\n post_sql_statements = []\n if options[:on_duplicate_key_update]\n post_sql_statements << sql_for_on_duplicate_key_update( table_name, options[:on_duplicate_key_update] )\n end\n\n #custom user post_sql\n post_sql_statements << options[:post_sql] if options[:post_sql]\n\n #with rollup\n post_sql_statements << rollup_sql if options[:rollup]\n\n post_sql_statements\n end",
"def target_sql_mode=(_arg0); end",
"def logs\n end",
"def log_results(orig_cond_type, condition_type, loop_res, cond_res, orig_loop_res)\n return if Rails.env.production?\n\n begin\n Rails.logger.debug \"**#{orig_cond_type}*******************************************************************************************************\"\n Rails.logger.debug \"this instance: #{@current_instance.id}\"\n Rails.logger.debug \"condition_type: #{condition_type} - loop_res: #{loop_res} - cond_res: #{cond_res} - orig_loop_res: #{orig_loop_res}\"\n Rails.logger.debug @condition_config\n Rails.logger.debug @non_query_conditions\n Rails.logger.debug @base_query.to_sql if @base_query\n Rails.logger.debug @condition_scope.to_sql if @condition_scope\n Rails.logger.debug '*********************************************************************************************************'\n rescue StandardError => e\n Rails.logger.warn \"condition_type: #{condition_type} - loop_res: #{loop_res} - cond_res: #{cond_res} - orig_loop_res: #{orig_loop_res}\"\n Rails.logger.warn @condition_config\n Rails.logger.warn @join_tables\n Rails.logger.warn JSON.pretty_generate(@action_conf)\n Rails.logger.warn \"Failure in calc_actions: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n raise e\n end\n end",
"def prepared_statements\n false\n end",
"def execute(sql, name = nil)\n # lol no, won't hit connection pool just for this one\n #\n # if @connection\n # # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been\n # # made since we established the connection\n # @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone\n # end\n\n log(sql, name) { @connection.query(sql) }\n end",
"def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end",
"def inspect\n \"#<#{self.class.name}: #{sql.inspect}>\"\n end",
"def post_sql_statements( table_name, options ) # :nodoc:\n post_sql_statements = []\n\n if supports_on_duplicate_key_update? && options[:on_duplicate_key_update]\n post_sql_statements << sql_for_on_duplicate_key_update( table_name, options[:on_duplicate_key_update], options[:model], options[:primary_key], options[:locking_column] )\n elsif logger && options[:on_duplicate_key_update]\n logger.warn \"Ignoring on_duplicate_key_update because it is not supported by the database.\"\n end\n\n # custom user post_sql\n post_sql_statements << options[:post_sql] if options[:post_sql]\n\n # with rollup\n post_sql_statements << rollup_sql if options[:rollup]\n\n post_sql_statements\n end",
"def version_inserted_rows\n if versioning_enabled\n logger.warn \"Inserting initial version for inserted rows in '#{name}'\"\n\n last_version = Time.now.to_i\n\n q_versioning = <<-EOF\n INSERT INTO #{versioning} \n SELECT #{fields.map(&:audit).join(', ')}, #{last_version} \n FROM #{audit} \n WHERE #{audit}.`_copied_at` IS NULL\n EOF\n\n q_audit_update = \"UPDATE #{audit} SET `_last_version`= #{last_version} WHERE `_copied_at` IS NULL\"\n\n db.query(q_versioning)\n db.query(q_audit_update)\n end\n end",
"def log_current_cusiness_context_query\n qc_current_inspection = get_current_inspection_record( session[:user_id].id, session[:qc_inspection_type_code] )\n if qc_current_inspection.nil?\n ActiveRecord::Base.connection.execute(\"INSERT INTO qc_current_inspections\n (user_id, qc_inspection_type_code, qc_business_context_query, columns_list)\n VALUES(#{session[:user_id].id}, '#{session[:qc_inspection_type_code]}',\n '#{dm_session[:search_engine_query_definition].gsub(/'/, \"''\")}', '#{session[:columns_list].to_yaml}')\")\n else\n ActiveRecord::Base.connection.execute(ActiveRecord::Base.extend_update_sql_with_request(\"UPDATE qc_current_inspections\n SET qc_business_context_query = '#{dm_session[:search_engine_query_definition].gsub(/'/, \"''\")}',\n columns_list = '#{session[:columns_list].to_yaml}'\n WHERE user_id = #{session[:user_id].id} AND qc_inspection_type_code = '#{session[:qc_inspection_type_code]}' \"))\n end\n end",
"def log=(log); end",
"def log\n end",
"def notice_sql(sql, config, duration, &explainer)\n if NewRelic::Agent.is_sql_recorded?\n statement = build_database_statement(sql, config, explainer)\n notice_extra_data(statement, duration, :sql)\n end\n end",
"def check_sql_before_running; tarif_optimizator.check_sql_before_running; end",
"def sql! sql=nil\n require 'niceql'\n puts Niceql::Prettifier.prettify_sql sql || $last_sql_command\n end",
"def list_sql_history_snapshots\n update_area = params[:update_area]\n @instance = prepare_param_instance\n @dbid = prepare_param_dbid\n @sql_id = params[:sql_id]\n @parsing_schema_name = params[:parsing_schema_name]\n @time_selection_start = params[:time_selection_start]\n @time_selection_end = params[:time_selection_end]\n\n params[:groupby] = \"snap\" unless params[:groupby] # Default\n case params[:groupby].to_s\n when \"day\" then\n @begin_interval_sql = \"TRUNC(snap.Begin_Interval_Time)\"\n @end_interval_sql = \"TRUNC(snap.Begin_Interval_Time) + INTERVAL '1' DAY\"\n when \"snap\" then\n @begin_interval_sql = \"snap.Begin_Interval_Time\"\n @end_interval_sql = \"snap.End_Interval_Time\"\n else\n raise \"Unsupported value for parameter :groupby (#{params[:groupby]})\"\n end\n\n if @time_selection_start == nil || @time_selection_end == nil\n alter =sql_select_first_row [\"SELECT TO_CHAR(MIN(Begin_Interval_Time), '#{sql_datetime_minute_mask}') Time_Selection_Start,\n TO_CHAR(MAX(End_Interval_Time), '#{sql_datetime_minute_mask}') Time_Selection_End\n FROM DBA_Hist_Snapshot\n WHERE DBID = ?\n AND Instance_Number = ?\n \", @dbid, @instance]\n @time_selection_start =alter.time_selection_start\n @time_selection_end =alter.time_selection_end\n end\n\n @hist = sql_select_all([\"\\\n SELECT /* Panorama-Tool Ramm */\n #{@begin_interval_sql} Begin_Interval_Time,\n #{@end_interval_sql} End_Interval_Time,\n MIN(snap.Begin_Interval_Time) First_Occurrence,\n MAX(snap.End_Interval_Time) Last_Occurrence,\n COUNT(DISTINCT s.Plan_Hash_Value) Execution_Plans,\n MIN(Plan_Hash_Value) First_Plan_Hash_Value,\n MIN(Optimizer_Env_Hash_Value) First_Opt_Env_Hash_Value,\n SUM(Executions_Delta) Executions,\n SUM(Fetches_Delta) Fetches,\n SUM(Parse_Calls_Delta) Parse_Calls,\n SUM(Sorts_Delta) Sorts,\n SUM(Loads_Delta) Loads,\n SUM(Elapsed_Time_Delta)/1000000 Elapsed_Time_Secs,\n SUM(ELAPSED_TIME_Delta/1000000) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_Delta)) ELAPSED_TIME_SECS_PER_EXECUTE,\n SUM(Disk_Reads_Delta) Disk_Reads,\n SUM(DISK_READS_delta) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_Delta)) DISK_READS_PER_EXECUTE,\n SUM(Executions_Delta) / DECODE(SUM(Disk_Reads_Delta), 0, 1, SUM(Disk_Reads_Delta)) Execs_Per_Disk,\n SUM(Buffer_Gets_Delta) Buffer_Gets,\n SUM(BUFFER_GETS_delta) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_delta)) BUFFER_GETS_PER_Exec,\n SUM(BUFFER_GETS_delta) / DECODE(SUM(Rows_Processed_Delta), 0, 1, SUM(Rows_Processed_Delta)) BUFFER_GETS_PER_Row,\n SUM(Rows_Processed_Delta) Rows_Processed,\n SUM(Rows_Processed_Delta) / DECODE(SUM(EXECUTIONS_Delta), 0, 1, SUM(EXECUTIONS_Delta)) Rows_Processed_PER_EXECUTE,\n SUM(CPU_Time_Delta)/1000000 CPU_Time_Secs,\n SUM(ClWait_Delta) /1000000 Cluster_Wait_Time_Secs,\n SUM(ApWait_Delta) /1000000 Application_Wait_Time_secs,\n SUM(CCWait_Delta) /1000000 Concurrency_Wait_Time_secs,\n SUM(IOWait_Delta) /1000000 User_IO_Wait_Time_secs,\n SUM(PLSExec_Time_Delta)/1000000 PLSQL_Exec_Time_secs,\n 100 * (SUM(s.Buffer_Gets_Delta) - SUM(s.Disk_Reads_Delta)) / GREATEST(SUM(s.Buffer_Gets_Delta), 1) Hit_Ratio,\n MIN(s.Snap_ID) Min_Snap_ID,\n MAX(s.Snap_ID) Max_Snap_ID\n FROM DBA_Hist_SQLStat s\n JOIN dba_hist_snapshot snap ON snap.DBID = s.DBID AND snap.Instance_Number= s.instance_number AND snap.Snap_ID = s.Snap_ID\n WHERE s.DBID = ?\n AND s.Instance_Number = ?\n AND s.SQL_ID = ?\n AND snap.End_Interval_time > TO_TIMESTAMP(?, '#{sql_datetime_minute_mask}')\n AND snap.Begin_Interval_time < TO_TIMESTAMP(?, '#{sql_datetime_minute_mask}')\n #{@parsing_schema_name ? \"AND s.Parsing_Schema_Name = ?\" : \"\" }\n GROUP BY #{@begin_interval_sql}, #{@end_interval_sql}\n ORDER BY #{@begin_interval_sql}\n \", @dbid, @instance, @sql_id, @time_selection_start, @time_selection_end].concat(@parsing_schema_name ? [@parsing_schema_name] : []) )\n\n respond_to do |format|\n format.js {render :js => \"$('##{update_area}').html('#{j render_to_string :partial=>\"list_sql_history_snapshots\" }');\"}\n end\n end",
"def db_logger\n self.class.database_logger\n end",
"def execute(sql, opts=OPTS)\n _execute(sql, opts) do |conn|\n begin\n yield(stmt = log_connection_yield(sql, conn){conn.prepare(sql)})\n ensure\n stmt.close if stmt\n end\n end\n end",
"def inspect\n \"#<#{self.class}: #{sql.inspect}>\"\n end",
"def log_formatter; end",
"def log_formatter; end",
"def logs\n\n end",
"def custom_silent_sql(q)\n begin\n query = q + ';' unless q =~ /;$/\n query = @db_connection.query(\"#{query}\")\n return true\n rescue => e\n if e =~ /MySQL server has gone away/\n print_error(\"Lost MySQL Connection!\")\n print_error(\"This is likely due to payload which is too large in size.....\")\n print_error(\"Try compressing with UPX to shrink size down: upx 9 -qq payload.exe\")\n puts \"\\t=> \".white + \"Then try again\".light_red + \".....\".white\n end\n return false\n end\n end"
] |
[
"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.595979",
"0.5953503",
"0.5920809",
"0.58945",
"0.5829642",
"0.5829642",
"0.5829642",
"0.58081114",
"0.57822424",
"0.5767319",
"0.5752168",
"0.57429594",
"0.5741133",
"0.57405615",
"0.57405615",
"0.57405615",
"0.57405615",
"0.57405615",
"0.57405615",
"0.57405615",
"0.57405615",
"0.57232094",
"0.57124406",
"0.5693445",
"0.5668403",
"0.56669855",
"0.5607045",
"0.55911726",
"0.5590732",
"0.55567217",
"0.55564",
"0.55499643",
"0.55398935",
"0.5530263",
"0.5515943",
"0.5515943",
"0.55139023",
"0.55139023",
"0.5511126",
"0.55039006",
"0.5502552",
"0.54869395",
"0.5483187",
"0.5469006",
"0.545237",
"0.544572",
"0.543381",
"0.5431308",
"0.54255867",
"0.5421318",
"0.54114354",
"0.54087585",
"0.54017836",
"0.5389047",
"0.5389047",
"0.5377643",
"0.5374803",
"0.5352053",
"0.5340712",
"0.533985",
"0.5339585",
"0.5338137",
"0.5337124",
"0.53227985",
"0.53117394",
"0.5309815",
"0.5309226",
"0.5301574",
"0.5290757",
"0.5290738",
"0.52876306",
"0.5274859",
"0.52736956",
"0.5271631",
"0.5268152",
"0.5257071",
"0.52518165",
"0.52518165",
"0.52513003",
"0.52412176"
] |
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 begin_db_transaction\n log('begin transaction', nil) do\n begin_isolated_db_transaction(default_transaction_isolation)\n end\n end",
"def begin_db_transaction\n log('BEGIN', 'TRANSACTION') { @connection.begin }\n end",
"def begin_db_transaction\n # PG driver doesn't really do anything on setAutoCommit(false)\n # except for commit-ing a previous pending transaction if any\n log('/* BEGIN */') { @connection.begin }\n end",
"def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end",
"def transaction(start_db_transaction=true)\n yield\n end",
"def begin_db_transaction() end",
"def begin_db_transaction() end",
"def TransactionBegin()\n\t@dbh.do(\"BEGIN\")\nend",
"def begin_transaction\n return System.begin_transaction\n end",
"def start(&block)\n res = database.execute_request(\n :post,\n '/transaction/begin',\n headers: { content_type: 'text/plain' }\n ).body\n self.id = res\n @state = :started\n instance_eval(&block) if block_given?\n self\n end",
"def begin_db_transaction\n @connection.autocommit = false\n end",
"def begin_db_transaction() \n log('Opening boxcar', 'begin_db_transaction()')\n @command_boxcar = []\n end",
"def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end",
"def startRun\n db_cached_connect\n\n @dbh.do(\"BEGIN TRANSACTION;\")\n @dbh.do(\"SELECT startRun();\")\n end",
"def transaction(mode = :deferred, &block)\n @db.transaction(mode, &block)\n end",
"def transaction(start_db_transaction = true)\n transaction_open = false\n begin\n if block_given?\n if start_db_transaction\n begin_db_transaction\n transaction_open = true\n end\n yield\n end\n rescue Exception => database_transaction_rollback\n if transaction_open\n transaction_open = false\n rollback_db_transaction\n end\n raise unless database_transaction_rollback.is_a? ActiveRecord::Rollback\n end\n ensure\n if transaction_open\n begin\n commit_db_transaction\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end\n end",
"def begin_transaction_sql\n SQL_BEGIN\n end",
"def begin_transaction_sql\n SQL_BEGIN\n end",
"def begin\n db.transaction do\n yield\n end\n end",
"def start(&block)\n transaction.start do\n run_callbacks(:transaction, &block)\n end\n end",
"def start\n raise TransactionError, \"Transaction already opened.\" unless @id.nil?\n\n ensure_service!\n tx_res = service.begin_transaction \\\n previous_transaction: @previous_transaction\n @id = tx_res.transaction\n end",
"def transaction\n begin\n if block_given?\n begin_db_transaction\n result = yield\n commit_db_transaction\n result\n end\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end",
"def transaction(opts={}, &blk)\n Toshi.db.transaction(opts, &blk)\n end",
"def transaction\n @database.transaction { yield self }\n end",
"def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end",
"def begin_isolated_db_transaction(isolation)\n log(\"BEGIN ISOLATED - #{isolation}\", 'TRANSACTION') { @connection.begin(isolation) }\n end",
"def begin_transaction(conn)\n log_info(TRANSACTION_BEGIN)\n conn.setAutoCommit(false)\n conn\n end",
"def begin_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n _trans(conn)[:savepoints][-1][:obj] = log_connection_yield('Transaction.savepoint', conn){conn.set_savepoint}\n else\n log_connection_yield('Transaction.begin', conn){conn.setAutoCommit(false)}\n set_transaction_isolation(conn, opts)\n end\n end",
"def start_transaction\n NewRelic::Agent.instance.events.notify(:start_transaction)\n end",
"def begin_isolated_db_transaction(isolation)\n @connection.transaction transaction_isolation_levels.fetch(isolation, isolation)\n end",
"def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end",
"def start_transaction(**options)\n get_current_hub&.start_transaction(**options)\n end",
"def transaction(*sqls)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n db.transaction do\n sqls.each do |sql|\n db.execute(sql)\n end\n end\n ensure\n db.close\n end\n end",
"def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def begin_transaction(conn, opts={})\n log_yield(TRANSACTION_BEGIN){conn.setAutoCommit(false)}\n conn\n end",
"def transaction(&block); end",
"def begin_transaction(conn, opts={})\n set_transaction_isolation(conn, opts)\n super\n end",
"def trans\n\t\tbegin\n\t app = Aas::Application\n\t doc = app.DocumentManager.MdiActiveDocument\n\t db = doc.Database\n\t tr = doc.TransactionManager.StartTransaction\n\t yield tr, db\n\t\n\t tr.Commit\n\t tr.Dispose\n\t rescue Exception => e\n\t puts_ex e\n\t ensure\n\t tr.Dispose \n\t end\t\n\tend",
"def begin_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.begin', conn){conn.autocommit = false}\n set_transaction_isolation(conn, opts)\n end",
"def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end",
"def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction(&block)\n ActiveRecord::Base.transaction(&block)\n end",
"def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end",
"def commit_db_transaction() end",
"def commit_db_transaction() end",
"def transaction(&block)\n block.call\n end",
"def transaction(&block)\n begin\n @store.transaction\n block.call(@store)\n @store.commit\n rescue SQLite3::Exception => exception\n raise \"SQLite exception: #{exception}\"\n end\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def restart_transaction\n ActiveRecord::Base.connection.execute(\"COMMIT\")\n ActiveRecord::Base.connection.execute(\"BEGIN\")\n end",
"def within_transaction; end",
"def within_transaction; end",
"def transaction(options = {}, &block)\n @klass.connection.run_queries_on_shard(@shard) do\n @klass = @klass.connection.transaction(options, &block)\n end\n end",
"def start\n raise \"Not implemented\"\n true if @transaction_nesting < 1\n @transaction_nesting += 1\n end",
"def call\n db.transaction do\n _call_in_transaction\n end\n end",
"def add_start_transaction!(command)\n command.tap do |c|\n if starting_transaction?\n c[:startTransaction] = true\n end\n end\n end",
"def transaction(&block)\n yield\n commit\n end",
"def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end",
"def scaffold_transaction(&block)\n transaction(&block)\n end",
"def with_transaction\n ActiveRecord::Base.transaction { yield }\n end",
"def ddl_transaction(migration)\n if use_transaction?(migration)\n ActiveRecord::Base.transaction { yield }\n else\n yield\n end\n end",
"def begin_transaction read_only: nil, previous_transaction: nil, read_time: nil\n if read_only\n transaction_options = Google::Cloud::Datastore::V1::TransactionOptions.new\n transaction_options.read_only = \\\n Google::Cloud::Datastore::V1::TransactionOptions::ReadOnly.new \\\n read_time: read_time_to_timestamp(read_time)\n\n end\n if previous_transaction\n transaction_options ||= \\\n Google::Cloud::Datastore::V1::TransactionOptions.new\n rw = Google::Cloud::Datastore::V1::TransactionOptions::ReadWrite.new(\n previous_transaction: previous_transaction.encode(\"ASCII-8BIT\")\n )\n transaction_options.read_write = rw\n end\n service.begin_transaction project_id: project, database_id: database, transaction_options: transaction_options\n end",
"def transaction(options = {}, &block)\n run_on_shard { @klass = klass.transaction(options, &block) }\n end",
"def transaction_insert(num_times)\r\n client = self.connect\r\n r = Random.new\r\n \r\n # transaction start..\r\n client.run \"START TRANSACTION\"\r\n \r\n # insert test..\r\n 1.upto(num_times) do |i|\r\n db_str = \"INSERT INTO fleet (name, description) \" +\r\n \"VALUES (\" +\r\n \"'foo\" + r.rand(100).to_s + \"', \" +\r\n \"'bar' \" +\r\n \");\"\r\n #puts db_str \r\n client.run db_str \r\n end\r\n \r\n # transaction start..\r\n client.run \"COMMIT\"\r\n \r\n # cleanup\r\n puts \"transaction insert\"\r\n client.disconnect\r\n \r\n return true\r\n end",
"def transaction(&block)\n db\n persister\n\n result = nil\n start_time = Time.now\n begin\n db.transaction(:rollback => :reraise, :isolation => :repeatable,\n :retry_on => @retry_on_error, :num_retries => 3) do\n result = yield block\n end\n total = Time.now.to_ms - start_time.to_ms\n debug \"Transaction committed (#{total} ms)\"\n result\n rescue StandardError => e\n total = Time.now.to_ms - start_time.to_ms\n warn \"Transaction failed (#{total} ms)\"\n raise e\n ensure\n GC.start\n end\n end",
"def start_transaction(\n name = nil,\n type = nil,\n context: nil,\n trace_context: nil\n )\n agent&.start_transaction(\n name,\n type,\n context: context,\n trace_context: trace_context\n )\n end",
"def transaction(object)\n object.db.transaction {raise ::Sequel::Error::Rollback unless yield}\n end",
"def commit_db_transaction\n @transaction = @connection.commit\n end",
"def begin_transaction\n if @transaction_stack.empty?\n if @transaction_thread\n PEROBS.log.fatal 'transaction_thread must be nil'\n end\n @transaction_thread = Thread.current\n # The new transaction is the top-level transaction. Flush the write\n # buffer to save the current state of all objects.\n flush\n else\n # Nested transactions are currently only supported within the same\n # thread. If we are in another thread, raise TransactionInOtherThread\n # to pause the calling thread for a bit.\n if @transaction_thread != Thread.current\n raise TransactionInOtherThread\n end\n # Save a copy of all objects that were modified during the enclosing\n # transaction.\n @transaction_stack.last.each do |id|\n @transaction_objects[id]._stash(@transaction_stack.length - 1)\n end\n end\n # Push a transaction buffer onto the transaction stack. This buffer will\n # hold a reference to all objects modified during this transaction.\n @transaction_stack.push(::Array.new)\n end",
"def begin\n raise \"Nested transactions are not allowed\" if @state != :INITIALIZED\n begin\n case @isolation\n when Hash\n if @isolation[:timestamp]\n @grpc_transaction = @connection.session.create_snapshot timestamp: @isolation[:timestamp]\n elsif @isolation[:staleness]\n @grpc_transaction = @connection.session.create_snapshot staleness: @isolation[:staleness]\n elsif @isolation[:strong]\n @grpc_transaction = @connection.session.create_snapshot strong: true\n else\n raise \"Invalid snapshot argument: #{@isolation}\"\n end\n when :read_only\n @grpc_transaction = @connection.session.create_snapshot strong: true\n when :pdml\n @grpc_transaction = @connection.session.create_pdml\n else\n @begin_transaction_selector = Google::Cloud::Spanner::V1::TransactionSelector.new \\\n begin: Google::Cloud::Spanner::V1::TransactionOptions.new(\n read_write: Google::Cloud::Spanner::V1::TransactionOptions::ReadWrite.new\n )\n\n end\n @state = :STARTED\n rescue Google::Cloud::NotFoundError => e\n if @connection.session_not_found? e\n @connection.reset!\n retry\n end\n @state = :FAILED\n raise\n rescue StandardError\n @state = :FAILED\n raise\n end\n end",
"def with_transaction(&block)\n base_model.transaction(&block)\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def test_transactions(table=\"test_monetdb_transactions\", columndefs=['col1 INT', 'col2 VARCHAR(255)'])\n test_create_table(table, columndefs)\n \n data = [1, 'aa'] \n values = \"\"\n \n data.each do |d| values += '\\'' + d.to_s + '\\'' + ',' end\n values = values.chop # remove last ',' character \n \n insert = \"INSERT INTO \" + table + \" VALUES \" + \" ( \" + values + \" )\"\n \n @db.query('START TRANSACTION')\n @db.auto_commit(flag=false) # if @db.auto_commit?\n @db.query(insert)\n\n @db.query(\"COMMIT\") \n \n res = @db.query('SELECT * FROM ' + table)\n rows_committed = res.fetch_all\n res.free\n \n # create a save point\n @db.save\n @db.query(\"SAVEPOINT #{@db.transactions} ;\")\n \n @db.query(insert)\n \n # rollback to savepoint\n @db.query(\"ROLLBACK TO SAVEPOINT #{@db.transactions};\")\n @db.release\n \n res = @db.query('SELECT * FROM ' + table)\n rows_rolled_back = res.fetch_all\n res.free\n \n assert_equal(rows_committed, rows_rolled_back)\n \n # restore autocommit for remaining tests\n @db.auto_commit(flag=true) \n end",
"def use_transactions; end",
"def use_transactions; end",
"def begin\n self.transaction_count += 1\n end",
"def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end",
"def in_transaction(opts = {})\n yield\n end",
"def begin_transaction(mutable: false, graph_name: nil)\n raise NotImplementedError\n end",
"def transaction(&block)\n yield\n end",
"def transaction(&block)\n yield\n end",
"def add_to_transaction(*)\n @connection.add_transaction_record(self)\n end",
"def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end",
"def begin_new_transaction(conn, opts)\n super\n if opts.has_key?(:synchronous)\n case sync = opts[:synchronous]\n when true\n sync = :on\n when false\n sync = :off\n when nil\n return\n end\n\n log_connection_execute(conn, \"SET LOCAL synchronous_commit = #{sync}\")\n end\n end",
"def commit\n # Nothing to do for an in memory database\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end",
"def started_db\n start unless db.running?\n db\n end",
"def started_db\n start unless db.running?\n db\n end",
"def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end",
"def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end",
"def transaction\n use do |connection|\n connection.transaction do |conn|\n begin\n yield conn\n rescue Rollback\n return\n end\n end\n end\n end"
] |
[
"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.70105946",
"0.6999633",
"0.6939845",
"0.6914214",
"0.69053346",
"0.6881507",
"0.6879718",
"0.67385566",
"0.67370117",
"0.6731373",
"0.67285514",
"0.66809547",
"0.6673167",
"0.66436404",
"0.6620462",
"0.65977144",
"0.6596906",
"0.6596906",
"0.6596906",
"0.65886843",
"0.65846926",
"0.653607",
"0.6508305",
"0.6501179",
"0.6498071",
"0.6495879",
"0.64922315",
"0.64894384",
"0.64382225",
"0.64382225",
"0.6415917",
"0.64086246",
"0.6367611",
"0.6367611",
"0.63600814",
"0.6353073",
"0.6353073",
"0.63513076",
"0.6327489",
"0.6324727",
"0.6316143",
"0.63120484",
"0.62745076",
"0.62304866",
"0.6214878",
"0.6209349",
"0.6180296",
"0.61778754",
"0.61734796",
"0.61718446",
"0.6150973",
"0.61129487",
"0.6108939",
"0.6103667",
"0.6066385",
"0.6064429",
"0.6060607",
"0.6060607",
"0.60597205",
"0.6057576",
"0.6057576",
"0.60466987",
"0.6041627",
"0.6039845",
"0.60351676",
"0.6021459",
"0.6021459",
"0.60040754",
"0.6002201",
"0.5998852",
"0.59951067",
"0.5994108",
"0.5994108",
"0.5992327",
"0.5991189",
"0.5991189",
"0.59830415",
"0.59830415",
"0.5976185"
] |
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 override to #m3\n\t\t\t\tend",
"def material\n end",
"def metal; end",
"def intensifier; end",
"def transforms; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def verdi; end",
"def ident; glLoadIdentity; end",
"def transformations; end",
"def droid; end",
"def under_construction\n end",
"def nasa_space_craft; end",
"def mathtex(*)\n super\n end",
"def probers; end",
"def anchored; end",
"def phase; end",
"def project_to_plane\n end",
"def test_arff_parse\n in_file = './test_arff.arff'\n rel = Rarff::Relation.new\n rel.parse(File.open(in_file).read)\n\n assert_equal(rel.instances[2][1], 3.2)\n assert_equal(rel.instances[7][4], 'Iris-setosa')\n end",
"def mode; end",
"def mode; end",
"def mode; end",
"def mode; end",
"def isolated; end",
"def isolated; end",
"def ravel; end",
"def r; end",
"def r; end",
"def variants; end",
"def variant; end",
"def variant; end",
"def terpene; end",
"def loaded_features; end",
"def camera\n end",
"def camera\n end",
"def medical_use; end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def model=(_arg0); end",
"def qseq; @mrna.seq; end",
"def alt; end",
"def custom; end",
"def custom; end",
"def manufacture; end",
"def formation; end",
"def iso; end",
"def emotional_adjective; end",
"def active_section_plane\n end",
"def kind; end",
"def kind; end",
"def kind; end",
"def kind; end",
"def kind; end",
"def kind; end",
"def transformation_device(*eras); end",
"def nn\n end",
"def detect; end",
"def identify; end",
"def make_and_model; end",
"def rla\n end",
"def active_section_plane\n end",
"def active_section_plane\n end",
"def state; region; end",
"def band; end",
"def band; end",
"def extra; end",
"def trd; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def main_spriteset ; end",
"def flamegraph_mode; end",
"def feruchemist; end",
"def ar_class\n self.class.ar_class\n end",
"def malts; end",
"def stderrs; end",
"def qrgen\n end",
"def vin; end",
"def geometry( b)\n\t\t# over-ride where neeeded, e.g. UONActor\n\tend",
"def yyerrok; end",
"def yyerrok; end",
"def mediatype; end",
"def reflector; end",
"def reflector; end",
"def aon; end",
"def alpha; end",
"def attributes=(_arg0); end",
"def collegiate_rivals\n end",
"def flamegraph_mode=(_arg0); end",
"def required_positionals; end",
"def rra\n end",
"def at(p0) end"
] |
[
"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.52404743",
"0.52350163",
"0.52151585",
"0.5215017",
"0.52110255",
"0.51896966",
"0.51833147",
"0.51833147",
"0.51833147",
"0.51833147",
"0.51723087",
"0.51723087",
"0.51698226",
"0.5160317",
"0.5160317",
"0.5158869",
"0.5156506",
"0.5156506",
"0.51503843",
"0.5143282",
"0.51327324",
"0.51327324",
"0.5124634",
"0.511875",
"0.511875",
"0.511875",
"0.511875",
"0.51140493",
"0.5095177",
"0.5087794",
"0.5087794",
"0.508539",
"0.5078136",
"0.5074779",
"0.50688404",
"0.50672144",
"0.5064556",
"0.5064556",
"0.5064556",
"0.5064556",
"0.5064556",
"0.5064556",
"0.5045732",
"0.50332683",
"0.50187504",
"0.5017449",
"0.50124496",
"0.49997708",
"0.49921456",
"0.49921456",
"0.49907443",
"0.49873215",
"0.49873215",
"0.498702",
"0.49759555",
"0.4975201",
"0.4975201",
"0.4975201",
"0.4975201",
"0.49657652",
"0.4962436",
"0.49602827",
"0.49535915",
"0.4945987",
"0.4945858",
"0.49438462",
"0.49381194",
"0.49360144",
"0.4932965",
"0.4932965",
"0.49309698",
"0.49226418",
"0.49226418",
"0.49215496",
"0.4910353",
"0.49084157",
"0.4907368",
"0.49063614",
"0.49050185",
"0.49023965",
"0.48950946"
] |
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_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end",
"def set_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_user\n @user = @current_user\n end",
"def session_auth=(user)\n clear_cache!\n execute \"SET SESSION AUTHORIZATION #{user}\"\n end",
"def set_user\n @user = current_user \n end",
"def set_authorization_user\n Authorization.current_user = current_alchemy_user\n end",
"def set_user\n @user = User.find(params[:id])\n authorize @user\n end",
"def set_user\n @user = User.find(params[:id])\n authorize @user\n end",
"def set_user\n @user = @current_user.admin ? User.find(params['id']) : @current_user\n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\n @user = User.find(current_user)\n end",
"def set_user\r\n @user = current_user\r\n end",
"def set_user_as_current_user\n @user = @current_user\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def current_user=(user)\n if user\n unless logged_in?\n @auth_session = Session.start(@controller, :user => user)\n end\n @_auth_current_user = user\n else\n auth_session.destroy if logged_in?\n @_auth_current_user = nil\n end\n end",
"def set_current_user_for_auth\n Authorization.current_user = current_user\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find(current_user[:id])\n end",
"def set_user\n @user = User.find_by(auth0_id: auth_token[0]['sub'])\n end",
"def set_logged_in_user(user)\n set_temporary_logged_in_user(user)\n session[:user_id] = user.id\n set_unlogged_in_user(nil)\n end",
"def set_credentials\n @user = User.find(current_user.id)\n end",
"def set_user_session\n UserSession.current_user = current_user\n end",
"def set_user\n @user = session[:current_user]\n unless @user\n redirect_to home_path\n end\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n @user = User.find(current_user.id)\n end",
"def set_user\n if session[:user_id].nil?\n @user = nil\n else\n @user = User.find(session[:user_id])\n end\n end",
"def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n begin\n if user_signed_in?\n User.send :class_variable_set, :@@current, current_user\n end\n rescue Exception => exception\n logger.error \"Could not set User.current. Error was #{exception.to_s}\"\n end\n end",
"def current_user=(new_user)\n current_session.user = new_user\n end",
"def set_user\n @user = User.find(session[:user_id])\n end",
"def set_authorization\n Authorization.current_user = current_user\n end",
"def set_user\n\t\tif(session[:role]=='administrator')\n \t\t@user = User.find(params[:id])\n\t\telse\n\t\t\t@user = @current_user\n\t\tend\n end",
"def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end",
"def set_user\n @client = current_client\n end",
"def set_user\n @cUser = current_user\n puts \"***#{@cUser}\"\n end",
"def set_user\n\t\t@user = current_user\n\t\tif !current_user.is_admin?\n\t\t\t# redirects to the denied path if not\n\t\t\tredirect_to denied_path\n\t\tend\n\tend",
"def logged_user=(user)\n # only override parent if the request is from ioc user\n return super(user) unless session[:oic_session_id]\n\n if user && user.is_a?(User)\n User.current = user\n start_user_session(user)\n else\n User.current = User.anonymous\n end\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_user\n @user = User.find(user_id)\n end",
"def set_authorization\n @user ||= current_user\n authorize @user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_current_user\n Authorization.current_user = current_user\n end",
"def set_logged_in_user\n @logged_in_user = logged_in_user\n end",
"def set_user\n @user = User.find_by(access_token: params[:access_token])\n end",
"def set_user\n @user = User.find(params[:user_id])\n authorize @user\n end",
"def set_current_user(user)\n if user.nil?\n session[:authenticated] = false\n session[:user_id] = 0\n else\n session[:authenticated] = true\n session[:user_id] = user.id\n end\n end",
"def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end",
"def set_current_user\n # for access to authenticate method\n t = ActionController::HttpAuthentication::Token\n @current_user = t.authenticate(self, &AUTH_PROC)\n end",
"def set_user\n if self.current_user and self.current_user.name == 'admin'\n @user = User.find(params[:id])\n else\n @user = User.find(current_user.id)\n end\n end",
"def set_user\n @user = session_user\n if !@user\n render json: { error: 'You are not logged in'}, status: 400\n end\n end",
"def set_auth_user\n @auth_user = Auth::User.find(params[:id])\n end",
"def set_self_as_user\n @user = self.current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_user_session\n @user = user_session.find(params[:id])\n end",
"def set_auth_user\n @auth_user = AuthUser.find(params[:id])\n end",
"def set_user\n if params[:id] == nil\n @user = @current_user\n else\n @user = User.find(params[:id])\n end\n end",
"def current_user=(user)\n warden.set_user(user, event: :authentication)\n end"
] |
[
"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.71937734",
"0.71937734",
"0.71937734",
"0.71937734",
"0.71937734",
"0.71782434",
"0.71451634",
"0.7124843",
"0.7124843",
"0.7118069",
"0.70972055",
"0.7088524",
"0.70866823",
"0.70361817",
"0.70361817",
"0.7025367",
"0.7022998",
"0.7022998",
"0.70064867",
"0.7001463",
"0.70009047",
"0.69987774",
"0.6978402",
"0.6972746",
"0.6972746",
"0.69619185",
"0.69546086",
"0.6941046",
"0.69380915",
"0.69269055",
"0.692499",
"0.692499",
"0.692499",
"0.692499",
"0.692499",
"0.6924486",
"0.69205326",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69023275",
"0.69010574",
"0.68836147",
"0.68712986",
"0.68609935",
"0.6845247",
"0.681396",
"0.6809918",
"0.6794393",
"0.67940843",
"0.6752605",
"0.6744365",
"0.6744365",
"0.6744365",
"0.6744365",
"0.6699414",
"0.66799337",
"0.66730535",
"0.66730535",
"0.6672933",
"0.6648305",
"0.66273415",
"0.6581018",
"0.65655005",
"0.65592813",
"0.6555111",
"0.65418863",
"0.65223",
"0.6522021",
"0.6515799",
"0.6515799",
"0.6514283",
"0.65138566",
"0.65107787",
"0.6504596"
] |
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_i : 63)\n end",
"def max_identifier_length\n 63\n end",
"def column_name_length\n IDENTIFIER_MAX_LENGTH\n end",
"def table_name_length\n IDENTIFIER_MAX_LENGTH\n end",
"def default_autoincrement_length\n 64\n end",
"def get_id_length\n get_id.digits.count\n end",
"def determine_length\n determine_length_support\n end",
"def sequence_name_length\n IDENTIFIER_MAX_LENGTH\n end",
"def odb_length\n \"#{to_s}.length()\"\n end",
"def max_sql_param_length; end",
"def column_name_length\n 31\n end",
"def max_length\n MAX_LENGTH\n end",
"def sql_query_length\n 32767\n end",
"def table_name_length\n 31\n end",
"def index_name_length\n IDENTIFIER_MAX_LENGTH\n end",
"def max_sql_param_length=(_arg0); end",
"def table_alias_length\n @table_alias_length ||= 63\n end",
"def length\n # TODO: add a default for length if not in params (instead of just 5!)\n @params[:length].to_i > 0 ? @params[:length].to_i : 5 # or use @cfg[:default][:length].to_i\n end",
"def in_clause_length\n 1499\n end",
"def sequence_length\n id_line('SEQUENCE_LENGTH')\n end",
"def table_alias_length\n @table_alias_length ||= (query(\"select length from systypes where name = 'sysname'\")[0][0].to_i)\n end",
"def max_length\n return @max_length\n end",
"def max_size()\n AUTHENTICATION_START_MAX_SIZE\n end",
"def limit_value\n length\n end",
"def max_key_width; end",
"def key_len\n @key_len ||= defaults[:key_len]\n end",
"def password_minimum_character_set_count\n return @password_minimum_character_set_count\n end",
"def max_command_length; end",
"def table_alias_length\n 31\n end",
"def odb_size\n \"#{to_s}.size()\"\n end",
"def maxStringLength\n\t\tweight = @dictionaries.inject(1) { |x, d| x * d.length }\n\t\tbits = (Math.log(weight)/Math.log(2)).floor\n\t\tchars = bits/4\n\tend",
"def min_length\n MIN_LENGTH\n end",
"def length_override; end",
"def max_sql_bytesize\n @max_sql_bytesize ||= begin\n case (row = connection.query(\"SHOW VARIABLES LIKE 'max_allowed_packet'\").first)\n when Array\n row[1]\n when Hash\n row['Value']\n else\n raise \"Don't know what to do if connection.query returns a #{row.class}\"\n end.to_i\n end\n end",
"def getSqlLengthQry(column)\n\t\tif ActiveRecord::Base.connection.adapter_name == 'SQLServer'\t\t\t \n\t\t\tlenSqlQry = \"len(#{column})\"\n\t\telse\n\t\t\tlenSqlQry = \"length(#{column})\"\n\t\tend\t\t\n\t\tlenSqlQry\n\tend",
"def default_tire_size\n '23'\n end",
"def maximum_size\n @ids.size\n end",
"def char_length(arg)\n SQL::Function.new!(:char_length, [arg], :emulate=>true)\n end",
"def max_iso_packet_size(endpoint_number); end",
"def default_field_lengths\n field_lengths = @headers ? @headers.inject({}) {|h,(k,v)| h[k] = String.size(v); h} :\n @fields.inject({}) {|h,e| h[e] = 1; h }\n @rows.each do |row|\n @fields.each do |field|\n len = String.size(row[field])\n field_lengths[field] = len if len > field_lengths[field].to_i\n end\n end\n field_lengths\n end",
"def length\n @config[:length]\n end",
"def length\n [default&.length, max_content_length].compact.max\n end",
"def ndp_opt_len; self[:ndp_opt_len].to_i; end",
"def char_length\n @char_length ||= (@n**2 / 10) + 1\n end",
"def min_size()\n AUTHENTICATION_START_MIN_SIZE\n end",
"def get_id_len\n @reference_db.load_fai_entries\n @reference_db.index.entries.each_entry do | entry |\n @id_len[entry.id] = entry.length\n end\n end",
"def valid_id_number; end",
"def ipv4_prefix_len(size)\n\t\tprefix_len = 32\n\t\t32.downto(0) do |i|\n\t\t\thostbits = 32 - prefix_len\n\t\t\tmax = 1 << hostbits\n\t\t\tif (size <= max)\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tprefix_len -= 1\n\t\tend\n\t\treturn prefix_len\n\tend",
"def target_postgresql_version; end",
"def have_length(options = {})\n Length.new(options)\n end",
"def passcode_minimum_length\n return @passcode_minimum_length\n end",
"def postgresql_version\n 100000\n end",
"def longest_integer_length\n longest_integer.to_s.size\n end",
"def safe_len(maxLen, reqLen)\n #handle stings and garbage\n maxLen = (maxLen||reqLen).to_i\n [maxLen, reqLen].min\n end",
"def max_size()\n AUTHENTICATION_CONTINUE_MAX_SIZE\n end",
"def length\n raise NotImplementedError, \"Please implement length\"\n end",
"def length()\n return to_s.size\n end",
"def key_length(name); end",
"def specific_max_size(number); end",
"def work_profile_password_min_numeric_characters\n return @work_profile_password_min_numeric_characters\n end",
"def engine_size; end",
"def length_in_long_words\n return @bits.attr_length\n end",
"def passcode_minimum_character_set_count\n return @passcode_minimum_character_set_count\n end",
"def suggestedNumber\r\n return self.maxLength\r\n end",
"def pascal_string_len_field(name)\n \"_#{name.to_s}_len\".to_sym\n end",
"def valid_length?\n specification && specification['length'] - 4 == @code.length\n end",
"def max_width\n breakpoints.last ? breakpoints.last.id.to_s.length : 1\n end",
"def max_key_width=(_arg0); end",
"def length\n to_s.length\n end",
"def max_size()\n AUTHENTICATION_REPLY_MAX_SIZE\n end",
"def string_length(password)\n if password.size >= 10 && password.size < 17\n return 0\n else\n return password.size > 16 ? (16 - password.size) : 10 - password.size\n end\n end",
"def dbsize; end",
"def dbsize; end",
"def min_size()\n AUTHENTICATION_CONTINUE_MIN_SIZE\n end",
"def header_length\n @header_length ||= DBF_HEADER_SIZE + columns.size * 32 + 1\n end",
"def work_profile_password_minimum_length\n return @work_profile_password_minimum_length\n end",
"def length\n config = Pillowfort.config\n\n case self.type\n when 'activation' then config.activation_token_length\n when 'password_reset' then config.password_reset_token_length\n else config.session_token_length\n end\n end",
"def get_token_length(key)\n get_option(key, :token_length)\n end",
"def in_clause_length\n 1000\n end",
"def max_size()\n ACCOUNTING_REPLY_MAX_SIZE\n end",
"def password_minimum_length\n return @password_minimum_length\n end",
"def password_minimum_length\n return @password_minimum_length\n end",
"def password_minimum_length\n return @password_minimum_length\n end",
"def password_minimum_length\n return @password_minimum_length\n end",
"def length\n @column_families.length\n end",
"def default_reservation_size\n\t\t\t\t\t1\n\t\t\t\tend",
"def length\n 3\n end",
"def length\n 3\n end",
"def min_size()\n AUTHENTICATION_REPLY_MIN_SIZE\n end",
"def max_hex_ring_size(k)\n k.zero? ? 1 : 6 * k\n end",
"def length\n length = 1 #@primary\n length += @extlang.length if @extlang\n length += 1 if @script\n length += 1 if @region\n length += @variants.length if @variants\n @extensions.each { |_,e| length += e.length+1 } if @extensions # length += @extenstions.to_a.flatten.length if @extensions\n length += @privateuse.length+1 if @privateuse\n length\n end",
"def max_digits size\n (1..size).map{|x| x.to_s.size}.max\n end",
"def seq_length \n if self.source_name == \"ENSEMBLGENE\"\n return self.get_gene.slice.length\n elsif self.source_name == \"ENSEMBLPEP\"\n return self.sequence.length\n else\n return nil\n end \n end",
"def render_length_limit; end",
"def get_lengths(name, options = T.unsafe(nil)); end",
"def length\n # nasty hack, but works well enough.\n @mask_addr.to_s(2).count(\"1\")\n end",
"def private_key_length\n #Kopal[:kopal_private_key_length] ||\n 2048\n end",
"def password_length\n @password_length\n end",
"def length\n to_s.length\n end"
] |
[
"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.56921464",
"0.56840456",
"0.5653385",
"0.56373",
"0.561692",
"0.56092876",
"0.5590945",
"0.5587107",
"0.5584453",
"0.556982",
"0.5559164",
"0.5556245",
"0.5535383",
"0.55330235",
"0.55232424",
"0.54901993",
"0.54867125",
"0.5450519",
"0.5447453",
"0.54135454",
"0.54103553",
"0.54086643",
"0.5400719",
"0.539182",
"0.5383705",
"0.53682405",
"0.535788",
"0.5352014",
"0.53384143",
"0.53266644",
"0.5316559",
"0.5299734",
"0.5274259",
"0.5272612",
"0.52650034",
"0.5260324",
"0.52573574",
"0.52558136",
"0.5254624",
"0.5249059",
"0.5236882",
"0.52303755",
"0.5225731",
"0.52160764",
"0.51885927",
"0.5186189",
"0.5181149",
"0.5181112",
"0.5173971",
"0.51719767",
"0.5167233",
"0.5165017",
"0.5165017",
"0.5164937",
"0.51560163",
"0.51526123",
"0.5148403",
"0.5144199",
"0.51390696",
"0.51387453",
"0.5136871",
"0.5136871",
"0.5136871",
"0.5136871",
"0.5129413",
"0.5122755",
"0.51220775",
"0.51220775",
"0.5120868",
"0.51176697",
"0.51128954",
"0.5110846",
"0.5106942",
"0.51068527",
"0.5103905",
"0.5092893",
"0.50871146",
"0.50868076",
"0.5085387"
] |
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)} TO #{max_id}\") if legacy_mode\n end",
"def reset_primary_key_sequence(table)\n return unless seq = primary_key_sequence(table)\n pk = SQL::Identifier.new(primary_key(table))\n db = self\n s, t = schema_and_table(table)\n table = Sequel.qualify(s, t) if s\n\n if server_version >= 100000\n seq_ds = metadata_dataset.from(:pg_sequence).where(:seqrelid=>regclass_oid(LiteralString.new(seq)))\n increment_by = :seqincrement\n min_value = :seqmin\n # :nocov:\n else\n seq_ds = metadata_dataset.from(LiteralString.new(seq))\n increment_by = :increment_by\n min_value = :min_value\n # :nocov:\n end\n\n get{setval(seq, db[table].select(coalesce(max(pk)+seq_ds.select(increment_by), seq_ds.select(min_value))), false)}\n end",
"def reset_pk_sequence!(table_name, primary_key=nil, sequence_name=nil)\n primary_key, seq_schema, sequence_name = pk_and_sequence_for(table_name, true)\n if primary_key && !sequence_name\n @logger.warn \"#{table_name} has primary key #{primary_key} with no sequence\" if @logger\n end\n\n if primary_key && sequence_name\n seq_from_where = \"FROM information_schema.sequences \"+\n \"WHERE sequence_schema='#{quote_string(seq_schema)}' \"+\n \"AND sequence_name='#{quote_string(sequence_name)}'\"\n result = select_rows(\n \"SELECT COALESCE(MAX(#{quote_column_name(primary_key)} + (SELECT increment #{seq_from_where})), \"+\n \" (SELECT minimum_value #{seq_from_where})) \"+\n \"FROM #{quote_table_name(table_name)}\",\n SCHEMA_LOG_NAME\n )\n\n if result.length == 1\n # The COMMIT; BEGIN; can go away when 1) transactional DDL is available 2) There is a better restart/set function\n execute(\n \"COMMIT; \"+\n \"CALL sys.alter_seq_restart('#{quote_string(seq_schema)}', '#{quote_string(sequence_name)}', #{result[0][0]}); \"+\n \"BEGIN;\",\n SCHEMA_LOG_NAME\n )\n else\n @logger.warn \"Unable to determin max value for #{table_name}.#{primary_key}\" if @logger\n end\n end\n end",
"def reset_sequence!(table, column, sequence = nil)\n mpk = select_value(\"SELECT MAX(#{quote_column_name(column)}) FROM #{quote_table_name(table)}\")\n execute(\"ALTER TABLE #{quote_table_name(table)} ALTER COLUMN #{quote_column_name(column)} RESTART WITH #{mpk.to_i + 1}\")\n end",
"def reset_sequence!(table, column, sequence = nil)\n sequence ||= default_sequence_name(table, column)\n max_id = select_value(\"select max(#{column}) from #{table}\")\n execute(\"alter sequence #{sequence} restart with #{max_id}\")\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:\n unless pk && sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n\n pk ||= default_pk\n sequence ||= default_sequence\n end\n\n if @logger && pk && !sequence\n @logger.warn \"#{table} has primary key #{pk} with no default sequence.\"\n end\n\n if pk && sequence\n quoted_sequence = quote_table_name(sequence)\n max_pk = query_value(\"SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}\", \"SCHEMA\")\n if max_pk.nil?\n if postgresql_version >= 100000\n minvalue = query_value(\"SELECT seqmin FROM pg_sequence WHERE seqrelid = #{quote(quoted_sequence)}::regclass\", \"SCHEMA\")\n else\n minvalue = query_value(\"SELECT min_value FROM #{quoted_sequence}\", \"SCHEMA\")\n end\n end\n if max_pk\n # NOTE(joey): This is done to replace the call:\n #\n # SELECT setval(..., max_pk, false)\n #\n # with\n #\n # SELECT setval(..., max_pk-1)\n #\n # These two statements are semantically equivilant, but\n # setval(string, int, bool) is not supported by CockroachDB.\n #\n # FIXME(joey): This is incorrect if the sequence is not 1\n # incremented. We would need to pull out the custom increment value.\n max_pk - 1\n end\n query_value(\"SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue})\", \"SCHEMA\")\n end\n end",
"def reset_sequence_value(name, next_value = nil)\n create_sequence(name)\n unless next_value\n table, field = name.split('_$_')\n next_value = self.select_rows('SELECT MAX(%s) as max FROM %s' % [field, table]).first.first.to_i + 1\n end\n self.execute(\"ALTER TABLE %s_sequence AUTO_INCREMENT = %s\" % [name, next_value || 1])\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:\n unless pk and sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n pk ||= default_pk\n sequence ||= default_sequence\n end\n if pk\n if sequence\n quoted_sequence = quote_column_name(sequence)\n\n select_value <<-end_sql, 'Reset sequence'\n 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)\n end_sql\n else\n @logger.warn \"#{table} has primary key #{pk} with no default sequence\" if @logger\n end\n end\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:\n unless pk and sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n pk ||= default_pk\n sequence ||= default_sequence\n end\n if pk\n if sequence\n quoted_sequence = quote_column_name(sequence)\n\n select_value <<-end_sql, 'Reset sequence'\n 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)\n end_sql\n else\n @logger.warn \"#{table} has primary key #{pk} with no default sequence\" if @logger\n end\n end\n end",
"def reset_sequence!(table, column, sequence = nil)\n # Do nothing by default. Implement for PostgreSQL, Oracle, ...\n end",
"def set_sequence(table_name, pk)\n begin\n stmt = @connection.run(\"select max(#{pk}) + 1 from #{table_name}\")\n next_pk_val = stmt.fetch\n stmt.drop\n flds = table_name.split('.')\n @connection.do(\"sequence_set('#{flds[0]}.#{flds[1]}.#{table_name}.#{pk}', #{next_pk_val}, 0)\")\n return true\n rescue Exception => e\n @logger.unknown(\"exception=#{e}\") if @trace\n end\n return false\n end",
"def reset_sequence_numbers\n result = Database.connection.exec(\"SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';\")\n table_names = result.map { |row| row.values_at('table_name')[0] }\n\n table_names_with_id_column = table_names.select do |table_name|\n result = Database.connection.exec(\"SELECT column_name FROM information_schema.columns WHERE table_name = '#{table_name}';\")\n column_names = result.map { |row| row.values_at('column_name')[0] }\n column_names.include?('id')\n end\n\n table_names_with_id_column.each do |table_name|\n result = Database.connection.exec(\"SELECT pg_get_serial_sequence('#{table_name}', 'id');\")\n sequence_name = result.getvalue(0, 0)\n Database.connection.exec(\"SELECT setval('#{sequence_name}', (select MAX(id) from #{table_name}));\")\n end\n end",
"def reset_id_seq *tables\n tables.each do |table|\n sql \"SELECT setval('#{table}_id_seq',max(id)) FROM #{table}\"\n end\n end",
"def reset_sequence!(table, column, sequence = nil)\n # Nobody else implements this and it isn't called from anywhere\n end",
"def reset_sequence!(table, column, sequence = nil)\n # Nobody else implements this and it isn't called from anywhere\n end",
"def reset(sequence_name, value = 0)\n value = 0 if value.to_i <= 0\n value = 1 if value == 0 && UID.configuration.postgres?\n\n diff = []\n diff << uid_current_index(sequence_name)\n\n if UID.configuration.redis?\n $redis.set(sequence_name, value)\n else\n ActiveRecord::Base.connection.select_value(\"ALTER SEQUENCE #{sequence_name} RESTART WITH #{value};\")\n end\n\n diff << uid_current_index(sequence_name)\n diff\n end",
"def assign_tx_seq_num\n self.update(tx_seq_num: Order.max_tx_seq_num + 1) \n end",
"def reset_id\n ActiveRecord::Base.connection.execute(\\\n #'ALTER TABLE category AUTO_INCREMENT = 1')\n # \"DELETE FROM sqlite_sequence WHERE NAME = 'cate'\")\n # \"DELETE FROM sqlite_sequence WHERE NAME = 'categories'\")\n \"DELETE FROM categories; DELETE FROM sqlite_sequence WHERE NAME = 'categories'\")\n \n #\n # @adapter = ActiveRecord::Base.connection.adapter_name\n# \n # @key = maximum(primary_key)\n\n end",
"def test_resets_to_min_pk_with_default_pk_and_sequence\n @instances.each do |instance|\n model = instance.class\n model.delete_all\n model.connection.reset_pk_sequence!(model.table_name)\n\n instance.save!\n assert_equal 1, instance.id, \"Sequence reset for #{model.table_name} failed.\"\n end\n end",
"def test_resets_to_min_pk_with_specified_pk_and_sequence\n @instances.each do |instance|\n model = instance.class\n model.delete_all\n model.connection.reset_pk_sequence!(model.table_name, model.primary_key, model.sequence_name)\n\n instance.save!\n assert_equal 1, instance.id, \"Sequence reset for #{model.table_name} failed.\"\n end\n end",
"def clear_sequence_setup(database, table)\n table_options = options(table)\n if table_options[:adjust_sequences]\n session.send(database).clear_sequence_setup(\n table_options[:rep_prefix], table\n )\n end\n end",
"def test_reset_empty_table_with_custom_pk_sequence\n @connection.exec_query(\"CREATE SEQUENCE widgets_seq\")\n @connection.exec_query(\"\n CREATE TABLE widgets (\n widgetid INT PRIMARY KEY DEFAULT nextval('widgets_seq'),\n name string\n )\n \")\n assert_equal 1, Widget.create(name: \"weather\").id\n end",
"def test_reset_empty_table_with_custom_pk_sequence\n @connection.exec_query(\"CREATE SEQUENCE widgets_seq\")\n @connection.exec_query(\"\n CREATE TABLE widgets (\n widgetid INT PRIMARY KEY DEFAULT nextval('widgets_seq'),\n name string\n )\n \")\n assert_equal 1, Widget.create(name: \"weather\").id\n end",
"def reset_initial_version\n @initial_version = last_committed_sequence_number\n end",
"def change_sequence(name, options = {})\n execute change_sequence_sql(name, options)\n end",
"def default_sequence_name(table_name, pri_key = nil)\n serial_sequence(table_name, pri_key || 'id').split('.').last\n rescue ActiveRecord::StatementInvalid\n \"#{table_name}_#{pri_key || 'id'}_seq\"\n end",
"def reset_db_peak_sequence\n ActiveRecord::Base.connection.tables.each do |t|\n ActiveRecord::Base.connection.reset_pk_sequence!(t)\n end\nend",
"def reset_db_peak_sequence\n ActiveRecord::Base.connection.tables.each do |t|\n ActiveRecord::Base.connection.reset_pk_sequence!(t)\n end\nend",
"def default_sequence_name(table_name, pk = \"id\")\n nil\n end",
"def default_sequence_name(table_name, pk = nil) #:nodoc:\n default_pk, default_seq = pk_and_sequence_for(table_name)\n default_seq || \"#{table_name}_#{pk || default_pk || 'id'}_seq\"\n end",
"def next_sequence_id\n last_sequence_id + 1\n end",
"def default_sequence_name(table, _column)\n \"#{table}_seq\"\n end",
"def default_sequence_name(table_name, pk = nil) #:nodoc:\n result = serial_sequence(table_name, pk || 'id')\n return nil unless result\n Utils.extract_schema_qualified_name(result).to_s\n rescue ActiveRecord::StatementInvalid\n Redshift::Name.new(nil, \"#{table_name}_#{pk || 'id'}_seq\").to_s\n end",
"def default_sequence_name(table_name, column = nil)\n pk, seq = pk_and_sequence_for(table_name)\n if column && (pk != column)\n # Is this ever actually called with a non-pk column?\n nil\n else\n seq\n end\n rescue\n nil\n end",
"def increment_sequence_number\n @sequence_number += 1\n @sequence_number = 0 if @sequence_number > 0xFFFFFFFF\n end",
"def next_val_sequence(name)\n if self.class.to_s =~ /ActiveRecord::ConnectionAdapters::Mysql/\n self.insert_sql(\"INSERT INTO %s_sequence VALUES(NULL)\" % name)\n else\n # the default insert_sql is nonsense, but jdbc_mysql doesn't override it\n self.execute(\"INSERT INTO %s_sequence VALUES(NULL)\" % name)\n end\n end",
"def drop_sequence(name)\n self.execute(\"DROP TABLE IF EXISTS %s_sequence\" % name)\n end",
"def set_next_seqno\n a = self.pcp_subject.pcp_items\n m = a.maximum( :seqno ) || 0\n n = a.count\n self.seqno = ( n > m ? n : m ) + 1\n end",
"def uses_sequence\n select_value(\"SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';\")\n end",
"def set_sequence\n @sequence = Sequence.find(params[:id])\n end",
"def set_sequence\n @sequence = Sequence.find(params[:id])\n end",
"def set_sequence\n @sequence = Sequence.find(params[:id])\n end",
"def primary_key_sequence(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_key_sequences[quoted_table] if @primary_key_sequences.has_key?(quoted_table)}\n cond = {Sequel[:t][:oid] => regclass_oid(table, opts)}\n value = if pks = _select_serial_sequence_ds.first(cond)\n literal(SQL::QualifiedIdentifier.new(pks[:schema], pks[:sequence]))\n elsif pks = _select_custom_sequence_ds.first(cond)\n literal(SQL::QualifiedIdentifier.new(pks[:schema], LiteralString.new(pks[:sequence])))\n end\n\n Sequel.synchronize{@primary_key_sequences[quoted_table] = value} if value\n end",
"def set_key\n last_key = Issue.find_by_sql('select max(issueId) as maxid from issue')[0].maxid\n self.issueId = last_key.to_i + 1\n end",
"def last_sequence\n self.seq\n end",
"def set_sequence\n @sequence = Sequence.find params[:id]\n end",
"def drop_sequence(name)\n execute drop_sequence_sql(name)\n end",
"def sequence_number=(value)\n @sequence_number = value\n end",
"def seq\n @values.fetch('seq') { \n @values['seq'] = nil\n }\n end",
"def seq=(value)\n if value == @defaults['seq']\n @values.delete 'seq' if @values.key? 'seq'\n else\n @values['seq'] = value\n end\n end",
"def inititalize\n @id = @@next_table_id\n @@next_table_id += 1\n\n def self.preview_next_id\n @@next_table_id\n end\n end",
"def sequence_number\n @sequence_number ||= rand(0xFFFFFFFF)\n end",
"def getNextSequence(table,db)\n\t\tif db[table].count == 0\n\t\t\treturn 1\n\t\telse\n\t\t\tdb[table].find().sort(_id: -1).limit(1).each do |document|\n\t\t\t\treturn document[:_id]+1\n\t\t\tend\n\t\tend\n\tend",
"def reset_indecies\n puts 'Resetting AR indecies.'\n ApplicationRecord.connection.tables.each { |t| ApplicationRecord.connection.reset_pk_sequence!(t) }\n puts 'Restore complete'\n end",
"def last_insert_id(table, sequence_name) #:nodoc:\n Integer(select_value(\"SELECT currval('#{sequence_name}')\"))\n end",
"def pk_and_sequence_for(table)\n # try looking for a seq with a dependency on the table's primary key :\n result = select(<<-end_sql, 'PK and Serial Sequence')[0]\n SELECT attr.attname, seq.relname\n FROM pg_class seq,\n pg_attribute attr,\n pg_depend dep,\n pg_constraint cons\n WHERE seq.oid = dep.objid\n AND seq.relkind = 'S'\n AND attr.attrelid = dep.refobjid\n AND attr.attnum = dep.refobjsubid\n AND attr.attrelid = cons.conrelid\n AND attr.attnum = cons.conkey[1]\n AND cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n\n if result.nil? || result.empty?\n # if that fails, try parsing the primary key's default value :\n result = select(<<-end_sql, 'PK and Custom Sequence')[0]\n SELECT attr.attname,\n CASE\n WHEN pg_get_expr(def.adbin, def.adrelid) !~* 'nextval' THEN NULL\n WHEN split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2) ~ '.' THEN\n substr(split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2),\n strpos(split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2), '.')+1)\n ELSE split_part(pg_get_expr(def.adbin, def.adrelid), '''', 2)\n END as relname\n FROM pg_class t\n JOIN pg_attribute attr ON (t.oid = attrelid)\n JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)\n JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])\n WHERE t.oid = '#{quote_table_name(table)}'::regclass\n AND cons.contype = 'p'\n AND pg_get_expr(def.adbin, def.adrelid) ~* 'nextval|uuid_generate'\n end_sql\n end\n\n [ result['attname'], result['relname'] ]\n rescue\n nil\n end",
"def clear_sequence_setup(rep_prefix, table_name)\n sequence_table_name = \"#{rep_prefix}_sequences\"\n if tables.include?(sequence_table_name)\n trigger_name = \"#{rep_prefix}_#{table_name}_sequence\"\n trigger_row = select_one(<<-end_sql)\n select * from information_schema.triggers\n where trigger_schema = database()\n and trigger_name = '#{trigger_name}'\n end_sql\n if trigger_row\n execute \"DROP TRIGGER `#{trigger_name}`\"\n execute \"delete from #{sequence_table_name} where name = '#{table_name}'\"\n unless select_one(\"select * from #{sequence_table_name}\")\n # no more sequences left --> delete sequence table\n drop_table sequence_table_name.to_sym\n end\n end\n end\n end",
"def inc_seq_no!()\n @seq_no += 1\n return(nil)\n end",
"def clear_primary_key\n @attributes[self.primary_key_attribute] = nil\n end",
"def alter_sequence(name, options = {})\n execute(PostgreSQLSequenceDefinition.new(self, :alter, name, options).to_s)\n end",
"def adjust_sequences\n return unless sequence_changed?\n\n throw :abort if sequence && sequence <= 0\n\n largest = last_sequence\n self.sequence = largest if sequence.nil? || sequence > largest\n\n if sequence > sequence_was\n sequence_lower(sequence_was, sequence)\n else\n sequence_higher(sequence, sequence_was)\n end\n end",
"def next_sequence_number\n last_sequence_number ? last_sequence_number.next : 0\n end",
"def sequence\n # noop\n @state = :id\n end",
"def _next_id\n @@id -= 1\n @@id\n end",
"def property_schema_statement(schema)\n statement = super\n\n if schema.has_key?(:sequence_name)\n statement << \" DEFAULT nextval('#{schema[:sequence_name]}') NOT NULL\"\n end\n\n statement\n end",
"def sequence=(value)\n @sequence = value\n end",
"def test_create_fixtures_resets_sequences_when_not_cached\n @instances.each do |instance|\n max_id = create_fixtures(instance.class.table_name).first.fixtures.inject(0) do |_max_id, (_, fixture)|\n fixture_id = fixture[\"id\"].to_i\n fixture_id > _max_id ? fixture_id : _max_id\n end\n\n # Clone the last fixture to check that it gets the next greatest id.\n instance.save!\n assert_equal max_id + 1, instance.id, \"Sequence reset for #{instance.class.table_name} failed.\"\n end\n end",
"def generate_sequence_number(forecast)\n if Forecast.find_by_sql(\"select max(sequence_number) as max_sequence from forecasts where farm_code = '#{forecast.farm_code}' and season = '#{forecast.season}' and forecast_type_code = '#{forecast.forecast_type_code}'\") != nil\n max_sequence_number_arra = Forecast.find_by_sql(\"select max(sequence_number) as max_sequence from forecasts where farm_code = '#{forecast.farm_code}' and season = '#{forecast.season}' and forecast_type_code = '#{forecast.forecast_type_code}'\")\n max_sequence_number = max_sequence_number_arra[0].max_sequence.to_i\n else\n max_sequence_number = 0\n end\n\n return max_sequence_number\n end",
"def next_sequence_value(sequence_name)\n select_one(\"select #{sequence_name}.nextval id from dual\")['id']\n end",
"def next_sequence_value(sequence_name)\n # if sequence_name is set to :autogenerated then it means that primary key will be populated by trigger\n raise ArgumentError.new \"Trigger based primary key is not supported\" if sequence_name == AUTOGENERATED_SEQUENCE_NAME\n # call directly connection method to avoid prepared statement which causes fetching of next sequence value twice\n select_value(<<~SQL.squish, \"SCHEMA\")\n SELECT #{quote_table_name(sequence_name)}.NEXTVAL FROM dual\n SQL\n end",
"def next_sequence_number!\n sequence_number && @sequence_number += 1\n end",
"def set_key\n last_key = User.find_by_sql('select max(userId) as maxid from user')[0].maxid\n self.userId = last_key.to_i + 1\n end",
"def assign_slug_sequence\n return if self[self.slug_column].blank?\n assoc = self.class.base_class\n base_slug = self[self.slug_column]\n seq = 0\n\n while assoc.where(self.slug_column => self[self.slug_column]).exists? do\n seq += 1\n self[self.slug_column] = \"#{base_slug}-#{seq}\"\n end\n end",
"def set_MaxID(value)\n set_input(\"MaxID\", value)\n end",
"def set_MaxID(value)\n set_input(\"MaxID\", value)\n end",
"def next_seq\n @seq = (@seq + 1) & 0xffffffff\n end",
"def primary_key(table_name)\n pk_and_sequence_for(table_name)[0]\n rescue\n nil\n end",
"def last_sequence_number\n if @events.empty?\n return @last_committed_sequence_number\n end\n\n unless @last_sequence_number\n @last_sequence_number = @events.last.sequence_number\n end\n\n @last_sequence_number\n end",
"def no_primary_key\n clear_setter_methods_cache\n self.simple_pk = @primary_key = nil\n end",
"def no_primary_key\n clear_setter_methods_cache\n self.simple_pk = @primary_key = nil\n end",
"def sequence_number; end",
"def reverse_sequence\n revcom(sequence)\n end",
"def last_sequence_id\n #if the last page exists, return its sequence_id otherwise return 0\n last_page ? last_page.sequence_id : 0\n end",
"def set_sequence\n if seq!= nil\n sequence=\"\"\n seq.each_with_index do |s,index|\n sequence = sequence + s +\",\"\n end\n if examquestion_ids.count > seq.count\n diff_count = examquestion_ids.count - seq.count\n 0.upto(diff_count-1) do |c|\n sequence = sequence + \"Select\"+\",\"\n end\n end \n self.sequ = sequence \n end\n end",
"def set_sequence\n if seq!= nil\n sequence=\"\"\n seq.each_with_index do |s,index|\n sequence = sequence + s +\",\"\n end\n if examquestion_ids.count > seq.count\n diff_count = examquestion_ids.count - seq.count\n 0.upto(diff_count-1) do |c|\n sequence = sequence + \"Select\"+\",\"\n end\n end \n self.sequ = sequence \n end\n end",
"def seqid=(new_seqid)\n @seqid = Seqid.new(new_seqid)\n end",
"def last_insert_id(table, sequence_name) #:nodoc:\n identity = select_value(\"SELECT scope_identity()\")\n if identity.class == System::DBNull\n nil\n else\n System::Convert.to_int32(identity)\n end\n end",
"def check_id\n unless self.id\n maximo= self.class.maximum(:id)\n id = 1 unless maximo\n id ||= maximo.to_i + 1\n self.id = id\n end\n end",
"def last_insert_id(sequence_name)\n r = exec_query(\"SELECT currval('#{sequence_name}')\", 'SQL')\n Integer(r.rows.first.first)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end",
"def set_MaxId(value)\n set_input(\"MaxId\", value)\n end"
] |
[
"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.61282074",
"0.61282074",
"0.6112798",
"0.61117244",
"0.6101113",
"0.6085309",
"0.6085309",
"0.60690826",
"0.5980069",
"0.59637374",
"0.59555185",
"0.5856403",
"0.5855043",
"0.58385843",
"0.58126324",
"0.5808882",
"0.5801063",
"0.5746447",
"0.57396513",
"0.57396513",
"0.57396513",
"0.5731074",
"0.57199275",
"0.5695279",
"0.56588143",
"0.56559986",
"0.56356764",
"0.559513",
"0.55811054",
"0.55782384",
"0.5574255",
"0.55255073",
"0.5523078",
"0.54853964",
"0.54768175",
"0.5476677",
"0.5459901",
"0.5457822",
"0.5453513",
"0.54478306",
"0.5437504",
"0.54317826",
"0.54213405",
"0.5412152",
"0.5400685",
"0.5395701",
"0.5390943",
"0.539063",
"0.5386343",
"0.53761846",
"0.53692776",
"0.53373086",
"0.53237027",
"0.5323073",
"0.52979314",
"0.5293916",
"0.5286874",
"0.5262868",
"0.5262868",
"0.52533627",
"0.52530664",
"0.524741",
"0.5244029",
"0.5244029",
"0.52191806",
"0.52146304",
"0.52126026",
"0.521154",
"0.5207304",
"0.5207304",
"0.5207304",
"0.5207304",
"0.5207228",
"0.5207228",
"0.5207228",
"0.52070093",
"0.52070093",
"0.52070093",
"0.52070093"
] |
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(table_name)\n pk_and_sequence_for(table_name)[0]\n rescue\n nil\n end",
"def pk_and_sequence_for(table_name)\n (owner, table_name) = @connection.describe(table_name)\n\n # RSI: changed select from all_constraints to user_constraints - much faster in large data dictionaries\n pks = select_values(<<-SQL, 'Primary Key')\n select cc.column_name\n from user_constraints c, user_cons_columns cc\n where c.owner = '#{owner}'\n and c.table_name = '#{table_name}'\n and c.constraint_type = 'P'\n and cc.owner = c.owner\n and cc.constraint_name = c.constraint_name\n SQL\n\n # only support single column keys\n pks.size == 1 ? [oracle_downcase(pks.first), nil] : nil\n end",
"def pk_and_sequence_for(table) #:nodoc:\n result = query(<<-end_sql, 'PK and serial sequence')[0]\n SELECT columns.column_name, columns.column_default \n FROM primary_keys \n LEFT JOIN columns \n USING(table_name, column_name)\n WHERE primary_keys.table_name = '#{table_name.gsub(/(^\"|\"$)/,'')}'\n end_sql\n \n if result.length == 0\n return nil\n elsif result[0][1].nil?\n return nil\n else\n default_value = result[0][1]\n seq_name = default_value.match(/\\(\\'(\\w+)\\'\\)/).to_a.last\n return [result[0][0], seq_name]\n end\n rescue\n nil\n end",
"def pk_and_sequence_for(table) #:nodoc:\n # First try looking for a sequence with a dependency on the\n # given table's primary key.\n result = select(<<-end_sql, 'PK and serial sequence')[0]\n SELECT attr.attname, seq.relname\n FROM pg_class seq,\n pg_attribute attr,\n pg_depend dep,\n pg_namespace name,\n pg_constraint cons\n WHERE seq.oid = dep.objid\n AND seq.relkind = 'S'\n AND attr.attrelid = dep.refobjid\n AND attr.attnum = dep.refobjsubid\n AND attr.attrelid = cons.conrelid\n AND attr.attnum = cons.conkey[1]\n AND cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n\n if result.nil? or result.empty?\n # If that fails, try parsing the primary key's default value.\n # Support the 7.x and 8.0 nextval('foo'::text) as well as\n # the 8.1+ nextval('foo'::regclass).\n result = select(<<-end_sql, 'PK and custom sequence')[0]\n SELECT attr.attname,\n CASE\n WHEN split_part(def.adsrc, '''', 2) ~ '.' THEN\n substr(split_part(def.adsrc, '''', 2),\n strpos(split_part(def.adsrc, '''', 2), '.')+1)\n ELSE split_part(def.adsrc, '''', 2)\n END as relname\n FROM pg_class t\n JOIN pg_attribute attr ON (t.oid = attrelid)\n JOIN pg_attrdef def ON (adrelid = attrelid AND adnum = attnum)\n JOIN pg_constraint cons ON (conrelid = adrelid AND adnum = conkey[1])\n WHERE t.oid = '#{quote_table_name(table)}'::regclass\n AND cons.contype = 'p'\n AND def.adsrc ~* 'nextval'\n end_sql\n end\n\n [result[\"attname\"], result[\"relname\"]]\n rescue\n nil\n end",
"def primary_key table\n return nil unless table\n table = self[table]\n pk = table.column_names.find{ |c| table[c].primary_key? }\n end",
"def pk_and_sequence_for(table_name, with_seq_schema = false)\n result = select_rows(\n \"SELECT kc.column_name, \"+\n (with_seq_schema ? \"c.sequence_schema, \" : \"\") +\n \" c.sequence_name \"+\n \"FROM information_schema.table_constraints tc \"+\n \"INNER JOIN information_schema.key_column_usage kc \"+\n \" ON tc.table_schema = kc.table_schema \"+\n \" AND tc.table_name = kc.table_name \"+\n \" AND tc.constraint_name = kc.constraint_name \"+\n \"LEFT JOIN information_schema.columns c \"+\n \" ON kc.table_schema = c.table_schema \"+\n \" AND kc.table_name = c.table_name \"+\n \" AND kc.column_name = c.column_name \"+\n \"WHERE tc.table_schema = CURRENT_SCHEMA \"+\n \" AND tc.table_name = '#{table_name}' \"+\n \" AND tc.constraint_type = 'PRIMARY KEY'\",\n SCHEMA_LOG_NAME\n )\n (result.length == 1) ? result[0] : nil\n rescue\n nil\n end",
"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_catalog = 'reaktor'\n AND tc.table_schema = 'public'\n AND tc.table_name = ?\n ORDER BY ordinal_position;\n }\n\n sth = $dbh_pg.prepare(query)\n begin\n sth.execute(table.to_s)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not find primary key. Message: #{$!}. query: #{get_query_string(sth)}\")\n raise\n exit\n end\n pk = []\n while row = sth.fetch\n pk << row[0]\n end\n return pk\nend",
"def primary_key_sequence(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_key_sequences[quoted_table] if @primary_key_sequences.has_key?(quoted_table)}\n cond = {Sequel[:t][:oid] => regclass_oid(table, opts)}\n value = if pks = _select_serial_sequence_ds.first(cond)\n literal(SQL::QualifiedIdentifier.new(pks[:schema], pks[:sequence]))\n elsif pks = _select_custom_sequence_ds.first(cond)\n literal(SQL::QualifiedIdentifier.new(pks[:schema], LiteralString.new(pks[:sequence])))\n end\n\n Sequel.synchronize{@primary_key_sequences[quoted_table] = value} if value\n end",
"def find_primary_key_by_table(table_name)\n @opts[:primary_key].values_at(table_name).first\n end",
"def primary_key(table_name)\n 'id' # table.primary_key || 'id'\n end",
"def primary_key(table)\n t = dataset.send(:input_identifier, table)\n @primary_keys.fetch(t) do\n pk = fetch(\"SELECT RDB$FIELD_NAME FROM RDB$INDEX_SEGMENTS NATURAL JOIN RDB$RELATION_CONSTRAINTS WHERE RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' AND RDB$RELATION_NAME = ?\", t).single_value\n @primary_keys[t] = dataset.send(:output_identifier, pk.rstrip) if pk\n end\n end",
"def primary_key(table_name)\n stmt = @connection.primary_keys(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop unless stmt.nil?\n result[0] && result[0][3]\n end",
"def pkey\n table = self.class.table_name\n key = get_primary_key_values.first\n return key\n end",
"def pk_and_sequence_for(table_name, owner = nil, desc_table_name = nil) # :nodoc:\n (owner, desc_table_name) = @raw_connection.describe(table_name)\n\n seqs = select_values_forcing_binds(<<~SQL.squish, \"SCHEMA\", [bind_string(\"owner\", owner), bind_string(\"sequence_name\", default_sequence_name(desc_table_name))])\n select us.sequence_name\n from all_sequences us\n where us.sequence_owner = :owner\n and us.sequence_name = upper(:sequence_name)\n SQL\n\n # changed back from user_constraints to all_constraints for consistency\n pks = select_values_forcing_binds(<<~SQL.squish, \"SCHEMA\", [bind_string(\"owner\", owner), bind_string(\"table_name\", desc_table_name)])\n SELECT cc.column_name\n FROM all_constraints c, all_cons_columns cc\n WHERE c.owner = :owner\n AND c.table_name = :table_name\n AND c.constraint_type = 'P'\n AND cc.owner = c.owner\n AND cc.constraint_name = c.constraint_name\n SQL\n\n warn <<~WARNING if pks.count > 1\n WARNING: Active Record does not support composite primary key.\n\n #{table_name} has composite primary key. Composite primary key is ignored.\n WARNING\n\n # only support single column keys\n pks.size == 1 ? [oracle_downcase(pks.first),\n oracle_downcase(seqs.first)] : nil\n end",
"def primary_key(table_name)\n # TODO: Change this to be a pure mongo lookup by digging into document definitions\n # TODO: Manage _id and id\n id_definition = Mongo::DocumentDefinition.fields_for(table_name).find { |_, field_definition| field_definition['primary_key'] }\n Array(id_definition).first # && id_definition.first || '_id'\n end",
"def primary_key(table_name) #:nodoc:\r\n sql = \"SELECT COLUMN_NAME FROM (EXECUTE PROCEDURE sp_GetBestRowIdentifier( NULL, NULL, '#{table_name}', NULL, FALSE)) as gbri\"\r\n rs = select(sql)\r\n if !rs.nil? and !rs[0].nil?\r\n strip_or_self(rs[0]['COLUMN_NAME'])\r\n else\r\n nil\r\n end\r\n end",
"def primary_key(table, opts=OPTS)\n quoted_table = quote_schema_table(table)\n Sequel.synchronize{return @primary_keys[quoted_table] if @primary_keys.has_key?(quoted_table)}\n value = _select_pk_ds.where_single_value(Sequel[:pg_class][:oid] => regclass_oid(table, opts))\n Sequel.synchronize{@primary_keys[quoted_table] = value}\n end",
"def primary_key(_table_name)\n []\n end",
"def primary_key\n select(&:primary_key?)\n end",
"def primary_key(table_name)\n pk = super\n\n if pk == CockroachDBAdapter::DEFAULT_PRIMARY_KEY\n nil\n else\n pk\n end\n end",
"def primary_keys(table)\n row = exec_query(<<-end_sql, 'SCHEMA').rows.map do |row|\n SELECT DISTINCT(attr.attname)\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = cons.conkey[1]\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n row && row.first\n end\n end",
"def primary_key\n return @primary_key if @primary_key\n return 'id' if @id\n \n candidates = @columns.find_all { |col| col.unique }.map { |col| col.name }\n return 'id' if candidates.include? 'id'\n candidates.find { |c| c =~ eval(\"/^#{@name}.*id$/i\") } ||\n candidates.find { |c| c =~ eval(\"/^#{singularize}.*id$/i\") } ||\n candidates.find { |c| c =~ eval(\"/^#{pluralize}.*id$/i\") } ||\n candidates.first\n end",
"def key\n get_primary_key_value_map[self.class.table_name]\n end",
"def primary_key(table_name)\n table_name = table_name.to_s\n\n @primary_keys ||= {}\n @primary_keys[table_name] ||= if @registration[:primary_key].present?\n @registration[:primary_key].call(@connection, table_name)\n else\n @connection.primary_key(table_name)\n end\n end",
"def primary_key(table_name, opts=OPTS)\n quoted_table = quote_schema_table(table_name)\n Sequel.synchronize{return @primary_keys[quoted_table] if @primary_keys.has_key?(quoted_table)}\n out_identifier, in_identifier = identifier_convertors(opts)\n schema, table = schema_or_current_and_table(table_name, opts)\n dataset = metadata_dataset.\n select(:kc__column_name).\n from(Sequel.as(:information_schema__key_column_usage, 'kc')).\n join(Sequel.as(:information_schema__table_constraints, 'tc'),\n [:table_name, :table_schema, :constraint_name]).\n where(:kc__table_name => in_identifier.call(table),\n :kc__table_schema => schema,\n :tc__constraint_type => 'PRIMARY KEY')\n value = dataset.map do |row|\n out_identifier.call(row.delete(:column_name))\n end\n value = case value.size\n when 0 then nil\n when 1 then value.first\n else value\n end\n Sequel.synchronize{@primary_keys[quoted_table] = value}\n end",
"def primary_key_name\n @primary_key_name ||= @connection.schema[@table_name.to_s][:primary_key]\n end",
"def primary_keys(table)\n pks = query(<<-end_sql, 'SCHEMA')\n SELECT DISTINCT attr.attname\n FROM pg_attribute attr\n INNER JOIN pg_depend dep ON attr.attrelid = dep.refobjid AND attr.attnum = dep.refobjsubid\n INNER JOIN pg_constraint cons ON attr.attrelid = cons.conrelid AND attr.attnum = any(cons.conkey)\n WHERE cons.contype = 'p'\n AND dep.refobjid = '#{quote_table_name(table)}'::regclass\n end_sql\n pks.present? ? pks[0] : pks\n end",
"def primary_key\n primary_key = attributes.find { |a| a.primary_key? }\n error(\"Unable to locate primary key for #{self.name}, attributes => #{attributes.collect { |a| a.name }}\") unless primary_key\n primary_key\n end",
"def primary_key\n @primary_key ||= :id\n end",
"def reset_pk_sequence!(table_name, primary_key=nil, sequence_name=nil)\n primary_key, seq_schema, sequence_name = pk_and_sequence_for(table_name, true)\n if primary_key && !sequence_name\n @logger.warn \"#{table_name} has primary key #{primary_key} with no sequence\" if @logger\n end\n\n if primary_key && sequence_name\n seq_from_where = \"FROM information_schema.sequences \"+\n \"WHERE sequence_schema='#{quote_string(seq_schema)}' \"+\n \"AND sequence_name='#{quote_string(sequence_name)}'\"\n result = select_rows(\n \"SELECT COALESCE(MAX(#{quote_column_name(primary_key)} + (SELECT increment #{seq_from_where})), \"+\n \" (SELECT minimum_value #{seq_from_where})) \"+\n \"FROM #{quote_table_name(table_name)}\",\n SCHEMA_LOG_NAME\n )\n\n if result.length == 1\n # The COMMIT; BEGIN; can go away when 1) transactional DDL is available 2) There is a better restart/set function\n execute(\n \"COMMIT; \"+\n \"CALL sys.alter_seq_restart('#{quote_string(seq_schema)}', '#{quote_string(sequence_name)}', #{result[0][0]}); \"+\n \"BEGIN;\",\n SCHEMA_LOG_NAME\n )\n else\n @logger.warn \"Unable to determin max value for #{table_name}.#{primary_key}\" if @logger\n end\n end\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_key\n \"#{quoted_table_name}.#{model_class.send :primary_key}\"\n end",
"def primary_key\n @primary_key\n end",
"def primary_key_columns\n @columns.values.find_all { |c| c.primary_key? }\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:\n unless pk && sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n\n pk ||= default_pk\n sequence ||= default_sequence\n end\n\n if @logger && pk && !sequence\n @logger.warn \"#{table} has primary key #{pk} with no default sequence.\"\n end\n\n if pk && sequence\n quoted_sequence = quote_table_name(sequence)\n max_pk = query_value(\"SELECT MAX(#{quote_column_name pk}) FROM #{quote_table_name(table)}\", \"SCHEMA\")\n if max_pk.nil?\n if postgresql_version >= 100000\n minvalue = query_value(\"SELECT seqmin FROM pg_sequence WHERE seqrelid = #{quote(quoted_sequence)}::regclass\", \"SCHEMA\")\n else\n minvalue = query_value(\"SELECT min_value FROM #{quoted_sequence}\", \"SCHEMA\")\n end\n end\n if max_pk\n # NOTE(joey): This is done to replace the call:\n #\n # SELECT setval(..., max_pk, false)\n #\n # with\n #\n # SELECT setval(..., max_pk-1)\n #\n # These two statements are semantically equivilant, but\n # setval(string, int, bool) is not supported by CockroachDB.\n #\n # FIXME(joey): This is incorrect if the sequence is not 1\n # incremented. We would need to pull out the custom increment value.\n max_pk - 1\n end\n query_value(\"SELECT setval(#{quote(quoted_sequence)}, #{max_pk ? max_pk : minvalue})\", \"SCHEMA\")\n end\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:\n unless pk and sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n pk ||= default_pk\n sequence ||= default_sequence\n end\n if pk\n if sequence\n quoted_sequence = quote_column_name(sequence)\n\n select_value <<-end_sql, 'Reset sequence'\n 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)\n end_sql\n else\n @logger.warn \"#{table} has primary key #{pk} with no default sequence\" if @logger\n end\n end\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:\n unless pk and sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n pk ||= default_pk\n sequence ||= default_sequence\n end\n if pk\n if sequence\n quoted_sequence = quote_column_name(sequence)\n\n select_value <<-end_sql, 'Reset sequence'\n 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)\n end_sql\n else\n @logger.warn \"#{table} has primary key #{pk} with no default sequence\" if @logger\n end\n end\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n self.class.primary_key\n end",
"def primary_key\n self.class.primary_key\n end",
"def reset_primary_key_sequence(table)\n return unless seq = primary_key_sequence(table)\n pk = SQL::Identifier.new(primary_key(table))\n db = self\n s, t = schema_and_table(table)\n table = Sequel.qualify(s, t) if s\n\n if server_version >= 100000\n seq_ds = metadata_dataset.from(:pg_sequence).where(:seqrelid=>regclass_oid(LiteralString.new(seq)))\n increment_by = :seqincrement\n min_value = :seqmin\n # :nocov:\n else\n seq_ds = metadata_dataset.from(LiteralString.new(seq))\n increment_by = :increment_by\n min_value = :min_value\n # :nocov:\n end\n\n get{setval(seq, db[table].select(coalesce(max(pk)+seq_ds.select(increment_by), seq_ds.select(min_value))), false)}\n end",
"def primary_key\n unless @primary_key\n pk_column_names = Set.new( primary_key_columns.collect { |c| c.name } )\n unique_indexes = indexes.values.find_all { |i| i.unique? }\n\n pk_result = []\n\n unique_indexes.each do |idx|\n idx_column_names = Set.new( idx.columns.collect { |c| c.name } )\n r = idx_column_names ^ pk_column_names\n if r.size == 0 then\n pk_result = idx.columns\n break\n end\n end\n\n # no joy, see about just using all the columns that say the are primary\n # keys\n if pk_result.empty? then\n pk_result = self.primary_key_columns\n end\n @primary_key = pk_result\n end\n return @primary_key\n end",
"def autoincrementing_primary_key\n primary_key\n end",
"def autoincrementing_primary_key\n primary_key\n end",
"def primary_key\n @primary_key || 'id'\n end",
"def table_primary_keys table_name, include_parent_keys = false\n sql = +\"WITH TABLE_PK_COLS AS ( \"\n sql << \"SELECT C.TABLE_NAME, C.COLUMN_NAME, C.INDEX_NAME, C.COLUMN_ORDERING, C.ORDINAL_POSITION \"\n sql << \"FROM INFORMATION_SCHEMA.INDEX_COLUMNS C \"\n sql << \"WHERE C.INDEX_TYPE = 'PRIMARY_KEY' \"\n sql << \"AND TABLE_CATALOG = '' \"\n sql << \"AND TABLE_SCHEMA = '') \"\n sql << \"SELECT INDEX_NAME, COLUMN_NAME, COLUMN_ORDERING, ORDINAL_POSITION \"\n sql << \"FROM TABLE_PK_COLS \"\n sql << \"INNER JOIN INFORMATION_SCHEMA.TABLES T USING (TABLE_NAME) \"\n sql << \"WHERE TABLE_NAME = %<table_name>s \"\n sql << \"AND TABLE_CATALOG = '' \"\n sql << \"AND TABLE_SCHEMA = '' \"\n unless include_parent_keys\n sql << \"AND (T.PARENT_TABLE_NAME IS NULL OR COLUMN_NAME NOT IN ( \"\n sql << \" SELECT COLUMN_NAME \"\n sql << \" FROM TABLE_PK_COLS \"\n sql << \" WHERE TABLE_NAME = T.PARENT_TABLE_NAME \"\n sql << \")) \"\n end\n sql << \"ORDER BY ORDINAL_POSITION\"\n execute_query(\n sql,\n table_name: table_name\n ).map do |row|\n Index::Column.new \\\n table_name,\n row[\"INDEX_NAME\"],\n row[\"COLUMN_NAME\"],\n order: row[\"COLUMN_ORDERING\"],\n ordinal_position: row[\"ORDINAL_POSITION\"]\n end\n end",
"def get_pkey_fields(table_struct)\n pkeys = []\n\n table_struct.each do | row |\n pkeys << row[:field] if row[:key] == 'PRI'\n end\n\n pkeys\nend",
"def primary_key(table, field)\n execute \"ALTER TABLE #{table} ADD PRIMARY KEY(#{field_list(field)})\"\n end",
"def has_primary_key(db, table, key)\n return db.primary_key(table) == key.to_s if db.respond_to?(:primary_key)\n\n pk_column_info = db.schema(table).find { |column_info| column_info[0] == key }\n return false if pk_column_info.nil?\n\n pk_column_info[1][:primary_key] == true\nend",
"def primary_key\n @primary_key ||= @klass.primary_key.to_s\n end",
"def primary_key\n self[:primary_key]\n end",
"def primary_key(value=nil)\n self.primary_key = value unless value.nil?\n \n @primary_key ||= :id\n end",
"def primary_key\n 'id'\n end",
"def primary_keys(field)\n sql = \"SELECT #{field.primary_key_col} from #{field.table} \"\n sql += \"#{where_and(sql)} #{field.column} IS NOT NULL \" if field.leave_null\n field.where&.each_pair do |column, value|\n sql += \"#{where_and(sql)} #{column} = #{value} \"\n end\n sql += \"ORDER BY #{field.primary_key_col};\"\n execute(sql).split(\"\\n\")\nend",
"def primary_key\n send( self.class.primary_key )\n end",
"def primary_key\n '_id'\n end",
"def reset_pk_sequence!(table, pk = nil, sequence = nil)\n if ! pk || ! sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n pk ||= default_pk; sequence ||= default_sequence\n end\n if pk && sequence\n quoted_sequence = quote_column_name(sequence)\n\n select_value <<-end_sql, 'Reset Sequence'\n 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)\n end_sql\n end\n end",
"def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n else\n dataset.first(primary_key_hash(pk))\n end\n end",
"def full_primary_key(klass)\n \"#{klass.quoted_table_name}.#{klass.quoted_primary_key}\"\n end",
"def primary_key\n case primary_key_prefix_type\n when :table_name\n Inflector.foreign_key(class_name_of_active_record_descendant(self), false)\n when :table_name_with_underscore\n Inflector.foreign_key(class_name_of_active_record_descendant(self))\n else\n \"id\"\n end\n end",
"def insert_pk\n if (f = opts[:from]) && !f.empty?\n case t = f.first\n when Symbol, String, SQL::Identifier, SQL::QualifiedIdentifier\n if pk = db.primary_key(t)\n pk\n end\n end\n end\n end",
"def primary_key\n fields.select { |f| f.key }.map(&:name)\n end",
"def orchestrate_primary_key\n id\n end",
"def default_sequence_name(table_name, pk = nil) #:nodoc:\n result = serial_sequence(table_name, pk || 'id')\n return nil unless result\n Utils.extract_schema_qualified_name(result).to_s\n rescue ActiveRecord::StatementInvalid\n Redshift::Name.new(nil, \"#{table_name}_#{pk || 'id'}_seq\").to_s\n end",
"def uses_sequence\n select_value(\"SELECT name FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';\")\n end",
"def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end",
"def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end",
"def primary_key\n @attributes[self.primary_key_attribute]\n end",
"def generate_primary_key\n self[self.class.primary_key] ||= self.class.new_primary_key(10_000)\n end",
"def primary_key_names(table_name, options = {})\n return connection.primary_key_names(table_name) if options[:raw]\n \n self.primary_key_names_cache ||= {}\n result = primary_key_names_cache[table_name]\n unless result\n result = manual_primary_keys[table_name] || connection.primary_key_names(table_name)\n primary_key_names_cache[table_name] = result\n end\n result\n end",
"def pkey_selection(table = nil)\n prefix = table ? \"#{table}.\" : \"\"\n \"#{primary_key.map { |k| \"#{prefix}`#{k}` AS '#{k}'\" }.join(', ')}\"\n end",
"def primary_key_names\n @primary_key_names ||= session.left.primary_key_names(left_table)\n end",
"def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n elsif dataset.joined_dataset?\n # SEQUEL5: Remove as joined model datasets are not allowed\n dataset.first(qualified_primary_key_hash(pk))\n else\n dataset.first(primary_key_hash(pk))\n end\n end",
"def primary_key\n cached_fetch(:primary_key){associated_class.primary_key || raise(Error, \"no primary key specified for #{associated_class.inspect}\")}\n end",
"def default_sequence_name(table_name, pri_key = nil)\n serial_sequence(table_name, pri_key || 'id').split('.').last\n rescue ActiveRecord::StatementInvalid\n \"#{table_name}_#{pri_key || 'id'}_seq\"\n end",
"def set_sequence(table_name, pk)\n begin\n stmt = @connection.run(\"select max(#{pk}) + 1 from #{table_name}\")\n next_pk_val = stmt.fetch\n stmt.drop\n flds = table_name.split('.')\n @connection.do(\"sequence_set('#{flds[0]}.#{flds[1]}.#{table_name}.#{pk}', #{next_pk_val}, 0)\")\n return true\n rescue Exception => e\n @logger.unknown(\"exception=#{e}\") if @trace\n end\n return false\n end",
"def primary_key\n return @primary_key if @primary_key\n @primary_key = dimension_table.to_s.camelize.constantize.primary_key.to_sym\n rescue NameError => e\n ETL::Engine.logger.debug \"couldn't get primary_key from dimension model class, using default :id\"\n @primary_key = :id\n end",
"def get_primary_keys \r\n return {\"KtoNr\" => self.KtoNr}\r\n end",
"def extract_key(row)\n row.reject {|column, value| not primary_key_names.include? column }\n end",
"def default_sequence_name(table_name, pk = \"id\")\n nil\n end",
"def default_sequence_name(table_name, column = nil)\n pk, seq = pk_and_sequence_for(table_name)\n if column && (pk != column)\n # Is this ever actually called with a non-pk column?\n nil\n else\n seq\n end\n rescue\n nil\n end",
"def pk(ta, h)\n x = primary_keys[ta]\n if x.is_a?(Array)\n unless x == []\n x = x.map{|ca| h[ca]}\n x if x.all?\n end\n else\n h[x]\n end\n end",
"def primary_key?\n schema && schema[:primary_key]\n end",
"def serial_primary_key_options\n {:primary_key => true, :type => :integer, :auto_increment => true}\n end",
"def serial_primary_key_options\n {:primary_key => true, :type => :integer, :auto_increment => true}\n end",
"def association_primary_key(klass = nil)\n active_record.primary_key\n end",
"def primary_key_attribute\n :id\n end",
"def last_insert_id(table, sequence_name) #:nodoc:\n Integer(select_value(\"SELECT currval('#{sequence_name}')\"))\n end",
"def find(*args)\n raise Automodel::FindOnCompoundPrimaryKeyError if table[:composite_primary_key]\n super\n end",
"def primary_key_value(obj)\n obj.pk\n end",
"def serial_primary_key_options\n {:primary_key => true, :type => Integer, :auto_increment => true}\n end",
"def serial_primary_key_options\n {:primary_key => true, :type => Integer, :auto_increment => true}\n end",
"def primary_key\n self[:primary_key] ||= self[:model].primary_key\n end",
"def qualified_primary_key\n cached_fetch(:qualified_primary_key){qualify_cur(primary_key)}\n end",
"def getNextSequence(table,db)\n\t\tif db[table].count == 0\n\t\t\treturn 1\n\t\telse\n\t\t\tdb[table].find().sort(_id: -1).limit(1).each do |document|\n\t\t\t\treturn document[:_id]+1\n\t\t\tend\n\t\tend\n\tend",
"def primary_key\n self.class.primary_key == :id ? id : @saved_attributes[self.class.primary_key]\n end",
"def serial_primary_key_options\n {:primary_key => true, :serial => true, :type=>Integer}\n end",
"def primary_key(name, type = :primary_key, **options)\n column(name, type, **options.merge(primary_key: true))\n end"
] |
[
"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.68511313",
"0.68148273",
"0.6784319",
"0.673908",
"0.67326915",
"0.66803163",
"0.665388",
"0.66209966",
"0.66164017",
"0.6614755",
"0.65523535",
"0.653146",
"0.653146",
"0.65307474",
"0.6513421",
"0.65047204",
"0.64426965",
"0.64356005",
"0.64122057",
"0.64122057",
"0.64122057",
"0.6375507",
"0.6361121",
"0.6360058",
"0.6360058",
"0.6334928",
"0.63348556",
"0.6327641",
"0.63051707",
"0.6285004",
"0.6282691",
"0.62587327",
"0.624767",
"0.62192595",
"0.6206498",
"0.6189246",
"0.6152762",
"0.61419773",
"0.61305934",
"0.6115272",
"0.61136776",
"0.60722303",
"0.6059169",
"0.605025",
"0.6047691",
"0.6044042",
"0.60307556",
"0.60307556",
"0.6012087",
"0.600851",
"0.6006869",
"0.60030174",
"0.5963146",
"0.5952483",
"0.59442055",
"0.59414154",
"0.59398514",
"0.59273124",
"0.59189004",
"0.59035426",
"0.59015435",
"0.58943194",
"0.58545685",
"0.58518213",
"0.5850869",
"0.5850869",
"0.5849206",
"0.5847667",
"0.5846594",
"0.5835874",
"0.5813916",
"0.5811415",
"0.5811415",
"0.5797524",
"0.5790053",
"0.5783366",
"0.57774806",
"0.577616",
"0.57692575"
] |
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('SELECT schema_name FROM information_schema.schemata').flatten\n end",
"def schemas\n sql = \"SELECT nspname FROM pg_namespace WHERE nspname !~ '^pg_.*'\"\n ActiveRecord::Base.connection.query(sql).flatten\n end",
"def available_schemas\n load_schemas.transform_values(&:description).to_a\n end",
"def schema\n @schema ||= []\n end",
"def get_storage_names\n @schemas = self.get_schema\n @schemas.map { |schema| schema['id'] }\n end",
"def get_schemas\n @schemas\n end",
"def schemas\n @schemas ||= metadata.xpath('//Schema').map do |schema_xml|\n [\n schema_xml.attributes['Namespace'].value,\n Schema.new(schema_xml, self)\n ]\n end.to_h\n end",
"def schemas\n @schemas ||= metadata.xpath('//Schema').map do |schema_xml|\n [\n schema_xml.attributes['Namespace'].value,\n Schema.new(schema_xml, self)\n ]\n end.to_h\n end",
"def schema\n []\n end",
"def schema_name\n unless @schema_name\n @schema_name = collect_first(&:schema_name)\n end\n return @schema_name\n end",
"def schema_and_table_name\n if qualified_table_name.include? '.'\n schema_name, table_name = qualified_table_name.split('.', 2)\n else\n table_name = qualified_table_name\n schema_name = self.class.default_schema_name\n end\n [schema_name, table_name]\n end",
"def tables\n execute('select table_name from information_schema.tables where table_schema = ?', [schema]).map(&:first)\n end",
"def namespace_names\n @namespaces.map(&:name)\n end",
"def get_tables\n get_schemas.keys\n end",
"def list_names_of_all_tables\n tables = @stargate.list_tables\n tables.collect { |t| t.name}\n end",
"def current_schemata\n extension :pg_array\n metadata_dataset.select(Sequel::function(:current_schemas, false).\n cast('varchar[]')).single_value.map(&:to_sym)\n end",
"def table_names\n @tables.keys\n end",
"def schemas\n @schema ||= Dir['schemas/*'].reduce({}) do |schemas, file|\n filename = parse_filename(file)\n schemas[filename] = File.read(file).split(\"\\n\").map do |row|\n values = row.split(',')\n {\n name: values[0],\n length: values[1],\n type: values[2]\n }\n end\n\n schemas\n end\n end",
"def names\n map(&:names).flatten\n end",
"def all_database_names\n @specs_store.names\n end",
"def entity_types\n @entity_types ||= schemas.map do |namespace, schema|\n schema.entity_types.map do |entity_type|\n \"#{namespace}.#{entity_type}\"\n end\n end.flatten\n end",
"def entity_types\n @entity_types ||= schemas.map do |namespace, schema|\n schema.entity_types.map do |entity_type|\n \"#{namespace}.#{entity_type}\"\n end\n end.flatten\n end",
"def schema_tables\n @schema_tables ||= %i[\n projects\n amazon_clouds\n data_centers\n jmeter_plans\n load_agents\n target_hosts\n clusters\n execution_cycles\n client_stats\n page_stats\n target_stats\n jtl_files\n ]\n end",
"def tables()\n tables = []\n @client.query(\"SHOW TABLES;\").each do |table|\n tables.push(table.values[0])\n end\n\n tables\n end",
"def names\n @column_families.keys\n end",
"def get_non_public_schema_table_names\n result = @connection.query(<<-SQL, 'SCHEMA')\n SELECT schemaname || '.' || tablename\n FROM pg_tables\n WHERE schemaname NOT IN ('pg_catalog', 'information_schema', 'public')\n ORDER BY schemaname, tablename\n SQL\n result.flatten\n end",
"def tenant_names\n ActiveRecord::Base.connection.execute('SELECT nspname FROM pg_namespace;').collect { |row| row['nspname'] }\n end",
"def tenant_names\n ActiveRecord::Base.connection.execute('SELECT nspname FROM pg_namespace;').collect { |row| row['nspname'] }\n end",
"def list_namespace_tables(namespace_name)\n unless namespace_name.nil?\n return @admin.listTableNamesByNamespace(namespace_name).map(&:getQualifierAsString)\n end\n\n raise(ArgumentError, \"Failed to find namespace named #{namespace_name}\")\n end",
"def schema_prefix\n ''\n end",
"def types\n load_schema! unless schema_loaded?\n @types\n end",
"def schema_meta_data\n schema = []\n # not sure if there needs to be a header element with the number of columns in it\n # would look sort of like this\n # header = SchemaElement.new\n # header.name = @csv.rows.first.first\n # header.num_children = num_rows\n # schema << header\n @csv.headers.each do |header|\n schema << Configurator.schema_element_with_defaults({\n name: header\n })\n end\n\n schema\n end",
"def schema\n jiak.data.schema\n end",
"def table_names\n with_admin { |admin| admin.list_tables.map(&:name_as_string) }\n end",
"def list_schemas request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_schemas_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DiscoveryEngine::V1::ListSchemasResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def index\n @schemas = Schema.all\n end",
"def schema\n return @schema\n end",
"def database_names\n database_info.keys\n end",
"def keyspace_names\n @keyspaces.keys\n end",
"def types\n @types ||= inject({}) { |memo, schema| memo.merge(schema.types) }\n end",
"def getHeaderFieldNames(schemaName)\n\t\tend",
"def get_schemas(tag, sname, node, attrs)\n begin\n engine = Marty::ScriptSet.new(tag).get_engine(sname+'Schemas')\n result = engine.evaluate_attrs(node, attrs, {})\n attrs.zip(result)\n rescue => e\n use_message = e.message == 'No such script' ?\n 'Schema not defined' : 'Problem with schema'\n raise \"Schema error for #{sname}/#{node} \"\\\n \"attrs=#{attrs.join(',')}: #{use_message}\"\n end\n end",
"def tables(name = nil, schema = nil, table = nil)\n schema = schema ? \"'#{quote_string(schema)}'\" : 'CURRENT_SCHEMA'\n select_rows(\n \"SELECT table_name \"+\n \"FROM information_schema.tables \"+\n \"WHERE table_type = 'TABLE' \"+\n \" AND table_schema = #{schema} \"+\n (table ? \"AND table_name = '#{quote_string(table)}'\" : \"\"),\n SCHEMA_LOG_NAME\n ).map { |row|\n row[0]\n }\n end",
"def schema\n adapter.schema\n end",
"def jsonschemas\n schemas = {}\n steps.collect(&:jsonschema).each do |s|\n schemas.merge!(s['properties']) unless s.nil?\n end\n return schemas.stringify_keys\n end",
"def database_names\n database_info.keys\n end",
"def tables\n Mongo::DocumentDefinition.defined_document_names\n #db.collection_names\n end",
"def tables(name = nil)\n query(<<-SQL, 'SCHEMA').map { |row| row[0] }\n SELECT tablename\n FROM pg_tables\n WHERE schemaname = ANY (ARRAY['public'])\n SQL\n end",
"def schema\n schema = Schema.new\n\n for name in db.tables\n next if IGNORED_TABLES.include? name\n table = schema.add_table( name )\n import_table( table )\n end\n\n schema\n end",
"def schema(name)\n get(\"schemas/#{name}/\", \"schema\")\n end",
"def json_schema\n @schema.to_s\n end",
"def tables(name = nil)\n if name\n ActiveSupport::Deprecation.warn(<<-MSG.squish)\n Passing arguments to #tables is deprecated without replacement.\n MSG\n end\n\n select_values(\"SELECT tablename FROM pg_tables WHERE schemaname = ANY(current_schemas(false))\", 'SCHEMA')\n end",
"def unchanged_schemas\n return @unchanged_schemas unless @unchanged_schemas.nil?\n\n @unchanged_schemas = []\n @unchanged_schemas << name if @already_camelized\n referenced_schemas.each do |referenced_camelizer|\n @unchanged_schemas.concat referenced_camelizer.unchanged_schemas\n end\n @unchanged_schemas\n end",
"def schemas(stream)\n # Don't create \"public\" schema since it exists by default.\n schema_names = PgPower::Tools.schemas - [\"public\", \"information_schema\"]\n schema_names.each do |schema_name|\n schema(schema_name, stream)\n end\n stream << \"\\n\"\n end",
"def tables(_name = nil)\n stmt = @connection.tables\n result = stmt.fetch_all || []\n stmt.drop\n\n result.each_with_object([]) do |row, table_names|\n schema_name, table_name, table_type = row[1..3]\n next if respond_to?(:table_filtered?) && table_filtered?(schema_name, table_type)\n table_names << format_case(table_name)\n end\n end",
"def tables(_name = nil)\n stmt = @connection.tables\n result = stmt.fetch_all || []\n stmt.drop\n\n result.each_with_object([]) do |row, table_names|\n schema_name, table_name, table_type = row[1..3]\n next if respond_to?(:table_filtered?) && table_filtered?(schema_name, table_type)\n table_names << format_case(table_name)\n end\n end",
"def schema\n absolutize(@schema)\n end",
"def schema\n absolutize(@schema)\n end",
"def schema\n connection.schema\n end",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def read_all(path=nil)\n schemas = []\n file_path = File.join(path || SchemaTools.schema_path, '*.json')\n Dir.glob( file_path ).each do |file|\n schema_name = File.basename(file, '.json').to_sym\n schemas << read(schema_name, path)\n end\n schemas\n end",
"def names\n Array(@name)\n end",
"def names\n map(&:name)\n end",
"def as_names\n __getobj__.map { |i| i.name }\n end",
"def __schema\n @relvar.namespace.schema\n end",
"def table_names\n structure_yml.to_a.map { |s| s.first }.select{ |tn| tn != SHARED_COLUMNS }\n end",
"def tables(name = nil)\n @connection.table_names\n end",
"def show_tables\n execute('select table_name from information_schema.tables where table_schema = ?', [schema])\n end",
"def schema_version_list\n result = []\n Dir.glob(\"#{File.dirname(__FILE__)}/expands/v*.rb\") do |f|\n result << File.basename(f, '.rb')\n end\n result.sort\n end",
"def names\n map(&:name)\n end",
"def model_names\n result = []\n ole_obj.Models.each do |el|\n result << el.name\n end\n result\n end",
"def get_tables\r\n table_names = []\r\n tables = @db.execute <<-SQL\r\n SELECT name FROM sqlite_master\r\n WHERE type='table'\r\n ORDER BY name;\r\n SQL\r\n tables.each do |row| \r\n table_names << row[\"name\"]\r\n end\r\n table_names\r\n end",
"def search_schemas(opts = {})\n data, _status_code, _headers = search_schemas_with_http_info(opts)\n return data\n end",
"def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n stream.puts \" # Custom schemas defined in this database.\"\n list.each { |name| stream.puts \" create_schema \\\"#{name}\\\", force: :cascade\" }\n stream.puts\n end",
"def schema_source\n column_families\n end",
"def schema\n @schema.nil? ? root : root.join(@schema)\n end",
"def schema_data\n dev_schema\n rescue\n VetsJsonSchema::SCHEMAS[@schema_name]\n end",
"def column_names\n columns.map(&:name)\n end",
"def tables\n execute(\"SHOW TABLES FROM #{@opts[:database]}\")\n .map{ |i| i.values }\n .reduce(:+)\n .map{ |i| i.to_sym }\n end",
"def schema\n execute(<<-eosql).collect { |row| row[0] }.collect { |t| table_schema(t) }\nSELECT rdb$relation_name FROM rdb$relations WHERE rdb$system_flag != 1\neosql\n end",
"def collection_names\n collections.keys\n end",
"def tenant_names\n connection.execute('select datname from pg_database;').collect { |row| row['datname'] }\n end",
"def names\n collect { |a| a.name }\n end",
"def question_names\n self.catalogs.reduce([]) do |names, catalog|\n questions = \"#{catalog.capitalize}Catalog\".constantize.const_get(\"QUESTIONS\")\n namespaced_questions = questions.map{|question| \"#{catalog}_#{question}\".to_sym }\n\n names + namespaced_questions\n end\n end",
"def list_schemas view, options = {}\n schema_view = Google::Cloud::PubSub::V1::SchemaView.const_get view.to_s.upcase\n paged_enum = schemas.list_schemas parent: project_path(options),\n view: schema_view,\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end",
"def all_package_names\n each_autobuild_package.map(&:name)\n end",
"def schema\n @schema ||= get_parser(options)\n end",
"def schema_name\n return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\\./\n return self.table_name_prefix.to_s.gsub(/\\./,'') if self.table_name_prefix && self.table_name_prefix =~ /\\./\n return self.connection.config[:database] if self.connection.mysql?\n end",
"def tables\n db_connection.select_values(\"show tables\")\n end",
"def tables\n []\n end",
"def quoted_schema\n Squirm.quote_ident schema\n end",
"def names_for(ip)\n resolvers.each do |r|\n names = r.getnames(ip)\n\n return names unless names.nil? || names.empty?\n end\n\n []\n end",
"def get_storage_names\n # This gets all the non view tables, but has to strip column 0 out of the two column response.\n select(\"SHOW FULL TABLES FROM #{options[:path][1..-1]} WHERE Table_type = 'BASE TABLE'\").map { |item| item.first }\n end",
"def schema\n @schema ||= metadata.ancestors('Schema').first\n end",
"def get_stanza_column_names (stanza_name)\n columns = []\n @metadata[\"stanzas\"].map do |stanza|\n if stanza_name == stanza[\"stanza_name\"]\n stanza[\"queries\"].each do |query|\n query[\"columns\"].each do |column|\n columns.push(column[\"column_name\"])\n end\n end\n end\n end\n columns.uniq\nend",
"def as_name_array\n if @db == @@sdb\n as_array[0]\n elsif @db == @@google_storage\n objects = Hash.from_xml(@db.get_bucket(@table_name))[\"ListBucketResult\"][\"Contents\"]\n if objects.nil? #there is no contents node, meaning there are no tables in the database\n []\n else\n objects = [objects] unless objects.is_a?(Array)\n objects.map! {|object| object[\"Key\"]}\n end\n end\n end",
"def names\n NAME_FIELDS.map { |k| has_field?(k) ? @fields[k].tokens : nil }.flatten.compact\n end",
"def schema\n self.class.schema\n end",
"def schema_lookup(schema_name)\n s = nil\n @current_domain.schemas.each do |schema|\n s = schema if schema.name == schema_name\n end\n s\n end"
] |
[
"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.5884116",
"0.5884116",
"0.5860674",
"0.5860136",
"0.5835491",
"0.58271134",
"0.5809472",
"0.5809472",
"0.57905525",
"0.5787839",
"0.57703024",
"0.5732573",
"0.57291895",
"0.5724804",
"0.57232714",
"0.5710181",
"0.5693362",
"0.568633",
"0.5684194",
"0.5677137",
"0.565514",
"0.56362695",
"0.5635376",
"0.56345016",
"0.5625279",
"0.56231594",
"0.56141895",
"0.55996996",
"0.5596168",
"0.55701405",
"0.55645627",
"0.55614674",
"0.55574495",
"0.5552879",
"0.55473363",
"0.5546081",
"0.55440515",
"0.55440515",
"0.5541277",
"0.5539647",
"0.55393463",
"0.55367166",
"0.5532386",
"0.5530664",
"0.55278003",
"0.5527685",
"0.5512833",
"0.5511868",
"0.55108595",
"0.5509918",
"0.55051976",
"0.5501719",
"0.54950064",
"0.5486871",
"0.54822826",
"0.54748654",
"0.5474739",
"0.5473572",
"0.5464573",
"0.54640913",
"0.544993",
"0.54478186",
"0.5407839",
"0.5407817",
"0.5395937",
"0.5377755",
"0.53747076",
"0.53665197",
"0.5366056",
"0.53650004",
"0.536069",
"0.5358711",
"0.53557855",
"0.53464574",
"0.5333236",
"0.533133",
"0.5327189",
"0.532602",
"0.5311999"
] |
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_name)\n end",
"def schema_defined_for?(statement_name)\n !!schema_for(statement_name)\n end",
"def schema_in_use?(tenant)\n schema = ActiveRecord::Base.connection.\n execute(\"SELECT schema_name\n FROM information_schema.schemata\n WHERE schema_name = '#{tenant}'\")\n schema.ntuples > 0\n end",
"def table_exists?\n true\n end",
"def has_schema?\n request || !responses.empty? || documentation\n end",
"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 schema, table = extract_schema_and_table(name.to_s)\n return false unless table\n\n binds = [[nil, table]]\n binds << [nil, schema] if schema\n\n sql = \"#{TABLE_EXISTS_SQL_PREFIX} AND n.nspname = #{schema ? \"?\" : 'ANY (current_schemas(false))'}\"\n\n log(sql, 'SCHEMA', binds) do\n @connection.execute_query_raw(sql, binds).first['table_count'] > 0\n end\n end",
"def valid_schema?(schema, id)\n schema.is_a?(Hash) && Schema.build(schema, parent, id)\n rescue InvalidSchema\n false\n end",
"def table_exists?\n db.table_exists?(table_name)\n end",
"def exists?\n begin\n res=@db.fetch %Q/ SELECT tablename FROM pg_tables WHERE tablename='%s' AND schemaname='%s'/ % [table_name,schema_name]\n if res.count == 0\n res=@db.fetch %Q/ SELECT viewname FROM pg_views WHERE viewname='%s'AND schemaname='%s'/ % [table_name,schema_name]\n end\n rescue PG::Error => err\n return false\n end\n\n # also say false if the table is empty\n if res.count > 0\n return ds.select(1).limit(1).count > 0\n else\n return true\n end\n return false\n end",
"def valid?\n return false if @info.nil?\n return false if @schema_version.nil?\n true\n end",
"def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend",
"def feature_table_exists?\n Feature::FlipperFeature.table_exists?\n rescue StandardError\n false\n end",
"def table_exists?(table)\n table_info(table) ? true : false\n end",
"def server_schema?(schema=nil)\n schema ||= jiak.bucket.schema\n jiak.client.schema(jiak.bucket).eql? schema\n end",
"def ensure_tenant_schema_exists\n logger.info \"Creating new schema '#{db_name}' ...\"\n if schema_exists?\n logger.info \"Schema '#{db_name}' already existed!\"\n else\n Apartment::Tenant.create(db_name)\n end\n rescue Apartment::SchemaExists => e\n logger.info \"#{e.class.name}: Schema '#{db_name}' already existed!\"\n end",
"def supports_schema_parsing?\n respond_to?(:schema_parse_table, true)\n end",
"def schema?(model_class)\n model_class.name == 'ActiveRecord::SchemaMigration'\n end",
"def exists?\n @executor.call({\n command: :keyspaces,\n transformer_arguments: {\n executor: @executor,\n },\n }).any? { |keyspace| keyspace.name == @name }\n end",
"def database_exists?\n exists = File.file?(@database_path)\n raise \"Database does not exist: #{@database_path}\" unless exists\n\n exists\n end",
"def database_exists?\n\t\t\t _options = configurations[Rails.env].dup\n\t\t\t _options.symbolize_keys!\n\n\t\t begin\n\t\t connection\n\t\t return true\n\t\t rescue Exception => e\n\t\t return false\n\t\t end\n\t\t end",
"def reload_db_schema?\n false\n end",
"def reload_db_schema?\n false\n end",
"def db_exists? db_name\n File.exists? db_name\n end",
"def oauth_applications_exists?\n ActiveRecord::Base.connection.table_exists? :oauth_applications\n end",
"def table_exists?(name)\n if respond_to?(:tables)\n tables.include?(name.to_sym)\n else\n from(name).first\n true\n end\n rescue\n false\n end",
"def table_exists?(table_name)\n sql = 'select count(*) as table_exists from pg_tables where tablename = $1::varchar'\n result = conn.exec_params(sql, [table_name])\n result[0]['table_exists'] == 0 ? false : true\n end",
"def database_exists(dbh, db_name)\n return !dbh.select_one(\"SELECT SCHEMA_NAME\n FROM INFORMATION_SCHEMA.SCHEMATA\n WHERE SCHEMA_NAME = ?\", db_name).nil?\nend",
"def exist?\n true\n end",
"def table_exists? (table_name)\r\n if !get_tables.include? (table_name)\r\n puts \"the current database doesn't include a table called \\\"#{table_name}\\\"\"\r\n return false\r\n end\r\n true\r\n end",
"def has_database?\n paths.shared_config.join('database.yml').exist? &&\n !paths.shared_config.join('nodatabase.yml').exist?\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 true\n end\n rescue\n false\n end\n end",
"def exists?\n Table.exists?(db, auditor.audit_db, name)\n end",
"def valid?\n schema_validator.validate(schema, raw_data)\n end",
"def exist_tables?\n @db.tables.sort == [:mirrors, :users, :user_tokens, :products, :products_users, :versions, :dependencies, :access_keys].sort\n end",
"def required?\n @schema['required'] ? true : false\n end",
"def exist?\n workspace_info.exist?\n end",
"def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end",
"def has_database?\n paths.path(:shared_config, 'database.yml').exist? &&\n !paths.path(:shared_config, 'nodatabase.yml').exist?\n end",
"def table_exists?\n @table_exists = ActiveRecord::Base.connection.table_exists? @model.table_name if @table_exists == nil\n @table_exists\n end",
"def table_exists?(table_name)\n return false unless table_name\n schema, table = split_table_name(table_name)\n tables(nil, schema, table).any?\n end",
"def aggregation_schedules_table_exists?\n return true unless Rails.env.test?\n\n Namespace::AggregationSchedule.table_exists?\n end",
"def installed?\n File.exists?(database_configuration_file)\n end",
"def storage_exists?(storage_name)\n statement = <<-EOS.compress_lines\n SELECT COUNT(*)\n FROM `information_schema`.`columns`\n WHERE `table_schema` = ? AND `table_name` = ?\n EOS\n\n query(statement, db_name, storage_name).first > 0\n end",
"def table_or_view_ready?\n Admin::MigrationGenerator.table_or_view_exists?(table_name)\n rescue StandardError => e\n @extra_error = e\n false\n end",
"def valid?\n schema.validate(self)\n end",
"def exists?\n validate_directory_structure\n end",
"def valid?\n if Gem.loaded_specs.has_key?(\"json-schema\")\n return validation_errors.empty?\n else\n return true\n end\n end",
"def exists?\n @exists\n end",
"def exists?\n !service.get_table(instance_id, name, view: :NAME_ONLY).nil?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def table_exists(table_name)\n ActiveRecord::Base.connection.execute(\"SELECT EXISTS(SELECT * FROM information_schema.tables WHERE table_name = '#{table_name}');\").first['exists'] == 't'\n end",
"def data_set_exists?\n Pathname.new(header_file_full_path).exist?\n end",
"def exist?\n nil\n end",
"def valid_schema_version?\n schema_version = PROIEL::PROIELXML::Schema.check_schema_version_of_xml_file(@filename)\n\n if schema_version.nil?\n @errors << 'invalid schema version'\n\n false\n else\n true\n end\n rescue PROIEL::PROIELXML::Schema::InvalidSchemaVersion => e\n @errors << e.message\n\n false\n end",
"def exists?\n\t\tFile.exists?(File.join(path, 'PG_VERSION'))\n\tend",
"def exists?(path)\n\t\t@connection.exists?(path)\n\tend",
"def exists?(slug)\n File.exists? table_path(slug)\n end",
"def exists?\n @exists == true\n end",
"def supports_create_table_if_not_exists?\n server_version >= 90100\n end",
"def table_exists?\n @table_exists ||= {}\n @table_exists[current_site] ||= ActiveRecord::Base.connection.table_exists?(@model.table_name)\n end",
"def exists?\n\t\treturn false\n\tend",
"def table_exists?(tablename)\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n tablename.is_a?(Symbol)\r\n\r\n return @engine.table_exists?(tablename)\r\n end",
"def exist?\n @resource.exist?\n end",
"def which_has_schema(schema)\n if schema.key? '$ref'\n ref = schema\n schema = resolve_ref(schema['$ref'])\n end\n\n self.baw_model_schema = defined?(ref) ? ref : schema\n let(:model_schema) {\n schema\n }\n end",
"def table_exist?(table_name)\n res = run_single_result(\"SELECT COUNT(*) FROM X$File\n WHERE Xf$Name = '#{table_name}'\")\n res == 1\n end",
"def storage_exists?(storage_name)\n statement = <<-SQL.compress_lines\n SELECT COUNT(*)\n FROM \"information_schema\".\"tables\"\n WHERE \"table_type\" = 'BASE TABLE'\n AND \"table_schema\" = ?\n AND \"table_name\" = ?\n SQL\n\n query(statement, schema_name, storage_name).first > 0\n end",
"def has_run?(filename)\n if @db.schema_schema_evolution_manager_exists?\n query = \"select count(*) from %s.%s where filename = '%s'\" % [Db.schema_name, @table_name, filename]\n @db.psql_command(query).to_i > 0\n else\n false\n end\n end",
"def exists?\n zk.exists?(path)\n end",
"def exists_on_server?\n false\n end",
"def document_exists? path_to_document\n File.exists? path_to_document\n end",
"def supports_create_table_if_not_exists?\n false\n end",
"def exists?()\n #This is a stub, used for indexing\n end",
"def named_db_exists?(connection, name)\n connection.exec(\"SELECT count(*) AS result FROM pg_database WHERE datname='#{name}'\")[0]['result'] == '1'\n end",
"def index_exists?\n connection.index_exists?(index_name_with_prefix)\n end",
"def exists?\n true\n end",
"def table_exists?(table='test_ruby') \n begin\n res = @db.query(\"select * from #{table} where 1=0\")\n return true\n rescue\n return false\n end\n end",
"def exist?(name)\n @data_adapter.has_relation? name\n end",
"def supports_create_table_if_not_exists?\n true\n end",
"def database_exists?(name)\n database = ::MySQL::Database.find_by_name(name)\n !database.nil?\n end",
"def exists?\n self.ensure == :present\n end",
"def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end",
"def valid?\n @errors = self.class.valid_against_schema?(self.class.json_schema, self)\n @errors.empty?\n end",
"def valid?\n xml_schema_valiations.all?{ |v| instance_eval(&v) }\n end",
"def schema_valid_error(schema, message, trace)\n xprint(\"\\n** INVALID SCHEMA ** #{message}: #{schema.inspect}\\n\")\n false\n end",
"def exists?()\n end",
"def exists?(style_name = default_style)\n filesystem.exists?\n end",
"def create_schema\n PgTools.create_schema id unless PgTools.schemas.include? id.to_s\n end",
"def exists?(table_name)\n @admin.tableExists(TableName.valueOf(table_name))\n end",
"def has_table?(table_id)\n begin\n table table_id\n rescue\n false\n else\n true\n end\n end",
"def available?\n @available_flag ||= ActiveRecord::Migrator.current_version >= REQUIRED_SCHEMA_VERSION # rubocop:disable Gitlab/PredicateMemoization\n end",
"def available?(database)\n return false unless installed?(database)\n return true if created?(database)\n\n created_any_version?(database) ? updatable?(database) : creatable?(database)\n rescue ExtensionCreateError\n false\n end",
"def cross_schema_support?\n @cross_schema_support ||= (config[:adapter] =~ /(mysql)|(postgres)|(sqlserver)/i)\n end",
"def exists?\n false\n end",
"def exists?\n false\n end",
"def table_exists?\n resp = dynamodb_client.describe_table(table_name: table_name)\n resp.table.table_status == 'ACTIVE'\n rescue DynamoDB::Errors::ResourceNotFoundException\n false\n end",
"def table_exists?(table)\n ActiveRecord::Base.connection.table_exists?(table)\nend",
"def table_exists?(table)\n ActiveRecord::Base.connection.table_exists?(table)\nend"
] |
[
"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.65754956",
"0.65427476",
"0.6522344",
"0.6498995",
"0.6496282",
"0.6496282",
"0.64937574",
"0.6480491",
"0.64754426",
"0.64376944",
"0.6426902",
"0.6412927",
"0.64103115",
"0.63945097",
"0.6393376",
"0.6383448",
"0.6379469",
"0.63735735",
"0.63716334",
"0.6356463",
"0.6352891",
"0.632766",
"0.63223743",
"0.6321972",
"0.6318272",
"0.6297277",
"0.62811476",
"0.6259002",
"0.6253651",
"0.6243203",
"0.62154746",
"0.62128544",
"0.6210531",
"0.62030464",
"0.6201822",
"0.61944425",
"0.61879164",
"0.6165434",
"0.6158206",
"0.61531836",
"0.6151735",
"0.6150118",
"0.61380905",
"0.6125152",
"0.612464",
"0.6120934",
"0.61155033",
"0.61153114",
"0.6103149",
"0.60972744",
"0.60923237",
"0.60909224",
"0.60743827",
"0.60615665",
"0.60341275",
"0.60334176",
"0.60307264",
"0.60276407",
"0.6027607",
"0.60252285",
"0.6006727",
"0.599222",
"0.5977474",
"0.5971764",
"0.5964684",
"0.59549564",
"0.5951535",
"0.59464824",
"0.5944144",
"0.5937631",
"0.59300745",
"0.5924787",
"0.5921095",
"0.5919563",
"0.5918041",
"0.591011",
"0.591011",
"0.5901455",
"0.5899073",
"0.5899073"
] |
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_value(<<~SQL.squish, \"SCHEMA\")\n SELECT SYS_CONTEXT('userenv', 'current_schema') FROM dual\n SQL\n end",
"def schema_name\n return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\\./\n return self.table_name_prefix.to_s.gsub(/\\./,'') if self.table_name_prefix && self.table_name_prefix =~ /\\./\n return self.connection.config[:database] if self.connection.mysql?\n end",
"def schema_name\n @schema_name ||= owner_type.eql?('Root') ? owner.tenant.schema_name : schema_name_from_access_key_id\n end",
"def current_schema\n select_value('SELECT current_schema()', 'SCHEMA')\n end",
"def shared_schema_name\n Roomer.shared_schema_name ||= options[:shared_schema_name].to_s\n end",
"def schema_prefix\n ''\n end",
"def identifier(schema, name = nil)\n name ||= @name\n \"`#{schema}`.`#{name}`\"\n end",
"def components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name)\n schema_name\n end",
"def get_schema_id()\n\t\tend",
"def components_schema_name(_doc, _path_component, _tag_name, _verb, schema_name)\n schema_name\n end",
"def schema_name_for(statement_name)\n unless statement_name =~ STATEMENT_NAME_REGEXP\n raise ArgumentError, \"statement '#{statement_name}' name must match #{STATEMENT_NAME_REGEXP.inspect}\"\n end\n const_name = statement_name.to_s\n if const_name == \"schema\"\n \"#{self.name}::Schema\"\n else\n \"#{self.name}::#{const_name.camelize}Schema\"\n end\n end",
"def roomer_full_table_name_prefix(schema_name)\n \"#{schema_name.to_s}#{Roomer.schema_seperator}\"\n end",
"def namespace_equivalent_for_db_server\n # HACK!\n return connection.respond_to?(:postgresql_connection) ? 'schema' : 'database'\n end",
"def schema_lookup(schema_name)\n s = nil\n @current_domain.schemas.each do |schema|\n s = schema if schema.name == schema_name\n end\n s\n end",
"def local_name; connection_space.name end",
"def namespace\n \"#{database.name}.#{name}\"\n end",
"def namespace\n \"#{database.name}.#{name}\"\n end",
"def schema(name)\n get(\"schemas/#{name}/\", \"schema\")\n end",
"def schema\n return @schema\n end",
"def table_name\n self.name.split('::').last\n end",
"def schema\n @schema.nil? ? root : root.join(@schema)\n end",
"def schema\n @schema ||= metadata.ancestors('Schema').first\n end",
"def current_database\n select_value('select current_database()', 'SCHEMA')\n end",
"def namespaced_table_name\n [self.class.table_namespace, table_name].reject {|s| s.nil? || s.empty?}.join('-')\n end",
"def table_name\n @table_name ||= begin\n schema = self.class.schema_name\n table = self.sqltablename.blank? ? \"PS_#{self.recname}\" : self.sqltablename\n [schema, table].compact.join(\".\")\n end\n end",
"def scheme_name\n svc = minter\n return nil unless svc.present?\n\n scheme(svc: svc)&.name&.downcase\n end",
"def __schema\n @relvar.namespace.schema\n end",
"def name\n @db_name\n end",
"def default_graphql_name\n to_s.split(\"::\").last.sub(/\\Z/, \"\")\n end",
"def humanName\n schema&.dig('name')\n end",
"def default_database_name\n self.name.tableize\n end",
"def name\n (@name ||= namespace).to_s.underscore.symbolize\n end",
"def name\n db_name = URI.parse(uri(self)).path.to_s.sub(\"/\", \"\")\n db_name.blank? ? database : db_name\n end",
"def schema_and_table_name\n if qualified_table_name.include? '.'\n schema_name, table_name = qualified_table_name.split('.', 2)\n else\n table_name = qualified_table_name\n schema_name = self.class.default_schema_name\n end\n [schema_name, table_name]\n end",
"def ctype\n select_value(\n \"SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def quoted_schema\n Squirm.quote_ident schema\n end",
"def schema\n @schema ||= (default_schema || ETL::Schema::Table.new)\n end",
"def schema\n if @old_schema.nil?\n @old_schema = Schema.new(get(link('schema')))\n end\n return @old_schema \n end",
"def name\n @config.db_name.gsub(/@thismachinehostname@/, Socket.gethostname).\n gsub(/@prefix@/, prefix)\n end",
"def schema\n self.class.schema\n end",
"def db_name\n @uri.path.split('/').last\n end",
"def name\n @name ||= self.class.non_namespaced_name\n end",
"def prefix\n if @config.db_general_authmode == :winauth\n \"%s.dbo.\" % [@dbprops.name]\n else\n \"\"\n end\n end",
"def form_name\n @form_name ||= master_class(ActiveRecord::Base).name.underscore\n end",
"def schema_name=schema_name\n self.table_name_prefix = \"#{schema_name}.\" if schema_name && !schema_name.blank?\n self.table_name = \"#{self.table_name_prefix}#{self.table_name}\" unless self.abstract_class?\n end",
"def schema_version\n migration_context.current_version\n end",
"def table_name\n if qualified? && meta[:qualified].is_a?(Symbol)\n meta[:qualified]\n else\n source.dataset\n end\n end",
"def current_table_name(model)\n table_name_from_model_version(model, get_current_model_version(model))\n end",
"def database_name\n data[:database_name]\n end",
"def _table_name\n self.class.table_name\n end",
"def schema\n connection.schema\n end",
"def _xml_name()\n if name = self.sfa_class\n return name\n end\n self.class.name.gsub('::', '_')\n end",
"def qualified_name\n if @demangled\n # The 'demangled' attribute of the node for methods / functions is the \n # full signature, so cut that part out.\n @demangled.split(/\\(/)[0]\n else\n @parent ? \"#{@parent.qualified_name}::#{@name}\" : @name\n end\n end",
"def qualified_name\n self.class.name\n end",
"def schema\n absolutize(@schema)\n end",
"def schema\n absolutize(@schema)\n end",
"def table_name\n self.to_s.pluralize.underscore\n end",
"def docname(doctype)\n \"#{self.class.class_prefix(self.class)}:#{self.app_id}:#{self.doc_suffix(doctype)}\"\n end",
"def name\n @name ||= Rails.application.class.parent_name.underscore\n end",
"def db_name\n data[:db_name]\n end",
"def name\n return self.class.name.split('::').last\n end",
"def real_table_name\n packageid.gsub('.', '_')\n end",
"def json_schema\n @schema.to_s\n end",
"def namespace\n return self.name ? self.name.downcase.gsub(/[^0-9A-Za-z ]/, '').gsub(' ', '-') : ''\n end",
"def schema\n self\n end",
"def table_name\n self.class.table_name\n end",
"def schema(work_class_name:, context: nil)\n context ||= AllinsonFlex::Context.where(name: 'default')\n AllinsonFlex::DynamicSchema.where(\n allinson_flex_class: work_class_name,\n context: context\n ).order('created_at').last.schema\n rescue StandardError\n {}\n end",
"def fullName\n return 'nil' if @obj.nil?\n\n java_import org.dspace.content.MetadataSchema\n schema = MetadataSchema.find(DSpace.context, @obj.schemaID)\n str = \"#{schema.getName}.#{@obj.element}\"\n str += \".#{@obj.qualifier}\" if @obj.qualifier\n str\n end",
"def current_database_name\n ActiveRecord::Base.connection_pool.spec.config[:name] || 'default'\n end",
"def get_table_name\n self.class.table_name\n end",
"def fully_qualified_name\n return \".#{self.package}\"\n end",
"def database_name\n @dbi.db_name\n end",
"def database_name\n @dbi.db_name\n end",
"def database_name\n @database_name\n end",
"def pretty_name\n @pretty_name || self.to_s\n end",
"def pretty_name\n @pretty_name || self.to_s\n end",
"def qualified_name\n if parent\n \"#{parent.qualified_name}::#{self.name}\"\n else\n self.name\n end\n end",
"def default_schema\n nil\n end",
"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 schema_key\n @schema_key ||= self.class.name.demodulize.gsub('Validator', '').underscore\n end",
"def realname\r\n return for_context(nil, false) { |c| c.realname }\r\n end",
"def my_name\n @my_name ||= self.class.name.split(\"::\").last\n end",
"def name\n self.class.name.split(\"::\").last\n end",
"def qualified_name\n self.code.qualified_name\n end",
"def namespace\n @namespace ||= schema.attributes['Namespace'].value\n end",
"def name\n self.class.name.split('::').last\n end",
"def current_namespace\n @current_namespace\n end",
"def name\n self.class.name.split('::').last\n end",
"def full_function_name(function_name, options)\n schema = options[:schema]\n function_name = %Q{\"#{schema}\".#{function_name}} if schema\n function_name\n end",
"def roomer_set_table_name_prefix\n self.table_name_prefix = begin\n case @roomer_scope\n when :shared\n roomer_full_table_name_prefix(Roomer.shared_schema_name)\n when :tenanted\n roomer_full_table_name_prefix(Roomer.current_tenant.try(Roomer.tenant_schema_name_column))\n else\n \"\"\n end\n end\n end",
"def base_name\n name\n end",
"def base_name\n @base_name ||= if base = name.to_s.split(\"::\").first\n base.underscore\n end\n end",
"def scaffold_name_sql\n scaffold_auto_complete_options[:sql_name]\n end",
"def resource_name\n current_definition.resource_name\n end",
"def schema\n @schema ||= Schema::Scope.new(self)\n end",
"def scaffold_name\n @scaffold_name ||= name.underscore\n end",
"def schema_definition\n of.schema_definition \n end",
"def table_name\n @table_name ||= self.class.const_get(class_name).table_name\n end"
] |
[
"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.6508917",
"0.64252293",
"0.64233786",
"0.64031714",
"0.6386361",
"0.63860345",
"0.63813585",
"0.6361144",
"0.6357424",
"0.63555926",
"0.6354112",
"0.63355094",
"0.6322251",
"0.62650067",
"0.6261896",
"0.62579954",
"0.6243751",
"0.6222775",
"0.62059385",
"0.6199798",
"0.6184479",
"0.616958",
"0.615911",
"0.6147076",
"0.6144624",
"0.6144418",
"0.6120634",
"0.61117667",
"0.6101517",
"0.6099757",
"0.6082304",
"0.60737634",
"0.60716134",
"0.606775",
"0.6064289",
"0.6050319",
"0.6050319",
"0.602808",
"0.602693",
"0.6019537",
"0.6019392",
"0.60170853",
"0.6009504",
"0.6008483",
"0.6007513",
"0.6004191",
"0.5999448",
"0.59986556",
"0.59979016",
"0.59949654",
"0.59920996",
"0.59733695",
"0.59669113",
"0.59669113",
"0.596616",
"0.5957162",
"0.5957162",
"0.5947282",
"0.5927986",
"0.59267753",
"0.59223574",
"0.59074914",
"0.5901982",
"0.5900538",
"0.5890741",
"0.5889523",
"0.58884835",
"0.5886655",
"0.58866",
"0.5880985",
"0.5874009",
"0.58707464",
"0.5866309",
"0.5865674",
"0.5857087",
"0.58541644",
"0.5854051",
"0.58470786",
"0.58417886"
] |
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 encoding')[0]['encoding']\n end\n end",
"def encoding_for_ruby\n @database_encoding ||= case ActiveRecord::Base.connection.encoding\n when 'UTF8'\n 'UTF-8'\n else\n ActiveRecord::Base.connection.encoding\n end\n end",
"def encoding\n @connection.encoding.to_s\n end",
"def charset\n show_variable \"character_set_database\"\n end",
"def encoding\n @attributes[:encoding]\n end",
"def get_encoding()\n puts @csv_encoding\n end",
"def default_encoding; end",
"def default_encoding; end",
"def encoding\n\t'ISO-8859-1'\nend",
"def character_set_name\n @dbi.character_set_name\n end",
"def character_set_name\n @dbi.character_set_name\n end",
"def encoding()\n #This is a stub, used for indexing\n end",
"def encoding\n Encoding::UTF_8\n end",
"def encoding\n Encoding::UTF_8\n end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def format\n @format ||= self._format_default\n end",
"def encoding\n @gapi.csv_options.encoding\n end",
"def encoding\n @gapi.csv_options.encoding\n end",
"def database_type(database)\n Contrib::Utils::Database.normalize_vendor(database.database_type.to_s)\n end",
"def encoding\n if @encoding.blank?\n if !self.http_headers.blank?\n if self.http_headers['content-type'] =~ /charset=([\\w\\d-]+)/\n @encoding = $1.downcase\n else\n @encoding = self.encoding_from_feed_data\n end \n else\n @encoding = self.encoding_from_feed_data\n end\n end\n return @encoding\n end",
"def encoding\n @gapi.encoding\n end",
"def encoding\n @gapi.encoding\n end",
"def formats\n @@formats\n end",
"def format\n return @format\n end",
"def format\n return @format\n end",
"def format\n return @format\n end",
"def encodings; end",
"def encoding\n @external_encoding\n end",
"def default_encoding\n Encoding::UTF_8\n end",
"def formats\n self.class::FORMATS\n end",
"def meta_encoding; end",
"def meta_encoding; end",
"def character_set_name\n @charset.name\n end",
"def getDatabaseType\n return ActiveRecord::Base.connection.adapter_name\n end",
"def charset\n metadata[:charset]\n end",
"def database_type\n :fdbsql\n end",
"def encoding\n @content[pn(:Encoding)]\n end",
"def input_format\n settings[:input_format]\n end",
"def charset\n 'UTF8'\n end",
"def pack_format\n self.class.get_pack_format\n end",
"def encoding\n @encoding ||= Encoding.const_get(\n Hunspell.Hunspell_get_dic_encoding(self).gsub('-','_')\n )\n end",
"def default_encoding\n (@media_type == \"text\") ? \"quoted-printable\" : \"base64\"\n end",
"def charset\n @@charset\n end",
"def ctype\n select_value(\n \"SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def so_encoding(feature)\n if hash = @data[feature]\n if hash[\"encoding\"]\n return hash[\"encoding\"]\n end\n end\n end",
"def output_format\n settings[:output_format]\n end",
"def format\n @format ||= {}\n end",
"def serialization_format\n serialization_map.values.first\n end",
"def encoding\n # noop?\n end",
"def guess_encoding\n if @mime_type && !@mime_type.binary?\n \"7bit\"\n else\n \"binary\"\n end\n end",
"def to_format\n @format ||= lookup.last \n end",
"def printGetDbFormats(dbName)\n printDebugMessage('printGetDbFormats', 'Begin', 1)\n dbInfo = getDatabaseInfo(dbName)\n if dbInfo != nil\n dbInfo.each_element('formatInfoList/formatInfo') { |formatInfo|\n puts formatInfo.elements['name'].text\n }\n end\n printDebugMessage('printGetDbFormats', 'End', 1)\n end",
"def guess_encoding(guesser = CharDet)\n Encoding.find(guesser.detect(self, :silent => true)[\"encoding\"])\n end",
"def version_formats\n self.class::VERSION_FORMATS\n end",
"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 found_encoding; end",
"def found_encoding; end",
"def collation\n select_value(\n \"SELECT pg_database.datcollate\" <<\n \" FROM pg_database\" <<\n \" WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def set_date_format(format) \n unless format.nil?\n return format\n else\n return @@db_format\n end\n end",
"def charset\n 'utf-8'\n end",
"def encoding(encoding)\n primitive \"encoding #{encoding}\"\n end",
"def default_format\n @default_format ||= :html\n end",
"def format\n @format\n end",
"def encoding(encoding); end",
"def charset\n #@data.charset ||= CharGuess.guess(document).downcase\n end",
"def default_encoding=(_arg0); end",
"def mobile_encoding\n\t'ISO-8859-1'\nend",
"def character_set\n @character_set ||= show_variable('character_set_connection') || 'utf8'\n end",
"def database_flags\n settings[:database_flags]\n end",
"def printGetSupportedFormats()\n printDebugMessage('printGetSupportedFormats', 'Begin', 1)\n dbInfoList = getDatabaseInfoList()\n dbInfoList.each{ |dbInfo|\n fmtStr = ''\n itemNum = 0\n dbInfo.each_element('formatInfoList/formatInfo') { |formatInfo|\n fmtStr += ',' if(itemNum > 0)\n fmtStr += formatInfo.elements['name'].text\n itemNum += 1\n }\n \n puts dbInfo.elements['name'].text + \"\\t\" + fmtStr\n }\n printDebugMessage('printGetSupportedFormats', 'End', 1)\n end",
"def charset\n # locale parameter is ignored now.\n system.charset\n end",
"def dialect\n connection.adapter_name.downcase.to_s\n end",
"def format\n @data.format == :base ? :file : @data.format\n end",
"def encoding_found; end",
"def encoding_found; end",
"def force_default_encoding; end",
"def encoding(value = nil)\n value ? @encoding = value : @encoding\n end",
"def content_format\n attributes.fetch(:contentFormat)\n end",
"def encoding\n @io.external_encoding\n end",
"def encoding\n @io.external_encoding\n end",
"def typus_date_format(attribute = 'default')\n date_format = Typus::Configuration.config[self.name]['fields']['options']['date_formats'][attribute] rescue nil\n date_format = :db if date_format.nil?\n return date_format.to_sym\n end",
"def encoding\n @encoding ||= AudioFormat::Encoding::PCM_UNSIGNED\n end",
"def binary_mode(mode)\n ruby_19? ? \"#{mode}:ASCII-8BIT\" : mode\n end",
"def base_rfc5646_locale\n @blob.project.base_locale.rfc5646\n end"
] |
[
"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.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5922049",
"0.5921071",
"0.58429533",
"0.58429533",
"0.5824147",
"0.58164304",
"0.5813798",
"0.5813798",
"0.5805453",
"0.5800146",
"0.5800146",
"0.5800146",
"0.5790845",
"0.5787261",
"0.57701045",
"0.5758077",
"0.57256365",
"0.57256365",
"0.57234657",
"0.5718122",
"0.5716857",
"0.56934476",
"0.5682073",
"0.56782746",
"0.5670803",
"0.5668698",
"0.56602573",
"0.56461066",
"0.5622737",
"0.5618617",
"0.5618156",
"0.56181496",
"0.56170267",
"0.56083155",
"0.56073385",
"0.5596789",
"0.5593912",
"0.55870044",
"0.5574748",
"0.55649",
"0.5544993",
"0.5544993",
"0.5525389",
"0.5525389",
"0.55251646",
"0.5517751",
"0.5510327",
"0.5488465",
"0.54690254",
"0.54665333",
"0.54637593",
"0.5452073",
"0.5440091",
"0.5439643",
"0.54333085",
"0.54308236",
"0.54260254",
"0.54112685",
"0.5408962",
"0.5404578",
"0.5393555",
"0.5393555",
"0.53804886",
"0.53769445",
"0.5358634",
"0.5350024",
"0.5350024",
"0.5348834",
"0.5347289",
"0.53426886",
"0.5329264"
] |
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 collation\n if @object.kind_of?(Linkage::Data)\n @object.collation\n else\n nil\n end\n end",
"def collation\n 'ucs_binary'\n end",
"def collation=(value)\n @collation = value\n end",
"def character_set_name\n @dbi.character_set_name\n end",
"def character_set_name\n @dbi.character_set_name\n end",
"def spell_collation\n spellcheck_response && spellcheck_response.index(\"collation\") && spellcheck_response[spellcheck_response.index(\"collation\")+1]\n end",
"def charset\n show_variable \"character_set_database\"\n end",
"def get_charset(locale)\n locale.charset || @@default_locale.charset\n end",
"def encoding_for_ruby\n @database_encoding ||= case ActiveRecord::Base.connection.encoding\n when 'UTF8'\n 'UTF-8'\n else\n ActiveRecord::Base.connection.encoding\n end\n end",
"def encoding\n select_value(\n \"SELECT pg_encoding_to_char(pg_database.encoding)\" <<\n \" FROM pg_database\" <<\n \" WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"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 encoding')[0]['encoding']\n end\n end",
"def character_set_name\n @charset.name\n end",
"def collation_enabled?\n $collation_enabled ||= scanned_client_server!.features.collation_enabled?\nend",
"def get_charset(locale)\n loc = LocaleTable.find{|v| v[1] == locale.to_win}\n loc = LocaleTable.find{|v| v[1] =~ /^#{locale.language}-/} unless loc\n loc ? loc[2] : \"CP1252\"\n end",
"def charset\n @@charset\n end",
"def charset\n # locale parameter is ignored now.\n system.charset\n end",
"def character_set\n @character_set ||= show_variable('character_set_connection') || 'utf8'\n end",
"def current_database #:nodoc:\n select_one(\"select sys_context('userenv','db_name') db from dual\")[\"db\"]\n end",
"def charset\n metadata[:charset]\n end",
"def charset\n #@data.charset ||= CharGuess.guess(document).downcase\n end",
"def _character_set(id)\n Unxls::Biff8::Constants::CHARSETS[id]\n end",
"def current_database\n query('select current_database()')[0][0]\n end",
"def current_locale\n Thread.current[:\"localite:locale\"] || base\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n else\n return nil\n end\n end",
"def current_language\n @@current_language\n end",
"def charset\n @j_del.charset().toString()\n end",
"def cipher_name\n @cipher.name\n end",
"def mb_downcase\n\t\treturn self.mb_chars.downcase.to_s\n\tend",
"def current_database\n select_value('select current_database()', 'SCHEMA')\n end",
"def database_name\n database&.name\n end",
"def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n elsif !self.org.nil?\n return self.org.get_locale\n else\n return nil\n end\n end",
"def current\n RequestStore.store[:alchemy_current_language] || default\n end",
"def most_common_language\n self.repos.collect { |repo| repo.language }.mode\n end",
"def get_encoding()\n puts @csv_encoding\n end",
"def current_database_name\n ActiveRecord::Base.connection_pool.spec.config[:name] || 'default'\n end",
"def enc_col\r\n if !@enc_col\r\n self.conn_exec do |driver|\r\n @enc_col = driver.escape_col\r\n end\r\n end\r\n \r\n return @enc_col\r\n end",
"def character_set_name\n data[:character_set_name]\n end",
"def character_set_name\n data[:character_set_name]\n end",
"def charset\n @charset ||= message.charset.upcase\n end",
"def database_name\n @database_name\n end",
"def charset\n 'UTF8'\n end",
"def ctype\n select_value(\n \"SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def current_locale\n I18n.locale.to_sym || I18n.default_locale.to_sym || I18n.available_locales.first.to_sym\n end",
"def default_database_name\n self.name.tableize\n end",
"def encoding\n @encoding ||= Encoding.const_get(\n Hunspell.Hunspell_get_dic_encoding(self).gsub('-','_')\n )\n end",
"def charset\n 'utf-8'\n end",
"def determine_database\n self.class.database \n end",
"def database_name\n @dbi.db_name\n end",
"def database_name\n @dbi.db_name\n end",
"def z_fix_charset\n Iconv.iconv('UTF-8', 'UTF-8', self).first.to_s\n end",
"def encoding\n @connection.encoding.to_s\n end",
"def column_definition_collate_sql(sql, column)\n if collate = column[:collate]\n sql << \" COLLATE #{collate}\"\n end\n end",
"def charset\n @charset ||= (charset_from_meta_charset || charset_from_content_type)\n end",
"def language\n compiler && @compiler.class.language\n end",
"def getCol\n return @col\n end",
"def timezone\n @timezone || Sequel.database_timezone\n end",
"def dialect\n connection.adapter_name.downcase.to_s\n end",
"def cipher_name\n rc, name = Cproton.pn_ssl_get_cipher_name(@impl, 128)\n return name if rc\n nil\n end",
"def get_collection_name()\r\n result = nil\r\n if @coll_id #if coll_id is false, than collection_service is used by environment\r\n info = Transformer::KeyBuilder.collection_info(@env_id, @coll_id)\r\n result = @db_interface.get_hash_value(info, Transformer::KeyBuilder::NAME_KEY)\r\n end\r\n return result\r\n end",
"def database\n @database ? @database : Database::ADMIN\n end",
"def charset\n if @header\n has_content_type? ? content_type_parameters['charset'] : @charset\n else\n @charset\n end\n end",
"def name\n @db_name\n end",
"def current_language\n @attributes[:current_language]\n end",
"def db\n @db == true ? TABLE : @db.try(:parameterize, separator: \"_\")\n end",
"def charset_name(name)\n case name.to_s.downcase\n when \"utf-8\"\n \"utf8\"\n when /^iso-8859-[0-9]+$/\n name.to_s.gsub(/^.*?-([0-9]+)$/, \"latin\\\\1\")\n else\n name\n end\n end",
"def database_name\n data[:database_name]\n end",
"def keyspace\n @@current_keyspace || @@default_keyspace\n end",
"def keyspace\n @@current_keyspace || @@default_keyspace\n end",
"def current_zone\n ::Time.new.zone\n end",
"def get_charset_name(charset)\n charset.downcase.gsub(/[^0-9a-z]/, \"\")\n end",
"def coll_name\n return coll.college_name\n end",
"def find_locale\n locale = locales.all.detect(&:default)\n return locale.code if locale\n\n default_locale\n end",
"def column_definition_collate_sql(sql, column)\n if collate = column[:collate]\n collate = literal(collate) unless collate.is_a?(String)\n sql << \" COLLATE #{collate}\"\n end\n end",
"def database\n @database ||= determine_database\n end",
"def suggest\n Hash[@solr_data[:spellcheck]['suggestions']]['collation']\n end",
"def locale\n favored_locale\n end",
"def current_schema\n select_value(<<~SQL.squish, \"SCHEMA\")\n SELECT SYS_CONTEXT('userenv', 'current_schema') FROM dual\n SQL\n end",
"def current_schema\n exec_query('SELECT current_schema', 'SCHEMA')[0][\"current_schema\"]\n end",
"def database_name \n self.database.nil? ? 'Not Assigned' : self.database.name \n end",
"def database\n @database || self.class.database\n end",
"def charset\n @charset ||= (charset_from_meta_charset || charset_from_meta_content_type)\n end",
"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 getDatabaseType\n return ActiveRecord::Base.connection.adapter_name\n end",
"def encoding\n Encoding::UTF_8\n end",
"def encoding\n Encoding::UTF_8\n end",
"def default_encoding\n Encoding::UTF_8\n end",
"def nchar_character_set_name\n data[:nchar_character_set_name]\n end",
"def charset\n match_data = headers['Content-Type']&.match(/charset=(.*);?/)\n return unless match_data\n\n Encoding.find(match_data[1])\n end",
"def down_case\n mb_chars.downcase.to_s\n end",
"def database\n @database || self.class.database\n end",
"def language_code\n if self.class.globalized?\n unless @original_language.nil?\n code = @original_language.code\n else\n code = Globalize::Locale.base_language.code\n end\n elsif Globalize::Locale.language.nil?\n code = Globalize::Locale.base_language.code\n else\n code = Globalize::Locale.language.code\n end\n code\n end",
"def utf8_locale\n if params[:lang]\n cookies[:lang] = params[:lang]\n elsif cookies[:lang]\n params[:lang] = cookies[:lang]\n end\n I18n.locale = params[:lang]\n # TODO remove blood with Dean\n Dean.columns\n end",
"def collection\n database[collection_name]\n end",
"def create_table_statement(model)\n \"#{super} ENGINE = InnoDB CHARACTER SET #{character_set} COLLATE #{collation}\"\n end"
] |
[
"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.5351092",
"0.53038955",
"0.53015316",
"0.5291988",
"0.5207476",
"0.5149855",
"0.5124375",
"0.5118455",
"0.51022154",
"0.5100365",
"0.5025201",
"0.502118",
"0.50119376",
"0.49689913",
"0.49554026",
"0.4948104",
"0.4931789",
"0.49261186",
"0.49248105",
"0.4906576",
"0.4889331",
"0.48781705",
"0.48781705",
"0.48733363",
"0.48665264",
"0.48617443",
"0.48543188",
"0.48516035",
"0.48448896",
"0.48426348",
"0.48174468",
"0.47999677",
"0.47967854",
"0.47967854",
"0.4796187",
"0.47949696",
"0.47666523",
"0.47464317",
"0.47311363",
"0.47250777",
"0.47063142",
"0.4686199",
"0.46776944",
"0.46765742",
"0.467398",
"0.46465683",
"0.46394843",
"0.4632702",
"0.46255034",
"0.46240124",
"0.46134734",
"0.4611631",
"0.4611631",
"0.46115518",
"0.46073717",
"0.45981902",
"0.4579784",
"0.45697865",
"0.45603698",
"0.454186",
"0.45390186",
"0.45371538",
"0.45338628",
"0.45283636",
"0.45226893",
"0.4515341",
"0.4515013",
"0.4515013",
"0.45128533",
"0.45067945",
"0.45067945",
"0.4492679",
"0.4488054",
"0.4470231",
"0.44671938",
"0.44636303",
"0.4461023",
"0.44595826",
"0.4457698",
"0.44560862"
] |
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 end",
"def lookup_ctype(ctype)\n ctypes[ctype] or raise Exceptions::TypeNotRegistered.new(ctype)\n end",
"def storage_type\n @dbi.storage_type\n end",
"def storage_type\n @dbi.storage_type\n end",
"def getDatabaseType\n return ActiveRecord::Base.connection.adapter_name\n end",
"def simpledb_type\n model.storage_name(DataMapper.repository.name)\n end",
"def database_type\n :fdbsql\n end",
"def instance_class\n @dbi.db_instance_class\n end",
"def instance_class\n @dbi.db_instance_class\n end",
"def supports?(dbtype)\n (:ctan.eql? dbtype.to_sym)\n end",
"def cstype(generic_type)\n CS_TYPES[generic_type] || camelcasetype(generic_type)\nend",
"def column_type\r\n @type\r\n end",
"def sql_type\n self['sql_type']\n end",
"def current_type\n @type\n end",
"def builtin_inheritance_column # :nodoc:\n # Can this be made less brittle?\n if self == ActiveRecord::Base\n 'type'\n else\n (@builtin_inheritance_column ||= nil) || superclass.builtin_inheritance_column\n end\n end",
"def scaffold_table_column_type(c)\n column = self.properties[c]\n if column then\n if column.type == DataMapper::Property::Text\n :text\n else\n column.class.to_s.split(\"::\").last.downcase.intern\n end\n else\n nil\n end\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\Atinyint/\n Sequel.convert_tinyint_to_bool ? :boolean : :integer\n when /\\A(int(eger)?|bigint|smallint)/\n :integer\n when /\\A(character( varying)?|varchar|text)/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when \"boolean\"\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric(\\(\\d+,\\d+\\))?|decimal|money)\\z/\n :decimal\n when \"bytea\"\n :blob\n end\n end",
"def column_type\n object.class.scaffold_column_type(@method_name)\n end",
"def column_type\n class_name.columns_hash[@column.to_s].type\n end",
"def db_instance_class\n data.db_instance_class\n end",
"def type_from_database(attribute)\n col = @object.column_for_attribute(attribute)\n\n unless col.nil?\n col.type.to_s.downcase\n else\n nil\n end\n end",
"def schema_type_class(column)\n if (sch = db_schema[column]) && (type = sch[:type])\n db.schema_type_class(type)\n end\n end",
"def schema_type_class(column)\n if (sch = db_schema[column]) && (type = sch[:type])\n db.schema_type_class(type)\n end\n end",
"def column_type(column)\n (sch = model.db_schema[column]) && sch[:type]\n end",
"def simpledb_type(model)\n model.storage_name(model.repository.name)\n end",
"def content_type\n @record.send( :\"#{@column}_content_type\" ) rescue ''\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def fbe_type\n TYPE\n end",
"def type\n TYPES[self[:type_flags] & 0x3]\n end",
"def type\n\t\tself.class.type\n\tend",
"def type\n\t\tself.class.type\n\tend",
"def native_database_types\n {\n :primary_key => \"integer not null primary key\",\n :string => { :name => \"varchar\", :limit => 255 },\n :text => { :name => \"blob sub_type text\" },\n :integer => { :name => \"integer\" },\n :float => { :name => \"float\" },\n :decimal => { :name => \"decimal\" },\n :datetime => { :name => \"timestamp\" },\n :timestamp => { :name => \"timestamp\" },\n :time => { :name => \"time\" },\n :date => { :name => \"date\" },\n :binary => { :name => \"blob\" },\n :boolean => { :name => boolean_domain[:name] }\n }\n end",
"def model_type\n self.class.model_type\n end",
"def db_instance_class\n data[:db_instance_class]\n end",
"def java_type\n Jrodb::Model.type_map[self]\n end",
"def by_type(id)\n DB_TYPE[id]\n end",
"def database_type\n :sqlite\n end",
"def type\n self_class.to_s.to_sym\n end",
"def get_record_type_code\n @record_type_code\n end",
"def native_database_types #:nodoc:\r\n {\r\n :primary_key => 'AUTOINC PRIMARY KEY CONSTRAINT NOT NULL',\r\n :string => { :name => \"varchar\", :limit => 255 },\r\n :text => { :name => \"memo\" },\r\n :integer => { :name => \"integer\" },\r\n :float => { :name => \"float\" },\r\n :decimal => { :name => \"numeric\" },\r\n :datetime => { :name => \"timestamp\" },\r\n :timestamp => { :name => \"timestamp\" },\r\n :time => { :name => \"time\" },\r\n :date => { :name => \"date\" },\r\n :binary => { :name => \"blob\" },\r\n :boolean => { :name => \"logical\"}\r\n }\r\n end",
"def canonic_type\n t = type.to_s.downcase.to_sym\n CANONIC_TYPES[ t ] || t\n end",
"def type\n self.class.class_name.downcase\n end",
"def device_type\n return @device_type\n end",
"def data_type\n return @data_type\n end",
"def type\n self.class.to_s.downcase\n end",
"def database\n self.class_database || CouchRest::Model.default_database\n end",
"def _type\n self.class.to_s\n end",
"def character_set_name\n @dbi.character_set_name\n end",
"def character_set_name\n @dbi.character_set_name\n end",
"def database_column_type\n :string\n end",
"def type\n self.class::TYPE\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\A(int(eger)?|bigint|smallint)\\z/\n :integer\n when /\\A(character( varying)?|varchar|text)\\z/\n :string\n when /\\Adate\\z/\n :date\n when /\\A(datetime|timestamp( with(out)? time zone)?)\\z/\n :datetime\n when /\\Atime( with(out)? time zone)?\\z/\n :time\n when /\\A(boolean|tinyint)\\z/\n :boolean\n when /\\A(real|float|double( precision)?)\\z/\n :float\n when /\\A(numeric|decimal|money)\\z/\n :decimal\n end\n end",
"def get_type\n\n end",
"def get_operator_class()\n if(operator_for(:has_many) || operator_for(:belongs_to) || operator_for(:has_one)) \n begin \n Kernel.const_get(operator.classify)\n rescue; nil; end\n\n elsif(@col_type)\n begin\n Kernel.const_get(@col_type.type.to_s.classify)\n rescue; nil; end\n else\n nil\n end\n end",
"def field_type(key)\n IBM_DB.field_type(@stmt, key)\n end",
"def type\n self.class.name.downcase\n end",
"def caprese_type\n self.name.underscore\n end",
"def type\n Sequel::SQL::StringExpression.new(:NOOP, function(:type, self))\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def datatype\n @options[:datatype] || (@column ? @column.type : nil)\n end",
"def data_type\n\t\tend",
"def getContenttype\r\n\t\t\t\t\treturn @contenttype\r\n\t\t\t\tend",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def document_type\n instance.class.tire.document_type\n end",
"def model_type\n @model_type\n end",
"def determine_database\n self.class.database \n end",
"def database_type\n :as400\n end",
"def get_mode()\n end",
"def getCSharpType( type )\n\n entry = $typeTable.select{ |a| a.first == type }\n if( entry.empty? )\n return nil\n end\n return entry[0]\nend",
"def schema_enum_type(db_type)\n :enum\n end",
"def to_clr_type\n self.class.to_clr_type\n end",
"def type\n @@type\n end",
"def type\n @@type\n end",
"def fstype; end",
"def column_type(col)\n self.class.column_type(col)\n end",
"def get_type()\n res = super(context,self)\n return res\n end",
"def type()\n\t\t@db.hget('sgt-structure:' + @id, 'type')\n\tend",
"def class\n @cx.class\n end",
"def doctype\n return @doctype if instance_variable_defined?(:@doctype)\n return nil unless self =~ /\\A\\s*(?:<\\?.*?\\?>\\s*)?<!DOCTYPE\\s+(.+?)>/\n\n @doctype = Regexp.last_match[1]\n end",
"def ostype\n return @rye_ostype if @rye_ostype # simple cache\n os = self.quietly { uname.first } rescue nil\n os ||= 'unknown'\n os &&= os.downcase\n @rye_ostype = os\n end"
] |
[
"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.57325494",
"0.57222134",
"0.57139534",
"0.5713401",
"0.564751",
"0.564751",
"0.5631367",
"0.5627825",
"0.5623457",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56233907",
"0.56224877",
"0.5621669",
"0.5621669",
"0.5618662",
"0.5602802",
"0.55897945",
"0.55878896",
"0.5585745",
"0.5579056",
"0.5572284",
"0.5569478",
"0.5555636",
"0.554303",
"0.5521494",
"0.54981375",
"0.54959464",
"0.5489481",
"0.5485068",
"0.5478252",
"0.5474734",
"0.5474734",
"0.5469948",
"0.54692984",
"0.54594326",
"0.5456173",
"0.5438114",
"0.54322374",
"0.54298985",
"0.5408939",
"0.5401247",
"0.5396612",
"0.5396612",
"0.5395222",
"0.5381044",
"0.53760356",
"0.5371559",
"0.5371559",
"0.5371559",
"0.5369799",
"0.5366122",
"0.5362976",
"0.53551006",
"0.53528255",
"0.5342167",
"0.53419423",
"0.53353095",
"0.533443",
"0.533443",
"0.5334352",
"0.53333783",
"0.53255403",
"0.53172356",
"0.5310463",
"0.5310405",
"0.53091055"
] |
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_path', 'SCHEMA')\n end",
"def get_search_path\n @path = ActiveRecord::Base.connection.schema_search_path\n @path\n end",
"def schema_search_path\n 'dbo'\n end",
"def schema\n absolutize(@schema)\n end",
"def schema\n absolutize(@schema)\n end",
"def schema\n @schema.nil? ? root : root.join(@schema)\n end",
"def set_path_if_required(schema)\n return if @connection.schema_search_path == schema\n @connection.schema_search_path = schema\n end",
"def search_path\n @search_path ||= pathname.join(owner.respond_to?(:search_path) ? owner.search_path : '')\n end",
"def activate_default\n ActiveRecord::Base.connection.schema_search_path = self.initial_search_path\n end",
"def restore_default_search_path\n ActiveRecord::Base.connection.schema_search_path = default_search_path\n end",
"def set_search_path(name, include_public = true)\n path_parts = [name.to_s, (\"public\" if include_public)].compact\n ActiveRecord::Base.connection.schema_search_path = path_parts.join(\",\")\n end",
"def current_schema\n exec_query('SELECT current_schema', 'SCHEMA')[0][\"current_schema\"]\n end",
"def path\n @path ||=\n if user_configuration.has_key?('solr')\n \"#{user_configuration['solr']['path'] || '/solr'}\"\n end\n end",
"def schema_search_path=(schema_csv)\n end",
"def current_schema\n select_value('SELECT current_schema', 'SCHEMA')\n end",
"def search_path\n Options.custom_dir\n end",
"def path\r\n if Api.method_defined?(:proj_context_get_database_path)\r\n Api.proj_context_get_database_path(self.context)\r\n end\r\n end",
"def query_path\n @attributes[:query_path]\n end",
"def current_schema\n select_value('SELECT current_schema()', 'SCHEMA')\n end",
"def current_schema\n select_value(<<~SQL.squish, \"SCHEMA\")\n SELECT SYS_CONTEXT('userenv', 'current_schema') FROM dual\n SQL\n end",
"def db_path\n @db\n end",
"def schema_lookup(schema_name)\n s = nil\n @current_domain.schemas.each do |schema|\n s = schema if schema.name == schema_name\n end\n s\n end",
"def schema_search_path=(schema_csv)\n if schema_csv\n existing_schemas = execute(\"select nspname from pg_catalog.pg_namespace;\").values\n unless existing_schemas.map{|x| x[0]}.include?(schema_csv)\n execute(\"CREATE SCHEMA #{schema_csv}\")\n end\n execute(\"SET search_path TO #{schema_csv}\", 'SCHEMA')\n @schema_search_path = schema_csv\n end\n end",
"def db_treasures_found_path\r\n db_path(\"treasures\")\r\n end",
"def path\n unless defined?(@path)\n @path = solr_url.path if solr_url\n @path ||= user_configuration_from_key('solr', 'path')\n @path ||= default_path\n end\n @path\n end",
"def search_external_path\n Options.external_dir\n end",
"def __schema\n @relvar.namespace.schema\n end",
"def wfs_path\n url = Array.wrap(resource_decorator.wfs_url)\n return url.first if url.try(:first).present?\n return unless @config && visibility && file_set && vector_file_set?\n \"#{path}/#{@config[visibility][:workspace]}/wfs\"\n end",
"def solr_home\n File.join(configuration.solr_home)\n end",
"def solr_home\n File.join(configuration.solr_home)\n end",
"def solr_home\n File.join(FileUtils.pwd, 'solr')\n end",
"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 path\n s = lib.tcidbpath( @db )\n return File.expand_path( s ) if s\n end",
"def storage_path\n return Neo4j::Config.storage_path unless db.running?\n db.storage_path\n end",
"def path\n @path ||= best_qmake\n end",
"def schema_prefix\n ''\n end",
"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 execute \"SET search_path TO #{schema_csv}\"\n @schema_search_path = schema_csv\n end\n end",
"def sdbmss_search_action_path(options = {})\n opts = options.dup\n # prevent deprecation warnings from Rails\n [\"action\", \"controller\"].each do |key|\n if opts.has_key? key\n opts[key.to_s] = opts[key]\n opts.delete key\n end\n end\n main_app.root_path({ \"utf8\" => SDBMSS::Util::CHECKMARK, \"search_field\" => \"all_fields\" }.merge(opts))\n end",
"def schema\n return @schema\n end",
"def default_search_path\n @default_search_path ||= %{\"$user\", public}\n end",
"def suggest_handler_path\n @autocomplete_config[\"solr_endpoint\"]\n end",
"def current_schemas\n # Frozen hash or nil\n @hastur_schemas\n end",
"def activate(schema,verify_migration = false)\n base_path = self.initial_search_path\n self.create(schema) if verify_migration\n conn = ActiveRecord::Base.connection\n return false unless conn.schema_exists?(schema)\n conn.schema_search_path = [schema, base_path].compact.join(',')\n end",
"def fs_path\n @changeset.fs_path(@path)\n end",
"def schema_name\n unless @schema_name\n @schema_name = collect_first(&:schema_name)\n end\n return @schema_name\n end",
"def schema\n self.class.schema\n end",
"def path\n @options[:database_path]\n end",
"def path\n @options[:database_path]\n end",
"def get_schemas\n @schemas\n end",
"def schema_dump_path\n File.join ARTest::SQLServer.root_activerecord, \"test/assets/schema_dump_5_1.yml\"\n end",
"def storage_path\n return nil unless db.running?\n db.storage_path\n end",
"def path_space\n @path_space\n end",
"def wfs_path\n return unless @config && visibility && geo_file_set? && file_set_format?\n \"#{path}/#{@config[:workspace]}/wfs\"\n end",
"def path\n application? ? application_path : local_path\n end",
"def schema\n hyper_schema_link.schema\n end",
"def path\n @base\n end",
"def slapd_init_db_index\n slapd_init_db_path_matcher[1]\n end",
"def schema\n @schema ||= Schema::Scope.new(self)\n end",
"def schema\n @schema ||= metadata.ancestors('Schema').first\n end",
"def tfs_path\n case @path[0]\n when \"$\"\n @path\n when \"/\"\n \"$#{@path}\"\n else\n \"$/#{@path}\"\n end\n end",
"def query_path\n query_string = env.fetch('QUERY_STRING')\n return '' if query_string.empty?\n\n query_hash = Rack::Utils.parse_query(query_string)\n query_hash.each_pair.with_object(['/query']) { |(key, val), result|\n result << \"/#{key}-is-#{val}\"\n }.join()\n end",
"def default_search_directory\n Figgy.config[\"default_search_directory\"]\n end",
"def search_path; end",
"def search_path; end",
"def schema\n if @old_schema.nil?\n @old_schema = Schema.new(get(link('schema')))\n end\n return @old_schema \n end",
"def root_path\n environment.paths.detect { |path| pathname.to_s[path] }\n end",
"def absolute_db_path\n pn = Pathname.new(__FILE__)\n install_dir = pn.dirname.parent.parent.to_s + Pathname::SEPARATOR_LIST\n install_dir + @storage_location + @database_name\n end",
"def applications_path\n Pathname.new('apps')\n end",
"def ext_db_path; end",
"def ext_db_path; end",
"def schema\n self\n end",
"def solr_home\n @solr_home ||=\n if user_configuration_from_key('solr', 'solr_home')\n user_configuration_from_key('solr', 'solr_home')\n else\n File.join(::Rails.root, 'solr')\n end\n end",
"def abs_path(path, ctype=:document)\n node = @content_tree.lookup(path, ctype)\n node ? node.doc_path : nil\n end",
"def schema\n @schema ||= []\n end",
"def schema\n connection.schema\n end",
"def schema_name\n return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\\./\n return self.table_name_prefix.to_s.gsub(/\\./,'') if self.table_name_prefix && self.table_name_prefix =~ /\\./\n return self.connection.config[:database] if self.connection.mysql?\n end",
"def run(&block)\n original_path = @connection.schema_search_path\n set_path_if_required(@schema)\n yield\n ensure\n set_path_if_required(original_path)\n end",
"def schema(name)\n get(\"schemas/#{name}/\", \"schema\")\n end",
"def request_schema\n if @discovery_document['request']\n schema_name = @discovery_document['request']['$ref']\n return @api.schemas[schema_name]\n else\n return nil\n end\n end",
"def path\n @path ||= \n (@path_proc && @path_proc.call(self)) || \n default_path\n end",
"def schema(work_class_name:, context: nil)\n context ||= AllinsonFlex::Context.where(name: 'default')\n AllinsonFlex::DynamicSchema.where(\n allinson_flex_class: work_class_name,\n context: context\n ).order('created_at').last.schema\n rescue StandardError\n {}\n end",
"def logical_path\n @logical_path[/^([^.]+)/, 0]\n end",
"def which_has_schema(schema)\n if schema.key? '$ref'\n ref = schema\n schema = resolve_ref(schema['$ref'])\n end\n\n self.baw_model_schema = defined?(ref) ? ref : schema\n let(:model_schema) {\n schema\n }\n end",
"def path\n @path ||= if _unscoped.empty?\n Mongoid::Atomic::Paths::Embedded::Many.position_without_document(_base, _association)\n else\n _unscoped.first.atomic_path\n end\n end",
"def path(table)\n \"#{database}.#{table}\"\n end",
"def current\n\t\t\t\t\treturn Pathname.new(\".\")\n\t\t\t\tend",
"def defined_paths()\n return root_defined_path_part\n end",
"def get_property_schema_path(schema_path, resource)\n nested_props = resource.properties\n prop = nil\n path_tkns = schema_path.split('.0.').map do |pname|\n camel_pname = pname.camelize(:lower)\n prop = nested_props.find { |p| p.name == camel_pname }\n # if we couldn't find it, see if it was renamed at the top level\n prop = nested_props.find { |p| p.name == schema_path } if prop.nil?\n return nil if prop.nil?\n\n nested_props = prop.nested_properties || []\n prop.flatten_object ? nil : pname.underscore\n end\n if path_tkns.empty? || path_tkns[-1].nil?\n nil\n else\n path_tkns.compact.join('.0.')\n end\n end",
"def schema_name\n @schema_name ||= owner_type.eql?('Root') ? owner.tenant.schema_name : schema_name_from_access_key_id\n end",
"def get_schema_id()\n\t\tend",
"def out_path\n @out_path ||= File.join( base_path, 'json-schema')\n end",
"def find_path\n\n end",
"def base_path\n self.class.base_path\n end",
"def schema\n adapter.schema\n end",
"def lib_path\n File.join( solr_home, 'lib' )\n end",
"def schema\n @schema ||= (default_schema || ETL::Schema::Table.new)\n end",
"def path\n ensure_valid\n @path\n end"
] |
[
"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.5863648",
"0.584379",
"0.5729461",
"0.57151026",
"0.5703947",
"0.5702473",
"0.56910473",
"0.56484723",
"0.5632068",
"0.56100446",
"0.56100446",
"0.55985206",
"0.55722415",
"0.555897",
"0.5542597",
"0.5530552",
"0.55282265",
"0.5484781",
"0.5484781",
"0.5484054",
"0.54670936",
"0.5457971",
"0.54574966",
"0.5451218",
"0.54510283",
"0.5434936",
"0.5428776",
"0.54246753",
"0.5410613",
"0.5410613",
"0.5409161",
"0.5391137",
"0.53908235",
"0.5385691",
"0.5380544",
"0.53776",
"0.53582305",
"0.5349242",
"0.5346946",
"0.5339752",
"0.532769",
"0.5321355",
"0.53006303",
"0.52808815",
"0.52763045",
"0.52763045",
"0.5253696",
"0.52438784",
"0.52294165",
"0.52260447",
"0.52232903",
"0.52232903",
"0.5218193",
"0.52167326",
"0.52039534",
"0.5199396",
"0.5176941",
"0.5174868",
"0.517191",
"0.51716095",
"0.5163237",
"0.514437",
"0.5139463",
"0.51308984",
"0.5129501",
"0.5126162",
"0.5116064",
"0.51097673",
"0.51013947",
"0.5100211",
"0.5096067",
"0.5091923",
"0.5086668",
"0.5070131",
"0.5068509",
"0.5066346",
"0.50618184",
"0.50616837",
"0.5050805"
] |
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_catalog.pg_namespace;\").values\n unless existing_schemas.map{|x| x[0]}.include?(schema_csv)\n execute(\"CREATE SCHEMA #{schema_csv}\")\n end\n execute(\"SET search_path TO #{schema_csv}\", 'SCHEMA')\n @schema_search_path = schema_csv\n end\n end",
"def set_path_if_required(schema)\n return if @connection.schema_search_path == schema\n @connection.schema_search_path = schema\n end",
"def schema_search_path=(schema_csv)\n end",
"def schema(s)\n @config[:schema] = s\n end",
"def schema_search_path\n @schema_search_path ||= select_value('SHOW search_path', 'SCHEMA')\n end",
"def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end",
"def set_search_path(name, include_public = true)\n path_parts = [name.to_s, (\"public\" if include_public)].compact\n ActiveRecord::Base.connection.schema_search_path = path_parts.join(\",\")\n end",
"def schema_search_path\n @schema_search_path ||= select_value('SHOW search_path', 'SCHEMA')\n end",
"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 after_connect(search_path)\n Proc.new do |conn|\n search_path.split(',').map(&:strip).each do |schema|\n conn.execute(\"CREATE SCHEMA IF NOT EXISTS #{schema}\")\n end\n conn.execute(\"SET search_path TO #{search_path}\")\n end\n end",
"def schema_search_path\n 'dbo'\n end",
"def set_schema(schema)\n @current_schema = nil\n execute \"SET SCHEMA #{schema}\", 'SCHEMA'\n end",
"def search_path= search_path\n case search_path\n when String\n search_path = search_path.split(\",\").map{|s| s.strip}\n when Symbol\n search_path = [search_path]\n when Array\n # nil\n else\n raise Error, \"unrecognized value for search_path: #{search_path.inspect}\"\n end\n self << \"SET search_path = #{search_path.map{|s| \"\\\"#{s.to_s.gsub('\"', '\"\"')}\\\"\"}.join(',')}\"\n end",
"def schema\n absolutize(@schema)\n end",
"def schema\n absolutize(@schema)\n end",
"def schema=(value)\n @schema = value\n end",
"def set_schema( schema )\n @schema = schema if @schema == self\n schema\n end",
"def restore_default_search_path\n ActiveRecord::Base.connection.schema_search_path = default_search_path\n end",
"def quoted_schema\n Squirm.quote_ident schema\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def get_search_path\n @path = ActiveRecord::Base.connection.schema_search_path\n @path\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def scanSchemaFromString(schemaString)\n strm = Tempfile::new($0) ;\n strm << schemaString ;\n strm.close() ;\n scanSchema(strm.path) ;\n strm.open() ; strm.close(true) ;\n end",
"def quote_type_name(string, schema = nil)\n name_schema, table = string.to_s.scan(/[^\".\\s]+|\"[^\"]*\"/)\n if table.nil?\n table = name_schema\n name_schema = nil\n end\n\n schema = schema || name_schema || 'public'\n Name.new(schema, table).quoted\n end",
"def schema_prefix\n ''\n end",
"def schema\n @schema.nil? ? root : root.join(@schema)\n end",
"def run(&block)\n original_path = @connection.schema_search_path\n set_path_if_required(@schema)\n yield\n ensure\n set_path_if_required(original_path)\n end",
"def schema_name=schema_name\n self.table_name_prefix = \"#{schema_name}.\" if schema_name && !schema_name.blank?\n self.table_name = \"#{self.table_name_prefix}#{self.table_name}\" unless self.abstract_class?\n end",
"def schema_name_for(statement_name)\n unless statement_name =~ STATEMENT_NAME_REGEXP\n raise ArgumentError, \"statement '#{statement_name}' name must match #{STATEMENT_NAME_REGEXP.inspect}\"\n end\n const_name = statement_name.to_s\n if const_name == \"schema\"\n \"#{self.name}::Schema\"\n else\n \"#{self.name}::#{const_name.camelize}Schema\"\n end\n end",
"def create_search_schema(name, content)\n @data[:search_schemas][name] = {:name => name, :content => content}\n true\n end",
"def schema_params\n params.require(:schema).permit(:name, :root, :xsd)\n end",
"def schema(schema_name, stream)\n stream << \" create_schema \\\"#{schema_name}\\\"\\n\"\n end",
"def load_schemas!\n pattern = [@path, \"**\", \"*.avsc\"].join(\"/\")\n\n Dir.glob(pattern) do |schema_path|\n # Remove the path prefix.\n schema_path.sub!(/^\\/?#{@path}\\//, \"\")\n\n # Replace `/` with `.` and chop off the file extension.\n schema_name = File.basename(schema_path.tr(\"/\", \".\"), \".avsc\")\n\n # Load and cache the schema.\n find(schema_name)\n end\n end",
"def activate_default\n ActiveRecord::Base.connection.schema_search_path = self.initial_search_path\n end",
"def db_set_search_path(dbh, pid)\n dbh.execute(\"SET search_path = modencode_experiment_#{pid}_data\")\n end",
"def shared_schema_name\n Roomer.shared_schema_name ||= options[:shared_schema_name].to_s\n end",
"def schema_name\n unless @schema_name\n @schema_name = collect_first(&:schema_name)\n end\n return @schema_name\n end",
"def schema_params\n params.require(:schema).permit(:name)\n end",
"def camel_path\n @camel_path ||= original_path.gsub('schemas', 'schemas_camelized')\n end",
"def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n stream.puts \" # Custom schemas defined in this database.\"\n list.each { |name| stream.puts \" create_schema \\\"#{name}\\\", force: :cascade\" }\n stream.puts\n end",
"def schema(schema_name)\n state_depth_must_be(States::DOMAIN)\n s = schema_lookup(schema_name)\n if s.nil?\n n = Schema.new(@current_domain, schema_name)\n @current_domain.schemas << n\n @current_schema = n\n else\n @current_schema = s\n end\n clear_state_below(States::SCHEMA)\n end",
"def identifier(schema, name = nil)\n name ||= @name\n \"`#{schema}`.`#{name}`\"\n end",
"def schema_lookup(schema_name)\n s = nil\n @current_domain.schemas.each do |schema|\n s = schema if schema.name == schema_name\n end\n s\n end",
"def roomer_full_table_name_prefix(schema_name)\n \"#{schema_name.to_s}#{Roomer.schema_seperator}\"\n end",
"def schema(name)\n get(\"schemas/#{name}/\", \"schema\")\n end",
"def schema(path = nil)\n s = \"ActiveRecord::Schema.define do\\n\"\n s << \" create_table \\\"#{File.basename(@data.path, \".*\")}\\\" do |t|\\n\"\n columns.each do |column|\n s << \" t.column #{column.schema_definition}\"\n end\n s << \" end\\nend\"\n \n if path\n File.open(path, 'w') {|f| f.puts(s)}\n end\n \n s\n end",
"def set_schema\n s = Schema.find(params[:id]) if user_id = current_user\n if s.user_id == current_user.id\n schema = s\n else\n redirect_to schemas_url, notice: 'wrong url'\n end\n end",
"def create_schema schema_name\n execute \"CREATE SCHEMA #{quote_schema_name(schema_name)}\"\n end",
"def get_property_schema_path(schema_path, resource)\n nested_props = resource.properties\n prop = nil\n path_tkns = schema_path.split('.0.').map do |pname|\n camel_pname = pname.camelize(:lower)\n prop = nested_props.find { |p| p.name == camel_pname }\n # if we couldn't find it, see if it was renamed at the top level\n prop = nested_props.find { |p| p.name == schema_path } if prop.nil?\n return nil if prop.nil?\n\n nested_props = prop.nested_properties || []\n prop.flatten_object ? nil : pname.underscore\n end\n if path_tkns.empty? || path_tkns[-1].nil?\n nil\n else\n path_tkns.compact.join('.0.')\n end\n end",
"def schema_params\n params.require(:schema).permit(:user_id, :name, :initiator, :emotions, :thoughts, :behaviour, :my_schema, :h_thought, :r_worry, :o_reaction, :h_behaviour, :belief, :pros, :cons)\n end",
"def schema= new_schema\n frozen_check!\n @schema = new_schema\n end",
"def schema= new_schema\n frozen_check!\n @schema = new_schema\n end",
"def schema= new_schema\n frozen_check!\n @schema = new_schema\n end",
"def schema_name\n return self.table_name.split('.')[0] if self.table_name && self.table_name =~ /\\./\n return self.table_name_prefix.to_s.gsub(/\\./,'') if self.table_name_prefix && self.table_name_prefix =~ /\\./\n return self.connection.config[:database] if self.connection.mysql?\n end",
"def components_schema_name(_doc, _path_component, _tag_name, _verb, schema_name)\n schema_name\n end",
"def push_schema(schema=nil)\n schema ||= jiak.bucket.schema\n jiak.client.set_schema(jiak.bucket.name,schema)\n end",
"def create_schema(schema)\n execute \"CREATE SCHEMA #{schema}\", 'Create Schema'\n end",
"def with_chronomodel_schema_search_path\n patch_configuration!\n\n yield\n ensure\n reset_configuration!\n end",
"def set_schema_table\n @schema_table = SchemaTable.find(params[:id])\n end",
"def which_has_schema(schema)\n if schema.key? '$ref'\n ref = schema\n schema = resolve_ref(schema['$ref'])\n end\n\n self.baw_model_schema = defined?(ref) ? ref : schema\n let(:model_schema) {\n schema\n }\n end",
"def default_schema=(default_schema) # :nodoc:\n raise \"changing DEFAULT_SCHEMA only supported on SQLServer 2005+\" if sqlserver_2000?\n execute(\"ALTER #{current_user} WITH DEFAULT_SCHEMA=#{default_schema}\")\n @default_schema = nil if defined?(@default_schema)\n end",
"def set_pg_search_path(dump_file)\n `sed -e \"s/SELECT pg_catalog.set_config('search_path', '', false)/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true)/\" #{dump_file} > #{dump_file}.tmp`\n `mv -- #{dump_file}.tmp #{dump_file}`\n end",
"def schema=(value)\n json = value.is_a?(String) ? ActiveRecord::Coders::JSON.load(value.strip) : value\n super(json)\n rescue JSON::ParserError\n errors.add(:schema, :invalid_json)\n end",
"def filter_schema(ds, opts)\n expr = if schema = opts[:schema]\n schema.to_s\n else\n Sequel.function(:any, Sequel.function(:current_schemas, false))\n end\n ds.where{{pg_namespace[:nspname]=>expr}}\n end",
"def schema_name\n @schema_name ||= owner_type.eql?('Root') ? owner.tenant.schema_name : schema_name_from_access_key_id\n end",
"def scaffold_auto_complete_name_sql\n scaffold_auto_complete_options[:sql_name]\n end",
"def schema_and_table_name\n if qualified_table_name.include? '.'\n schema_name, table_name = qualified_table_name.split('.', 2)\n else\n table_name = qualified_table_name\n schema_name = self.class.default_schema_name\n end\n [schema_name, table_name]\n end",
"def sanitize_path_string(str)\n quoted_name = VIM::escape_for_single_quotes(str)\n ::VIM::evaluate(\"fnameescape('#{quoted_name}')\")\n end",
"def configure_connection\n if @config[:encoding]\n @connection.set_client_encoding(@config[:encoding])\n end\n # self.client_min_messages = @config[:min_messages] || 'warning'\n self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings so we don't have to do the E'...' dance.\n # set_standard_conforming_strings\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n # (SET TIME ZONE does not use an equals sign like other SET variables)\n # if ActiveRecord::Base.default_timezone == :utc\n # execute(\"SET time zone 'UTC'\", 'SCHEMA')\n # elsif @local_tz\n # execute(\"SET time zone '#{@local_tz}'\", 'SCHEMA')\n # end\n\n # SET statements from :variables config hash\n # http://www.postgresql.org/docs/8.3/static/sql-set.html\n variables = @config[:variables] || {}\n variables.map do |k, v|\n if v == ':default' || v == :default\n # Sets the value to the global or compile default\n execute(\"SET SESSION #{k} TO DEFAULT\", 'SCHEMA')\n elsif !v.nil?\n execute(\"SET SESSION #{k} TO #{quote(v)}\", 'SCHEMA')\n end\n end\n end",
"def database_path=(val)\n @database_path = val.index(\"://\").nil? ? \"sqlite3://#{val}\" : val\n load_signatures\n end",
"def escape_wildcards(unescaped)\n case ActiveRecord::Base.connection.adapter_name\n when \"Mysql2\".freeze\n # Necessary for MySQL\n unescaped.to_s.gsub(/([\\\\%_])/, '\\\\\\\\\\\\1')\n when \"PostgreSQL\".freeze\n # Necessary for PostgreSQL\n unescaped.to_s.gsub(/([\\\\%_.])/, '\\\\\\\\\\\\1')\n else\n unescaped\n end\n end",
"def process(input_string)\n return nil unless input_string\n name, namespace =\n if File.exist?(input_string)\n copy_schema_to_store(input_string)\n elsif schema?(input_string)\n save_schema(input_string)\n else\n separate_fullname(input_string)\n end\n @schema_store.find(name, namespace)\n end",
"def quote_table_or_view(name, options)\n schema = options[:schema]\n if schema\n \"\\\"#{schema}\\\".\\\"#{name}\\\"\"\n else\n \"\\\"#{name}\\\"\"\n end\n end",
"def initialize(name, schema)\n @name = name\n @schema = schema\n end",
"def schema=(value); end",
"def double_quote(value)\n return if value.nil?\n\n case value.to_s\n # Ignore keys that contain double quotes or a Arel.star (*)[all columns]\n # or if a table has already been explicitly declared (ex: users.id)\n when \"*\", /((^\".+\"$)|(^[[:alpha:]]+\\.[[:alnum:]]+)|\\(.+\\))/\n value\n else\n PG::Connection.quote_ident(value.to_s)\n end\n end",
"def add_schema_url(source)\n schema = config.get(:schema)\n return source if source[:schema]\n source[:schema] = schema.dig(:urls, :default)\n source\n end",
"def extend_schema(schema, file = nil, &block)\n Rubyrel::DDL::extend_schema(schema, file, &block)\n end",
"def escape_wildcards(unescaped)\n case ActiveRecord::Base.connection.adapter_name\n when \"Mysql2\", \"PostgreSQL\"\n # Necessary for PostgreSQL and MySQL\n unescaped.to_s.gsub(/([\\\\|\\%|.])/, '\\\\\\\\\\\\1')\n else\n unescaped\n end\n end",
"def load_schemas!\n @schema_store.load_schemas!\n end",
"def create_schema(schema)\n ActiveRecord::Base.connection.execute(\"CREATE SCHEMA #{schema}\")\n end",
"def create_schema_sql(name, opts = {})\n \"CREATE SCHEMA #{quote_identifier(name)}\"\n end",
"def components_schema_name(_doc, _path_component, _tag_name, _verb, _http_status, schema_name)\n schema_name\n end",
"def create_schema_sql(name, opts = {})\n \"CREATE SCHEMA #{quote_identifier(name)}\"\n end",
"def read(schema_name, path_or_schema=nil)\n schema_name = schema_name.to_sym\n return registry[schema_name] if registry[schema_name]\n \n if path_or_schema.is_a?(::Hash)\n schema = Schema.new(path_or_schema) \n elsif path_or_schema.is_a?(::String) || path_or_schema.nil?\n path = path_or_schema\n file_path = File.join(path || SchemaTools.schema_path, \"#{schema_name}.json\")\n unless File.exist?(file_path)\n # check if file exists else try to find first real path in sub-dirs\n recursive_search = Dir.glob( File.join(SchemaTools.schema_path, '**/*', \"#{schema_name}.json\"))[0]\n # use only if we found something, else keep path which will throw error on file.open later\n file_path = recursive_search || file_path\n end\n schema = Schema.new(file_path)\n else\n raise ArgumentError, 'Second parameter must be a path or a schema!'\n end\n\n\n # only import object definitions, shared property definitions are handled separate\n return unless schema[:type] == 'object'\n registry[ schema_name ] = schema\n return schema\n end",
"def activate(schema,verify_migration = false)\n base_path = self.initial_search_path\n self.create(schema) if verify_migration\n conn = ActiveRecord::Base.connection\n return false unless conn.schema_exists?(schema)\n conn.schema_search_path = [schema, base_path].compact.join(',')\n end",
"def schema_params\n params.require(:schema).permit(:name, :database_type, :username, :password, :changelogfile, :changelogtable, :host, :port, :application_id, :environment_id)\n end",
"def scaffold_name_sql\n scaffold_auto_complete_options[:sql_name]\n end",
"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 self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings if available so we don't have to do the E'...' dance.\n set_standard_conforming_strings\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n if ActiveRecord::Base.default_timezone == :utc\n execute(\"SET time zone 'UTC'\")\n elsif @local_tz\n execute(\"SET time zone '#{@local_tz}'\")\n end\n end",
"def set_price_schema\n @price_schema = PriceSchema.find(params[:id])\n end",
"def set_puppetdb_path(connection=self.connection)\n set_url_prefix\n connection.url_prefix.path = '/pdb'\n connection.url_prefix.port = 8081\n end",
"def register_schema(schema_name:, subject: nil, namespace: nil)\n schema = @schema_store.find(schema_name, namespace)\n schema_id = @registry.register(subject || schema.fullname, schema)\n [schema, schema_id]\n end",
"def sql_wildcard\n \"%#{self}%\"\n end",
"def search_schemas(opts = {})\n data, _status_code, _headers = search_schemas_with_http_info(opts)\n data\n end",
"def chooseSchema\n @metadata.chooseSchema\n end"
] |
[
"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.537175",
"0.537175",
"0.5371275",
"0.5245544",
"0.52307105",
"0.52076656",
"0.5199738",
"0.5199464",
"0.5170301",
"0.51490754",
"0.5109228",
"0.50922734",
"0.5039838",
"0.5036648",
"0.50323564",
"0.50130373",
"0.498271",
"0.4982627",
"0.498213",
"0.49611333",
"0.4936884",
"0.49291247",
"0.49101213",
"0.4894985",
"0.4867025",
"0.48401973",
"0.48376396",
"0.47938573",
"0.47802478",
"0.47746593",
"0.47745037",
"0.47525254",
"0.47418413",
"0.4713806",
"0.4713806",
"0.4713806",
"0.47096997",
"0.46835774",
"0.46647012",
"0.4662226",
"0.46422917",
"0.4639214",
"0.463786",
"0.4623397",
"0.45864636",
"0.45730883",
"0.45599207",
"0.45515373",
"0.45360747",
"0.44735926",
"0.44626617",
"0.44610795",
"0.44529438",
"0.44511884",
"0.44430062",
"0.44345292",
"0.44259876",
"0.44179797",
"0.44124815",
"0.44119966",
"0.44116867",
"0.44094193",
"0.4405989",
"0.43899485",
"0.43892407",
"0.43825865",
"0.43806008",
"0.4374782",
"0.43721256",
"0.4364693",
"0.4350303",
"0.43496418",
"0.43474737",
"0.43471128",
"0.43342575",
"0.4314074",
"0.43101802",
"0.43068388"
] |
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 sql = \"select last_insert_id()\"\n id = @db.query(sql).fetch_row[0].to_i\n end\n return id\n end",
"def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n exec_insert(to_sql(arel), name, binds)\n retval = last_inserted_id(nil)\n retval = id_value if retval == 0\n return retval\n end",
"def last_inserted_id(result)\n if result.is_a? Fixnum\n result\n else\n result.first.first[1]\n end\n end",
"def insert\n DATABASE.execute(\"INSERT INTO students (name, age, github) VALUES (?, ?, ?)\", @name, @age, @github)\n @id = DATABASE.last_insert_row_id\n end",
"def insert\n DATABASE.execute(\"INSERT INTO locations (city) VALUES ('#{@city}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def last_inserted_id(result)\n @connection.gathered_data[:last_id]\n end",
"def _insert\n ds = _insert_dataset\n if _use_insert_select?(ds) && (h = _insert_select_raw(ds))\n _save_set_values(h)\n nil\n else\n iid = _insert_raw(ds)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = autoincrementing_primary_key) && pk.is_a?(Symbol) && !(vals = @values)[pk]\n vals[pk] = iid\n end\n pk\n end\n end",
"def _insert\n ds = _insert_dataset\n if _use_insert_select?(ds) && (h = _insert_select_raw(ds))\n _save_set_values(h)\n nil\n else\n iid = _insert_raw(ds)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = autoincrementing_primary_key) && pk.is_a?(Symbol) && !(vals = @values)[pk]\n vals[pk] = iid\n end\n pk\n end\n end",
"def save\n result = DB.exec(\"INSERT INTO books (name, author) VALUES ('#{@name}', '#{@author}') RETURNING id;\")\n @id = result.first().fetch(\"id\").to_i\nend",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n super\n\n exec_query('SELECT @@IDENTITY AS id')\n end",
"def insert_id\n @insert_id\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n\n DB[:conn].execute(sql)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def insert_product(product)\n db_connection do |conn|\n result = conn.exec(\"SELECT id FROM products WHERE product = $1\", [product[:product]])\n if result.to_a.empty?\n sql = \"INSERT INTO products (product) VALUES ($1) RETURNING id\"\n result = conn.exec(sql, [product[:product]])\n end\n result.first[\"id\"]\n end\nend",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) #:nodoc:\r\n execute(sql, name)\r\n identity = last_inserted_id(nil)\r\n retval = id_value if retval == 0\r\n return retval\r\n end",
"def insert()\n query = \"INSERT INTO artists (art_name, art_photo) VALUES ($1, $2) RETURNING art_id\"\n @art_id = DbHelper.run_sql_return_first_row_column_value(query, [@art_name, @art_photo], 'art_id').to_i;\n end",
"def insert\n DATABASE.execute(\"INSERT INTO locations (location_name) \n VALUES ('#{@location_name}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n \n DB[:conn].execute(sql)\n \n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save()\n sql = \"INSERT INTO albums (artist_name, album_title, genre) VALUES ($1, $2, $3) RETURNING id;\"\n values = [@artist_name, @album_title, @genre]\n result = SqlRunner.run(sql, values)\n @id = result[0]['id'].to_i\nend",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def save\n sql = <<-SQL\n INSERT INTO #{table_name_for_insert} (#{col_names_for_insert})\n VALUES (#{values_for_insert})\n SQL\n\n DB[:conn].execute(sql)\n # need to assign .id here because does not have id when instantiated, but now has one via its database\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def insert_id\n rID = @ID\n\n @CallsList << [ 'insert_id', @ID ]\n @ID += 1\n\n return rID\n end",
"def last_insert_id\n @connection.sql(\"SELECT @@IDENTITY\")\n unless @connection.cmd_fail?\n id = @connection.top_row_result.rows.first.first\n if id\n id = id.to_i\n id = nil if id == 0\n end\n else\n id = nil\n end\n id\n end",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n execute(sql, name)\n id_value\n end",
"def save\n sql = \"INSERT INTO #{self.table_name_for_insert} (#{self.col_names_for_insert}) VALUES (#{self.values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{self.table_name_for_insert}\")[0][0]\n end",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n # Extract the table from the insert sql. Yuck.\n table = sql.split(\" \", 4)[2].gsub('\"', '')\n\n # Try an insert with 'returning id' if available (PG >= 8.2)\n if supports_insert_with_returning? && id_value.nil?\n pk, sequence_name = *pk_and_sequence_for(table) unless pk\n if pk\n sql = substitute_binds(sql, binds)\n id_value = select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n clear_query_cache #FIXME: Why now?\n return id_value\n end\n end\n\n # Otherwise, plain insert\n execute(sql, name, binds)\n\n # Don't need to look up id_value if we already have it.\n # (and can't in case of non-sequence PK)\n unless id_value\n # If neither pk nor sequence name is given, look them up.\n unless pk || sequence_name\n pk, sequence_name = *pk_and_sequence_for(table)\n end\n\n # If a pk is given, fallback to default sequence name.\n # Don't fetch last insert id for a table without a pk.\n if pk && sequence_name ||= default_sequence_name(table, pk)\n id_value = last_insert_id(table, sequence_name)\n end\n end\n id_value\n end",
"def save\n sql = <<-SQL\n INSERT INTO #{self.table_name_for_insert} (#{self.col_names_for_insert})\n VALUES (#{self.values_for_insert})\n SQL\n\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{self.table_name_for_insert}\")[0][0]\n end",
"def save()\n sql = \"INSERT INTO customers (name) VALUES ($1) RETURNING id\"\n values = [@name]\n @id = SqlRunner.run(sql, values)[0][\"id\"].to_i()\n end",
"def last_insert_id(conn, opts=OPTS)\n statement(conn) do |stmt|\n sql = opts[:prepared] ? 'SELECT @@IDENTITY' : 'SELECT SCOPE_IDENTITY()'\n rs = log_connection_yield(sql, conn){stmt.executeQuery(sql)}\n rs.next\n rs.getLong(1)\n end\n end",
"def last_insert_id(conn, opts=OPTS)\n statement(conn) do |stmt|\n sql = opts[:prepared] ? 'SELECT @@IDENTITY' : 'SELECT SCOPE_IDENTITY()'\n rs = log_connection_yield(sql, conn){stmt.executeQuery(sql)}\n rs.next\n rs.getLong(1)\n end\n end",
"def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end",
"def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end",
"def last_insert_id(conn, opts=OPTS)\n statement(conn) do |stmt|\n rs = stmt.executeQuery('SELECT last_insert_rowid()')\n rs.next\n rs.getLong(1)\n end\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n table = sql.split(\" \", 4)[2]\n super || last_insert_id(table, sequence_name || default_sequence_name(table, pk))\n end",
"def insert\n DATABASE.execute(\"INSERT INTO dogs (name, breed, age, serial_num, colour, description, temperament_id, owner_id) VALUES \n ('#{@name}', '#{@breed}', #{@age}, #{@serial_num}, '#{@colour}', '#{@description}', #{@temperament_id}, #{@owner_id})\")\n @id = DATABASE.last_insert_row_id\n end",
"def insert_pk\n (f = opts[:from]) && !f.empty? && (t = f.first)\n case t\n when Symbol, String, SQL::Identifier, SQL::QualifiedIdentifier\n if pk = db.primary_key(t)\n Sequel::SQL::Identifier.new(pk)\n end\n end\n end",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end",
"def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end",
"def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n sql, binds = sql_for_insert(to_sql(arel, binds), pk, id_value, sequence_name, binds)\n value = exec_insert(sql, name, binds)\n id_value\n end",
"def last_insert_row_id\n @database.insert_id\n end",
"def inserted_id\n inserted_ids.first\n end",
"def save\n # binding.pry\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n # binding.pry\n DB[:conn].execute(sql)\n # binding.pry\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n # binding.pry\n end",
"def insert_pk\n if (f = opts[:from]) && !f.empty?\n case t = f.first\n when Symbol, String, SQL::Identifier, SQL::QualifiedIdentifier\n if pk = db.primary_key(t)\n pk\n end\n end\n end\n end",
"def last_insert_id(conn, opts={})\n stmt = conn.createStatement\n begin\n sql = opts[:prepared] ? 'SELECT @@IDENTITY' : 'SELECT SCOPE_IDENTITY()'\n rs = log_yield(sql){stmt.executeQuery(sql)}\n rs.next\n rs.getInt(1)\n ensure\n stmt.close\n end\n end",
"def insert \n \n DATABASE.execute(\"INSERT INTO categories (genre) VALUES ('#{@genre}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def insert \n \n DATABASE.execute(\"INSERT INTO categories (genre) VALUES ('#{@genre}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil) end",
"def insert(*values)\n execute_dui(insert_sql(*values)){|c| return c.last_id}\n end",
"def insert\n DATABASE.execute(\"INSERT INTO terms (term, definition, phonetic) VALUES \n ('#{@term}', '#{@definition}', '#{@phonetic}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def save()\n sql = \"INSERT INTO transactions (merchant, amount, tag, tran_date) VALUES ('#{@merchant}', #{@amount}, '#{@tag}', '#{@tran_date}') RETURNING *;\"\n data = SqlRunner.run(sql)\n @id = data.first()['id'].to_i\n end",
"def save\n sql = \"\n INSERT INTO artists\n (name)\n values($1)\n RETURNING *\n \"\n values = [@name]\n result = SqlRunner.run(sql, values)\n @id = result[0][\"id\"].to_i\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n # Extract the table from the insert sql. Yuck.\n table = sql.split(\" \", 4)[2].gsub('\"', '')\n\n # Otherwise, insert then grab last_insert_id.\n if insert_id = super\n insert_id\n else\n # If neither pk nor sequence name is given, look them up.\n unless pk || sequence_name\n pk, sequence_name = *pk_and_sequence_for(table)\n end\n\n # If a pk is given, fallback to default sequence name.\n # Don't fetch last insert id for a table without a pk.\n if pk && sequence_name ||= default_sequence_name(table, pk)\n last_insert_id(table, sequence_name)\n end\n end\n end",
"def insert\n DATABASE.execute(\"INSERT INTO boards (title,description) VALUES ('#{@title}', '#{@description}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def insert \n DATABASE.execute(\"INSERT INTO contents (slide_order, title, body) \n VALUES (#{@slide_order}, '#{@title}', '#{@body}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def save()\n sql = \"INSERT INTO transactions (amount, merchant_id, tag_id)\n VALUES ($1, $2, $3)\n RETURNING id\"\n values = [@amount, @merchant_id, @tag_id]\n @id = SqlRunner.run(sql, values)[0]['id'].to_i\n end",
"def last_insert_id\n @connection.identity_val_local\n end",
"def insert()\n query = \"INSERT INTO sale_items (sli_qty, sli_unit_price, sli_alb_id, sli_slo_id)\n VALUES ($1, $2, $3, $4) RETURNING sli_id\"\n @sli_id = DbHelper.run_sql_return_first_row_column_value(query,\n [@sli_qty, @sli_unit_price, @sli_alb_id, @sli_slo_id],\n 'sli_id').to_i\n end",
"def last_insert_id(conn, opts={})\n nil\n end",
"def last_insert_id(conn, opts={})\n nil\n end",
"def reaktor_insert(row)\n insert_id = 0\n unless row.idstore.nil?\n Log.write_log($import_log, \"reaktor_insert: Table: #{row.table_name} args: #{row.idstore.args * ', '}\")\n else\n Log.write_log($import_log, \"reaktor_insert: Table: #{row.table_name} No IdStore object\")\n end\n query = \"INSERT INTO #{row.table_name} (#{row.get_column_name_string})\\n VALUES (#{(['?']*row.size).join(', ')})\"\n sth = $dbh_ms.prepare(query)\n begin\n sth.execute(*row.get_column_values)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not insert data. Message: #{$!}. query: \\\"#{get_query_string(sth)}\\\"\")\n raise\n exit\n end\n begin\n insert_id = $dbh_ms.func(:insert_id) unless row.idstore.nil?\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not get insert id. Message: #{$!}.\")\n raise\n exit\n end\n if insert_id > 0\n row.store_id(insert_id)\n Log.write_log($import_log, \"Insert id store to table: #{row.table_name} id_store parameters: (#{row.idstore.args * ', '}) id: #{insert_id}\")\n else\n unless row.idstore.nil?\n Log.write_log($import_log, \"No id stored for table: #{row.table_name} id_store parameters: (#{row.idstore.args * ', '})\")\n else\n Log.write_log($import_log, \"No id stored for table: #{row.table_name} No IdStore object\")\n end\n \n end\nend",
"def save()\n sql = \"INSERT INTO transactions (merchant, tag_id, value, datestore) VALUES ('#{@merchant}', #{@tag_id}, #{@value}, '#{@datestore}') RETURNING *;\"\n transaction = SqlRunner.run( sql ).first\n @id = transaction['id'].to_i\nend",
"def save()\n sql = \"INSERT INTO albums (title, genre, artist_id)\n VALUES ($1, $2, $3) RETURNING id\"\n values = [@title, @genre, @artist_id]\n results = SqlRunner.run(sql, values)\n @id = results[0]['id'].to_i()\n end",
"def sql_for_insert(sql, pk, id_value, sequence_name, binds)\n unless pk\n table_ref = extract_table_ref_from_insert_sql(sql)\n pk = primary_key(table_ref) if table_ref\n end\n\n sql = \"#{sql} RETURNING #{quote_column_name(pk)}\" if pk\n\n [sql, binds]\n end",
"def save()\n sql = \"INSERT INTO customers\n (name, funds) VALUES ($1, $2) RETURNING id\"\n values = [@name,@funds]\n customer = SqlRunner.run(sql,values).first\n @id = customer['id'].to_i\n end",
"def last_insert_id(table, sequence_name) #:nodoc:\n Integer(select_value(\"SELECT currval('#{sequence_name}')\"))\n end",
"def last_insert_id(table, sequence_name) #:nodoc:\n identity = select_value(\"SELECT scope_identity()\")\n if identity.class == System::DBNull\n nil\n else\n System::Convert.to_int32(identity)\n end\n end",
"def save\n sql = \"\n INSERT INTO albums\n (title, genre, artist_id)\n VALUES\n (\n $1, $2, $3\n )\n RETURNING *\n \"\n values = [@title, @genre, @artist_id]\n @id = SqlRunner.run(sql, values)[0][\"id\"].to_i\n end",
"def save\n sql = \"INSERT INTO cars(\n shop_id,\n make,\n model,\n style,\n price,\n image\n )\n VALUES ($1, $2, $3, $4, $5, $6)\n RETURNING id;\"\n values = [@shop_id, @make, @model, @style, @price, @image]\n @id = SqlRunner.run(sql,values)[0]['id'].to_i\n end",
"def save()\n sql = \"\n INSERT INTO players\n ( name, team )\n VALUES\n ( '#{@name}', '#{@team}' )\n RETURNING *;\n \"\n @id = SqlRunner.run( sql )[0]['id'].to_i()\n end",
"def insert_sales_dates(sale_date)\n db_connection do |conn|\n result = conn.exec_params(\"SELECT id FROM sales_dates WHERE sale_date = $1\", [sale_date[:sale_date]])\n if result.to_a.empty?\n result = conn.exec_params(\"INSERT INTO sales_dates (sale_date) VALUES ($1) RETURNING id\", [sale_date[:sale_date]])\n end\n result.first[\"id\"]\n end\nend",
"def save()\n sql = \"INSERT INTO tickets\n (customer_id, film_id, screening_film_time)\n VALUES\n ($1, $2, $3)\n RETURNING id\"\n values = [@customer_id, @film_id, @screening_film_time]\n @id = SqlRunner.run(sql, values).first['id'].to_i\n end",
"def save()\n sql = \"INSERT INTO films (title, price) VALUES ($1, $2) RETURNING id\"\n values = [@title, @price]\n film = SqlRunner.run(sql, values).first\n @id = film['id'].to_i\n end",
"def last_insert_id(klass)\n # return last insert id\n end",
"def last_insert_row_id\n SQLite::API.last_insert_row_id( @handle )\n end",
"def returning_id\n @sql_returning = ::MultiInsert::QueryBuilder.returning([:id])\n @returning_flat = true\n self\n end",
"def save\n # INSERT INTO songs (name, album) VALUES ?, ?\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n\n DB[:conn].execute(sql)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def execute_insert(sql, opts=OPTS)\n execute(sql, opts.merge(:meth=>:autoid))\n end",
"def last_insert_id(sequence_name)\n r = exec_query(\"SELECT currval('#{sequence_name}')\", 'SQL')\n Integer(r.rows.first.first)\n end",
"def generateAndInsertNewContent ()\n ## Generate a random string between 8 and 50 characters long\n content = \"\";\n (8 + rand(42)).times{content << (97 + rand(26)).chr}\n\n ## Insert a new row into contents table\n query = \"INSERT INTO contents (content) VALUES('#{content}') returning id\"\n ret = $conn.exec(query)\n\n ## Consider and return the new row id\n ret[0]['id']\nend",
"def save()\n sql = \"\n INSERT INTO heroes\n ( name, description )\n VALUES\n ( '#{@name}', '#{@description}' )\n RETURNING *;\n \"\n\n @id = SqlRunner.run( sql )[0]['id'].to_i()\n end",
"def save()\n sql = \"INSERT INTO tickets\n (\n film_id,\n customer_id\n )\n VALUES\n (\n $1, $2\n )\n RETURNING id\"\n values = [@film_id, @customer_id]\n ticket = SqlRunner.run(sql, values).first\n @id = ticket['id'].to_i\n end",
"def insert_in_database\n Fetch.new(insertion_query).array\n end",
"def insert_sql(sql, name = nil, pri_key = nil, id_value = nil, sequence_name = nil)\n unless pri_key\n table_ref = extract_table_ref_from_insert_sql(sql)\n pri_key = primary_key(table_ref) if table_ref\n end\n\n if pri_key\n select_value(\"#{sql} RETURNING #{quote_column_name(pri_key)}\")\n else\n super\n end\n end",
"def save\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?,?)\n SQL\n\n DB[:conn].execute(sql, self.name, self.grade)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\nend",
"def insert_user(con, email_address)\n result = con.exec \"SELECT MAX(id) FROM users\"\n p result.values\n id = result.values[0][0].to_i + 1\n con.exec \"INSERT INTO users VALUES(#{id},'#{email_address}', 0)\"\nend",
"def save\n sql = \"INSERT INTO cities(name, visit_status, number_of_visits, country_id) VALUES($1, $2, $3, $4) RETURNING id\"\n values = [@name, @visit_status, @number_of_visits, @country_id]\n @id = SqlRunner.run(sql, values)[0]['id'].to_i\n end",
"def execute_insert(sql, opts=OPTS)\n synchronize(opts[:server]) do |c|\n if sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts)\n else\n _execute(c, sql, opts)\n end\n _execute(c, \"SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1\", opts){|stmt| i = stmt.fetch_array.first.to_i; i}\n end\n rescue Connection::Error => e\n raise_error(e)\n end",
"def save\n result=self.class.collection.insert_one(_id:@id, number:@number, first_name:@first_name, \n last_name:@last_name, group:@group, secs:@secs, gender:@gender)\n @id=result.inserted_id.to_s #save string version to id\n end",
"def insert(*args)\n r = super\n if s = opts[:sequence]\n with_sql(\"SELECT #{literal(s)}.currval FROM dual\").single_value.to_i\n else\n r\n end\n end"
] |
[
"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.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.6766254",
"0.67579615",
"0.6750038",
"0.6749876",
"0.6702695",
"0.66865027",
"0.6683089",
"0.66705614",
"0.66322917",
"0.662924",
"0.662924",
"0.66003144",
"0.66003144",
"0.6582817",
"0.6570024",
"0.6569799",
"0.65686965",
"0.65645117",
"0.65645117",
"0.6543422",
"0.65319985",
"0.6523176",
"0.65227705",
"0.6501233",
"0.6492824",
"0.64926547",
"0.649203",
"0.64816976",
"0.64596057",
"0.6451408",
"0.6444051",
"0.64375985",
"0.6436712",
"0.64326507",
"0.64269406",
"0.6406926",
"0.6393912",
"0.6376809",
"0.6373857",
"0.6373857",
"0.6358303",
"0.6355821",
"0.63436157",
"0.6326084",
"0.6324138",
"0.6311565",
"0.6293976",
"0.6276274",
"0.62675744",
"0.62621015",
"0.62471855",
"0.6228541",
"0.6224763",
"0.620634",
"0.6205185",
"0.6190928",
"0.61827946",
"0.61693436",
"0.6159752",
"0.6156123",
"0.6152908",
"0.6151471",
"0.6087793",
"0.6083549",
"0.6081725",
"0.60490876",
"0.6047398",
"0.6043941",
"0.60251886",
"0.60221416"
] |
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 = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n ''\n end\n end\n\n execute(\"CREATE DATABASE #{quote_table_name(name)}#{option_string}\")\n end",
"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 = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end",
"def create_database(name, options = {})\n options = { encoding: 'utf8' }.merge!(options.symbolize_keys)\n\n option_string = options.inject(\"\") do |memo, (key, value)|\n memo += case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end",
"def create_database(name, options = {})\n if options[:collation]\n execute \"CREATE DATABASE #{quote_table_name(name)} DEFAULT COLLATE #{quote_table_name(options[:collation])}\"\n elsif options[:charset]\n execute \"CREATE DATABASE #{quote_table_name(name)} DEFAULT CHARACTER SET #{quote_table_name(options[:charset])}\"\n elsif row_format_dynamic_by_default?\n execute \"CREATE DATABASE #{quote_table_name(name)} DEFAULT CHARACTER SET `utf8mb4`\"\n else\n raise \"Configure a supported :charset and ensure innodb_large_prefix is enabled to support indexes on varchar(255) string columns.\"\n end\n end",
"def db_create_postgresql(*args)\n\t\t\tcmd_db_disconnect()\n\n\t\t\tif(args[0] == nil or args[0] == \"-h\" or args[0] == \"--help\")\n\t\t\t\tprint_status(\" Usage: db_create <user:pass>@<host:port>/<database>\")\n\t\t\t\tprint_status(\"Examples:\")\n\t\t\t\tprint_status(\" db_create user@metasploit3\")\n\t\t\t\tprint_status(\" db_create user:pass@192.168.0.2/metasploit3\")\n\t\t\t\tprint_status(\" db_create user:pass@192.168.0.2:1500/metasploit3\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\treturn if ! db_find_tools(%W{psql dropdb createdb})\n\n\t\t\tinfo = db_parse_db_uri_postgresql(args[0])\n\t\t\topts = { 'adapter' => 'postgresql' }\n\t\t\targv = []\n\n\t\t\tif (info[:user])\n\t\t\t\topts['username'] = info[:user]\n\t\t\t\targv.push('-U')\n\t\t\t\targv.push(info[:user])\n\t\t\telse\n\t\t\t\topts['username'] = 'postgres'\n\t\t\t\targv.push('-U')\n\t\t\t\targv.push('postgres')\n\t\t\tend\n\n\t\t\tif (info[:pass])\n\t\t\t\tprint()\n\t\t\t\tprint_status(\"Warning: You will need to enter the password at the prompts below\")\n\t\t\t\tprint()\n\t\t\t\targv.push('-W')\n\t\t\tend\n\n\t\t\tif (info[:host])\n\t\t\t\topts['host'] = info[:host]\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\n\t\t\tif (info[:port])\n\t\t\t\topts['port'] = info[:port]\n\t\t\t\targv.push('-p')\n\t\t\t\targv.push(info[:port])\n\t\t\tend\n\n\t\t\topts['database'] = info[:name]\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\n\t\t\tsystem(\"dropdb #{cargs} #{info[:name]} >/dev/null 2>&1\")\n\t\t\tsystem(\"createdb #{cargs} #{info[:name]}\")\n\n\t\t\topts['password'] = info[:pass] || ''\n\n\t\t\t# Do a little legwork to find the real database socket\n\t\t\tif(! opts['host'])\n\t\t\t\twhile(true)\n\t\t\t\t\tdone = false\n\t\t\t\t\tdirs = %W{ /var/run/postgresql /tmp }\n\t\t\t\t\tdirs.each do |dir|\n\t\t\t\t\t\tif(::File.directory?(dir))\n\t\t\t\t\t\t\td = ::Dir.new(dir)\n\t\t\t\t\t\t\td.entries.grep(/^\\.s\\.PGSQL.(\\d+)$/).each do |ent|\n\t\t\t\t\t\t\t\topts['port'] = ent.split('.')[-1].to_i\n\t\t\t\t\t\t\t\topts['host'] = dir\n\t\t\t\t\t\t\t\tdone = true\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tbreak if done\n\t\t\t\t\tend\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Default to loopback\n\t\t\tif(! opts['host'])\n\t\t\t\topts['host'] = '127.0.0.1'\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Database creation complete (check for errors)\")\n\t\tend",
"def postgresql_database\n # FIXME work in progress\n #encoding = \"-E #{configuration[:postgresql][:encoding]}\" if configuration[:postgresql][:encoding]\n encoding = ''\n template = \"-T #{configuration[:postgresql][:template_database]}\" if configuration[:postgresql][:template_database]\n\n exec \"postgresql_database\",\n :command => \"/usr/bin/createdb -O #{database_environment[:username]} #{encoding} #{template} #{database_environment[:database]}\",\n :unless => \"/usr/bin/psql -l | grep #{database_environment[:database]}\",\n :user => 'postgres',\n :require => exec('postgresql_user'),\n :before => exec('rake tasks')#,\n # :notify => exec('rails_bootstrap') # TODO make this configurable to work with multi_server\n end",
"def create_database(name, _options = {})\n execute(\"CREATE SCHEMA `#{name}`\")\n end",
"def create_database(name, options = {})\n execute(\n \"CREATE SCHEMA #{quote_table_name(name)}\",\n SCHEMA_LOG_NAME\n )\n end",
"def create_db(options)\n info \"Created database '#{options[:name]}'\"\n end",
"def create_db(opts)\n\t\tbegin\n\t\t\tcase opts[\"adapter\"]\n\t\t\twhen 'sqlite3'\n\t\t\t\t# Sqlite just needs the file to be writable. ActiveRecord creates\n\t\t\t\t# it if it doesn't exist and checks permissions if it does. This\n\t\t\t\t# all happens during establish_connection(), so we don't need to\n\t\t\t\t# bother with creating anything here.\n\t\t\twhen 'postgresql','mysql'\n\t\t\t\tActiveRecord::Base.establish_connection(opts.merge('database' => nil))\n\t\t\t\tActiveRecord::Base.connection.create_database(opts['database'])\n\t\t\t\tActiveRecord::Base.remove_connection\n\t\t\tend\n\t\trescue ::Exception => e\n\t\t\tilog(\"Trying to continue despite failed database creation: #{e}\")\n\t\tend\n\tend",
"def create_database(name)\n end",
"def create_database\n say_with_task(\"Creating database...\", \"db:create\")\n end",
"def create_database_sql(name, opts = {})\n \"CREATE DATABASE #{quote_identifier(name)}\"\n end",
"def create_database(connection_string, db_name)\n create_sql = <<-SQL\n CREATE DATABASE #{db_name};\n SQL\n\n run \"#{connection_string} --execute=\\\"#{create_sql}\\\"\"\nend",
"def create_database\n if dockerized?\n puts \"Running inside of a docker container\"\n puts \"No systemd support, skipping mysql configuration\"\n return\n end\n\n Runner.activate_service(\"mysql\") if database_local?\n\n env_variables = {\n \"SKIP_MIGRATION\" => \"yes\",\n \"PORTUS_PASSWORD\" => @portus_password\n }\n puts \"Creating Portus' database\"\n Runner.bundler_exec(\"rake\", [\"db:create\"], env_variables)\n\n puts \"Running database migrations\"\n Runner.bundler_exec(\"rake\", [\"db:migrate\"], env_variables)\n\n puts \"Seeding database\"\n begin\n Runner.bundler_exec(\"rake\", [\"db:seed\"], env_variables)\n rescue\n puts \"Something went wrong while seedeing the database\"\n puts \"Are you sure the database is empty?\"\n puts \"Ignoring error\"\n end\n FileUtils.chown_R(\"wwwrun\", \"www\", \"/srv/Portus/tmp\")\n end",
"def create(master_established = false)\n establish_master_connection unless master_established\n extra_configs = { \"encoding\" => encoding }\n extra_configs[\"owner\"] = username if has_su?\n connection.create_database(configuration[\"database\"], configuration.merge(extra_configs))\n setup_gis\n rescue ::ActiveRecord::StatementInvalid => error\n if /database .* already exists/ === error.message\n raise ::ActiveRecord::Tasks::DatabaseAlreadyExists\n else\n raise\n end\n end",
"def create_database(db_name)\n ret = PureHailDB.ib_database_create(db_name)\n if ret != true\n check_return_code(PureHailDB::DbError[:DB_ERROR])\n end\n end",
"def create_database_yml\n print_title('Creating database configuration')\n\n @database = Database.create_config(self)\n logger.info(\"Database initialized #{@database}\")\n end",
"def create_database\n puts \"Creating database #{@db_name}...\"\n begin\n client = Mysql2::Client.new(:host => @db_host, :username => @db_user, :password => @db_pass)\n client.query(\"CREATE DATABASE #{@db_name}\")\n client.close\n rescue Exception => e\n puts \"An error occurred\\n #{e}\"\n end\n end",
"def db_create_sqlite3(*args)\n\t\t\tcmd_db_disconnect()\n\n\t\t\tif(args[0] and (args[0] == \"-h\" || args[0] == \"--help\"))\n\t\t\t\tprint_status(\"Usage: db_create [database-file-path]\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tinfo = db_parse_db_uri_sqlite3(args[0])\n\t\t\tdbfile = info[:path]\n\t\t\topts = { 'adapter' => 'sqlite3', 'database' => dbfile }\n\n\t\t\tif (::File.exists?(dbfile))\n\t\t\t\tprint_status(\"The specified database already exists, connecting\")\n\t\t\telse\n\t\t\t\tprint_status(\"Creating a new database instance...\")\n\t\t\t\trequire_library_or_gem('sqlite3')\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Successfully connected to the database\")\n\n\t\t\tprint_status(\"File: #{dbfile}\")\n\t\tend",
"def create_database\n options = { database: Orientdb::ORM.connection_uri.database, user: Orientdb::ORM.connection_uri.user, password: Orientdb::ORM.connection_uri.password, type: :graph, storage: :memory }\n Orientdb::ORM.with { |conn| conn.client.create_database( options ) }\nend",
"def create_database(name)\n @logger.unknown(\"ODBCAdapter#create_database>\") if @trace\n @logger.unknown(\"args=[#{name}]\") if @trace\n execute \"CREATE DATABASE #{name}\"\n rescue Exception => e\n @logger.unknown(\"exception=#{e}\") if @trace\n raise\n end",
"def create_database\n system \"createdb #{@base_name}\"\n system \"psql -d #{@base_name} -c 'CREATE EXTENSION postgis;'\"\n end",
"def create_database(name, charset)\n database = ::MySQL::Database.create(name, charset)\n !database.nil?\n end",
"def create_database(db_name)\n config = Rails.configuration.database_configuration[Rails.env]\n password = Shellwords.escape(config['password'])\n new_db = \"mysqldump -u#{config['username']} -p#{password} -h#{config['host']} #{config['database']} > /home/rails/current/tmp/backup.sql;\n mysqladmin -u#{config['username']} -p#{password} create #{db_name};\n mysql -u#{config['username']} -p#{password} -h#{config['host']} #{db_name} < /home/rails/current/tmp/backup.sql\"\n system new_db\n end",
"def create_physical_databases\n FileUtils.rm_rf File.expand_path('../fixtures/basics/test.db', __FILE__)\n FileUtils.rm_rf File.expand_path('../fixtures/basics/robust.db', __FILE__)\n require 'readline'\n puts \"#################################################################################\"\n puts \"ATTENTION: This task will create physical test databases on your computer\"\n puts \" A password will probably be asked as this task relies on 'sudo'.\"\n puts \" Please provide the root password\"\n puts \"#################################################################################\"\n Readline.readline(\"Press enter to start\")\n puts \"Creating the physical postgresql database ...\"\n puts `sudo su postgres -c 'dropdb dbagile_test'`\n puts `sudo su postgres -c 'dropuser dbagile'`\n puts `sudo su postgres -c 'createuser --no-superuser --no-createrole --createdb dbagile'`\n puts `sudo su postgres -c 'createdb --encoding=utf8 --owner=dbagile dbagile_test'`\n puts \n puts \"#################################################################################\"\n puts \"Done.\"\n puts \"Please run 'rake fixtures'\"\n puts \"#################################################################################\"\n true\n end",
"def setup_databases\n postgres_user = app_name\n postgres_pass = SecureRandom.urlsafe_base64\n postgres_port = find_open_port\n redis_port = find_open_port\n\n add_env \"REDIS_URL\",\n \"redis://localhost:#{redis_port}\"\n\n add_env \"DATABASE_URL\",\n \"postgres:///#{postgres_user}:#{postgres_pass}@localhost:#{postgres_port}\",\n skip_secrets: true\n\n template \"database.yml\",\n \"#{app_name}/config/database.yml\",\n force: true\n\n template \"docker-compose.yml\",\n \"#{app_name}/docker-compose.yml\",\n postgres_user: postgres_user,\n postgres_pass: postgres_pass,\n postgres_port: postgres_port,\n redis_port: redis_port\n end",
"def create_database!(name=nil)\n db = if name\n self.server.database!(db_name_with_prefix(name))\n else\n self.database!\n end\n create_rotation_filter(db)\n if self.respond_to?(:design_doc)\n design_doc.sync!(db)\n # or maybe this?:\n #self.design_docs.each do |design|\n # design.migrate(to_db)\n #end\n end\n return db\n end",
"def create_database # :nodoc:\n @db = HDB.new\n if !@db.open(@path, default_flags)\n raise CorpusError.new(\"Error creating the database: #{@db.errmsg(@db.ecode)}\")\n end\n end",
"def database! name\n create_db(name) rescue nil\n database name\n end",
"def create\n database.command({ :create => name }.merge(options))\n end",
"def setup_database\n require \"sequel\"\n\n options = {\n :max_connections => 16,\n :pool_timeout => 240\n }\n\n database_config = YAML.load_file(\"#{$intrigue_basedir}/config/database.yml\")\n database_host = database_config[$intrigue_environment][\"host\"] || \"localhost\"\n database_port = database_config[$intrigue_environment][\"port\"] || 5432\n database_user = database_config[$intrigue_environment][\"user\"]\n database_pass = database_config[$intrigue_environment][\"password\"]\n database_name = database_config[$intrigue_environment][\"database\"]\n database_debug = database_config[$intrigue_environment][\"debug\"]\n\n if database_pass \n $db = Sequel.connect(\"postgres://#{database_user}:#{database_pass}@#{database_host}:#{database_port}/#{database_name}\", options)\n else\n $db = Sequel.connect(\"postgres://#{database_user}@#{database_host}:#{database_port}/#{database_name}\", options)\n end\n\n $db.loggers << Logger.new($stdout) if database_debug\n\n # Allow datasets to be paginated\n $db.extension :pagination\n Sequel.extension :pg_json_ops\n Sequel.extension :migration\nend",
"def create_db(database)\n @conn.query({url_path: database, method: :put})\n end",
"def create_database_directory\n FileUtils.mkdir(database_directory)\n end",
"def db_create_mysql(*args)\n\n\t\t\tcmd_db_disconnect()\n\n\t\t\tif(args[0] == nil or args[0] == \"-h\" or args[0] == \"--help\")\n\t\t\t\tprint_status(\" Usage: db_create <user:pass>@<host:port>/<database>\")\n\t\t\t\tprint_status(\"Examples:\")\n\t\t\t\tprint_status(\" db_create user@metasploit3\")\n\t\t\t\tprint_status(\" db_create user:pass@192.168.0.2/metasploit3\")\n\t\t\t\tprint_status(\" db_create user:pass@192.168.0.2:1500/metasploit3\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\treturn if ! db_find_tools(%W{mysqladmin mysql})\n\n\t\t\tinfo = db_parse_db_uri_mysql(args[0])\n\t\t\topts = { 'adapter' => 'mysql' }\n\n\t\t\targv = []\n\n\t\t\tif (info[:user])\n\t\t\t\topts['username'] = info[:user]\n\t\t\t\targv.push('-u')\n\t\t\t\targv.push(info[:user])\n\t\t\tend\n\n\t\t\tif (info[:pass])\n\t\t\t\targv.push('--password=' + info[:pass])\n\t\t\t\topts['password'] = info[:pass]\n\t\t\tend\n\n\t\t\tif (info[:host])\n\t\t\t\topts['host'] = info[:host]\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\n\t\t\tif (info[:port])\n\t\t\t\topts['port'] = info[:port]\n\t\t\t\targv.push('-P')\n\t\t\t\targv.push(info[:port])\n\n\t\t\t\t# This is an ugly hack for a broken MySQL adapter:\n\t\t\t\t# \thttp://dev.rubyonrails.org/ticket/3338\n\t\t\t\tif (opts['host'].strip.downcase == 'localhost')\n\t\t\t\t\topts['host'] = Socket.gethostbyname(\"localhost\")[3].unpack(\"C*\").join(\".\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\targv.push('-f')\n\n\t\t\topts['database'] = info[:name]\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\n\t\t\tsystem(\"mysqladmin #{cargs} drop #{info[:name]} >/dev/null 2>&1\")\n\t\t\tsystem(\"mysqladmin #{cargs} create #{info[:name]}\")\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Database creation complete (check for errors)\")\n\t\tend",
"def create_mysql_database(schema=\"\")\n @mysql_database = true\n MysqlUtils.create_mysql_database(database_name, schema)\n end",
"def create_db_cmd!\n \"createdb -e #{new_db_name}\"\n end",
"def create_db name\n \n req = Net::HTTP::Put.new \"/#{name}\"\n ret = @http.request req\n \n puts \"Creating Database #{name} => #{ret.msg} (#{ret.code})\\n\"\n \n end",
"def db_connect_postgresql(*args)\n\t\t\tif(args[0] == nil or args[0] == \"-h\" or args[0] == \"--help\")\n\t\t\t\tprint_status(\" Usage: db_connect <user:pass>@<host:port>/<database>\")\n\t\t\t\tprint_status(\"Examples:\")\n\t\t\t\tprint_status(\" db_connect user@metasploit3\")\n\t\t\t\tprint_status(\" db_connect user:pass@192.168.0.2/metasploit3\")\n\t\t\t\tprint_status(\" db_connect user:pass@192.168.0.2:1500/metasploit3\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tinfo = db_parse_db_uri_postgresql(args[0])\n\t\t\topts = { 'adapter' => 'postgresql' }\n\n\t\t\topts['username'] = info[:user] if (info[:user])\n\t\t\topts['password'] = info[:pass] if (info[:pass])\n\t\t\topts['database'] = info[:name]\n\t\t\topts['host'] = info[:host] if (info[:host])\n\t\t\topts['port'] = info[:port] if (info[:port])\n\n\t\t\topts['pass'] ||= ''\n\n\t\t\t# Do a little legwork to find the real database socket\n\t\t\tif(! opts['host'])\n\t\t\t\twhile(true)\n\t\t\t\t\tdone = false\n\t\t\t\t\tdirs = %W{ /var/run/postgresql /tmp }\n\t\t\t\t\tdirs.each do |dir|\n\t\t\t\t\t\tif(::File.directory?(dir))\n\t\t\t\t\t\t\td = ::Dir.new(dir)\n\t\t\t\t\t\t\td.entries.grep(/^\\.s\\.PGSQL.(\\d+)$/).each do |ent|\n\t\t\t\t\t\t\t\topts['port'] = ent.split('.')[-1].to_i\n\t\t\t\t\t\t\t\topts['host'] = dir\n\t\t\t\t\t\t\t\tdone = true\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\tbreak if done\n\t\t\t\t\tend\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Default to loopback\n\t\t\tif(! opts['host'])\n\t\t\t\topts['host'] = '127.0.0.1'\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\t\tend",
"def create_initial_database\n db_class = RailsInstaller::Database.dbs[config['database']]\n in_directory(install_directory) do\n db_class.create(self)\n end\n end",
"def create_database(character_set_name, d_b_instance_id, d_b_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateDatabase'\n\t\targs[:query]['CharacterSetName'] = character_set_name\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:query]['DBName'] = d_b_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :d_b_description\n\t\t\targs[:query]['DBDescription'] = optional[:d_b_description]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def open\n create_database\n end",
"def create\n @database = Database.new(database_params)\n @database.name = @database.name.downcase\n @database.user = @user[\"uid\"]\n @database.password = SecureRandom.urlsafe_base64(16)\n result = true\n if @database.postgres?\n result = create_postgresql_db(@database.name, @database.password)\n end\n\n if @database.mysql?\n result = create_mysql_db(@database.name, @database.password)\n end\n\n if result then\n result = @database.save\n end\n\n respond_to do |format|\n if result\n format.html { redirect_to @database, notice: 'La base de données à bien été créée.' }\n format.json { render :show, status: :created, location: @database }\n else\n format.html { render :new }\n format.json { render json: @database.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grant_privileges(config)\n print \"Please provide the root password for your db installation\\n>\"\n postgres_password = $stdin.gets.strip\n\n create_db(config.merge('database' => config['database'], 'username' => 'postgres', 'password' => postgres_password))\n\n grant_statement = <<-SQL\nGRANT ALL ON DATABASE #{config['database']}\nTO \"#{config['username']}\" WITH GRANT OPTION;\nSQL\n\n ActiveRecord::Base.connection.execute grant_statement\n #ActiveRecord::Base.connection.drop_database config['database']\nend",
"def create_db(db_name)\n\n db = SQLite3::Database.new(db_name + \".db\")\n db.results_as_hash = true\n current_db_name = (db_name + \".db\")\n\n # Create Project Table\n create_project_table = <<-SQL\n CREATE TABLE IF NOT EXISTS projects(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n client VARCHAR(255)\n )\n SQL\n\n # Create Geologists Table\n create_geo_table = <<-SQL\n CREATE TABLE IF NOT EXISTS geologists(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n company VARCHAR(255)\n )\n SQL\n\n # Create Borehole Table\n create_borehole_table = <<-SQL\n CREATE TABLE IF NOT EXISTS boreholes(\n id INTEGER PRIMARY KEY,\n designation VARCHAR(255),\n northing REAL,\n easting REAL,\n elevation REAL,\n project_id INTEGER,\n FOREIGN KEY (project_id) REFERENCES projects(id)\n )\n SQL\n \n # Create Samples Table\n create_sample_table = <<-SQL\n CREATE TABLE IF NOT EXISTS samples(\n id INTEGER PRIMARY KEY,\n bh_id INTEGER, \n logger_id INTEGER,\n depth REAL,\n USCS VARCHAR(63),\n color VARCHAR(127),\n wetness VARCHAR(63),\n percent_gravel INTEGER,\n percent_sand INTEGER,\n percent_fines INTEGER,\n plasticity VARCHAR(63),\n toughness VARCHAR(63),\n other VARCHAR(255),\n FOREIGN KEY (bh_id) REFERENCES boreholes(id),\n FOREIGN KEY (logger_id) REFERENCES geologists(id)\n )\n SQL\n\n db.execute(create_project_table)\n db.execute(create_geo_table)\n db.execute(create_borehole_table)\n db.execute(create_sample_table)\n\n db\nend",
"def create_database_config_file(db = nil)\n fpath = db ? \"/multiple_dbs/#{db}_database.yml\" : \"/database.yml\"\n db ||= databases.first\n copy_file \"config_db.yml\", \"config#{fpath}\"\n\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"adapter\"] ? options.development[\"adapter\"] : @@default_db_config[\"adapter\"] } },\n before: \"#development_adapter\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"encoding\"] ? options.development[\"encoding\"] : @@default_db_config[\"encoding\"] } },\n before: \"#development_encoding\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"pool\"] ? options.development[\"pool\"] : @@default_db_config[\"pool\"] } },\n before: \"#development_pool\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{db}_development },\n before: \"#development_database\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"username\"] ? options.development[\"username\"] : @@default_db_config[\"username\"] } },\n before: \"#development_username\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.development[\"password\"] ? options.development[\"password\"] : @@default_db_config[\"password\"] } },\n before: \"#development_psw\", verbose: false, force: true\n\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"adapter\"] ? options.production[\"adapter\"] : @@default_db_config[\"adapter\"] } },\n before: \"#production_adapter\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"encoding\"] ? options.production[\"encoding\"] : @@default_db_config[\"encoding\"] } },\n before: \"#production_encoding\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"pool\"] ? options.production[\"pool\"] : @@default_db_config[\"pool\"] } },\n before: \"#production_pool\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{db}_production },\n before: \"#production_database\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"username\"] ? options.production[\"username\"] : @@default_db_config[\"username\"] } },\n before: \"#production_username\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.production[\"password\"] ? options.production[\"password\"] : @@default_db_config[\"password\"] } },\n before: \"#production_psw\", verbose: false, force: true\n\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"adapter\"] ? options.test[\"adapter\"] : @@default_db_config[\"adapter\"] } },\n before: \"#test_adapter\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"encoding\"] ? options.test[\"encoding\"] : @@default_db_config[\"encoding\"] } },\n before: \"#test_encoding\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"pool\"] ? options.test[\"pool\"] : @@default_db_config[\"pool\"] } },\n before: \"#test_pool\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{db}_test },\n before: \"#test_database\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"username\"] ? options.test[\"username\"] : @@default_db_config[\"username\"] } },\n before: \"#test_username\", verbose: false, force: true\n insert_into_file \"config#{fpath}\",\n %Q{#{options.test[\"password\"] ? options.test[\"password\"] : @@default_db_config[\"password\"] } },\n before: \"#test_psw\", verbose: false, force: true\n end",
"def find_or_create_db(filename)\n SQLite3::Database.new(filename)\n end",
"def pg\n uri = URI.parse( hpg_resolve(shift_argument, \"DATABASE_URL\").url )\n config = {\n 'name' => gen_datasource_name(\"PostgreSQL\"),\n 'type' => \"POSTGRESQL\",\n 'config' => {\n 'host' => uri.host,\n 'port' => uri.port || 5432,\n 'database' => uri.path[1..-1],\n 'username' => uri.user,\n 'password' => uri.password,\n 'use_ssl' => true,\n 'validate_ssl_cert' => false\n }\n }\n open_jackdb(config)\n end",
"def new_db(options = {})\n cached = find_cached(options)\n return cached if cached && !options[:force_new]\n @cache[options] = ConnectionMaker.new(options).connection\n end",
"def create(database_id:, name:)\n path = '/databases'\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n databaseId: database_id,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Database\n )\n end",
"def create!(db, colls = nil)\n db.in_transaction do |conn|\n raise StandardError.new(\"Schema #{name} already created!\") unless schema_tables(conn).empty?\n end\n\n osm2pgsql_exec db, \"'#{empty_file}'\", \"creating osm2pgsql schema\"\n end",
"def create_default_databases()\n # Create subfolder for databases if needed.\n dir = \"./databases\"\n Dir.mkdir(dir) unless Dir.exist?(dir)\n # TODO: sanity check: if db-file exist, create copy first, make sure the\n # name of the copy makes it highly unlikely to match an already existing\n # file, e.g. current epoch.\n # TODO: Create DBs\nend",
"def create_default_database_yml\n db_class = RailsInstaller::Database.dbs[config['database']]\n db_class.database_yml(self)\n end",
"def handle_database_creation\n database = Sequel.sqlite('./actions_db.db') # memory database, requires sqlite3\n database.create_table? :\"#{@username}_follows\" do\n primary_key :id\n String :user_id\n String :username\n Time :follow_time\n end\n database.create_table? :\"#{@username}_likes\" do\n primary_key :id\n String :media_id\n String :user_id\n String :shortcode\n Time :like_time\n end\n @table_follows = database[:\"#{@username}_follows\"]\n @table_likes = database[:\"#{@username}_likes\"]\n end",
"def create_database_if_missing\n result = PG.connect.exec \"select count(*) as db_exists from pg_database where datname = '#{db_name}'\"\n if result[0]['db_exists'] == '0'\n `createdb #{db_name}`\n `echo 'create extension postgis' | psql #{db_name}`\n @log.warn \"Created database #{db_name}.\"\n end\n end",
"def establish_connection(database_url_or_options = {}, options = {})\n\n case database_url_or_options\n when String\n uri = URI.parse(database_url_or_options)\n @table_name = options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: uri.host,\n port: uri.port,\n user: uri.user,\n password: uri.password,\n dbname: uri.path.tr(\"/\",\"\"),\n sslmode: \"prefer\",\n )\n else\n @table_name = database_url_or_options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: database_url_or_options[:host],\n port: database_url_or_options[:port],\n user: database_url_or_options[:username],\n password: database_url_or_options[:password],\n dbname: database_url_or_options[:database],\n sslmode: \"prefer\",\n )\n end\n\n end",
"def pg_configure\n files = %w[ pg_hba.conf pg_ident.conf postgresql.conf ]\n files += %w[ environment pg_ctl.conf ] if distro.is_a?( Debian )\n files = files.map { |f| File.join( 'postgresql', f ) }\n rput( *files, pg_config_dir, user: 'postgres' )\n end",
"def create_db(revision)\n Database.create(self, revision)\n end",
"def setup_database!\n mapper = Praxis::Application.instance.plugins[:praxis_mapper]\n Sequel.connect(mapper.config.repositories[\"default\"]['connection_settings'].dump) do |db|\n db.create_table! :people do\n primary_key :id\n string :name\n end\n end\nend",
"def database(opts = nil)\n if opts\n @database ||= Sequel.connect(opts)\n find_or_create_sequence_number\n end\n @database\n end",
"def create_new_rotated_database(options={})\n from = options[:from]\n to = options[:to]\n to_db = self.create_database!(to)\n if database_exists?(@rotation_base_name)\n base_db = self.server.database(db_name_with_prefix(@rotation_base_name))\n copy_design_docs(base_db, to_db)\n end\n if from && from != to && database_exists?(from)\n from_db = self.server.database(db_name_with_prefix(from))\n replicate_old_to_new(from_db, to_db)\n end\n end",
"def recreate_database(name, options = {})\n drop_database(name)\n create_database(name, options)\n end",
"def create_database\n $conn.exec(\"\"\"\n CREATE TABLE users (\n id SERIAL NOT NULL,\n name varchar(255) NOT NULL,\n created_at timestamp NOT NULL,\n PRIMARY KEY (id)\n );\n CREATE UNIQUE INDEX user_names ON users (name);\n CREATE TABLE blathers (\n id SERIAL NOT NULL,\n text varchar(141) NOT NULL,\n created_at timestamp NOT NULL,\n user_id integer NOT NULL,\n PRIMARY KEY (id)\n );\n CREATE TABLE blathers_mentioned_users (\n blather_id integer NOT NULL,\n user_id integer NOT NULL,\n PRIMARY KEY (blather_id, user_id)\n );\n \"\"\")\nend",
"def database\n \"--db='#{ name }'\"\n end",
"def establish_postgres_connection(name = 'default')\n if database_config[name]\n ActiveRecord::Base.establish_connection(database_config[name][env].merge('database' => 'postgres',\n 'schema_search_path' => 'public'))\n end\n end",
"def create_database_schema!\n \n if file_format.class.const_defined?('Database')\n @orm_module = file_format.class.const_get('Database')\n else\n @orm_module = file_format.class.const_set('Database', Module.new)\n end\n\n create_request_table_and_class\n create_warning_table_and_class\n \n file_format.line_definitions.each do |name, definition|\n create_database_table(name, definition)\n create_activerecord_class(name, definition)\n end\n end",
"def recreate_database(name, options = {})\n drop_database(name)\n sql = create_database(name, options)\n reconnect!\n sql\n end",
"def psql_db__sample_example *args\n db_name=\"any_db\"\n db_user=\"any_user\"\n db_host=\"localhost\"\n db_password=\"onlyNSAknows\"\n db_port = nil\n db_connection = nil\n\n [\n db_name,\n db_user,\n db_password,\n db_host,\n db_port,\n db_connection,\n ]\n end",
"def database(args={})\n args[:connection_name] = @connection_name unless args.has_key?(:connection_name)\n req(:required => [:db_name],\n :args_object => args)\n data = {}\n dbh = Mysqladmin::Exec.new(:connection_name => args[:connection_name])\n dbh.use(args[:db_name])\n dbh.list_tables.each do |table_name|\n data[table_name] = table(:table_name => args[:table_name], :db_name => args[:db_name], :connection_name => args[:connection_name])\n end\n return data\n end",
"def database(name)\n Database.new(connection.db(name))\n end",
"def create_schema schema_name\n execute \"CREATE SCHEMA #{quote_schema_name(schema_name)}\"\n end",
"def database\n @database ||= Database.create # defaults to 'aqua' \n end",
"def initialize_database\n config = YAML::load(IO.read(Antfarm::Helpers.defaults_file))\n # Database setup based on adapter specified\n if config && config[ANTFARM_ENV] && config[ANTFARM_ENV].has_key?('adapter')\n if config[ANTFARM_ENV]['adapter'] == 'sqlite3'\n config[ANTFARM_ENV]['database'] = Antfarm::Helpers.db_file(ANTFARM_ENV)\n elsif config[ANTFARM_ENV]['adapter'] == 'postgres'\n config[ANTFARM_ENV]['database'] = ANTFARM_ENV\n else\n # If adapter specified isn't one of sqlite3 or postgresql,\n # default to SQLite3 database configuration.\n config = nil\n end\n else\n # If the current environment configuration doesn't specify a\n # database adapter, default to SQLite3 database configuration.\n config = nil\n end\n # Default to SQLite3 database configuration\n config ||= { ANTFARM_ENV => { 'adapter' => 'sqlite3', 'database' => Antfarm::Helpers.db_file(ANTFARM_ENV) } }\n if config[ANTFARM_ENV]['adapter'] == 'postgres'\n DataMapper.setup(:default, \"postgres:///#{config[ANTFARM_ENV]['database']}\")\n else\n DataMapper.setup(:default, \"sqlite3://#{config[ANTFARM_ENV]['database']}\")\n end\n end",
"def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n username = options['username']\n\n # always reuse an existing connection if it matches on these connection options\n conn_options = {:host => host, :port => port, :database => database, :username => username}\n existing_connection = self.class.persisted_connection(conn_options)\n\n if existing_connection.nil?\n # create and persist a new connection\n @connection = PG::Connection.new(\n host,\n port,\n nil,\n nil,\n database,\n username,\n options['password'] || ''\n )\n @connection.set_notice_processor do |msg|\n if msg =~ /^ERROR:/\n LOG.error('psql') { msg.gsub(/\\n/,'; ') }\n else\n LOG.info('psql') { msg.gsub(/\\n/,'; ') }\n end\n end\n self.class.persist_connection(@connection, conn_options)\n else\n # reuse an existing connection\n @connection = existing_connection\n end\n\n # set up trackig if it isn't set up already\n set_up_tracking if !tracking_tables?\n end",
"def recreate_database(name, options = {}) #:nodoc:\n drop_database(name)\n create_database(name, options)\n end",
"def create_database_configuration_file\n FileUtils.cp(database_configuration_sample, database_configuration_file)\n end",
"def database\n \"--db='#{ name }'\" if name\n end",
"def database(name)\n Database.new(self, name)\n end",
"def to_create_database_sql(db)\n db.send(:create_database_sql, self.name, {})\n end",
"def create_schema(schema_name, pg_username = nil)\n if pg_username.nil? # AR 4.0 compatibility - accepts only single argument\n execute \"CREATE SCHEMA #{schema_name}\"\n else\n execute(\"CREATE SCHEMA \\\"#{schema_name}\\\" AUTHORIZATION \\\"#{pg_username}\\\"\")\n end\n end",
"def create(options = {})\n options[:name] ||= SecureRandom.hex\n\n create_options = { p: port }\n create_options[:c] = options[:name] if options[:name]\n create_options[:d] = options[:dir] if options[:dir]\n exec(\"create\", create_options)\n\n options[:name]\n end",
"def CreateNewDatabaseClicked\n unless getDBConn\n msgbox(_(\"Warning\"), _(\"Please open a database-profile first.\"), \"warning\")\n return false\n end\n\n type = getDBConn.getType\n if type != \"mysql\" && type != \"pgsql\"\n msgbox(_(\"Warning\"), sprintf(_(\"You cant create databases.new of af the current dbtype: %s.\"), type), \"warning\")\n return false\n end\n\n name = knj_input(_(\"New database name\"), _(\"Please enter the name of the database.new-type:\"))\n return false if name == false\n\n # Create and choose the database.new.\n begin\n getDBConn.dbs.createDB(\"name\" => name)\n db = getDBConn.dbs.getDB(name)\n getDBConn.dbs.chooseDB(db)\n dbpage.tablesUpdate\n rescue => e\n msgbox(_(\"Warning\"), e.getMessage, \"warning\")\n return false\n end\n end",
"def db(db_name, options={})\n DB.new(db_name, self, options.merge(:logger => @logger))\n end",
"def setup_storage\n ActiveRecord::Base.establish_connection(\n adapter: 'sqlite3',\n database: 'meshchat.sqlite3',\n pool: 128\n )\n\n create_database\n end",
"def configure_postgres\n<<BASH\necho \"deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main\" > /etc/apt/sources.list.d/pgdg.list\nwget --quiet https://www.postgresql.org/media/keys/ACCC4CF8.asc\napt-key add ACCC4CF8.asc\napt-get update\napt-get install postgresql-9.2 -y\necho \"host all all #{CS_VM_ADDRESS}/32 md5\" >> /etc/postgresql/9.2/main/pg_hba.conf\necho \"listen_addresses='*'\" >> /etc/postgresql/9.2/main/postgresql.conf\nservice postgresql restart\nexport PATH=/usr/lib/postgresql/9.2/bin:$PATH\nsudo -u postgres psql -c \"CREATE USER bofh SUPERUSER ENCRYPTED PASSWORD 'i1uvd3v0ps';\"\nBASH\nend",
"def connect_to_database(options)\n connection_hash = {:adapter => 'postgres',\n :database => options[:database_name],\n :user => options[:database_user],\n :password => options[:database_password],\n :test => true}\n\n if options[:database_host]\n connection_hash[:host] = options[:database_host]\n end\n\n @connection = Sequel.connect(connection_hash)\n end",
"def create_schema\n Apartment::Database.create(subdomain)\n end",
"def database_config\n TemplateWriter.process(\n \"database.yml.erb\",\n \"/srv/Portus/config/database.yml\",\n binding\n )\n FileUtils.chown(\"root\", \"www\", \"/srv/Portus/config/database.yml\")\n FileUtils.chmod(0o640, \"/srv/Portus/config/database.yml\")\n end",
"def database\n Database.initialize_with(connection)\n end",
"def db_destroy_postgresql(*args)\n\n\t\t\tcmd_db_disconnect()\n\n\t\t\treturn if ! db_find_tools(%W{dropdb})\n\n\t\t\tinfo = db_parse_db_uri_postgresql(args[0])\n\t\t\targv = []\n\n\t\t\tif (info[:user])\n\t\t\t\targv.push('-U')\n\t\t\t\targv.push(info[:user])\n\t\t\tend\n\n\t\t\tif (info[:pass])\n\t\t\t\tprint()\n\t\t\t\tprint_status(\"Warning: You will need to enter the password at the prompts below\")\n\t\t\t\tprint()\n\t\t\t\targv.push('-W')\n\t\t\tend\n\n\t\t\tif (info[:host])\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\n\t\t\tif (info[:port])\n\t\t\t\targv.push('-p')\n\t\t\t\targv.push(info[:port])\n\t\t\tend\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\t\t\tsystem(\"dropdb #{cargs} #{info[:name]}\")\n\t\tend",
"def setup_db\n return unless File.exist?(\"#{Jets.root}/config/database.yml\")\n\n db_configs = Jets.application.config.database\n # DatabaseTasks.database_configuration for db:create db:migrate tasks\n # Documented in DatabaseTasks that this is the right way to set it when\n # using ActiveRecord rake tasks outside of Rails.\n ActiveRecord::Tasks::DatabaseTasks.database_configuration = db_configs\n\n current_config = db_configs[Jets.env]\n if current_config.blank?\n abort(\"ERROR: config/database.yml exists but no environment section configured for #{Jets.env}\")\n end\n # Using ActiveRecord rake tasks outside of Rails, so we need to set up the\n # db connection ourselves\n ActiveRecord::Base.establish_connection(current_config)\n end",
"def establish_master_connection\n establish_connection(configuration.merge(\n \"database\" => \"postgres\",\n \"password\" => su_password,\n \"schema_search_path\" => \"public\",\n \"username\" => su_username\n ))\n end",
"def initialize_database\n @db = SQLite3::Database.new @database_path\n File.chmod 0600, @database_path\n begin\n @db.execute 'drop table if exists host;'\n @db.execute <<-SQL\n create table host (\n id INT,\n name varchar(254)\n );\n SQL\n sync_host_table\n rescue\n File.unlink @database_path\n raise\n end\n end",
"def psql_db_command__program psql_program, psql_db\n shell_params_psql_db = quoted_shell_params psql_db\n db_name,\n db_user,\n db_password,\n db_host,\n reserved = shell_params_psql_db\n\n psql_command = \"PGPASSWORD=#{db_password} #{psql_program} -h #{db_host} -U #{db_user} #{db_name} \"\n end",
"def create_connection()\n\t\tconnection_properties = java.util.Properties.new\n\t\t@settings.each do |k,v|\n\t\t\tconnection_properties[k] = v\n\t\tend\n\t\treturn java.sql.DriverManager.getConnection(\"jdbc:sqlite:#{@file}\",connection_properties)\n\tend",
"def create\n\n if File.exists?(dbfilename)\n puts \"Moved '#{dbfilename}' to '#{dbfilename}.bak'.\"\n FileUtils.mv(dbfilename, dbfilename + '.bak')\n end\n db = Sequel.sqlite(dbfilename)\n db.create_table :pdfmd_documents do\n String :md5sum, :primary_key => true\n String :filename\n String :author\n String :title\n String :subject\n Date :createdate\n String :keywords\n String :filepath\n end\n db.add_index :pdfmd_documents, :md5sum\n db.add_index :pdfmd_documents, :keywords\n end",
"def setup_for_postgres\n ActiveRecord::Base.establish_connection adapter: \"postgresql\", \n database: \"active_symbol_test\",\n :username=>:active_symbol_test, :password=>\"active_symbol_test\"\n setup_db\nend",
"def db\r\n @db ||= PG.connect(\r\n host: ENV['HOST'],\r\n user: ENV['USER_NAME'],\r\n password: ENV['PASSWORD'],\r\n dbname: ENV['DATABASE']\r\n )\r\nend",
"def create_db\n SQLite3::Database.new \"flatiron.db\"\nend",
"def setup_database_dockerfile\n return nil unless options[:database] == 'mysql'\n\n template 'mysql/Dockerfile.tt', 'docker/Dockerfile'\n end"
] |
[
"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.64459014",
"0.6437718",
"0.64226043",
"0.64005494",
"0.6274025",
"0.62268364",
"0.6215357",
"0.62090975",
"0.6133772",
"0.61170965",
"0.60962635",
"0.60563356",
"0.60504735",
"0.6028395",
"0.6017102",
"0.5998801",
"0.5904714",
"0.5855214",
"0.58523935",
"0.58180255",
"0.5792445",
"0.5758338",
"0.5757473",
"0.5749764",
"0.57106197",
"0.57062674",
"0.5694512",
"0.5693328",
"0.5691237",
"0.5686181",
"0.56815386",
"0.56792116",
"0.5666215",
"0.5658648",
"0.56327826",
"0.5626403",
"0.55697054",
"0.55687743",
"0.55673707",
"0.5567328",
"0.5562789",
"0.55613494",
"0.5559488",
"0.55503196",
"0.55462646",
"0.5542168",
"0.5519722",
"0.5510967",
"0.55084777",
"0.5502405",
"0.54917383",
"0.5479633",
"0.54697424",
"0.5460151",
"0.54536206",
"0.5437635",
"0.54257566",
"0.5425063",
"0.5422729",
"0.5422425",
"0.541502",
"0.5405078",
"0.5379651",
"0.53728443",
"0.53628117",
"0.53460705",
"0.53336775",
"0.5331395",
"0.53268385",
"0.53143096",
"0.52965856",
"0.52926785",
"0.5286286",
"0.5281824",
"0.5280214",
"0.526259",
"0.5261226",
"0.5256043",
"0.5251717"
] |
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}\", 'Create Schema'\n end",
"def create_schema_sql(name, opts = {})\n \"CREATE SCHEMA #{quote_identifier(name)}\"\n end",
"def create_schema_sql(name, opts = {})\n \"CREATE SCHEMA #{quote_identifier(name)}\"\n end",
"def create_schema(schema)\n ActiveRecord::Base.connection.execute(\"CREATE SCHEMA #{schema}\")\n end",
"def create_database(name, _options = {})\n execute(\"CREATE SCHEMA `#{name}`\")\n end",
"def create_schema(name, opts=OPTS)\n self << create_schema_sql(name, opts)\n end",
"def create_schema_sql(name, opts=OPTS)\n \"CREATE SCHEMA #{'IF NOT EXISTS ' if opts[:if_not_exists]}#{quote_identifier(name)}#{\" AUTHORIZATION #{literal(opts[:owner])}\" if opts[:owner]}\"\n end",
"def create_schema\n PgTools.create_schema id unless PgTools.schemas.include? id.to_s\n end",
"def schema(schema_name, stream)\n stream << \" create_schema \\\"#{schema_name}\\\"\\n\"\n end",
"def create_database(name, options = {})\n execute(\n \"CREATE SCHEMA #{quote_table_name(name)}\",\n SCHEMA_LOG_NAME\n )\n end",
"def schema(name)\n get(\"schemas/#{name}/\", \"schema\")\n end",
"def create(schema,and_migrate = true)\n conn = ActiveRecord::Base.connection\n conn.execute(\"CREATE SCHEMA #{schema}\") unless conn.schema_exists? schema\n self.migrate(schema) if and_migrate\n end",
"def schema(schema_name)\n state_depth_must_be(States::DOMAIN)\n s = schema_lookup(schema_name)\n if s.nil?\n n = Schema.new(@current_domain, schema_name)\n @current_domain.schemas << n\n @current_schema = n\n else\n @current_schema = s\n end\n clear_state_below(States::SCHEMA)\n end",
"def create_schema\n Apartment::Database.create(subdomain)\n end",
"def set_schema(name = nil, &block)\n set_dataset(db[name]) if name\n @schema = db.create_table_generator(&block)\n set_primary_key(@schema.primary_key_name) if @schema.primary_key_name\n end",
"def create_search_schema(name, content)\n @data[:search_schemas][name] = {:name => name, :content => content}\n true\n end",
"def initialize_schema!\n Schema.create(self)\n end",
"def by_schema( schema_name )\n self.class.new( definitions_by_schema( schema_name ) )\n end",
"def create_schema schema_id, type, definition, options = {}\n schema = Google::Cloud::PubSub::V1::Schema.new(\n type: type,\n definition: definition\n )\n schemas.create_schema parent: project_path(options),\n schema: schema,\n schema_id: schema_id\n end",
"def create\n @schema = Schema.new(schema_params)\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render :show, status: :created, location: @schema }\n else\n format.html { render :new }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schema = Schema.new(schema_params)\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render :show, status: :created, location: @schema }\n else\n format.html { render :new }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schema = Schema.new(params[:schema])\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, notice: 'Schema was successfully created.' }\n format.json { render json: @schema, status: :created, location: @schema }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schema = Schema.new(params[:schema])\n\n respond_to do |format|\n if @schema.save\n format.html { redirect_to @schema, :notice => 'Schema was successfully created.' }\n format.json { render :json => @schema, :status => :created, :location => @schema }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @schema.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create!(db, colls = nil)\n db.in_transaction do |conn|\n raise StandardError.new(\"Schema #{name} already created!\") unless schema_tables(conn).empty?\n end\n\n osm2pgsql_exec db, \"'#{empty_file}'\", \"creating osm2pgsql schema\"\n end",
"def initialize(name, schema)\n @name = name\n @schema = schema\n end",
"def create_schema(args={})\n args[:force] ||= false\n\n ActiveRecord::Schema.define do\n create_table :users, force: args[:force] do |t|\n t.string :jid, limit: 512, null: false\n t.string :name, limit: 256, null: true\n t.string :password, limit: 256, null: true\n t.text :vcard, null: true\n end\n add_index :users, :jid, unique: true\n\n create_table :contacts, force: args[:force] do |t|\n t.integer :user_id, null: false\n t.string :jid, limit: 512, null: false\n t.string :name, limit: 256, null: true\n t.string :ask, limit: 128, null: true\n t.string :subscription, limit: 128, null: false\n end\n add_index :contacts, [:user_id, :jid], unique: true\n\n create_table :groups, force: args[:force] do |t|\n t.string :name, limit: 256, null: false\n end\n add_index :groups, :name, unique: true\n\n create_table :contacts_groups, id: false, force: args[:force] do |t|\n t.integer :contact_id, null: false\n t.integer :group_id, null: false\n end\n add_index :contacts_groups, [:contact_id, :group_id], unique: true\n\n create_table :fragments, force: args[:force] do |t|\n t.integer :user_id, null: false\n t.string :root, limit: 256, null: false\n t.string :namespace, limit: 256, null: false\n t.text :xml, null: false\n end\n add_index :fragments, [:user_id, :root, :namespace], unique: true\n end\n end",
"def schema_name_for(statement_name)\n unless statement_name =~ STATEMENT_NAME_REGEXP\n raise ArgumentError, \"statement '#{statement_name}' name must match #{STATEMENT_NAME_REGEXP.inspect}\"\n end\n const_name = statement_name.to_s\n if const_name == \"schema\"\n \"#{self.name}::Schema\"\n else\n \"#{self.name}::#{const_name.camelize}Schema\"\n end\n end",
"def create_table(name, &block)\n g = Schema::Generator.new(self, &block)\n create_table_sql_list(name, *g.create_info).each {|sql| execute(sql)}\n end",
"def add_schema(export_type = nil)\n mig_text = schema_generator_script(db_migration_schema, 'create')\n write_db_migration mig_text, \"#{db_migration_schema}_schema\", export_type: export_type\n end",
"def create_database(name)\n end",
"def register(name)\n Schemas.register(name, self)\n end",
"def create_mysql_database(schema=\"\")\n @mysql_database = true\n MysqlUtils.create_mysql_database(database_name, schema)\n end",
"def schema(name, file=nil, &block)\n extend_schema(Schema.new(name), file, &block)\n end",
"def ensure_tenant_schema_exists\n logger.info \"Creating new schema '#{db_name}' ...\"\n if schema_exists?\n logger.info \"Schema '#{db_name}' already existed!\"\n else\n Apartment::Tenant.create(db_name)\n end\n rescue Apartment::SchemaExists => e\n logger.info \"#{e.class.name}: Schema '#{db_name}' already existed!\"\n end",
"def register_schema(schema_name:, subject: nil, namespace: nil)\n schema = @schema_store.find(schema_name, namespace)\n schema_id = @registry.register(subject || schema.fullname, schema)\n [schema, schema_id]\n end",
"def schema_name=schema_name\n self.table_name_prefix = \"#{schema_name}.\" if schema_name && !schema_name.blank?\n self.table_name = \"#{self.table_name_prefix}#{self.table_name}\" unless self.abstract_class?\n end",
"def schema_generator_script(schema_name, mode = 'create', owner: DefaultSchemaOwner)\n cname = \"#{mode}_#{schema_name}_schema_#{migration_version}\".camelize\n\n <<~CONTENT\n require 'active_record/migration/app_generator'\n class #{cname} < ActiveRecord::Migration[5.2]\n include ActiveRecord::Migration::AppGenerator\n\n def change\n self.schema = '#{schema_name}'\n self.owner = '#{owner}'\n create_schema\n end\n end\n CONTENT\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 create_database_schema!\n \n if file_format.class.const_defined?('Database')\n @orm_module = file_format.class.const_get('Database')\n else\n @orm_module = file_format.class.const_set('Database', Module.new)\n end\n\n create_request_table_and_class\n create_warning_table_and_class\n \n file_format.line_definitions.each do |name, definition|\n create_database_table(name, definition)\n create_activerecord_class(name, definition)\n end\n end",
"def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n stream.puts \" # Custom schemas defined in this database.\"\n list.each { |name| stream.puts \" create_schema \\\"#{name}\\\", force: :cascade\" }\n stream.puts\n end",
"def create\n @schema_table = SchemaTable.new(schema_table_params)\n\n respond_to do |format|\n if @schema_table.save\n format.html { redirect_to @schema_table, notice: 'Schema table was successfully created.' }\n format.json { render :show, status: :created, location: @schema_table }\n else\n format.html { render :new }\n format.json { render json: @schema_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n ''\n end\n end\n\n execute(\"CREATE DATABASE #{quote_table_name(name)}#{option_string}\")\n end",
"def drop_schema(schema_name)\n execute(\"DROP SCHEMA \\\"#{schema_name}\\\"\")\n end",
"def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end",
"def register_schema(schema)\n s = Java::org.apache.avro.Schema.parse(schema)\n @client.register(s.getName, s)\n end",
"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 = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def drop_schema schema_name\n execute \"DROP SCHEMA #{schema_name} CASCADE\"\n end",
"def create_database(name, options = {})\n options = { :encoding => 'utf8' }.merge!(options.symbolize_keys)\n\n option_string = options.sum do |key, value|\n case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n when :template\n \" TEMPLATE = \\\"#{value}\\\"\"\n when :encoding\n \" ENCODING = '#{value}'\"\n when :collation\n \" LC_COLLATE = '#{value}'\"\n when :ctype\n \" LC_CTYPE = '#{value}'\"\n when :tablespace\n \" TABLESPACE = \\\"#{value}\\\"\"\n when :connection_limit\n \" CONNECTION LIMIT = #{value}\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end",
"def apply_schema(name, type, options={})\n raise NotImplementedError\n end",
"def set_schema\n @schema = Schema.find(params[:id])\n end",
"def create_database(name, options = {})\n options = { encoding: 'utf8' }.merge!(options.symbolize_keys)\n\n option_string = options.inject(\"\") do |memo, (key, value)|\n memo += case key\n when :owner\n \" OWNER = \\\"#{value}\\\"\"\n else\n \"\"\n end\n end\n\n execute \"CREATE DATABASE #{quote_table_name(name)}#{option_string}\"\n end",
"def create_table(name)\n if ! db.tables.include?(name.to_sym)\n db.create_table name do\n String :name, :size => 15\n Float :freq\n index :freq\n end\n end\n end",
"def schema(s)\n @config[:schema] = s\n end",
"def schema_params\n params.require(:schema).permit(:name)\n end",
"def read(schema_name, path_or_schema=nil)\n schema_name = schema_name.to_sym\n return registry[schema_name] if registry[schema_name]\n \n if path_or_schema.is_a?(::Hash)\n schema = Schema.new(path_or_schema) \n elsif path_or_schema.is_a?(::String) || path_or_schema.nil?\n path = path_or_schema\n file_path = File.join(path || SchemaTools.schema_path, \"#{schema_name}.json\")\n unless File.exist?(file_path)\n # check if file exists else try to find first real path in sub-dirs\n recursive_search = Dir.glob( File.join(SchemaTools.schema_path, '**/*', \"#{schema_name}.json\"))[0]\n # use only if we found something, else keep path which will throw error on file.open later\n file_path = recursive_search || file_path\n end\n schema = Schema.new(file_path)\n else\n raise ArgumentError, 'Second parameter must be a path or a schema!'\n end\n\n\n # only import object definitions, shared property definitions are handled separate\n return unless schema[:type] == 'object'\n registry[ schema_name ] = schema\n return schema\n end",
"def schema\n schema = Schema.new\n\n for name in db.tables\n next if IGNORED_TABLES.include? name\n table = schema.add_table( name )\n import_table( table )\n end\n\n schema\n end",
"def create_db name\n \n req = Net::HTTP::Put.new \"/#{name}\"\n ret = @http.request req\n \n puts \"Creating Database #{name} => #{ret.msg} (#{ret.code})\\n\"\n \n end",
"def schema_for(collection_name)\n params = Params.new.limit(1).filter('name' => collection_name)\n schemas.list(params).first\n end",
"def schema(work_class_name:, context: nil)\n context ||= AllinsonFlex::Context.where(name: 'default')\n AllinsonFlex::DynamicSchema.where(\n allinson_flex_class: work_class_name,\n context: context\n ).order('created_at').last.schema\n rescue StandardError\n {}\n end",
"def schema_lookup(schema_name)\n s = nil\n @current_domain.schemas.each do |schema|\n s = schema if schema.name == schema_name\n end\n s\n end",
"def get_schema schema_name, view, options = {}\n schema_view = Google::Cloud::PubSub::V1::SchemaView.const_get view.to_s.upcase\n schemas.get_schema name: schema_path(schema_name, options),\n view: schema_view\n end",
"def schema(name_or_file)\n DbAgile::Core::Schema::yaml_file_load(schema_file(name_or_file))\n end",
"def create(database_id:, name:)\n path = '/databases'\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n databaseId: database_id,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::Database\n )\n end",
"def set_schema(schema)\n @current_schema = nil\n execute \"SET SCHEMA #{schema}\", 'SCHEMA'\n end",
"def create_table(name, &block)\n DB.drop_table? name if @opts.drop_tables?\n DB.create_table? name.to_sym, &block\n info \"Setup database table: #{name}\"\n end",
"def push_schema(schema=nil)\n schema ||= jiak.bucket.schema\n jiak.client.set_schema(jiak.bucket.name,schema)\n end",
"def schema(path = nil)\n s = \"ActiveRecord::Schema.define do\\n\"\n s << \" create_table \\\"#{File.basename(@data.path, \".*\")}\\\" do |t|\\n\"\n columns.each do |column|\n s << \" t.column #{column.schema_definition}\"\n end\n s << \" end\\nend\"\n \n if path\n File.open(path, 'w') {|f| f.puts(s)}\n end\n \n s\n end",
"def create_table_with_storing_name(table_name, options = {}, &block)\n @@table_name = table_name\n create_table_without_storing_name table_name, options, &block\n AirBlade::Migrations::SchemaDefinitions.foreign_keys = []\n end",
"def create_database!(name=nil)\n db = if name\n self.server.database!(db_name_with_prefix(name))\n else\n self.database!\n end\n create_rotation_filter(db)\n if self.respond_to?(:design_doc)\n design_doc.sync!(db)\n # or maybe this?:\n #self.design_docs.each do |design|\n # design.migrate(to_db)\n #end\n end\n return db\n end",
"def create_schema request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_schema_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def add_field_schema(name, type, schema)\n @field_names ||= [] ; @field_schemas ||= {}\n @field_names = @field_names | [name]\n schema = schema.symbolize_keys.merge({ :name => name })\n #\n # FIXME: this is terrible, especially given what's in TypeFactory anyway.\n #\n schema[:type] =\n case\n when type == Hash && schema.has_key?(:values) then Icss::Meta::TypeFactory.receive({ :type => :hash, :values => schema.delete(:values)})\n when type == Array && schema.has_key?(:items) then Icss::Meta::TypeFactory.receive({ :type => :array, :items => schema.delete(:items) })\n when type == Hash then IdenticalHashFactory\n when type == Array then IdenticalArrayFactory\n else\n Icss::Meta::TypeFactory.receive(type)\n end\n fld = (field_schemas[name] || make_field_schema).merge(schema)\n fld[:parent] = self\n @field_schemas[name] = fld\n end",
"def alter_sequence_schema(name, schema, options = {})\n execute(\"ALTER SEQUENCE #{quote_sequence(name)} SET SCHEMA #{quote_schema(schema)};\")\n end",
"def plugin_schema(name)\n get(\"/plugins/schema/#{name}\")\n end",
"def generate_classes(schema_name, namespace, key_config)\n schema_base = Deimos.schema_backend(schema: schema_name, namespace: namespace)\n schema_base.load_schema\n if key_config&.dig(:schema)\n key_schema_base = Deimos.schema_backend(schema: key_config[:schema], namespace: namespace)\n key_schema_base.load_schema\n generate_class_from_schema_base(key_schema_base, key_config: nil)\n end\n generate_class_from_schema_base(schema_base, key_config: key_config)\n end",
"def unload_schema(schema_name)\n end",
"def initialize( schema, name )\n @schema = schema\n @name = name\n @columns = {}\n @indexes = []\n @foreign_keys = []\n end",
"def create\n @price_schema = PriceSchema.new(price_schema_params)\n\n respond_to do |format|\n if @price_schema.save\n format.html { redirect_to @price_schema, notice: 'Price schema was successfully created.' }\n format.json { render action: 'show', status: :created, location: @price_schema }\n else\n format.html { render action: 'new' }\n format.json { render json: @price_schema.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createUserTable\n @Handle.execute( @UserSchema ) \n end",
"def xml_schema_type(type_name)\n new.tap do |vt|\n vt.base_type = type_name.to_sym\n end\n end",
"def create(name, table)\n Utils.model(name).new(table.hashes.first).tap do |document|\n document.save\n end\n end",
"def drop_schema_sql(name, opts=OPTS)\n \"DROP SCHEMA#{' IF EXISTS' if opts[:if_exists]} #{quote_identifier(name)}#{' CASCADE' if opts[:cascade]}\"\n end",
"def schema(table_name = nil, opts={})\n table_name = table_name.to_sym if table_name\n if opts[:reload] && @schemas\n if table_name\n @schemas.delete(table_name)\n else\n @schemas = nil\n end\n end\n\n if @schemas\n if table_name\n return @schemas[table_name] if @schemas[table_name]\n else\n return @schemas\n end\n end\n\n if table_name\n @schemas ||= {}\n if respond_to?(:schema_parse_table, true)\n @schemas[table_name] ||= schema_parse_table(table_name, opts)\n else\n raise Error, 'schema parsing is not implemented on this database'\n end\n else\n if respond_to?(:schema_parse_tables, true)\n @schemas = schema_parse_tables(opts)\n elsif respond_to?(:schema_parse_table, true) and respond_to?(:tables, true)\n tables.each{|t| schema(t, opts)}\n @schemas\n else\n raise Error, 'schema parsing is not implemented on this database'\n end\n end\n end",
"def identifier(schema, name = nil)\n name ||= @name\n \"`#{schema}`.`#{name}`\"\n end",
"def create_table!(name, &block)\n drop_table(name) rescue nil\n create_table(name, &block)\n end",
"def create_db_schema(connection)\n connection.execute 'CREATE TABLE documents (id INTEGER PRIMARY KEY AUTOINCREMENT, name)'\n connection.execute 'CREATE TABLE words (id, doc_id, value)'\n connection.execute 'CREATE TABLE characters (id, word_id, value)'\nend",
"def set_schema_table\n @schema_table = SchemaTable.find(params[:id])\n end",
"def table(name, schema=nil)\n define_collection(name)\n @tables[name] = Bud::BudTable.new(name, self, schema)\n end",
"def migration(version, fingerprint, name)\n SchemaMigration.create!(version: version, migrated_at: Time.now, fingerprint: fingerprint, name: name)\n end",
"def prepare_schema\n tables = [];ActiveRecord::Base.connection.execute(\"show tables\").each{|t| tables << t[0].strip}\n \n ActiveRecord::Schema.define do\n App.log.info(\"preparing schema\")\n \n unless tables.include?(\"services\")\n # a service entry\n begin\n create_table :services do |t|\n t.string :name\n t.string :status, :null => false, :default => \"active\"\n end\n add_index :services, :name\n rescue\n App.log_exception\n end\n end\n \n unless tables.include?(\"queries\")\n begin\n # queries\n create_table :queries do |t|\n t.string :query \n t.column :last_twid, :bigint, :null => false, :default => 0\n t.timestamp :last_run\n t.integer :last_result_count\n t.string :status, :default => 'active', :null=> false\n end\n add_index :queries, :query\n rescue\n App.log_exception\n end\n end\n \n unless tables.include?(\"tweets\")\n begin\n # cache of tweets\n create_table :tweets do |t|\n t.column :twid, :bigint, :null => false\n t.string :from_user\n t.string :to_user\n t.integer :from_user_id\n t.integer :to_user_id\n t.string :text\n t.string :profile_image_url\n t.timestamp :created_at\n end\n add_index :tweets, :twid\n rescue\n App.log_exception\n end\n end\n \n end # define schema\n end",
"def schema_dump(file_name = nil)\n schema = ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, StringIO.new).string\n return schema unless file_name\n\n File.open(file_name, 'w') { |f| f.puts(schema) }\n end",
"def schema_dump(file_name = nil)\n schema = ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, StringIO.new).string\n return schema unless file_name\n\n File.open(file_name, 'w') { |f| f.puts(schema) }\n end",
"def create_database_sql(name, opts = {})\n \"CREATE DATABASE #{quote_identifier(name)}\"\n end",
"def create_schema\n schema = @index.schema\n unless schema.tables['search']\n @index.execute_batch <<-SQL\n CREATE VIRTUAL TABLE search USING fts5(\n sequence_number,\n kanji,\n kana,\n senses\n );\n SQL\n @index.reload_schema!\n end\n end",
"def create(name)\n self.new(name)\n end",
"def init_schema\n return unless in_memory_database?\n\n inform_using_in_memory unless silent?\n\n if silent? || quiet?\n load_schema_silently\n else\n load_schema\n end\n end"
] |
[
"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.62491083",
"0.62491083",
"0.6210386",
"0.6192214",
"0.61921316",
"0.61783",
"0.6023668",
"0.5988244",
"0.5961164",
"0.5927577",
"0.5851516",
"0.5818226",
"0.58172125",
"0.58136445",
"0.5781115",
"0.57727003",
"0.5759505",
"0.5736693",
"0.56955075",
"0.5679792",
"0.566031",
"0.5646082",
"0.557752",
"0.5561739",
"0.5531281",
"0.5523061",
"0.5502299",
"0.5462787",
"0.5462787",
"0.5462057",
"0.5432283",
"0.5431818",
"0.54281855",
"0.54096675",
"0.53912723",
"0.5389741",
"0.5387448",
"0.53772056",
"0.53711957",
"0.53658766",
"0.5361147",
"0.5359799",
"0.53573996",
"0.5339018",
"0.5330767",
"0.53210366",
"0.53206116",
"0.5316093",
"0.53149474",
"0.53112423",
"0.5301387",
"0.52925825",
"0.5290761",
"0.5283104",
"0.5277385",
"0.5277068",
"0.52767915",
"0.5271661",
"0.5270242",
"0.52632886",
"0.5263081",
"0.5236833",
"0.52350545",
"0.5233412",
"0.5229584",
"0.5219875",
"0.5217005",
"0.5206878",
"0.51994413",
"0.5194815",
"0.5188298",
"0.5183897",
"0.5159771",
"0.5158227",
"0.5158227",
"0.51561123",
"0.5139527",
"0.51360554",
"0.51325965"
] |
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 \"DROP SCHEMA #{quote_identifier(name)}\"\n end",
"def drop_schema(name, opts = {})\n execute_ddl(drop_schema_sql(name, opts))\n end",
"def unload_schema(schema_name)\n end",
"def drop_schema(name, opts=OPTS)\n self << drop_schema_sql(name, opts)\n end",
"def drop_schema(schema)\n execute \"DROP SCHEMA #{schema} RESTRICT\", 'Drop Schema'\n end",
"def drop_schema_sql(name, opts=OPTS)\n \"DROP SCHEMA#{' IF EXISTS' if opts[:if_exists]} #{quote_identifier(name)}#{' CASCADE' if opts[:cascade]}\"\n end",
"def drop_schema_sql(name, opts = {})\n \"DROP SCHEMA #{quote_identifier(name)} CASCADE\"\n end",
"def destroy_schema\n Apartment::Tenant.drop(schema_name)\n Rails.logger.info(\"Tenant dropped: #{schema_name}\")\n rescue Apartment::TenantNotFound => e\n Rails.logger.warn(\"Failed to drop tenant (not found): #{schema_name}\")\n raise e if Rails.env.production? # Don't raise an exception in dev mode so to allow seeds to work\n end",
"def delete\n ensure_service!\n service.delete_schema name\n true\n end",
"def drop_table(name)\n not_exist(name)\n\n ORM::DBConnection.new(model_name(name)).remove_table(name)\n File.delete(\"app/services/db/tables/#{name}.json\")\n end",
"def drop_database(name)\n single_db_command(name, :dropDatabase => 1)\n end",
"def drop_table_sql(name)\n \"DROP TABLE #{quote_schema_table(name)}\"\n end",
"def drop_database(name) #:nodoc:\n execute \"DROP DATABASE #{quote_table_name(name)}\"\n end",
"def drop_database(name)\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end",
"def drop_table_sql(name)\n \"DROP TABLE #{quote_schema_table(name)}\"\n end",
"def drop_database(name) # :nodoc:\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end",
"def drop_database(name) #:nodoc:\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end",
"def drop_database(name)\n execute \"DROP DATABASE IF EXISTS #{name}\" \n end",
"def to_sql_drop_namespace(db)\n if db.supports_schemas?\n db.send(:drop_schema_sql, self.name, {})\n else\n \"\"\n end\n end",
"def drop\n database.command(:drop => name)\n rescue Error::OperationFailure => ex\n raise ex unless ex.message =~ /ns not found/\n false\n end",
"def drop_database(db_name)\n check_return_code(PureHailDB.ib_database_drop(db_name))\n end",
"def drop_audit_schema!\n @config[:drop_audit_schema] = true\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema = Schema.find(params[:id])\n @schema.destroy\n\n respond_to do |format|\n format.html { redirect_to schemas_url }\n format.json { head :no_content }\n end\n end",
"def drop_table_sql(name)\n \"DROP TABLE #{quote_identifier(name)}\"\n end",
"def drop_table(*names)\n options = names.last.is_a?(Hash) ? names.pop : OPTS \n names.each do |n|\n execute_ddl(drop_table_sql(n, options))\n remove_cached_schema(n)\n end\n nil\n end",
"def drop\n @db.drop_collection(@name)\n end",
"def drop_database_sql(name, opts = {})\n \"DROP DATABASE #{quote_identifier(name)}\"\n end",
"def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schema.destroy\n respond_to do |format|\n format.html { redirect_to schemas_url, notice: 'Schema was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_schema\n Apartment::Tenant.drop tenant\n end",
"def destroy_schema\n Apartment::Tenant.drop tenant\n end",
"def drop\n @db.drop_collection(@name)\n end",
"def drop_table\n db.drop_table(table_name)\n end",
"def drop\n\t\tActiveRecord::Base.connection.execute \"SET AUTOCOMMIT=0\"\n\t\tActiveRecord::Base.connection.execute \"SET FOREIGN_KEY_CHECKS=0\"\n\n self.change_schema_to 'information_schema';\n @result[:deleted] = []\n \n if request[:remove_all]\n #remove all tables\n @tables = ActiveRecord::Base.connection.select_all \"select TABLE_NAME table_name from `TABLES` where `TABLE_SCHEMA`='#{request[:db_name]}'\"\n self.change_schema_to request[:db_name];\n \n @tables.each do |table|\n ActiveRecord::Base.connection.execute \"drop table `#{table[\"table_name\"]}`\"\n @result[:deleted].push table[\"table_name\"];\n end\n else\n self.change_schema_to request[:db_name];\n ActiveRecord::Base.connection.execute \"drop table `#{request[:key]}`\";\n @result[:deleted].push request[:key];\n end\n \n self.change_schema_to 'information_schema';\n @result[:type] = 'table'\n render json: @result\n end",
"def drop_sequence(name)\n execute drop_sequence_sql(name)\n end",
"def drop_rule(name, table)\n execute \"DROP RULE #{quote_rule(name)} ON #{quote_table_name(table)};\"\n end",
"def drop_sequence(name)\n name = quote_name(name)\n sql = \"DROP SEQUENCE #{name}\"\n execute(sql)\n end",
"def remove_synonym(name)\n execute \"DROP SYNONYM #{quote_table_name(name)}\"\n end",
"def schema(schema_name)\n state_depth_must_be(States::DOMAIN)\n s = schema_lookup(schema_name)\n if s.nil?\n n = Schema.new(@current_domain, schema_name)\n @current_domain.schemas << n\n @current_schema = n\n else\n @current_schema = s\n end\n clear_state_below(States::SCHEMA)\n end",
"def drop_table\n self.connection.drop_table table_name\n end",
"def drop_mysql_database\n MysqlUtils.drop_mysql_database(database_name)\n end",
"def drop_db( path_names )\n path_name_tokens = path_names.split( \"|\" )\n zone = path_name_tokens[1]\n connect_for( zone ) do |con|\n db_name = path_name_tokens.pop\n con.drop_database( db_name )\n end\n end",
"def drop_sequence(sequence_name, options = {})\n SchemaMonkey::Middleware::Migration::DropSequence.start(connection: self, sequence_name: sequence_name, sequence_options: options) do |env|\n sequence_name = env.sequence_name\n options = env.sequence_options\n sql = \"DROP SEQUENCE\"\n sql += \" IF EXISTS\" if options[:if_exists]\n sql += \" #{quote_table_name(sequence_name)}\"\n execute sql\n end\n end",
"def drop_tablespace(name, options = {})\n sql = 'DROP TABLESPACE '\n sql << 'IF EXISTS ' if options[:if_exists]\n sql << quote_tablespace(name)\n\n execute(\"#{sql};\")\n end",
"def delete_database(connection_string, db_name)\n drop_sql = <<-SQL\n DROP DATABASE #{db_name};\n SQL\n\n run \"#{connection_string} --execute=\\\"#{drop_sql}\\\"\"\nend",
"def drop_collection(collection_name)\n get_db.drop_collection(collection_name)\n end",
"def drop_collection(collection_name)\n get_db.drop_collection(collection_name)\n end",
"def delete_database(database_name)\n @glue_client.delete_database(name: database_name)\n rescue Aws::Glue::Errors::ServiceError => e\n @logger.error(\"Glue could not delete database: \\n#{e.message}\")\n end",
"def drop_table_sql(name, options)\n \"DROP TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if options[:cascade]}\"\n end",
"def destroy\n @schema_table.destroy\n respond_to do |format|\n format.html { redirect_to schema_tables_url, notice: 'Schema table was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def drop_database\n puts \"Droping database #{@db_name}...\"\n begin\n client = Mysql2::Client.new(:host => @db_host, :username => @db_user, :password => @db_pass)\n client.query(\"DROP DATABASE IF EXISTS #{@db_name}\")\n client.close\n rescue Exception => e\n puts \"An error occurred\\n #{e}\"\n end\n end",
"def schema(name)\n get(\"schemas/#{name}/\", \"schema\")\n end",
"def drop\n ensure_service!\n service.drop_database instance_id, database_id\n true\n end",
"def drop\n ensure_service!\n service.drop_database instance_id, database_id\n true\n end",
"def drop_function(name, custom_drop_statement = nil)\n Scenic.database.drop_function(name, custom_drop_statement)\n end",
"def dropUserTable\n @conn.exec(\"DROPE users\")\n end",
"def destroy!\n drop_ddl = tables.map(&:name).map do |t|\n \"drop table if exists #{t};\\n\"\n end.join\n ActiveRecord::Base.connection.execute(drop_ddl)\n end",
"def drop_constraint(table, name)\n current_instructions << Instructions::DropConstraint.new(\n table: table,\n name: name,\n )\n end",
"def drop_db\n Mongoid.purge!\n end",
"def drop_trigger(table_name, trigger_name, options = {})\n SchemaMonkey::Middleware::Migration::CreateTrigger.start(connection: self, table_name: table_name, trigger_name: trigger_name, options: options) do |env|\n table_name = env.table_name\n trigger_name = env.trigger_name\n options = env.options\n\n sql = \"DROP TRIGGER\"\n sql += \" IF EXISTS\" if options[:if_exists]\n sql += \" #{quote_table_name(trigger_name)} ON #{quote_table_name(table_name)}\"\n sql += \" CASCADE\" if options[:cascade]\n\n execute sql\n end\n end",
"def drop!(db, colls = nil)\n db.in_transaction do |conn|\n schema_tables(conn).each do |table|\n conn.exec \"DROP TABLE IF EXISTS #{table}\"\n end\n end\n end",
"def clean_schema\n # AppControl.restart_server # if Rails.env.production?\n ActiveRecord::Base.connection.schema_cache.clear!\n end",
"def drop_table(table_name, **options)\n schema_cache.clear_data_source_cache!(table_name.to_s)\n execute \"DROP#{' TEMPORARY' if options[:temporary]} TABLE#{' IF EXISTS' if options[:if_exists]} #{quote_table_name(table_name)}#{' CASCADE' if options[:force] == :cascade}\"\n end",
"def drop(name)\n tuples = primary.lookup_vals(name)\n return delete(tuples).size > 0\n end",
"def drop_table(*names)\n names.each {|n| execute(drop_table_sql(n))}\n end",
"def alter_table(name, *)\n super\n remove_cached_schema(name)\n nil\n end",
"def drop_sequence_sql(name)\n \"DROP SEQUENCE #{name}\"\n end",
"def drop_sequence(name)\n self.execute(\"DROP TABLE IF EXISTS %s_sequence\" % name)\n end",
"def dropUserTable(tableName)\n @conn.exec(\"DROP TABLE #{tableName}\")\n end",
"def drop_table(table_name = temporary_table_name)\n ::RailsRedshiftReplicator.connection.exec \"drop table if exists #{table_name}\"\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def destroy_database(name)\n database = ::MySQL::Database.find_by_name(name)\n return false if database.nil?\n !!database.destroy\n end",
"def destroy\n @schema_field = SchemaField.find(params[:id])\n @schema_field.destroy\n\n respond_to do |format|\n format.html { redirect_to schema_fields_url }\n format.json { head :ok }\n end\n end",
"def drop_and_create_schema_migrations_table\n sql = [\n \"USE #{@database}\",\n 'DROP TABLE IF EXISTS schema_migrations',\n 'CREATE TABLE schema_migrations ( version varchar(255) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY unique_schema_migrations (version)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci'\n ]\n\n run_commands(sql)\n end",
"def destroy_db(options)\n info \"Dropped database '#{options[:name]}'\"\n end",
"def remove_tables_from_publication(name, tables)\n typed_exec(\"ALTER PUBLICATION #{connection.quote_ident(name)} DROP TABLE #{safe_list(tables)}\")\n end",
"def drop_proc(name, columns=[], cascade=false)\n execute \"DROP FUNCTION #{name.to_sql_name}(#{columns.collect {|column| column}.join(\", \")}) #{cascade_or_restrict(cascade)};\"\n end",
"def drop_proc(name, columns=[], cascade=false)\n execute \"DROP FUNCTION #{name.to_sql_name}(#{columns.collect {|column| column}.join(\", \")}) #{cascade_or_restrict(cascade)};\"\n end",
"def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end",
"def drop_versioned_table\n self.connection.drop_table versioned_table_name\n end",
"def delete_table\n table_name = self.to_s.pluralize.underscore\n DATABASE.execute(\"DROP TABLE #{table_name}\")\n end",
"def delete(name)\n @driver.deleteRule([name])\n end",
"def drop_function(function_name, options = {})\n function_name = full_function_name(function_name, options)\n\n execute \"DROP FUNCTION #{function_name}\"\n end",
"def drop_view_sql(name, opts=OPTS)\n \"DROP #{'MATERIALIZED ' if opts[:materialized]}VIEW#{' IF EXISTS' if opts[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if opts[:cascade]}\"\n end",
"def delete_security_policy_definition(kapp_slug, name, headers=default_headers)\n @logger.info(\"Deleting Security Policy Definition \\\"#{name}\\\" from the \\\"#{kapp_slug}\\\" kapp.\")\n # Delete the kapp security policy definition\n delete(\"#{@api_url}/kapps/#{kapp_slug}/securityPolicyDefinitions/#{encode(name)}\", headers)\n end",
"def drop_table(tablename)\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n tablename.is_a?(Symbol)\r\n raise \"Table does not exist!\" unless table_exists?(tablename)\r\n @table_hash.delete(tablename)\r\n\r\n return @engine.delete_table(tablename)\r\n end",
"def drop_view(name)\n execute(\"DROP VIEW #{name}\")\n end",
"def drop_trigger_sql(table, name, opts=OPTS)\n \"DROP TRIGGER#{' IF EXISTS' if opts[:if_exists]} #{name} ON #{quote_schema_table(table)}#{' CASCADE' if opts[:cascade]}\"\n end",
"def drop_function(function_name, params, options = {})\n SchemaMonkey::Middleware::Migration::CreateFunction.start(connection: self, function_name: function_name, params: params, options: options) do |env|\n function_name = env.function_name\n params = env.params\n options = env.options\n function_type = (options[:function_type] || :function).to_s.upcase\n\n sql = \"DROP #{function_type}\"\n sql += \" IF EXISTS\" if options[:if_exists]\n sql += \" #{function_name}(#{params})\"\n sql += \" CASCADE\" if options[:cascade]\n\n execute sql\n end\n end",
"def drop_collection(name)\n response = RequestResponse.new\n names_resp = collection_names\n names_resp.callback do |names|\n if names.include?(name.to_s)\n cmd_resp = command(:drop=>name)\n cmd_resp.callback do |doc|\n response.succeed EM::Mongo::Support.ok?(doc)\n end\n cmd_resp.errback { |err| response.fail err }\n else\n response.succeed false\n end\n end\n names_resp.errback { |err| response.fail err }\n response\n end",
"def drop(db)\n\tif $table_exists\n\t\tdb.execute(\"DROP TABLE items;\")\n\t\t$table_exists = false\n\t\tputs \"\\nTable successfully deleted.\"\n\telse\n\t\tputs \"\\nTable successfully deleted.\"\n\tend\nend",
"def drop_view(view_name, options = {})\n SchemaMonkey::Middleware::Migration::DropView.start(connection: self, view_name: view_name, options: options) do |env|\n view_name = env.view_name\n options = env.options\n materialized = options[:materialized] ? 'MATERIALIZED' : ''\n sql = \"DROP #{materialized} VIEW\"\n sql += \" IF EXISTS\" if options[:if_exists]\n sql += \" #{quote_table_name(view_name)}\"\n execute sql\n end\n end",
"def db_destroy_postgresql(*args)\n\n\t\t\tcmd_db_disconnect()\n\n\t\t\treturn if ! db_find_tools(%W{dropdb})\n\n\t\t\tinfo = db_parse_db_uri_postgresql(args[0])\n\t\t\targv = []\n\n\t\t\tif (info[:user])\n\t\t\t\targv.push('-U')\n\t\t\t\targv.push(info[:user])\n\t\t\tend\n\n\t\t\tif (info[:pass])\n\t\t\t\tprint()\n\t\t\t\tprint_status(\"Warning: You will need to enter the password at the prompts below\")\n\t\t\t\tprint()\n\t\t\t\targv.push('-W')\n\t\t\tend\n\n\t\t\tif (info[:host])\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\n\t\t\tif (info[:port])\n\t\t\t\targv.push('-p')\n\t\t\t\targv.push(info[:port])\n\t\t\tend\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\t\t\tsystem(\"dropdb #{cargs} #{info[:name]}\")\n\t\tend",
"def drop_replication_trigger(trigger_name, table_name)\n %w(insert update delete).each do |action|\n execute \"DROP TRIGGER `#{trigger_name}_#{action}`;\"\n end\n execute \"DROP PROCEDURE `#{trigger_name}`;\"\n end",
"def destroy_constraints_statement(table_name, constraint_name)\n <<-EOS.compress_lines\n ALTER TABLE #{quote_table_name(table_name)}\n DROP CONSTRAINT #{quote_constraint_name(constraint_name)}\n EOS\n end",
"def alter_sequence_schema(name, schema, options = {})\n execute(\"ALTER SEQUENCE #{quote_sequence(name)} SET SCHEMA #{quote_schema(schema)};\")\n end"
] |
[
"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.64898354",
"0.6358794",
"0.6345663",
"0.63225555",
"0.6263287",
"0.6263287",
"0.62586147",
"0.62405723",
"0.6228346",
"0.62018573",
"0.6187447",
"0.6187447",
"0.6187447",
"0.6157745",
"0.6157745",
"0.6155083",
"0.61373574",
"0.6122304",
"0.60688007",
"0.60189646",
"0.60071087",
"0.59945554",
"0.5958892",
"0.594101",
"0.59306496",
"0.5925847",
"0.5902077",
"0.59009314",
"0.5866214",
"0.5862994",
"0.5862994",
"0.5843099",
"0.5832972",
"0.58145624",
"0.57970446",
"0.5795762",
"0.5781613",
"0.5781613",
"0.57746285",
"0.57347757",
"0.57060814",
"0.5704544",
"0.5696644",
"0.56929183",
"0.56813073",
"0.56731445",
"0.5655585",
"0.56530064",
"0.5648716",
"0.56388384",
"0.56368136",
"0.5610042",
"0.5609604",
"0.56051177",
"0.56001824",
"0.55837756",
"0.55793923",
"0.5573",
"0.5565923",
"0.5561857",
"0.556015",
"0.556015",
"0.5559875",
"0.5512107",
"0.5511211",
"0.55063915",
"0.5476337",
"0.54709464",
"0.5465022",
"0.54630643",
"0.5442909",
"0.5442801",
"0.54368025",
"0.54346424",
"0.54296744",
"0.5414345",
"0.5410039",
"0.54016113",
"0.5396651",
"0.5384412"
] |
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\n end",
"def get_level(msg)\n player = verify_player msg\n return unless player\n msg.reply \"#{player.name} is level #{player.level}.\"\n end",
"def level\n @level\n end",
"def get_level\n case @level\n when 0, 1, 2, 3, 4, 5\n return @level\n else\n return WatirmarkLog::Level::DEBUG\n end\n end",
"def level\n @log.level\n end",
"def level\n logger.level\n end",
"def level\n return @state[:fiber][:level]\n end",
"def level\n @level || Helpers.char_level(@entity)\n end",
"def current_user_level\n current_user.level\n end",
"def message_version\r\n\t\t\tCURRENT_VERSION\r\n\t\tend",
"def current_level\n @cur_level\n end",
"def level\n logger_instance.level\n end",
"def client_min_messages=(level)\n # Not supported on Redshift\n redshift? ? nil : super\n end",
"def client_min_messages=(level)\n # NOTE: for now simply ignore the writer (no warn on Redshift) so that\n # the AR copy-pasted PpstgreSQL parts stay the same as much as possible\n return nil if redshift? # not supported on Redshift\n execute(\"SET client_min_messages TO '#{level}'\", 'SCHEMA')\n end",
"def level\n Logger::Severity.constants.each do |name|\n return name.downcase.to_sym if @logger.level.eql?(Logger::Severity.const_get(name))\n end\n raise \"error\"\n end",
"def level\n init unless @initialized\n level = level_to_sym(@level)\n end",
"def get_message\n get_status[:message]\n end",
"def level\n @loggers.each do |logger|\n return logger.level if logger.respond_to?(:level)\n end\n end",
"def severity()\n @logger.level\n end",
"def level_text\n @level.to_s\n end",
"def level\n bid[0] if contract?\n end",
"def getLevels\n @level\n end",
"def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end",
"def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end",
"def log_level\n %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]\n end",
"def level; @logger.level; end",
"def priority; @message_impl.getPriority; end",
"def log_level\n LOG_LEVELS[::Rails.logger.level]\n end",
"def message_language\n return @message_language\n end",
"def message_version\n msg['_version']\n end",
"def iclevel\n \"\"\n end",
"def logging_level\n @logging_level\n end",
"def log_level\n case @log_level\n when Symbol, String\n Log.level_from_sym(@log_level.to_sym)\n else\n @log_level\n end\n end",
"def severity_level\n return @values['severityLevel'] if @values.key?('severityLevel')\n @defaults['severityLevel']\n end",
"def level\n @location.level\n end",
"def client_min_messages\n return nil if redshift? # not supported on Redshift\n # Need to use #execute so we don't try to access the type map before it is initialized\n execute('SHOW client_min_messages', 'SCHEMA').values.first.first\n end",
"def level\n [MAJOR, MINOR, PATCH, PRE].compact.join(\".\")\n end",
"def level; end",
"def level; end",
"def level; end",
"def level; end",
"def level; end",
"def level; end",
"def get_level(key)\n case key\n when \"L\", \"l\" then 0 # Level L\n when \"M\", \"m\" then 1 # Level M\n when \"Q\", \"q\" then 2 # Level Q\n when \"H\", \"h\" then 3 # Level H\n end\n end",
"def message_class\n return Scene_Battle::Message\n end",
"def logger_level; end",
"def message\n MESSAGE\n end",
"def message\n MESSAGE\n end",
"def message\n MESSAGE\n end",
"def message\n MESSAGE\n end",
"def level\n @events.max_by{|event| LoggedEvent.types_of_events.invert[event.level]}.level\n end",
"def level! min\n level = @connection.users[@msg.nick].level\n\n return true if level >= min\n\n raise 'Insufficient access level.'\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def restriction_level\r\n # Pvtmessages not so much\r\n return Relationshiptype.nobody if self.is_a?(Pvtmessage)\r\n \r\n # Items in inboxes MUST have security set to public\r\n return Relationshiptype.everyone if self.in_inbox?\r\n \r\n # Otherwise, return the level (default to open if something got messed up)\r\n self.relationshiptype_id.blank? ? Relationshiptype.everyone : self.relationshiptype_id\r\n end",
"def level\n @level || :trace\n end",
"def level\n @level || :trace\n end",
"def fetch_log_level(mode)\n case mode\n when 'verbose'\n Logger::INFO\n when 'debug'\n Logger::DEBUG\n else # silent mode\n Logger::ERROR\n end\n end",
"def client_state\n return @client_state\n end",
"def header_level\n @pairs.fetch(\"level\", \"1\").to_i\n end",
"def current_msg\n return session[:msg] if defined?(session[:msg])\n return ''\n end",
"def severity\n return @severity\n end",
"def severity\n return @severity\n end",
"def log_level; end",
"def log_level; end",
"def current_msg\n return session[:msg] if defined?(session[:msg])\n ''\n end",
"def heading_level\n self.get_heading_level\n end",
"def get_severity\n\t\treturn ERROR_SEVERITY[:medium]\n\tend",
"def status\n @message\n end",
"def levelname\n\t\t\tlevel.level_name\n\t\tend",
"def write_message?(level_of_message); end",
"def levels\n Access::Core.levels_hash.keys\n end",
"def get_level(src)\n\t\tlog_levels[src]\n\tend",
"def client_version\n ClientVersion\n end",
"def build_message\n level_string = (user.level == User::Levels::APPROVER) ? \"an Approver\" : \"a #{user.level_string}\"\n if user.level > user.level_was\n \"You have been promoted to #{level_string} level account from #{user.level_string_was}.\"\n elsif user.level < user.level_was\n \"You have been demoted to #{level_string} level account from #{user.level_string_was}.\"\n end\n end",
"def log_level\n @log_level ||= begin\n log_level = @config.log_level || @config_from_file['galaxy.agent.log-level'] || 'INFO'\n case log_level\n when \"DEBUG\"\n Logger::DEBUG\n when \"INFO\"\n Logger::INFO\n when \"WARN\"\n Logger::WARN\n when \"ERROR\"\n Logger::ERROR\n end\n end\n end",
"def get_current_client\n get_current_hub&.current_client\n end",
"def message\n status.last\n end",
"def log_level\n @log_level ||= begin\n log_level = @config.log_level || @config_from_file['galaxy.console.log-level'] || 'INFO'\n case log_level\n when \"DEBUG\"\n Logger::DEBUG\n when \"INFO\"\n Logger::INFO\n when \"WARN\"\n Logger::WARN\n when \"ERROR\"\n Logger::ERROR\n end\n end\n end",
"def level\n @level ||= :warn\n end",
"def level\n parent_id.nil? ? 0 : compute_level\n end",
"def status_message\n @data[:status_message]\n end",
"def get_level(name = nil)\n name = :default unless name\n return nil unless @logdevs[name]\n return @logdevs[name][:level]\n end",
"def message_type\n @message_type ||= \"message\"\n end",
"def notification_level\n unless first_expiring_value.nil?\n return first_expiring_value.notification_level\n end\n return 0\n end",
"def log_level\n (self['resque.log_level'] || 1).to_i\n end",
"def default_level\n self.levels[nil]\n end",
"def current_weixin_message\n Message.factory(request.body.read)\n end",
"def current_weixin_message\n Message.factory(request.body.read)\n end",
"def getOponentLevel(monster)\n monster.getBasicValue\n end",
"def getMessage()\n return @message\n end",
"def info?; @level <= INFO; end",
"def info?; @level <= INFO; end",
"def message\n read_content :status\n end",
"def current_access_level\n @wfd_current_fal + 1\n end",
"def getOponentLevel(m)\n m.getCombatLevel\n end"
] |
[
"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.5837949",
"0.5804143",
"0.57304305",
"0.57248235",
"0.5692376",
"0.56743544",
"0.5653753",
"0.5653753",
"0.5653753",
"0.56473905",
"0.56440103",
"0.56343335",
"0.56286365",
"0.5618883",
"0.55892426",
"0.55578005",
"0.555712",
"0.5553145",
"0.55401933",
"0.5513114",
"0.55029845",
"0.54821026",
"0.54821026",
"0.54821026",
"0.54821026",
"0.54821026",
"0.54821026",
"0.5479062",
"0.5443587",
"0.5433314",
"0.54275614",
"0.54275614",
"0.54275614",
"0.54275614",
"0.5411482",
"0.5387682",
"0.5384636",
"0.5384636",
"0.5380649",
"0.5367384",
"0.5367384",
"0.5353044",
"0.53518176",
"0.53406435",
"0.5295489",
"0.5292769",
"0.5292769",
"0.52917445",
"0.52917445",
"0.5290763",
"0.5286974",
"0.5286493",
"0.5277661",
"0.5252741",
"0.5250827",
"0.5247387",
"0.5246752",
"0.52415234",
"0.5216619",
"0.5216472",
"0.5195627",
"0.5195556",
"0.51940286",
"0.51938945",
"0.5185244",
"0.5170809",
"0.5165075",
"0.51605034",
"0.51570845",
"0.51495844",
"0.5143789",
"0.5140382",
"0.5140382",
"0.5138584",
"0.5138443",
"0.51352733",
"0.51352733",
"0.5123401",
"0.51197284",
"0.5106165"
] |
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 @level = ::Logger::Severity.const_get(value.to_s.upcase)\n end",
"def level=(value)\n @level = value\n end",
"def level=(value)\n @level = value\n end",
"def log_level=(level); end",
"def level=( level )\n super(level || 0)\n end",
"def log_level=(value)\n logger.level = value\n end",
"def log_level=(value)\n logger.level = value\n end",
"def log_level=(value)\n logger.level = value\n end",
"def level=(level)\n @level = level\n @log.level = @level\n end",
"def log_level=(val)\n @@log_level = val\n end",
"def level=(level)\n logger.level = level\n end",
"def irc_log_level=(level)\n set(:irc_log_level, MonoLogger.const_get(level))\n if self.log\n self.log.level = self.irc_log_level\n end\n end",
"def loglevel=(level)\n @loglevel = logger.level = level\n end",
"def log_level=(level)\n logger.level = level\n end",
"def set_log_level( level )\n case level\n when :fatal\n ::Logger::FATAL\n when :error\n ::Logger::ERROR\n when :warn\n ::Logger::WARN\n when :info\n ::Logger::INFO\n when :debug\n ::Logger::DEBUG\n else\n ::Logger::INFO\n end\n end",
"def set_level(level)\n if SEVERITY.has_key? level\n @log_level=level\n else\n raise ArgumentError, \"Invalid log level given\"\n end\n end",
"def level=(new_level)\n logger.level = severity_lookup(new_level, :info)\n end",
"def loglevel=(level)\n @log.level=level\n end",
"def level=(new_level)\n @level = LEVELS[new_level.to_sym]\n reset_methods(:close)\n end",
"def set_level(level)\n Merb::Config[:log_level] = level\n Merb.reset_logger!\n end",
"def log_level=(level)\n @logger.level = level\n end",
"def level=(value)\n logger_instance.level = self.class.level_from_any(value)\n end",
"def level=(level) # needed to meet the Sentry spec\n @level = level.to_s == \"warn\" ? :warning : level\n end",
"def level=(level)\n @level = level\n @implementation.level = @level if @implementation\n level\n end",
"def level=(log_level)\n @@log_level = DEBUG_LEVEL[log_level]\n end",
"def set_log_level(log_level)\n case log_level.downcase\n when 'debug'\n @logger.level = Logger::DEBUG\n when 'info'\n @logger.level = Logger::INFO\n when 'warn'\n @logger.level = Logger::WARN\n when 'error'\n @logger.level = Logger::ERROR\n when 'fatal'\n @logger.level = Logger::FATAL\n end\n end",
"def log_level=(level)\n writer.level = level if level.is_a?(Integer) && level.between?(0, 3)\n writer.level = LOG_LEVELS[level] ||\n raise(ArgumentError, \"unknown log level\")\n @level = level\n end",
"def level=(new_level)\n super new_level.to_s\n end",
"def level(l)\n @config[:level] = l\n end",
"def level=(value)\n @loggers.each do |logger|\n logger.level = value if logger.respond_to?(:level=)\n end\n end",
"def level=(severity)\n raise TypeError, \"invalid log level: #{severity}\" if !severity.is_a? Integer\n @level = severity\n end",
"def setlog(level)\n $LOGLEVEL = level\n end",
"def loglevel= level\n self.class.createlogger unless self.class._logobject\n level = level.to_s.downcase.to_sym\n unless JLogger::Simple::LEVELS.has_key? level\n raise ArgumentError, \"'#{level}' is an invalid loglevel\"\n end\n \n self.class._logobject.level = JLogger::Simple::LEVELS[level]\n end",
"def log_level level\n level = Deployable::Logger.const_get level.upcase unless \n level.kind_of? ::Fixnum\n\n @log.level = level\n end",
"def level=(val)\n # Convert strings to the constant value\n val = convert_level(val)\n\n # Update the default log level\n @default_level = val\n\n # Set all loggers' log levels\n @loggers.each do |key, logger|\n logger.level = val\n end\n end",
"def log_level=(level)\n\t if level == 'debug'\n\t\t\t@log.level = Logger::DEBUG\n\t\telsif level == 'info'\n\t\t\t@log.level = Logger::INFO\n\t\telsif level == 'warn'\n\t\t\t@log.level = Logger::WARN\n\t\telsif level == 'error'\n\t\t\t@log.level = Logger::ERROR\n\t\telsif level == 'fatal'\n\t\t\t@log.level = Logger::FATAL\n\t\tend\n\tend",
"def log_level=(level)\n\t if level == 'debug'\n\t\t\t@log.level = Logger::DEBUG\n\t\telsif level == 'info'\n\t\t\t@log.level = Logger::INFO\n\t\telsif level == 'warn'\n\t\t\t@log.level = Logger::WARN\n\t\telsif level == 'error'\n\t\t\t@log.level = Logger::ERROR\n\t\telsif level == 'fatal'\n\t\t\t@log.level = Logger::FATAL\n\t\tend\n\tend",
"def level=(level)\n @level = level.to_s.downcase.to_sym\n\n loggers.each do |_, logger|\n logger.level = @level\n end\n\n @level\n end",
"def level=(level)\n init unless @initialized\n unless @level_frozen\n new_level = case level\n when Symbol then level_from_sym(level)\n when String then level_from_sym(level.to_sym)\n else level\n end\n if new_level != @level\n @logger.info(\"[setup] setting log level to #{level_to_sym(new_level).to_s.upcase}\")\n @logger.level = @level = new_level\n end\n end\n level = level_to_sym(@level)\n end",
"def level=(level)\n @level_index = self.class.map_level_to_index(level)\n @level = level\n end",
"def log_level=(log_level)\n @log_level = log_level if [DEBUG, INFO, WARN, ERROR].include?(log_level)\n end",
"def level=(level)\n @state[:fiber][:level] = level\n end",
"def severity=(level)\n if level.is_a?(String)\n severity = {\n 'FATAL' => Logger::Severity::FATAL,\n 'ERROR' => Logger::Severity::ERROR,\n 'WARN' => Logger::Severity::WARN,\n 'INFO' => Logger::Severity::INFO,\n 'DEBUG' => Logger::Severity::DEBUG,\n '4' => Logger::Severity::FATAL,\n '3' => Logger::Severity::ERROR,\n '2' => Logger::Severity::WARN,\n '1' => Logger::Severity::INFO,\n '0' => Logger::Severity::DEBUG\n }[level.upcase()]\n raise \"#{level} is not a severity\" if severity.nil?\n level = severity\n elsif level < Logger::Severity::DEBUG || Logger::Severity::FATAL < level\n raise \"#{level} is not a severity\"\n end\n @logger.level = level\n end",
"def level=(val)\n unless LEVELS.include?(val)\n fail \"Unknown log level, valid values are: #{LEVELS}\"\n end\n\n # Map the log4r levels to our simplified 3 level system\n # log4r level order is DEBUG < INFO < WARN < ERROR < FATAL\n case val\n when :normal\n # Output everything except debug statements\n console.level = Logger::INFO\n # Output everything\n log_files(:level=, Logger::DEBUG) unless console_only?\n when :verbose\n console.level = Logger::DEBUG\n log_files(:level=, Logger::DEBUG) unless console_only?\n when :silent\n # We don't use any fatal messages, so this is effectively OFF\n console.level = Logger::FATAL\n log_files(:level=, Logger::DEBUG) unless console_only?\n end\n\n @level = val\n end",
"def level=(lvl)\n @level = if lvl.is_a?(Integer)\n lvl\n else\n Level::NAME_TO_LEVEL.fetch(lvl.to_s.upcase)\n end\n end",
"def set_level(src, level)\n\t\tlog_levels[src] = level.to_i\n\tend",
"def level= level\n if (0..6).include? level then @level = level\n elsif LEVEL.include? level.to_s then @level = LEVEL.index level\n else @level = UNKNOWN\n end\n end",
"def severity_level=(value)\n if value == @defaults['severityLevel']\n @values.delete 'severityLevel' if @values.key? 'severityLevel'\n else\n @values['severityLevel'] = value\n end\n end",
"def level=(value_)\n if value_.kind_of?(Level)\n @level = value_\n else\n level_obj_ = @level_group.get(value_)\n if level_obj_.nil?\n raise Errors::UnknownLevelError, value_\n end\n @level = level_obj_\n end\n end",
"def logging_level=(level)\n level = Integer(level)\n raise ArgumentError, \"invalid logging level value #{level}\" if level < 1\n @logging_level = level\n end",
"def log_message( level, message )\n\n end",
"def set_message(msg)\n @message = msg\n end",
"def set_logging_level(level)\n level = level.to_s.downcase\n if %w[debug info warn error fatal unknown].include?(level)\n @logger.level = level.to_sym\n else\n @logger.warn('Invalid logger level')\n end\n end",
"def header_level=(level)\n if self.type != :header\n raise NodeError, \"can't set header_level for non-header\"\n end\n if !level.kind_of?(Integer) || level < 0 || level > 6\n raise NodeError, \"level must be between 1-6\"\n end\n res = CMark.node_set_header_level(@pointer, level)\n if res == 0 then raise NodeError, \"could not set header level\" end\n end",
"def log_set (level)\n execute(:log_set, level)\n end",
"def opt_level=(level)\n @opt_level = level.to_i\n C.pass_manager_builder_set_opt_level(self, @opt_level)\n end",
"def level= severity\n new_level = derive_severity severity\n fail ArgumentError, \"invalid log level: #{severity}\" if new_level.nil?\n @level = new_level\n end",
"def level=(level)\n validator = EnumAttributeValidator.new('String', [\"Unknown\", \"Inline\", \"Block\", \"Row\", \"Cell\"])\n if level.to_i == 0\n unless validator.valid?(level)\n raise ArgumentError, \"invalid value for 'level', must be one of #{validator.allowable_values}.\"\n end\n @level = level\n else\n @level = validator.allowable_values[level.to_i]\n end\n end",
"def startlevel_set (level)\n execute(:startlevel, level)\n end",
"def <<(message_)\n add(@level_group.default, message_)\n end",
"def level=(severity)\n if severity.is_a?(Integer)\n @level = severity\n else\n _severity = severity.to_s.downcase\n case _severity\n when 'debug'\n @level = DEBUG\n when 'info'\n @level = INFO\n when 'warn'\n @level = WARN\n when 'error'\n @level = ERROR\n when 'fatal'\n @level = FATAL\n when 'unknown'\n @level = UNKNOWN\n when 'null'\n @level = NULL\n else\n raise ArgumentError, \"invalid log level: #{severity}\"\n end\n end\n end",
"def level=(severity)\n if severity.is_a?(Integer)\n @level = severity\n elsif severity.is_a?(String)\n @level = from_label(severity.upcase)\n elsif severity.is_a?(Symbol)\n @level = from_label(severity.to_s.upcase)\n else\n @level = nil\n end\n end",
"def log_level(value)\n Logger.log_level = value\n return nil\n end",
"def change_level\n if Group::LEVEL_TITLES.include?(params[:level])\n params[:level] = Group::LEVELS[Group::LEVEL_TITLES.index(params[:level])]\n end\n unless Group::LEVELS.include?(params[:level])\n flash[:notice] = 'invalid level'\n render(:update) do |page|\n update_flash(page, flash[:notice])\n end\n return\n end\n\n act_on_members do |gi|\n if gi.level == 'leader' && gi.group.leaders.count == 1\n @member_notices << \"Couldn't change #{gi.person.full_name}'s level from a leader, since that would result in a leaderless group!\"\n else\n @levels_to_update << gi.level # update old\n gi.level = params[:level]\n @levels_to_update << gi.level # update new\n @member_notices << \"#{gi.person.full_name} is now a #{params[:level]}\"\n end\n end\n end",
"def cli_level(level, active: @active, quiet: @quiet)\n\t\t\tlevel=active if level==true #for cli\n\t\t\tlevel=quiet if level==false #for cli\n\t\t\tself.level=level\n\t\tend",
"def enforcement_level=(value)\n @enforcement_level = value\n end",
"def set_level(name, level=nil)\n # Default\n unless level then\n level = name\n name = nil\n end\n\n # Look up the level if the user provided a :symbol or \"string\"\n level = MultiLog.string_to_level(level.to_s) unless level.is_a? Fixnum\n\n if name\n # Set a specific one\n raise \"No log by the name '#{name}'\" unless @logdevs[name]\n @logdevs[name][:level] = level\n else\n # Set them all by default \n @logdevs.each{|_, logdev| logdev[:level] = level }\n end\n end",
"def set_reverb_level(index, wet_level)\n wet = wet_level.clamp(0.0, 1.0)\n FMOD.invoke(:ChannelGroup_SetReverbProperties, self, index, wet)\n end",
"def access_level=(new_level)\n super new_level.to_s\n end",
"def access_level=(new_level)\n super new_level.to_s\n end",
"def setMessage(msg)\n @message = msg\n end",
"def priority=(priority); @message_impl.setPriority priority; end",
"def log level, message\n logger.send(level, name) { message }\n end",
"def log level, message\n logger.send(level, name) { message }\n end",
"def level\n init unless @initialized\n level = level_to_sym(@level)\n end",
"def log level, message; write level, message, caller[0] unless level > @level end",
"def log_level(level)\n\t\t\t@sys_lock.synchronize {\n\t\t\t\t@log_level = Control::get_log_level(level)\n\t\t\t\tif @controller.active\n\t\t\t\t\t@logger.level = @log_level\n\t\t\t\tend\n\t\t\t}\n\t\tend",
"def alter_user_level(user_level)\n \tself.user_level = user_level\n \tself.save\n end",
"def cli_level(level, active: @verbose_lvl, disactive: @quiet_lvl)\n\t\t\tlevel=active if level==true #for cli\n\t\t\tlevel=disactive if level==false #for cli\n\t\t\tself.level=level\n\t\tend",
"def set_level\n @level = Level.find(params[:id])\n end",
"def set_level\n @level = Level.find(params[:id])\n end",
"def severity= severity\n @logger.level = severity\n end",
"def logger_level=(level)\n ::Mongo::Logger.logger.level = case level\n when :debug\n ::Logger::DEBUG\n when :fatal\n ::Logger::FATAL\n else\n nil\n end\n end",
"def multi level, message\n return if level>@level\n\n caller0 = caller[0]\n if message.kind_of? Array then message.each { |one| write level, one, caller0 }\n else log level, message, caller0\n end\n end",
"def set_log_level(level=nil)\n defined?(Rails) and (default = (Rails.env.production? ? \"INFO\" : \"DEBUG\")) or (default = \"INFO\")\n log_level = (ENV['LOG_LEVEL'] || level || default)\n self.level = ZTK::Logger.const_get(log_level.to_s.upcase)\n end",
"def set_message(value)\n return false unless have_lock?\n cur = get_status\n set_status(value, cur[:percent])\n end",
"def handle_loglevel(val)\n\t\tset_log_level(Rex::LogSource, val)\n\t\tset_log_level(Msf::LogSource, val)\n\tend",
"def level=(level)\n # Check up and down limits\n level = [[level, $data_actors[@actor_id].final_level].min, 1].max\n # Change EXP\n self.exp = @exp_list[level]\n end",
"def level! min\n level = @connection.users[@msg.nick].level\n\n return true if level >= min\n\n raise 'Insufficient access level.'\n end",
"def set_log_level(flags)\n options = %w{none basic triggers trigger_summary entries exits closures}.map(&:to_sym)\n flags = Array.wrap(flags)\n unless flags.all? { |flag| options.member? flag }\n flags.each do |flag|\n unless options.member? flag\n raise ArgumentError, \"log level :#{flag} is not one of the support options: #{options.join(', ')}\"\n end\n end\n end\n @log_flags = flags\n end",
"def level\n @level\n end",
"def level\n @level\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end",
"def size_level=(level)\n @size_level = level.to_i\n C.pass_manager_builder_set_size_level(self, @size_level)\n end",
"def message=(message)\n set_content_for :status, message\n end",
"def set_Message(value)\n set_input(\"Message\", value)\n end"
] |
[
"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.5748123",
"0.573949",
"0.5723424",
"0.57098067",
"0.5690843",
"0.5661317",
"0.56494635",
"0.56278384",
"0.5622292",
"0.5612385",
"0.561087",
"0.5588992",
"0.55774647",
"0.5570876",
"0.5564867",
"0.5553001",
"0.55414414",
"0.5528364",
"0.5528364",
"0.5523596",
"0.5511723",
"0.55067337",
"0.54961026",
"0.5488117",
"0.54569536",
"0.54288185",
"0.5421437",
"0.5418231",
"0.5407518",
"0.53924996",
"0.5380874",
"0.53523535",
"0.5345492",
"0.5343219",
"0.533925",
"0.5330381",
"0.5302952",
"0.5294395",
"0.5291529",
"0.5281384",
"0.5276306",
"0.5276168",
"0.52735364",
"0.5273074",
"0.5268364",
"0.52671456",
"0.5230635",
"0.5229609",
"0.52205306",
"0.5204632",
"0.520204",
"0.520204",
"0.5187306",
"0.5165369",
"0.5144164",
"0.5144164",
"0.51335716",
"0.5115099",
"0.5113688",
"0.5102934",
"0.51014876",
"0.50993156",
"0.50993156",
"0.5096778",
"0.5075884",
"0.5073956",
"0.506386",
"0.505982",
"0.5054843",
"0.5048551",
"0.50456595",
"0.4996653",
"0.4980293",
"0.4980293",
"0.49755082",
"0.49755082",
"0.49735814",
"0.49680564",
"0.49592355"
] |
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 @columns&.max_by(&:size)\n end",
"def max_columns(fit = T.unsafe(nil)); end",
"def column_size; end",
"def col_max() 2 end",
"def col_max() return 2 end",
"def biggest_column\n @cols.max_by { |col| col.rows.length }\n end",
"def max_len_column(j)\n column_collect(j) {|x| x.to_s.length}.max\n end",
"def col_max\n [(self.width - padding * 2) / 96, 1].max\n end",
"def max_col\n [(@opts.width - 32) / char_width, @max_char].min\n end",
"def maxcol\n data.cols\n end",
"def ncols\n @colnames.length\n end",
"def length_of_column n\n length_of_largest_cell_in_column n \n end",
"def too_many_cols?; cols.count >= MAX_COL_COUNT; end",
"def length\n columns.length\n end",
"def col_max ## Gets the max columns for other modes.\n return CP::BATTLERS.basic ? 1 : $game_party.max_battle_members\n end",
"def max_identifier_length\n @max_identifier_length ||= select_one('SHOW max_identifier_length', 'SCHEMA'.freeze)['max_identifier_length'].to_i\n end",
"def max_sql_bytesize\n @max_sql_bytesize ||= begin\n case (row = connection.query(\"SHOW VARIABLES LIKE 'max_allowed_packet'\").first)\n when Array\n row[1]\n when Hash\n row['Value']\n else\n raise \"Don't know what to do if connection.query returns a #{row.class}\"\n end.to_i\n end\n end",
"def number_of_columns\n headings_with_rows.map { |r| r.number_of_columns }.max || 0\n end",
"def columns_count\n @columns.size\n end",
"def column_count\n @stmt_api.column_count\n end",
"def last_column\n max = 0\n @data.each do |row|\n max = row.length if max < row.length\n end\n max - 1\n end",
"def num_cols()\n return self[0].length\n end",
"def multi_column_index_limit\n defined?(@multi_column_index_limit) && @multi_column_index_limit || 32\n end",
"def max_field_length\n if fields.is_a? Array\n fields.map { |f| f.to_s.length }.max\n else\n fields.to_s.length\n end\n end",
"def columns\n @columns || 150\n end",
"def table_alias_length\n @table_alias_length ||= (\n postgresql_version >= 80000 ?\n select_one('SHOW max_identifier_length')['max_identifier_length'].to_i :\n 63\n )\n end",
"def count_columns\n fields.size\n end",
"def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def number_of_columns\n return rows.first.length unless rows.empty?\n raise Error, 'your table needs some rows'\n end",
"def last_column\n column( maxcol )\n end",
"def sql_query_length\n 32767\n end",
"def table_alias_length\n @table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to_i : 63)\n end",
"def max_sql_param_length; end",
"def column_name_length\n 31\n end",
"def column_size\n @delegate.getColSize\n end",
"def suggestedNumber\r\n return self.maxLength\r\n end",
"def columns(max: 20)\n (first_column..([last_column, max].min))\n end",
"def size\n @db.get_first_value( \"SELECT COUNT(*) FROM #{TABLE_NAME};\" ).to_i\n end",
"def cols\n @size\n end",
"def max_sql_param_length=(_arg0); end",
"def size\n return 0 if columns.empty?\n\n columns.first.size\n end",
"def column_size\n first_row = @rows[0]\n if first_row._equal?(nil)\n return 0\n end\n first_row.size\n end",
"def num_cols\n col_labels.length\n end",
"def col_max\n return MAX_CATEGORY\n end",
"def size\n @max\n end",
"def num_columns\n score_numbers.count\n end",
"def get_max_field()\n 0\n end",
"def column_count\n visible_column_names().count\n end",
"def size\n Float::MAX.to_i\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def columns\n IO.console.winsize.last\n end",
"def table_size\n @table.size\n end",
"def table_size\n @table.size\n end",
"def row_count\n @stkw_config[:max_row]\n end",
"def specific_max_size(number); end",
"def max_digits size\n (1..size).map{|x| x.to_s.size}.max\n end",
"def maxrow\n data.rows\n end",
"def size\n @max_entries\n end",
"def maximum_width\n @factors.flatten.reject(&:nil?).max.to_s.size\n end",
"def dbsize; end",
"def dbsize; end",
"def calc_computer_col_size\n [\n Move.history.map { |ary| ary[2] }.max_by(&:size).size,\n computer.name.size\n ].max\n end",
"def length_of_largest_single_column_cell_in_column n\n column_with_headings(n).map do |cell|\n if cell.is_a? Hash\n if cell[:colspan] && cell[:colspan] > 1\n 0\n else\n cell[:value].to_s.length\n end\n else\n cell.to_s.length\n end\n end.sort.last\n end",
"def length_of_largest_cell_in_column n\n column_with_headings(n).map do |cell|\n if cell.is_a? Hash\n if cell[:colspan] && cell[:colspan] > 1\n if (cell[:value].to_s.length <= length_of_single_columns_where_multicolumn_is(cell[:start_index],cell[:colspan]))\n 0\n else\n spacing_length = (3 * (cell[:colspan] - 1))\n length_in_columns = (cell[:value].to_s.length - spacing_length)\n (length_in_columns.to_f / cell[:colspan]).ceil\n end\n else\n cell[:value].to_s.length\n end\n else\n cell.to_s.length\n end\n end.sort.last\n end",
"def max_size; end",
"def largest_length\n @executor.getLargestPoolSize\n end",
"def width\n return 0 if columns.empty?\n\n columns.size\n end",
"def columns_count\n @values.empty? ? 0 : @values.first.count\n end",
"def column_number\n env(:column_number).to_i - 1\n end",
"def size\n rows * columns\n end",
"def max_node_value_length\n max_length = 0\n all_node_values_with_nil.each do |value|\n value_length = value.to_s.length\n max_length = value_length if value_length > max_length\n end\n return max_length\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def max_key_width; end",
"def max_width\n breakpoints.last ? breakpoints.last.id.to_s.length : 1\n end",
"def column_count\n is_container? ? get_content_param_by_key( :model_count_in_row ) : 0\n end",
"def max_length\n MAX_LENGTH\n end",
"def length\n @column_families.length\n end",
"def length_of_single_columns_where_multicolumn_is(n,length)\n total_length = 0\n spacing_length = (3 * (length - 1))\n total_length = total_length + spacing_length\n n.upto(n + length - 1) do |i|\n total_length = total_length + length_of_largest_single_column_cell_in_column(i)\n end\n return total_length\n end",
"def columns\n 1\n end",
"def local_maximum_window_size; end",
"def maximum_size\n @ids.size\n end",
"def table_size_for(entry_count); end",
"def find_longest_field\n\t\t\tcurrent_longest = nil\n\t\t\t@api_model.schema.each do |field|\n\t\t\t\tif current_longest == nil || field[0].length > current_longest\n\t\t\t\t\tcurrent_longest = field[0].length\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn current_longest\n\t\tend",
"def limit\n @column[:limit] if @column\n end",
"def num_fields\n IBM_DB.num_fields(@stmt)\n end",
"def max_value_size\n @max_value_size ||= options[:values].max { |a, b| a.size <=> b.size }.size\n end",
"def specific_max_size(number)\n [self.size, number].min\n end",
"def size\n\t\t@rows * @columns\n\tend",
"def item_max; 64; end",
"def column_width\n return @column_width\n end",
"def max\n @max ||= map {|a| a[0].length}.max\n end",
"def allow_more_cols?\n !cols_enum_empty? && cols_enum_ready? && !(cols.values.include?('') || cols.values.include?(nil)) && cols.values.count < MAX_COL_COUNT\n end"
] |
[
"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.68330646",
"0.6825184",
"0.6804654",
"0.67943466",
"0.67723376",
"0.6763244",
"0.6732932",
"0.6618373",
"0.6612837",
"0.658512",
"0.65631396",
"0.65570647",
"0.65414286",
"0.6539925",
"0.6539177",
"0.65210587",
"0.65170056",
"0.6487889",
"0.64829123",
"0.64482254",
"0.64267397",
"0.6400656",
"0.637803",
"0.63754493",
"0.6368989",
"0.6368867",
"0.6359064",
"0.635606",
"0.63487935",
"0.63462836",
"0.6327118",
"0.6315093",
"0.6292001",
"0.6248709",
"0.6236033",
"0.62202626",
"0.62164235",
"0.62164235",
"0.62163335",
"0.62084967",
"0.62084967",
"0.6194773",
"0.6192412",
"0.617786",
"0.6163947",
"0.61605406",
"0.61537904",
"0.61428684",
"0.61428684",
"0.61251086",
"0.61242986",
"0.6123352",
"0.6106421",
"0.60983545",
"0.60957116",
"0.60928303",
"0.60827315",
"0.6067331",
"0.6059822",
"0.6050525",
"0.60489804",
"0.6047136",
"0.60420454",
"0.6041419",
"0.60390085",
"0.6035687",
"0.6028974",
"0.6017156",
"0.5994792",
"0.5985369",
"0.5984973",
"0.59832627",
"0.5974677",
"0.5963177",
"0.5948215",
"0.59457195",
"0.5942777",
"0.5932363",
"0.59269226",
"0.5925598"
] |
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\n return 3\n end",
"def col_max; 1; end",
"def multi_column_index_limit\n defined?(@multi_column_index_limit) && @multi_column_index_limit || 32\n end",
"def max_sql_param_length; end",
"def specific_max_size(number); end",
"def max_sql_param_length=(_arg0); end",
"def too_many_cols?; cols.count >= MAX_COL_COUNT; end",
"def columns=(integer); end",
"def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def col_max() 2 end",
"def max_column\n @columns&.max_by(&:size)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def set_MaxLength(value)\n set_input(\"MaxLength\", value)\n end",
"def table_size=(size)\n @limit = size\n size_check(nil)\n end",
"def max_key_width; end",
"def sql_query_length\n 32767\n end",
"def max_identifier_length\n @max_identifier_length ||= select_one('SHOW max_identifier_length', 'SCHEMA'.freeze)['max_identifier_length'].to_i\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def set_MaxRows(value)\n set_input(\"MaxRows\", value)\n end",
"def max_sql_bytesize\n @max_sql_bytesize ||= begin\n case (row = connection.query(\"SHOW VARIABLES LIKE 'max_allowed_packet'\").first)\n when Array\n row[1]\n when Hash\n row['Value']\n else\n raise \"Don't know what to do if connection.query returns a #{row.class}\"\n end.to_i\n end\n end",
"def col_max\n [(self.width - padding * 2) / 96, 1].max\n end",
"def table_alias_length\n @table_alias_length ||= (\n postgresql_version >= 80000 ?\n select_one('SHOW max_identifier_length')['max_identifier_length'].to_i :\n 63\n )\n end",
"def maximum_limit\n 100\n end",
"def col_max() return 2 end",
"def max_size; end",
"def max_col\n [(@opts.width - 32) / char_width, @max_char].min\n end",
"def max_len_column(j)\n column_collect(j) {|x| x.to_s.length}.max\n end",
"def table_alias_length\n @table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to_i : 63)\n end",
"def specific_max_size(number)\n [self.size, number].min\n end",
"def max_field_length\n if fields.is_a? Array\n fields.map { |f| f.to_s.length }.max\n else\n fields.to_s.length\n end\n end",
"def set_MaxEntries(value)\n set_input(\"MaxEntries\", value)\n end",
"def default_autoincrement_length\n 64\n end",
"def column_name_length\n 31\n end",
"def max_count\n multiple? ? (@schema['max_count'] || :unlimited) : nil\n end",
"def remove_max_length(table, *arr_cn_len)\n execute sql_remove_max_length(table, *arr_cn_len)\n end",
"def cells_per_column limit\n @grpc.cells_per_column_limit_filter = limit\n self\n end",
"def max_key_width=(_arg0); end",
"def max_size\n 1\n end",
"def columns=(n)\n @columns = n\n end",
"def max_size=(_arg0); end",
"def maxsize(value)\n merge(ormaxsize: value.to_s)\n end",
"def limit\n @column[:limit] if @column\n end",
"def default_limit\n 10\n end",
"def local_maximum_window_size; end",
"def columns\n @columns || 150\n end",
"def max_value_size\n @max_value_size ||= options[:values].max { |a, b| a.size <=> b.size }.size\n end",
"def set_max(fields)\n view.update_many(\"$max\" => collect_operations(fields))\n end",
"def default_max_size; end",
"def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end",
"def col_max ## Gets the max columns for other modes.\n return CP::BATTLERS.basic ? 1 : $game_party.max_battle_members\n end",
"def max_length\n MAX_LENGTH\n end",
"def item_max; 64; end",
"def column_options\n { limit: column.limit, default: column.default, null: column.null }\n end",
"def max_length=(value)\n @max_length = value\n end",
"def height=(value)\n @height = if @columns && value <= max_column.size\n max_column.size\n else\n value\n end\n end",
"def set_maxsize(options)\n if options.has_key?(:maxsize) || options.has_key?('maxsize')\n maxsize = options[:maxsize] || options['maxsize']\n\n multiplier = 1\n if (maxsize =~ /\\d+KB/)\n multiplier = 1024\n elsif (maxsize =~ /\\d+MB/)\n multiplier = 1024 * 1024\n elsif (maxsize =~ /\\d+GB/)\n multiplier = 1024 * 1024 * 1024\n end\n\n _maxsize = maxsize.to_i * multiplier\n\n if _maxsize.class != Fixnum and _maxsize.class != Bignum\n raise TypeError, \"Argument 'maxsize' must be an Fixnum\", caller\n end\n if _maxsize == 0\n raise TypeError, \"Argument 'maxsize' must be > 0\", caller\n end\n @maxsize = _maxsize\n else\n @maxsize = 0\n end\n end",
"def dbsize; end",
"def dbsize; end",
"def set_sql_buffer_size(size)\n @config[:sql_buffer_size] = size\n end",
"def set_MaxRecords(value)\n set_input(\"MaxRecords\", value)\n end",
"def set_MaxRecords(value)\n set_input(\"MaxRecords\", value)\n end",
"def set_MaxRecords(value)\n set_input(\"MaxRecords\", value)\n end",
"def limit\n meta.fetch('limit', nil)\n end",
"def max_size\n @max_size ||= options[:max_size] || [DEFAULT_MAX_SIZE, min_size].max\n end",
"def remote_maximum_window_size; end",
"def set_limit(n)\n @limit = n\n end",
"def allow_more_cols?\n !cols_enum_empty? && cols_enum_ready? && !(cols.values.include?('') || cols.values.include?(nil)) && cols.values.count < MAX_COL_COUNT\n end",
"def columns(max: 20)\n (first_column..([last_column, max].min))\n end",
"def defaults # :nodoc:\n self.columns.length.times { |idx|\n }\n end",
"def table_name_length\n 31\n end",
"def limit_value\n length\n end",
"def max_command_length; end",
"def connection_pool_maximum_size\n super\n end",
"def column_name_length\n IDENTIFIER_MAX_LENGTH\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end"
] |
[
"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.64464056",
"0.64464056",
"0.64464056",
"0.64436805",
"0.6439935",
"0.6429192",
"0.6429192",
"0.6429192",
"0.6429192",
"0.6423017",
"0.6414929",
"0.6370591",
"0.6326429",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.6321646",
"0.63008296",
"0.62786704",
"0.6251571",
"0.62507886",
"0.6250741",
"0.62500507",
"0.6230199",
"0.6207052",
"0.61886835",
"0.6129679",
"0.61212194",
"0.611055",
"0.6110253",
"0.610703",
"0.6101883",
"0.6099118",
"0.6094555",
"0.609101",
"0.6076643",
"0.60715216",
"0.6059202",
"0.603386",
"0.5982926",
"0.59783155",
"0.59382474",
"0.5912206",
"0.59070545",
"0.58938265",
"0.5881692",
"0.58767027",
"0.5870038",
"0.58584917",
"0.58271223",
"0.5810267",
"0.5797518",
"0.57430434",
"0.57256675",
"0.57250434",
"0.57250434",
"0.5720504",
"0.57188267",
"0.57188267",
"0.57188267",
"0.57118577",
"0.5709847",
"0.57097155",
"0.5707534",
"0.5701645",
"0.56999093",
"0.5684223",
"0.56770676",
"0.5676802",
"0.56753063",
"0.5667357",
"0.5654863",
"0.56487066"
] |
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}\" }.join(', ')\n\n sql << \" ORDER BY #{order}\"\n end",
"def execute_union_with_order(options = {})\n execute_sql(union_with_order(options))\n end",
"def order_union_sentence(*args)\n @union_query_elements ||= {}\n @union_query_elements[:order] = \" ORDER BY \" + order_union_attributes(*args).join(', ')\n end",
"def select_sql\n return super unless o = @opts[:offset]\n raise(Error, \"#{db.database_type} requires an order be provided if using an offset\") unless order = @opts[:order]\n dsa1 = dataset_alias(1)\n rn = row_number_column\n sql = @opts[:append_sql] || ''\n subselect_sql_append(sql, unlimited.\n unordered.\n select_append{ROW_NUMBER(:over, :order=>order){}.as(rn)}.\n from_self(:alias=>dsa1).\n limit(@opts[:limit]).\n where(SQL::Identifier.new(rn) > o).\n order(rn))\n sql\n end",
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def group_by_sort_clause\n return nil unless grouped?\n order_clause group_by, \n (default_order_for(group_by) || :asc), \n (sortable_for(group_by) || true)\n end",
"def order_by(opt)\n raise ArgumentError, \"invalid order by value\" unless %w(sld tld nsstatus expdate renew).include?(opt)\n @options['orderby'] = opt\n self\n end",
"def order(expr)\n from(default_table).order(expr)\n end",
"def select_sql\n return super unless o = @opts[:offset]\n raise(Error, 'MSSQL requires an order be provided if using an offset') unless order = @opts[:order]\n dsa1 = dataset_alias(1)\n dsa2 = dataset_alias(2)\n rn = row_number_column\n unlimited.\n unordered.\n from_self(:alias=>dsa2).\n select{[WILDCARD, ROW_NUMBER(:over, :order=>order){}.as(rn)]}.\n from_self(:alias=>dsa1).\n limit(@opts[:limit]).\n where(rn > o).\n select_sql\n end",
"def ordering_query\n \"#{sql_length}(#{slug_column}) ASC, #{slug_column} ASC\"\n end",
"def sorting(order_column, options)\n sandbox = options[:sandbox]\n published(sandbox.nil?).interval(options[:interval], sandbox).order_by(order_column)\n end",
"def ordering_sql_string\n\t\tif order\n\t\t\torder.collect{|col,dir| absolute_column_name( col ) + ((dir.eql?(:asc))?(''):(' DESC')) if item_class.column_names.include?( col ) }.compact.join(',')\n\t\tend\n\tend",
"def agregate_order_by(params, options)\n case params[:order_by].to_s\n when \"direction\" then\n order_by = \"destinations.direction_code\"\n when \"destination\" then\n order_by = \"destinations.name\"\n when \"customer_orig\" then\n order_by = \"nice_user\"\n when \"customer_term\" then\n order_by = \"terminators.name\"\n when \"billed_orig\" then\n order_by = \"originating_billed\"\n when \"billed_term\" then\n order_by = \"terminating_billed\"\n when \"billsec_orig\" then\n order_by = \"originating_billsec\"\n when \"billsec_term\" then\n order_by = \"terminating_billsec\"\n when \"duration\" then\n order_by = \"duration\"\n when \"answered_calls\" then\n order_by = \"answered_calls\"\n when \"total_calls\" then\n order_by = \"total_calls\"\n when \"asr\" then\n order_by = \"asr\"\n when \"acd\" then\n order_by = \"acd\"\n else\n options[:order_by] ? order_by = options[:order_by] : order_by = \"\"\n end\n\n without = order_by\n order_by = \"users.first_name \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", users.last_name\" if order_by.to_s == \"users.first_name\"\n order_by = \"ds.direction_code \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", ds.name\" if order_by.to_s == \"destinations.name\"\n order_by = \"ds.direction_code \" + (options[:order_desc] == 1 ? \"DESC\" : \"ASC\") + \", ds.subcode\" if order_by.to_s == \"destinations.name\"\n order_by = \"t.name\" if order_by.to_s == \"terminators.name\"\n\n order_by += \" ASC\" if options[:order_desc] == 0 and order_by != \"\"\n order_by += \" DESC\" if options[:order_desc] == 1 and order_by != \"\"\n return without, order_by\n end",
"def remove_invalid_ordering_from_select_statement(node)\n return unless Arel::Nodes::SelectStatement === node\n\n node.orders = [] unless node.offset || node.limit\n end",
"def distinct(columns, order_by) #:nodoc:\n return \"DISTINCT #{columns}\" if order_by.blank?\n\n # Construct a clean list of column names from the ORDER BY clause, removing\n # any ASC/DESC modifiers\n order_columns = order_by.split(',').collect { |s| s.split.first }\n order_columns.delete_if { |c| c.blank? }\n order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| \"#{s} AS alias_#{i}\" }\n\n # Return a DISTINCT ON() clause that's distinct on the columns we want but includes\n # all the required columns for the ORDER BY to work properly.\n sql = \"DISTINCT ON (#{columns}) #{columns}, \"\n sql << order_columns * ', '\n end",
"def query_sort(query, table, *order_by_params)\n\tquery = \"select #{query} from #{table}\"\n\tif order_by_params != nil\n\t\tquery += \" order by\"\n\t\torder_by_params.each do |param|\n\t\t\tquery += \" #{param}\"\n\t\tend\n\tend\n\treturn query\nend",
"def ordered_expression_sql(oe)\n \"#{literal(oe.expression)} #{oe.descending ? 'DESC' : 'ASC'}\"\n end",
"def ordered_by(statement)\n @expected_options[:order] = statement\n self\n end",
"def order_clause\n col = case sort_params[:sort_col]\n when 'title'\n 'data_management_plans.title'\n when 'funder'\n 'affiliations_fundings.name'\n else\n 'data_management_plans.updated_at'\n end\n { \"#{col}\": :\"#{sort_params[:sort_dir]}\" }\n end",
"def sort_clause\n sorter.to_sql\n end",
"def ordering_query; end",
"def order(*args)\r\n args.map!{ |arg| arg.is_a?(Hash) ? arg.map{ |k,v| \"#{k} #{v.upcase}\"} : arg }\r\n order = args.flatten(2).join(\", \")\r\n\r\n rows = connection.execute <<-SQL\r\n SELECT * FROM #{table}\r\n ORDER BY #{order};\r\n SQL\r\n\r\n rows_to_array(rows)\r\n end",
"def search_get_order_select_sql(sort_by, order_by, default)\n sql = []\n\n sort_by.each_with_index do |value, index|\n next if value.blank?\n next if order_by[index].blank?\n\n sql.push( \"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)}\" )\n end\n\n if sql.blank?\n sql.push(\"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(default)}\")\n end\n\n sql.join(', ')\n end",
"def apply_distinct_on_eager_limit_strategy(ds)\n keys = predicate_key\n ds.distinct(*keys).order_prepend(*keys)\n end",
"def order(*args)\n with_opts(:order=>args.freeze)\n end",
"def select_clause_order\n SELECT_CLAUSE_ORDER\n end",
"def order(*args)\n order_union_sentence(*args)\n self\n end",
"def apply_search_order( ds, options )\n\t\tif (( fields = options[:order] ))\n\t\t\tds = ds.to_a.sort_by do |uuid|\n\t\t\t\t@storage[ uuid ].values_at( *fields.compact ).map {|val| val || ''}\n\t\t\tend\n\t\tend\n\n\t\treturn ds\n\tend",
"def __sort_option__\n multi.inject({}) do |options, criteria|\n options.merge!(criteria.__sort_pair__)\n options\n end\n end",
"def order(order)\n attribute, order_type = order.gsub(/\\s+/, ' ').split(' ')\n raise 'Invalid attribute in order clause' unless (model.attributes.keys + ['id', 'created_at']).include?(attribute)\n\n attribute = model.map_to_syncano_attribute(attribute)\n order_type = order_type.to_s.downcase == 'desc' ? 'DESC' : 'ASC'\n\n self.parameters.merge!({ order_by: attribute, order: order_type })\n\n self\n end",
"def order(ordering=nil)\n @options[:order] = ordering if ordering.kind_of?(String)\n end",
"def distinct(columns, order_by)\n return \"DISTINCT #{columns}\" if order_by.blank?\n\n # construct a valid DISTINCT clause, ie. one that includes the ORDER BY columns, using\n # FIRST_VALUE such that the inclusion of these columns doesn't invalidate the DISTINCT\n order_columns = order_by.split(',').map { |s| s.strip }.reject(&:blank?)\n order_columns = order_columns.zip((0...order_columns.size).to_a).map do |c, i|\n \"FIRST_VALUE(#{c.split.first}) OVER (PARTITION BY #{columns} ORDER BY #{c}) AS alias_#{i}__\"\n end\n sql = \"DISTINCT #{columns}, \"\n sql << order_columns * \", \"\n end",
"def order_more(*order)\n order(*((@opts[:order] || []) + order))\n end",
"def sort_criteria_clause\n return nil unless sort_criteria.present?\n sort_criteria.map { |name, order| order_clause(name, order) if name != group_by }.reject(&:blank?).join(',')\n end",
"def order!(&blk) options.order!(self, &blk) end",
"def order()\n @options[:order] || DEF_LAST_ORDER\n end",
"def order(sorts = {})\n clone.tap { |query| query.sorts = sorts }\n end",
"def joins_for_order_statement(order_options)\n joins = []\n\n if order_options\n if order_options.include?('authors')\n joins << \"LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id\"\n end\n order_options.scan(/cf_\\d+/).uniq.each do |name|\n column = available_columns.detect {|c| c.name.to_s == name}\n join = column && column.custom_field.join_for_order_statement\n if join\n joins << join\n end\n end\n end\n\n joins.any? ? joins.join(' ') : nil\n end",
"def set_conditions_and_sort_order(query, sdb_type)\n conditions = [\"simpledb_type = '#{sdb_type}'\"]\n # look for query.order.first and insure in conditions\n # raise if order if greater than 1\n\n if query.order && query.order.length > 0\n query_object = query.order[0]\n #anything sorted on must be a condition for SDB\n conditions << \"#{query_object.property.name} IS NOT NULL\" \n order = \"order by #{query_object.property.name} #{query_object.direction}\"\n else\n order = \"\"\n end\n\n query.conditions.each do |operator, attribute, value|\n operator = case operator\n when :eql then '='\n when :not then '!='\n when :gt then '>'\n when :gte then '>='\n when :lt then '<'\n when :lte then '<='\n else raise \"Invalid query operator: #{operator.inspect}\" \n end\n conditions << \"#{attribute.name} #{operator} '#{value}'\"\n end\n [conditions,order]\n end",
"def order!(*args)\n args.flatten!\n validate_order_args args\n\n references = args.reject { |arg|\n Arel::Node === arg || Squeel::Nodes::Node === arg\n }\n references.map! { |arg| arg =~ /^([a-zA-Z]\\w*)\\.(\\w+)/ && $1 }.compact!\n references!(references) if references.any?\n\n # if a symbol is given we prepend the quoted table name\n args = args.map { |arg|\n arg.is_a?(Symbol) ?\n Arel::Nodes::Ascending.new(klass.arel_table[arg]) :\n arg\n }\n\n self.order_values += args\n self\n end",
"def order_with(expr)\n unless expr.is_a?(String)\n raise \"must call FatTable::Table\\#order_with with a single string expression\"\n end\n\n rev = false\n if expr.match?(/\\s*!\\s*\\z/)\n rev = true\n expr = expr.sub(/\\s*!\\s*\\z/, '')\n end\n sort_sym = rev ? :sort_key! : :sort_key\n dup.select(*headers, sort_key: expr).order_by(sort_sym)\n end",
"def order(name, direction = :asc, as: nil, sort: nil, sql_column: nil, limit: nil, reorder: false)\n raise 'expected relation to be present' unless relation\n\n sql_column ||= sql_column(name)\n sql_type = (as || sql_type(name))\n\n association = associated(name)\n sql_direction = sql_direction(direction)\n @relation = relation.reorder(nil) if reorder\n\n case sql_type\n when :belongs_to\n relation\n .order(Arel.sql(\"#{is_null(sql_column)} ASC\"))\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n when :belongs_to_polymorphic\n relation\n .order(Arel.sql(\"#{sql_column}_type #{sql_direction}\"))\n .order(Arel.sql(\"#{sql_column}_id #{sql_direction}\"))\n when :has_and_belongs_to_many, :has_many, :has_one\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_addresses\n relation\n .order(order_by_associated_conditions(associated(:addresses), sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_roles\n relation.order(Arel.sql(\"#{sql_column(:roles_mask)} #{sql_direction}\"))\n when :string, :text\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column}='' ASC, #{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n when :time\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"EXTRACT(hour from #{sql_column}) #{sql_direction}, EXTRACT(minute from #{sql_column}) #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n else\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n end\n end",
"def order(criteria, relation)\n return relation unless criteria.order?\n order_str = convert_order_exprs(criteria.order_by)\n relation.order(order_str)\n end",
"def order_by(column, order)\n return resource().order(column.to_s + \" \" + order)\n end",
"def sort_order # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n col = sort_column\n # do a case-insensitive sort if we are sort on last name\n col = \"lower(#{col})\" if col.include?('last_name')\n return Arel.sql(\"#{col} #{sort_direction}\") unless col.include?('enumerations')\n\n klass, method = col.split('.')\n values = klass.singularize.capitalize.constantize.send(method.intern)\n .order(Arel.sql(\"value #{sort_direction} \")).pluck('value')\n order_query = values.each_with_index.inject(+'CASE ') do |memo, (val, i)| # rubocop:disable Style/EachWithObject\n memo << \"WHEN( enumerations.value = '#{val}') THEN #{i} \"\n memo\n end\n Arel.sql(\"#{order_query} ELSE #{values.length} END\")\n end",
"def search_get_order_sql(sort_by, order_by, default)\n sql = []\n\n sort_by.each_with_index do |value, index|\n next if value.blank?\n next if order_by[index].blank?\n\n sql.push( \"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(value)} #{order_by[index]}\" )\n end\n\n if sql.blank?\n sql.push(\"#{ActiveRecord::Base.connection.quote_table_name(table_name)}.#{ActiveRecord::Base.connection.quote_column_name(default)}\")\n end\n\n sql.join(', ')\n end",
"def order(*args)\n @options[:order] << args\n end",
"def order(name, direction = :asc, as: nil, sort: nil, sql_column: nil, limit: nil, reorder: false)\n raise 'expected relation to be present' unless relation\n\n sql_column ||= sql_column(name)\n sql_type = (as || sql_type(name))\n\n association = associated(name)\n sql_direction = sql_direction(direction)\n @relation = relation.reorder(nil) if reorder\n\n case sql_type\n when :belongs_to\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n when :belongs_to_polymorphic\n relation\n .order(Arel.sql(\"#{sql_column}_type #{sql_direction}\"))\n .order(Arel.sql(\"#{sql_column}_id #{sql_direction}\"))\n when :has_and_belongs_to_many, :has_many, :has_one\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_addresses\n relation\n .order(order_by_associated_conditions(associated(:addresses), sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :active_storage\n relation\n .send(\"with_attached_#{name}\")\n .references(\"#{name}_attachment\")\n .order(Arel.sql(\"active_storage_blobs.filename #{sql_direction}\"))\n when :effective_roles\n relation\n .order(Arel.sql(\"#{sql_column(:roles_mask)} #{sql_direction}\"))\n when :time\n relation\n .order(Arel.sql(\"EXTRACT(hour from #{sql_column}) #{sql_direction}, EXTRACT(minute from #{sql_column}) #{sql_direction}\"))\n when :string, :text\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column}='' ASC, #{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n when :date, :datetime\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n else\n relation\n .order(Arel.sql(\"#{sql_column} #{sql_direction}\"))\n end\n end",
"def group_by_sort_order\n if grouped? && (column = group_by_column)\n order = sort_criteria_order_for(column.name) || column.default_order\n column.sortable.is_a?(Array) ?\n column.sortable.collect {|s| \"#{s} #{order}\"}.join(',') :\n \"#{column.sortable} #{order}\"\n end\n end",
"def order_by(*props)\n @query[:order_by] = props.join(',')\n self\n end",
"def columns_for_distinct(columns, orders)\n # Lifted from the default Postgres implementation\n order_columns = orders.map{ |s|\n # Convert Arel node to string\n s = s.to_sql unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(ASC|DESC)\\s*(NULLS\\s+(FIRST|LAST)\\s*)?/i, '')\n }.reject(&:blank?).map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n [super, *order_columns].join(', ')\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n end",
"def order_by_cached_appeal_priority_clause\n Arel.sql(<<-SQL)\n (CASE\n WHEN cached_appeal_attributes.case_type = 'Court Remand' THEN 1\n ELSE 0\n END) DESC,\n cached_appeal_attributes.is_aod DESC,\n cached_appeal_attributes.docket_number ASC\n SQL\n end",
"def to_sparql(**options)\n \"ASC(#{operands.last.to_sparql(**options)})\"\n end",
"def apply_sorting_to_relation(rel)\n return rel if !params[:sort]\n\n sorts = params[:sort].split(',')\n\n sorts.each do |sort|\n if sort =~ /^([-+]?)(.*)$/\n desc = ($1 && $1 == '-')\n attrname = $2\n\n (attr, path) = rel.nested_attribute(attrname)\n\n rel = rel.joins { path[1..-1].inject(self.__send__(path[0]).outer) { |a,x| a.__send__(x).outer } } if path.any?\n\n # Call .asc explicitly to overcome a bug in pgsql adapter leading to undefined method to_sql\n attr = desc ? attr.desc : attr.asc\n\n rel = rel.order(attr)\n end\n end\n\n rel\n end",
"def build_subselect(key, o)\n subselect = super\n\n # Materialize subquery by adding distinct\n # to work with MySQL 5.7.6 which sets optimizer_switch='derived_merge=on'\n unless has_limit_or_offset_or_orders?(subselect)\n core = subselect.cores.last\n core.set_quantifier = Arel::Nodes::Distinct.new\n end\n\n Nodes::SelectStatement.new.tap do |stmt|\n core = stmt.cores.last\n core.froms = Nodes::Grouping.new(subselect).as(\"__active_record_temp\")\n core.projections = [Arel.sql(quote_column_name(key.name))]\n end\n end",
"def select_sql\n return super unless l = @opts[:limit]\n o = @opts[:offset] || 0\n order = @opts[:order]\n dsa1 = dataset_alias(1)\n dsa2 = dataset_alias(2)\n rn = row_number_column\n irn = Sequel::SQL::Identifier.new(rn).qualify(dsa2)\n subselect_sql(unlimited.\n from_self(:alias=>dsa1).\n select_more(Sequel::SQL::QualifiedIdentifier.new(dsa1, WILDCARD),\n Sequel::SQL::WindowFunction.new(SQL::Function.new(:ROW_NUMBER), Sequel::SQL::Window.new(:order=>order)).as(rn)).\n from_self(:alias=>dsa2).\n select(Sequel::SQL::QualifiedIdentifier.new(dsa2, WILDCARD)).\n where((irn > o) & (irn <= l + o)))\n end",
"def order_with_pinned_sql\n -\"CASE\n WHEN (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))\n THEN topics.pinned_at + interval '9999 years'\n ELSE topics.bumped_at\n END DESC\"\n end",
"def columns_for_distinct(columns, orders) #:nodoc:\n order_columns = orders.reject(&:blank?).map{ |s|\n # Convert Arel node to string\n s = s.to_sql unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(?:ASC|DESC)\\b/i, '')\n .gsub(/\\s+NULLS\\s+(?:FIRST|LAST)\\b/i, '')\n }.reject(&:blank?).map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n (order_columns << super).join(', ')\n end",
"def joins_for_order_statement(order_options)\n joins = []\n\n if order_options\n if order_options.include?('authors')\n joins << \"LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{Meeting.table_name}.author_id\"\n end\n end\n\n joins.any? ? joins.join(' ') : nil\n end",
"def order_union_attributes(*args)\n arguments = preprocess_order_args(args)\n arguments.flat_map do |arg|\n case arg\n when String, Symbol\n arg\n when Hash\n arg.map do |field, order|\n [:asc, :desc].include?(order.to_sym.downcase) ? \"#{field.to_s} #{order.to_s.upcase}\" : field.to_s\n end\n end\n end\n end",
"def order_by(*args)\n clone.tap do |crit|\n arguments = args.size == 1 ? args.first : args\n setup_sort_options(crit.options) unless args.first.nil?\n if arguments.is_a?(Array)\n #[:name, :asc]\n if arguments.size == 2 && (arguments.first.is_a?(Symbol) || arguments.first.is_a?(String))\n build_order_options(arguments, crit)\n else\n arguments.each { |argument| build_order_options(argument, crit) }\n end\n else\n build_order_options(arguments, crit)\n end\n end\n end",
"def order(order_str:)\n @order_by = \"ORDER BY #{order_str}\"\n end",
"def selects_all_bears_names_and_orders_in_alphabetical_order\n 'SELECT bears.name FROM bears ORDER BY name'\nend",
"def reorder(*args)\n query = copy\n\n query.remove_clause_class(OrderClause)\n query.order(*args)\n end",
"def order_by(ids, klass=nil)\n column = namespaced_column(:id, klass)\n if ids.empty?\n nil\n elsif ::ActiveRecord::Base.is_mysql_adapter?\n \"FIELD(#{column},#{ids.join(',')})\"\n else\n order = ''\n ids.each_index { |i| order << \"WHEN #{column}=#{ids[i]} THEN #{i+1} \" }\n \"CASE \" + order + \" END\"\n end\n end",
"def apply_criteria_options\n if spec = criteria.options[:sort]\n query.sort(spec)\n end\n if spec = criteria.options[:fields]\n query.select(spec)\n end\n end",
"def sort_order(order)\n \"#{(params[:order] || order.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:direction] == 'up' ? 'ASC' : 'DESC'}\"\n end",
"def to_cql\n \"ORDER BY #{@field} #{@dir.to_s.upcase}\"\n end",
"def arrange options = {}\n if (order = options.delete(:order))\n arrange_nodes ancestry_base_class.order(order).where(options)\n else\n arrange_nodes ancestry_base_class.where(options)\n end\n end",
"def _primary_key_order\n if @opts[:order].nil? && model && (pk = model.primary_key)\n cached_dataset(:_pk_order_ds){order(*pk)}\n end\n end",
"def _primary_key_order\n if @opts[:order].nil? && model && (pk = model.primary_key)\n cached_dataset(:_pk_order_ds){order(*pk)}\n end\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n\n # Redefine the `to_a` method to the original one\n #\n sql_records.instance_exec do\n define_singleton_method(:to_a) do\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4\n self.load\n else\n self.__send__(:exec_queries)\n end\n @records\n end\n end\n\n sql_records\n end",
"def order_nocategory_with_pinned_sql\n -\"CASE\n WHEN topics.pinned_globally\n AND (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))\n THEN topics.pinned_at + interval '9999 years'\n ELSE topics.bumped_at\n END DESC\"\n end",
"def columns_for_distinct(columns, orders) #:nodoc:\n order_columns = orders.reject(&:blank?).map{ |s|\n # Convert Arel node to string\n s = s.to_sql unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(?:ASC|DESC)\\b/i, '')\n .gsub(/\\s+NULLS\\s+(?:FIRST|LAST)\\b/i, '')\n }.reject(&:blank?).map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n [super, *order_columns].join(', ')\n end",
"def select_sql\n return super unless o = @opts[:offset]\n l = @opts[:limit]\n order = @opts[:order]\n dsa1 = dataset_alias(1)\n dsa2 = dataset_alias(2)\n rn = row_number_column\n irn = Sequel::SQL::Identifier.new(rn).qualify(dsa2)\n subselect_sql(unlimited.\n from_self(:alias=>dsa1).\n select_more(Sequel::SQL::QualifiedIdentifier.new(dsa1, WILDCARD),\n Sequel::SQL::WindowFunction.new(SQL::Function.new(:ROW_NUMBER), Sequel::SQL::Window.new(:order=>order)).as(rn)).\n from_self(:alias=>dsa2).\n select(Sequel::SQL::QualifiedIdentifier.new(dsa2, WILDCARD)).\n where(l ? ((irn > o) & (irn <= l + o)) : (irn > o))) # Leave off limit in case of limit(nil, offset)\n end",
"def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end",
"def order(*order)\n clone(:order => (order.compact.empty?) ? nil : order)\n end",
"def include_eager_order?(options)\n order = options[:order]\n return false unless order\n order.scan(/([\\.\\w]+)\\.[\\[\"]?\\w+[\\]\"]?/).flatten.any? do |order_table_name|\n order_table_name != table_name\n end\n end",
"def sort_and_order_sql\n {:sort => ATTACH_MAPPING[@sort], :order => @order}\n end",
"def distinct(columns, orders) #:nodoc:\n return \"DISTINCT #{columns}\" if orders.empty?\n\n # Construct a clean list of column names from the ORDER BY clause, removing\n # any ASC/DESC modifiers\n order_columns = orders.collect { |s| s.gsub(/\\s+(ASC|DESC)\\s*/i, '') }.\n reject(&:blank?)\n order_columns = order_columns.\n zip((0...order_columns.size).to_a).map { |s,i| \"#{s} AS alias_#{i}\" }\n\n \"DISTINCT #{columns}, #{order_columns * ', '}\"\n end",
"def scaffold_select_order_association(association)\n scaffold_associated_class(association).scaffold_select_order(:association)\n end",
"def columns_for_distinct(columns, orders) # :nodoc:\n order_columns = orders.compact_blank.map { |s|\n # Convert Arel node to string\n s = visitor.compile(s) unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(?:ASC|DESC)\\b/i, \"\")\n }.compact_blank.map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n (order_columns << super).join(\", \")\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n\n # Redefine the `to_a` method to the original one\n #\n sql_records.instance_exec do\n define_singleton_method(:to_a) do\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4\n self.load\n else\n self.__send__(:exec_queries)\n end\n @records\n end\n end\n\n sql_records\n end",
"def adhoc_select(list, selection)\n sorted_list = adhoc_sort(list)\n return sorted_list[selection]\n end",
"def group_by_sort_order\n if grouped? && (column = group_by_column)\n column.sortable.is_a?(Array) ?\n column.sortable.collect {|s| \"#{s} #{column.default_order}\"}.join(',') :\n \"#{column.sortable} #{column.default_order}\"\n end\n end",
"def true_eager_graph_limit_strategy\n if associated_class.dataset.supports_ordered_distinct_on? && !offset\n :distinct_on\n else\n super\n end\n end",
"def setup_sort_options(options)\n options[:sort] = options[:sort] ? options[:sort].dup : []\n end",
"def order(*argv, into: nil, &nonopt)\n argv = argv[0].dup if argv.size == 1 and Array === argv[0]\n order!(argv, into: into, &nonopt)\n end",
"def all_eager_by_user_id_and_aggregate_id_ordered_by_position(user_id, aggregate_id, order: 'matches.id')\n aggregate = Aggregate.find(aggregate_id)\n aggregate_ids = aggregate.has_groups? ? aggregate.groups.pluck(:id) : aggregate_id\n\n Tip.includes(match: [:team_1, :team_2]).\n where('tips.user_id' => user_id, 'matches.aggregate_id' => aggregate_ids).\n order(order)\n end",
"def sorted_association_options_find(association, conditions = nil, record = nil)\n options = association_options_find(association, conditions, nil, record)\n column = column_for_association(association, record)\n unless column&.sort && column.sort&.dig(:sql)\n method = column.options[:label_method] if column\n options = options.sort_by(&(method || :to_label).to_sym)\n end\n options\n end",
"def ordering_by\n order && order.to_s.gsub(/^(ascend|descend)_by_/, '')\n end",
"def order_sql(sort_priorities)\n base = \"UPDATE categories\n SET sort_priority = CASE id\\n\"\n\n update_statements = sort_priorities.reduce(base) do |sql, (cat_id, priority)|\n sql + \"WHEN #{cat_id} THEN #{priority}\\n\"\n end\n\n update_statements + \"END\\n WHERE id IN (#{sort_priorities.keys.join(\",\")});\"\n end",
"def convert_sort_order(order)\n return nil if order.blank?\n o = order.clone\n SORT_ORDER_ALIASES.each_pair do|value_alias, real_value|\n o.gsub!(value_alias, real_value)\n end\n o\n end",
"def set_sort_order(opts)\n opts = check_params(opts,[:orders])\n super(opts)\n end",
"def sorted_with_order\n # Identify groups of nodes that can be executed concurrently\n groups = tsort_each.slice_when { |a, b| parents(a) != parents(b) }\n\n # Assign order to each node\n i = 0\n groups.flat_map do |group|\n group_with_order = group.product([i])\n i += group.size\n group_with_order\n end\n end",
"def sort_by(options)\n self.sort = options\n end",
"def random_weighted_order_clause(ranking_column, opts={})\n connection = opts[:connection]\n\n if connection.adapter_name =~ /sqlite/i\n # computer multiplication is faster than division I was once taught...so translate here\n max_int = 9223372036854775807.0\n multiplier = 1.0 / max_int\n \"(#{ranking_column} * ABS(#{random_for(opts)} * #{multiplier}) ) DESC\"\n else\n \"(#{ranking_column} * #{random_for(opts)}) DESC\"\n end\n end"
] |
[
"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.5273461",
"0.5250792",
"0.5216791",
"0.5197942",
"0.5182182",
"0.5182005",
"0.517513",
"0.5128593",
"0.51146495",
"0.510508",
"0.51000756",
"0.50985366",
"0.50853264",
"0.5079691",
"0.507868",
"0.5058557",
"0.5054601",
"0.50190896",
"0.5000439",
"0.4997727",
"0.4955539",
"0.49362504",
"0.49220848",
"0.49117598",
"0.4911696",
"0.49098235",
"0.49088976",
"0.48886624",
"0.4886767",
"0.48845688",
"0.486995",
"0.48594865",
"0.48577052",
"0.48560676",
"0.4851092",
"0.4848324",
"0.48464",
"0.48387918",
"0.48373386",
"0.48303026",
"0.48164725",
"0.48132035",
"0.4806784",
"0.48029193",
"0.4796328",
"0.47901574",
"0.4789538",
"0.47795177",
"0.4760369",
"0.47584105",
"0.47584105",
"0.4749704",
"0.47447732",
"0.47439647",
"0.47438014",
"0.47406638",
"0.4709234",
"0.4708498",
"0.4695305",
"0.4693957",
"0.46883407",
"0.46852386",
"0.4684188",
"0.46694136",
"0.46656466",
"0.4664559",
"0.46638647",
"0.46580645",
"0.46530816",
"0.4639365",
"0.46387327",
"0.46378624",
"0.462547",
"0.46143883",
"0.46077168",
"0.4598706",
"0.459435"
] |
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_columns(name => value)\n end",
"def update_column(name, value)\n update_columns(name => value)\n end",
"def update_column(name, value)\n update_columns(name => value)\n end",
"def rename_column(table_name, column_name, new_column_name)\n execute \"ALTER TABLE #{quote_table_name(table_name)} ALTER #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}\"\n end",
"def column=(_); end",
"def rename_column(table_name, column_name, new_column_name, options = {}) #:nodoc:\n column_info = select_one(\"SHOW FULL FIELDS FROM #{table_name} LIKE '#{column_name}'\")\n current_type = column_info[\"Type\"]\n options[:comment] ||= column_info[\"Comment\"]\n sql = \"ALTER TABLE #{table_name} CHANGE #{column_name} #{new_column_name} #{current_type}\"\n sql << \" COMMENT #{quote(options[:comment])}\" unless options[:comment].blank?\n execute sql\n end",
"def rename_column(table_name, column_name, new_column_name) #:nodoc:\n clear_cache!\n execute \"ALTER TABLE #{quote_table_name(table_name)} RENAME COLUMN #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}\"\n end",
"def change_column(table_name, column_name, type, options = {})\n execute(\n \"ALTER TABLE #{quote_table_name(table_name)} \"+\n \"ALTER COLUMN #{quote_column_name(column_name)} \"+\n \"SET DATA TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\",\n SCHEMA_LOG_NAME\n )\n change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)\n change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)\n end",
"def rename_column(table_name, column_name, new_column_name)\n execute \"ALTER TABLE #{quote_table_name(table_name)} RENAME COLUMN #{quote_column_name(column_name)} TO #{quote_column_name(new_column_name)}\"\n end",
"def rename_column(table_name, old_name, new_name)\n column_functional(table_name) do\n rename_table_column(old_name, new_name)\n end\n end",
"def change_column(table_name, column_name, type, options = {})\n sql = \"ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\"\n add_column_options!(sql, options)\n execute(sql)\n end",
"def change_column(table_name, column_name, type, options = {})\n clear_cache!\n quoted_table_name = quote_table_name(table_name)\n sql_type = type_to_sql(type, options[:limit], options[:precision], options[:scale])\n sql = \"ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{sql_type}\"\n sql << \" USING #{options[:using]}\" if options[:using]\n if options[:cast_as]\n sql << \" USING CAST(#{quote_column_name(column_name)} AS #{type_to_sql(options[:cast_as], options[:limit], options[:precision], options[:scale])})\"\n end\n execute sql\n\n change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)\n change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)\n end",
"def rename_column(table, *args)\n alter_table(table) {rename_column(*args)}\n end",
"def rename_column(table, *args)\n alter_table(table) {rename_column(*args)}\n end",
"def change_column_value(column, value)\n cc = changed_columns\n cc << column unless cc.include?(column)\n @values[column] = value\n end",
"def change_column_value(column, value)\n cc = changed_columns\n cc << column unless cc.include?(column)\n @values[column] = value\n end",
"def rename_column(table_name, column_name, new_column_name)\n execute \"exec sp_rename '#{table_name}.#{column_name}', '#{new_column_name}'\"\n end",
"def column=(col)\n @columns[@name] = [col.to_s, {}]\n end",
"def update_cell(column, value)\n table_name = self.class.to_s.pluralize.underscore\n return CONNECTION.execute(\"UPDATE #{table_name} SET #{column} = '#{value}' WHERE id = #{@id}\")\n end",
"def set_column\n @column = Column.find(params[:id])\n end",
"def set_column\n @column = Column.find(params[:id])\n end",
"def set_column\n @column = Column.find_by(id: params[:id], board: @board)\n end",
"def []=(column, value)\n if @table.indices.include? column\n add_to_index(column, value)\n end\n @attributes[column] = value\n end",
"def change_column(table_name, column_name, type, options = {})\n quoted_table_name = quote_table_name(table_name)\n\n begin\n execute \"ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\"\n rescue ActiveRecord::StatementInvalid => e\n begin\n begin_db_transaction\n tmp_column_name = \"#{column_name}_ar_tmp\"\n add_column(table_name, tmp_column_name, type, options)\n execute \"UPDATE #{quoted_table_name} SET #{quote_column_name(tmp_column_name)} = CAST(#{quote_column_name(column_name)} AS #{type_to_sql(type, options[:limit], options[:precision], options[:scale])})\"\n remove_column(table_name, column_name)\n rename_column(table_name, tmp_column_name, column_name)\n commit_db_transaction\n rescue\n rollback_db_transaction\n end\n end\n\n change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)\n change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)\n end",
"def change(column_name, type, **options)\n raise_on_if_exist_options(options)\n @base.change_column(name, column_name, type, **options)\n end",
"def rename_column(old_col_name, new_col_name)\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n raise \"Cannot rename recno column!\" if old_col_name == :recno\r\n raise \"Cannot give column name of recno!\" if new_col_name == :recno\r\n\r\n raise 'Invalid column name to rename: ' % old_col_name unless \\\r\n @field_names.include?(old_col_name)\r\n \r\n raise 'New column name already exists: ' % new_col_name if \\\r\n @field_names.include?(new_col_name)\r\n\r\n @db.engine.rename_column(self, old_col_name, new_col_name)\r\n\r\n # Need to reinitialize the table instance and associated indexes.\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n\r\n update_header_vars\r\n create_indexes\r\n create_table_class unless @db.server?\r\n end",
"def column!( column )\n columns && Mtx.synchronize { @columns << column }\n end",
"def update_column name, value\n name = name.to_s\n self.dynamic_record.send \"#{name}=\", value\n self.raw_write_attribute name, value\n end",
"def []=(column_number_or_name, value)\n begin\n ole_cell = ole_table.Application.Intersect(\n @ole_tablerow.Range, ole_table.ListColumns.Item(column_number_or_name).Range)\n ole_cell.Value = value\n rescue WIN32OLERuntimeError\n raise TableRowError, \"could not assign value #{value.inspect} to cell at column #{column_number_or_name}\\n#{$!.message}\"\n end\n end",
"def set_tm_table_column\n @tm_table_column = TmTableColumn.find(params[:id])\n end",
"def ListView_SetColumn(hwnd, iCol, pcol)\n send_listview_message(hwnd, :SETCOLUMN, wparam: iCol, lparam: pcol)\n end",
"def update!(**args)\n @column = args[:column] if args.key?(:column)\n end",
"def set_to_column_name(value=nil, &block)\n define_attr_method :to_column_name, value, &block\n end",
"def column=(column)\n @column = Utility.clamp(column, 0, GRID_COLUMNS - 1)\n end",
"def set_column\n @column = params[:id] ? Column.find(params[:id]) : Column.new(column_params)\n end",
"def change_column(table_name, column_name, type, options = {})\n quoted_table_name = quote_table_name(table_name)\n\n begin\n execute \"ALTER TABLE #{quoted_table_name} ALTER COLUMN #{quote_column_name(column_name)} TYPE #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\"\n rescue ActiveRecord::StatementInvalid => e\n raise e if postgresql_version > 80000\n # This is PostgreSQL 7.x, so we have to use a more arcane way of doing it.\n begin\n begin_db_transaction\n tmp_column_name = \"#{column_name}_ar_tmp\"\n add_column(table_name, tmp_column_name, type, options)\n execute \"UPDATE #{quoted_table_name} SET #{quote_column_name(tmp_column_name)} = CAST(#{quote_column_name(column_name)} AS #{type_to_sql(type, options[:limit], options[:precision], options[:scale])})\"\n remove_column(table_name, column_name)\n rename_column(table_name, tmp_column_name, column_name)\n commit_db_transaction\n rescue\n rollback_db_transaction\n end\n end\n\n change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)\n change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)\n end",
"def change_column(table_name, column_name, type, options = {})\n begin\n execute \"ALTER TABLE #{table_name} ALTER COLUMN #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\"\n rescue ActiveRecord::StatementInvalid\n # This is PostgreSQL 7.x, so we have to use a more arcane way of doing it.\n begin_db_transaction\n tmp_column_name = \"#{column_name}_ar_tmp\"\n add_column(table_name, tmp_column_name, type, options)\n execute \"UPDATE #{table_name} SET #{quote_column_name(tmp_column_name)} = CAST(#{quote_column_name(column_name)} AS #{type_to_sql(type, options[:limit], options[:precision], options[:scale])})\"\n remove_column(table_name, column_name)\n rename_column(table_name, tmp_column_name, column_name)\n commit_db_transaction\n end\n \n change_column_default(table_name, column_name, options[:default]) if options_include_default?(options)\n change_column_null(table_name, column_name, options[:null], options[:default]) if options.key?(:null)\n end",
"def change_column_default(table, column, value)\n current_instructions << Instructions::ChangeColumnDefault.new(\n table: table,\n column: column,\n value: value,\n )\n end",
"def setcolumntovalue(column,value)\n @filearray.each do |line|\n unless line.first =~ /\\D(.*)/\n line[column] = value\n end\n end\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def update!(**args)\n @column_name = args[:column_name] if args.key?(:column_name)\n end",
"def set_value(name, value)\n name = name.to_s.upcase.to_sym\n raise UnknownColumnError.new(name) unless @table.column(name)\n @values_changed[name] = value\n end",
"def []=(column_number_or_name, value)\n begin\n column_number_or_name = column_number_or_name.to_s if column_number_or_name.is_a?(Symbol)\n ole_cell = ole_table.Application.Intersect(\n @ole_tablerow.Range, ole_table.ListColumns.Item(column_number_or_name).Range)\n ole_cell.Value = value\n rescue WIN32OLERuntimeError\n raise TableRowError, \"could not assign value #{value.inspect} to cell at column #{column_number_or_name}\\n#{$!.message}\"\n end\n end",
"def set_column\n @column = Column.find_by_ident(params[:id])\n end",
"def set_columns_changeable(value)\n self.write_attribute :columns_changeable, value.to_json\n end",
"def set_column_comment(table_name, column_name, comment_text)\n execute comment_sql(CommentDefinition.new(table_name, column_name, comment_text))\n end",
"def columns= columns\n columns.each { |c| c.table = self }\n @columns = columns\n end",
"def set_columns_changeable(value)\n write_attribute :columns_changeable, value.to_json\n end",
"def set_column\n @column = Column.find_by(id: params[:id])\n end",
"def modify_columns(columns)\n columns\n end",
"def modified!(column=nil)\n if column && !changed_columns.include?(column)\n changed_columns << column\n end\n @modified = true\n end",
"def modified!(column=nil)\n if column && !changed_columns.include?(column)\n changed_columns << column\n end\n @modified = true\n end",
"def set_column_comment(table_name, column_name, comment)\n # Does nothing\n end",
"def rename_column_concurrently(table, old_column, new_column, type: nil, batch_column_name: :id)\n Gitlab::Database::QueryAnalyzers::RestrictAllowedSchemas.require_ddl_mode!\n\n setup_renamed_column(__callee__, table, old_column, new_column, type, batch_column_name)\n\n with_lock_retries do\n install_bidirectional_triggers(table, old_column, new_column)\n end\n end",
"def change_column_type(col_name, col_type)\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n raise \"Cannot change type for recno column!\" if col_name == :recno\r\n raise 'Invalid column name: ' % col_name unless \\\r\n @field_names.include?(col_name)\r\n \r\n raise 'Invalid field type: %s' % col_type unless \\\r\n KBTable.valid_field_type?(col_type)\r\n\r\n @db.engine.change_column_type(self, col_name, col_type)\r\n\r\n # Need to reinitialize the table instance and associated indexes.\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n\r\n update_header_vars\r\n create_indexes\r\n create_table_class unless @db.server?\r\n end",
"def set_column_value(c, v)\n if col = model.set_column_conflicts[c]\n self[col] = v\n else\n super\n end\n end",
"def reset_column_information\n @column = find_column(column_name)\n end",
"def []=(column_nr, newVal)\n @content[column_nr] = newVal\n return unless @parent\n @item.text = @content.join(\"\\t\")\n update_sortable(column_nr, newVal)\n @parent.recalc\n end",
"def column=(value)\n @coordinate.x = value\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def column(column)\n Column.new(@data, column)\n end",
"def []=(column, value)\n # If it is new, it doesn't have a value yet, so we should\n # definitely set the new value.\n # If the column isn't in @values, we can't assume it is\n # NULL in the database, so assume it has changed.\n if new? || !@values.include?(column) || value != @values[column]\n @changed_columns << column unless @changed_columns.include?(column)\n @values[column] = typecast_value(column, value)\n end\n end",
"def increment_column!(attribute, by = 1)\n # \"foo\"\n increment(attribute, by).update_column(attribute, self[attribute])\n end",
"def set_column!(column=nil, colname: nil, &callback)\n colname ||= get_new_colname\n if callback then\n each do |row| @rows[@rownames[row.rowname]][colname] = yield(row) end\n else\n return to_enum unless column\n column = column.to_a if column.respond_to? :to_a\n case column\n when Array then\n raise \"arg must have #{nrow} elements\" unless column.length == nrows\n each do |row| @rows[@rownames[row.rowname]][colname] = column[row.rowid] end\n else\n each do |row| @rows[@rownames[row.rowname]][colname] = column end\n end\n end\n @colnames << colname\n self\n end",
"def column(name, *args)\n define_method name do\n instance_variable_get(\"@_#{name}\")\n end\n define_method \"#{name}=\" do |val|\n instance_variable_set(\"@_#{name}\", val)\n end\n self.columns = columns.concat([[name].concat(args)])\n end",
"def set_column(name, locale, value)\n set_blank_hash(name) if column_data(name).blank?\n column_data(name)[locale.to_sym] = value\n end",
"def set_column_type(table, *args)\n alter_table(table) {set_column_type(*args)}\n end",
"def set_column_type(table, *args)\n alter_table(table) {set_column_type(*args)}\n end",
"def add_column(table, *args)\n alter_table(table) {add_column(*args)}\n end",
"def add_column(table, *args)\n alter_table(table) {add_column(*args)}\n end",
"def columns=(value)\n return if @columns == value\n @columns = value\n refresh\n end",
"def columns=(v)\n cache_set(:_columns, v)\n end",
"def up\n change_column(:my_table, :my_columnn, :new_type)\nend",
"def change\n change_column(:table_name, :column_name, :new_type)\nend",
"def columns=(array)\n #$log.debug \"tabular got columns #{array.count} #{array.inspect} \" if $log\n @columns = array\n @columns.each_with_index { |e,i| \n #@chash[i] = ColumnInfo.new(c, c.to_s.length) \n c = get_column(i)\n c.name = e\n c.width = e.to_s.length\n #@chash[i] = c\n #@cw[i] ||= c.to_s.length\n #@calign[i] ||= :left # 2011-09-27 prevent setting later on\n }\n end",
"def column(*args,&block)\n columns.column(*args, &block)\n end",
"def change_name(field, new_name)\n CONNECTION.execute(\"UPDATE #{table_name} SET #{field} = '#{new_name}' WHERE id = #{@id};\")\n end",
"def write(object, attribute, value)\n result = super\n column = self.attribute.to_sym\n object.changed_columns << column if attribute == :state && owner_class.columns.include?(column) && !object.changed_columns.include?(column)\n result\n end",
"def set_column\n @column = @board.columns.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n build_flash_message(:error, column: :not_found)\n redirect_to action: :index\n end",
"def col1=(col1)\n self[:col1] = col1.to_s.gsub(\",\", \".\").to_f\n end",
"def real_column; end",
"def changeCell(cell, symbol)\n\t\t@field[cell].value = symbol\n\tend",
"def set_row_column\n @row_column = RowColumn.find(params[:id])\n end"
] |
[
"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.6610352",
"0.6566059",
"0.6566059",
"0.65486956",
"0.65097517",
"0.64732563",
"0.64687717",
"0.6430221",
"0.6418806",
"0.63734424",
"0.63723934",
"0.6358457",
"0.63583857",
"0.63064647",
"0.6301803",
"0.62981695",
"0.6286498",
"0.6277568",
"0.6252894",
"0.6236158",
"0.6161745",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.61565113",
"0.6145492",
"0.61279815",
"0.6113039",
"0.6090331",
"0.60852355",
"0.6056519",
"0.60353625",
"0.6032592",
"0.6029787",
"0.60276484",
"0.60276484",
"0.6003504",
"0.6000547",
"0.5998934",
"0.5962716",
"0.59473336",
"0.5944677",
"0.5932716",
"0.5930864",
"0.5929797",
"0.5912765",
"0.59034663",
"0.5878768",
"0.5878141",
"0.58774984",
"0.5834394",
"0.5834394",
"0.58055604",
"0.58055604",
"0.57894975",
"0.5786829",
"0.57759666",
"0.5772401",
"0.57682586",
"0.57621026",
"0.5754747",
"0.5742549",
"0.5720839",
"0.569131",
"0.564528",
"0.5643358",
"0.56376606"
] |
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 WHERE c.oid = a.attcollation AND t.oid = a.atttypid\n AND a.attcollation <> t.typcollation),\n col_description(a.attrelid, a.attnum) AS comment\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"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 FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def column_definitions(table_name) # :nodoc:\n query(<<-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 format_encoding(a.attencodingtype::integer)\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def column_definitions(table_name) #:nodoc:\n exec_query(<<-end_sql, 'SCHEMA').rows\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 FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def column_definitions(table_name) #:nodoc:\n exec_query(<<-end_sql, 'SCHEMA')\n SELECT a.attname as column_name, format_type(a.atttypid, a.atttypmod) as column_type, d.adsrc as column_default, a.attnotnull as column_not_null\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def columns(table_name)\n column_definitions(table_name.to_s).map do |column_name, type, default, notnull, oid, fmod|\n default_value = extract_value_from_default(default)\n type_metadata = fetch_type_metadata(column_name, type, oid, fmod)\n default_function = extract_default_function(default_value, default)\n new_column(column_name, default_value, type_metadata, notnull == 'f', table_name, default_function)\n end\n end",
"def column_definitions(table_name) # :nodoc:\n local_condition = 'AND a.attislocal IS TRUE' if @_dump_mode\n query(<<-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 WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),\n col_description(a.attrelid, a.attnum) AS comment\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0\n AND a.attisdropped IS FALSE\n #{local_condition}\n ORDER BY a.attnum\n SQL\n end",
"def column_definitions(table_name)\r\n query <<-end_sql\r\n SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull, c.consrc\r\n FROM pg_attribute a LEFT JOIN pg_attrdef d\r\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\r\n LEFT JOIN pg_constraint c ON a.attrelid = c.conrelid AND \r\n c.contype = 'c' AND c.conkey[1] = a.attnum\r\n WHERE a.attrelid = '#{table_name}'::regclass\r\n AND a.attnum > 0 AND NOT a.attisdropped\r\n ORDER BY a.attnum\r\n end_sql\r\n end",
"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 ('datetime', 'smalldatetime') then 'datetime'\nwhen t.name = 'bit' then 'boolean'\nwhen t.name = 'numeric' and c.prec < 10 and c.scale = 0 then 'integer'\nwhen t.name = 'numeric' then 'decimal'\nwhen t.name = 'text' then 'text'\nelse t.name\nend type,\nd.text,\nc.isnullable\nfrom\nsyscolumns c\ninner join systypes t\non c.xusertype = t.xusertype\nleft outer join syscomments d\non c.cdefault = d.id\nwhere\nc.id = object_id('#{table_name}')\norder by\nc.colid\nend_sql\n end",
"def column_definitions(table_name) #:nodoc:\n pieces = table_name.split('.')\n \n if pieces.length == 1\n schema_name = 'public'\n table_name = pieces.last\n else\n schema_name, table_name = pieces.first, pieces.last\n end\n \n query <<-end_sql\n SELECT column_name, data_type, column_default, is_nullable\n FROM v_catalog.columns\n WHERE table_schema = '#{schema_name.gsub(/(^\"|\"$)/,'')}'\n AND table_name = '#{table_name.gsub(/(^\"|\"$)/,'')}'\n end_sql\n end",
"def column_definitions(table_name)\n fields = query(<<~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 c.collname, NULL AS comment,\n #{supports_virtual_columns? ? 'attgenerated' : quote('')} as attgenerated,\n NULL as is_hidden\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n LEFT JOIN pg_type t ON a.atttypid = t.oid\n LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n SQL\n\n crdb_fields = crdb_column_definitions(table_name)\n\n # Use regex comparison because if a type is an array it will\n # have [] appended to the end of it.\n target_types = [\n /geometry/,\n /geography/,\n /interval/,\n /numeric/\n ]\n\n re = Regexp.union(target_types)\n fields.map do |field|\n dtype = field[1]\n field[1] = crdb_fields[field[0]][2].downcase if re.match(dtype)\n field[7] = crdb_fields[field[0]][1]&.gsub!(/^\\'|\\'?$/, '')\n field[9] = true if crdb_fields[field[0]][3]\n field\n end\n fields.delete_if do |field|\n # Don't include rowid column if it is hidden and the primary key\n # is not defined (meaning CRDB implicitly created it).\n if field[0] == CockroachDBAdapter::DEFAULT_PRIMARY_KEY\n field[9] && !primary_key(table_name)\n else\n false # Keep this entry.\n end\n end\n end",
"def columns( table )\n sanity_check\n @handle.columns( table ).collect {|col| ColumnInfo.new(col) }\n end",
"def crdb_column_definitions(table_name)\n fields = \\\n query(<<~SQL, \"SCHEMA\")\n SELECT c.column_name, c.column_comment, c.crdb_sql_type, c.is_hidden::BOOLEAN\n FROM information_schema.columns c\n WHERE c.table_name = #{quote(table_name)}\n SQL\n\n fields.reduce({}) do |a, e|\n a[e[0]] = e\n a\n end\n end",
"def columns_for(table)\n db_connection.select_values(\"show columns from `#{ table }`\")\n end",
"def get_table_column_names(table)\r\n @db[table].columns\r\n end",
"def list_columns\n columns\n end",
"def columns(table_name, name = nil)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).collect do |name, type, default, notnull|\n notnull = [false, true][notnull]\n Column.new(name, default, type, notnull)\n end\n end",
"def columns(table_name, *rest)\n @table.fields.map {|s| ::ActiveRecord::ConnectionAdapters::Column.new(s.to_s, nil, String)}\n end",
"def columns_for(table_name)\n self.connection.columns(table_name)\n end",
"def all_columns(excluded_supertypes) #:nodoc:\n columns = []\n trace :columns, \"All Columns for #{name}\" do\n if is_table\n self_value_reference\n else\n columns << ActiveFacts::RMap::Column.new\n end\n references_from.each do |ref|\n trace :columns, \"Columns absorbed via #{ref}\" do\n columns += ref.columns({})\n end\n end\n end\n columns\n end",
"def table_columns\n klass.column_names\n end",
"def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name\"].to_sym }\n end",
"def columns(table = nil)\n if table\n @columns[table]\n else\n ActiveSupport::Deprecation.warn('call columns with a table name!')\n @columns.dup\n end\n end",
"def columns\n @columns ||= connection.columns(table_name, \"#{name} Columns\")\n end",
"def columns(table_name, _name = nil)\n return [] if table_name.blank?\n table_structure(table_name).each_with_object([]) do |col, cols|\n col_name = col[0] # SQLColumns: COLUMN_NAME\n col_default = col[1] # SQLColumns: COLUMN_DEF\n col_sql_type = col[2] # SQLColumns: DATA_TYPE\n col_nullable = col[3] # SQLColumns: IS_NULLABLE\n col_native_type = col[4] # SQLColumns: TYPE_NAME\n col_limit = col[5] # SQLColumns: COLUMN_SIZE\n col_scale = col[6] # SQLColumns: DECIMAL_DIGITS\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end",
"def columns(table_name, name = nil)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).collect do |name, type, default, notnull|\n VerticaColumn.new(name, default, type, notnull == 'false')\n end\n end",
"def columns(table_name, _name = nil)\n result = @connection.columns(table_name.to_s)\n\n result.each_with_object([]) do |field, cols|\n col_name = field.name\n col_sql_type = native_database_types.invert[name: field.type]\n col_nullable = (field.mode == 'NULLABLE')\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: nil }\n args[:scale] = nil\n args[:precision] = nil\n\n sql_type_metadata =\n ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << ActiveRecord::ConnectionAdapters::Column.new(\n col_name,\n nil,\n sql_type_metadata,\n col_nullable,\n table_name\n )\n end\n end",
"def columns(table_name, name = nil)\n type_part = @sql_layer_version >= 10903 ?\n \" COLUMN_TYPE_STRING(table_schema, table_name, column_name), \" :\n \" data_type||COALESCE('('||character_maximum_length||')', '('||numeric_precision||','||numeric_scale||')', ''), \"\n select_rows(\n \"SELECT column_name, \"+\n \" column_default, \"+\n type_part +\n \" is_nullable \"+\n \"FROM information_schema.columns \"+\n \"WHERE table_schema = CURRENT_SCHEMA \"+\n \" AND table_name = '#{quote_string(table_name.to_s)}' \"+\n \"ORDER BY ordinal_position\",\n name || SCHEMA_LOG_NAME\n ).map { |row|\n # Base Column depends on lower and no space (e.g. DECIMAL(10, 0) => decimal(10,0))\n type_str = row[2].gsub(' ', '').downcase\n FdbSqlColumn.new(row[0], row[1], type_str, row[3] == 'YES')\n }\n end",
"def columns(table_name)\n table_name = table_name.to_s\n\n @columns ||= {}\n @columns[table_name] ||= if @registration[:columns].present?\n @registration[:columns].call(@connection, table_name)\n else\n @connection.columns(table_name)\n end\n end",
"def column_names(table_name)\n columns(table_name).map(&:name)\n end",
"def get_column_names(table_name)\r\n column_names = get_info(table_name, 'name')\r\n end",
"def columns\n collect = []\n recursive_columns(@base, collect)\n end",
"def columns(table_name, name = nil)#:nodoc:\n # Each table always has a row key called 'ROW'\n columns = [\n Column.new('ROW', '')\n ]\n schema = describe_table(table_name)\n doc = REXML::Document.new(schema)\n column_families = doc.elements['Schema/AccessGroup[@name=\"default\"]'].elements.to_a\n\n @hypertable_column_names[table_name] ||= {}\n for cf in column_families\n column_name = cf.elements['Name'].text\n rubified_name = rubify_column_name(column_name)\n @hypertable_column_names[table_name][rubified_name] = column_name\n columns << new_column(rubified_name, '')\n end\n\n columns\n end",
"def columns\n @columns ||= []\n end",
"def column_names(table)\n self.table_column_names ||= {}\n unless table_column_names.include? table\n table_column_names[table] = columns(table).map {|c| c.name}\n end\n table_column_names[table]\n end",
"def order_column_definitions\n dump.gsub!(/^(?<table>CREATE TABLE .+?\\(\\n)(?<columns>.+?)(?=\\n\\);$)/m) do\n table = $~[:table]\n columns =\n $~[:columns]\n .split(\",\\n\")\n .sort_by { |column| column.delete('\"') }\n .partition { |column| !column.match?(/\\A *CONSTRAINT/) }\n .flatten\n .join(\",\\n\")\n\n [table, columns].join\n end\n end",
"def columns\n if @column_names\n columns = []\n\n # First match against fully named columns, e.g. 'attribute:name'\n @column_names.each{|cn| columns << owner.columns_hash[cn] if owner.columns_hash.has_key?(cn)}\n\n # Now match against aliases if the number of columns found previously do not\n # match the expected @columns_names size, i.e. there's still some missing.\n if columns.size != @column_names.size\n columns_left = @column_names - columns.map{|column| column.name}\n owner.columns_hash.each { |name,column| columns << column if columns_left.include?(column.alias) }\n end\n\n columns\n else\n owner.columns\n end\n end",
"def columns(table_name, name = nil)\n sql = <<-END_SQL\n SELECT r.rdb$field_name, r.rdb$field_source, f.rdb$field_type, f.rdb$field_sub_type,\n f.rdb$field_length, f.rdb$field_precision, f.rdb$field_scale,\n COALESCE(r.rdb$default_source, f.rdb$default_source) rdb$default_source,\n COALESCE(r.rdb$null_flag, f.rdb$null_flag) rdb$null_flag\n FROM rdb$relation_fields r\n JOIN rdb$fields f ON r.rdb$field_source = f.rdb$field_name\n WHERE r.rdb$relation_name = '#{ar_to_fb_case(table_name)}'\n ORDER BY r.rdb$field_position\n END_SQL\n select_rows(sql, name).collect do |field|\n field_values = field.collect do |value|\n case value\n when String then value.rstrip\n else value\n end\n end\n FbColumn.new(*field_values)\n end\n end",
"def columns\n @columns ||= [].tap do |fields|\n @model.columns.reject { |a| a.name.match(/_id$/) }.each do |column|\n fields << resolve(column.type, column.name)\n end\n end\n end",
"def order_column_definitions\n dump.gsub!(/^(?<table>CREATE TABLE .+?\\(\\n)(?<columns>.+?)(?=\\n\\);$)/m) do\n columns =\n $~[:columns]\n .split(\",\\n\")\n .sort_by { |column| column[/[^ \"]+/] }\n .partition { |column| !column.match?(/\\A *CONSTRAINT/) }\n .flatten\n .join(\",\\n\")\n\n [$~[:table], columns].join\n end\n end",
"def columns(table_name, name = nil) end",
"def columns\n @columns = @clazz.columns_hash.map do |name, column|\n [name, @columns[name] || Column.new(column, @dump)]\n end.to_h.with_indifferent_access\n end",
"def columns(table_name, name = nil) #:nodoc:\n cdef = column_definitions(table_name)\n cdef = cdef.collect(&:values) if cdef.size > 0 && cdef.first.is_a?(Hash)\n cdef.collect do |name, type, default, notnull|\n col = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new(name, default, type, notnull == \"f\")\n raw_geom_info = PostgresGis::RawGeomInfo.from_sql_type(type)\n col.set_gis(raw_geom_info.srid, raw_geom_info.with_z, raw_geom_info.with_m, raw_geom_info.geographic)\n col\n end\n end",
"def columns(table_name, name = nil) #:nodoc:\r\n table_structure(table_name).map do |field|\r\n AdvantageColumn.new(strip_or_self(field['COLUMN_NAME']), field['COLUMN_DEF'], strip_or_self(field['TYPE_NAME']), field['NULLABLE'])\r\n end\r\n end",
"def columns(tables)\n columns = execute <<-SQL\n SELECT\n s.nspname || '.' || t.relname AS table_name,\n a.attname AS column_name,\n pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type\n FROM pg_attribute a\n JOIN pg_class t on a.attrelid = t.oid\n JOIN pg_namespace s on t.relnamespace = s.oid\n WHERE a.attnum > 0\n AND NOT a.attisdropped\n AND s.nspname || '.' || t.relname IN (#{tables.map {|t| quote(t)}.join(\", \")})\n ORDER BY\n 1, 2\n SQL\n\n columns.map {|v| {table: v[\"table_name\"], column: v[\"column_name\"], type: v[\"data_type\"]}}\n end",
"def table_columns\n ActiveRecord::Base.connection.columns(table_name)\n end",
"def columns\n @columns ||= [];\n end",
"def columns(connection, table_name)\n if ignored_table?(table_name)\n raise ActiveRecord::StatementInvalid, \"Table '#{table_name}' doesn't exist\"\n end\n\n @columns.fetch(table_name) do\n @columns[deep_deduplicate(table_name)] = deep_deduplicate(connection.columns(table_name))\n end\n end",
"def columns(table_name, name = nil)#:nodoc:\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql, name)\n result.each do |field|\n klass = field[1] =~ /geometry|point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection/i ? ActiveRecord::ConnectionAdapters::SpatialMysql2Column : ActiveRecord::ConnectionAdapters::Mysql2Column\n columns << klass.new(field[0], field[4], field[1], field[2] == \"YES\")\n end\n columns\n end",
"def get_column_metadata( table_name )\r\n sql=<<-SQL\r\n select column_name\r\n from information_schema.columns\r\n where\r\n table_schema = '#{ @schema || 'public' }' and\r\n table_catalog = '#{ @catalog }' and\r\n table_name = '#{ table_name }'\r\n order by ordinal_position;\r\n SQL\r\n column_names = []\r\n execute( sql.trim_tabs ).each do |record|\r\n column_names.push record.column_name\r\n end\r\n return column_names\r\n end",
"def columns\n @columns ||= begin\n column_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end",
"def columns()\n return @columns.keys\n end",
"def table_columns(table)\n fields = db_client.query(\"SHOW FIELDS FROM #{table['name']}\")\n columns = {}\n fields.each do |field|\n if (table['columns'].nil? || table['columns'].include?(field['Field']))\n t = field['Type']\n t = 'varchar' if t.start_with?('varchar')\n t = 'decimal' if t.start_with?('decimal')\n t = 'int' if (t.start_with?('int') || t.start_with?('tinyint') || t.start_with?('bigint') || t.start_with?('smallint'))\n if !(COLUMN_TYPES.include?(t))\n raise \"Unknown column type #{t}, exiting.\"\n end\n columns[field['Field']] = t\n end\n end\n columns\n end",
"def get_columns\n return @columns\n end",
"def columns\n @columns ||= header.collect { |header_cell|\n Column.new(self)\n }\n end",
"def columns\n @columns_hash.values\n end",
"def columns\n # we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?\n unless defined? @columns\n self.columns = @core.columns.collect { |c| c.name if @core.columns._inheritable.include?(c.name) && c.searchable? && c.association.nil? && c.text? }.compact\n end\n @columns\n end",
"def columns(table_name, _name = nil)\n stmt = @connection.columns(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop\n\n result.each_with_object([]) do |col, cols|\n col_name = col[3] # SQLColumns: COLUMN_NAME\n col_default = col[12] # SQLColumns: COLUMN_DEF\n col_sql_type = col[4] # SQLColumns: DATA_TYPE\n col_native_type = col[5] # SQLColumns: TYPE_NAME\n col_limit = col[6] # SQLColumns: COLUMN_SIZE\n col_scale = col[8] # SQLColumns: DECIMAL_DIGITS\n\n # SQLColumns: IS_NULLABLE, SQLColumns: NULLABLE\n col_nullable = nullability(col_name, col[17], col[10])\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end",
"def get_column_descriptors\n #skip past header to get to column information\n @data.seek(HEADER_LENGTH)\n \n # column names are the first 128 bytes and column info takes up the last 72 bytes. \n # byte 130 contains a 16-bit column type\n # byte 136 contains a 16-bit length field\n @columns = []\n @column_count.times do\n name, type, length = @data.read(200).unpack('A128 x S x4 S')\n if length > 0\n @columns << Column.new(name.strip, type, length)\n end\n end\n # Reset the column count in case any were skipped\n @column_count = @columns.size\n \n @columns\n end",
"def columns\n\t\t\t@columns ||= Txtboard::Column.columns.sort_by(&:order)\n\t\tend",
"def all\n __getobj__.column_names\n end",
"def columns\n get_metadata unless @columns\n return @columns\n end",
"def columns\n unless @columns\n @columns = collection_info[table_name].columns.collect { |col_def|\n col = ActiveRecord::ConnectionAdapters::Column.new(col_def.name, col_def.default, col_def.sql_type, col_def.null)\n col.primary = col.name == primary_key\n col\n }\n end\n @columns\n end",
"def column_names\n columns.map(&:name)\n end",
"def columns\n @model.columns.map{|c| c.name}\n end",
"def columns\n self.class.const_get(:COLUMNS) rescue []\n end",
"def columns\n self.columns = @core.columns._inheritable unless @columns # lazy evaluation\n @columns\n end",
"def columns\n self.columns = @core.columns._inheritable unless @columns # lazy evaluation\n @columns\n end",
"def column_names\n @column_names ||= columns.collect(&:name)\n end",
"def columns(table)\r\n tab = @handle.describe_table(table)\r\n cols = tab.columns\r\n cols.collect! do |col|\r\n column_metadata_to_column_info(col)\r\n end\r\n\r\n dbh = DBI::DatabaseHandle.new(self)\r\n\r\n primaries = {}\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|\r\nselect column_name\r\n from all_cons_columns a, all_constraints b\r\n where a.owner = b.owner\r\n and a.constraint_name = b.constraint_name\r\n and a.table_name = b.table_name\r\n and b.constraint_type = 'P'\r\n and b.owner = :1\r\n and b.table_name = :2\r\nEOS\r\n primaries[row[0]] = true\r\n end\r\n\r\n indices = {}\r\n uniques = {}\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|\r\nselect a.column_name, a.index_name, b.uniqueness\r\n from all_ind_columns a, all_indexes b\r\n where a.index_name = b.index_name\r\n and a.index_owner = b.owner\r\n and a.table_owner = :1\r\n and a.table_name = :2\r\nEOS\r\n col_name, index_name, uniqueness = row\r\n indices[col_name] = true\r\n uniques[col_name] = true if uniqueness == 'UNIQUE'\r\n end\r\n\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name).collect do |row|\r\nselect column_id, column_name, data_default\r\n from all_tab_columns\r\n where owner = :1\r\n and table_name = :2\r\nEOS\r\n col_id, col_name, default = row\r\n\r\n col = cols[col_id.to_i - 1]\r\n col_name = col['name']\r\n\r\n if default && default[0] == ?'\r\n default = default[1..-2].gsub(/''/, \"'\")\r\n end\r\n\r\n col['indexed'] = indices[col_name] || false\r\n col['primary'] = primaries[col_name] || false\r\n col['unique'] = uniques[col_name] || false\r\n col['default'] = default\r\n col\r\n end\r\n rescue OCIException => err\r\n raise_dbierror(err)\r\n end",
"def quote_column_list(table)\n column_names(table).map do |column_name| \n quote_column_name(column_name)\n end.join(', ')\n end",
"def column_names\n @columns.keys\n end",
"def columns\r\n unless @columns\r\n @columns = connection.columns(table_name, \"#{name} Columns\")\r\n @columns.each {|column| column.primary = primary_keys.include?(column.name.to_sym)}\r\n end\r\n @columns\r\n end",
"def column_list_sql(generator)\n (generator.columns.map{|c| column_definition_sql(c)} + generator.constraints.map{|c| constraint_definition_sql(c)}).join(', ')\n end",
"def columns\n @columns ||= @stats.values.flatten.map { |a| a.column_name }\n end",
"def columns\n @columns = columns_hash.values\n end",
"def columns\n self.class.instance_variable_get(:@columns)\n end",
"def columns\n @columns\n end",
"def columns\n @columns\n end",
"def columns\n @stmt.columns\n end",
"def predefined_columns\n helper_module = \"Netzke::Helpers::#{short_widget_class_name}#{data_class.name}\".constantize rescue nil\n \n data_class_columns = data_class && data_class.column_names.map(&:to_sym) || []\n \n if helper_module\n exposed_attributes = helper_module.respond_to?(:exposed_attributes) ? normalize_array_of_columns(helper_module.exposed_attributes) : nil\n virtual_attributes = helper_module.respond_to?(:virtual_attributes) ? helper_module.virtual_attributes : []\n excluded_attributes = helper_module.respond_to?(:excluded_attributes) ? helper_module.excluded_attributes : []\n attributes_config = helper_module.respond_to?(:attributes_config) ? helper_module.attributes_config : {}\n \n res = exposed_attributes || data_class_columns + virtual_attributes\n \n res = normalize_columns(res)\n \n res.reject!{ |c| excluded_attributes.include? c[:name] }\n\n res.map!{ |c| c.merge!(attributes_config[c[:name]] || {})}\n else\n res = normalize_columns(data_class_columns)\n end\n \n res\n end",
"def columns\n _columns || columns!\n end",
"def column_all_sql(ca)\n \"#{quote_identifier(ca.table)}.*\"\n end",
"def content_columns #:nodoc:\n model_name.constantize.content_columns.collect { |c| c.name.to_sym }.compact rescue []\n end",
"def list\n @list ||= define_list do |l|\n l.default_columns.each do |attribute|\n l.column attribute\n end\n end\n end",
"def column_names\n @column_names ||= @columns.keys\n end",
"def column_aliases\n if @table_expr.is_a?(AliasedExpression)\n @table_expr.columns\n end\n end",
"def columns\n return @columns if @columns\n return nil if frozen?\n set_columns(dataset.naked.columns)\n end",
"def columns\n return @columns if @columns\n return nil if frozen?\n set_columns(dataset.naked.columns)\n end",
"def columns(table_name, name = nil)\n column_info = SpatialColumnInfo.new(self, quote_string(table_name.to_s))\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod|\n # JDBC gets true/false in Rails 4, where other platforms get\n # 't'/'f' strings.\n if(notnull.is_a?(String))\n notnull = (notnull == 't')\n end\n\n oid = column_type_map.fetch(oid.to_i, fmod.to_i) { OID::Identity.new }\n SpatialColumn.new(@rgeo_factory_settings,\n table_name,\n column_name,\n default,\n oid,\n type,\n !notnull,\n column_info.get(column_name, type))\n end\n end",
"def generate_column_def_table()\r\n table_def_name = \"column_definitions\"\r\n # If the table doesn't already exist, create it\r\n puts \"Creating column definition table (#{table_def_name}) if it doesn't exist.\" if @enable_debug_logging\r\n db_column_size_limits = @db_column_size_limits\r\n @db.transaction(:retry_on => [Sequel::SerializationFailure]) do\r\n @db.create_table?(table_def_name.to_sym) do\r\n String :tableName, :size => db_column_size_limits[:tableName]\r\n String :kappSlug, :size => db_column_size_limits[:kappSlug]\r\n String :formSlug, :size => db_column_size_limits[:formSlug]\r\n String :fieldName, :text => true\r\n String :fieldKey, :size => db_column_size_limits[:fieldKey]\r\n String :columnName, :size => db_column_size_limits[:columnName]\r\n primary_key [:tableName, :columnName]\r\n end\r\n end\r\n end",
"def columns\n return @columns\n end",
"def columns; @columns_hash.values; end",
"def columns\n @columns\n end",
"def columns \n []\n end",
"def content_columns #:nodoc:\n self.model_name.constantize.content_columns.collect { |c| c.name.to_sym }.compact rescue []\n end",
"def generateColumnDef()\n res=@conn.exec(\"select tablename from pg_tables where schemaname='public'\")\n classObj = \"\"\n for i in res\n classObj = classObj + \"\\n\\n\\n== \"+ i[0].to_s + \"\\n\"\n classObj = classObj + genrateTabledesc(i[0].to_s)\n classObj = classObj + \"\\n\"\n classObj = classObj + \".Properties\\n\"\n classObj = classObj + \"[frame=\\\"none\\\",options=\\\"header\\\"]\\n\"\n classObj = classObj + \"|======================================================================================\\n\"\n classObj = classObj + \"| | Data Type | Description \\n\"\n classObj = classObj + self.singleTableColDef(i.to_s)\n classObj = classObj + \"|======================================================================================\\n\"\n classObj = classObj + \"=== Links\\n\"\n classObj = classObj + self.generateForeignKeyDef(i.to_s)\n classObj = classObj + \"=== Methods\\n\"\n classObj = classObj + self.generateStoredProcDef(i.to_s)\n end\n puts classObj\n return classObj\n end",
"def columns\n self.class.columns\n end",
"def columns\n self.class.columns\n end",
"def columns\n @columns || self.class.columns\n end"
] |
[
"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.69558454",
"0.6872477",
"0.6859597",
"0.6857711",
"0.6810113",
"0.68096447",
"0.6773635",
"0.6716337",
"0.6710239",
"0.6700112",
"0.6695399",
"0.66950184",
"0.66788805",
"0.66680944",
"0.6656141",
"0.6648619",
"0.66249615",
"0.6616783",
"0.6610158",
"0.6601017",
"0.6597316",
"0.65552855",
"0.6552711",
"0.6540742",
"0.6525621",
"0.6513829",
"0.65087444",
"0.6506334",
"0.65009576",
"0.6471801",
"0.64555925",
"0.64545745",
"0.64381945",
"0.64336795",
"0.6427136",
"0.6367157",
"0.636393",
"0.63611555",
"0.6332563",
"0.63182",
"0.6281929",
"0.62741095",
"0.62725794",
"0.6259255",
"0.62591356",
"0.625453",
"0.6248926",
"0.6248926",
"0.6244943",
"0.62435377",
"0.6241045",
"0.6238984",
"0.62367356",
"0.6235091",
"0.6222236",
"0.6214874",
"0.62089133",
"0.6186334",
"0.6186334",
"0.61719686",
"0.6168268",
"0.6166089",
"0.6159129",
"0.61241364",
"0.6123699",
"0.6102662",
"0.609672",
"0.6064616",
"0.6064616",
"0.6019105",
"0.60088646",
"0.6005609",
"0.59882504",
"0.5982929",
"0.59787375",
"0.5965582",
"0.5964965",
"0.5947283",
"0.5947283",
"0.59460247"
] |
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 ('datetime', 'smalldatetime') then 'datetime'\nwhen t.name = 'bit' then 'boolean'\nwhen t.name = 'numeric' and c.prec < 10 and c.scale = 0 then 'integer'\nwhen t.name = 'numeric' then 'decimal'\nwhen t.name = 'text' then 'text'\nelse t.name\nend type,\nd.text,\nc.isnullable\nfrom\nsyscolumns c\ninner join systypes t\non c.xusertype = t.xusertype\nleft outer join syscomments d\non c.cdefault = d.id\nwhere\nc.id = object_id('#{table_name}')\norder by\nc.colid\nend_sql\n end",
"def column_definitions(table_name) #:nodoc:\n exec_query(<<-end_sql, 'SCHEMA')\n SELECT a.attname as column_name, format_type(a.atttypid, a.atttypmod) as column_type, d.adsrc as column_default, a.attnotnull as column_not_null\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def column_definitions(table_name) #:nodoc:\n pieces = table_name.split('.')\n \n if pieces.length == 1\n schema_name = 'public'\n table_name = pieces.last\n else\n schema_name, table_name = pieces.first, pieces.last\n end\n \n query <<-end_sql\n SELECT column_name, data_type, column_default, is_nullable\n FROM v_catalog.columns\n WHERE table_schema = '#{schema_name.gsub(/(^\"|\"$)/,'')}'\n AND table_name = '#{table_name.gsub(/(^\"|\"$)/,'')}'\n end_sql\n end",
"def column_definitions(table_name) # :nodoc:\n query(<<-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 format_encoding(a.attencodingtype::integer)\n FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def column_definitions(table_name) #:nodoc:\n exec_query(<<-end_sql, 'SCHEMA').rows\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 FROM pg_attribute a LEFT JOIN pg_attrdef d\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def schema(table, opts={})\n hero = execute(\"DESCRIBE #{table}\")\n hero.map do |h|\n [\n h[:col_name].strip.to_sym,\n { :db_type => h[:data_type].strip , :comment => h[:comment].strip }\n ]\n end\n end",
"def format_model_schema(klass)\n hsh = klass.columns_hash.map { |column_name,column| [column_name, column.type] }.to_h\n format_schema_helper(hsh)\n end",
"def schema(table, opts={})\n hero = execute(\"DESCRIBE #{table}\")\n hero.map do |h|\n [ h[:col_name].to_sym, { :db_type => h[:data_type] , :comment => h[:comment] } ]\n end\n end",
"def column_definitions(table_name)\n fields = query(<<~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 c.collname, NULL AS comment,\n #{supports_virtual_columns? ? 'attgenerated' : quote('')} as attgenerated,\n NULL as is_hidden\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n LEFT JOIN pg_type t ON a.atttypid = t.oid\n LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation\n WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n SQL\n\n crdb_fields = crdb_column_definitions(table_name)\n\n # Use regex comparison because if a type is an array it will\n # have [] appended to the end of it.\n target_types = [\n /geometry/,\n /geography/,\n /interval/,\n /numeric/\n ]\n\n re = Regexp.union(target_types)\n fields.map do |field|\n dtype = field[1]\n field[1] = crdb_fields[field[0]][2].downcase if re.match(dtype)\n field[7] = crdb_fields[field[0]][1]&.gsub!(/^\\'|\\'?$/, '')\n field[9] = true if crdb_fields[field[0]][3]\n field\n end\n fields.delete_if do |field|\n # Don't include rowid column if it is hidden and the primary key\n # is not defined (meaning CRDB implicitly created it).\n if field[0] == CockroachDBAdapter::DEFAULT_PRIMARY_KEY\n field[9] && !primary_key(table_name)\n else\n false # Keep this entry.\n end\n end\n end",
"def columns(table_name, name = nil)\n type_part = @sql_layer_version >= 10903 ?\n \" COLUMN_TYPE_STRING(table_schema, table_name, column_name), \" :\n \" data_type||COALESCE('('||character_maximum_length||')', '('||numeric_precision||','||numeric_scale||')', ''), \"\n select_rows(\n \"SELECT column_name, \"+\n \" column_default, \"+\n type_part +\n \" is_nullable \"+\n \"FROM information_schema.columns \"+\n \"WHERE table_schema = CURRENT_SCHEMA \"+\n \" AND table_name = '#{quote_string(table_name.to_s)}' \"+\n \"ORDER BY ordinal_position\",\n name || SCHEMA_LOG_NAME\n ).map { |row|\n # Base Column depends on lower and no space (e.g. DECIMAL(10, 0) => decimal(10,0))\n type_str = row[2].gsub(' ', '').downcase\n FdbSqlColumn.new(row[0], row[1], type_str, row[3] == 'YES')\n }\n end",
"def columns(table_name)\n column_definitions(table_name.to_s).map do |column_name, type, default, notnull, oid, fmod|\n default_value = extract_value_from_default(default)\n type_metadata = fetch_type_metadata(column_name, type, oid, fmod)\n default_function = extract_default_function(default_value, default)\n new_column(column_name, default_value, type_metadata, notnull == 'f', table_name, default_function)\n end\n end",
"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 WHERE c.oid = a.attcollation AND t.oid = a.atttypid\n AND a.attcollation <> t.typcollation),\n col_description(a.attrelid, a.attnum) AS comment\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = #{quote(quote_table_name(table_name))}::regclass\n AND a.attnum > 0 AND NOT a.attisdropped\n ORDER BY a.attnum\n end_sql\n end",
"def columns(table_name, name = nil)#:nodoc:\n sql = \"SHOW FIELDS FROM #{quote_table_name(table_name)}\"\n columns = []\n result = execute(sql, name)\n result.each do |field|\n klass = field[1] =~ /geometry|point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection/i ? ActiveRecord::ConnectionAdapters::SpatialMysql2Column : ActiveRecord::ConnectionAdapters::Mysql2Column\n columns << klass.new(field[0], field[4], field[1], field[2] == \"YES\")\n end\n columns\n end",
"def columns(table_name, _name = nil)\n return [] if table_name.blank?\n table_structure(table_name).each_with_object([]) do |col, cols|\n col_name = col[0] # SQLColumns: COLUMN_NAME\n col_default = col[1] # SQLColumns: COLUMN_DEF\n col_sql_type = col[2] # SQLColumns: DATA_TYPE\n col_nullable = col[3] # SQLColumns: IS_NULLABLE\n col_native_type = col[4] # SQLColumns: TYPE_NAME\n col_limit = col[5] # SQLColumns: COLUMN_SIZE\n col_scale = col[6] # SQLColumns: DECIMAL_DIGITS\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end",
"def singleTableColDef(tabName)\n res=@conn.exec(\"SELECT column_name,data_type,column_default,is_nullable FROM information_schema.columns WHERE table_name ='#{tabName}'\")\n retType=\"\"\n for i in res\n colVal = \"+\"+i[0].to_s+\"+\" \n dataType = \"+\"+i[1].to_s+\"+\" \n retType = retType + \"|\"+colVal.center(25)+\"|\"+dataType.center(24)+\"|\"+self.singleTableColDesc(tabName)\n retType = retType + \"\\n\"\n end\n return retType\n end",
"def column_definitions(table_name)\r\n query <<-end_sql\r\n SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull, c.consrc\r\n FROM pg_attribute a LEFT JOIN pg_attrdef d\r\n ON a.attrelid = d.adrelid AND a.attnum = d.adnum\r\n LEFT JOIN pg_constraint c ON a.attrelid = c.conrelid AND \r\n c.contype = 'c' AND c.conkey[1] = a.attnum\r\n WHERE a.attrelid = '#{table_name}'::regclass\r\n AND a.attnum > 0 AND NOT a.attisdropped\r\n ORDER BY a.attnum\r\n end_sql\r\n end",
"def columns(table_name, *rest)\n @table.fields.map {|s| ::ActiveRecord::ConnectionAdapters::Column.new(s.to_s, nil, String)}\n end",
"def get_schema_info(klass, options)\n info = []\n klass.columns.each do |col|\n attrs = []\n attrs << \"default(#{quote(col.default)})\" unless col.default.nil?\n attrs << \"not null\" unless col.null\n attrs << \"primary key\" if col.name == klass.primary_key\n\n col_type = col.type.to_s\n if col_type == \"decimal\"\n col_type << \"(#{col.precision}, #{col.scale})\"\n else\n col_type << \"(#{col.limit})\" if col.limit\n end\n\n # Check out if we got a geometric column\n # and print the type and SRID\n if col.respond_to?(:geometry_type)\n attrs << \"#{col.geometry_type}, #{col.srid}\"\n end\n\n # Check if the column has indices and print \"indexed\" if true\n # If the indice include another colum, print it too.\n if options[:simple_indexes] # Check out if this column is indexed\n indices = klass.connection.indexes(klass.table_name)\n if indices = indices.select { |ind| ind.columns.include? col.name }\n indices.each do |ind|\n ind = ind.columns.reject! { |i| i == col.name }\n attrs << (ind.length == 0 ? \"indexed\" : \"indexed => [#{ind.join(\", \")}]\")\n end\n end\n end\n info << { :name => col.name, :type => col_type, :attrs => attrs.join(\", \"), :human_name => klass.respond_to?(:human_attribute_name) ? klass.human_attribute_name(col.name) : col.name }\n end\n info\n end",
"def get_data_types(table_name) \r\n data_types = get_info(table_name, 'type')\r\n data_types.shift\r\n data_types\r\n end",
"def table_columns(table)\n fields = db_client.query(\"SHOW FIELDS FROM #{table['name']}\")\n columns = {}\n fields.each do |field|\n if (table['columns'].nil? || table['columns'].include?(field['Field']))\n t = field['Type']\n t = 'varchar' if t.start_with?('varchar')\n t = 'decimal' if t.start_with?('decimal')\n t = 'int' if (t.start_with?('int') || t.start_with?('tinyint') || t.start_with?('bigint') || t.start_with?('smallint'))\n if !(COLUMN_TYPES.include?(t))\n raise \"Unknown column type #{t}, exiting.\"\n end\n columns[field['Field']] = t\n end\n end\n columns\n end",
"def columns(tables)\n columns = execute <<-SQL\n SELECT\n s.nspname || '.' || t.relname AS table_name,\n a.attname AS column_name,\n pg_catalog.format_type(a.atttypid, a.atttypmod) AS data_type\n FROM pg_attribute a\n JOIN pg_class t on a.attrelid = t.oid\n JOIN pg_namespace s on t.relnamespace = s.oid\n WHERE a.attnum > 0\n AND NOT a.attisdropped\n AND s.nspname || '.' || t.relname IN (#{tables.map {|t| quote(t)}.join(\", \")})\n ORDER BY\n 1, 2\n SQL\n\n columns.map {|v| {table: v[\"table_name\"], column: v[\"column_name\"], type: v[\"data_type\"]}}\n end",
"def table_columns\n klass.column_names\n end",
"def table_structure(table_name)\n execute('select * from information_schema.columns where table_schema = ?' \\\n 'AND table_name = ?', [schema, table_name])\n end",
"def numeric_columns(table_name)\n columns = []\n @client.query(\"DESC `#{table_name}`;\").each do |column|\n if is_numeric(column[\"Type\"])\n columns.push(column[\"Field\"])\n end\n end\n\n columns\n end",
"def table_structure(table_name)\r\n sql = \"SELECT COLUMN_NAME, IIF(COLUMN_DEF = 'NULL', null, COLUMN_DEF) as COLUMN_DEF, TYPE_NAME, NULLABLE from (EXECUTE PROCEDURE sp_GetColumns( NULL, NULL, '#{table_name}', NULL )) spgc where table_cat <> 'system';\"\r\n structure = execute(sql, :skip_logging)\r\n raise(ActiveRecord::StatementInvalid, \"Could not find table '#{table_name}'\") if structure == false\r\n structure\r\n end",
"def columns(table_name, _name = nil)\n result = @connection.columns(table_name.to_s)\n\n result.each_with_object([]) do |field, cols|\n col_name = field.name\n col_sql_type = native_database_types.invert[name: field.type]\n col_nullable = (field.mode == 'NULLABLE')\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: nil }\n args[:scale] = nil\n args[:precision] = nil\n\n sql_type_metadata =\n ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << ActiveRecord::ConnectionAdapters::Column.new(\n col_name,\n nil,\n sql_type_metadata,\n col_nullable,\n table_name\n )\n end\n end",
"def columns(table_name, name = nil)\n sql = <<-END_SQL\n SELECT r.rdb$field_name, r.rdb$field_source, f.rdb$field_type, f.rdb$field_sub_type,\n f.rdb$field_length, f.rdb$field_precision, f.rdb$field_scale,\n COALESCE(r.rdb$default_source, f.rdb$default_source) rdb$default_source,\n COALESCE(r.rdb$null_flag, f.rdb$null_flag) rdb$null_flag\n FROM rdb$relation_fields r\n JOIN rdb$fields f ON r.rdb$field_source = f.rdb$field_name\n WHERE r.rdb$relation_name = '#{ar_to_fb_case(table_name)}'\n ORDER BY r.rdb$field_position\n END_SQL\n select_rows(sql, name).collect do |field|\n field_values = field.collect do |value|\n case value\n when String then value.rstrip\n else value\n end\n end\n FbColumn.new(*field_values)\n end\n end",
"def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name\"].to_sym }\n end",
"def columns(table_name, name = nil)\n column_definitions(table_name).map! do |row|\n # |name, type, default, notnull, oid, fmod|\n name = row[0]; type = row[1]; default = row[2]\n notnull = row[3]; oid = row[4]; fmod = row[5]\n # oid = OID::TYPE_MAP.fetch(oid.to_i, fmod.to_i) { OID::Identity.new }\n notnull = notnull == 't' if notnull.is_a?(String) # JDBC gets true/false\n # for ID columns we get a bit of non-sense default :\n # e.g. \"nextval('mixed_cases_id_seq'::regclass\"\n if default =~ /^nextval\\(.*?\\:\\:regclass\\)$/\n default = nil\n elsif default =~ /^\\(([-+]?[\\d\\.]+)\\)$/ # e.g. \"(-1)\" for a negative default\n default = $1\n end\n\n Column.new(name, default, oid, type, ! notnull, fmod, self)\n end\n end",
"def column_definitions(table_name) # :nodoc:\n local_condition = 'AND a.attislocal IS TRUE' if @_dump_mode\n query(<<-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 WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),\n col_description(a.attrelid, a.attnum) AS comment\n FROM pg_attribute a\n LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum\n WHERE a.attrelid = '#{quote_table_name(table_name)}'::regclass\n AND a.attnum > 0\n AND a.attisdropped IS FALSE\n #{local_condition}\n ORDER BY a.attnum\n SQL\n end",
"def schema_ds_select(table_name, opts)\n cols = [:column_name___column, :data_type___db_type, :character_maximum_length___max_chars, \\\n :numeric_precision, :column_default___default, :is_nullable___allow_null]\n cols << :c__table_name unless table_name\n cols\n end",
"def info\n if @filtered_rset.empty?\n @columns = {}\n return\n end\n\n query = @filtered_rset.to_sql\n\n @columns = @filtered_rset.first.attributes.each_with_object({}) do |c, m|\n m[c[0].to_sym] = nil\n m\n end\n\n tables = ActiveRecord::Base.connection.tables.select do |t|\n Regexp.new('\\b' + t + '\\b') =~ query\n end\n\n tables.each do |t|\n ActiveRecord::Base.connection.columns(t).each do |c|\n @columns[c.name.to_sym] = c.type if @columns.key?(c.name.to_sym)\n end\n end\n\n unless (extra = @columns.values.reject(&:present?)).empty?\n msg = extra.join(', ') + 'have missing types, perhaps these are aliased?'\n raise KilterError, msg\n end\n end",
"def format_schema_helper(hsh)\n hsh = map_data_types(hsh)\n hsh.map { |column_name,column_type| [\"#{column_type}\".to_sym,\"#{column_name}\"] }\n end",
"def get_table_column_names(table)\r\n @db[table].columns\r\n end",
"def columns_for(table)\n db_connection.select_values(\"show columns from `#{ table }`\")\n end",
"def db_fields_for_table(table_name)\n db_fields = {}\n result = @db.schema(table_name).each do |col|\n db_fields[col[0].to_sym] = col[1]\n end\n\n db_fields\n end",
"def columns(table_name, _name = nil)\n stmt = @connection.columns(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop\n\n result.each_with_object([]) do |col, cols|\n col_name = col[3] # SQLColumns: COLUMN_NAME\n col_default = col[12] # SQLColumns: COLUMN_DEF\n col_sql_type = col[4] # SQLColumns: DATA_TYPE\n col_native_type = col[5] # SQLColumns: TYPE_NAME\n col_limit = col[6] # SQLColumns: COLUMN_SIZE\n col_scale = col[8] # SQLColumns: DECIMAL_DIGITS\n\n # SQLColumns: IS_NULLABLE, SQLColumns: NULLABLE\n col_nullable = nullability(col_name, col[17], col[10])\n\n args = { sql_type: col_sql_type, type: col_sql_type, limit: col_limit }\n args[:sql_type] = 'boolean' if col_native_type == self.class::BOOLEAN_TYPE\n\n if [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(col_sql_type)\n args[:scale] = col_scale || 0\n args[:precision] = col_limit\n end\n sql_type_metadata = ActiveRecord::ConnectionAdapters::SqlTypeMetadata.new(**args)\n\n cols << new_column(format_case(col_name), col_default, sql_type_metadata, col_nullable, table_name, col_native_type)\n end\n end",
"def columns_for(table_name)\n self.connection.columns(table_name)\n end",
"def columns(table)\n dbh = DBI::DatabaseHandle.new(self)\n uniques = []\n dbh.execute(\"SHOW INDEX FROM #{table}\") do |sth|\n sth.each do |row|\n uniques << row[4] if row[1] == \"0\"\n end\n end \n\n ret = nil\n dbh.execute(\"SHOW FIELDS FROM #{table}\") do |sth|\n ret = sth.collect do |row|\n name, type, nullable, key, default, extra = row\n #type = row[1]\n #size = type[type.index('(')+1..type.index(')')-1]\n #size = 0\n #type = type[0..type.index('(')-1]\n\n sqltype, type, size, decimal = mysql_type_info(row[1])\n col = Hash.new\n col['name'] = name\n col['sql_type'] = sqltype\n col['type_name'] = type\n col['nullable'] = nullable == \"YES\"\n col['indexed'] = key != \"\"\n col['primary'] = key == \"PRI\"\n col['unique'] = uniques.index(name) != nil\n col['precision'] = size\n col['scale'] = decimal\n col['default'] = row[4]\n col\n end # collect\n end # execute\n \n ret\n end",
"def schema_parse_table(table_name, opts)\n m = output_identifier_meth(opts[:dataset])\n\n _schema_ds.where_all(Sequel[:pg_class][:oid]=>regclass_oid(table_name, opts)).map do |row|\n row[:default] = nil if blank_object?(row[:default])\n if row[:base_oid]\n row[:domain_oid] = row[:oid]\n row[:oid] = row.delete(:base_oid)\n row[:db_domain_type] = row[:db_type]\n row[:db_type] = row.delete(:db_base_type)\n else\n row.delete(:base_oid)\n row.delete(:db_base_type)\n end\n\n db_type = row[:db_type]\n row[:type] = if row.delete(:is_array)\n schema_array_type(db_type)\n else\n send(TYPTYPE_METHOD_MAP[row.delete(:typtype)], db_type)\n end\n identity = row.delete(:attidentity)\n if row[:primary_key]\n row[:auto_increment] = !!(row[:default] =~ /\\A(?:nextval)/i) || identity == 'a' || identity == 'd'\n end\n\n # :nocov:\n if server_version >= 90600\n # :nocov:\n case row[:oid]\n when 1082\n row[:min_value] = MIN_DATE\n row[:max_value] = MAX_DATE\n when 1184, 1114\n if Sequel.datetime_class == Time\n row[:min_value] = MIN_TIMESTAMP\n row[:max_value] = MAX_TIMESTAMP\n end\n end\n end\n\n [m.call(row.delete(:name)), row]\n end\n end",
"def table_columns\n ActiveRecord::Base.connection.columns(table_name)\n end",
"def generateColumnDef()\n res=@conn.exec(\"select tablename from pg_tables where schemaname='public'\")\n classObj = \"\"\n for i in res\n classObj = classObj + \"\\n\\n\\n== \"+ i[0].to_s + \"\\n\"\n classObj = classObj + genrateTabledesc(i[0].to_s)\n classObj = classObj + \"\\n\"\n classObj = classObj + \".Properties\\n\"\n classObj = classObj + \"[frame=\\\"none\\\",options=\\\"header\\\"]\\n\"\n classObj = classObj + \"|======================================================================================\\n\"\n classObj = classObj + \"| | Data Type | Description \\n\"\n classObj = classObj + self.singleTableColDef(i.to_s)\n classObj = classObj + \"|======================================================================================\\n\"\n classObj = classObj + \"=== Links\\n\"\n classObj = classObj + self.generateForeignKeyDef(i.to_s)\n classObj = classObj + \"=== Methods\\n\"\n classObj = classObj + self.generateStoredProcDef(i.to_s)\n end\n puts classObj\n return classObj\n end",
"def genrateTabledesc(tabName)\n res=@conn.exec(\"select obj_description(oid) from pg_class where relname='#{tabName}'\")\n retType=\"\"\n for i in res\n retType = retType + \"#{i[0].to_s}\"\n end\n return retType\n end",
"def columns(table_name, name = nil) end",
"def column_types\n @column_types ||= @columns.values\n end",
"def get_table_attributes(table_name)\n get_schemas[table_name].columns.map(&:name)\n end",
"def columns(table_name, name = nil) #:nodoc:\n cdef = column_definitions(table_name)\n cdef = cdef.collect(&:values) if cdef.size > 0 && cdef.first.is_a?(Hash)\n cdef.collect do |name, type, default, notnull|\n col = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new(name, default, type, notnull == \"f\")\n raw_geom_info = PostgresGis::RawGeomInfo.from_sql_type(type)\n col.set_gis(raw_geom_info.srid, raw_geom_info.with_z, raw_geom_info.with_m, raw_geom_info.geographic)\n col\n end\n end",
"def table_schema(tbl)\n column_sql = <<-eosql\nSELECT rf.rdb$field_name AS \"name\",\n field.rdb$field_type AS \"type_code\",\n field.rdb$field_sub_type AS \"subtype_code\",\n-- -- -- field.rdb$field_length AS \"length\", -- -- --\n field.rdb$field_precision AS \"precision\",\n field.rdb$field_scale AS \"scale\",\n CASE\n WHEN rf.rdb$null_flag > 0\n THEN 'NO'\n ELSE 'YES'\n END AS \"nullable\",\n CASE\n WHEN iseg.rdb$index_name IS NOT NULL\n THEN 'YES'\n ELSE 'NO'\n END AS \"primary_key\"\nFROM rdb$relation_fields rf\nJOIN rdb$fields field ON rf.rdb$field_source = field.rdb$field_name\nLEFT JOIN rdb$relation_constraints c\n ON c.rdb$relation_name = rf.rdb$relation_name\n AND\n c.rdb$constraint_type = 'PRIMARY KEY'\nLEFT JOIN rdb$index_segments iseg\n ON iseg.rdb$index_name = c.rdb$index_name\n AND\n iseg.rdb$field_name = rf.rdb$field_name\nWHERE rf.rdb$relation_name = ?\nORDER BY rf.rdb$field_position, rf.rdb$field_name\neosql\n\n info = RDBI::Schema.new([], [])\n res = execute(column_sql, tbl.to_s.upcase)\n res.as(:Struct)\n while row = res.fetch[0]\n type = RDBI::Driver::Rubyfb::Types::field_type_to_rubyfb(row[:type_code], row[:subtype_code])\n info.columns << RDBI::Column.new(\n row[:name].to_sym,\n type,\n RDBI::Driver::Rubyfb::Types::rubyfb_to_rdbi(type, row[:scale]),\n row[:precision],\n row[:scale],\n row[:nullable] == 'YES',\n #nil, # metadata\n #nil, # default\n #nil, # table\n )\n (info.columns[-1].primary_key = row[:primary_key] == 'YES') rescue nil # pk > rdbi 0.9.1\n end\n return unless info.columns.length > 0\n info.tables << tbl\n info\n end",
"def get_columns(class_name)\n \t\t\tcolumns = [] # the standard columns we will show depending on the type\n \t\t\tall_possible_columns = [] # every column available depending on type\n\t\t\t\tglobal_add = ['id'] # the standard columns that we'll always show\n \t\t\tglobal_remove = ['created_at', 'updated_at', 'datastore'] # stuff we never show\n\t\n\t\t\t\tif class_name == \"Host\"\n\t\t\t\t\tcolumns = [ 'address','name','state','os_name','os_flavor','os_sp']\n\t\t\t\telsif class_name == \"Service\"\n\t\t\t\t\tcolumns = ['port','proto','state','name']\n\t\t\t\telsif class_name == \"Session\"\n\t\t\t\t\tcolumns = [ 'host_id', 'local_id', 'stype', 'closed_at', 'port', 'desc' ]\n\t\t\t\tend\n\n\t\t\t\t## generate all possible columns\n\t\t\t\tif eval(\"Msf::DBManager::#{class_name}.respond_to?('columns')\")\n\t \t\t\t\teval(\"Msf::DBManager::#{class_name}.columns.each do |type_col|\n\t \t\t\t\t\t\tall_possible_columns << type_col.name\n\t \t\t\t\t\tend\")\n\t \t\t\tend\n\t \t\t\tif all_possible_columns.empty?\n\t \t\t\t\tprint_error(\"The database does not recognize #{class_name} objects\")\n\t \t\t\t\tprint_deb(\"DBManager didn't respond_to? #{class_name}.columns\")\n\t \t\t\t\treturn []\n\t \t\t\tend\t\t\n\n\t\t\t\t# if columns is still empty, just dup all_possible_columns\n\t\t\t\tcolumns = all_possible_columns.dup if columns.empty?\n\t\t\t\t\n\t\t\t\t# Globally remove these \t\t\t\n\t\t\t\tcolumns = columns - global_remove\n\n\t\t\t\t# Globally add these\n\t\t\t\tcolumns = global_add | columns\n\n \t\t\treturn [columns,all_possible_columns]\n \t\tend",
"def get_schema_struct(table_name)\n dbres = do_sql_command(\"DESC #{table_name};\")\n\n dbstruct = []\n\n if(dbres) then\n dbres.each_hash do | row |\n dbstruct_hash = {}\n row.each {|key, val|\n dbstruct_hash[key.downcase.to_sym] = val \n }\n dbstruct << dbstruct_hash\n end \n end\n\n dbstruct\nend",
"def columns(table_name, name = nil) #:nodoc:\r\n table_structure(table_name).map do |field|\r\n AdvantageColumn.new(strip_or_self(field['COLUMN_NAME']), field['COLUMN_DEF'], strip_or_self(field['TYPE_NAME']), field['NULLABLE'])\r\n end\r\n end",
"def default_columns\n [\n {:name => \"id\", :attr_type => :integer, :meta => true},\n {:name => \"position\", :attr_type => :integer, :meta => true},\n {:name => \"attr_type\", :attr_type => :string, :meta => true},\n *config[:owner].class.meta_columns.map { |c| c[:name] == \"name\" ? inject_combo_for_name_column(c) : c }\n ]\n end",
"def query_part_table_definition\n remote_query_column_types.map do |name, type|\n \"#{name} #{type}\"\n end.join(\"\\n , \")\n end",
"def schema_and_table_name\n if qualified_table_name.include? '.'\n schema_name, table_name = qualified_table_name.split('.', 2)\n else\n table_name = qualified_table_name\n schema_name = self.class.default_schema_name\n end\n [schema_name, table_name]\n end",
"def ctype\n select_value(\n \"SELECT pg_database.datctype FROM pg_database WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def column_names(table_name)\n columns(table_name).map(&:name)\n end",
"def default_formats\n attr_formats = {}\n columns.each do |column|\n attr_formats[column.name] = case column.type\n when :integer, :float\n {:class => :right, :formatter => :number_with_delimiter}\n when :text, :string\n {}\n when :date, :datetime\n {}\n else\n {}\n end\n end\n attr_formats\n end",
"def schema_parse_table(table_name, opts)\n m = output_identifier_meth\n m2 = input_identifier_meth\n ds = metadata_dataset.from(:information_schema__tables___t).\n join(:information_schema__columns___c, :table_catalog=>:table_catalog,\n :table_schema => :table_schema, :table_name => :table_name).\n select(:column_name___column, :data_type___db_type, :character_maximum_length___max_chars, :column_default___default, :is_nullable___allow_null).\n filter(:c__table_name=>m2.call(table_name.to_s))\n if schema = opts[:schema] || default_schema\n ds.filter!(:table_schema=>schema)\n end\n ds.map do |row|\n row[:allow_null] = row[:allow_null] == 'YES' ? true : false\n row[:default] = nil if blank_object?(row[:default])\n row[:type] = schema_column_type(row[:db_type])\n [m.call(row.delete(:column)), row]\n end\n end",
"def generate_table_fields(tbl_name)\n field_hash = {}\n fields = @mysql_client.query(\"desc #{tbl_name}\")\n fields.each do |field|\n field_hash[field[\"Field\"]] = ::Schema::Mapping::Column.from_sql(field[\"Field\"], field[\"Type\"], field[\"Key\"]).to_hash\n end\n\n return field_hash\n end",
"def col_types\n result = {}\n columns.each do |c|\n result[c.header] = c.type\n end\n result\n end",
"def get_info(table_name, type)\r\n info = []\r\n if table_exists?(table_name)\r\n table_info = @db.execute(\"PRAGMA table_info(#{table_name});\")\r\n table_info.each { |data| info<< data[type]}\r\n end \r\n info\r\n end",
"def columns\n [\"#{@base}.*\"]\n end",
"def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end",
"def types\n load_schema! unless schema_loaded?\n @types\n end",
"def types\n @stmt.types\n end",
"def types\n @stmt.types\n end",
"def columns(table_name, name = nil)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).collect do |name, type, default, notnull|\n VerticaColumn.new(name, default, type, notnull == 'false')\n end\n end",
"def get_column_type(table_name, column_name) #:nodoc:\r\n sql = <<-SQL\r\nSELECT\r\n CASE\r\n WHEN type_name = 'VARCHAR' or type_name = 'CHAR' or type_name = 'CICHAR' or\r\n type_name = 'NVARCHAR' or type_name = 'NCHAR' or type_name = 'VARBINARY'\r\n THEN CAST(TRIM(type_name) + '(' + TRIM(CAST(column_size AS SQL_CHAR)) + ')' AS SQL_CHAR)\r\n WHEN type_name = 'NUMERIC' or type_name = 'DOUBLE' or type_name = 'CURDOUBLE'\r\n THEN CAST(TRIM(type_name) + '(' + TRIM(CAST(column_size AS SQL_CHAR)) + ',' + TRIM(CAST(decimal_digits AS SQL_CHAR)) + ')' AS SQL_CHAR)\r\n ELSE\r\n TRIM(type_name COLLATE ads_default_cs)\r\n END AS \"domain\"\r\nfrom (EXECUTE PROCEDURE sp_GetColumns( NULL, NULL, '#{table_name}', NULL)) as spgc\r\nWHERE COLUMN_NAME = '#{column_name}'\r\nSQL\r\n rs = select(sql)\r\n if !rs.nil? and !rs[0].nil?\r\n rs[0]['domain']\r\n end\r\n end",
"def convert_schema_to_type(table_name, *)\n converter = SchemaConverter.new(table_name: table_name, is_snake_case: @is_snake_case)\n yield converter\n @converted_types.concat converter.converted_type_lines\n end",
"def columns(table_name, name = nil)\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).collect do |name, type, default, notnull|\n notnull = [false, true][notnull]\n Column.new(name, default, type, notnull)\n end\n end",
"def schema_and_table(result)\n :\"#{result.schema}__#{self.implicit_table_name}\"\n end",
"def columns_for_klass(klass)\n if klass == 'Tenant'\n [:name, :use_config_for_attributes]\n elsif klass.safe_constantize.column_names.include?('name')\n [:name]\n else\n [:description]\n end\n end",
"def get_field_datatype(table_struct, field_name = FIELD_NAME)\n datatype = nil\n \n table_struct.each { |row|\n break if !datatype.nil?\n if row[:field] == field_name\n datatype = row[:type]\n end\n }\n \n datatype\nend",
"def column_names\n klass.attributes\n end",
"def types\n must_be_open!\n @columns.map(&:last)\n end",
"def get_column_names(table_name)\r\n column_names = get_info(table_name, 'name')\r\n end",
"def get_column_metadata( table_name )\r\n sql=<<-SQL\r\n select column_name\r\n from information_schema.columns\r\n where\r\n table_schema = '#{ @schema || 'public' }' and\r\n table_catalog = '#{ @catalog }' and\r\n table_name = '#{ table_name }'\r\n order by ordinal_position;\r\n SQL\r\n column_names = []\r\n execute( sql.trim_tabs ).each do |record|\r\n column_names.push record.column_name\r\n end\r\n return column_names\r\n end",
"def all_columns(excluded_supertypes) #:nodoc:\n columns = []\n trace :columns, \"All Columns for #{name}\" do\n if is_table\n self_value_reference\n else\n columns << ActiveFacts::RMap::Column.new\n end\n references_from.each do |ref|\n trace :columns, \"Columns absorbed via #{ref}\" do\n columns += ref.columns({})\n end\n end\n end\n columns\n end",
"def schema_ds_from(table_name, opts)\n [:information_schema__tables___t]\n end",
"def columns(table_name, name = nil)\n column_info = SpatialColumnInfo.new(self, quote_string(table_name.to_s))\n # Limit, precision, and scale are all handled by the superclass.\n column_definitions(table_name).map do |column_name, type, default, notnull, oid, fmod|\n # JDBC gets true/false in Rails 4, where other platforms get\n # 't'/'f' strings.\n if(notnull.is_a?(String))\n notnull = (notnull == 't')\n end\n\n oid = column_type_map.fetch(oid.to_i, fmod.to_i) { OID::Identity.new }\n SpatialColumn.new(@rgeo_factory_settings,\n table_name,\n column_name,\n default,\n oid,\n type,\n !notnull,\n column_info.get(column_name, type))\n end\n end",
"def get(table)\n if internal?(table)\n INTERNAL_SCHEMATA[table.variable.name]\n else\n table_id = @table_manager.variable_id(table)\n Schema.new(\n @internal_evaluator.select(\n [\"column_name\", \"index\", \"type_id\", \"short_default\", \"boolean_default\", \"string_default\", \"double_default\", \"integer_default\"],\n \"schemata\",\n [\"table_id\"],\n [table_id]\n ).sort_by { |tuple| tuple[1] }.map do |tuple|\n name = tuple[0]\n type = StorageType.by_id(tuple[2])\n default = case type \n when StorageType::SHORT then tuple[3]\n when StorageType::BOOLEAN then tuple[4]\n when StorageType::STRING then tuple[5]\n when StorageType::DOUBLE then tuple[6]\n when StorageType::INTEGER then tuple[7]\n else\n raise\n end\n if default.nil?\n Column.new(name, type)\n else\n Column.new(name, type, default)\n end\n end\n )\n end\n end",
"def crdb_column_definitions(table_name)\n fields = \\\n query(<<~SQL, \"SCHEMA\")\n SELECT c.column_name, c.column_comment, c.crdb_sql_type, c.is_hidden::BOOLEAN\n FROM information_schema.columns c\n WHERE c.table_name = #{quote(table_name)}\n SQL\n\n fields.reduce({}) do |a, e|\n a[e[0]] = e\n a\n end\n end",
"def column_names\n klass.properties.keys\n end",
"def sqlite3_schema(table_name)\n table_schema = @dbm.sqlite3_pragma(table_name)\n\n # First, find the max lengths of each column's title strings\n # for nice print out in a fixed length of table format\n max_column_name_length = 0\n max_type_name_col_length = 22\n max_nullable_col_length = 10\n max_pk_col_length = 5\n\n table_schema.each {|schema|\n if max_column_name_length < schema[1].length\n max_column_name_length = schema[1].length\n end\n \n # Check null status and convert the stored binary value\n # into string \"YES\" or \"NO\"\n schema[3] = (schema[3] == 1 ? \"YES\":\"NO\")\n # Check primary key status and convert the stored\n # binary value into string \"YES\" or \"NO\"\n schema[5] = (schema[5] == 1 ? \"YES\":\"NO\")\n }\n\n # Print out the schema in a table format\n puts table_name\n printf \"%-5s | %-#{max_column_name_length}s | %-22s | %-5s | %-5s\\n\",\\\n \"CID\", \"NAME\", \"TYPE\", \"NULL?\", \"PK?\"\n dash_line_splitter = '-' * (50 + max_column_name_length)\n puts dash_line_splitter\n table_schema.each {|schema|\n printf \"%-5s | %-#{max_column_name_length}s | %-22s | %-5s | %-5s\\n\",\\\n schema[0].to_s, schema[1], schema[2], schema[3], schema[5]\n }\n end",
"def columns\n @columns ||= [].tap do |fields|\n @model.columns.reject { |a| a.name.match(/_id$/) }.each do |column|\n fields << resolve(column.type, column.name)\n end\n end\n end",
"def all\n __getobj__.column_names\n end",
"def column_names\n klass.new.attributes.keys\n end",
"def get_column_string(name, type)\n case type\n when 'primary_key' then \"primary_key :#{name}\"\n when 'integer' then \"Integer :#{name}\"\n when 'string' then \"String :#{name}\"\n when 'text' then \"String :#{name}, text: true\"\n when 'boolean' then \"TrueClass :#{name}\"\n when 'float' then \"Float :#{name}\"\n when 'date' then \"Date :#{name}\"\n when 'time' then \"Time :#{name}\"\n when 'references' then \"foreign_key :#{name.foreign_key}, :#{name.tableize}\"\n when 'references_singleton' then \"foreign_key :#{name.foreign_key}, :#{name.underscore}\"\n end\n end",
"def columns_for_search\n self.entity_columns.select(\"name, ref_type, ref_name, col_type\")\n end",
"def columns(table)\r\n tab = @handle.describe_table(table)\r\n cols = tab.columns\r\n cols.collect! do |col|\r\n column_metadata_to_column_info(col)\r\n end\r\n\r\n dbh = DBI::DatabaseHandle.new(self)\r\n\r\n primaries = {}\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|\r\nselect column_name\r\n from all_cons_columns a, all_constraints b\r\n where a.owner = b.owner\r\n and a.constraint_name = b.constraint_name\r\n and a.table_name = b.table_name\r\n and b.constraint_type = 'P'\r\n and b.owner = :1\r\n and b.table_name = :2\r\nEOS\r\n primaries[row[0]] = true\r\n end\r\n\r\n indices = {}\r\n uniques = {}\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name) do |row|\r\nselect a.column_name, a.index_name, b.uniqueness\r\n from all_ind_columns a, all_indexes b\r\n where a.index_name = b.index_name\r\n and a.index_owner = b.owner\r\n and a.table_owner = :1\r\n and a.table_name = :2\r\nEOS\r\n col_name, index_name, uniqueness = row\r\n indices[col_name] = true\r\n uniques[col_name] = true if uniqueness == 'UNIQUE'\r\n end\r\n\r\n dbh.select_all(<<EOS, tab.obj_schema, tab.obj_name).collect do |row|\r\nselect column_id, column_name, data_default\r\n from all_tab_columns\r\n where owner = :1\r\n and table_name = :2\r\nEOS\r\n col_id, col_name, default = row\r\n\r\n col = cols[col_id.to_i - 1]\r\n col_name = col['name']\r\n\r\n if default && default[0] == ?'\r\n default = default[1..-2].gsub(/''/, \"'\")\r\n end\r\n\r\n col['indexed'] = indices[col_name] || false\r\n col['primary'] = primaries[col_name] || false\r\n col['unique'] = uniques[col_name] || false\r\n col['default'] = default\r\n col\r\n end\r\n rescue OCIException => err\r\n raise_dbierror(err)\r\n end",
"def schema_parse_table(table_name, opts)\n m = output_identifier_meth(opts[:dataset])\n\n table = if opts[:schema]\n Sequel.qualify(opts[:schema], table_name)\n else\n Sequel.identifier(table_name)\n end\n\n describe(table, opts).map do |row|\n row[:db_type] = row[:type]\n row[:type] = schema_column_type(row[:db_type])\n row[:default] = nil\n row[:primary_key] = false\n [m.call(row.delete(:name)), row]\n end\n end",
"def initialize_fields_by_type\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n initialize_to_correct_date_type(field_info, field) \n end\n end",
"def schema\n @_format.schema\n end",
"def list_columns\n columns\n end",
"def columns(table_name, name = nil)#:nodoc:\n # Each table always has a row key called 'ROW'\n columns = [\n Column.new('ROW', '')\n ]\n schema = describe_table(table_name)\n doc = REXML::Document.new(schema)\n column_families = doc.elements['Schema/AccessGroup[@name=\"default\"]'].elements.to_a\n\n @hypertable_column_names[table_name] ||= {}\n for cf in column_families\n column_name = cf.elements['Name'].text\n rubified_name = rubify_column_name(column_name)\n @hypertable_column_names[table_name][rubified_name] = column_name\n columns << new_column(rubified_name, '')\n end\n\n columns\n end",
"def types\n FIELD_TYPES\n end",
"def columns\n self.class.const_get(:COLUMNS) rescue []\n end",
"def schema(obj)\n y(obj.send(\"column_names\"))\nend",
"def inspect_data_types(t)\n types = {}\n\n t.headers.each do |col|\n type = NilClass\n t[col].each do |v|\n next if v.nil?\n if v.class == String\n type = type_of(v)\n else\n type = v.class\n end\n break\n end\n types[col] = type\n end\n\n types\n end",
"def fields\n schema.fields\n end"
] |
[
"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.6164927",
"0.61490566",
"0.6136783",
"0.6112608",
"0.61099404",
"0.6064744",
"0.60387313",
"0.6022818",
"0.5999358",
"0.5988156",
"0.5952293",
"0.59503233",
"0.5946621",
"0.5901321",
"0.5900138",
"0.58924246",
"0.5890665",
"0.58661973",
"0.5845131",
"0.5839011",
"0.58003175",
"0.57776934",
"0.576877",
"0.57675654",
"0.57567257",
"0.5751855",
"0.5727368",
"0.5723259",
"0.57211876",
"0.5711258",
"0.5711142",
"0.57060003",
"0.5702587",
"0.5673364",
"0.5640551",
"0.56263673",
"0.56239015",
"0.562258",
"0.5621836",
"0.56197816",
"0.5616029",
"0.5615894",
"0.56155115",
"0.5604872",
"0.56031334",
"0.5599442",
"0.55960906",
"0.5591956",
"0.55823416",
"0.557925",
"0.5547506",
"0.55456585",
"0.55366576",
"0.5531495",
"0.5521492",
"0.55186135",
"0.5516689",
"0.5508992",
"0.5507912",
"0.5505429",
"0.55043393",
"0.5499542",
"0.54962724",
"0.549599",
"0.54921615",
"0.5491757",
"0.5479908",
"0.54712373",
"0.54336274",
"0.5418142",
"0.5407079",
"0.53894097",
"0.5382353",
"0.5369242",
"0.5368731",
"0.5363622",
"0.5361438",
"0.5355933",
"0.53486925",
"0.53475165"
] |
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 true\n end\n rescue\n false\n end\n end",
"def table_exists?(name)\n if respond_to?(:tables)\n tables.include?(name.to_sym)\n else\n from(name).first\n true\n end\n rescue\n false\n end",
"def table_exists?(table_name)\n return false unless table_name\n schema, table = split_table_name(table_name)\n tables(nil, schema, table).any?\n end",
"def table_exists?(name)\n return @tables[name] if @tables.key? name\n\n @tables[name] = connection.table_exists?(name)\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_exists?(name)\n select_value(\"SELECT COUNT(*) FROM pg_namespace WHERE nspname = '#{name}'\", 'SCHEMA').to_i > 0\n end",
"def table_exists?\n db.table_exists?(table_name)\n end",
"def table_exists? (table_name)\r\n if !get_tables.include? (table_name)\r\n puts \"the current database doesn't include a table called \\\"#{table_name}\\\"\"\r\n return false\r\n end\r\n true\r\n end",
"def table_exists?(table_name)\n sql = 'select count(*) as table_exists from pg_tables where tablename = $1::varchar'\n result = conn.exec_params(sql, [table_name])\n result[0]['table_exists'] == 0 ? false : true\n end",
"def exists?(table_name)\n @admin.tableExists(TableName.valueOf(table_name))\n end",
"def table_exist?(table_name)\n res = run_single_result(\"SELECT COUNT(*) FROM X$File\n WHERE Xf$Name = '#{table_name}'\")\n res == 1\n end",
"def ∃table?(table_name); self.sql(\"SELECT does_table_exist('#{table_name}');\").rows[0][0]; end",
"def table_exists(table_name)\n ActiveRecord::Base.connection.execute(\"SELECT EXISTS(SELECT * FROM information_schema.tables WHERE table_name = '#{table_name}');\").first['exists'] == 't'\n end",
"def exist(name)\n raise TableError, \"Table #{name} already exist.\" if File.exist?(\"app/services/db/tables/#{name}.json\")\n end",
"def table_exists?(table)\n table_info(table) ? true : false\n end",
"def table_exists?(table_name:)\n return true if @table_names.include?(table_name)\n update_table_cache\n @table_names.include?(table_name)\n end",
"def table_exists?\n true\n end",
"def table_exists?(tablename)\r\n raise(ArgumentError, 'Table name must be a symbol!') unless \\\r\n tablename.is_a?(Symbol)\r\n\r\n return @engine.table_exists?(tablename)\r\n end",
"def exists?(name, table)\n Existence.new(name, table).matches?\n end",
"def table_exists(dbh, db_name, tbl_name)\n return !dbh.select_one(\"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES\n WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?\",\n db_name, tbl_name).nil?\nend",
"def table_exists?(table='test_ruby') \n begin\n res = @db.query(\"select * from #{table} where 1=0\")\n return true\n rescue\n return false\n end\n end",
"def table_exists?(name)\n ActiveSupport::Deprecation.warn(<<-MSG.squish)\n #table_exists? currently checks both tables and views.\n This behavior is deprecated and will be changed with Rails 5.1 to only check tables.\n Use #data_source_exists? instead.\n MSG\n\n data_source_exists?(name)\n end",
"def tableExists(table_name)\n raise ArgumentError, \"Table #{table_name} does not exist.\" unless exists?(table_name)\n end",
"def exists?\n begin\n res=@db.fetch %Q/ SELECT tablename FROM pg_tables WHERE tablename='%s' AND schemaname='%s'/ % [table_name,schema_name]\n if res.count == 0\n res=@db.fetch %Q/ SELECT viewname FROM pg_views WHERE viewname='%s'AND schemaname='%s'/ % [table_name,schema_name]\n end\n rescue PG::Error => err\n return false\n end\n\n # also say false if the table is empty\n if res.count > 0\n return ds.select(1).limit(1).count > 0\n else\n return true\n end\n return false\n end",
"def exists?\n schema.exists?(self)\n end",
"def exists?\n Table.exists?(db, auditor.audit_db, name)\n end",
"def exists?\n !service.get_table(instance_id, name, view: :NAME_ONLY).nil?\n rescue Google::Cloud::NotFoundError\n false\n end",
"def has_table?(table_id)\n begin\n table table_id\n rescue\n false\n else\n true\n end\n end",
"def table_exists?\n resp = dynamodb_client.describe_table(table_name: table_name)\n resp.table.table_status == 'ACTIVE'\n rescue DynamoDB::Errors::ResourceNotFoundException\n false\n end",
"def table_exists?\n @table_exists = ActiveRecord::Base.connection.table_exists? @model.table_name if @table_exists == nil\n @table_exists\n end",
"def not_exist(name)\n raise TableError, \"Table #{name} doesn't exist.\" unless File.exist?(\"app/services/db/tables/#{name}.json\")\n end",
"def schema_defined_for?(statement_name)\n !!schema_for(statement_name)\n end",
"def table_exists?\n @table_exists ||= {}\n @table_exists[current_site] ||= ActiveRecord::Base.connection.table_exists?(@model.table_name)\n end",
"def exist_tables?\n @db.tables.sort == [:mirrors, :users, :user_tokens, :products, :products_users, :versions, :dependencies, :access_keys].sort\n end",
"def has_table?(table)\n tables.map(&:to_s).include?(table)\n end",
"def table_exists?(table)\n ActiveRecord::Base.connection.table_exists?(table)\nend",
"def table_exists?(table)\n ActiveRecord::Base.connection.table_exists?(table)\nend",
"def exists?(slug)\n File.exists? table_path(slug)\n end",
"def db_exist?(db_name)\n list_schemas.include?(db_name)\n end",
"def storage_exists?(storage_name)\n statement = <<-SQL.compress_lines\n SELECT COUNT(*)\n FROM \"information_schema\".\"tables\"\n WHERE \"table_type\" = 'BASE TABLE'\n AND \"table_schema\" = ?\n AND \"table_name\" = ?\n SQL\n\n query(statement, schema_name, storage_name).first > 0\n end",
"def table_filtered?(schema_name, table_type)\n %w[information_schema pg_catalog].include?(schema_name) || table_type !~ /TABLE/i\n end",
"def create_table?(*args, &block)\n create_table(*args, &block) unless table_exists?\n end",
"def cache_table_exists?\n @pg.exec(%{SELECT 1 FROM pg_class WHERE pg_class.relname = '#{@table_name}';}).ntuples.eql?(1)\n end",
"def supports_create_table_if_not_exists?\n false\n end",
"def supports_create_table_if_not_exists?\n true\n end",
"def feature_table_exists?\n Feature::FlipperFeature.table_exists?\n rescue StandardError\n false\n end",
"def schema_in_use?(tenant)\n schema = ActiveRecord::Base.connection.\n execute(\"SELECT schema_name\n FROM information_schema.schemata\n WHERE schema_name = '#{tenant}'\")\n schema.ntuples > 0\n end",
"def exist?(name)\n @data_adapter.has_relation? name\n end",
"def aggregation_schedules_table_exists?\n return true unless Rails.env.test?\n\n Namespace::AggregationSchedule.table_exists?\n end",
"def migration_exists?(table_name)\n Dir.glob(\"#{File.join(destination_root, migration_path)}/[0-9]*_*.rb\").grep(/\\d+_add_heimdallr_#{table_name}.rb$/).first\n end",
"def exists?(name)\r\n \t!template_paths(name).empty?\r\n end",
"def table_or_view_ready?\n Admin::MigrationGenerator.table_or_view_exists?(table_name)\n rescue StandardError => e\n @extra_error = e\n false\n end",
"def create_table?(name, options=OPTS, &block)\n if options[:partition_of]\n create_table(name, options.merge!(:if_not_exists=>true), &block)\n return\n end\n\n super\n end",
"def create_table?(*args, &block)\n if !db.table_exists?(model.table_name)\n create_table(*args, &block)\n end\n end",
"def get_table(table_name)\n db.execute <<-SQL\n Select * from #{table_name}\n SQL\n rescue SQLite3::SQLException\n false\n end",
"def table_does_not_exist\n exists = table_exists?\n errors.add(:base, :table_exists, {:table_name => to_table}) if exists\n !exists\n end",
"def exists?\n @executor.call({\n command: :keyspaces,\n transformer_arguments: {\n executor: @executor,\n },\n }).any? { |keyspace| keyspace.name == @name }\n end",
"def storage_exists?(storage_name)\n statement = <<-EOS.compress_lines\n SELECT COUNT(*)\n FROM `information_schema`.`columns`\n WHERE `table_schema` = ? AND `table_name` = ?\n EOS\n\n query(statement, db_name, storage_name).first > 0\n end",
"def dataset?(name)\n run rql.db(options[:db]).table_list.contains(name.to_s)\n end",
"def model_exists?(model)\n model.exists? # Throws invalid ActiveRecord::StatementInvalid if doesn't exist\n rescue ActiveRecord::StatementInvalid => e\n return false if e.message.match?(/Table .* doesn't exist/i)\n\n raise e\n end",
"def named_db_exists?(connection, name)\n connection.exec(\"SELECT count(*) AS result FROM pg_database WHERE datname='#{name}'\")[0]['result'] == '1'\n end",
"def previous_table_migration_exists?(name, mode: '*', export_type: nil)\n dirname = db_migration_dirname export_type\n cname_us = \"#{mode}_#{name}_??????\"\n filepath = \"#{dirname}/*_#{cname_us}.rb\"\n Dir.glob(filepath).present?\n end",
"def serving?(table)\n self.tables.include?(table)\n end",
"def database_exists?(name)\n database = ::MySQL::Database.find_by_name(name)\n !database.nil?\n end",
"def oauth_applications_exists?\n ActiveRecord::Base.connection.table_exists? :oauth_applications\n end",
"def table_filter(schemaName, tblName, tblType)\n [\"information_schema\", \"pg_catalog\"].include?(schemaName) || tblType !~ /TABLE/i\n end",
"def report_active?\n\t\tbegin\n\t\t\tReport.table_exists?\n\t\trescue\n\t\t\tfalse\n\t\tend\n\tend",
"def create_table\n if TinyDyno::Adapter.table_exists?(table_name: self.table_name)\n return true\n end\n raise InvalidTableDefinition.new \"#{ self.name } has invalid table configuration\" unless model_table_config_is_valid?\n TinyDyno::Adapter.create_table(create_table_request)\n end",
"def should_create?(klass)\n table_name = klass.to_s.tableize\n ActiveRecord::Base.connection.table_exists?(table_name) && !klass.any?\n end",
"def exists?(name)\n name = name.to_s if name.is_a?(Symbol)\n __getobj__.columns_hash.key?(name)\n end",
"def valid_table_name?(name)\n name =~ /^([a-z]|[A-Z]){1}([a-z]|[A-Z]|\\d){2,62}$/\n end",
"def supports_drop_table_if_exists?\n true\n end",
"def supports_drop_table_if_exists?\n true\n end",
"def check_table_exists(id, timeout=nil)\r\n find_by_id_and_tag(id, \"table\", timeout)\r\n end",
"def table_does_not_exist\n table = sandbox.datasets.find_by_name(to_table)\n errors.add(:base, :table_exists, {:table_name => to_table}) if table\n end",
"def supports_drop_table_if_exists?\n supports_create_table_if_not_exists?\n end",
"def valid_table_name?(name)\r\n name =~ /^([a-z]|[A-Z]){1}([a-z]|[A-Z]|\\d){2,62}$/\r\n end",
"def supports_schema_parsing?\n respond_to?(:schema_parse_table, true)\n end",
"def exists? (name:, database: Arango.current_database)\n args = { name: name }\n result = Arango::Requests::Graph::Get.execute(server: database.server, args: args)\n result.graphs.map { |c| c[:name] }.include?(name)\n end",
"def drop_table?\n db.drop_table?(table_name)\n end",
"def database_exists(dbh, db_name)\n return !dbh.select_one(\"SELECT SCHEMA_NAME\n FROM INFORMATION_SCHEMA.SCHEMATA\n WHERE SCHEMA_NAME = ?\", db_name).nil?\nend",
"def exists\n self.class.exists(@name)\n end",
"def trigger_exists?(table_name, trigger_name)\n triggers(table_name).detect { |i| i.name == trigger_name }\n end",
"def supports_create_table_if_not_exists?\n server_version >= 90100\n end",
"def valid_name?\n proto_table.key?(@name)\n end",
"def table_has_rows?(table_name)\n scanner = @stargate.open_scanner(table_name)\n rows = @stargate.get_rows(scanner, limit = 1)\n not rows.empty?\n end",
"def tables(name = nil)\n query(<<-SQL, 'SCHEMA').map { |row| row[0] }\n SELECT tablename\n FROM pg_tables\n WHERE schemaname = ANY (ARRAY['public'])\n SQL\n end",
"def exist?(name)\n File.exist?(path(name))\n end",
"def supports_table_listing?\n respond_to?(:tables)\n end",
"def exists?\n zk.exists?(path)\n end",
"def namespace_exists?(name, context = T.unsafe(nil)); end",
"def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not exist in the table.\"\n false\n else\n true\n end\n end",
"def exists?(name)\n get(name).exists?\n end",
"def exists(table, where = {})\n count(table, where) > 0\n end",
"def db_exists? db_name\n File.exists? db_name\n end",
"def tables(name = nil)\n if name\n ActiveSupport::Deprecation.warn(<<-MSG.squish)\n Passing arguments to #tables is deprecated without replacement.\n MSG\n end\n\n select_values(\"SELECT tablename FROM pg_tables WHERE schemaname = ANY(current_schemas(false))\", 'SCHEMA')\n end",
"def schema_loaded?\n @schema_loaded\n end",
"def schema_and_table(table_name)\n schema_utility_dataset.schema_and_table(table_name)\n end",
"def tables(name = nil, schema = nil, table = nil)\n schema = schema ? \"'#{quote_string(schema)}'\" : 'CURRENT_SCHEMA'\n select_rows(\n \"SELECT table_name \"+\n \"FROM information_schema.tables \"+\n \"WHERE table_type = 'TABLE' \"+\n \" AND table_schema = #{schema} \"+\n (table ? \"AND table_name = '#{quote_string(table)}'\" : \"\"),\n SCHEMA_LOG_NAME\n ).map { |row|\n row[0]\n }\n end"
] |
[
"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.6947884",
"0.6907101",
"0.6903122",
"0.6862931",
"0.6855214",
"0.6657771",
"0.66565424",
"0.6654635",
"0.6624855",
"0.66182935",
"0.6574844",
"0.65592664",
"0.65551966",
"0.655014",
"0.6518099",
"0.6483021",
"0.6483021",
"0.6425023",
"0.6370868",
"0.6364136",
"0.63519996",
"0.627154",
"0.61772215",
"0.615963",
"0.613949",
"0.60786396",
"0.60517114",
"0.6040135",
"0.60317135",
"0.60166514",
"0.6004469",
"0.59875256",
"0.5984851",
"0.5935374",
"0.59316576",
"0.59030265",
"0.59026223",
"0.58971417",
"0.588828",
"0.58869714",
"0.58787906",
"0.5839721",
"0.58369064",
"0.5818803",
"0.5738836",
"0.57356113",
"0.57337254",
"0.57147187",
"0.5707258",
"0.57068473",
"0.5693271",
"0.5692484",
"0.5692484",
"0.56868905",
"0.5681194",
"0.56744266",
"0.56605446",
"0.5659802",
"0.5649513",
"0.56378776",
"0.5615158",
"0.5611712",
"0.5610645",
"0.5602562",
"0.5600399",
"0.55964655",
"0.5574401",
"0.5569557",
"0.55611414",
"0.55591863",
"0.55532646",
"0.5544055",
"0.5529607",
"0.55154085",
"0.5515225",
"0.55148005",
"0.5510451",
"0.5508385",
"0.55074376"
] |
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 = fetch('show indexes from ' + table_name.to_s).all\n results.each do |idx_entry|\n idx_name = idx_entry[:Name].to_sym\n next if idx_name == :primary # ignore primary index\n idxs[idx_name] ||= { name: idx_name.to_s }\n idx = idxs[idx_name]\n idx[:unique] = idx_entry[:Unique]\n idx[:deferrable] = false\n idx[:columns] ||= []\n idx[:columns] << idx_entry[:Column].to_sym unless idx_entry[:Implicit]\n end\n idxs\n end",
"def indexes(table_name, name = nil)\n []\n end",
"def indexes(table_name, name = nil)\n []\n end",
"def indexes(table, opts=OPTS)\n m = output_identifier_meth\n cond = {Sequel[:tab][:oid]=>regclass_oid(table, opts)}\n cond[:indpred] = nil unless opts[:include_partial]\n\n indexes = {}\n _indexes_ds.where_each(cond) do |r|\n i = indexes[m.call(r[:name])] ||= {:columns=>[], :unique=>r[:unique], :deferrable=>r[:deferrable]}\n i[:columns] << m.call(r[:column])\n end\n indexes\n end",
"def row_indexes(get_at = nil)\n @@row_indexes[@length] ||= begin\n @length.times.map do |count|\n @length.times.map do |inner_count|\n inner_count + (count * @length)\n end\n end\n end\n if get_at\n @@row_indexes[@length][get_at]\n else\n @@row_indexes[@length]\n end\n end",
"def indexes(table_name)\n data = select(\"EXEC sp_helpindex #{quote(table_name)}\", \"SCHEMA\") rescue []\n\n data.reduce([]) do |indexes, index|\n index = index.with_indifferent_access\n\n if index[:index_description] =~ /primary key/\n indexes\n else\n name = index[:index_name]\n unique = index[:index_description].to_s.match?(/unique/)\n where = select_value(\"SELECT [filter_definition] FROM sys.indexes WHERE name = #{quote(name)}\")\n orders = {}\n columns = []\n\n index[:index_keys].split(',').each do |column|\n column.strip!\n\n if column.ends_with?('(-)')\n column.gsub! '(-)', ''\n orders[column] = :desc\n end\n\n columns << column\n end\n\n indexes << IndexDefinition.new(table_name, name, unique, columns, where: where, orders: orders)\n end\n end\n end",
"def indexes(table_name,opts=OPTS)\n m = output_identifier_meth\n idxs = ado_schema_indexes(table_name).inject({}) do |memo, idx|\n unless idx[\"PRIMARY_KEY\"]\n index = memo[m.call(idx[\"INDEX_NAME\"])] ||= {\n :columns=>[], :unique=>idx[\"UNIQUE\"]\n }\n index[:columns] << m.call(idx[\"COLUMN_NAME\"])\n end\n memo\n end\n idxs\n end",
"def indexes(table_name, name = nil)#:nodoc:\n indexes = []\n current_index = nil\n (execute(\"SHOW KEYS FROM #{table_name}\", name) || []).each do |row|\n if current_index != row[2]\n next if row[2] == \"PRIMARY\" # skip the primary key\n current_index = row[2]\n indexes << ActiveRecord::ConnectionAdapters::IndexDefinition.new(row[0], row[2], row[1] == \"0\", [], row[10] == \"SPATIAL\")\n end\n indexes.last.columns << row[4]\n end\n indexes\n end",
"def indexes\n @indexes ||= connection.indexes(table_name)\n end",
"def indexes(table_name, _name = nil)\n stmt = @connection.indexes(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop unless stmt.nil?\n\n index_cols = []\n index_name = nil\n unique = nil\n\n result.each_with_object([]).with_index do |(row, indices), row_idx|\n # Skip table statistics\n next if row[6].zero? # SQLStatistics: TYPE\n\n if row[7] == 1 # SQLStatistics: ORDINAL_POSITION\n # Start of column descriptor block for next index\n index_cols = []\n unique = row[3].zero? # SQLStatistics: NON_UNIQUE\n index_name = String.new(row[5]) # SQLStatistics: INDEX_NAME\n end\n\n index_cols << format_case(row[8]) # SQLStatistics: COLUMN_NAME\n next_row = result[row_idx + 1]\n\n if (row_idx == result.length - 1) || (next_row[6].zero? || next_row[7] == 1)\n indices << ActiveRecord::ConnectionAdapters::IndexDefinition.new(table_name, format_case(index_name), unique, index_cols)\n end\n end\n end",
"def indexes(table_name, _name = nil)\n stmt = @connection.indexes(native_case(table_name.to_s))\n result = stmt.fetch_all || []\n stmt.drop unless stmt.nil?\n\n index_cols = []\n index_name = nil\n unique = nil\n\n result.each_with_object([]).with_index do |(row, indices), row_idx|\n # Skip table statistics\n next if row[6].zero? # SQLStatistics: TYPE\n\n if row[7] == 1 # SQLStatistics: ORDINAL_POSITION\n # Start of column descriptor block for next index\n index_cols = []\n unique = row[3].zero? # SQLStatistics: NON_UNIQUE\n index_name = String.new(row[5]) # SQLStatistics: INDEX_NAME\n end\n\n index_cols << format_case(row[8]) # SQLStatistics: COLUMN_NAME\n next_row = result[row_idx + 1]\n\n if (row_idx == result.length - 1) || (next_row[6].zero? || next_row[7] == 1)\n indices << ActiveRecord::ConnectionAdapters::IndexDefinition.new(table_name, format_case(index_name), unique, index_cols)\n end\n end\n end",
"def indexes(table, opts=OPTS)\n return super unless opts.empty?\n\n quoted_name = literal(table)\n if v = Sequel.synchronize{@indexes[quoted_name]}\n return v\n end\n\n result = super\n Sequel.synchronize{@indexes[quoted_name] = result}\n result\n end",
"def get_indexes\n table_cond = @files ? \"AND r.relname IN (#{@files.map{|(t,f)|\"'#{t}'\"}.join(', ')})\" : ''\n results = query(<<-SQL)\n SELECT\n r.relname,\n i.relname,\n ri.indisprimary,\n pg_get_indexdef(i.oid)\n FROM\n pg_class r,\n pg_class i,\n pg_index ri\n WHERE\n ri.indexrelid = i.oid\n AND ri.indrelid = r.oid\n AND r.relkind = 'r'\n AND i.relkind = 'i'\n AND r.relnamespace = (SELECT oid FROM pg_namespace WHERE nspname = '#{@config[:schema]}')\n #{table_cond}\n SQL\n\n hash = Hash.new(){|hash, key| hash.store(key, [])}\n results.each do |row|\n table, index, primary_key, create_sql = row.split(/\\t/)\n hash[table] << {:index => index, :primary_key => primary_key == 't', :create_sql => create_sql}\n end\n hash\n end",
"def indices\n @data.keys\n end",
"def to_a\n indices\n end",
"def indices\n @indices.to_a\n end",
"def indexes_on(partitioned_table)\n return [] if Gem::Version.new(Rails.version) >= Gem::Version.new('6.0.3')\n return [] unless connection.supports_indexes_on_partitioned_tables?\n\n Indexes.new(connection).on(partitioned_table)\n end",
"def indexes(table_name, name = nil) #:nodoc:\n schemas = schema_search_path.split(/,/).map { |p| quote(p) }.join(',')\n result = query(<<-SQL, name)\nSELECT i.relname, d.indisunique, a.attname\nFROM pg_class t, pg_class i, pg_index d, pg_attribute a, pg_namespace n\nWHERE i.relkind = 'i'\nAND d.indexrelid = i.oid\nAND d.indisprimary = 'f'\nAND t.oid = d.indrelid\nAND t.relname = '#{table_name}'\nAND a.attrelid = t.oid\nAND n.nspname in (#{schemas})\nAND n.oid = t.relnamespace\nAND ( d.indkey[0]=a.attnum OR d.indkey[1]=a.attnum\nOR d.indkey[2]=a.attnum OR d.indkey[3]=a.attnum\nOR d.indkey[4]=a.attnum OR d.indkey[5]=a.attnum\nOR d.indkey[6]=a.attnum OR d.indkey[7]=a.attnum\nOR d.indkey[8]=a.attnum OR d.indkey[9]=a.attnum )\nORDER BY i.relname\nSQL\n \n current_index = nil\n indexes = []\n \n result.each do |row|\n if current_index != row[0]\n indexes << IndexDefinition.new(table_name, row[0], row[1] == \"t\", [])\n current_index = row[0]\n end\n \n indexes.last.columns << row[2]\n end\n \n indexes\n end",
"def ids(table)\n res = connection.query(\"SELECT id FROM #{table} GROUP BY id\")\n id_list = []\n res.each { |i| id_list << i[0].to_i }\n return id_list\n end",
"def indexes(table_name, name = nil)\n select_rows(\n \"SELECT index_name, \"+\n \" is_unique \"+\n \"FROM information_schema.indexes \"+\n \"WHERE table_schema = CURRENT_SCHEMA \"+\n \" AND table_name = '#{quote_string(table_name.to_s)}' \"+\n \" AND index_type <> 'PRIMARY' \"+\n \"ORDER BY index_name\",\n name || SCHEMA_LOG_NAME\n ).map { |row|\n cols = select_rows(\n \"SELECT column_name \"+\n \"FROM information_schema.index_columns \"+\n \"WHERE index_table_schema = CURRENT_SCHEMA \"+\n \" AND index_table_name = '#{quote_string(table_name.to_s)}' \"+\n \" AND index_name = '#{quote_string(row[0])}' \"+\n \"ORDER BY ordinal_position\",\n name || SCHEMA_LOG_NAME\n ).map { |col_row|\n col_row[0]\n }\n IndexDefinition.new(table_name, row[0], row[1] == 'YES', cols, [], {})\n }\n end",
"def indexes(table_name, name = nil)\n result = query(\"exec sp_helpindex '#{table_name}'\", name)\n \n indexes = []\n result.each do |row|\n if row[1].match('primary key') == nil\n indexes << IndexDefinition.new(table_name, row[0], row[1].match('unique') != nil, row[2].split(',').each {|x| x.strip!})\n end\n end\n \n indexes\n end",
"def sql_indices_for_class(klass)\n indices = []\n\n for a in klass.serializable_attributes\n indices << a if klass.ann(a, :index)\n end\n\n return indices\n end",
"def indexes(table_name, name = nil) #:nodoc:\r\n sql = \"SELECT name, INDEX_OPTIONS & 1 AS [unique], index_expression FROM SYSTEM.INDEXES WHERE parent = '#{table_name}'\"\r\n select(sql, name).map do |row|\r\n index = IndexDefinition.new(table_name, row['name'])\r\n index.unique = row['unique'] == 1\r\n index.columns = row['index_expression']\r\n index\r\n end\r\n end",
"def omim_ids\n @table.keys\n end",
"def indexes(table_name, name = nil)\n result = @connection.indexes.values.select {|ix| ix.table_name == table_name && ix.index_name !~ /^rdb\\$/ }\n indexes = result.map {|ix| IndexDefinition.new(table_name, ix.index_name, ix.unique, ix.columns) }\n indexes\n end",
"def indexes(table_name, name = nil)\n schemas = schema_search_path.split(/,/).map { |p| quote(p) }.join(',')\n result = query(<<-SQL, name)\n SELECT i.relname, d.indisunique, d.indkey, t.oid, am.amname\n FROM pg_class t, pg_class i, pg_index d, pg_attribute a, pg_am am\n WHERE i.relkind = 'i'\n AND d.indexrelid = i.oid\n AND d.indisprimary = 'f'\n AND t.oid = d.indrelid\n AND i.relam = am.oid\n AND t.relname = '#{table_name}'\n AND a.attrelid = t.oid\n AND ( d.indkey[0]=a.attnum OR d.indkey[1]=a.attnum\n OR d.indkey[2]=a.attnum OR d.indkey[3]=a.attnum\n OR d.indkey[4]=a.attnum OR d.indkey[5]=a.attnum\n OR d.indkey[6]=a.attnum OR d.indkey[7]=a.attnum\n OR d.indkey[8]=a.attnum OR d.indkey[9]=a.attnum )\n ORDER BY i.relname\n SQL\n\n indexes = []\n\n indexes = result.map do |row|\n index_name = row[0]\n unique = row[1] == 't'\n indkey = row[2].split(\" \")\n oid = row[3]\n spatial = row[4] == \"gist\"\n\n columns = query(<<-SQL, \"Columns for index #{row[0]} on #{table_name}\").inject({}) {|attlist, r| attlist[r[1]] = r[0]; attlist}\n SELECT a.attname, a.attnum\n FROM pg_attribute a\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n SQL\n\n column_names = indkey.map {|attnum| columns[attnum] }\n ActiveRecord::ConnectionAdapters::IndexDefinition.new(table_name, index_name, unique, column_names, spatial)\n end\n\n indexes\n end",
"def indices\n return [\n columns.nil? ? nil : columns.begin,\n rows.nil? ? nil : rows.begin,\n columns.nil? ? nil : columns.end,\n rows.nil? ? nil : rows.end\n ]\n end",
"def indexes\n @indexes ||= []\n end",
"def indexes(table_name)\n\n # FIXME: AR version => table = Utils.extract_schema_qualified_name(table_name.to_s)\n schema, table = extract_schema_and_table(table_name.to_s)\n\n result = query(<<-SQL, 'SCHEMA')\n SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid,\n pg_catalog.obj_description(i.oid, 'pg_class') AS comment\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n LEFT JOIN pg_namespace n ON n.oid = i.relnamespace\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = '#{table}'\n AND n.nspname = #{schema ? \"'#{schema}'\" : 'ANY (current_schemas(false))'}\n ORDER BY i.relname\n SQL\n\n result.map do |row|\n index_name = row[0]\n # FIXME: These values [1,2] are returned in a different format than AR expects, maybe we could update it on the Java side to be more accurate\n unique = row[1].is_a?(String) ? row[1] == 't' : row[1] # JDBC gets us a boolean\n indkey = row[2].is_a?(Java::OrgPostgresqlUtil::PGobject) ? row[2].value : row[2]\n indkey = indkey.split(\" \").map(&:to_i)\n inddef = row[3]\n oid = row[4]\n comment = row[5]\n\n using, expressions, where = inddef.scan(/ USING (\\w+?) \\((.+?)\\)(?: WHERE (.+))?\\z/m).flatten\n\n orders = {}\n opclasses = {}\n\n if indkey.include?(0)\n columns = expressions\n else\n columns = Hash[query(<<-SQL.strip_heredoc, \"SCHEMA\")].values_at(*indkey).compact\n SELECT a.attnum, a.attname\n FROM pg_attribute a\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n SQL\n\n # add info on sort order (only desc order is explicitly specified, asc is the default)\n # and non-default opclasses\n expressions.scan(/(?<column>\\w+)\\s?(?<opclass>\\w+_ops)?\\s?(?<desc>DESC)?\\s?(?<nulls>NULLS (?:FIRST|LAST))?/).each do |column, opclass, desc, nulls|\n opclasses[column] = opclass.to_sym if opclass\n if nulls\n orders[column] = [desc, nulls].compact.join(' ')\n elsif desc\n orders[column] = :desc\n end\n end\n end\n\n IndexDefinition.new(\n table_name,\n index_name,\n unique,\n columns,\n orders: orders,\n opclasses: opclasses,\n where: where,\n using: using.to_sym,\n comment: comment.presence\n )\n end\n end",
"def all_indexes\n\t\tindex_list = []\n\t\tfor y_index in 0..7\n\t\t\tfor x_index in 0..7\n\t\t\t\tindex_list << [y_index, x_index]\n\t\t\tend\n\t\tend\n\t\tindex_list\n\tend",
"def indexes\n @indexes ||= connection.indexes(table_name, \"#{name} Indexes\")\n end",
"def column_indexes(get_at = nil)\n @@column_indexes[@length] ||= begin\n @length.times.map do |count|\n @length.times.map do |inner_count|\n inner_count * @length + count\n end\n end\n end\n if get_at\n @@column_indexes[@length][get_at]\n else\n @@column_indexes[@length]\n end\n end",
"def indexes(table_name)\n scope = quoted_scope(table_name)\n\n result = query(<<-SQL, \"SCHEMA\")\n SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid,\n pg_catalog.obj_description(i.oid, 'pg_class') AS comment\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n LEFT JOIN pg_namespace n ON n.oid = i.relnamespace\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = #{scope[:name]}\n AND n.nspname = #{scope[:schema]}\n ORDER BY i.relname\n SQL\n\n result.map do |row|\n index_name = row[0]\n unique = row[1]\n indkey = row[2].split(\" \").map(&:to_i)\n inddef = row[3]\n oid = row[4]\n comment = row[5]\n\n using, expressions, where = inddef.scan(/ USING (\\w+?) \\((.+?)\\)(?: WHERE (.+))?\\z/m).flatten\n\n orders = {}\n opclasses = {}\n\n if indkey.include?(0)\n definition = inddef.sub(INDEX_WHERE_EXPRESSION, '')\n\n if column_expression = definition.match(INDEX_COLUMN_EXPRESSION)[1]\n columns = split_expression(expressions).map do |functional_name|\n remove_type(functional_name)\n end\n\n columns = columns.size > 1 ? columns : columns[0]\n end\n else\n columns = Hash[query(<<-SQL.strip_heredoc, \"SCHEMA\")].values_at(*indkey).compact\n SELECT a.attnum, a.attname\n FROM pg_attribute a\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n SQL\n\n # add info on sort order (only desc order is explicitly specified, asc is the default)\n # and non-default opclasses\n expressions.scan(/(?<column>\\w+)\"?\\s?(?<opclass>\\w+_ops)?\\s?(?<desc>DESC)?\\s?(?<nulls>NULLS (?:FIRST|LAST))?/).each do |column, opclass, desc, nulls|\n opclasses[column] = opclass.to_sym if opclass\n if nulls\n orders[column] = [desc, nulls].compact.join(\" \")\n else\n orders[column] = :desc if desc\n end\n end\n end\n\n IndexDefinition.new(\n table_name,\n index_name,\n unique,\n columns,\n orders: orders,\n opclasses: opclasses,\n where: where,\n using: using.to_sym,\n comment: comment.presence\n )\n end\n end",
"def keys\n in_transaction\n @table.keys\n end",
"def indexes\n @model.indexes.select{|index| index.columns.include? self.name}\n end",
"def indexes(table_name, name = nil)\n schemas = schema_search_path.split(/,/).map { |p| quote(p) }.join(',')\n \n # Changed from upstread: link to pg_am to grab the index type (e.g. \"gist\")\n result = query(<<-SQL, name)\n SELECT distinct i.relname, d.indisunique, d.indkey, t.oid, am.amname\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n INNER JOIN pg_attribute a ON a.attrelid = t.oid\n INNER JOIN pg_am am ON i.relam = am.oid\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = '#{table_name}'\n AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN (#{schemas}) )\n ORDER BY i.relname\n SQL\n\n indexes = result.map do |row|\n index_name = row[0]\n unique = row[1] == 't'\n indkey = row[2].split(\" \")\n oid = row[3]\n indtype = row[4]\n\n # Changed from upstream: need to get the column types to test for spatial indexes\n columns = query(<<-SQL, \"Columns for index #{row[0]} on #{table_name}\").inject({}) {|attlist, r| attlist[r[1]] = [r[0], r[2]]; attlist}\n SELECT a.attname, a.attnum, t.typname\n FROM pg_attribute a\n INNER JOIN pg_type t ON a.atttypid = t.oid\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n SQL\n\n # Only GiST indexes on spatial columns denote a spatial index\n spatial = indtype == 'gist' && columns.size == 1 && (columns.values.first[1] == 'geometry' || columns.values.first[1] == 'geography')\n\n column_names = indkey.map {|attnum| columns[attnum] ? columns[attnum][0] : nil }.compact\n ActiveRecord::ConnectionAdapters::IndexDefinition.new(table_name, index_name, unique, column_names, spatial)\n end\n end",
"def alignments\n @alignment_table.indexes.keys\n end",
"def indexes(table, stream)\n if (indexes = @connection.indexes(table)).any?\n add_index_statements = indexes.map do |index|\n statement_parts = [\n ('add_index ' + index.table.inspect),\n index.columns.inspect,\n (':name => ' + index.name.inspect),\n ]\n statement_parts << ':unique => true' if index.unique\n\n index_lengths = (index.lengths || []).compact\n statement_parts << (':length => ' + Hash[index.columns.zip(index.lengths)].inspect) unless index_lengths.empty?\n\n index_orders = (index.orders || {})\n statement_parts << (':order => ' + index.orders.inspect) unless index_orders.empty?\n\n # changed from rails 2.3\n statement_parts << (':where => ' + index.where.inspect) if index.where\n statement_parts << (':index_type => ' + index.index_type.inspect) if index.index_type\n statement_parts << (':index_opclass => ' + index.index_opclass.inspect) if index.index_opclass.present?\n # /changed\n\n ' ' + statement_parts.join(', ')\n end\n\n stream.puts add_index_statements.sort.join(\"\\n\")\n stream.puts\n end\n end",
"def indexes(table_name, name = nil)\n (owner, table_name) = @connection.describe(table_name)\n unless all_schema_indexes\n result = select_all(<<-SQL)\n SELECT lower(i.table_name) as table_name, lower(i.index_name) as index_name, i.uniqueness, lower(c.column_name) as column_name\n FROM all_indexes i, all_ind_columns c\n WHERE i.owner = '#{owner}'\n AND i.table_owner = '#{owner}'\n AND c.index_name = i.index_name\n AND c.index_owner = i.owner\n AND NOT EXISTS (SELECT uc.index_name FROM all_constraints uc WHERE uc.index_name = i.index_name AND uc.owner = i.owner AND uc.constraint_type = 'P')\n ORDER BY i.index_name, c.column_position\n SQL\n \n current_index = nil\n self.all_schema_indexes = []\n \n result.each do |row|\n # have to keep track of indexes because above query returns dups\n # there is probably a better query we could figure out\n if current_index != row['index_name']\n self.all_schema_indexes << ::ActiveRecord::ConnectionAdapters::IndexDefinition.new(row['table_name'], row['index_name'], row['uniqueness'] == \"UNIQUE\", [])\n current_index = row['index_name']\n end\n \n self.all_schema_indexes.last.columns << row['column_name']\n end\n end\n \n # Return the indexes just for the requested table, since AR is structured that way\n table_name = table_name.downcase\n all_schema_indexes.select{|i| i.table == table_name}\n end",
"def keys!\n @table.keys\n end",
"def all_indices\n @indices ||= []\n @indices.dup\n end",
"def field_indexes\r\n return @field_indexes\r\n end",
"def table_names\n @tables.keys\n end",
"def indices\n state(metrics: \"metadata\").dig(\"metadata\", \"indices\")\n end",
"def table_array\r\n @table_array\r\n end",
"def build_indexes\n Patient.column_names.select { |col| col != 'id' }.each do |col|\n @indexes[ col.to_sym ] = []\n end\n\n Patient.find( :all ).each do |patient|\n Patient.column_names.select { |col| col != 'id' }.each do |col|\n @indexes[ col.to_sym ] << [ patient.send( col ).to_s.strip.hash, patient.id ] unless\n ( (! EXCLUSIONS[ col ].nil?) and EXCLUSIONS[ col ].include? patient.send( col ).to_s.strip )\n end\n end\n\n @indexes.each_value { |value| value.sort! { |a,b| a[0] <=> b[0] } }\n end",
"def index_as\n Array(@index_as)\n end",
"def keys\n each_with_index.map {|_, index| index }\n end",
"def indexes_per_table\n 65_535\n end",
"def import_indexes( table )\n # Foreign keys also automatically create indexes, which we must exclude when importing.\n # But only if they look like indexes named by the automatic foreign key naming convention.\n foreign_key_indexes = table.foreign_keys.map{ |x| x.columns if x.columns.size == 1 }.compact\n for name, opts in db.indexes( table.name )\n opts = opts.dup\n opts[ :name ] = name\n columns = opts.delete( :columns )\n next if ( ! opts[ :unique ] ) && foreign_key_indexes.include?( columns ) && name == columns.first\n # Sequel currently doesn't provide info about fulltext indexes, so we have to rely on properly used names.\n opts[ :type ] = :full_text if name =~ /_fulltext$/\n opts.delete( :deferrable ) unless opts[ :deferrable ]\n table.add_index( columns, opts )\n end\n end",
"def list\n @table.keys\n end",
"def dump_table_indexes(table, meth, options={})\n return '' unless respond_to?(:indexes)\n im = method(:index_to_generator_opts)\n indexes = indexes(table).sort_by{|k,v| k.to_s} \n gen = Schema::Generator.new(self) do\n indexes.each{|iname, iopts| send(:index, iopts[:columns], im.call(table, iname, iopts))}\n end\n gen.dump_indexes(meth=>table, :ignore_errors=>!options[:same_db])\n end",
"def get_index_info(klass)\n index_info = []\n indexes = klass.connection.indexes(klass.table_name)\n indexes.each do |index|\n index_info << { :name => index.name, :columns => index.columns.join(\", \"), :unique => (index.unique ? \"UNIQUE\" : \"NO\") }\n end\n index_info\n end",
"def indexes\n indexes = []\n @attributes.each_with_index {|values,idx| indexes << idx if values}\n indexes\n end",
"def get_ids_from(table_name)\n DB::Queries.get_ids_from(table: table_name)\nend",
"def indexes(table_name, name = nil)\n result = query(<<-SQL, 'SCHEMA')\n SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = '#{table_name}'\n AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) )\n ORDER BY i.relname\n SQL\n\n result.map do |row|\n index_name = row[0]\n unique = row[1] == 't'\n indkey = row[2].split(\" \")\n inddef = row[3]\n oid = row[4]\n\n columns = query(<<-SQL, \"SCHEMA\")\n SELECT a.attnum, a.attname, t.typname\n FROM pg_attribute a, pg_type t\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n AND a.atttypid = t.oid\n SQL\n columns = columns.inject({}){ |h, r| h[r[0].to_s] = [r[1], r[2]]; h }\n column_names = columns.values_at(*indkey).compact.map{ |a| a[0] }\n\n unless column_names.empty?\n # add info on sort order for columns (only desc order is explicitly specified, asc is the default)\n desc_order_columns = inddef.scan(/(\\w+) DESC/).flatten\n orders = desc_order_columns.any? ? Hash[desc_order_columns.map {|order_column| [order_column, :desc]}] : {}\n where = inddef.scan(/WHERE (.+)$/).flatten[0]\n # using = inddef.scan(/USING (.+?) /).flatten[0].to_sym\n\n spatial = inddef =~ /using\\s+gist/i &&\n columns.size == 1 &&\n %w[geometry geography].include?(columns.values.first[1])\n\n # IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, nil, using)\n ::RGeo::ActiveRecord::SpatialIndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, !!spatial)\n end\n end.compact\n end",
"def index_as\n Array(@index_as)\n end",
"def list\n @table.keys # values\n end",
"def dump_table_indexes(table, meth, options=OPTS)\n if supports_index_parsing?\n indexes = indexes(table).sort\n else\n return ''\n end\n\n im = method(:index_to_generator_opts)\n gen = create_table_generator do\n indexes.each{|iname, iopts| send(:index, iopts[:columns], im.call(table, iname, iopts, options))}\n end\n gen.dump_indexes(meth=>table, :ignore_errors=>!options[:same_db])\n end",
"def index\n table.columns.index self\n end",
"def all_indices(elem, array)\r\n indices = []\r\n array.each_with_index do |element, index|\r\n (indices << index) if element == elem\r\n end\r\n indices\r\n end",
"def field_group_indexes(get_at = nil)\n # 9x9 -> [[0,1,2,9,10,11,18,19,20], [3,4,5,12,13,14,21,22,23], ..... ]\n @@field_group_indexes[@length] ||= begin\n base = @length / @field_size\n temp_indexes = base.times.map { |count| base.times.map { |c| count + (base * c) } }\n max_index = (length ** 2) - 1\n field_group_rows = (0..max_index).to_a.each_slice(@field_size).each_slice(@length).to_a\n indexes = field_group_rows.flat_map do |e|\n temp_indexes.map { |indexes| indexes.flat_map { |i| e[i]} }\n end\n end\n if get_at\n @@field_group_indexes[@length][get_at]\n else\n @@field_group_indexes[@length]\n end\n end",
"def get_indices\n @conn.query({url_path: \"#{database}/_index\", method: :get})\n end",
"def check_indexes(table)\n indexes = table_indexes(table)\n\n indexes.permutation(2).each_with_object([]) do |(source_index, target_index), response|\n next unless source_index.columns.start_with?(target_index.columns)\n\n if target_index.unique\n response << {\n index: source_index,\n result: \"#{source_index.name} has column(s) on the right side of unique index (#{target_index.name}). You can drop if low cardinality\",\n }\n else\n response << {\n index: target_index,\n result: \"#{target_index.name} is a left-prefix of #{source_index.name}\",\n }\n end\n end\n end",
"def table_to_array_of_arrays(table=@table)\n array = []\n table.rows.each do |row|\n row_array = []\n row.data.each_with_index do |column, index|\n data = {:text => column}\n if row.cell_format.is_a? Hash\n data.reverse_merge! row.cell_format\n elsif row.cell_format.is_a? Array\n data.reverse_merge! row.cell_format[index]\n end\n row_array << Prawn::Table::Cell.new(data)\n end\n array << row_array\n end\n array\n end",
"def indexes\n select_all( <<-SQL\n SELECT\n t.relname AS table,\n ix.relname AS name,\n regexp_replace(pg_get_indexdef(indexrelid), '^[^\\\\(]*\\\\((.*)\\\\)$', '\\\\1') AS columns,\n regexp_replace(pg_get_indexdef(indexrelid), '.* USING ([^ ]*) \\\\(.*', '\\\\1') AS using,\n indisunique AS unique,\n indisprimary AS primary,\n indisvalid AS valid,\n indexprs::text,\n indpred::text,\n pg_get_indexdef(indexrelid) AS definition\n FROM\n pg_index i\n INNER JOIN\n pg_class t ON t.oid = i.indrelid\n INNER JOIN\n pg_class ix ON ix.oid = i.indexrelid\n ORDER BY\n 1, 2\n SQL\n ).map { |v| v[\"columns\"] = v[\"columns\"].sub(\") WHERE (\", \" WHERE \").split(\", \"); v }\n end",
"def get_ids(table)\r\n valid_ids = []\r\n table_info = @db.execute(\"SELECT * FROM #{table}\")\r\n table_info.each do |line|\r\n line_info = []\r\n line.each do |name, value|\r\n if name == 'id'\r\n valid_ids << value\r\n end\r\n end\r\n end\r\n valid_ids\r\n end",
"def indexes(table_name, name = nil)\n opclasses\n result = select_rows(<<-SQL, name)\n SELECT distinct i.relname, d.indisunique, d.indkey, pg_get_indexdef(d.indexrelid), t.oid\n FROM pg_class t\n INNER JOIN pg_index d ON t.oid = d.indrelid\n INNER JOIN pg_class i ON d.indexrelid = i.oid\n WHERE i.relkind = 'i'\n AND d.indisprimary = 'f'\n AND t.relname = '#{table_name}'\n AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname = ANY (current_schemas(false)) )\n ORDER BY i.relname\n SQL\n result.map do |row|\n index_name = row[0]\n unique = row[1] == 't'\n indkey = row[2].split(\" \")\n inddef = row[3]\n oid = row[4]\n\n columns = Hash[select_rows(<<-SQL, \"Columns for index #{row[0]} on #{table_name}\")]\n SELECT a.attnum::text, a.attname\n FROM pg_attribute a\n WHERE a.attrelid = #{oid}\n AND a.attnum IN (#{indkey.join(\",\")})\n SQL\n column_names = columns.values_at(*indkey).compact\n\n # add info on sort order for columns (only desc order is explicitly specified, asc is the default)\n desc_order_columns = inddef.scan(/(\\w+) DESC/).flatten\n orders = desc_order_columns.any? ? Hash[desc_order_columns.map {|order_column| [order_column, :desc]}] : {}\n #changed from rails 3.2\n where = inddef.scan(/WHERE (.+)$/).flatten[0]\n index_type = inddef.scan(/USING (.+?) /).flatten[0].to_sym\n if index_type\n index_op = inddef.scan(/USING .+? \\(.+? (#{opclasses.join('|')})\\)/).flatten\n index_op = index_op[0].to_sym if index_op.present?\n end\n if column_names.present?\n index_def = IndexDefinition.new(table_name, index_name, unique, column_names, [], orders)\n index_def.where = where\n index_def.index_type = index_type if index_type && index_type != :btree\n index_def.index_opclass = index_op if index_type && index_type != :btree && index_op\n index_def\n # else nil\n end\n #/changed\n end.compact\n end",
"def rows\n @rows ||= begin\n row_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end",
"def list_tables\n data.keys\n end",
"def remember_index_columns_inside_table(node)\n table_name = @table_name\n index_column = node.arguments.all.first.to_object\n\n @index_columns[table_name] ||= []\n @index_columns[table_name] << index_column\n end",
"def all_indices_for_binding(array)\n all_indices(array, [], :_)\n end",
"def calcIndice\n\t\t# [true,true,false,true]\t\t\t\t[2,1]\n\t\t# [false,true,false,false]\t\t--> \t[1]\n\t\t# [true,true,true,false,true]\t\t\t[3,1]\n\n\t\t@indicesLigne = groupeIndicesGrid(@tab)\n\t\t@indicesColonne = groupeIndicesGrid(@tab.transpose)\n\t\treturn @tab\n\tend",
"def getindicesLigne(i)\n\t\treturn @indicesLigne[i]\n\tend",
"def keys\n @index.range(0, -1)\n end",
"def find_indexes(plan)\n find_by_key(plan, \"Index Name\")\n end",
"def indices\n rest.get instrument_path('indices')\n end",
"def text_indexes\n fields = self.class.text_indexes.keys\n fields.collect{|f| text_indexes_for(f)}.flatten\n end",
"def index_sql_list(table_name, indexes)\n indexes.map{|i| index_definition_sql(table_name, i)}\n end",
"def index_list_sql_list(table_name, indexes)\n indexes.map{|i| index_definition_sql(table_name, i)}\n end",
"def keys\n index.keys.collect {|keys| keys.to_s }\n end",
"def index_list_sql_list(table_name, indexes)\n indexes.map{|i| index_definition_sql(table_name, i)}\n end",
"def index_list_sql_list(table_name, indexes)\n indexes.map{|i| index_definition_sql(table_name, i)}\n end",
"def tableau index_tableau\n tableaux_in(resultat_final)[index_tableau]\n end",
"def keys\n @table.keys.inject(@parent ? @parent.keys : []) do |res, k1|\n @table[k1].keys.inject(res) do |_res, k2|\n ref = make_reference(k1, k2)\n _res.include?(ref) ? _res : res << ref\n end\n end\n end",
"def get_matching_indices pattern\n matches = []\n @obj.content.each_with_index { |e,i| \n # convert to string for tables\n e = e.to_s unless e.is_a? String\n if e =~ /#{pattern}/\n matches << i\n end\n }\n return matches\n end",
"def remember_index_columns_outside_table(node)\n table_name = node.arguments.all.first.to_s\n index_column = node.arguments.all[1].to_object\n\n @index_columns[table_name] ||= []\n @index_columns[table_name] << index_column\n end",
"def disable_indexes(table)\n list = indexes(table)\n change_table_with_remaps table do |t|\n list.each do |i|\n t.remove_index :name => i.name\n end\n end\n list\n end",
"def create_i18n_indexes(table_name)\n i18n_indexes.each do |index|\n unless indexes(table_name).map(&:columns).flatten.include? index.to_s\n add_index table_name, index\n end\n end\n end",
"def index_keys\n index_specifications.map(&:key)\n end",
"def table_elements(identifier)\n platform.tables_for(identifier.clone)\n end",
"def create_table_indices(klass)\n for idx in sql_indices_for_class(klass)\n anno = klass.ann(idx)\n idx = idx.to_s\n pre_sql, post_sql = klass.ann(idx, :pre_index), klass.ann(idx, :post_index)\n idxname = idx.gsub(/ /, \"\").gsub(/,/, \"_\").gsub(/\\(.*\\)/, \"\")\n sql = \"CREATE #{pre_sql} INDEX #{klass.table}_#{idxname}_idx #{post_sql} ON #{klass.table} (#{idx})\"\n exec(sql)\n end\n end",
"def text_indexes_for(field)\n self.class.text_indexes_for(id, field)\n end",
"def keys\n @array.transpose[0]\n end",
"def cell_index_array\n use_default_index ? 0.upto(points - 1) : concatenate_data_arrays('index', 'cells')\n end",
"def to_json_array\n @indexes.map do |ai_|\n name_ = ai_.axis_name\n axis_ = ai_.axis_object\n type_ = axis_.class.name\n if type_ =~ /^NTable::(\\w+)Axis$/\n type_ = $1\n type_ = type_[0..0].downcase + type_[1..-1]\n end\n obj_ = {'type' => type_}\n obj_['name'] = name_ if name_\n axis_.to_json_object(obj_)\n obj_\n end\n end",
"def rows\n @pz.group_by.each_with_index { |val, n| row_id(n) }\n end"
] |
[
"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.6247839",
"0.62240136",
"0.622346",
"0.62052554",
"0.6204836",
"0.6196035",
"0.6184006",
"0.61438817",
"0.6116882",
"0.60798085",
"0.607376",
"0.6014473",
"0.59945583",
"0.59918827",
"0.598288",
"0.5918346",
"0.59129477",
"0.5880687",
"0.5877557",
"0.5858263",
"0.5829146",
"0.5759101",
"0.5752113",
"0.57221746",
"0.5719882",
"0.5693691",
"0.5672805",
"0.56591827",
"0.56195825",
"0.56051916",
"0.5604738",
"0.5604616",
"0.5600024",
"0.5590656",
"0.55746603",
"0.5547663",
"0.5545299",
"0.55407965",
"0.55186486",
"0.54917866",
"0.54898715",
"0.5487862",
"0.5477855",
"0.54758555",
"0.5474334",
"0.5457109",
"0.5453507",
"0.5450881",
"0.5414469",
"0.5413984",
"0.54096204",
"0.5365493",
"0.53451",
"0.5342375",
"0.5337753",
"0.53345644",
"0.53321844",
"0.53276503",
"0.5320322",
"0.5287604",
"0.5279256",
"0.52768475",
"0.52762836",
"0.52704",
"0.52704",
"0.524476",
"0.5243527",
"0.5241571",
"0.5240237",
"0.5233445",
"0.52294415",
"0.5204425",
"0.5193213",
"0.51773536",
"0.51761854",
"0.51443803",
"0.51259744",
"0.5124236",
"0.5115715"
] |
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\"\n elapse = Time.now\n ips = getnodes.map{|x| x.ip}\n all = cmd.include?('all')\n init = cmd.include?('init')\n config = cmd.include?('config')\n dashboard = cmd.include?('dashboard')\n helm = cmd.include?('helm')\n weave = cmd.include?('weave')\n flannel = cmd.include?('flannel')\n flannel = true if !weave\n\n # Validate host environment\n #---------------------------------------------------------------------------\n puts(\":: Validating the K8s host environment\".colorize(:cyan))\n Log.die(\"Ensure 'kubectl' is installed and on the $PATH\") unless FileUtils.exec?('kubectl')\n host_k8sver = `kubectl version --client`[/GitVersion.*v([\\d]+\\.[\\d]+\\.[\\d]+)/, 1]\n !puts(\"Kubectl needs to be version #{@k8sver} or higher\".colorize(:red)) and\n exit unless Gem::Version.new(host_k8sver) >= Gem::Version.new(@k8sver)\n puts(\"Host K8s Version: #{host_k8sver}\".colorize(:green))\n\n Log.die(\"Ensure 'helm' is installed and on the path\") unless FileUtils.exec?('helm')\n host_helmver = `helm version --client`[/\\d+\\.\\d+\\.\\d+/]\n !puts(\"Helm needs to be version #{@helmver} or higher\".colorize(:red)) and\n exit unless Gem::Version.new(host_helmver) >= Gem::Version.new(@helmver)\n puts(\"Host Helm Version: #{host_helmver}\".colorize(:green))\n\n # Validate node environment\n #---------------------------------------------------------------------------\n puts(\":: Validating the K8s node environment\".colorize(:cyan))\n node_k8sver = nil\n puts(\"Nodes: #{ips * ', '}\".colorize(:cyan))\n Net::SSH.start(ips.first, @user, password:@pass, verify_host_key: :never){|ssh|\n node_k8sver = ssh.exec!(\"kubectl version --client\")[/GitVersion.*v([\\d]+\\.[\\d]+\\.[\\d]+)/, 1]\n !puts(\"Node K8s needs to be version #{@k8sver} or higher\".colorize(:red)) and\n exit unless Gem::Version.new(node_k8sver) >= Gem::Version.new(@k8sver)\n puts(\"Node K8s Version: #{node_k8sver}\".colorize(:green))\n\n node_helmver = ssh.exec!(\"helm version --client\")[/SemVer.*v([\\d]+\\.[\\d]+\\.[\\d]+)/, 1]\n !puts(\"Node Helm needs to be version #{@helmver} or higher\".colorize(:red)) and\n exit unless Gem::Version.new(node_helmver) >= Gem::Version.new(@helmver)\n puts(\"Node Helm Version: #{node_helmver}\".colorize(:green))\n }\n\n # (Idempotent) Configure nodes for clustering\n # ==========================================================================\n threads = []\n ips.each{|ip| threads << Thread.new{\n Net::SSH.start(ip, @user, password:@pass, verify_host_key: :never) do |ssh|\n puts(\":: Configure nodes for clustering\".colorize(:cyan))\n\n # Configure journald for persistent storage\n journald_conf = '/etc/systemd/journald.conf'\n if not ssh.exec!(\"cat #{journald_conf}\").include?('persistent')\n ssh.exec!(\"sudo sed -i -e 's/.*\\\\(Storage=\\\\).*/\\\\1persistent/' #{journald_conf}\")\n ssh.exec!(\"sudo systemctl restart systemd-journald\")\n puts(\"#{ip}: Configured node journald...done\".colorize(:cyan))\n else\n puts(\"#{ip}: Configure node journald...skipped\".colorize(:cyan))\n end\n\n # Configure kubelet node ip\n kubelet = '/etc/default/kubelet'\n if not ssh.exec!(\"cat #{kubelet}\").include?(ip)\n args = [\"--node-ip=#{ip}\"] * ' '\n ssh.exec!(\"sudo sed -i -e 's/\\\\(KUBELET_EXTRA_ARGS=\\\\)\\\\(.*$\\\\)/\\\\1#{args} \\\\2/' #{kubelet}\")\n ssh.exec!(\"sudo systemctl restart kubelet\")\n puts(\"#{ip}: Configured Kubelet private network ip...done\".colorize(:cyan))\n else\n puts(\"#{ip}: Configure Kubelet private network ip...skipped\".colorize(:cyan))\n end\n\n # Configure kernel for Elasticsearch\n sysctl_conf = '/etc/sysctl.d/10-cyberlinux.conf'\n if not ssh.exec!(\"cat #{sysctl_conf}\").include?('max_map_count')\n ssh.exec!(\"echo 'vm.max_map_count = 262144' | sudo tee -a #{sysctl_conf}'\")\n ssh.exec!(\"sudo sysctl -w vm.max_map_count=262144\")\n else\n puts(\"#{ip}: Configure kernel params...skipped\".colorize(:cyan))\n end\n\n # Optionally - configure private registry\n# if registry\n# docker_opts = [ \"--registry-mirror=http://#{registry}\", \"--insecure-registry #{registry}\" ]\n# override_conf = '/etc/systemd/system/docker.service.d/override.conf'\n# if not ssh.exec!(\"[ -e #{override_conf} ] && echo 'exists'\").include?('exists')\n#\n# # Configure kubernetes for private registry\n# docker_conf = \"{\\\\\\\"auths\\\\\\\":{\\\\\\\"#{registry}\\\\\\\":{\\\\\\\"auth\\\\\\\":\\\\\\\"YW5vbnltb3VzOmFub255bW91cw==\\\\\\\"}}}\"\n# ssh.exec!(\"sudo bash -c 'mkdir -p /root/.docker'\")\n# ssh.exec!(\"sudo bash -c 'echo \\\"#{docker_conf}\\\" > /root/.docker/config.json'\")\n#\n# # Configure docker for private registry\n# ssh.exec!(\"sudo bash -c 'echo \\\"[Service]\\\" > #{override_conf}'\")\n# ssh.exec!(\"sudo bash -c 'echo \\\"ExecStart=\\\" >> #{override_conf}'\")\n# ssh.exec!(\"sudo bash -c 'echo \\\"ExecStart=/usr/bin/dockerd #{docker_opts * ' '} -H fd://\\\" >> #{override_conf}'\")\n# ssh.exec!(\"sudo systemctl daemon-reload\")\n# ssh.exec!(\"sudo systemctl restart docker\")\n# puts(\"#{ip}: Configured Docker overrides...done\".colorize(:cyan))\n# else\n# puts(\"#{ip}: Configure Docker overrides...skipped\".colorize(:cyan))\n# end\n# end\n end\n }}\n threads.each{|x| x.join}\n\n # (Idempotent) Initialize cluster via kubeadm\n # ==========================================================================\n # https://kubernetes.io/docs/getting-started-guides/kubeadm\n # https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/\n # https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm-init/#config-file\n # --------------------------------------------------------------------------\n join = nil\n if all or init\n Net::SSH.start(ips.first, @user, password:@pass, verify_host_key: :never){|ssh|\n if not ssh.exec!(\"docker ps\").include?(\"apiserver\")\n puts(\":: Initialize master node '#{ips.first}'\".colorize(:cyan))\n ssh.exec!(\"mkdir -p ~/manifest\")\n\n # Cluster cidr is required for flannel and some other pod networks.\n # https://github.com/coreos/flannel/blob/master/Documentation/kubernetes.md\n # It is the same cidr range that gets assigned to --cluster-cidr if you check with\n # 'kubectl cluster-info dump | grep cidr' and thus the same value that should be used for\n # the kube-proxy --cluster-cidr argument as well.\n cluster_cidr = \"10.32.0.0/12\" if weave\n cluster_cidr = \"10.244.0.0/16\" if flannel\n\n # Execute kubeadm with config template\n if config\n FileUtils.cp('template/kubeadm.tpl', 'manifest/kubeadm.yaml')\n FileUtils.resolve('manifest/kubeadm.yaml', {\n advertise_address: ips.first,\n kubernetes_version: @k8sver,\n kube_proxy_mode: \"iptables\",\n cgroup_driver: \"cgroupfs\", # kubeadm default: cgroupfs\n cluster_domain: \"cluster.local\", # kubeadm default: cluster.local\n cluster_dns: \"10.96.0.10\", # kubeadm default: 10.96.0.10\n service_cidr: \"10.96.0.0/12\", # kubeadm default: 10.96.0.0/12\n cluster_cidr: cluster_cidr # cidr for pod networking\n })\n Net::SCP.upload!(ips.first, @user, 'manifest/kubeadm.yaml', 'manifest/kubeadm.yaml',\n ssh:{verify_host_key: :never, password: @pass})\n cmd = \"sudo kubeadm init --config manifest/kubeadm.yaml\"\n else\n cmd = \"sudo kubeadm init --kubernetes-version=v#{@k8sver} \"\n cmd += \"--apiserver-advertise-address=#{ips.first} \"\n cmd += \"--pod-network-cidr=#{cluster_cidr}\"\n end\n\n # Capture join for worker nodes\n # e.g. kubeadm join 192.168.56.10:6443 --token u6wor2.6kinrlvcbtxcoqo4 --discovery-token-ca-cert-hash\n # sha256:1112aafe50e27d54bccfd45d956f658a18b05e8b0ccf90c264ec17b026d01a8f\n ssh.exec!(cmd){|c,s,o|\n puts(o)\n join = o.split(\"\\n\").find{|x| x.include?(\"kubeadm join\")}.strip if o.include?(\"kubeadm join\")\n }\n\n # Setup kubectl on master node for both vagrant and root users\n ssh.exec!(\"mkdir -p ~/.kube\")\n ssh.exec!(\"sudo mkdir -p /root/.kube\")\n ssh.exec!(\"sudo cp /etc/kubernetes/admin.conf /root/.kube/config\")\n ssh.exec!(\"sudo cp /etc/kubernetes/admin.conf ~/.kube/config\")\n ssh.exec!(\"sudo chown $(id -u):$(id -g) ~/.kube/config\")\n ssh.exec!(\"kubectl config use-context kubernetes-admin@kubernetes\")\n ssh.exec!(\"sudo kubectl config use-context kubernetes-admin@kubernetes\")\n ssh.exec!(\"kubectl cluster-info\"){|c,s,o|puts(o)}\n\n # Disable RBAC\n # Bottom of https://kubernetes.io/docs/admin/authorization/rbac\n puts(\"Disabling RBAC...\".colorize(:cyan))\n ssh.exec!(\"kubectl create clusterrolebinding permissive-binding --clusterrole=cluster-admin --user=admin --user=kubelet --group=system:serviceaccounts\"){|c,s,o|puts(o)}\n\n # Taint master node to allow pods to be scheduled on it\n # Check current taints in Taints section: kubectl describe node\n puts(\"Tainting the master node to allow pods to be scheduled on it\".colorize(:cyan))\n ssh.exec!(\"kubectl taint nodes --all node-role.kubernetes.io/master-\"){|c,s,o|puts(o)}\n\n # Configure kube-proxy\n # --------------------------------------------------------------------\n # https://kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/\n # --------------------------------------------------------------------\n # Note: as kube-proxy runs as a pod created by the kubeadm process it is impossible to\n # configure it as all documentation suggests with --<param> values nor with config files\n # for kube-proxy e.g. /var/lib/kub-proxy/config.conf. The only way to configure it is to\n # launch kubeadm with the --config param and pass in a static kubeadm config with the\n # .kubeProxy.config.mode and .kubeProxy.config.clusterCIDR variables changed as deired.\n # Alternatively one can modify the kube-proxy manifest post deploy and restart the pod.\n # --------------------------------------------------------------------\n # See configs kube-proxy is currently using:\n # kubectl -n kube-system get ds kube-proxy -o json | jq '.spec.template.spec.containers[0].command'\n # --------------------------------------------------------------------\n if !config\n puts(\"Configure kube-proxy...\".colorize(:cyan))\n get_kube_proxy = \"kubectl -n kube-system get ds kube-proxy -o json\"\n\n # Which proxy mode to use 'userspace' (older), 'iptables' (faster), 'ipvs' (experimental)\n mod_kube_proxy = \" | jq '.spec.template.spec.containers[0].command |= .+ [\\\"--proxy-mode=iptables\\\"]'\"\n\n # CIDR range of pods in cluster. Essential to set so kube-proxy knows what and where to proxy\n mod_kube_proxy += \" | jq '.spec.template.spec.containers[0].command |= .+ [\\\"--cluster-cidr=#{cluster_cidr}\\\"]'\"\n\n # Update kube-proxy deployment configuration and restart the service\n set_kube_proxy = \"#{get_kube_proxy} #{mod_kube_proxy} | kubectl apply -f -\"\n puts(\"exec: #{set_kube_proxy}\")\n ssh.exec!(set_kube_proxy){|c,s,o|puts(o)}\n ssh.exec!(\"kubectl -n kube-system delete po -l 'k8s-app=kube-proxy'\"){|c,s,o|puts(o)}\n end\n\n # Deploy Pod networking\n # CoreDNS will be in a pending state until pod networking is deployed\n # CoreDNS must be running before joining any worker nodes to the cluster\n # https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/#pod-network\n # kubectl -n kube-system get ds kube-flannel-ds -o json | '.spec.template.spec.containers[0].command'\"\n puts(\"Installing pod networking\".colorize(:cyan))\n if weave\n podnet = \"https://cloud.weave.works/k8s/net?k8s-version=#{@k8sver}\"\n elsif flannel\n FileUtils.cp('template/flannel.tpl', 'manifest/flannel.yaml')\n FileUtils.resolve('manifest/flannel.yaml', {\n iface: \"enp0s8\", # the interface to use for inter-host communication\n backend_type: \"vxlan\", # default: vxlan - backend type\n cluster_cidr: cluster_cidr # default: 10.244.0.0/16 - cidr for pod networking\n })\n Net::SCP.upload!(ips.first, @user, 'manifest/flannel.yaml', 'manifest/flannel.yaml',\n ssh:{verify_host_key: :never, password: @pass})\n podnet = \"~/manifest/flannel.yaml\"\n end\n ssh.exec!(\"#{proxy_export}; kubectl apply -f #{podnet}\"){|c,s,o|puts(o)}\n podready!('coredns', ssh:ssh)\n end\n }\n end\n\n # (Idempotent) Configure slaves to join cluster\n #---------------------------------------------------------------------------\n if all or init\n nodes_to_join = []\n Net::SSH.start(ips.first, @user, password:@pass, verify_host_key: :never){|ssh|\n puts(\":: Determine nodes to join cluster...\".colorize(:cyan))\n output = getpods(ssh:ssh)\n nodes_to_join = ips[1..-1].select{|x| !output.include?(x)}\n puts(nodes_to_join)\n }\n nodes_to_join.each{|ip|\n Net::SSH.start(ip, @user, password:@pass, verify_host_key: :never){|ssh|\n puts(\"#{ip.colorize(:cyan)}: Joining cluster\")\n puts(\"#{ip.colorize(:cyan)}: sudo #{join}\")\n ssh.exec!(\"sudo #{join}\"){|c,s,o|puts(o)}\n }\n }\n end\n\n # (Idempotent) Install dashboard and helm\n #---------------------------------------------------------------------------\n Net::SSH.start(ips.first, @user, password:@pass, verify_host_key: :never){|ssh|\n if (all || init) && (dashboard || helm)\n podready!('etcd', ssh:ssh)\n podready!('apiserver', ssh:ssh)\n podready!('controller', ssh:ssh)\n podready!('scheduler', ssh:ssh)\n end\n\n # Initialize/update helm\n if all or helm\n if not getpods(pod:'tiller', ssh:ssh)\n puts(\"#{ips.first}: Initializing helm\".colorize(:cyan))\n ssh.exec!(\"#{proxy_export}; helm init\"){|c,s,o|puts(o)}\n ssh.exec!(\"#{proxy_export}; helm repo update\"){|c,s,o|puts(o)}\n else\n puts(\"#{ips.first}: Initializing/updating helm...skipped\".colorize(:cyan))\n end\n end\n\n # Install dashboard\n # debug dns: kubectl run -ti --image=busybox -- sh\n # nslookup kubernetes.default\n if all or dashboard\n if not getpods(pod:'dashboard', ssh:ssh)\n puts(\"#{ips.first}: Installing dashboard\".colorize(:cyan))\n url = \"https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml\"\n puts(ssh.exec!(\"kubectl create -f #{url}\"))\n puts(\"Access Dashboard:\".colorize(:cyan))\n puts(\"run: kubectl proxy\".colorize(:cyan))\n puts(\"#{'Navigate to:'.colorize(:cyan)} http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/\")\n else\n puts(\"#{ips.first}: Installing dashboard...skipped\".colorize(:cyan))\n end\n end\n podready!('tiller', ssh:ssh) if all or helm\n podready!('dashboard', ssh:ssh) if all or dashboard\n }\n\n puts(\"Cluster creation took: #{Time.now - elapse} sec\".colorize(:light_yellow))\n\n # Configure local kubectl\n kube_conf_dir = File.expand_path(\"~/.kube\")\n FileUtils.mkdir_p(kube_conf_dir) if Dir.exists?(kube_conf_dir)\n kube_conf = File.join(kube_conf_dir, \"config.kubinator\")\n FileUtils.rm_rf(kube_conf)\n Net::SCP.download!(ips.first, @user, '.kube/config', kube_conf, ssh:{verify_host_key: :never, password: @pass})\n Sys.exec(\"ln -sf ~/.kube/config.kubinator ~/.kube/config\")\n puts(\"#{'-' * 80}\".colorize(:cyan))\n Sys.exec(\"kubectl get po --all-namespaces -o wide\")\n end",
"def deploy_to_cloud(project_config: {}, cloud_config: {}, local_image_name: '')\n puts \"#{__method__.to_s} enter\"\n\n cloud_info = push_container_image_to_cloud(\n cloud_config: cloud_config,\n local_image_name: local_image_name,\n )\n\n\n kubernetes(\n uber_name: project_config.name,\n keys: project_config.keys,\n remote_image_uri: cloud_info.remote_registry_image_uri\n )\n\n puts \"#{__method__.to_s} exit\"\nend",
"def service; end",
"def kubernetes?\n defined?(SamsonKubernetes::SamsonPlugin) && @stage&.kubernetes\n end",
"def my_pod\n get_pod_by_namespace_and_hostname(my_namespace, ENV[\"HOSTNAME\"])\n end",
"def create\n response.add(exec: \"kubectl create ns #{namespace}\", env: kube_env)\n response.add(exec: \"kubectl label namespace #{namespace} istio-injection=enabled --overwrite\", env: kube_env)\n # errors.add(:kubectl_label_namespace, stderr) if exit_code.positive? and stderr.index('AlreadyExists').nil?\n\n # deploy helm into namespace\n # TODO: Need to generate tiller-rbac\n response.add(exec: kubectl(\"apply -f #{target.write_path}/tiller-k8s-ns.yml\"), env: kube_env)\n response.add(exec: 'helm init --upgrade --wait --service-account tiller', env: kube_env)\n end",
"def commons_pods\nend",
"def service_resources(release_doc)\n release_doc.resources.select { |r| r.is_a?(Kubernetes::Resource::Service) }\n end",
"def sharedPods\n\nend",
"def service; raise NotImplementedError; end",
"def service_request(service); end",
"def services\n\n end",
"def get_vs(labels = {}, return_one = false)\n cmd = \"get virtualservice -l #{labels.map{ |k, v| \"app.kubernetes.io/#{k}=#{v}\" }.join(',')} -o yaml\"\n result = svpr(cmd)\n return result.first if return_one\n result\n end",
"def services\n end",
"def get_kubernetes_service_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_service_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Services'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesServiceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_service_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_service_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def main\n kubectl_args = ARGV.take_while { |opt| opt != '--' }\n kubectl_options = kubectl_args.join(' ')\n app_name = ARGV[kubectl_args.size + 1]\n command_options = ARGV[(kubectl_args.size + 2) .. -1]\n command = command_options.join(\" \")\n\n run_pod_session(app_name, command, kubectl_options)\nend",
"def serverWorker_pods\nend",
"def service_name; end",
"def initialize(opts = {})\n # Get options and assign default values:\n @host = opts[:host]\n @port = opts[:port]\n @token = opts[:token]\n @namespace = opts[:namespace] || 'default'\n\n # Prepare the TLS and authentication options that will be used for the standard Kubernetes API\n # and also for the KubeVirt extension:\n @opts = {\n ssl_options: {\n verify_ssl: OpenSSL::SSL::VERIFY_NONE,\n },\n auth_options: {\n bearer_token: @token\n }\n }\n\n # Kubeclient needs different client objects for different API groups. We will keep in this hash the\n # client objects, indexed by API group/version.\n @clients = {}\n\n # Nothing else is done here, as this method should never throw an exception, even if the\n # credentials are wrong.\n end",
"def service_endpoint; end",
"def service_endpoint; end",
"def kube_url\n \"http://#{node['kubernetes']['master']['ip']}:#{node['kubernetes']['master']['port']}/api\"\n end",
"def service_url(service:)\n kubernetes_adapter.service_url(\n service: service\n )\n end",
"def keyword_based_service?; end",
"def service(nickname, reserved, distribution, type)\n end",
"def initialize(service)\n @service = service\n end",
"def fetch_pods(release)\n release.clients.flat_map do |client, query|\n client.get_pods(query).map! do |p|\n Kubernetes::Api::Pod.new(p, client: client)\n end\n end\n end",
"def controller\n platform_service(:controller)\n end",
"def create_service(resource, actions)\n service_name = get_service_name()\n\n case resource.service_type\n when \"upstart\"\n service service_name do\n provider Chef::Provider::Service::Upstart\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n when \"init.d\"\n service service_name do\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n else\n raise \"dashing: Unknown service_type '#{resource.service_type}'\"\n end\nend",
"def service_resource\n find_resource(:systemd_unit, \"#{new_resource.name}.service\") do\n content(\n 'Unit' => {\n 'Description' => \"MongoDB #{new_resource.name} service\",\n 'After' => 'network.target',\n 'Documentation' => 'https://docs.mongodb.org/manual'\n },\n 'Service' => {\n 'User' => new_resource.user,\n 'Group' => new_resource.group,\n 'ExecStart' => \"#{new_resource.daemon_path} --config #{new_resource.config_path}\",\n 'RestartSec' => '3s',\n 'Restart' => 'always',\n 'LimitFSIZE' => 'infinity',\n 'LimitCPU' => 'infinity',\n 'LimitAS' => 'infinity',\n 'LimitNOFILE' => 64000,\n 'LimitNPROC' => 16000\n },\n 'Install' => {\n 'WantedBy' => 'multi-user.target'\n }\n )\n\n triggers_reload true\n\n action :nothing\n end\n end",
"def get_pod_name(namespace, index)\n `kubectl get pods -n #{namespace} | awk 'FNR == #{index + 1} {print $1}'`.chomp\nend",
"def create_pod(pod_spec, kubectl_options)\n sh = Shell.new\n new_pod_json = (sh.echo(pod_spec.to_json) | sh.system(\"kubectl #{kubectl_options} create -o json -f -\")).to_s\n\n new_pod = JSON.parse(new_pod_json)\n pod_name = new_pod[\"metadata\"][\"name\"]\n\n puts \"Created pod: #{pod_name}\"\n pod_name\nend",
"def get_kubernetes_service_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_service_by_moid ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.get_kubernetes_service_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Services/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesService'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_service_by_moid\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_service_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def do_create_namespace(namespace, default_per_namespace_max_pods)\n name = namespace['name']\n annotations = namespace['annotations']\n labels = namespace['labels']\n max_pods = namespace['max_pods']\n filename=\"/var/vcap/data/action/ns_#{name}.yml\"\n filenameresourcequota=\"/var/vcap/data/action/ns_#{name}_quota.yml\"\n File.open(filename, 'w+') do |f|\n f.puts(\"apiVersion: v1\")\n f.puts(\"kind: Namespace\")\n f.puts(\"metadata:\")\n f.puts(\" name: #{name}\")\n f.puts(\" labels:\")\n f.puts(\" name: #{name}\")\n if labels != nil\n labels.each{ |label|\n f.puts(\" #{label['name']}: #{label['value']}\")\n }\n end\n\n if annotations != nil\n f.puts(\" anotations: \")\n annotations.each{ |annotation|\n f.puts(\" #{annotation['name']}: #{annotation['value']}\")\n }\n end\n end\n cmd = \"kubectl apply -f #{filename} \"\n\n if max_pods ==nil\n max_pods = default_per_namespace_max_pods\n end\n if max_pods != \"-1\"\n File.open(filenameresourcequota, 'w+') do |f|\n f.puts(\"apiVersion: v1\")\n f.puts(\"kind: ResourceQuota\")\n f.puts(\"metadata:\")\n f.puts(\" name: quota-#{name}\")\n f.puts(\" namespace: #{name}\")\n f.puts(\"spec:\")\n f.puts(\" hard:\")\n f.puts(\" pods: #{max_pods}\")\n cmd =\"kubectl apply -f #{filename}; kubectl apply -f #{filenameresourcequota}\"\n end\n end\n cmd\nend",
"def bi_service\n end",
"def restart(services)\n generate_config if stale_config\n update_platform_env\n services.each do |service|\n kubectl(\"rollout restart deploy #{clean_kubernetes_name(service)}\")\n end\n # down(services)\n # up(services)\n # status\n end",
"def kube_api_version\n 'v1beta1'\n end",
"def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"develop\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\nend",
"def services\n\tend",
"def platform_endpoint; end",
"def k8s_node(key)\n k8s_node_sub(@_k8s_node, key, key)\n end",
"def service_key\n SERVICE_KEY\n end",
"def test_k8s_pod_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub: false,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_CUSTOM\n },\n {\n config: EMPTY_K8S_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_FROM_LOCAL\n }\n ].each do |test_params|\n new_stub_context do\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs(test_params[:setup_k8s_stub])\n setup_logging_stubs do\n d = create_driver(test_params[:config])\n d.emit(test_params[:log_entry])\n d.run\n end\n verify_log_entries(1, test_params[:expected_params],\n 'jsonPayload') do |entry|\n fields = entry['jsonPayload']\n assert_equal 2, fields.size, entry\n assert_equal 'test log entry 0', fields['log'], entry\n assert_equal K8S_STREAM, fields['stream'], entry\n end\n end\n end\n end",
"def pod\n @pod ||= lambda{\n host = lygneo_id.split('@')[1]\n ResourceServer.where(:host => host).first || ResourceServer.register(host)\n }.call\n end",
"def service_to_container_name(service_name)\n [File.basename(Dir.getwd), service_name].join('_')\nend",
"def exec(service_name, command, pty)\n pods = query_cluster(:pod, name: service_name, component: :server)\n return response unless (pod = pods.first)\n\n response.add(exec: kubectl(\"exec -it #{pod} -c #{service_name} #{command}\"), env: kube_env, pty: pty)\n end",
"def initialize\n @services = {}\n end",
"def kubectl_cmd(_cmd, options = {})\n kube_options = { context: kube_context, namespace: namespace }.merge(options).compact\n kube_cli_options = kube_options.map { |k,v| \"--#{k}=#{v}\" }.join(' ')\n \"kubectl #{kube_cli_options} #{_cmd}\"\n end",
"def shared_pods\n pod 'SObjectKit'\nend",
"def kubernetes_path_to_binaries\n kube_commands(kubernetes_bin_prefix)\n end",
"def get_pods_and_start_watcher\n options = {\n resource_version: '0' # Fetch from API server cache instead of etcd quorum read\n }\n if ENV['K8S_NODE_NAME']\n options[:field_selector] = 'spec.nodeName=' + ENV['K8S_NODE_NAME']\n end\n if @last_seen_resource_version\n options[:resource_version] = @last_seen_resource_version\n else\n pods = @client.get_pods(options)\n pods[:items].each do |pod|\n cache_key = pod[:metadata][:uid]\n @cache[cache_key] = parse_pod_metadata(pod)\n @stats.bump(:pod_cache_host_updates)\n end\n\n # continue watching from most recent resourceVersion\n options[:resource_version] = pods[:metadata][:resourceVersion]\n end\n\n watcher = @client.watch_pods(options)\n reset_pod_watch_retry_stats\n watcher\n end",
"def common_pods\n pod \"Regift\"\nend",
"def service_name\n resource[:name]\n end",
"def deploy(data, replace=false, force=false)\n err = runWithData(\"kubectl create -f -\", data)\n if err\n if existsErr?(err) && replace\n return replace(data, force)\n end\n return \"could not create object: #{err}\"\n end\n return false\nend",
"def service(operation, name, options='')\n ssh_cmd \"service #{name} #{operation.to_s} #{options}\".rstrip\n end",
"def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end",
"def get_kubernetes_pod_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_pod_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Pods'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesPodResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_pod_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_pod_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_service\n super.tap do |service_template|\n service_template.cookbook('poise-service')\n create_monit_config\n end\n end",
"def create_kubernetes_version_with_http_info(kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.create_kubernetes_version ...'\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.create_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n header_params[:'If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.create_kubernetes_version\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#create_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_ingress_endpoint(namespace, ingress_name)\n stdout, _, _ = execute(\"kubectl get ingress #{ingress_name} -n #{namespace} -o json -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'\")\n stdout\nend",
"def pods\n\tpod 'DateTools'\n\tpod 'HyUIActionEvent', :git => \"https://github.com/HyanCat/HyUIActionEvent.git\"\n\tpod 'HyFoundation', :path => \"..\"\nend",
"def dist_service_via_systemctl( shortname, action )\n systemctl( action, dot_service( shortname ) )\n end",
"def show_resources_in_namespace(namespace, *resource_types)\n run \"kubectl get #{resource_types.join(',')} --namespace #{namespace} --output=wide\"\nend",
"def authenticate_k8s\n @cli.system_call \"gcloud container clusters get-credentials #{self.config.container_cluster}\"\n end",
"def service\n @service\n end",
"def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"master\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => \"#{feature_branch}\"\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => \"#{feature_branch}\"\nend",
"def shared_pods\n # Swap for local development in the same path, but remember to swap back and\n # run pod update SpotHeroSwiftAPI again to not hit other pods!\n # pod 'SpotHeroSwiftAPI', :path => '../SpotHeroSwiftAPI'\n pod 'SpotHeroSwiftAPI', '~> 6.1.0'\n\n pod 'SAMKeychain', '~> 1.5.3'\n\n # Using our own fork since Vokoder is no longer maintained\n pod 'Vokoder/Swift', git: 'https://github.com/spothero/Vokoder.git', branch: 'master'\nend",
"def service_name=(_arg0); end",
"def toKitten(**_args)\n if MU::Cloud::Google::User.cannedServiceAcctName?(@cloud_id)\n return nil\n end\n\n bok = {\n \"cloud\" => \"Google\",\n \"credentials\" => @config['credentials']\n }\n\n if cloud_desc.nil?\n MU.log @config['name']+\" couldn't fetch its cloud descriptor\", MU::WARN, details: @cloud_id\n return nil\n end\n\n user_roles = MU::Cloud.resourceClass(\"Google\", \"Role\").getAllBindings(@config['credentials'])[\"by_entity\"]\n\n if cloud_desc.nil?\n MU.log \"FAILED TO FIND CLOUD DESCRIPTOR FOR #{self}\", MU::ERR, details: @config\n return nil\n end\n bok['name'] = @config['name']\n bok['cloud_id'] = @cloud_id\n bok['type'] = @config['type']\n bok['type'] ||= \"service\"\n\n if bok['type'] == \"service\"\n bok['name'].gsub!(/@.*/, '')\n if cloud_desc.description and !cloud_desc.description.empty? and\n !cloud_desc.description.match(/^[A-Z0-9_-]+-[A-Z0-9_-]+-\\d{10}-[A-Z]{2}$/)\n bok['description'] = cloud_desc.description\n end\n bok['project'] = @project_id\n keys = MU::Cloud::Google.iam(credentials: @config['credentials']).list_project_service_account_keys(@cloud_id)\n\n if keys and keys.keys and keys.keys.size > 0\n bok['create_api_key'] = true\n end\n# MU.log \"service account #{@cloud_id}\", MU::NOTICE, details: MU::Cloud::Google.iam(credentials: @config['credentials']).get_project_service_account_iam_policy(cloud_desc.name)\n if user_roles[\"serviceAccount\"] and\n user_roles[\"serviceAccount\"][bok['cloud_id']] and\n user_roles[\"serviceAccount\"][bok['cloud_id']].size > 0\n bok['roles'] = MU::Cloud.resourceClass(\"Google\", \"Role\").entityBindingsToSchema(user_roles[\"serviceAccount\"][bok['cloud_id']])\n end\n else\n if user_roles[\"user\"] and\n user_roles[\"user\"][bok['cloud_id']] and\n user_roles[\"user\"][bok['cloud_id']].size > 0\n bok['roles'] = MU::Cloud.resourceClass(\"Google\", \"Role\").entityBindingsToSchema(user_roles[\"user\"][bok['cloud_id']], credentials: @config['credentials'])\n end\n bok['given_name'] = cloud_desc.name.given_name if cloud_desc.name.given_name and !cloud_desc.name.given_name.empty?\n bok['family_name'] = cloud_desc.name.family_name if cloud_desc.name.family_name and !cloud_desc.name.family_name.empty?\n bok['email'] = cloud_desc.primary_email\n bok['suspend'] = cloud_desc.suspended\n bok['admin'] = cloud_desc.is_admin\n end\n\n bok['use_if_exists'] = true\n\n bok\n end",
"def service\n @service ||= fetcher.get(Service, service_id)\n end",
"def service; services.first; end",
"def trik\n\tpod 'TiemzyaRiOSKit', :path => '../'\n\t#pod '<pod name>', '<version>'\n\t#pod '<local or private pod name>', :path => '<path>'\nend",
"def wait_for_namespace(namespace, sleep_duration=10)\n puts \"#{c_blue}# Waiting for: #{namespace}, every #{sleep_duration}s#{c_reset}\"\n loop do\n output, status = capture_with_status(\"kubectl get pods --namespace #{namespace} --no-headers\")\n ready = status.success? && !output.empty?\n if ready\n output.each_line do |line|\n name, readiness, state, restarts, age = line.split\n next if state == 'Completed'\n next if state == 'Running' && /^(\\d+)\\/\\1$/ =~ readiness\n puts \"# Waiting for: #{line}\"\n ready = false\n end\n end\n break if ready\n sleep sleep_duration\n end\nend",
"def initialize (service_name, application_context)\n super\n end",
"def initialize\n # These require statements are intentionally placed here to initialize\n # the gRPC module only when it's required.\n # See https://github.com/googleapis/toolkit/issues/446\n require \"gapic/grpc\"\n require \"google/cloud/datalabeling/v1beta1/data_labeling_service_services_pb\"\n\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @operations_client = Operations.new do |config|\n config.credentials = credentials\n config.quota_project = @quota_project_id\n config.endpoint = @config.endpoint\n end\n\n @data_labeling_service_stub = ::Gapic::ServiceStub.new(\n ::Google::Cloud::DataLabeling::V1beta1::DataLabelingService::Stub,\n credentials: credentials,\n endpoint: @config.endpoint,\n channel_args: @config.channel_args,\n interceptors: @config.interceptors\n )\n end",
"def instantiate_service\n @service = ContestService.new\n end",
"def instantiate_service!(service, request)\n definition = service.kind_of?(Hash) ? service : service_definition_for(service.to_s)\n raise NoSuchService.new(\"Service '#{service}'' does not exist in umlaut-services.yml\") if definition.nil?\n className = definition[\"type\"] || definition[\"service_id\"]\n classConst = Kernel.const_get(className)\n service = classConst.new(definition)\n service.request = request\n return service\n end",
"def service_content\n unit = {\n \"Unit\" => {\n \"Description\" => new_resource.description,\n \"After\" => \"network.target auditd.service\",\n },\n \"Service\" => {\n \"Type\" => \"oneshot\",\n \"ExecStart\" => chef_client_cmd,\n \"SuccessExitStatus\" => [3, 213, 35, 37, 41],\n },\n \"Install\" => { \"WantedBy\" => \"multi-user.target\" },\n }\n\n unit[\"Service\"][\"ConditionACPower\"] = \"true\" unless new_resource.run_on_battery\n unit[\"Service\"][\"CPUQuota\"] = new_resource.cpu_quota if new_resource.cpu_quota\n unit[\"Service\"][\"Environment\"] = new_resource.environment.collect { |k, v| \"\\\"#{k}=#{v}\\\"\" } unless new_resource.environment.empty?\n unit\n end",
"def show_service(client, args, options)\n response = client.get(\"#{RESOURCE_PATH}/#{args[0]}\")\n\n if CloudClient::is_error?(response)\n [response.code.to_i, response.to_s]\n else\n #[0,response.body]\n if options[:json]\n [0,response.body]\n else\n str=\"%-20s: %-20s\"\n str_h1=\"%-80s\"\n\n document_hash = JSON.parse(response.body)\n template = document_hash['DOCUMENT']['TEMPLATE']['BODY']\n\n CLIHelper.print_header(str_h1 % \"SERVICE #{document_hash['DOCUMENT']['ID']} INFORMATION\")\n\n puts str % [\"ID\", document_hash['DOCUMENT']['ID']]\n puts str % [\"NAME\", document_hash['DOCUMENT']['NAME']]\n puts str % [\"USER\", document_hash['DOCUMENT']['UNAME']]\n puts str % [\"GROUP\",document_hash['DOCUMENT']['GNAME']]\n\n puts str % [\"STRATEGY\", template['deployment']]\n puts str % [\"SERVICE STATE\", Service.state_str(template['state'])]\n puts str % [\"SHUTDOWN\", template['shutdown_action']] if template['shutdown_action']\n\n puts\n\n CLIHelper.print_header(str_h1 % \"PERMISSIONS\",false)\n\n [\"OWNER\", \"GROUP\", \"OTHER\"].each { |e|\n mask = \"---\"\n mask[0] = \"u\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_U\"] == \"1\"\n mask[1] = \"m\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_M\"] == \"1\"\n mask[2] = \"a\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_A\"] == \"1\"\n\n puts str % [e, mask]\n }\n\n puts\n\n template['roles'].each {|role|\n CLIHelper.print_header(\"ROLE #{role['name']}\", false)\n\n puts str % [\"ROLE STATE\", Role.state_str(role['state'])]\n puts str % [\"PARENTS\", role['parents'].join(', ')] if role['parents']\n puts str % [\"VM TEMPLATE\", role['vm_template']]\n puts str % [\"CARDINALITY\", role['cardinality']]\n puts str % [\"MIN VMS\", role['min_vms']] if role['min_vms']\n puts str % [\"MAX VMS\", role['max_vms']] if role['max_vms']\n puts str % [\"COOLDOWN\", \"#{role['cooldown']}s\"] if role['cooldown']\n puts str % [\"SHUTDOWN\", role['shutdown_action']] if role['shutdown_action']\n\n puts \"NODES INFORMATION\"\n NODE_TABLE.show(role['nodes'])\n\n if !role['elasticity_policies'].nil? && role['elasticity_policies'].size > 0 || !role['scheduled_policies'].nil? && role['scheduled_policies'].size > 0\n puts\n puts \"ELASTICITY RULES\"\n\n if role['elasticity_policies'] && role['elasticity_policies'].size > 0\n puts\n# puts \"ELASTICITY POLICIES\"\n CLIHelper::ShowTable.new(nil, self) do\n column :ADJUST, \"\", :left, :size=>12 do |d|\n adjust_str(d)\n end\n\n column :EXPRESSION, \"\", :left, :size=>48 do |d|\n if !d['expression_evaluated'].nil?\n d['expression_evaluated']\n else\n d['expression']\n end\n end\n\n column :'EVALS', \"\", :right, :size=>5 do |d|\n if d['period_number']\n \"#{d['true_evals'].to_i}/#{d['period_number']}\"\n else\n \"-\"\n end\n end\n\n column :PERIOD, \"\", :size=>6 do |d|\n d['period'] ? \"#{d['period']}s\" : '-'\n end\n\n column :COOL, \"\", :size=>5 do |d|\n d['cooldown'] ? \"#{d['cooldown']}s\" : '-'\n end\n\n default :ADJUST, :EXPRESSION, :EVALS, :PERIOD, :COOL\n end.show([role['elasticity_policies']].flatten, {})\n end\n\n if role['scheduled_policies'] && role['scheduled_policies'].size > 0\n puts\n# puts \"SCHEDULED POLICIES\"\n CLIHelper::ShowTable.new(nil, self) do\n column :ADJUST, \"\", :left, :size=>12 do |d|\n adjust_str(d)\n end\n\n column :TIME, \"\", :left, :size=>67 do |d|\n if d['start_time']\n Time.parse(d['start_time']).to_s\n else\n d['recurrence']\n end\n end\n\n default :ADJUST, :TIME\n end.show([role['scheduled_policies']].flatten, {})\n end\n end\n\n puts\n }\n\n puts\n\n CLIHelper.print_header(str_h1 % \"LOG MESSAGES\",false)\n\n if template['log']\n template['log'].each { |log|\n t = Time.at(log['timestamp']).strftime(\"%m/%d/%y %H:%M\")\n puts \"#{t} [#{log['severity']}] #{log['message']}\"\n }\n end\n\n 0\n end\n end\nend",
"def install\n kit_klass = ServiceKit.const_get self.service_type.capitalize\n kit = kit_klass.new comms, container, host\n kit.configure_service!\n end",
"def main_app\n\n utilities_pod\n realm_pod\n \nend",
"def pods_test\n pod 'Quick'\n pod 'Nimble'\nend",
"def initialize(service)\n @metadata = service.metadata.xpath('//EntityContainer').first\n @service = service\n end",
"def connection(service=:cci)\n SoftLayer::Service.new(\n SoftlayerBase.send(service),\n :username => Chef::Config[:knife][:softlayer_username],\n :api_key => Chef::Config[:knife][:softlayer_api_key],\n :user_agent => USER_AGENT\n )\n end",
"def update_from_api_object(pod_hash)\n m = pod_hash[\"metadata\"]\n props[:uid] = m[\"uid\"]\n props[:generateName] = m[\"generateName\"]\n props[:labels] = m[\"labels\"]\n props[:created] = m[\"creationTimestamp\"] # already [Time]\n props[:annotations] = m[\"annotations\"]\n props[:deployment_config_version] = m[\"annotations\"][\"openshift.io/deployment-config.latest-version\"]\n props[:deployment_config_name] = m[\"annotations\"][\"openshift.io/deployment-config.name\"]\n props[:deployment_name] = m[\"annotations\"][\"openshift.io/deployment.name\"]\n\n # for builder pods\n props[:build_name] = m[\"annotations\"][\"openshift.io/build.name\"]\n\n # for deployment pods\n # ???\n\n spec = pod_hash[\"spec\"] # this is runtime, lets not cache\n props[:node_hostname] = spec[\"host\"]\n props[:node_name] = spec[\"nodeName\"]\n props[:fs_group] = spec[\"securityContext\"][\"fsGroup\"]\n\n s = pod_hash[\"status\"]\n props[:ip] = s[\"podIP\"]\n # status should be retrieved on demand but we cache it for the brave\n props[:status] = s\n\n\n return self # mainly to help ::from_api_object\n end",
"def delete_ingress(namespace, ingress_name)\n if namespace_exists?(namespace) && object_exists?(namespace, \"ingress\", ingress_name)\n execute(\"kubectl delete ingress #{ingress_name} -n #{namespace}\")\n end\nend",
"def find_images_in_k8s_complete_demo\n images = []\n yaml_parts = File.read(REPO_ROOT.join(\"deploy\").join(\"kubernetes\").join(\"complete-demo.yaml\"))\\\n .split(\"---\\n\")\\\n .map { |part| YAML.load(part) }\n\n yaml_parts \\\n .select { |part| part[\"kind\"] == \"Deployment\" }\\\n .map { |part| part[\"spec\"][\"template\"][\"spec\"][\"containers\"].map { |c| c[\"image\"] } }.flatten\\\n .map { |name| if name.include?(\":\") then name; else name + \":latest\"; end }.uniq\nend",
"def service\n unless defined?(@service)\n p = parent\n while p && !(SwiftStorage::Service === p)\n p = p.parent\n end\n @service = p\n end\n @service\n end",
"def create\n super(@@service)\n end",
"def vertx_start\n @consul_client.request(:PUT, \"/v1/agent/service/register\") { |response|\n if response.status_code() == 200\n puts \"Registered foo service with Consul\"\n else \n puts \"Failed to register foo service with Consul\"\n end\n }.end({\n \"ID\" => \"foo_service\",\n \"Name\" => \"foo\",\n \"Tags\" => [\n \"service\"\n ],\n \"Port\" => SERVICE_PORT\n }.to_json)\nend",
"def integrate_with_systemd; end",
"def get(cmp)\n case cmp\n when \"events\"\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME LAST SEEN FIRST SEEN COUNT KIND \"+\n \"SUBOBJECT TYPE REASON SOURCE MESSAGE\"\n\n [header] +\n (hsh[\"items\"].map do |item|\n obj = item[\"involvedObject\"]\n src = item[\"source\"]\n [ obj[\"namespace\"],\n obj[\"name\"],\n _unitsago(item[\"lastTimestamp\"]),\n _unitsago(item[\"firstTimestamp\"]),\n item[\"count\"],\n obj[\"kind\"],\n obj[\"fieldPath\"],\n item[\"type\"],\n item[\"reason\"],\n \"%s, %s\" % [src[\"component\"], src[\"host\"]],\n item[\"message\"]\n ].map{ |v| (v || \" \").to_s.gsub(/[[:space:]+]/, \" \") }.\n join(\" \")\n end)\n\n when 'nodes'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAME STATUS CPU MEMORY KUBELET VERSION \" +\n \"KERNEL VERSION CONTAINER VERSION ADDRESS AGE\"\n [header] +\n (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n status = st[\"conditions\"].select { |a| a[\"status\"] == \"True\" }.\n map { |a| a[\"type\"] }.join(\",\")\n ni = st[\"nodeInfo\"]\n\n [md[\"name\"],\n status,\n st[\"capacity\"][\"cpu\"],\n st[\"capacity\"][\"memory\"],\n ni[\"kubeletVersion\"],\n ni[\"kernelVersion\"],\n ni[\"containerRuntimeVersion\"],\n st[\"addresses\"].map { |a| a[\"address\"] }.join(\",\"),\n age,\n ].map{ |v| v || \" \" }.join(\" \")\n end)\n\n when 'ingress'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME HOSTS AGE\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n [md[\"namespace\"], md[\"name\"],\n sp[\"rules\"].map{|a|a[\"host\"]}.join(\",<br>\"),\n age\n ].map{ |v| v || \" \" }.join(\" \")\n end)\n\n when 'pvc'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES \"+\n \"STORAGECLASS AGE\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n [md[\"namespace\"], md[\"name\"],\n st[\"phase\"],\n sp[\"volumeName\"],\n st[\"capacity\"][\"storage\"],\n st[\"accessModes\"].join(\",\"),\n sp[\"storageClassName\"],\n age\n ].map{ |v| v || \" \" }.join(\" \")\n end)\n\n when 'pods'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n\n ready,not_ready =\n begin\n st[\"containerStatuses\"].partition do |cs|\n cs[\"ready\"]\n end\n rescue NoMethodError\n [[],[]]\n end\n rsc =\n begin\n st[\"containerStatuses\"].map do |cs|\n cs[\"restartCount\"]\n end.sum\n rescue NoMethodError\n 0\n end\n\n [md[\"namespace\"], md[\"name\"],\n \"#{ready.size}/#{ready.size + not_ready.size}\",\n st[\"phase\"],\n rsc,\n age,\n st[\"podIP\"],\n sp[\"nodeName\"],\n ].map{ |v| v || \" \" }.join(\" \")\n end)\n\n when \"daemonsets\"\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE \"+\n \"AVAILABLE NODE SELECTOR AGE CONTAINERS IMAGES\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n\n ndselector =\n (sp[\"template\"][\"spec\"][\"nodeSelector\"]||{}).\n map do |k,v|\n \"#{k}=#{v}\"\n end.join\n tmp = sp[\"template\"][\"spec\"][\"containers\"].map do |c|\n [c[\"name\"], c[\"image\"]]\n end\n images = tmp.map(&:last).join(\",\")\n containers = tmp.map(&:first).join(\",\")\n\n [md[\"namespace\"], md[\"name\"],\n st[\"desiredNumberScheduled\"],\n st[\"currentNumberScheduled\"],\n st[\"numberReady\"],\n st[\"updatedNumberScheduled\"] || \"0\",\n st[\"numberAvailable\"] || \"0\",\n ndselector.empty? ? nil : ndselector,\n age,\n containers,\n images,\n ].map{ |v| v || \" \" }.join(\" \")\n end)\n\n else\n kctl(\"get #{cmp.to_s} --all-namespaces --output=wide\")\n end\n end",
"def dot_service( shortname )\n shortname + \".service\"\n end",
"def across_service_state\n super\n end",
"def service_resource\n # Sanity checking\n check_signals!\n run_dummy!\n # Set defaults for sv_bin and sv_dir so we can use them in templates.\n # This follows the same lookup as in resource_runit_service.rb.\n if node['runit']\n options['sv_bin'] ||= node['runit']['sv_bin']\n options['sv_dir'] ||= node['runit']['sv_dir']\n end\n options['sv_bin'] ||= '/usr/bin/sv'\n options['sv_dir'] ||= '/etc/sv'\n # Build the runit_service resource.\n @service_resource ||= Chef::Resource::RunitService.new(new_resource.name, run_context).tap do |r|\n r.provider service_provider\n r.service_name new_resource.service_name\n r.owner 'root'\n r.group 'root'\n r.sv_bin options['sv_bin']\n r.sv_dir options['sv_dir']\n r.sv_timeout options['timeout'] if options['timeout']\n r.options options.merge(new_resource: new_resource, runit_signals: RUNIT_SIGNALS)\n r.env Mash.new(options['environment'] || new_resource.environment)\n r.run_template_name 'template'\n r.log_template_name 'template'\n # Force h and t because those map to stop_signal and reload_signal.\n control = []\n control << 'h' if new_resource.reload_signal != 'HUP'\n control += %w{d t} if new_resource.stop_signal != 'TERM'\n control += options['control'].keys if options['control']\n control.uniq!\n r.control control\n r.control_template_names Hash.new { 'template-control' } # There is no name only Zuul.\n r.cookbook 'poise-service-runit'\n # Runit only supports the equivalent of our 'immediately' mode :-/\n r.restart_on_update new_resource.restart_on_update\n end\n end",
"def replace_pods(namespace, delay = 90)\n get_pods(namespace).each do |pod|\n system \"kubectl -n #{namespace} delete pod #{pod}\"\n sleep delay # This could be optimised, because there's no need to sleep after deleting the last pod\n end\nend",
"def container_name(service)\n File.basename(root_dir).gsub(/\\W/, '') + \"_#{service}_1\"\nend"
] |
[
"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.55155295",
"0.55048454",
"0.54923517",
"0.54923517",
"0.5465188",
"0.5452192",
"0.5441783",
"0.5424391",
"0.5389891",
"0.5333723",
"0.53212845",
"0.5316213",
"0.53142345",
"0.5292671",
"0.527817",
"0.5261856",
"0.52574813",
"0.52435225",
"0.52233326",
"0.5211058",
"0.52062744",
"0.5205485",
"0.51958585",
"0.5186835",
"0.51705927",
"0.51657623",
"0.5158528",
"0.51526237",
"0.515132",
"0.51506656",
"0.514868",
"0.51412964",
"0.51315206",
"0.5131234",
"0.5121907",
"0.51175195",
"0.5111385",
"0.5104261",
"0.5099365",
"0.5095515",
"0.5084809",
"0.5080869",
"0.50652176",
"0.5059312",
"0.5053452",
"0.5052522",
"0.5046357",
"0.5043468",
"0.5043428",
"0.50417936",
"0.5040982",
"0.50396866",
"0.50366926",
"0.5034689",
"0.5033597",
"0.503345",
"0.5033274",
"0.5032188",
"0.5025485",
"0.50249577",
"0.50239486",
"0.50226754",
"0.50216204",
"0.50148094",
"0.5006533",
"0.5000672",
"0.49993932",
"0.49976948",
"0.4985817",
"0.49824917",
"0.49759752",
"0.49698117",
"0.49685207",
"0.496297",
"0.49616376",
"0.496056",
"0.49604794",
"0.49604115",
"0.4949222",
"0.49482012"
] |
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 implementation; end",
"def implementation; end",
"def verdi; end",
"def berlioz; end",
"def identify; end",
"def who_we_are\r\n end",
"def trd; end",
"def stderrs; end",
"def spec; end",
"def spec; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def operations; end",
"def operations; end",
"def zuruecksetzen()\n end",
"def intensifier; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def wrapper; end",
"def villian; end",
"def r; end",
"def r; end",
"def anchored; end",
"def sitemaps; end",
"def internal; end",
"def offences_by; end",
"def original_result; end",
"def extra; end",
"def strategy; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def reflector; end",
"def reflector; end",
"def feruchemist; end",
"def rossini; end",
"def isolated; end",
"def isolated; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def bs; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def schumann; end",
"def used?; end",
"def returns; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def ibu; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def original; end",
"def operation; end",
"def hd\n \n end",
"def ext; end",
"def ext; end",
"def relatorios\n end",
"def handle; end",
"def eplore\n end",
"def processor; end"
] |
[
"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.58726215",
"0.58717906",
"0.58717906",
"0.58554417",
"0.58554417",
"0.58554417",
"0.58554417",
"0.58539104",
"0.58539104",
"0.5842491",
"0.5824502",
"0.5818287",
"0.5818287",
"0.5818287",
"0.5818287",
"0.5818287",
"0.5818287",
"0.5818287",
"0.5818287",
"0.5818287",
"0.58168995",
"0.5808425",
"0.5804775",
"0.5804775",
"0.5776977",
"0.57516396",
"0.5750313",
"0.57467926",
"0.5733075",
"0.57304716",
"0.57210565",
"0.57208145",
"0.57208145",
"0.57208145",
"0.57208145",
"0.5715955",
"0.5715955",
"0.5715955",
"0.57039684",
"0.57039684",
"0.5700849",
"0.56850547",
"0.5667862",
"0.5667862",
"0.5653112",
"0.5653112",
"0.56481826",
"0.5640532",
"0.5640532",
"0.5640532",
"0.5640532",
"0.5631581",
"0.56271124",
"0.5625065",
"0.56082296",
"0.56082296",
"0.56082296",
"0.56082296",
"0.56082296",
"0.56082296",
"0.56082296",
"0.56082296",
"0.56061256",
"0.5606099",
"0.5606099",
"0.5606099",
"0.5606099",
"0.5606099",
"0.5606099",
"0.5606099",
"0.5606099",
"0.56053376",
"0.5601715",
"0.55978113",
"0.5589772",
"0.5589772",
"0.55742663",
"0.55702657",
"0.55680424",
"0.5566406"
] |
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.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/urlshortener&response_type=code&client_id=#{ENV['GOOGL_CLIENT_ID']}&redirect_uri=#{ENV['GOOGL_REDIRECT_URI']}&access_type=offline&include_granted_scopes=true&approval_prompt=force\"\n end",
"def get_authorization_url options = {}\n scope = options[:scope] || @scope\n credentials = UserRefreshCredentials.new(\n client_id: @client_id.id,\n client_secret: @client_id.secret,\n scope: scope\n )\n redirect_uri = redirect_uri_for options[:base_url]\n url = credentials.authorization_uri(access_type: \"offline\",\n redirect_uri: redirect_uri,\n approval_prompt: \"force\",\n state: options[:state],\n include_granted_scopes: true,\n login_hint: options[:login_hint])\n url.to_s\n end",
"def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend",
"def authorization_url\n\t\t@client ||= api_client()\n\t\t@client.authorization.authorization_uri.to_s\n\tend",
"def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end",
"def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end",
"def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend",
"def get_auth_url(service)\n config = get_service_config(service)\n request_id = get_request_token(service)\n\n url = String.new\n url << config[:authorize_url]\n url << \"?response_type=code\"\n url << \"&client_id=\"\n url << config[:client_id]\n url << \"&redirect_uri=\"\n url << config[:redirect_uri]\n url << \"&scope=\"\n url << config[:scope]\n url << \"&state=\"\n url << request_id\n\n url\n end",
"def get_oauth_authorization_link(account, project)\n return @client.authorization.authorization_uri({:state => \"#{account.site_address}-#{project.id}-google\"}).to_s\n end",
"def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end",
"def authorize_url(redirect_uri)\n @auth_client.auth_code.authorize_url(\n # The second scope lets us fetch the user's gmail address.\n :scope => 'https://mail.google.com/ https://www.googleapis.com/auth/userinfo.email',\n :redirect_uri => redirect_uri,\n :access_type => 'offline',\n :approval_prompt => 'force'\n )\n end",
"def google_authorize\n redirect_to client.authorization_url(\n Rails.application.secrets.auth0_callback_url,\n connection: 'google-oauth2',\n scope: 'openid'\n ).to_s\n end",
"def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end",
"def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end",
"def authorize_url(scope = nil)\n url = \"#{GRAPH_ROOT}/oauth/authorize?client_id=#{@app_id}&redirect_uri=#{URI.encode @redirect_uri}\"\n if scope.is_a?(Array)\n url += \"&#{scope.join(',')}\"\n end\n url\n end",
"def get_authorize_url\n return get_request_token.authorize_url\n end",
"def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end",
"def get_authorization_url\n client = Octokit::Client.new\n client.authorize_url(CLIENT_ID, scope: 'public_repo read:org')\n end",
"def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end",
"def authorize_url\n @connection.authorize_url\n end",
"def authorize_url\n request_token.authorize_url\n end",
"def authorize_url\n @oauth_client.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => site_url)\n end",
"def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end",
"def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end",
"def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend",
"def auth_uri(nonce)\n client.authorization_uri(\n scope: %i[user_group_path email profile esdl-mapeditor microprofile-jwt user_group],\n state: nonce,\n nonce: nonce\n )\n end",
"def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end",
"def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def get_authorization_url(request_token, callback_url)\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\n end",
"def authorize\n\t\t@@extension_url = params[:redirect_uri]\n\t\tredirect_to('/auth/google_oauth2')\n\tend",
"def authorize_url(client_id, redirect_uri, options={})\n \"https://#{API_URL}/oauth/authorize?#{build_query(options.merge(:client_id => client_id, :redirect_uri => redirect_uri))}\"\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def authorize_url(params=nil)\n connection.build_url(options[:authorize_url], params).to_s\n end",
"def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end",
"def authentication_url(params={})\n @request_token.authorize_url params\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end",
"def authorize_url(callback_url, options = {})\n url = \"#{BASE_URL}/oauth/authorize?client_id=#{app_id}&redirect_uri=#{callback_url}\"\n scope = options.delete(:scope)\n url += \"&scope=#{scope.join(',')}\" unless scope.blank?\n url += \"&#{options.to_query}\" unless options.blank? # Add other options. FIXME: to_query method requires Rails?!\n return url\n end",
"def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end",
"def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end",
"def redirect_uri\n @redirect_uri ||= root_url[0..-2] + oauth_callback_path\n end",
"def redirect\n client = Signet::OAuth2::Client.new({\n client_id: ENV.fetch('GOOGLE_API_CLIENT_ID'),\n client_secret: ENV.fetch('GOOGLE_API_CLIENT_SECRET'),\n authorization_uri: ENV.fetch('AUTH_URL'),\n scope: Google::Apis::GmailV1::AUTH_GMAIL_READONLY,\n redirect_uri: url_for(:action => :callback)\n })\n\n redirect_to client.authorization_uri.to_s\n end",
"def oauth_callback_url\n end",
"def authorize_url(client_id=nil, redirect_uri=@@config.redirect_uri, opts={})\n raise \"client_id required to authorize url. Pass with Geoloqi.config\" unless client_id\n url = \"#{oauth_url}?response_type=code&client_id=#{Rack::Utils.escape client_id}&redirect_uri=#{Rack::Utils.escape redirect_uri}\"\n url += \"&#{Rack::Utils.build_query opts}\" unless opts.empty?\n url\n end",
"def oauth_authorize_url(client_id, redirect_uri, options={})\n self.format_url('/oauth/authorize', {\n :client_id => client_id,\n :redirect_uri => redirect_uri\n }.merge(options))\n end",
"def auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end",
"def constructAuthorisationString\n \"GoogleLogin auth=#{@authorisationHash}\"\n end",
"def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end",
"def oauth_uri(provider=\"FACEBOOK\")\n dest= session[\"return_to\"] || request.env[\"REQUEST_URI\"] || \"/\"\n \"#{oauth_uri_left_part}/account/oauth_start?provider=#{CGI.escape(provider)}&dest_left=#{CGI.escape(request_uri_left_part)}&dest_path=#{CGI.escape(dest)}\"\n end",
"def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end",
"def redirect_to_google_auth(redirect)\n # initiate authentication w/ gmail\n # create url with url-encoded params to initiate connection with contacts api\n next_param = redirect\n scope_param = \"http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2F\"\n secure_param = \"0\"\n session_param = \"1\"\n root_url = \"https://www.google.com/accounts/AuthSubRequest\"\n query_string = \"?scope=#{scope_param}&session=#{session_param}&secure=#{secure_param}&next=#{URI::encode(next_param)}\"\n redirect_to root_url + query_string\n end",
"def auth_code_url(redirect_uri, user_email = false, user_name = false, permissions = \"manage_accounts,view_balance,collect_payments,refund_payments,view_user,preapprove_payments\")\n url = ui_endpoint + '/oauth2/authorize?client_id=' + client_id.to_s + '&redirect_uri=' + redirect_uri + '&scope=' + permissions\n url += user_name ? '&user_name=' + CGI::escape(user_name) : ''\n url += user_email ? '&user_email=' + CGI::escape(user_email) : ''\n end",
"def google_bucket_url\n \"https://accounts.google.com/AccountChooser?continue=https://console.cloud.google.com/storage/browser/#{self.bucket_id}\"\n end",
"def auth_code_url(options={})\n options = default_auth_code_url_options(options)\n\n if self.options[:raise_errors]\n check_redirect_uri!(options)\n end\n\n @redirect_uri = options[:redirect_uri]\n\n self.auth_code.authorize_url(options)\n end",
"def generate_authorize_url(request_token)\n request = consumer.create_signed_request(:get,\n consumer.authorize_path, request_token,\n {:oauth_callback => 'oob'})\n\n params = request['Authorization'].sub(/^OAuth\\s+/, '').split(/,\\s+/).map do |param|\n key, value = param.split('=')\n value =~ /\"(.*?)\"/\n \"#{key}=#{CGI::escape($1)}\"\n end.join('&')\n\n \"#{base_url}#{request.path}?#{params}\"\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code( user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def get_AuthorizationURL()\n \t return @outputs[\"AuthorizationURL\"]\n \tend",
"def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\r\n user_id = \"default\"\r\n credentials = authorizer.get_credentials user_id\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url base_url: OOB_URI\r\n puts \"Open the following URL in the browser and enter the \" \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\nend",
"def authorize\r\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\r\n\r\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(\r\n client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(\r\n base_url: OOB_URI)\r\n puts \"Open the following URL in the browser and enter the \" +\r\n \"resulting code after authorization\"\r\n puts url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI)\r\n end\r\n credentials\r\nend",
"def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\r\n user_id = \"default\"\r\n credentials = authorizer.get_credentials user_id\r\n\r\n # launch default browser to approve request of initial OAuth2 authorization\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url base_url: OOB_URI\r\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\r\n end\r\n\r\n credentials\r\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def auth_url(connection = nil)\n state = \"?state=#{Service.encode_state(connection)}\"\n callback = URI.encode_www_form_component(config[:redirect_uri] + state)\n\n uri = URI.parse(base_auth_url)\n uri.query ||= \"\"\n uri.query << \"&#{self.class.callback_param_name}=#{callback}\"\n uri.to_s\n end",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def googleplus_url; \"https://plus.google.com/#{googleplus}\" end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def build_authorization_link\n @oauth.auth_code.authorize_url(\n redirect_uri: @redirect_uri,\n scope: 'read_write',\n initial_view: 'signup'\n )\n end",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end",
"def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI,\n )\n end\n credentials\nend",
"def discovery_uri(host = WORLD_WIDE_AUTHORITY)\n URI(DISCOVERY_TEMPLATE.expand(host: host, endpoint: authorize_endpoint))\n end",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\\n\\n\"\n puts url\n print \"\\nCode: \"\n code = gets\n puts\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize_url\n # Fix: replace default oauth2 options, specially to prevent the Faraday gem which\n # concatenates with \"/\", removing the Facebook api version\n options = {\n site: File.join(@site, api_version.to_s),\n authorize_url: File.join(@auth_site, api_version.to_s, auth_path),\n token_url: token_url\n }\n\n @scope = access_permissions.present? ? access_permissions.join(',') : scope\n super(options)\n end",
"def get_request_auth_code_url\n URI.encode(\"https://#{@subdomain}.zendesk.com/oauth/authorizations/new?response_type=code&redirect_uri=#{@redirect_uri}/&client_id=#{@unique}&scope=read%20write\")\n end",
"def redirect_uri\n host = headers['Host']\n uri = \"#{path}/\"\n uri = \"#{uri}?#{query}\" unless (query || '').empty?\n uri = \"http://#{host}#{uri}\" if host\n uri\n end",
"def authorize(credentials)\n credentials_path = \"#{PATH}#{credentials}-gmail.json\"\n token_path = \"#{PATH}#{credentials}-token.yaml\"\n client_id = Google::Auth::ClientId.from_file credentials_path\n token_store = Google::Auth::Stores::FileTokenStore.new file: token_path\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = 'default'\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\r\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(base_url: OOB_URI)\r\n puts 'Open the following URL in the browser and enter the ' \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\nend",
"def authorize_url(attribs={})\n self.class.authorize_url id, attribs.reverse_merge(credentials: api_creds)\n end",
"def auth_google\n @attributes[:auth_google]\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def google_oauth\n return nil if @oauth_attempted\n @oauth_attempted = true\n\n path = \"#{ENV['HOME']}/.config/#{::Google::Auth::CredentialsLoader::WELL_KNOWN_PATH}\"\n FileUtils.mkdir_p(File.dirname(path))\n storage = GoogleStorage.new(::Google::APIClient::FileStore.new(path))\n\n options = {\n client_id: @google_id.id,\n client_secret: @google_id.secret,\n scope: %w[openid email]\n }\n uri_options = {include_granted_scopes: true}\n uri_options[:hd] = @domain if @domain\n uri_options[:access_type] = 'online' if @online\n\n credentials = ::Google::Auth::UserRefreshCredentials.new(options)\n credentials.code = get_oauth_code(credentials, uri_options)\n credentials.fetch_access_token!\n credentials.tap(&storage.method(:write_credentials))\n end"
] |
[
"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.6919297",
"0.690253",
"0.68986976",
"0.6876514",
"0.6869717",
"0.6867943",
"0.6821838",
"0.6814585",
"0.68103385",
"0.6732936",
"0.67211974",
"0.67125845",
"0.6709304",
"0.67064583",
"0.666616",
"0.6629995",
"0.66208375",
"0.6581736",
"0.6561996",
"0.6548918",
"0.6547096",
"0.65441364",
"0.6538075",
"0.6533842",
"0.6529239",
"0.6508692",
"0.6506348",
"0.6502407",
"0.6498818",
"0.64514685",
"0.6450088",
"0.64447963",
"0.6411596",
"0.63957095",
"0.6328027",
"0.63066345",
"0.62990946",
"0.6286055",
"0.6276086",
"0.62699306",
"0.62691945",
"0.6258435",
"0.6255393",
"0.62509793",
"0.62505066",
"0.62505066",
"0.6233892",
"0.6229218",
"0.62213606",
"0.6216441",
"0.6216441",
"0.621338",
"0.6208076",
"0.6208076",
"0.6208076",
"0.6208076",
"0.6208076",
"0.6208076",
"0.6202152",
"0.61910415",
"0.61910415",
"0.61910415",
"0.61910415",
"0.6188867",
"0.6180405",
"0.61761737",
"0.6170297",
"0.61608076",
"0.61606765",
"0.6158017",
"0.615289",
"0.61397827",
"0.6138277",
"0.61366206",
"0.6127574",
"0.61068827",
"0.61059886",
"0.60873413",
"0.6083409"
] |
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_token_from_auth_code(auth_code, client_id, client_secret, redirect_uri, environment = nil)\n environment ||= \"mypurecloud.com\"\n\n tokenFormData = {\n \"grant_type\" => \"authorization_code\",\n \"code\" => auth_code,\n \"redirect_uri\" => redirect_uri\n }\n\n tokenResponse =JSON.parse RestClient.post \"https://#{client_id}:#{client_secret}@login.#{environment}/token\", tokenFormData\n\n return tokenResponse['access_token'];\n end",
"def authenticate(code)\n request_access('authorization_code', code: code, redirect_uri: @redirect_uri)\n end",
"def authorize(callback_url, code)\n data = open(\"#{BASE_URL}/oauth/access_token?client_id=#{app_id}&redirect_uri=#{CGI.escape callback_url}&client_secret=#{app_secret}&code=#{CGI.escape code}\").read\n \n # The expiration date is not necessarily set, as the app might have\n # requested offline_access to the data\n match_data = data.match(/expires=([^&]+)/)\n @expires = match_data && match_data[1] || nil\n \n # Extract the access token\n @access_token = data.match(/access_token=([^&]+)/)[1]\n end",
"def authorize(callback_url, code)\n data = open(\"#{BASE_URL}/oauth/access_token?client_id=#{app_id}&redirect_uri=#{CGI.escape callback_url}&client_secret=#{app_secret}&code=#{CGI.escape code}\").read\n \n # The expiration date is not necessarily set, as the app might have\n # requested offline_access to the data\n match_data = data.match(/expires=([^&]+)/)\n @expires = match_data && match_data[1] || nil\n \n # Extract the access token\n @access_token = data.match(/access_token=([^&]+)/)[1]\n end",
"def get_access_token(code)\n @code = code\n @access_token ||= client.web_server.get_access_token( @code, :redirect_uri => callback_url)\n end",
"def retrieve_access_token(authorization_code: nil)\n path = path_for(:access_token)\n\n grant_type = get_grant_type(authorization_code.present?)\n body = request_body(\n grant_type: grant_type,\n authorization_code: authorization_code\n )\n\n self.class.post(path, body: body.to_json)\n end",
"def get_token(code)\n option = {\n url: \"#{self.bot_origin}/oauth/token\",\n header: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n param: {\n grant_type: \"authorization_code\",\n client_id: self.client_id,\n client_secret: self.client_secret,\n redirect_uri: self.redirect_uri,\n code: code\n }\n }\n response = post(option)\n json = JSON.parse(response.body)\n json[\"access_token\"]\n end",
"def request_token(code)\n params = {\n code: code,\n client_id: client_id,\n client_secret: client_secret,\n redirect_uri: redirect_uri,\n grant_type: 'authorization_code'\n }.to_param\n\n header = { 'Content-Type' => 'application/x-www-form-urlencoded' }\n uri = URI(TOKEN_URL)\n net_http = Net::HTTP.new(uri.host, uri.port)\n net_http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = params\n response = net_http.request(request)\n if response.code == '200'\n data = JSON.load(response.body)\n @access_token = data['access_token']\n @refresh_token = data['refresh_token']\n @expires_in = data['expires_in']\n else\n raise StandardError.new(response.body)\n end\n end",
"def exchange_code(authorization_code)\n client = Google::APIClient.new\n client.authorization = client_secrets\n client.authorization.code = authorization_code\n\n begin\n client.authorization.fetch_access_token!\n return client.authorization\n rescue Signet::AuthorizationError\n raise CodeExchangeError.new(nil)\n end\nend",
"def token!(code)\n Vermonster::Client.connection.basic_auth(@client[:id], @client[:secret])\n\n options = { :grant_type => \"autorization_code\", :code => code }\n response = Vermonster::Client.connection.post \"/oauth/token\", options\n\n if response.body[\"access_token\"]\n @client = @client.merge(:token => response.body[\"access_token\"])\n\n self.connect!(@client[:token])\n\n\n if @client[:token]\n @client[:token]\n else\n false\n end\n else\n false\n end\n end",
"def get_access_token_from_code(code)\n client = HTTPClient.new\n begin\n url = \"#{GRAPH_ROOT}/oauth/access_token\"\n params = { client_id: @app_id, redirect_uri: @redirect_uri, client_secret: @app_secret, code: code }\n result = client.get_content url, params\n pairs = result.split '&'\n pairs.each do |pair|\n key, value = pair.split '='\n if key == 'access_token'\n return @access_token = value\n end\n end\n rescue HTTPClient::BadResponseError => e\n raise e\n rescue => e\n end\n end",
"def request_access_token(code, params={})\n params[:redirect_uri] ||= \"http://localhost\"\n opts = {}\n opts[:mode] = :query\n opts[:param_name] = \"oauth2_access_token\"\n @access_token = oauth2_client.auth_code.get_token(code, params, opts)\n rescue OAuth2::Error => e\n raise LinkedIn::Errors::UnauthorizedError.new(e.code), e.description\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n token = client.auth_code.get_token(auth_code,\n :redirect_uri => authorize_url,\n :scope => SCOPES.join(' '))\n end",
"def fetch_token(code, redirect_uri)\n @access_token_obj = @auth_client.auth_code.get_token(code, {\n :redirect_uri => redirect_uri,\n :token_method => :post\n })\n end",
"def get_with_authorization_code(auth_code, redirect_uri, resource = nil)\n logger.verbose('TokenRequest getting token with authorization code ' \\\n \"#{auth_code}, redirect_uri #{redirect_uri} and \" \\\n \"resource #{resource}.\")\n request(CODE => auth_code,\n GRANT_TYPE => GrantType::AUTHORIZATION_CODE,\n REDIRECT_URI => URI.parse(redirect_uri.to_s),\n RESOURCE => resource)\n end",
"def get_access_token_from_code(code,redirect_url)\n @access_token ||= client.auth_code.get_token(code, :redirect_uri => redirect_url, :parse => :query)\n end",
"def exchange_code_for_token(api, client, auth_code)\n client.auth_code.get_token(auth_code, redirect_uri: api.oauth_redirect)\n rescue OAuth2::Error => e\n fail_with_oauth_error(\n \"Failed to exchange auth_code for token (code=#{e.response.status})\",\n e.response\n )\n end",
"def fetch_access_token(code)\n access_token = @oauth.auth_code.get_token(\n code,\n redirect_uri: @redirect_uri\n )\n { gocardless_access_token: access_token.token,\n gocardless_organisation_id: access_token['organisation_id'] }\n end",
"def create\n client.authorization_code = params[:code]\n access_token = client.access_token!\n puts access_token\n end",
"def oauth_check_authorization\n code = params[:code]\n session[:access_token] = facebook_client.check_authorization code,\n :redirect_uri => oauth_callback_url\n end",
"def get_access_token(code, _options = {})\n conn = Faraday.new(url: base_url) do |faraday|\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n params = access_token_params(code)\n conn.post do |req|\n req.url \"/api/oauth2/token\"\n req.body = params\n req.headers[\"Accept\"] = \"application/json\"\n end\n end",
"def oauth2_access_token(code, options={})\n query = {\n :client_id => Config.client_id,\n :client_secret => Config.client_secret,\n :grant_type => 'authorization_code',\n :redirect_uri => Config.redirect_uri,\n :code => code\n }\n return send_request(:POST, PATH[:oauth2_access_token], query, false, options)\n end",
"def get_token(code)\n uri = URI.parse(URL[\"oauth_access\"])\n params = { :client_id => CLIENT_ID,\n :client_secret => CLIENT_SECRET,\n :code => code\n }\n uri.query = URI.encode_www_form( params )\n return JSON.parse(uri.open.read)\n end",
"def exchange_code(authorization_code)\n\t\tclient_secrets = Google::APIClient::ClientSecrets.load(CLIENT_SECRET_PATH)\n client = client_secrets.to_authorization \n client.update!(redirect_uri: 'postmessage')\n client.code = authorization_code\n \n\t begin\n\t # client.authorization.fetch_access_token!\n\t client.fetch_access_token!\n\t return client\n\t rescue Signet::AuthorizationError\n\t raise CodeExchangeError.new(nil)\n\t end\n\tend",
"def get_access_token(auth_code)\n @access_token = @oauth_client.auth_code.get_token(auth_code, :redirect_uri => @redirect_uri)\n @token = @access_token.token\n @refresh_token = @access_token.refresh_token\n @token_expires_at = @access_token.expires_at\n end",
"def authorize\n return credentials if credentials\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.gets\n authorizer.get_and_store_credentials_from_code(\n user_id: user_id,\n code: code,\n base_url: OOB_URI\n )\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n token = client.auth_code.get_token(auth_code,\n :redirect_uri => authorize_url,\n :resource => 'https://outlook.office365.com')\n\n access_token = token\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n # :authorize_url => \"/auth/office365/callback\")\n \n token = client.auth_code.get_token(auth_code,\n :redirect_uri => office365_callback_url,\n :scope => SCOPES.join(' '))\n end",
"def get_access_token(code, options={})\n options[:grant_type] ||= \"authorization_code\"\n params = access_token_params.merge(options)\n response = post(\"https://www.douban.com/service/auth2/token\",\n params.merge(:code => code),\n raw=false)\n end",
"def authorize_code(authorization_code)\n api_client.authorization.code = authorization_code\n api_client.authorization.fetch_access_token!\n\n result = api_client.execute!(:api_method => settings.oauth2.userinfo.get)\n user = User.first_or_create(:email => result.data.email)\n api_client.authorization.refresh_token = (api_client.authorization.refresh_token || user.refresh_token)\n if user.refresh_token != api_client.authorization.refresh_token\n user.refresh_token = api_client.authorization.refresh_token\n user.save\n end\n session[:user_id] = user.id\nend",
"def get_access_token(code)\n # upstream methods will throw errors if needed\n if info = get_access_token_info(code)\n string = info['access_token']\n end\n end",
"def authorize\n\tclient_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n\ttoken_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n\tauthorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n\tuser_id = 'default'\n\n\tcredentials = authorizer.get_credentials(user_id)\n\treturn credentials unless credentials.nil?\n\n\turl = authorizer.get_authorization_url(base_url: OOB_URI)\n\tputs 'Open the following URL in the browser and enter the ' \\\n\t\t \"resulting code after authorization:\\n#{url}\"\n\tcode = gets\n\n\treturn authorizer.get_and_store_credentials_from_code(\n\t\tbase_url: OOB_URI,\n\t\tuser_id: user_id,\n\t\tcode: code,\n\t)\n\nend",
"def createToken(code)\n makeToken(:authorization_code, :code => code.to_s)\n end",
"def get_access_token(code, options={})\n response = @client.request(@client.options[:access_token_method], @client.access_token_url, access_token_params(code, options))\n parse_token_response(response)\n end",
"def get_access_token(code)\n response = self.class.get('/oauth/access_token', query(code))\n # Something went wrong either wrong configuration or connection\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_access_token Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.access_token'\n end\n response.parsed_response['access_token']\n end",
"def get_access_token(code:, redirect_uri: nil)\n query = {\n code: code,\n client_id: @client_id,\n client_secret: @client_secret,\n redirect_uri: redirect_uri\n }.compact\n response = HTTParty.get(\"https://slack.com/api/oauth.v2.access\", query: query)\n JSON.parse(response.body, symbolize_names: true)\n end",
"def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end",
"def build_access_token\n verifier = request.params[\"code\"]\n client.auth_code.get_token(verifier, token_params.to_hash(:symbolize_keys => true), deep_symbolize(options.auth_token_params))\n end",
"def get_token(code)\n url = \"#{sk_url}/oauth/token?code=#{code}&client_id=#{@@conf['id']}&client_secret=#{@@conf['secret']}&redirect_uri=#{oauth_redirect_uri}\"\n c = Curl::Easy.perform(url)\n # grab token from response body, containing json string\n ActiveSupport::JSON.decode(c.body_str)\n end",
"def exchange_code(code)\n return nil unless token_account\n return nil unless token_account['token_endpoint']\n\n response = request(\n http_method: token_account['token_method'].downcase.to_sym,\n path: token_account['token_endpoint'],\n headers: { CONTENT_TYPE => token_account['token_post_content_type'] },\n body: {\n 'grant_type' => 'authorization_code',\n 'code' => code,\n 'client_id' => Kontena::Client::CLIENT_ID,\n 'client_secret' => Kontena::Client::CLIENT_SECRET\n },\n expects: [200,201],\n auth: false\n )\n response['expires_at'] ||= in_to_at(response['expires_in'])\n response\n end",
"def get_access_token(authz_code = nil)\n if @config.grant_type == 'client_credentials'\n $LOG.i \"getting access token\"\n\t @access_token = @oauth2_client.client_credentials.get_token\n $LOG.i \"got access token\", @access_token\n else\n $LOG.i \"getting access and refresh token pair\"\n\t @access_token = @oauth2_client.auth_code.get_token(authz_code, :redirect_uri => @config.redirect_uri)\n $LOG.i \"got access and refresh token pair\", @access_token\n end\n\n\trefresh_config_from_access_token\n\n\t@access_token\n end",
"def create\n super\n \n if @access_token.client.uses_account_sid\n # Never expire this token. It will be expired when the user explicitly\n # ends their session (by logging out), and possibly after a configurable\n # amount of time, if the provider is using expiration scheduling\n # (see the sessions:expire rake task).\n @access_token.expires_at = Time.mktime(2100, 12, 31)\n end\n \n authorization_code = Oauth2Providable::AuthorizationCode.find_by_token(params[:code])\n @access_token.account_sid = authorization_code.account_sid\n @access_token.client_sid = params[:client_sid]\n @access_token.save\n end",
"def authorize\n credentialsFile = FILE_POSTFIX\n\n if File.exist? credentialsFile\n File.open(credentialsFile, 'r') do |file|\n credentials = JSON.load(file)\n @authorization.access_token = credentials['access_token']\n @authorization.client_id = credentials['client_id']\n @authorization.client_secret = credentials['client_secret']\n @authorization.refresh_token = credentials['refresh_token']\n @authorization.expires_in = (Time.parse(credentials['token_expiry']) - Time.now).ceil\n if @authorization.expired?\n @authorization.fetch_access_token!\n save(credentialsFile)\n end\n end\n else\n auth = @authorization\n url = @authorization.authorization_uri().to_s\n server = Thin::Server.new('0.0.0.0', 8081) do\n run lambda { |env|\n # Exchange the auth code & quit\n req = Rack::Request.new(env)\n auth.code = req['code']\n auth.fetch_access_token!\n server.stop()\n [200, {'Content-Type' => 'text/html'}, RESPONSE_HTML]\n }\n end\n\n Launchy.open(url)\n server.start()\n\n save(credentialsFile)\n end\n\n return @authorization\n end",
"def acquire_access_token(auth_code, reply_url)\n AUTH_CTX.acquire_token_with_authorization_code(\n auth_code,\n reply_url,\n CLIENT_CRED,\n GRAPH_RESOURCE)\n end",
"def oauth_complete(code)\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + \"/oauth2/access_token?client_id=%i&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s\" % [@client_id, @application_secret, @redirect_uri, code]\n \n # And call it.\n response = Curl::Easy.perform(url) do |req|\n req.headers['Accept'] = 'application/json'\n end\n\n # Use Crack to parse the JSON\n response = JSON.parse(response.body_str)\n\n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n\n # Save it locally.\n @access_token = response.access_token\n\n # Return it\n response\n end",
"def obtain_access_token(authorization_code_or_refresh_token, scope = nil)\n # Authorization codes always start with \"O\" and refresh tokens always start with \"R\".\n if authorization_code_or_refresh_token[0] == \"O\"\n data = { \"grant_type\" => \"authorization_code\", \"code\" => authorization_code_or_refresh_token }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n elsif authorization_code_or_refresh_token[0] == \"R\"\n data = { \"grant_type\" => \"refresh_token\", \"refresh_token\" => authorization_code_or_refresh_token }\n data[\"scope\"] = scope unless scope.nil?\n end\n return query_api(\"/auth/token\", data)\n end",
"def obtain_access_token(authorization_code_or_refresh_token, scope = nil)\n # Authorization codes always start with \"O\" and refresh tokens always start with \"R\".\n if authorization_code_or_refresh_token[0] == \"O\"\n data = { \"grant_type\" => \"authorization_code\", \"code\" => authorization_code_or_refresh_token }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n elsif authorization_code_or_refresh_token[0] == \"R\"\n data = { \"grant_type\" => \"refresh_token\", \"refresh_token\" => authorization_code_or_refresh_token }\n data[\"scope\"] = scope unless scope.nil?\n end\n return query_api(\"/auth/token\", data)\n end",
"def set_code(code)\n credentials = AUTHORIZER.get_and_store_credentials_from_code(\n user_id: USER_ID, code: code, base_url: OOB_URI\n )\n credentials.refresh_token\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\"\n puts url\n puts \"\"\n puts \"paste code here:\"\n code = gets\n\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def get_token_from_code(auth_code)\n OUTLOOK_CLIENT.auth_code.get_token(auth_code,\n :redirect_uri => OUTLOOK_REDIRECT_URI,\n :scope => OUTLOOK_SCOPES.join(' '))\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def authorize\n client_id = create_client_id\n token_store = create_token_store\n\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI\n )\n Rails.logger.debug do\n 'Open the following URL in the browser and enter the ' \\\n 'resulting code after authorization'\n end\n Rails.logger.debug url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id:, code:, base_url: OOB_URI\n )\n end\n credentials\n end",
"def get_access_token(auth_code, redirect_uri)\n json = post('/oauth2/token', nil, {'client_id' => client_id, 'client_secret' => client_secret, 'redirect_uri' => redirect_uri, 'code' => auth_code })\n raise WepayClient::Exceptions::AccessTokenError.new(\"A problem occurred trying to get the access token: #{json.inspect}\", json[:error_code]) unless json.has_key?(:access_token)\n json\n end",
"def oauth2_token(code, redirect_uri)\n call('/oauth2/token', false, {\n 'client_id' => @client_id,\n 'client_secret' => @client_secret,\n 'redirect_uri' => redirect_uri,\n 'code' => code\n })\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPES, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def get_token(code)\n uri = URI.parse(\"https://api.dropboxapi.com/oauth2/token\")\n\n payload = URI.encode_www_form(\n client_id: DROPBOX_APP_KEY,\n client_secret: DROPBOX_APP_SECRET,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: SHOTTY_CALLBACK_URL,\n )\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n\n response = http.post(uri.path, payload, {})\n\n body = JSON.parse(response.body)\n\n body[\"access_token\"]\nend",
"def authorize\r\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\r\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\r\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\r\n user_id = 'default'\r\n credentials = authorizer.get_credentials(user_id)\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url(base_url: OOB_URI)\r\n puts 'Open the following URL in the browser and enter the ' \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authenticate(code)\n session = BeyondApi::Session.new(api_url: beyond_api_url)\n\n if Rails.env.development? && BeyondCanvas.configuration.client_credentials\n session.token.client_credentials\n else\n session.token.authorization_code(code)\n end\n\n update(beyond_access_token: session.access_token,\n beyond_refresh_token: session.refresh_token)\n end",
"def get_access_tokens(authorization_grant_code)\n # headers = { 'Content-Type': 'application/x-www-form-urlencoded' } # turns out didn't need this\n params = {\n 'grant_type': 'authorization_code',\n 'access_type': 'offline',\n 'code': authorization_grant_code,\n 'client_id': client_id,\n 'redirect_uri': redirect_uri\n }\n response = HTTParty.post(\n 'https://api.tdameritrade.com/v1/oauth2/token',\n body: params\n )\n\n if response.status == 200\n @access_token = response[\"access_token\"]\n @refresh_token = response[\"refresh_token\"]\n end\n\n response\n end",
"def HandleTokenAuthorization(request)\n if not request['error'].nil?\n raise AuthenticationException, request['error']\n end\n\n code = request['code']\n res = Net::HTTP.post_form(URI(TOKEN_URL),\n 'grant_type' => 'authorization_code',\n 'code' => code,\n 'redirect_uri' => REDIRECT_URL,\n 'client_id' => CLIENT_ID,\n 'client_secret' => CLIENT_SECRET)\n\n if not res.code.to_i == 200\n raise TokenAuthorizationException, res.message\n end\n \n json = JSON.parse(res.body)\n \n @token_time = Time.now\n @expires_in = json['expires_in']\n @access_token = json['access_token']\n @refresh_token = json['refresh_token']\n end",
"def codeExchange(code)\n # Upgrade the code into a token object.\n $authorization.code = code\n $authorization.fetch_access_token!\n $client.authorization = $authorization\n\n # TODO: move into verify_token function\n id_token = $client.authorization.id_token\n encoded_json_body = id_token.split('.')[1]\n\n # Base64 must be a multiple of 4 characters long, trailing with '='\n encoded_json_body += (['='] * (encoded_json_body.length % 4)).join('')\n json_body = Base64.decode64(encoded_json_body)\n body = JSON.parse(json_body)\n\n # You can read the Google user ID in the ID token.\n # \"sub\" represents the ID token subscriber which in our case\n # is the user ID. This sample does not use the user ID.\n gplus_id = body['sub']\n puts \"User ID: \"\n puts gplus_id.inspect\n\n # Serialize and store the token in the user's session.\n token_pair = TokenPair.new\n token_pair.update_token!($client.authorization)\n\n puts token_pair.inspect\nend",
"def get_access_token(code=nil, options={})\n check_for_code!(code)\n options = default_access_code_options(options)\n\n if self.options[:raise_errors]\n check_access_code_url!(options)\n end\n\n tok = self.auth_code.get_token(code, options.map { |key, value| [key.to_s, value] }.to_h)\n self.access_token = LinkedIn::AccessToken.new(tok.token,\n tok.expires_in,\n tok.expires_at)\n return self.access_token\n rescue ::OAuth2::Error => e\n raise OAuthError.new(e.response)\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(self.credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: self.token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPES, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = 'default'\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def get_oauth_token(authorization_code, current_user, query_params = nil)\n begin\n @client.authorization.code = authorization_code\n @client.authorization.fetch_access_token!\n rescue\n return false\n end\n saved = OauthDriveToken.create_or_update(:user => current_user, \n :access_token => @client.authorization.access_token, \n :refresh_token => @client.authorization.refresh_token,\n :client_number => @client.authorization.client_id, \n :expires_at => Time.now + @client.authorization.expires_in.seconds,\n :provider_number => APP_CONFIG['oauth']['google']['provider_number'])\n saved\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(@credentials_path)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: @token_path)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, @scope, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: @oob_uri)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: @oob_uri\n )\n end\n credentials\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI,\n )\n end\n credentials\n end",
"def oauth_data(code:)\n res = uphold_conn.post do |req|\n req.url UPHOLD_AUTHENTICATION_PATH\n req.headers['Authorization'] = ActionController::HttpAuthentication::Basic.encode_credentials(client_id, client_secret)\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n req.body = URI.encode_www_form({code: code, grant_type: 'authorization_code'})\n end\n JSON.parse(res.body, symbolize_names: true).tap do |body|\n @access_token = body[:access_token]\n end\n end",
"def get_oauth_access_token(session_code)\n result = Octokit.exchange_code_for_token(session_code, CLIENT_ID, CLIENT_SECRET)\n result[:access_token]\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI,\n )\n end\n credentials\nend",
"def request_tokens(auth_code)\n @token = @oauth_client.auth_code.get_token auth_code, redirect_uri: @url\n tokens\n end",
"def exchange(code, redirect_url=nil)\n params = {\n client_id: client_id,\n client_secret: client_secret,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: redirect_url\n }\n begin\n response = RestClient.post token_url, params\n rescue => e\n logger.info \"Code exchange problem: \" + e.message\n return\n end\n return if response.code != 200\n\n logger.info \"Code exchange: \" + response.body\n return JSON.parse response.body\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def data_acc_token(code, client_id, client_secret, grant_type=\"authorization_code\", redirect_uri=REDIRECT_URL)\n \"client_id=#{client_id}&client_secret=#{client_secret}&grant_type=#{grant_type}&code=#{code}&redirect_uri=#{redirect_uri}\"\n end",
"def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\r\n user_id = \"default\"\r\n credentials = authorizer.get_credentials user_id\r\n if credentials.nil?\r\n url = authorizer.get_authorization_url base_url: OOB_URI\r\n puts \"Open the following URL in the browser and enter the \" \\\r\n \"resulting code after authorization:\\n\" + url\r\n code = gets\r\n credentials = authorizer.get_and_store_credentials_from_code(\r\n user_id: user_id, code: code, base_url: OOB_URI\r\n )\r\n end\r\n credentials\r\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def request_user_auth(code, redirect_uri)\n response = http_client(MXIT_AUTH_TOKEN_URI) do |http, path|\n\n request = new_post_request(path, {\n \"grant_type\" => \"authorization_code\",\n \"code\" => code,\n \"redirect_uri\" => redirect_uri\n })\n\n http.request(request)\n end\n\n @auth_token = AuthToken.new(handle_response(response))\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def refresh_token(code=nil)\n body = {}\n body[:code] = code unless code.nil?\n\n @client.client_credentials.get_token(\n headers: { 'Authorization' => 'Basic' })\n end"
] |
[
"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.74299335",
"0.7388712",
"0.7363964",
"0.7357776",
"0.7345714",
"0.729002",
"0.72752285",
"0.7264594",
"0.7246323",
"0.7240809",
"0.72246146",
"0.7176992",
"0.714192",
"0.71411383",
"0.7135236",
"0.71084404",
"0.71015525",
"0.7065231",
"0.70626104",
"0.7060247",
"0.7053482",
"0.70422226",
"0.70168054",
"0.7008359",
"0.70063436",
"0.6995642",
"0.6995642",
"0.6988298",
"0.69726616",
"0.6967712",
"0.69543505",
"0.6947785",
"0.6945369",
"0.69443214",
"0.6943627",
"0.6942857",
"0.69113725",
"0.6910234",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908562",
"0.6908269",
"0.69082123",
"0.6900768",
"0.6896815",
"0.68933773",
"0.6889711",
"0.6888174",
"0.6883668",
"0.6880615",
"0.68678546",
"0.68678546",
"0.68656105",
"0.6855625",
"0.6849101",
"0.6847277",
"0.68394583",
"0.6839323",
"0.68386894",
"0.683451",
"0.683451",
"0.683451",
"0.683451",
"0.6828342",
"0.6821896",
"0.68186516",
"0.68186516",
"0.678946",
"0.6779374",
"0.6772114",
"0.67655665"
] |
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 return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end",
"def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end",
"def fetch_user\n @current_user = User.find_by(:id => session[:user_id]) if session[:user_id]\n\n session[:user_id] = nil unless @current_user.present?\n end",
"def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end",
"def get_current_user(email='', first_name='', last_name='')\n current_user.present? ? current_user : {user_id: nil, email: email, first_name: first_name, last_name: last_name}\n end",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def user_info\n auth_hash['user_info']\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def fetch_user\n\n # Check if user_id in the session is the id of a real user in our db. If it is, we will get the user object in @current_user; if not, we will get nil\n if session[:user_id].present?\n @current_user = User.find_by id: session[:user_id]\n end\n\n # If we did get nil from the above query, delete the session because the user_id is stale (invalid)\n if @current_user.nil?\n session[:user_id] = nil # unless @current_user.present?\n end\n\n end",
"def check\n api.get_user\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def currentUser\n user = User.get(:current)\n return User.find(user[\"id\"])\n rescue ActiveResource::UnauthorizedAccess\n @error = \"User unauthorized.\"\n return nil\n rescue ActiveResource::ClientError => e\n @error = e.message\n return nil\n rescue ActiveResource::ConnectionError => e\n @error = e.message\n return nil\n rescue Errno::ECONNREFUSED => e\n @error = \"Unable to connect to #{@site}\"\n return nil\n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def info\n oauth_response = access_token.get \"/api/v1/users/current.json\"\n JSON.parse(oauth_response.body)\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def current_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n # Returns nil if not found\n end\n end",
"def user\n return User.current unless user_id\n user = User.get_from_cache(user_id)\n user || User.first({:id => user_id})\n end",
"def current_user\n data[:users][@current_user['id']] ||= @current_user\n data[:identities][@current_user_identity['id']] ||= @current_user_identity\n\n @current_user\n end",
"def find_current_user #for madlib/user connection - am i using this?\n @user_found = User.find_by(id: session[:user_id])\n end",
"def fetch_user\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n @user_token_sale_state = @user.get_token_sale_state_page_name\n end",
"def get_user\n return if @user # no extra http calls\n url = URI.escape(\"#{@options[:cas_server]}/#{@options[:uid]}.#{@options[:format]}\")\n response = Casport.get(url)\n if response.success?\n @user = response.parsed_response\n else\n @user = nil\n end\n end",
"def current_user\n if session[:user_id] == nil\n return {}\n end\n\n # ruby - implicit return\n return run_sql(\"SELECT * FROM users WHERE id = #{session[:user_id]};\")[0]\nend",
"def current_user\n api_key = APIKey.active.where(access_token: token).first\n if api_key\n return api_key.usuario\n else\n return nil\n end\n end",
"def getUser(user, info)\n @@users[user][info]\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def user_info_by_cid( id )\n\n print \"Looking up user details for #{id}...\"\n\n # lookup the user by computing id\n user_info = Helpers.lookup_user( id )\n if user_info.nil?\n puts \"not found\"\n return nil\n end\n\n puts \"done\"\n return user_info\n end",
"def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end",
"def current_user\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.includes(:person).find_by(token: token).try(:person)\n else\n nil\n end\n end",
"def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end",
"def get_cur_user\n @user = nil\n if is_logged_in session\n @user = User.find_by_sunet(session[:user_hash][\"username\"])\n end\n render json: @user\n end",
"def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end",
"def current_user\n\t\tif session[:user_id]\n\t\t\t@current_user = User.find(session[:user_id])\n\t\telse\n\t\t\tapi_key = ApiKey.where(access_token: token_and_options(request)).first\n\t\t\t@current_user = User.find(api_key.user_id) if api_key\n\t\tend\n\tend",
"def remote_info\n return nil unless oauth_token?\n response = api(url: '/user')\n response.data\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] \n #return this user if session[:user_id] that is stored in our session hash if so then find the user in our database and display it, \n # the @current_user is handy if the user already exist and we do not want the user id keep heiting the database every time \n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def current_user() # :doc:\n @current_user ||= begin\n if api_request?\n UserSession.find.full?(&:user) ||\n authenticate_by_api_key_in_params || \n authenticate_by_api_key_in_http_auth\n else\n UserSession.find.full?(&:user)\n end\n end\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def user_details(login, authenticated = false)\n result = nil\n if authenticated\n auth_connection(HTTP_GET, \"/api/users/#{login}.xml\") do |xml|\n result = User.new xml\n end\n else\n public_connection(HTTP_GET, \"/api/users/#{login}.xml\") do |xml|\n result = User.new xml\n end\n end\n result\n end",
"def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id] \n #this code will return nil rather than throwing an exception. \n #'||=' memoization technique is a minor performance optimization.\n #if @current_user exist, do not run the code after '||=' else do so, ensuring we will hit database once. \n end",
"def current_user\n # if current_user is et use it otherwise ask the data store\n @current_user ||= User.find_by(id: session[:user_id])\n end",
"def current_user\n puts decoded_token\n \n if decoded_token\n # user_id = User.find_by(id: user_id)\n User.find_by(id: decoded_token[0][\"user_id\"])\n\n end\n end",
"def get_current_user\n request(Route.new(:GET, '/users/@me'))\n end",
"def find_current_user\n if session[:current_user_id]\n @user = User.find_by(id: session[:current_user_id])\n else\n @user = nil\n end\n end",
"def current_user\n self.data[:users][@current_user[\"id\"]] ||= @current_user\n self.data[:identities][@current_user_identity[\"id\"]] ||= @current_user_identity\n\n @current_user\n end",
"def current_user\n self.data[:users][@current_user[\"id\"]] ||= @current_user\n self.data[:identities][@current_user_identity[\"id\"]] ||= @current_user_identity\n\n @current_user\n end",
"def fetch!\n github_user = client.user(login)\n\n @name = (github_user['name'] || login) # Fall back to login if no name specified\n @company = github_user['company']\n @email = github_user['email']\n\n github_user\n end",
"def get_user\n response = HTTParty.get(\n GIT_BASE_URL + 'users/' + self.git_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (get user): #{response}\"\n return response\n end",
"def current_user\n\n#return this @current user, only if he exists, if not, find him based on the current id stored in session\n@current_user ||= User.find(session[:user_id]) if session[:user_id] #return this user if there is a user id stored in our session hash\n\nend",
"def current_user\n @user || @api_user || @social_user\n end",
"def getUser\n render json: @current_user, status: 200\n end",
"def get_user_id\n if current_user\n @user = User.find(current_user.id)\n end\nend",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end",
"def current_user_id\n info['user']['id']\n end",
"def load_current_user\n the_id = session[:user_id]\n @current_user = User.where({ :id => the_id }).first\n end",
"def userinfo\n unless defined?(@userinfo)\n @userinfo = solr_url.userinfo if solr_url\n user = user_configuration_from_key('solr', 'user')\n pass = user_configuration_from_key('solr', 'pass')\n @userinfo ||= [ user, pass ].compact.join(\":\") if user && pass\n @userinfo ||= default_userinfo\n end\n @userinfo\n end",
"def user()\n return @data[\"access\"][\"user\"]\n end",
"def user\n User.get user_id || User.new\n end",
"def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend",
"def current_user\n payload = TokiToki.decode(bearer_token)\n @current_user ||= User.find_by :github_name => payload[0]['sub']\n end",
"def user\n @user ||= Innsights::Fetchers::User.new(@user_object) if @user_object\n end",
"def currentUser(extras=nil)\n method = 'currentUser'\n type = User\n args = {}\n args[:extras] = extras if extras\n return_object type,method,args,true\n end",
"def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end",
"def find_current_user\n user = nil\n unless api_request?\n if session[:user_id]\n # existing session\n user = (User.active.find(session[:user_id]) rescue nil)\n elsif cookies[Redmine::Configuration['autologin_cookie_name']] && Setting.autologin?\n # auto-login feature starts a new session\n user = User.try_to_autologin(cookies[Redmine::Configuration['autologin_cookie_name']])\n session[:user_id] = user.id if user\n user\n elsif params[:format] == 'atom' && params[:key] && accept_key_auth_actions.include?(params[:action])\n # RSS key authentication does not start a session\n user = User.find_by_rss_key(params[:key].to_s)\n end\n end\n if user.nil? && Setting.rest_api_enabled? && api_request?\n if (key = api_key_from_request) && accept_key_auth_actions.include?(params[:action])\n # Use API key\n user = User.find_by_api_key(key.to_s)\n else\n # HTTP Basic, either username/password or API key/random\n authenticate_with_http_basic do |username, password|\n user = User.try_to_login(username, password) || User.find_by_api_key(username)\n end\n end\n # Switch user if requested by an admin user\n if user && user.admin? && (username = api_switch_user_from_request)\n su = User.find_by_login(username)\n if su && su.active?\n logger.info(\" User switched by: #{user.login} (id=#{user.id})\") if logger\n user = su\n else\n render_error :message => 'Invalid X-ChiliProject-Switch-User header', :status => 412\n end\n end\n end\n user\n end",
"def check_for_user\n if current_user\n @user = current_user\n else\n @user = {}\n end\n render json: @user\n end",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end",
"def getUser login\n return false if !@usrData\n @usrData[login]\n end",
"def profile\n\t\t@user = User.find(current_user)\n\tend",
"def current_user\n @current_user ||= ::User.send(\"find_by_#{self.identifier_attribute}!\", session[identifier_name])\n rescue ActiveRecord::RecordNotFound\n nil\n end",
"def current_user_info\n\t\trespond_to do |format|\n\t\t\tif !current_user\n\t\t\t\tformat.json { render json: { 'User' => 'not logged in' } }\n\t\t\telse\n\t\t\t\tformat.json { render json: { 'Name' => current_user.name, 'Image' => getFacebookPicURL(current_user) } }\n\t\t\tend\n\t\tend\n\tend",
"def user\n return Etc.getlogin\n end",
"def current_user\n #memoization\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n rescue ActiveRecord::RecordNotFound\n session.delete(:user_id)\n @current_user = nil\n end",
"def actual_user\n if @current_user.nil? || session[:cas_user] != @current_user.cas_directory_id\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n end\n @current_user\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def current_user\n get(\"/v1/users/me\")\n end",
"def load_user\n @user ||= ((params[:id] && params[:id] != 'current' && User.find(params[:id])) || current_user)\n end",
"def _user uid = 0\n\t\t@infos \t\t\t= {}\n\t\t@infos[:uid] \t= uid\n\t\t@infos[:name] \t= 'unknown'\n\t\t@infos[:level] \t= 0\n\t\t@infos[:sid] \t= ''\n\n\t\t# get uid\n\t\tif uid == 0\n\t\t\t# checks the uid whether exists in session\n\t\t\tif sid = request.cookies['sid']\n\t\t\t\tuid = _session_has sid\n\t\t\tend\n\t\tend\n\n\t\t# fetch info by uid\n\t\tif uid.to_i > 0\n\t\t\tds = Sdb[:_user].filter(:uid => uid)\n\t\t\t@infos[:uid]\t\t= uid\n\t\t\t@infos[:name] \t= ds.get(:name)\n\t\t\t@infos[:level] \t= ds.get(:level)\n\t\t\t@infos[:sid] \t= sid\n\t\tend\n\t\t@infos\n\tend",
"def find_current_user\n Current.user = UserSession.find&.user\n\n return if logged_in?\n\n authenticate_with_http_token do |token, options|\n user = User.find_by(api_token: token)\n return unless user.present?\n\n # Compare the tokens in a time-constant manner, to mitigate timing attacks.\n Current.user = user if ActiveSupport::SecurityUtils.secure_compare(user.api_token, token)\n end\n end",
"def current_user\r\n api_key = ApiKey.active.where(access_token: token).first\r\n if api_key\r\n return api_key.user\r\n else\r\n return nil\r\n end\r\n end",
"def status_getuser!()\n @status = TAC_PLUS_AUTHEN_STATUS_GETUSER\n end",
"def userinfo?\n @userinfo = session[:userinfo] = request.env['omniauth.auth'][:extra][:raw_info]\n\n # No email address, reject\n return login_failed 'Email required.' unless @userinfo[:email]\n\n @email = @userinfo[:email]\n @auth0_id = @userinfo[:user_id]\n end",
"def hubssolib_get_user_data\n user = self.hubssolib_current_session ? self.hubssolib_current_session.session_user : nil\n\n if (user && user.user_id)\n return user\n else\n return nil\n end\n end",
"def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend",
"def current_user\n User::TYPES.each do |mapping|\n user = self.send(\"current_#{mapping.to_s.downcase}\")\n return user unless user.nil?\n end\n end",
"def current_user(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users/me', params)\n end",
"def get_current_logged_in_user \n get(\"/users.json/current\")\nend",
"def get_current_logged_in_user \n get(\"/users.json/current\")\nend",
"def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end"
] |
[
"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.68772125",
"0.68543833",
"0.68495995",
"0.68292946",
"0.6817157",
"0.6805334",
"0.67987984",
"0.67925674",
"0.6789876",
"0.67467844",
"0.6737717",
"0.6718585",
"0.6717319",
"0.66984016",
"0.669524",
"0.6694587",
"0.6674402",
"0.6674402",
"0.6673212",
"0.66593426",
"0.66573226",
"0.665414",
"0.6648865",
"0.6645846",
"0.6645498",
"0.66378886",
"0.6628147",
"0.6612469",
"0.6612415",
"0.65952647",
"0.6593376",
"0.6583872",
"0.6582355",
"0.6582355",
"0.6578385",
"0.65780807",
"0.65766734",
"0.6575579",
"0.6568989",
"0.6568965",
"0.6566839",
"0.6566839",
"0.6566839",
"0.6565708",
"0.65508276",
"0.6548979",
"0.6547857",
"0.6540255",
"0.6522692",
"0.65203714",
"0.65163386",
"0.651589",
"0.6512714",
"0.65107363",
"0.6506117",
"0.65055263",
"0.6504798",
"0.65020955",
"0.6501706",
"0.650009",
"0.6497105",
"0.6494672",
"0.64936036",
"0.6490554",
"0.64885646",
"0.64874995",
"0.64845616",
"0.64813083",
"0.64779264",
"0.64761937",
"0.64699805",
"0.6466128",
"0.6465342",
"0.6464001",
"0.64632714",
"0.6462751",
"0.64619493",
"0.64619493",
"0.64559895"
] |
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.user_extended_detail_id)\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def fetch!\n github_user = client.user(login)\n\n @name = (github_user['name'] || login) # Fall back to login if no name specified\n @company = github_user['company']\n @email = github_user['email']\n\n github_user\n end",
"def user\n logger.warn(\"DEBUG: getting user for %p\" % self.wedgetail)\n User.find_by_wedgetail(self.wedgetail,:order=>\"created_at desc\")\n end",
"def get_last_users_parsed\n return @last_parsed_userlist_data\n end",
"def fetch_user\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n @user_token_sale_state = @user.get_token_sale_state_page_name\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def recent_users\n respond_with json_response(\n 'recent_users',\n User.all.order('created_at DESC').first(5)\n )\n end",
"def get_user\n response = HTTParty.get(\n GIT_BASE_URL + 'users/' + self.git_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (get user): #{response}\"\n return response\n end",
"def show\n @user = User.find(params[:id])\n fresh_when :last_modified => @user.updated_at.utc, :etag => @user\n end",
"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@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"def info\n oauth_response = access_token.get \"/api/v1/users/current.json\"\n JSON.parse(oauth_response.body)\n end",
"def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end",
"def fetch_user(id)\n client.user(id)\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def get_last_user\n @last_user = User.last\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def most_recent_user\n \tuser = User.find(last_poster_id)\n \treturn user\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def show\n # If data has not changed, return a 304\n if stale? etag: EtagCalculator.etag(current_user.user_data_updated_at),\n last_modified: current_user.user_data_updated_at\n @user = current_user\n respond_with @user\n end\n rescue => e\n handle_error e\n end",
"def last_modified_by; User.get(self.last_modified_by_id); end",
"def last_modified_by; User.get(self.last_modified_by_id); end",
"def last_modified_by; User.get(self.last_modified_by_id); end",
"def last_modified_by; User.get(self.last_modified_by_id); end",
"def last\n user = User.new\n user.read_creddentials\n user.login\n last_food = YumConnector.food_by_id user.last\n puts last_food.to_str\n end",
"def get_latest_users_logged_in(top = 5)\n doc = DocumentStore.get_document(DOCS[:latest_users_loggedin])\n return nil if doc[:users].empty?\n\n Rails.logger.debug(\"Latest Users Logged In\")\n Rails.logger.debug(doc[:users].inspect)\n Rails.logger.debug(\"Slice List!\")\n users = doc[:users]\n\n Rails.logger.debug(users.first(top).inspect)\n Rails.logger.debug(\" \")\n\n get_multiple_users_by_uid(users.first(top))\n end",
"def fetch_users\n fetch_assignee + fetch_watchers\n end",
"def latest_on(board)\n board.entrys.where(user: self).last\n end",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def remote_info\n return nil unless oauth_token?\n response = api(url: '/user')\n response.data\n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def fetch_user\n id = params[:id] || params[:user].try(:fetch,:id)\n user = User.find(params[:id])\n authorize user, :update?\n return user\n end",
"def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def fetch_details_from_github\n\t\t# To Do\n\t\tself.user.has_github = true\n\t\tself.user.save\n\tend",
"def call\n fetch_user_from_auth_token\n end",
"def recent_users(order = \"id DESC\", limit = 5)\n User.all(:order => order, :limit => limit)\n end",
"def user\n UserRepository.find(user_id)\n end",
"def user\n @user ||= Innsights::Fetchers::User.new(@user_object) if @user_object\n end",
"def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend",
"def user_obj\r\n User.select(:name).where(id: object.user_id).last || User.new(name: \"Not Found\")\r\n end",
"def fetch_user\n\n # Check if user_id in the session is the id of a real user in our db. If it is, we will get the user object in @current_user; if not, we will get nil\n if session[:user_id].present?\n @current_user = User.find_by id: session[:user_id]\n end\n\n # If we did get nil from the above query, delete the session because the user_id is stale (invalid)\n if @current_user.nil?\n session[:user_id] = nil # unless @current_user.present?\n end\n\n end",
"def find_updated_by_user_info_for_room\n editor = self.updated_by\n return editor != nil ? User.find_by_id(editor) : nil\n end",
"def get_users\n @get_users = Rails.cache.fetch(\"get_aside_users\", :expires_in => 1.hours) do\n if @current_user.present?\n Core::User.active.where(\"verified = 1 AND id != #{@current_user.id}\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n else\n Core::User.active.where(\"verified = 1\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n end\n end\n end",
"def updated_by\n if self.logs.where(:action => :update).count > 0\n self.logs.where(:action => :update).desc(:created_at).limit(1).first.user\n end\n end",
"def fetch_details_from_twitter\n\t\t# twitter_object = Twitter::Client.new(\n\t\t# \t:oauth_token => self.token,\n\t\t# \t:oauth_token_secret => self.secret\n\t\t# \t)\n\t\t# twitter_data = Twitter.user(self.uid.to_i)\n\t\t# self.username = twitter_data.username\n\t\t# self.save\n\t\t# self.user.username = twitter_data.username if self.user.username.blank?\n\t\t# self.user.image = twitter_data.profile_image_url if self.user.image.blank?\n\t\t# self.user.location = twitter_data.location if self.user.location.blank?\n\t\t# self.user.save(:validate => false)\n\t\tself.user.has_twitter = true\n\t\tself.user.save\n\tend",
"def user\n return @duser if !@duser.nil?\n connection = Faraday::Connection.new options.client_options[:site], :ssl => options.client_options[:ssl]\n response = connection.get(\"/graph/me.json?access_token=#{access_token.token}\")\n json = JSON.parse(response.body)\n pp json if options[:verbose]\n @duser = {'token' => access_token.token}\n @duser['provider'] = 'dailycred'\n @duser['uid'] = json['id'] || json['user_id']\n json.each do |k,v|\n @duser[k] = v\n end\n json[\"identities\"].each do |k, v|\n @duser[k] = v\n @duser[k][:access_token] = json[\"access_tokens\"][k]\n end if !json[\"identities\"].nil?\n pp @duser if options[:verbose]\n created = json['created'] / 1000\n @duser['created'] = DateTime.strptime(created.to_s, '%s')\n @duser.delete(\"id\")\n\n @duser\n end",
"def user(reload = false)\n self.cache(CostAgent::User, self.username, reload) do\n data = self.client(\"verify\").get.headers\n [User.new(\n :id => data[:user_id],\n :permissions => data[:user_permission_level],\n :company_type => data[:company_type])]\n end.first\n end",
"def refresh_user(name)\n single_user_query = RallyAPI::RallyQuery.new()\n single_user_query.type = :user\n single_user_query.fetch = @detail_user_fetch\n single_user_query.page_size = 200 #optional - default is 200\n single_user_query.limit = 90000 #optional - default is 99999\n single_user_query.order = \"UserName Asc\"\n single_user_query.query_string = \"(UserName = \\\"\" + name + \"\\\")\"\n\n query_results = @rally.find(single_user_query)\n if query_results.total_result_count == 0\n return nil\n else\n # Cache user for use next time\n this_user = query_results.first\n @cached_users[this_user[\"UserName\"].downcase] = this_user\n @logger.info \"Refreshed User: #{this_user.UserName}\"\n\n return this_user\n end\n end",
"def user_info\n auth_hash['user_info']\n end",
"def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end",
"def get_user_details(token)\n uri = URI('https://api.github.com/user')\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = 'token ' + token\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n responseText = ActiveSupport::JSON.decode res.body\n else\n responseText = 'Error receiving user details: ' + res.value\n end\n\n return responseText\n end",
"def show\n\tuser_completed = @user.as_json(:only => [:id, :username, :login, :email, :guild_id, :otp_secret, :otp_required_for_login])\n\t\t\t\t\t\t.merge(guild: @user.guild, achievments: @user.achievments)\n\tif self.user_owner?\n \trender json: user_completed, status: :ok\n\telse\n \trender json: user_completed.except(:email, :otp_required_for_login), status: :ok\n\tend\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def refresh_user_data!\n if user = User.fields(:name, :nickname, :user_image, :user_image_original, :avatar_file_name).first(:id => self.user_id)\n self.name = user.name\n self.nickname = user.nickname\n self.user_image = user.user_image\n self.user_image_original = user.user_image_original\n self.has_shelby_avatar = user.has_shelby_avatar\n end\n end",
"def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end",
"def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end",
"def get_user_data(uid)\n @conn.get(\"/api/v1/users/#{uid}\")\n end",
"def show\n if current_api_user.id == @user.id\n render json: @user.as_json(except: [:updated_at])\n else\n render json: @user.as_json(except: [:google_id, :updated_at])\n end\n end",
"def fetch_user\n @current_user = User.find_by(:id => session[:user_id]) if session[:user_id]\n\n session[:user_id] = nil unless @current_user.present?\n end",
"def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end",
"def getUser\n \t\tuser_id = Course.where(\"id = '#{self.course_id}'\").first.user_id\n \t\treturn User.where(\"id = '#{user_id}'\").first\n \tend",
"def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end",
"def get_info(id = @id)\n res = @session.request(\"CakeMail::API::ClassUser\", \"GetInfo\", { :user_id => id, :user_key => @user_key })\n @email = res['email'].first unless res['email'].nil?\n @status = res['status'].first unless res['status'].nil?\n @created_on = res['created_on'].first unless res['created_on'].nil?\n @last_activity = res['last_activity'].first unless res['last_activity'].nil?\n @first_name = res['first_name'].first unless res['first_name'].nil?\n @last_name = res['last_name'].first unless res['last_name'].nil?\n @title = res['title'].first unless res['title'].nil?\n @language = res['language'].first unless res['language'].nil?\n @timezone = res['timezone'].first unless res['timezone'].nil?\n @timezone_id = res['timezone_id'].first unless res['timezone_id'].nil?\n @office_phone = res['office_phone'].first unless res['office_phone'].nil?\n @mobile_phone = res['mobile_phone'].first unless res['mobile_phone'].nil?\n @wysiwyg = res['wysiwyg'].first unless res['wysiwyg'].nil?\n @group_ids = res['group_id'] unless res['group_id'].nil?\n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end",
"def user\n user = JSON.parse(RestClient.get(\"https://api.discord.bio/v1/user/details/#{slug}\"))\n\n DBio::User.new(user['payload'])\n end",
"def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end",
"def user_information(username)\n response = get \"v1/market/user:#{username}.json\"\n response[:user]\n end",
"def get_user_info\n response = HTTParty.get(\n \"https://api.github.com/user\",\n :headers => {\n \"Authorization\" => \"Bearer #{session[:access_token]}\",\n \"User-Agent\" => \"OAuth Test App\"\n }\n )\n session[:email] = response[\"email\"]\n session[:name] = response[\"name\"]\n session[:user_image] = response[\"avatar_url\"]\n session[:provider] = \"GitHub\"\n end",
"def current_api_user\n api_access_token = extract_bearer_token(request)\n if api_access_token.present?\n user = User.find_by('api_access_token.access_token' => api_access_token)\n if user.nil?\n # extract user info from access_token\n begin\n token_url = \"https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=#{api_access_token}\"\n response = RestClient.get token_url\n credentials = JSON.parse response.body\n now = Time.zone.now\n token_values = {\n 'access_token' => api_access_token,\n 'expires_in' => credentials['expires_in'],\n 'expires_at' => now + credentials['expires_in'].to_i,\n 'last_access_at' => now\n }\n email = credentials['email']\n user = User.find_by(email: email)\n if user.present?\n # store api_access_token to speed up retrieval next time\n user.update(api_access_token: token_values)\n else\n Rails.logger.error \"Unable to retrieve user info from access token: #{api_access_token}\"\n end\n rescue => e\n error_context = {\n auth_response_body: response.present? ? response.body : nil,\n auth_response_code: response.present? ? response.code : nil,\n auth_response_headers: response.present? ? response.headers : nil\n }\n ErrorTracker.report_exception(e, user, error_context)\n Rails.logger.error \"Error retrieving user api credentials: #{e.class.name}: #{e.message}\"\n end\n end\n # check for token expiry and unset user && api_access_token if expired/timed out\n # unsetting token prevents downstream FireCloud API calls from using an expired/invalid token\n if user.api_access_token_expired? || user.api_access_token_timed_out?\n user.update(api_access_token: nil)\n nil\n else\n # update last_access_at\n user.update_last_access_at!\n user\n end\n elsif controller_name == 'search' && action_name == 'bulk_download'\n Rails.logger.info \"Authenticating user via auth_token: #{params[:auth_code]}\"\n user = User.find_by(totat: params[:auth_code].to_i)\n user.update_last_access_at!\n user\n end\n end",
"def set_most_recent\n @recent = User.order(\"created_at\").last\n end",
"def find_created_by_user_info_for_room\n return User.find_by_id(self.created_by)\n end",
"def fetch_user\n\n @user = User.where(id: @user_validation_hash_obj.user_id).first\n\n return validation_error(\n 'um_rp_9',\n 'invalid_api_params',\n ['invalid_r_t'],\n GlobalConstant::ErrorAction.default\n ) if @user.blank? || !@user.is_eligible_for_reset_passowrd?\n\n success\n\n end",
"def user\n cached(:user_uncached)\n end",
"def recent_users\n request('getRecentlyActiveUsers', {})['users'].map { |u| User.new(self, u) }\n end",
"def getUserInfo(idUser)\n \n begin\n \n query = \"SELECT last_name,first_name,email,birthdate,facebook_id,profile_img FROM `#{USER_TABLE}` WHERE `id_user` = ?\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute(idUser)\n count=0\n userinf=false\n sth.fetch() { |row| \n userinf = Hash[\"last_name\" => self.to_utf8(row[0]),\n \"first_name\" => self.to_utf8(row[1]),\n \"email\" => row[2],\n \"birthdate\" => row[3],\n \"facebook_id\" => row[4],\n \"profile_img\" => row[5]]\n } \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return userinf\n \n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def get_user_data(id)\n load_user_data(id)\n @user_data[@user_id]\n end",
"def get_user(screen_name)\n result = self.class.get(\"/users/#{screen_name}\", :headers => @headers)\n puts \"#{result.headers['x-ratelimit-remaining']} requests left!\"\n JSON.parse(result.body)\n\n end",
"def get_user_from_twitter_as_hash(screen_name_or_twitter_id)\n Rails.cache.fetch(\"/users/show/#{screen_name_or_twitter_id}\", :expires_in => 2.hours) { twitter.get(\"/users/show/#{screen_name_or_twitter_id}\") }\n end",
"def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end",
"def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end",
"def latest\n @gapi.only_read_latest\n end",
"def latest\n @gapi.only_read_latest\n end",
"def most_active_user\n \n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end"
] |
[
"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.6238325",
"0.6215662",
"0.6211664",
"0.62110823",
"0.6174721",
"0.6113348",
"0.60965055",
"0.60891",
"0.60891",
"0.60891",
"0.60891",
"0.60888827",
"0.6084756",
"0.60733783",
"0.60669446",
"0.6058216",
"0.6058216",
"0.6057231",
"0.6051748",
"0.6042242",
"0.6038334",
"0.60144144",
"0.5986095",
"0.5982953",
"0.59710085",
"0.5967277",
"0.59656835",
"0.596403",
"0.59623283",
"0.5961299",
"0.5960963",
"0.59392834",
"0.5929106",
"0.59234875",
"0.5919764",
"0.5916742",
"0.5909493",
"0.5909402",
"0.590708",
"0.5903795",
"0.5899691",
"0.58853644",
"0.5884647",
"0.5879898",
"0.58628595",
"0.58589774",
"0.5857772",
"0.5854224",
"0.5821068",
"0.5819208",
"0.5813644",
"0.579737",
"0.5795024",
"0.5793057",
"0.5783156",
"0.5779979",
"0.5770461",
"0.5763875",
"0.57504994",
"0.5749437",
"0.57315826",
"0.57259876",
"0.57201797",
"0.571266",
"0.5712408",
"0.5705138",
"0.56961346",
"0.5688581",
"0.56868565",
"0.5685929",
"0.5684992",
"0.5684654",
"0.5683301",
"0.5675193",
"0.5670127",
"0.5670127",
"0.5668606",
"0.56599224",
"0.56599224",
"0.5657032"
] |
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.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 task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def index\n @task_lists = Task::List.all.active\n end",
"def tasks\n task_list.tasks\n end",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"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_for(list)\n\t\t@tasks[list] ||= fetch_latest_tasks_for(list)\n\tend",
"def task_list\n get_or_make_reference('TaskList', @data, 'task_list_id')\n end",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"def task_list_items\n result[:task_list_items] ||= []\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def list_all_tasks\n task = Task.all\nend",
"def index\n @task_lists = TaskList.all\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def getTasklist\r\n\t\t\t\t\treturn @tasklist\r\n\t\t\t\tend",
"def index\n @tasklists = Tasklist.all\n end",
"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@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"def active_tasks\n @tasks.select { | task | task.active }\n end",
"def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def all\n return @tasks\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"def index\n @task_lists = @user.task_lists\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def all_tasks\n @task = Task.get_all_tasks_user_can_see(current_user)\n end",
"def get_sorted_list_of_tasks\r\n tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :active_task => true})\r\n unstarted_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :started_at => nil}).sort_by {|t| t.created_at}\r\n finished_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => true}).sort_by {|t| t.created_at}\r\n\r\n tasks.concat(unstarted_tasks).concat(finished_tasks)\r\n return tasks\r\n end",
"def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def task_names \n\t\t\tHelpers::DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(\n\t\t\t:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number, \n\t\t\t:Tasks__Name, :Tasks__Completed, :Tasks__Priority).filter(:Lists__Name => Config[:working_list_name])\n\t\tend",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def list_tasks\n config = instantiate_configuration\n config.load 'deploy'\n \n set_up_config(config)\n \n config.task_list(:all)\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def task_list\n self.tasks.map do |task|\n task.text\n end\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def active_tasks\n request.method = :get\n request.uri = '_active_tasks'\n Couchdbtools.execute(request)\n end",
"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 request = prepare_request(Net::HTTP::Get.new \"#{@path}/ajax/lists/id/#{list}\")\n response = @http.request request\n result = []\n\n Nokogiri::HTML(JSON.parse(response.body)[\"data\"]).css(\"li.more\").each do |html_task|\n task = Wunderlist::Task.new\n task.id = html_task.attributes[\"id\"].value.to_i\n task.name = html_task.css(\"span.description\").first.content\n task.important = html_task.css(\"span.fav\").empty? ? false : true\n task.done = html_task.attributes[\"class\"].value.split(\" \").include?(\"done\")\n html_timestamp = html_task.css(\"span.timestamp\")\n task.date = Time.at(html_timestamp.first.attributes[\"rel\"].\n value.to_i).to_date unless html_timestamp.empty?\n task.note = html_task.css('span.note').first.content\n task.api = self\n task.list = list_obj\n\n result << task\n end\n\n result\n end",
"def getAssignedTasks\n\tassignedTasks = CrawlerTask.where(:carrier => $worker_name, :status => 0)\nend",
"def update_internal_task_lists\n\n # Security - discard tasks the user should not be able to see.\n\n if ( @current_user.restricted? )\n @tasks.select do | task |\n task.is_permitted_for?( @current_user )\n end\n end\n\n # Now the fiddly bit! Sort the task objects by augmented title, then\n # retrospectively rebuild the task ID arrays using the reordered list.\n\n Task.sort_by_augmented_title( @tasks )\n\n @task_ids = []\n @active_task_ids = []\n @inactive_task_ids = []\n\n @tasks.each do | task |\n @task_ids << task.id\n @active_task_ids << task.id if ( task.active )\n @inactive_task_ids << task.id unless ( task.active )\n end\n end",
"def current_context_task_names()\n @cached_tasks.fetch(@active_context.get_task_cache_id(),[]).dup\n end",
"def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end",
"def all_tasks\n self.stories.collect { |s| s.tasks }.flatten\n end",
"def index # all available task\n @task_check = Task.all\n # need to list only Tasks that is not owned by current_user\n if user_signed_in?\n @my_id = current_user.id\n # All Available task not current_user & checks for accepted_by_user_id == 0\n # query worked only after setting accepted_by_user_id to = 0 from nil\n # Set default field of accepted_by_user_id to 0 within task.rb via after_initialize\n # @tasks = Task.where(\"user_id != ? AND task_status = ? AND accepted_by_user_id = ?\", @my_id, \"Available\", 0)\n @tasks = Task.where(\"user_id != ? AND task_status = ? AND accepted_by_user_id = ?\", @my_id, \"Available\", 0)\n @tasks2 = @tasks\n else\n # All Available task including my tasks : user_signed_in?(false) => index display\n @tasks = Task.where(task_status: \"Available\")\n @tasks2 = @tasks\n end\n end",
"def tasks\n return @tasks.values\n end",
"def list_user_tasks\n\t\t@tasks = current_user.get_developer_tasks\n\tend",
"def index\n @checklists = Checklist.get_checklist_entries(current_user).get_pending_tasks.paginate(page: params[:page])\n end",
"def index\n set_tasks\n if @role === 'admin'\n @tasks = Task.all\n end\n if @role === 'merchant'\n @tasks = Task.where(merchant: spree_current_user.merchant_id)\n end\n end",
"def registered_tasks\n # Get the task folder that contains the tasks.\n taskCollection = root_folder.GetTasks(0)\n array = []\n taskCollection.each do |registeredTask|\n array.push(registeredTask)\n end\n array\n end",
"def active_tasks(tasks)\n tasks.select { |task| task.completed_at.nil? }\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end",
"def list_tasks\n #begin\n #byebug\n @params=search_params[:search]\n #byebug\n if @params\n if !@params[:user].empty?\n query = iterate_add_tasks(User.where('handle LIKE ?', \"%#{@params[:user]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:client].empty?\n query = iterate_add_tasks(Client.where('name LIKE ?', \"%#{@params[:client]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:project].empty?\n query = iterate_add_tasks(Project.where('name LIKE ?', \"%#{@params[:project]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:activity].empty?\n query = iterate_add_tasks(Activity.where('name LIKE ?', \"%#{@params[:activity]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n \n if !@params[:date].empty?\n @start=Date.parse(@params[:date]).beginning_of_month\n @end=Date.parse(@params[:date]).end_of_month \n query = Task.where(date: @start..@end)\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n\n if @tasks\n #byebug\n @tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}\n @tasks=@tasks.reverse\n end\n \n flash[:notice]=nil\n \n all=true\n @params.each do |p|\n #byebug\n if !p[1].empty?\n all=false\n end\n end\n \n if all\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n else\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n #rescue\n #@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n #flash[:notice]='Listing the latest 20 tasks'\n #end\n @hours=total_hours(@tasks)\n respond_to do |format|\n format.html\n format.csv {send_data tasks_to_csv(@tasks)}\n end\n end",
"def tasks\n @tasks ||= Evoke.tasks\n end",
"def tasks\n if @tasks.nil?\n @tasks ||= (filtering_by_tags? ? tasks_by_tags : tasks_by_filters)\n @tasks = filter_by_properties(@tasks)\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def tasks(tasklist_id = '@default')\n get gtasks_tasks_url(tasklist_id)\n end",
"def index\n authenticate_user!\n @tasks = current_user.tasks\n end",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def tasks\n EarLogger.instance.log \"Getting tasks for #{self}\"\n TaskManager.instance.get_tasks_for(self)\n end",
"def index\n\t if current_user.has_role? :admin\n\t\t @tasks = Task.all\n\t elsif current_user.has_role? :ing\n\t\t @user = User.find(current_user)\n\t\t @tasks = @user.tasks\n\t end\n end",
"def registered_lists\n List.registered(id)\n end",
"def index\n @tasks = Task.where(isArchived: false)\n @task = Task.new\n @lists = List.all\n end",
"def tasks\n Task.undone_for_user(goddamn_tfpid)\n end",
"def index\n @task_managers = TaskManager.all\n end",
"def set_task_list\n @task_list = Task::List.find(params[:id])\n end",
"def tasks\n @tasks ||= {}\n end",
"def index\n @tasks = @list.tasks.where(\"type = ?\",\"TaskTemp\").where.not(\"estado = ?\",\"expirada\").order(:prioridad)\n end",
"def find_tasks\n\t Roby::Queries::Query.new(self)\n\tend",
"def index\n @task_lists = @project.task_lists.all\n\n respond_with @task_lists\n end",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def index\n @tasks = Task.order(created_at: :desc).limit(50)\n\n @last_fs_import = Task.where(service: Service::LOCAL_STORAGE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ht_check = Task.where(service: Service::HATHITRUST).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ia_check = Task.where(service: Service::INTERNET_ARCHIVE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_gb_check = Task.where(service: Service::GOOGLE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n\n render partial: 'tasks' if request.xhr?\n end",
"def get_tasks_for_organisation(_organisation)\n Task.all\n end",
"def index\n if Task::TASK_STATES.include?(params[:state]) then\n @tasks = @tasklist.tasks.where(:tstate => params[:state])\n else\n @tasks = @tasklist.tasks\n render action: \"index\", :notice => \"Wrong state. All tasks are listed.\"\n end\n end",
"def index\n @personal_tasks = PersonalTask.all_personal_tasks(session[:userid])\n @complete = PersonalTask.all_complete_personal_tasks(session[:userid])\n @incomplete = PersonalTask.all_incomplete_personal_tasks(session[:userid])\n end",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def index\n @tasks = @list.tasks.order(status: :asc)\n return render_success_task_index\n end",
"def completed_tasks\n self.tasks.where('is_completed =?', is_completed = true)\n end",
"def index\n @tasks = current_user.tasks.find(:all, :order => 'updated_at DESC')\n @shared_tasks = current_user.shared_tasks.find(:all, :order => 'updated_at DESC', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def show\n @tasks = current_user.assigned_and_written_tasks.pending.paginate(page: params[:page], per_page: 10)\n @fin_tasks = current_user.watching_tasks.completed.paginate(page: params[:page], per_page: 10) unless params[:page]\n end",
"def inactive_tasks\n @tasks.select { | task | ! task.active }\n end",
"def index\n \n if params[:task].present?\n if params[:task][:status].present? || params[:task][:search].present? || params[:task][:label_name]\n if params[:task][:status].present? && params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:status].present?\n @tasks = current_user.tasks.statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).page(params[:page]).per(10)\n elsif params[:task][:label_name].present?\n @searching_task_id = Combination.where(label_id: params[:task][:label_name].to_i).pluck(:task_id)\n @tasks = Task.where(id: @searching_task_id).page(params[:page]).per(10)\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n end",
"def determine_visible_tasks\n [root_task] + determine_visible_subtasks(root_task)\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end",
"def index\n @tasks = Task.where(user_id: current_user.id)\n end",
"def load_tasks\n end",
"def tasks\n Easybill::Api::Tasks\n end",
"def getSubtasks\r\n\t\t\t\t\treturn @tasks\r\n\t\t\t\tend",
"def find_all(client, assignee: nil, workspace: nil, project: nil, section: nil, tag: nil, user_task_list: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})\n params = { assignee: assignee, workspace: workspace, project: project, section: section, tag: tag, user_task_list: user_task_list, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks\", params: params, options: options)), type: self, client: client)\n end"
] |
[
"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.6643457",
"0.66391987",
"0.66233486",
"0.66195774",
"0.66103643",
"0.660745",
"0.6574705",
"0.6542821",
"0.6535431",
"0.6508903",
"0.65054786",
"0.6503617",
"0.6503617",
"0.6503617",
"0.649279",
"0.6476929",
"0.6450189",
"0.644568",
"0.64425015",
"0.6434917",
"0.64141107",
"0.64025456",
"0.6401379",
"0.6401379",
"0.6398321",
"0.6389491",
"0.6368491",
"0.63583976",
"0.6329778",
"0.6321644",
"0.6296781",
"0.6292522",
"0.62817",
"0.6268844",
"0.6267704",
"0.6266653",
"0.62643665",
"0.6261875",
"0.62509936",
"0.62209594",
"0.62108904",
"0.61874694",
"0.6182223",
"0.61723536",
"0.61644757",
"0.6161911",
"0.61564213",
"0.6149414",
"0.61437804",
"0.613808",
"0.6126616",
"0.6111738",
"0.6111081",
"0.6109858",
"0.6093895",
"0.60826004",
"0.60782325",
"0.6070697",
"0.60704076",
"0.606055",
"0.6052319",
"0.6051802",
"0.60392994",
"0.60286456",
"0.60243994",
"0.6023132",
"0.6013365",
"0.60028094",
"0.5996398",
"0.59932363",
"0.59748656",
"0.5974111",
"0.5974111",
"0.5974111",
"0.59634584",
"0.5961636",
"0.5961624",
"0.59602773",
"0.5957165",
"0.5956786"
] |
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@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"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 fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"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 tasks_for(list)\n\t\t@tasks[list] ||= fetch_latest_tasks_for(list)\n\tend",
"def tasklists\n get gtasks_tasklists_url\n end",
"def get_latest_task_info\n today = Time.now.beginning_of_day.utc.to_s(:Y_m_d)\n owner_id = get_brew_user_id\n brew_command_parse_response(%{call \"listTasks\" --python '{\"createdAfter\":\"#{today}\", \"owner\":#{owner_id}, \"method\":\"buildArch\"}'}).\n # Sort by id desc.\n sort_by{ |t| -t['id'] }.\n # Get the newest one.\n first\n end",
"def tasks\n task_list.tasks\n end",
"def task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def final_completed_tasks\n self.tasks.order(\"created_at DESC\").group_by {|t| t.id }.map { |k, v| v.first }\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def get_sorted_list_of_tasks\r\n tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :active_task => true})\r\n unstarted_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :started_at => nil}).sort_by {|t| t.created_at}\r\n finished_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => true}).sort_by {|t| t.created_at}\r\n\r\n tasks.concat(unstarted_tasks).concat(finished_tasks)\r\n return tasks\r\n end",
"def outdated_list(sort_order: { created_at: :desc })\n outdated.order(sort_order)\n end",
"def list(m, target)\n target.gsub!(/^\\s+/,\"\") #remove leading whitespace\n results = []\n read(:tasks).each do |record|\n unless target.empty?\n target_regex = /#{target}/\n if record[\"tag\"] =~ target_regex || record[\"creator\"] =~ target_regex\n results << record\n end\n end\n end\n m.reply \"==== found #{results.length} results. ====\"\n # sort by last bumped\n sorted = results.sort do |x,y| \n xd = DateTime.iso8601(x[\"bumped\"]) \n yd = DateTime.iso8601(y[\"bumped\"]) \n yd <=> xd\n end\n sorted.each_with_index do |r, ind|\n m.reply \"!#{r[\"id\"]} ##{r[\"tag\"]} '#{r[\"text\"]}'; created by #{r[\"creator\"]}\"\n end\n m.reply \"==== **** ====\"\n end",
"def get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end",
"def index\n @tasks = Task.order(\"date DESC\").limit(30)\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"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 request = prepare_request(Net::HTTP::Get.new \"#{@path}/ajax/lists/id/#{list}\")\n response = @http.request request\n result = []\n\n Nokogiri::HTML(JSON.parse(response.body)[\"data\"]).css(\"li.more\").each do |html_task|\n task = Wunderlist::Task.new\n task.id = html_task.attributes[\"id\"].value.to_i\n task.name = html_task.css(\"span.description\").first.content\n task.important = html_task.css(\"span.fav\").empty? ? false : true\n task.done = html_task.attributes[\"class\"].value.split(\" \").include?(\"done\")\n html_timestamp = html_task.css(\"span.timestamp\")\n task.date = Time.at(html_timestamp.first.attributes[\"rel\"].\n value.to_i).to_date unless html_timestamp.empty?\n task.note = html_task.css('span.note').first.content\n task.api = self\n task.list = list_obj\n\n result << task\n end\n\n result\n end",
"def index\n @tasks = current_user.tasks.order('updated_at DESC')\n end",
"def list_all_tasks\n task = Task.all\nend",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def tasks_info\n all_tasks = Set.new\n all_job_info = {}\n history.each_key do |cycle_index|\n tasks, job_info = tasks_info_of_snapshot(cycle_index)\n all_tasks.merge(tasks)\n all_job_info.merge!(job_info)\n end\n [all_tasks, all_job_info]\n end",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def pull_tasks_harvest\n harvest_uri = URI(\"https://api.harvestapp.com/v2/task_assignments?updated_since=#{last_updated_time}\")\n\n Net::HTTP.start(harvest_uri.host, harvest_uri.port, use_ssl: true) do |http|\n harvest_request = Net::HTTP::Get.new harvest_uri\n\n harvest_request[\"Authorization\"] = \"Bearer #{harvest_access_token}\"\n harvest_request[\"Harvest-Account-ID\"] = harvest_account_id\n harvest_request[\"User-Agent\"] = harvest_user_agent\n \n harvest_response = http.request harvest_request\n json_response = JSON.parse(harvest_response.body)\n return json_response[\"task_assignments\"]\n end\n\n end",
"def get_recently_updated_datasets(base_url)\n return handle_request(URI.encode(base_url + '/revision_list'))\n end",
"def index\n @task_lists = TaskList.all\n end",
"def index\n @task_lists = Task::List.all.active\n end",
"def index\n @tasks = Task.all.order( 'starttime DESC' )\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def task_list_items\n result[:task_list_items] ||= []\n end",
"def list_tasks\n #begin\n #byebug\n @params=search_params[:search]\n #byebug\n if @params\n if !@params[:user].empty?\n query = iterate_add_tasks(User.where('handle LIKE ?', \"%#{@params[:user]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:client].empty?\n query = iterate_add_tasks(Client.where('name LIKE ?', \"%#{@params[:client]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:project].empty?\n query = iterate_add_tasks(Project.where('name LIKE ?', \"%#{@params[:project]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:activity].empty?\n query = iterate_add_tasks(Activity.where('name LIKE ?', \"%#{@params[:activity]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n \n if !@params[:date].empty?\n @start=Date.parse(@params[:date]).beginning_of_month\n @end=Date.parse(@params[:date]).end_of_month \n query = Task.where(date: @start..@end)\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n\n if @tasks\n #byebug\n @tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}\n @tasks=@tasks.reverse\n end\n \n flash[:notice]=nil\n \n all=true\n @params.each do |p|\n #byebug\n if !p[1].empty?\n all=false\n end\n end\n \n if all\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n else\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n #rescue\n #@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n #flash[:notice]='Listing the latest 20 tasks'\n #end\n @hours=total_hours(@tasks)\n respond_to do |format|\n format.html\n format.csv {send_data tasks_to_csv(@tasks)}\n end\n end",
"def index\n @tasks = Task.order(created_at: :desc).limit(50)\n\n @last_fs_import = Task.where(service: Service::LOCAL_STORAGE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ht_check = Task.where(service: Service::HATHITRUST).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ia_check = Task.where(service: Service::INTERNET_ARCHIVE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_gb_check = Task.where(service: Service::GOOGLE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n\n render partial: 'tasks' if request.xhr?\n end",
"def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end",
"def task_list\n get_or_make_reference('TaskList', @data, 'task_list_id')\n end",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def fetch_latest_from_queue(user)\n redis_activity = $redis.lrange(redis_key_for_user(user), 0, KEEP_ACTIVITY_ITEMS - 1)\n\n preload_tour_ids = []\n\n redis_activity.map do |activity_json|\n activity_json = JSON.parse(activity_json)\n preload_tour_ids << activity_json['t_id']\n end\n\n preload_tour_ids = preload_tour_ids.compact.map(&:to_i).uniq\n tours = Tour.active.where(id: preload_tour_ids).order('updated_at desc') if preload_tour_ids\n tours\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def index\n @tasklists = Tasklist.all\n end",
"def task_list\n self.tasks.map do |task|\n task.text\n end\n end",
"def find_all(client, assignee: nil, workspace: nil, project: nil, section: nil, tag: nil, user_task_list: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})\n params = { assignee: assignee, workspace: workspace, project: project, section: section, tag: tag, user_task_list: user_task_list, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def latest_entries\n unless @latest_entries\n @latest_entries = Rails.cache.fetch([@account.cache_key, '/latest_entries'], :expires_in => 10.minutes) do\n Entry.paginate(:all, :from => \"/accounts/#{@account.account_resource_id.to_s}/entries.xml\", :params => { :page => 1, :per_page => 5}) \n end\n end\n @latest_entries\n end",
"def tasks_data_today \n tasks_of_today = self.tasks_due_today\n tasks = []\n tasks_of_today.each do |task|\n task = {\n task_name: task.name, \n completion_value: task.completions.last.completion_value,\n completion_max: task.completion_max,\n completion_unit: task.completion_unit\n }\n tasks << task \n end\n tasks \n end",
"def all\n return @tasks\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def all_tasks\n self.stories.collect { |s| s.tasks }.flatten\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def tasks\n @tasks.values.sort_by { |t| t.name }\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def listings\n Zoopla::CachedListings.new.search(self).sort_by(&:updated_at).reverse!\n end",
"def tasks_uncompleted\n tasks_uncompleted = assigned_tasks.uncompleted.order(\"deadline DESC\")\n tasks_uncompleted += executed_tasks.uncompleted.order(\"deadline DESC\")\n tasks_uncompleted.sort_by { |h| h[:deadline] }.reverse!\n end",
"def index\n @tasks = Task.includes(:user).order(created_at: :desc).all\n render json: @tasks, each_serializer: TasksSerializer\n end",
"def incomplete_tasks\n sublist { |task| task.incomplete? }.sort_by { |task| task.created_at }\n end",
"def latest_specs\n collect_specs_via(:latest_specs)\n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def fetch_missing\n all_tasks = SlimtimerTask.all\n missing_ids = TimeEntry.all(\n :slimtimer_task_id.not => all_tasks.map(&:id)\n ).map(&:slimtimer_task_id).uniq\n\n log.info \"Trying to get info on #{missing_ids.length} missing tasks\" if missing_ids.length > 0\n missing_ids.each do |task_id|\n task = handle_timeouts(MAX_CONSECUTIVE_TIMEOUTS, \"Loading specific task : #{task_id}\") do\n @st_api.find_task task_id\n end\n\n if task\n SlimtimerTask.update [task]\n else\n log.warn \"Unable to find task id : #{task_id}. Creating an artificial one...\"\n SlimtimerTask.update([\n 'id' => task_id,\n 'name' => \"Missing (#{task_id})\",\n 'hours' => 0,\n 'completed' => false\n ])\n end\n end\n end",
"def complete_tasks\n sublist { |task| task.complete? }.sort_by { |task| task.completed_at }\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def recent\n result = http_get(\"/services/data/v#{self.version}/recent\")\n collection_from(result.body)\n end",
"def index\n @url_queues = UrlQueue.all.order(updated_at: :desc)\n end",
"def tasks\n Task.undone_for_user(goddamn_tfpid)\n end",
"def get_all_completed_items(params = {})\n if params[\"until\"]\n params[\"until\"] = ParseHelper.format_time(params[\"until\"])\n end\n if params[\"since\"]\n params[\"since\"] = ParseHelper.format_time(params[\"since\"])\n end\n \n result = @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_ALL_COMMAND, params)\n items = ParseHelper.make_objects_as_array(result[\"items\"])\n projects = ParseHelper.make_objects_as_array(result[\"projects\"])\n return {\"items\" => items, \"projects\" => projects}\n end",
"def latest\n @loops = Loop.latest\n render 'list'\n end",
"def index\n @tasks = current_user.tasks.find(:all, :order => 'updated_at DESC')\n @shared_tasks = current_user.shared_tasks.find(:all, :order => 'updated_at DESC', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def load_newest\n ids = @api.fetch_new_story_ids\n load_by_ids ids\n end",
"def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end",
"def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end",
"def next_tasks\n find(:all, :order => \"execute_at asc\")\n end",
"def complete_tasks\n # Give me all the tasks such that the task is complete\n # results = @tasks.select { |task| task.complete? }\n # results.sort_by { |task| task.completed_at }\n #\n # We can combine this into a single line\n \n @tasks.select { |task| task.complete? }.sort_by { |task| task.completed_at }\n end",
"def query_long_running_tasks\n Kernel.sleep(0.01)\n target_tasks = []\n 100.times.each do\n target_tasks = @tasks.get[\"nodes\"]\n .map { |k, v| v[\"tasks\"] }\n .flatten.map { |ts| ts.select { |k, v| /bulk/ =~ v[\"action\"] } }\n .flatten.reject { |t| t.empty? }\n break if target_tasks.size > 0\n end\n\n target_tasks\nend",
"def index\n @api_tasks = Api::Task.all\n end",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end",
"def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end",
"def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end",
"def index\n @tasks = Task.where(isArchived: false)\n @task = Task.new\n @lists = List.all\n end",
"def last_20_jobs(project_id)\n api(\"projects/#{project_id}/jobs\").sort_by { |j| -j['id'] }\nend",
"def tasks_for_timeline\n tasks.where(status: Constants.TASK_STATUSES.completed).order(\"completed_at DESC\")\n .reject { |t| t.assigned_to.is_a?(Organization) && t.children.pluck(:assigned_to_type).include?(User.name) }\n end",
"def tasks\n return @tasks.values\n end",
"def public\n @polls = Poll.opened.order(id: :desc)\n end",
"def fetch_changelogs\n @changelogs = @spkg.changelogs\n .includes(:maintainer)\n .order(at: :desc, evr: :desc, created_at: :desc)\n end",
"def list_all_tasks\n #instance of View\n tasks = @repository.all # Array of tasks\n @view.display_all_tasks(tasks) #View to display all the tasks\n end",
"def fetch_latest(params)\n wines = []\n offset = 0\n limit = 5000\n params_with_defaults = { limit: limit }.merge(params)\n response = auth_then.get(BASE_URL, params: params_with_defaults)\n count = response.parse[\"count\"]\n\n while offset < count\n if response.code == 200\n response.parse[\"results\"].each do |result|\n wines << result\n end\n else\n []\n end\n response = auth_then.get(response.parse[\"next\"]) if response.parse[\"next\"] != nil\n offset += 5000\n end\n wines\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def fetch\n @jobs = fetch_rss(url, Sources::STACKOVERFLOW)\n end",
"def getTasks(response)\r\n\t\t\t\ttasks_all_json = JSON.parse response\r\n\t\t\t\ttasks_all_array = tasks_all_json[\"tasks\"]\r\n\t\t\t\ttasks_class_array = Array.new\r\n\t\t\t\tfor i in 0...tasks_all_array.length\r\n\t\t\t\t\ttasks_class_array.push(jsonToTask(tasks_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn tasks_class_array\r\n\t\t\tend",
"def update_internal_task_lists\n\n # Security - discard tasks the user should not be able to see.\n\n if ( @current_user.restricted? )\n @tasks.select do | task |\n task.is_permitted_for?( @current_user )\n end\n end\n\n # Now the fiddly bit! Sort the task objects by augmented title, then\n # retrospectively rebuild the task ID arrays using the reordered list.\n\n Task.sort_by_augmented_title( @tasks )\n\n @task_ids = []\n @active_task_ids = []\n @inactive_task_ids = []\n\n @tasks.each do | task |\n @task_ids << task.id\n @active_task_ids << task.id if ( task.active )\n @inactive_task_ids << task.id unless ( task.active )\n end\n end",
"def getAssignedTasks\n\tassignedTasks = CrawlerTask.where(:carrier => $worker_name, :status => 0)\nend",
"def get_tasks_for_organisation(_organisation)\n Task.all\n end",
"def fetch_entries\n logger.info \"#{SERVICE_NAME}: Fetching the most recent videos by #{self.vimeo_login}\"\n videos = []\n doc = Hpricot.XML(open(\"http://vimeo.com/#{self.vimeo_login}/videos/rss\"))\n (doc/'item').each do |item|\n videos << parse_entry(item)\n end\n\n logger.info \"#{SERVICE_NAME}: Fetching the most recent favorite videos of #{self.vimeo_login}\"\n likes = []\n doc = Hpricot.XML(open(\"http://vimeo.com/#{self.vimeo_login}/likes/rss\"))\n (doc/'item').each do |item|\n likes << parse_entry(item)\n end\n\n return videos.reject { |e| e.nil? }, likes.reject { |e| e.nil? }\n rescue Timeout::Error => tme\n logger.warn \"#{SERVICE_NAME}: Error fetching posts (timeout error): #{tme}\"\n []\n rescue => e\n logger.warn \"#{SERVICE_NAME}: Error fetching posts: #{e}\"\n []\n end",
"def sync_tasks\n\n #TODO make this line optional\n @account_info = @authenticator.get_account\n\n #Add any tasks that needed to be added\n new_tasks = @tasks.keys.select{|task| task.brand_new?}\n @authenticator.add_tasks(new_tasks.collect {|task| task.json_parsed}) unless @new_tasks.new_tasks.empty?\n\n #Record that the tasks have already been added\n new_tasks.each {|task| task.no_longer_new}\n\n #Delete any tasks that were marked as deleted locally but not yet removed from @tasks\n deleted_tasks = @tasks.keys.select{|task| task.deleted?}\n @authenticator.delete_tasks(deleted_tasks.collect {|task| task.id}) unless deleted_tasks.empty?\n \n if lastedit_task > @last_task_sync\n #Get (recently edited) tasks\n tasks = @authenticator.get_tasks {:after => lastedit_task}\n \n locally_edited = []\n\n #TODO we may need to put this in a loop and load tasks page by page\n tasks.each do |task|\n if not @tasks[task.id]\n #If for some reason the task doesn't exist yet locally, add it\n @tasks[task.id] = task\n else\n #Compare modification times, update local copy when necessary, and resolve editing conflicts\n #Do NOT use task.last_mod, because that will just refer to the time that the get_tasks function was called!\n #Instead, we care about the time that the last edits were actually saved on the Toodledo server\n if task.modified > @tasks[task.id].last_mod\n #The server-stored task was modified more recently than the local task\n #TODO make sure all other locations are properly mutating the task, rather than creating parallel/outdated instances\n #If we simply overwrote the task instead of updating task.json_parsed, any past references to the task would point to an invalid/outdated\n @tasks[task.id].json_parsed = task.json_parsed\n @tasks[task.id].edit_saved\n else\n #The local task was modified more recently than the server-stored task\n #Realistically, the two timestamps cannot be the same, but if they are, we will assume the local copy is more accurate\n locally_edited.push(@tasks[task.id])\n end\n end\n end\n end\n\n if lastdelete_task > @last_task_sync\n #Query the deleted tasks (on the Toodledo server) and delete them here locally\n @user.get_deleted_tasks.collect{|task| task.id}.each do |id| \n #The delete boolean will be set just in case there are other references to the task, in which case it would not be garbage-collected\n @tasks[id].delete!\n @tasks[id].edit_saved #Make sure it won't be edited-saved in the future\n @tasks.delete(id)\n end\n end\n\n locally_edited = locally_edited.select{|task| not task.deleted?}\n @user.edit_tasks(locally_edited.collect{|task| task.json_parsed}) unless locally_edited.empty?\n \n #After this, the modified timestamp on the server will be the current time, which is later than the task.last_mod for any task stored locally\n \n #TODO check if there were repeating tasks that needed to be rescheduled\n \n #Remove any deleted tasks from @tasks. There may still be references elsewhere to them (depending on the application), so they may not necessarily be garbage-collected\n @tasks = @tasks.select{|task| not task.deleted?}\n\n @last_task_sync = Time.now\n end",
"def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end"
] |
[
"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.6119495",
"0.6085204",
"0.60835725",
"0.6071778",
"0.60288024",
"0.6024482",
"0.6009417",
"0.6005087",
"0.5952201",
"0.5947422",
"0.5933608",
"0.5914372",
"0.58998984",
"0.588275",
"0.5870352",
"0.5861147",
"0.5859195",
"0.5857277",
"0.585108",
"0.5848654",
"0.5848376",
"0.58472776",
"0.5832246",
"0.582992",
"0.582456",
"0.5824393",
"0.58234364",
"0.5822206",
"0.58151126",
"0.58145183",
"0.5814433",
"0.5796476",
"0.57911855",
"0.5790617",
"0.57871526",
"0.5785521",
"0.5764133",
"0.57629",
"0.57552886",
"0.5750839",
"0.57492363",
"0.5732471",
"0.57304025",
"0.5723081",
"0.57203096",
"0.5712404",
"0.5702936",
"0.5701437",
"0.56983393",
"0.56930894",
"0.5688974",
"0.5688158",
"0.5680401",
"0.5680085",
"0.566542",
"0.56644756",
"0.56579196",
"0.565574",
"0.56418085",
"0.5639185",
"0.5639185",
"0.5632309",
"0.56227314",
"0.56214356",
"0.56118643",
"0.5602928",
"0.558741",
"0.55870926",
"0.55861485",
"0.55844694",
"0.55677766",
"0.5559568",
"0.5550909",
"0.5549449",
"0.5544856",
"0.55441743",
"0.55426294",
"0.55409634",
"0.5533993",
"0.55331105"
] |
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 request = prepare_request(Net::HTTP::Get.new \"#{@path}/ajax/lists/id/#{list}\")\n response = @http.request request\n result = []\n\n Nokogiri::HTML(JSON.parse(response.body)[\"data\"]).css(\"li.more\").each do |html_task|\n task = Wunderlist::Task.new\n task.id = html_task.attributes[\"id\"].value.to_i\n task.name = html_task.css(\"span.description\").first.content\n task.important = html_task.css(\"span.fav\").empty? ? false : true\n task.done = html_task.attributes[\"class\"].value.split(\" \").include?(\"done\")\n html_timestamp = html_task.css(\"span.timestamp\")\n task.date = Time.at(html_timestamp.first.attributes[\"rel\"].\n value.to_i).to_date unless html_timestamp.empty?\n task.note = html_task.css('span.note').first.content\n task.api = self\n task.list = list_obj\n\n result << task\n end\n\n result\n end",
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"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 task_list\n get_or_make_reference('TaskList', @data, 'task_list_id')\n end",
"def tasks\n task_list.tasks\n end",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"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 get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def tasklists\n get gtasks_tasklists_url\n end",
"def task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def task_list_items\n result[:task_list_items] ||= []\n end",
"def find_by_user_task_list(client, user_task_list: required(\"user_task_list\"), completed_since: nil, per_page: 20, options: {})\n params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/user_task_lists/#{user_task_list}/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"def task_list\n self.tasks.map do |task|\n task.text\n end\n end",
"def index\n @task_lists = Task::List.all.active\n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def where(options = {})\n _, _, root = @client.get(\"/tasks\", options)\n\n root[:items].map{ |item| Task.new(item[:data]) }\n end",
"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@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"def task_names \n\t\t\tHelpers::DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(\n\t\t\t:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number, \n\t\t\t:Tasks__Name, :Tasks__Completed, :Tasks__Priority).filter(:Lists__Name => Config[:working_list_name])\n\t\tend",
"def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end",
"def index\n @task_lists = TaskList.all\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def set_task_list\n @task_list = Task::List.find(params[:id])\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def scrape_tasks(url)\n tasks = []\n doc = Nokogiri::HTML(open(url))\n doc.css(\"li.task_event\").each do |node|\n task = scrape_task(node)\n\n tasks << task unless task.empty? or task.nil?\n end\n\n return tasks\nend",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end",
"def list_all_tasks\n task = Task.all\nend",
"def sublist(&block)\n @tasks.select(&block)\n end",
"def index\n @tasklists = Tasklist.all\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def list_tasks\n config = instantiate_configuration\n config.load 'deploy'\n \n set_up_config(config)\n \n config.task_list(:all)\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def tasks(tasklist_id = '@default')\n get gtasks_tasks_url(tasklist_id)\n end",
"def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end",
"def tasks(completed_since: nil, per_page: 20, options: {})\n params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/user_task_lists/#{gid}/tasks\", params: params, options: options)), type: Task, client: client)\n end",
"def find_all(client, assignee: nil, workspace: nil, project: nil, section: nil, tag: nil, user_task_list: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})\n params = { assignee: assignee, workspace: workspace, project: project, section: section, tag: tag, user_task_list: user_task_list, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def tasks\n if @tasks.nil?\n @tasks ||= (filtering_by_tags? ? tasks_by_tags : tasks_by_filters)\n @tasks = filter_by_properties(@tasks)\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def getTasklist\r\n\t\t\t\t\treturn @tasklist\r\n\t\t\t\tend",
"def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end",
"def index\n @tasks = @list.tasks.where(\"type = ?\",\"TaskTemp\").where.not(\"estado = ?\",\"expirada\").order(:prioridad)\n end",
"def getAssignedTasks\n\tassignedTasks = CrawlerTask.where(:carrier => $worker_name, :status => 0)\nend",
"def index\n @tasks = @list.tasks.order(status: :asc)\n return render_success_task_index\n end",
"def set_task_list\n @task_list = TaskList.find(params[:id])\n end",
"def list_tasks\n #begin\n #byebug\n @params=search_params[:search]\n #byebug\n if @params\n if !@params[:user].empty?\n query = iterate_add_tasks(User.where('handle LIKE ?', \"%#{@params[:user]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:client].empty?\n query = iterate_add_tasks(Client.where('name LIKE ?', \"%#{@params[:client]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:project].empty?\n query = iterate_add_tasks(Project.where('name LIKE ?', \"%#{@params[:project]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:activity].empty?\n query = iterate_add_tasks(Activity.where('name LIKE ?', \"%#{@params[:activity]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n \n if !@params[:date].empty?\n @start=Date.parse(@params[:date]).beginning_of_month\n @end=Date.parse(@params[:date]).end_of_month \n query = Task.where(date: @start..@end)\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n\n if @tasks\n #byebug\n @tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}\n @tasks=@tasks.reverse\n end\n \n flash[:notice]=nil\n \n all=true\n @params.each do |p|\n #byebug\n if !p[1].empty?\n all=false\n end\n end\n \n if all\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n else\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n #rescue\n #@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n #flash[:notice]='Listing the latest 20 tasks'\n #end\n @hours=total_hours(@tasks)\n respond_to do |format|\n format.html\n format.csv {send_data tasks_to_csv(@tasks)}\n end\n end",
"def tasks\n Task.undone_for_user(goddamn_tfpid)\n end",
"def all\n return @tasks\n end",
"def getTasks(response)\r\n\t\t\t\ttasks_all_json = JSON.parse response\r\n\t\t\t\ttasks_all_array = tasks_all_json[\"tasks\"]\r\n\t\t\t\ttasks_class_array = Array.new\r\n\t\t\t\tfor i in 0...tasks_all_array.length\r\n\t\t\t\t\ttasks_class_array.push(jsonToTask(tasks_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn tasks_class_array\r\n\t\t\tend",
"def find_task_by_status(status)\n ids = user_tasks.where(status: status).pluck(:task_id).uniq\n Task.find([ids]).all || nil\n end",
"def tasks_list\n (self.tasks || EMPTY_STRING).scan(/\\d+/).map{|x| x.to_i}.sort.uniq\n end",
"def index\n @task_lists = @user.task_lists\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def get_tasks__simple\n request = NSFetchRequest.alloc.init\n request.entity = NSEntityDescription\\\n .entityForName('Task',\n inManagedObjectContext: @context)\n\n error_ptr = Pointer.new(:object)\n\n data = @context.executeFetchRequest(request, error: error_ptr)\n\n if data == nil\n raise \"[ERROR] Error fetching tasks: #{error_ptr[0].description}\"\n end\n\n data\n end",
"def index\n \n if params[:task].present?\n if params[:task][:status].present? || params[:task][:search].present? || params[:task][:label_name]\n if params[:task][:status].present? && params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:status].present?\n @tasks = current_user.tasks.statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).page(params[:page]).per(10)\n elsif params[:task][:label_name].present?\n @searching_task_id = Combination.where(label_id: params[:task][:label_name].to_i).pluck(:task_id)\n @tasks = Task.where(id: @searching_task_id).page(params[:page]).per(10)\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n end",
"def tasks_for_definition(task_def)\n tasks.where(task_definition_id: task_def.id)\n end",
"def get_incomplete\n @task_list.select { |task| task.status == \"incomplete\" }\n end",
"def tasks_get(opts = {})\n data, _status_code, _headers = tasks_get_with_http_info(opts)\n data\n end",
"def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def tasks order = nil\n connection.tasks(id, order)\n end",
"def get_sorted_list_of_tasks\r\n tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :active_task => true})\r\n unstarted_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :started_at => nil}).sort_by {|t| t.created_at}\r\n finished_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => true}).sort_by {|t| t.created_at}\r\n\r\n tasks.concat(unstarted_tasks).concat(finished_tasks)\r\n return tasks\r\n end",
"def tasks(project_id, story_id, options = {})\n get(\"projects/#{project_id}/stories/#{story_id}/tasks\", options).tasks\n end",
"def load_special_tasks\n $bot[:tasks][:list] = {\n block: -> do\n list_tasks\n end,\n desc: 'List all available tasks'\n }\n end",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def task_get(task_name)\n tasks.fetch prepare_key(task_name), nil\n end",
"def show\n @task_list = TaskList.find(params[:id])\n add_breadcrumb I18n.t(\"tasklist.breadcrumbs.show\"), project_task_list_path\n\n respond_with @task_lists\n end",
"def index\n @tasks = Task.order(created_at: :desc).limit(50)\n\n @last_fs_import = Task.where(service: Service::LOCAL_STORAGE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ht_check = Task.where(service: Service::HATHITRUST).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ia_check = Task.where(service: Service::INTERNET_ARCHIVE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_gb_check = Task.where(service: Service::GOOGLE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n\n render partial: 'tasks' if request.xhr?\n end",
"def query_long_running_tasks\n Kernel.sleep(0.01)\n target_tasks = []\n 100.times.each do\n target_tasks = @tasks.get[\"nodes\"]\n .map { |k, v| v[\"tasks\"] }\n .flatten.map { |ts| ts.select { |k, v| /bulk/ =~ v[\"action\"] } }\n .flatten.reject { |t| t.empty? }\n break if target_tasks.size > 0\n end\n\n target_tasks\nend",
"def getTask(response)\r\n\t\t\t\ttasks_json = JSON.parse response\r\n\t\t\t\ttasks_array = tasks_json[\"tasks\"]\r\n\t\t\t\treturn jsonToTask(tasks_array[0])\r\n\t\t\tend",
"def setupTasksList\n require 'tmpdir'\n lTasksFileName = \"#{Dir.tmpdir}/WEACE_Tasks_#{Thread.current.object_id}.lst\"\n File.open(lTasksFileName, 'w') do |oFile|\n oFile << 'TaskID 1\nTaskID 2\nTaskID 3'\n end\n yield(lTasksFileName)\n File.unlink(lTasksFileName)\n end",
"def resolve_task(name)\n name = name.to_s\n @tasks.each do |task|\n return task if task.name == name\n end\n @salticid.tasks.each do |task|\n return task if task.name == name\n end\n nil\n end",
"def list(m, target)\n target.gsub!(/^\\s+/,\"\") #remove leading whitespace\n results = []\n read(:tasks).each do |record|\n unless target.empty?\n target_regex = /#{target}/\n if record[\"tag\"] =~ target_regex || record[\"creator\"] =~ target_regex\n results << record\n end\n end\n end\n m.reply \"==== found #{results.length} results. ====\"\n # sort by last bumped\n sorted = results.sort do |x,y| \n xd = DateTime.iso8601(x[\"bumped\"]) \n yd = DateTime.iso8601(y[\"bumped\"]) \n yd <=> xd\n end\n sorted.each_with_index do |r, ind|\n m.reply \"!#{r[\"id\"]} ##{r[\"tag\"]} '#{r[\"text\"]}'; created by #{r[\"creator\"]}\"\n end\n m.reply \"==== **** ====\"\n end",
"def index\n @checklists = Checklist.get_checklist_entries(current_user).get_pending_tasks.paginate(page: params[:page])\n end",
"def index\n @tasks = Task.where(isArchived: false)\n @task = Task.new\n @lists = List.all\n end",
"def tasks\n return @tasks.values\n end",
"def show\n @task = @list.tasks.build\n end",
"def list_tasks\r\n unless tasks\r\n puts \"No tasks yet. Add one!\"\r\n return\r\n end\r\n # Pretty-format hash and print\r\n print \" \" + \"ITEM\".ljust(30) + \" | \" +\r\n \"WHEN DUE\".ljust(15) + \" | \" +\r\n \"WHEN ADDED\".ljust(15) + \"\\n\"\r\n tasks.each do |task|\r\n print \"<#{tasks.find_index(task) + 1}>\".ljust(5) +\r\n task[:text].ljust(30) + \" | \" +\r\n task[:due].ljust(15) + \" | \" +\r\n task[:time].ljust(15) + \"\\n\"\r\n end\r\n end",
"def tasks(extra_conditions = nil, limit_tasks = true)\n limit = (limit_tasks ? 500 : nil)\n return user.company.tasks.all(:conditions => conditions(extra_conditions),\n :include => to_include,\n :limit => limit)\n end",
"def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend",
"def active_tasks(tasks)\n tasks.select { |task| task.completed_at.nil? }\n end",
"def set_task\n @task = Task.includes(:todo).find(params[:id])\n @todo = @task.todo\n @list = @todo.list\n end",
"def load_tasks\n end",
"def tasks_complete(list)\n completed = list[:todos].select do |item|\n item[:completed] == true\n end.size\n end",
"def tasks\n @tasks ||= Evoke.tasks\n end",
"def index\n @share_tasks = @list.share_tasks\n end"
] |
[
"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.64072293",
"0.63584715",
"0.6310593",
"0.62961847",
"0.6289898",
"0.62661535",
"0.6255752",
"0.62301034",
"0.6223417",
"0.62224066",
"0.6222358",
"0.62145174",
"0.62143046",
"0.6204482",
"0.61838126",
"0.6176953",
"0.61738175",
"0.61636084",
"0.6157775",
"0.61482227",
"0.61354756",
"0.6124483",
"0.6091745",
"0.6082821",
"0.6081378",
"0.60813046",
"0.6074248",
"0.6074116",
"0.6072443",
"0.60352194",
"0.60223156",
"0.60150903",
"0.6012018",
"0.6010229",
"0.5997292",
"0.5960688",
"0.5943997",
"0.5935195",
"0.59184724",
"0.5894948",
"0.5882691",
"0.5882691",
"0.5882691",
"0.588162",
"0.5872483",
"0.5850975",
"0.58491945",
"0.58479303",
"0.58478886",
"0.5839981",
"0.5834442",
"0.58242166",
"0.5811826",
"0.5803535",
"0.58024174",
"0.58024174",
"0.57905763",
"0.57905763",
"0.57905763",
"0.57899636",
"0.5772589",
"0.5766823",
"0.57636225",
"0.57247514",
"0.5722015",
"0.5721444",
"0.5720646",
"0.57193255",
"0.5698715",
"0.56912464",
"0.5680858",
"0.5677167",
"0.5676923",
"0.5662527",
"0.56599444",
"0.5652582",
"0.5651871",
"0.5648529",
"0.5646398",
"0.56428844"
] |
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] ||= fetch_latest_tasks_for(list)\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@tasks[list] = @client.execute(api_method: @gtasks.tasks.list, parameters: { 'tasklist' => list.id }).data.items\n\t\tend\n\t\treturn @user_info, @task_lists, @tasks\n\tend",
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\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 request = prepare_request(Net::HTTP::Get.new \"#{@path}/ajax/lists/id/#{list}\")\n response = @http.request request\n result = []\n\n Nokogiri::HTML(JSON.parse(response.body)[\"data\"]).css(\"li.more\").each do |html_task|\n task = Wunderlist::Task.new\n task.id = html_task.attributes[\"id\"].value.to_i\n task.name = html_task.css(\"span.description\").first.content\n task.important = html_task.css(\"span.fav\").empty? ? false : true\n task.done = html_task.attributes[\"class\"].value.split(\" \").include?(\"done\")\n html_timestamp = html_task.css(\"span.timestamp\")\n task.date = Time.at(html_timestamp.first.attributes[\"rel\"].\n value.to_i).to_date unless html_timestamp.empty?\n task.note = html_task.css('span.note').first.content\n task.api = self\n task.list = list_obj\n\n result << task\n end\n\n result\n end",
"def get_latest_task_info\n today = Time.now.beginning_of_day.utc.to_s(:Y_m_d)\n owner_id = get_brew_user_id\n brew_command_parse_response(%{call \"listTasks\" --python '{\"createdAfter\":\"#{today}\", \"owner\":#{owner_id}, \"method\":\"buildArch\"}'}).\n # Sort by id desc.\n sort_by{ |t| -t['id'] }.\n # Get the newest one.\n first\n end",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"def final_completed_tasks\n self.tasks.order(\"created_at DESC\").group_by {|t| t.id }.map { |k, v| v.first }\n end",
"def tasks\n task_list.tasks\n end",
"def list(m, target)\n target.gsub!(/^\\s+/,\"\") #remove leading whitespace\n results = []\n read(:tasks).each do |record|\n unless target.empty?\n target_regex = /#{target}/\n if record[\"tag\"] =~ target_regex || record[\"creator\"] =~ target_regex\n results << record\n end\n end\n end\n m.reply \"==== found #{results.length} results. ====\"\n # sort by last bumped\n sorted = results.sort do |x,y| \n xd = DateTime.iso8601(x[\"bumped\"]) \n yd = DateTime.iso8601(y[\"bumped\"]) \n yd <=> xd\n end\n sorted.each_with_index do |r, ind|\n m.reply \"!#{r[\"id\"]} ##{r[\"tag\"]} '#{r[\"text\"]}'; created by #{r[\"creator\"]}\"\n end\n m.reply \"==== **** ====\"\n end",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"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 get_task_list(id)\n response = request(\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::ToHashDocument.new,\n :path => \"tasksList/#{id}\"\n )\n ensure_list! response.body, :Task\n response\n end",
"def task_list\n get_or_make_reference('TaskList', @data, 'task_list_id')\n end",
"def task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def outdated_list(sort_order: { created_at: :desc })\n outdated.order(sort_order)\n end",
"def find_by_user_task_list(client, user_task_list: required(\"user_task_list\"), completed_since: nil, per_page: 20, options: {})\n params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/user_task_lists/#{user_task_list}/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def tasklists\n get gtasks_tasklists_url\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def retrieve_tasks\n Query.get_data(@values[:id], @values[:start_time], @values[:end_time])\n end",
"def get_sorted_list_of_tasks\r\n tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :active_task => true})\r\n unstarted_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :started_at => nil}).sort_by {|t| t.created_at}\r\n finished_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => true}).sort_by {|t| t.created_at}\r\n\r\n tasks.concat(unstarted_tasks).concat(finished_tasks)\r\n return tasks\r\n end",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend",
"def index\n @tasks = current_user.tasks.order('updated_at DESC')\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"def fetch_latest_from_queue(user)\n redis_activity = $redis.lrange(redis_key_for_user(user), 0, KEEP_ACTIVITY_ITEMS - 1)\n\n preload_tour_ids = []\n\n redis_activity.map do |activity_json|\n activity_json = JSON.parse(activity_json)\n preload_tour_ids << activity_json['t_id']\n end\n\n preload_tour_ids = preload_tour_ids.compact.map(&:to_i).uniq\n tours = Tour.active.where(id: preload_tour_ids).order('updated_at desc') if preload_tour_ids\n tours\n end",
"def next_tasks\n find(:all, :order => \"execute_at asc\")\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def task_list\n self.tasks.map do |task|\n task.text\n end\n end",
"def index\n @tasks = Task.order(\"date DESC\").limit(30)\n end",
"def task_list_items\n result[:task_list_items] ||= []\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end",
"def tasks(completed_since: nil, per_page: 20, options: {})\n params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/user_task_lists/#{gid}/tasks\", params: params, options: options)), type: Task, client: client)\n end",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def complete_tasks\n sublist { |task| task.complete? }.sort_by { |task| task.completed_at }\n end",
"def pull_tasks_harvest\n harvest_uri = URI(\"https://api.harvestapp.com/v2/task_assignments?updated_since=#{last_updated_time}\")\n\n Net::HTTP.start(harvest_uri.host, harvest_uri.port, use_ssl: true) do |http|\n harvest_request = Net::HTTP::Get.new harvest_uri\n\n harvest_request[\"Authorization\"] = \"Bearer #{harvest_access_token}\"\n harvest_request[\"Harvest-Account-ID\"] = harvest_account_id\n harvest_request[\"User-Agent\"] = harvest_user_agent\n \n harvest_response = http.request harvest_request\n json_response = JSON.parse(harvest_response.body)\n return json_response[\"task_assignments\"]\n end\n\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def sublist(&block)\n @tasks.select(&block)\n end",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def completed_tasks_by_date(list,date)\n # helpers.is_today?(date)\n if (Date.today == date)\n if (list.id == self.all_task.id)\n self.completed_tasks.where([\"DATE(completed_at)=?\", date] ).order('completed_at')\n # self.completed_tasks.where([\"DATE(completed_at) BETWEEN ? AND ?\", date - 1.day , date] ).order('completed_at')\n else\n self.completed_tasks.where([\"list_id=? and DATE(completed_at)=?\",list.id, date] ).order('completed_at DESC')\n # self.completed_tasks.where([\"list_id=? and DATE(completed_at) BETWEEN ? AND ?\",list.id, date - 1.day , date] ).order('completed_at DESC')\n end\n\n else\n if (list.id == self.all_task.id)\n self.completed_tasks.where([\"DATE(completed_at) =?\",date] ).order('completed_at DESC')\n # self.completed_tasks.where([\"DATE(completed_at) =?\",date - 1.day] ).order('completed_at DESC')\n else\n self.completed_tasks.where([\"list_id=? and DATE(completed_at) =?\",list.id, date] ).order('completed_at DESC')\n # self.completed_tasks.where([\"list_id=? and DATE(completed_at) =?\",list.id, date - 1.day] ).order('completed_at DESC')\n end\n\n end\n end",
"def index\n @task_lists = Task::List.all.active\n end",
"def index\n @tasks = Task.order(created_at: :desc).limit(50)\n\n @last_fs_import = Task.where(service: Service::LOCAL_STORAGE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ht_check = Task.where(service: Service::HATHITRUST).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_ia_check = Task.where(service: Service::INTERNET_ARCHIVE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n @last_gb_check = Task.where(service: Service::GOOGLE).\n where('completed_at IS NOT NULL').\n order(completed_at: :desc).limit(1).first\n\n render partial: 'tasks' if request.xhr?\n end",
"def list_tasks\n #begin\n #byebug\n @params=search_params[:search]\n #byebug\n if @params\n if !@params[:user].empty?\n query = iterate_add_tasks(User.where('handle LIKE ?', \"%#{@params[:user]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:client].empty?\n query = iterate_add_tasks(Client.where('name LIKE ?', \"%#{@params[:client]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:project].empty?\n query = iterate_add_tasks(Project.where('name LIKE ?', \"%#{@params[:project]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:activity].empty?\n query = iterate_add_tasks(Activity.where('name LIKE ?', \"%#{@params[:activity]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n \n if !@params[:date].empty?\n @start=Date.parse(@params[:date]).beginning_of_month\n @end=Date.parse(@params[:date]).end_of_month \n query = Task.where(date: @start..@end)\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n\n if @tasks\n #byebug\n @tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}\n @tasks=@tasks.reverse\n end\n \n flash[:notice]=nil\n \n all=true\n @params.each do |p|\n #byebug\n if !p[1].empty?\n all=false\n end\n end\n \n if all\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n else\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n #rescue\n #@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n #flash[:notice]='Listing the latest 20 tasks'\n #end\n @hours=total_hours(@tasks)\n respond_to do |format|\n format.html\n format.csv {send_data tasks_to_csv(@tasks)}\n end\n end",
"def tasks_data_today \n tasks_of_today = self.tasks_due_today\n tasks = []\n tasks_of_today.each do |task|\n task = {\n task_name: task.name, \n completion_value: task.completions.last.completion_value,\n completion_max: task.completion_max,\n completion_unit: task.completion_unit\n }\n tasks << task \n end\n tasks \n end",
"def find_all(client, assignee: nil, workspace: nil, project: nil, section: nil, tag: nil, user_task_list: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})\n params = { assignee: assignee, workspace: workspace, project: project, section: section, tag: tag, user_task_list: user_task_list, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def bulk_refresh(list,num=@max_parallel)\n\t\tputs \"Refresh entries in the site store from list:\\n #{list}\" if @verbose\n\t\tresults=Hash.new\n\t\tif list.size > 0\n\t\t\tputs \"Start parallel refreshing on the sites:\\n #{list}\"\n\t\t\tParallel.map(list, :in_processes => num) { |target|\n\t\t\t\trefresh(target)\n\t\t\t}.each do |process|\n\t\t\t\tif process.nil?\n\t\t\t\t\tnext\n\t\t\t\telsif process.empty?\n\t\t\t\t\t#do nothing\n\t\t\t\telse\n\t\t\t\t\tresults[process['url']]=Hash.new\n\t\t\t\t\tresults[process['url']]=process\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Clean up old entries, by Y.L. 03/30/2015\n\t\t\tlist.map {|x| @known_sites.delete(x)}\n\t\t\t# Add back fresh entries\n\t\t\t@known_sites.merge!(results)\n\t\t\tputs \"Done refresh sites.\"\n\t\telse\n\t\t\tputs \"Error: no entry is loaded. Please check your list and try again.\"\n\t\tend\n\t\treturn results\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def index\n @task_lists = TaskList.all\n end",
"def list_all_tasks\n task = Task.all\nend",
"def get_finished\n @task_list.select { |task| task.status == \"finished\" }\n end",
"def index\n @tasks = Task.all.order( 'starttime DESC' )\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def fetch_latest(params)\n wines = []\n offset = 0\n limit = 5000\n params_with_defaults = { limit: limit }.merge(params)\n response = auth_then.get(BASE_URL, params: params_with_defaults)\n count = response.parse[\"count\"]\n\n while offset < count\n if response.code == 200\n response.parse[\"results\"].each do |result|\n wines << result\n end\n else\n []\n end\n response = auth_then.get(response.parse[\"next\"]) if response.parse[\"next\"] != nil\n offset += 5000\n end\n wines\n end",
"def where(options = {})\n _, _, root = @client.get(\"/tasks\", options)\n\n root[:items].map{ |item| Task.new(item[:data]) }\n end",
"def incomplete_tasks\n sublist { |task| task.incomplete? }.sort_by { |task| task.created_at }\n end",
"def query_long_running_tasks\n Kernel.sleep(0.01)\n target_tasks = []\n 100.times.each do\n target_tasks = @tasks.get[\"nodes\"]\n .map { |k, v| v[\"tasks\"] }\n .flatten.map { |ts| ts.select { |k, v| /bulk/ =~ v[\"action\"] } }\n .flatten.reject { |t| t.empty? }\n break if target_tasks.size > 0\n end\n\n target_tasks\nend",
"def last_task\n @task_list.last.id\n end",
"def most_recent_commits(event_list)\n 5.times do |i|\n puts event_list[i][\"id\"]\n end\nend",
"def tasks_uncompleted\n tasks_uncompleted = assigned_tasks.uncompleted.order(\"deadline DESC\")\n tasks_uncompleted += executed_tasks.uncompleted.order(\"deadline DESC\")\n tasks_uncompleted.sort_by { |h| h[:deadline] }.reverse!\n end",
"def all\n return @tasks\n end",
"def latest\n @loops = Loop.latest\n render 'list'\n end",
"def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end",
"def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end",
"def listings(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/listings/latest\", options: params.compact)\n end",
"def complete_tasks\n # Give me all the tasks such that the task is complete\n # results = @tasks.select { |task| task.complete? }\n # results.sort_by { |task| task.completed_at }\n #\n # We can combine this into a single line\n \n @tasks.select { |task| task.complete? }.sort_by { |task| task.completed_at }\n end",
"def get_all_completed_items(params = {})\n if params[\"until\"]\n params[\"until\"] = ParseHelper.format_time(params[\"until\"])\n end\n if params[\"since\"]\n params[\"since\"] = ParseHelper.format_time(params[\"since\"])\n end\n \n result = @client.api_helper.get_response(Config::TODOIST_COMPLETED_GET_ALL_COMMAND, params)\n items = ParseHelper.make_objects_as_array(result[\"items\"])\n projects = ParseHelper.make_objects_as_array(result[\"projects\"])\n return {\"items\" => items, \"projects\" => projects}\n end",
"def index\n @tasklists = Tasklist.all\n end",
"def get_incomplete\n @task_list.select { |task| task.status == \"incomplete\" }\n end",
"def tasks\n Task.undone_for_user(goddamn_tfpid)\n end",
"def index\n @tasks = @list.tasks.order(status: :asc)\n return render_success_task_index\n end",
"def tasks\n @tasks.values.sort_by { |t| t.name }\n end",
"def scrape_tasks(url)\n tasks = []\n doc = Nokogiri::HTML(open(url))\n doc.css(\"li.task_event\").each do |node|\n task = scrape_task(node)\n\n tasks << task unless task.empty? or task.nil?\n end\n\n return tasks\nend",
"def latest_entries\n unless @latest_entries\n @latest_entries = Rails.cache.fetch([@account.cache_key, '/latest_entries'], :expires_in => 10.minutes) do\n Entry.paginate(:all, :from => \"/accounts/#{@account.account_resource_id.to_s}/entries.xml\", :params => { :page => 1, :per_page => 5}) \n end\n end\n @latest_entries\n end",
"def latest\n @latest = apiQuery(\"items(first:1, order:UPDATED_DESC, include:[PUBLISHED,EMBARGOED]) { nodes { updated } }\").\n dig(\"items\", \"nodes\", 0, \"updated\")\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def fetch\n @github.fetch\n @stackoverflow.fetch\n @acuk.fetch\n @jobs = data.shuffle\n end",
"def tasks_info\n all_tasks = Set.new\n all_job_info = {}\n history.each_key do |cycle_index|\n tasks, job_info = tasks_info_of_snapshot(cycle_index)\n all_tasks.merge(tasks)\n all_job_info.merge!(job_info)\n end\n [all_tasks, all_job_info]\n end",
"def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def index\n @tasks = Tasks::List.call(params: task_search_params, user: current_user).model\n @tasks = @tasks.page(params[:page]).order(created_at: :desc)\n end",
"def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def find_task_by_status(status)\n ids = user_tasks.where(status: status).pluck(:task_id).uniq\n Task.find([ids]).all || nil\n end",
"def fetch_latest\n page = page_with_latest_entries\n most_recent_new_entry = page.entries.first\n last_fetched_entry = @entry_cache.latest\n last_fetched_entry_seen = false \n next_entry = nil\n while !last_fetched_entry_seen && page\n page.entries.each do |entry|\n \n @entry_cache.write(entry, next_entry)\n if last_fetched_entry && entry.entry_id == last_fetched_entry.entry_id\n last_fetched_entry_seen = true\n break\n end\n\n next_entry = entry\n end\n page = page.next\n end\n \n @entry_cache.update_current_state(next_entry, most_recent_new_entry)\n @entry_cache.entries(next_entry, most_recent_new_entry)\n end",
"def index\n @tasks = @list.tasks.where(\"type = ?\",\"TaskTemp\").where.not(\"estado = ?\",\"expirada\").order(:prioridad)\n end",
"def task_id_list(commits)\n regex_arr = []\n\n tasks = Model::PACTaskCollection.new\n\n commits.each do |c_pac|\n\n referenced = false\n #Regex ~ Eacb regex in the task system\n settings[:task_systems].each do |ts|\n #Loop over each task system. Parse commits for matches\n if ts.has_key? :delimiter \n split_pattern = eval(ts[:delimiter]) \n end\n\n if ts.has_key? :regex \n tasks_for_commit = c_pac.matchtask(ts[:regex], split_pattern)\n tasks_for_commit.each do |t| \n t.applies_to = ts[:name]\n end \n #If a task was found\n unless tasks_for_commit.empty?\n referenced = true \n tasks.add(tasks_for_commit) \n end \n end\n end\n\n if !referenced\n task = Model::PACTask.new\n task.add_commit(c_pac)\n tasks.add(task)\n end \n\n end\n\n tasks \n end",
"def index\n \n if params[:task].present?\n if params[:task][:status].present? || params[:task][:search].present? || params[:task][:label_name]\n if params[:task][:status].present? && params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:status].present?\n @tasks = current_user.tasks.statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).page(params[:page]).per(10)\n elsif params[:task][:label_name].present?\n @searching_task_id = Combination.where(label_id: params[:task][:label_name].to_i).pluck(:task_id)\n @tasks = Task.where(id: @searching_task_id).page(params[:page]).per(10)\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n end",
"def index\n @tasks = Task.where(isArchived: false)\n @task = Task.new\n @lists = List.all\n end",
"def tasks(tasklist_id = '@default')\n get gtasks_tasks_url(tasklist_id)\n end",
"def getNext\n tasks = @db[:tasks]\n query_statuses = [\n Task.getStatusValue(:not_started),\n Task.getStatusValue(:restarted),\n Task.getStatusValue(:waiting),\n ]\n db_task = tasks.where(:status => query_statuses).order(:wake).order(:created).first\n if !db_task.nil?\n if self.lock db_task[:id]\n begin\n require db_task[:path]\n task = Marshal::load(db_task[:data])\n task.id = db_task[:id]\n status = Task.getStatusValue :running\n tasks.where(:id => task.id).update :status => status\n return task\n rescue\n self.unlock db_task[:id]\n end\n else\n @logger.warn \"lock contention for task #{db_task[:id]}\"\n return nil\n end\n end\n end",
"def collect3 pages\n id = 'barackobama'\n results = []\n tasks = TaskCollection.new( 50 )\n 1.upto pages do |page|\n puts \"queueing page #{page}\"\n task = BackgroundTask.new do \n http_get id, page\n end\n tasks << task\n end\n i=0\n loop do\n i+=1\n puts \"getting next task...\"\n task = tasks.next_finished\n if !task\n puts \"no more tasks\"\n break\n else\n puts \"task retrieved #{i}\"\n results += task.result\n end\n end\n results\nend",
"def recent\n result = http_get(\"/services/data/v#{self.version}/recent\")\n collection_from(result.body)\n end",
"def sync_tasks\n\n #TODO make this line optional\n @account_info = @authenticator.get_account\n\n #Add any tasks that needed to be added\n new_tasks = @tasks.keys.select{|task| task.brand_new?}\n @authenticator.add_tasks(new_tasks.collect {|task| task.json_parsed}) unless @new_tasks.new_tasks.empty?\n\n #Record that the tasks have already been added\n new_tasks.each {|task| task.no_longer_new}\n\n #Delete any tasks that were marked as deleted locally but not yet removed from @tasks\n deleted_tasks = @tasks.keys.select{|task| task.deleted?}\n @authenticator.delete_tasks(deleted_tasks.collect {|task| task.id}) unless deleted_tasks.empty?\n \n if lastedit_task > @last_task_sync\n #Get (recently edited) tasks\n tasks = @authenticator.get_tasks {:after => lastedit_task}\n \n locally_edited = []\n\n #TODO we may need to put this in a loop and load tasks page by page\n tasks.each do |task|\n if not @tasks[task.id]\n #If for some reason the task doesn't exist yet locally, add it\n @tasks[task.id] = task\n else\n #Compare modification times, update local copy when necessary, and resolve editing conflicts\n #Do NOT use task.last_mod, because that will just refer to the time that the get_tasks function was called!\n #Instead, we care about the time that the last edits were actually saved on the Toodledo server\n if task.modified > @tasks[task.id].last_mod\n #The server-stored task was modified more recently than the local task\n #TODO make sure all other locations are properly mutating the task, rather than creating parallel/outdated instances\n #If we simply overwrote the task instead of updating task.json_parsed, any past references to the task would point to an invalid/outdated\n @tasks[task.id].json_parsed = task.json_parsed\n @tasks[task.id].edit_saved\n else\n #The local task was modified more recently than the server-stored task\n #Realistically, the two timestamps cannot be the same, but if they are, we will assume the local copy is more accurate\n locally_edited.push(@tasks[task.id])\n end\n end\n end\n end\n\n if lastdelete_task > @last_task_sync\n #Query the deleted tasks (on the Toodledo server) and delete them here locally\n @user.get_deleted_tasks.collect{|task| task.id}.each do |id| \n #The delete boolean will be set just in case there are other references to the task, in which case it would not be garbage-collected\n @tasks[id].delete!\n @tasks[id].edit_saved #Make sure it won't be edited-saved in the future\n @tasks.delete(id)\n end\n end\n\n locally_edited = locally_edited.select{|task| not task.deleted?}\n @user.edit_tasks(locally_edited.collect{|task| task.json_parsed}) unless locally_edited.empty?\n \n #After this, the modified timestamp on the server will be the current time, which is later than the task.last_mod for any task stored locally\n \n #TODO check if there were repeating tasks that needed to be rescheduled\n \n #Remove any deleted tasks from @tasks. There may still be references elsewhere to them (depending on the application), so they may not necessarily be garbage-collected\n @tasks = @tasks.select{|task| not task.deleted?}\n\n @last_task_sync = Time.now\n end",
"def last_20_jobs(project_id)\n api(\"projects/#{project_id}/jobs\").sort_by { |j| -j['id'] }\nend",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def collect2 pages\n id = 'joshuabaer'\n results = []\n tasks = []\n 1.upto pages do |page|\n puts \"queueing page #{page}\"\n task = BackgroundTask.new do \n http_get id, page\n end\n tasks << task\n task.run\n end\n tasks.each do |task|\n puts \"task retrieved\"\n results += task.result\n end\n results\nend"
] |
[
"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.5847562",
"0.5803916",
"0.579407",
"0.57921886",
"0.5783062",
"0.5779489",
"0.57676286",
"0.57627296",
"0.57386094",
"0.57241166",
"0.5690896",
"0.56585884",
"0.5635589",
"0.56240755",
"0.56193537",
"0.5616334",
"0.56059235",
"0.55996263",
"0.55971664",
"0.5595674",
"0.5580408",
"0.5570558",
"0.55666316",
"0.55624604",
"0.5556153",
"0.55545807",
"0.55499005",
"0.5549666",
"0.55425984",
"0.55390614",
"0.5537476",
"0.5526899",
"0.5523295",
"0.5517157",
"0.551624",
"0.54998165",
"0.5492761",
"0.5481379",
"0.5480869",
"0.5470536",
"0.5452091",
"0.5439855",
"0.5438849",
"0.54367214",
"0.5432692",
"0.5423798",
"0.5423798",
"0.5422681",
"0.5420589",
"0.54192495",
"0.54163146",
"0.5415917",
"0.5400084",
"0.5398573",
"0.53908926",
"0.53810716",
"0.5370896",
"0.5368057",
"0.5363312",
"0.5344791",
"0.5340133",
"0.53315806",
"0.53269064",
"0.53188115",
"0.5314276",
"0.5309303",
"0.53075534",
"0.5293748",
"0.5289688",
"0.5288228",
"0.5274655",
"0.5271542",
"0.5269734",
"0.5267979",
"0.5262789",
"0.52592045",
"0.52581364",
"0.52567357",
"0.5246076"
] |
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_user_ids\n end\n lawyer_ids = @assigned_lawfirm_users.map(&:id)\n livian_user_ids = @user_ids\n order = set_order_of_tasks(params)\n @tasks = UserTask.get_tasks(params,user_ids,secretary,current_user,cluster_livian_user_ids,lawyer_ids,order)\n filtered_list\n @notes_count = Communication.get_notes_count(lawyer_ids,livian_user_ids,secretary,current_user)\n @tasks_count,@overdue_task_count,@upcoming_task_count,@todays_task_count = UserTask.get_task_count(lawyer_ids,livian_user_ids,secretary,current_user,params)\n end",
"def index\n @personal_tasks = PersonalTask.all_personal_tasks(session[:userid])\n @complete = PersonalTask.all_complete_personal_tasks(session[:userid])\n @incomplete = PersonalTask.all_incomplete_personal_tasks(session[:userid])\n end",
"def index\n authenticate_user!\n @tasks = current_user.tasks\n end",
"def index\n @task_lists = @user.task_lists\n end",
"def tasks\n Task.undone_for_user(goddamn_tfpid)\n end",
"def index\n @user_tasks_infos = UserTasksInfo.all\n end",
"def index\n @user = current_user\n if @user.project_manager\n @tasks = Task.where(pm_id: @user.id)\n else\n @tasks = Task.where(collaborator_id: @user.id)\n end\n\n end",
"def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end",
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend",
"def show\n @tasks = Task.from_user(@current_user).by_status(:confirmed).ordered\n @new_tasks = Task.from_user(@current_user).by_status(:pending).ordered\n @completed_tasks = Task.from_user(@current_user).by_status(:complete).ordered\n end",
"def show\n @tasks = current_user.assigned_and_written_tasks.pending.paginate(page: params[:page], per_page: 10)\n @fin_tasks = current_user.watching_tasks.completed.paginate(page: params[:page], per_page: 10) unless params[:page]\n @team = @task.team\n @project = @team.project\n @sub_tasks = @task.sub_tasks\n @comment = @task.comments.new\n end",
"def user\n users_tasks = current_user.tasks\n @main_list = users_tasks.where(:done => false).order(\"deadline ASC\")\n @main_list_header = \"Not done\"\n @done_unbilled_tasks = users_tasks.where(:done => true, :billed => 0).order(\"deadline ASC\")\n @active_subnavi = \"USER\";\n render :index\n end",
"def index\n\t if current_user.has_role? :admin\n\t\t @tasks = Task.all\n\t elsif current_user.has_role? :ing\n\t\t @user = User.find(current_user)\n\t\t @tasks = @user.tasks\n\t end\n end",
"def get_user_tasks\n puts \"CURRENT USER: #{get_current_user}\"\n if get_current_user\n # if params[:category_ids].empty?\n tasks = get_current_user.tasks.order(created_at: :desc)\n tasks_categories = TaskSerializer.new(tasks)\n\n puts \"CATEGORRRIES\", tasks_categories\n\n render json: TaskSerializer.new(tasks).to_serialized_json\n else \n render json: {\n error: \"Login to see tasks\"\n }\n # render json: get_current_user.tasks.order(created_at: :desc)\n end \n end",
"def index\n @user = User.find(username: 'default').first\n unless @user\n @user = User.create(username: 'default', fullname: 'Default User')\n end\n @task = Task.new # For a new task to be added\n # Pending tasks for this user\n @pending_tasks = @user.pending.all\n # We paginate completed tasks as the list could be long\n @completed_tasks, @page, @next_page = @user.get_completed_page(params, PAGE_SIZE)\n # Select pending or completed tab on view\n if params[:page]\n # Only completed tab has pagination\n @initial_tab = session[:current_tab] = 1\n elsif session[:current_tab]\n @initial_tab = session[:current_tab]\n else\n # Default\n @initial_tab = session[:current_tab] = 0\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = @current_user.tasks\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def index\n if params[:user_id].present?\n load_new_task\n @tasks = Task.where(user_id: params[:user_id])\n \n else\n @tasks = Task.all\n end\n end",
"def list_tasks\n #begin\n #byebug\n @params=search_params[:search]\n #byebug\n if @params\n if !@params[:user].empty?\n query = iterate_add_tasks(User.where('handle LIKE ?', \"%#{@params[:user]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:client].empty?\n query = iterate_add_tasks(Client.where('name LIKE ?', \"%#{@params[:client]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:project].empty?\n query = iterate_add_tasks(Project.where('name LIKE ?', \"%#{@params[:project]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n if !@params[:activity].empty?\n query = iterate_add_tasks(Activity.where('name LIKE ?', \"%#{@params[:activity]}%\"))\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n \n if !@params[:date].empty?\n @start=Date.parse(@params[:date]).beginning_of_month\n @end=Date.parse(@params[:date]).end_of_month \n query = Task.where(date: @start..@end)\n if query\n @tasks.nil? ? @tasks=query : @tasks=@tasks&query\n end\n end\n\n if @tasks\n #byebug\n @tasks=@tasks.uniq.sort{|a,b| a[:date] <=> b[:date]}\n @tasks=@tasks.reverse\n end\n \n flash[:notice]=nil\n \n all=true\n @params.each do |p|\n #byebug\n if !p[1].empty?\n all=false\n end\n end\n \n if all\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n else\n @tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n flash[:notice]='Listing the latest 20 tasks'\n end\n #rescue\n #@tasks=Task.includes(:user, :client, :project, :activity).order(:date).reverse_order.limit(20)\n #flash[:notice]='Listing the latest 20 tasks'\n #end\n @hours=total_hours(@tasks)\n respond_to do |format|\n format.html\n format.csv {send_data tasks_to_csv(@tasks)}\n end\n end",
"def get_all_open_tasks_by_user(login_id)\n [{ \"Action\" => \"Query\",\n \"QueryType\" => \"AllOpenTasksByUser\",\n \"DomainType\" => \"Replicon.Project.Domain.Task\",\n \"Args\" => [{ \"__type\" => \"Replicon.Domain.User\",\n \"Identity\" => login_id\n }\n ]\n }\n ]\nend",
"def show\n @tasks = current_user.assigned_and_written_tasks.pending.paginate(page: params[:page], per_page: 10)\n @fin_tasks = current_user.watching_tasks.completed.paginate(page: params[:page], per_page: 10) unless params[:page]\n end",
"def get_user_tasks\n render json: get_current_user.tasks\n end",
"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\n task_list.tasks\n end",
"def index\n set_tasks\n if @role === 'admin'\n @tasks = Task.all\n end\n if @role === 'merchant'\n @tasks = Task.where(merchant: spree_current_user.merchant_id)\n end\n end",
"def index\n @tasks = current_user.tasks.find(:all, :order => 'updated_at DESC')\n @shared_tasks = current_user.shared_tasks.find(:all, :order => 'updated_at DESC', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def index\n @tasks = Task.root.\n where(assigned_to: @user).\n or(Task.root.where(for_individual: @user) ).\n paginate(page: params[:page], per_page: 25)\n end",
"def my_task\n @my_id = current_user.id # may be redundant4 but will head towards service objects\n @tasks = Task.where(user_id: @my_id)\n end",
"def update_internal_task_lists\n\n # Security - discard tasks the user should not be able to see.\n\n if ( @current_user.restricted? )\n @tasks.select do | task |\n task.is_permitted_for?( @current_user )\n end\n end\n\n # Now the fiddly bit! Sort the task objects by augmented title, then\n # retrospectively rebuild the task ID arrays using the reordered list.\n\n Task.sort_by_augmented_title( @tasks )\n\n @task_ids = []\n @active_task_ids = []\n @inactive_task_ids = []\n\n @tasks.each do | task |\n @task_ids << task.id\n @active_task_ids << task.id if ( task.active )\n @inactive_task_ids << task.id unless ( task.active )\n end\n end",
"def index\n @tasks = (current_user.admin? ? Task.all : current_user.tasks)\n @error = nil\n if params[:name].present?\n resp = Task.where(\"name ilike '%#{params[:name]}%'\")\n if resp.present? \n if !current_user.admin?\n resp = resp.where(:user_id => current_user.id)\n end\n @tasks = resp \n end\n if resp.blank?\n @error = \"No Task Present with \\'#{params[:name]}\\' name\"\n end\n end \n end",
"def index\n\n if params[:user_id] && User.find(params[:user_id]) == current_user\n @tasks = @user.tasks\n elsif\n redirect_to missions_path\n flash[:notice] = \"Can't Do that\"\n else\n @tasks = Tasks.all\n end\n end",
"def find_by_user_task_list(client, user_task_list: required(\"user_task_list\"), completed_since: nil, per_page: 20, options: {})\n params = { completed_since: completed_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/user_task_lists/#{user_task_list}/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def get_followers_from_tasks(tasks, array) #tasks == an array, array == an array\n tasks.each do |task|\n task[\"followers\"].each do |follower|\n #get user name based on user id\n user = JSON.parse(Typhoeus::Request.get(\"https://app.asana.com/api/1.0/users/\" + follower[\"id\"].to_s, userpwd: \"4tuQrdX.5djpapCXlKooicNrUgx0zbeY:\").body)\n array.push(user[\"data\"][\"name\"])\n end\n end\nend",
"def index\n @pagy, @tasks = pagy(apply_scopes(current_user.tasks), items: 5)\n end",
"def index\n @tasks = Task.where(user_id: current_user.id)\n end",
"def reviewer_tasks\n tasks.find(:all, :conditions => { :context => 'reviewers', :show_for_context_object_tasks => true })\n end",
"def interviewer_tasks\n tasks.find(:all, :conditions => { :context => 'interviewers', :show_for_context_object_tasks => true })\n end",
"def find_all(client, assignee: nil, workspace: nil, project: nil, section: nil, tag: nil, user_task_list: nil, completed_since: nil, modified_since: nil, per_page: 20, options: {})\n params = { assignee: assignee, workspace: workspace, project: project, section: section, tag: tag, user_task_list: user_task_list, completed_since: completed_since, modified_since: modified_since, limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks\", params: params, options: options)), type: self, client: client)\n end",
"def index\n @tasks = Task.not_related.root.where(assigned_to: @user).or(Task.root.where(for_individual: @user) )\n end",
"def index\n @user = current_user\n if (@user.populated == false) \n populate_database\n @user.populated = true\n @user.save!\n elsif @user.current_login - @user.last_login > 30\n populate_database\n end\n @tasks = @user.tasks.where(start: params[:start]..params[:end])\n end",
"def index\n @task_users = TaskUser.all\n end",
"def show\n @user = User.find(params[:id])\n\n @tasks = Task.where(assignee: current_user).page(params[:page])\n @q = @tasks.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n\n # @tasks_authored = Task.where(author: current_user).page(params[:page])\n # @q_authored = @tasks_authored.ransack(params[:q])\n # @tasks_authored = @q_authored.result.page(params[:page])\n end",
"def index\n @tasks =\n if @is_admin\n if id = params[:filter_by_user_id]\n Task.where(user_id: id)\n elsif state = params[:filter_by_state]\n Task.where(state: state)\n else\n Task.all\n end\n else\n Task.where(user_id: @person.id) + Task.where(state: 'open', user_id: nil)\n end\n end",
"def get_tasks_from_todoist\n return Todoist::Task.uncompleted(PROGRAMMING_PROJECT_ID)\n end",
"def index\n \n if params[:task].present?\n if params[:task][:status].present? || params[:task][:search].present? || params[:task][:label_name]\n if params[:task][:status].present? && params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:status].present?\n @tasks = current_user.tasks.statusing(params[:task][:status]).page(params[:page]).per(10)\n elsif params[:task][:search].present?\n @tasks = current_user.tasks.searching(params[:task][:search]).page(params[:page]).per(10)\n elsif params[:task][:label_name].present?\n @searching_task_id = Combination.where(label_id: params[:task][:label_name].to_i).pluck(:task_id)\n @tasks = Task.where(id: @searching_task_id).page(params[:page]).per(10)\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n else\n if params[:sort_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(deadline: :asc)\n elsif params[:priority_expired]\n @tasks = current_user.tasks.page(params[:page]).per(10).order(priority: :asc)\n else\n @tasks = current_user.tasks.page(params[:page]).per(10).order(created_at: :desc)\n end\n end\n end",
"def index\n @tasks = current_user.tasks.order('updated_at DESC')\n end",
"def all_tasks\n @task = Task.get_all_tasks_user_can_see(current_user)\n end",
"def index # all available task\n @task_check = Task.all\n # need to list only Tasks that is not owned by current_user\n if user_signed_in?\n @my_id = current_user.id\n # All Available task not current_user & checks for accepted_by_user_id == 0\n # query worked only after setting accepted_by_user_id to = 0 from nil\n # Set default field of accepted_by_user_id to 0 within task.rb via after_initialize\n # @tasks = Task.where(\"user_id != ? AND task_status = ? AND accepted_by_user_id = ?\", @my_id, \"Available\", 0)\n @tasks = Task.where(\"user_id != ? AND task_status = ? AND accepted_by_user_id = ?\", @my_id, \"Available\", 0)\n @tasks2 = @tasks\n else\n # All Available task including my tasks : user_signed_in?(false) => index display\n @tasks = Task.where(task_status: \"Available\")\n @tasks2 = @tasks\n end\n end",
"def index\n # Replace TaskAdmin with User if we want SuperAdmin to manage all users\n @users = TaskAdmin.all\n end",
"def index\n #@tasks = current_user.assignments\n @tasks = current_user.watching_tasks.pending.paginate(page: params[:page], per_page: 10)\n @fin_tasks = current_user.watching_tasks.completed.paginate(page: params[:page], per_page: 10) unless params[:page]\n end",
"def index\n @user = current_user\n @tasks = @user.tasks.rank(:row_order)\n @label_list = Label.all\n @task = current_user.tasks.new\n @sort = nil\n if params[:task]\n selection = params.dig(:task, :keyword)\n # @tasks = Task.sort(selection)\n # @tasks = @tasks.where(user_id: current_user)\n @tasks = Task.where(user_id: current_user).order_by_key(selection)\n @sort = params[:task][:keyword]\n end\n end",
"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\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end",
"def index\n @tasks = current_company.tasks.all.page(params[:page]).per(20).search(params[:search]).reverse_order if params[:sort] == nil && params[:uesr_id] == nil\n @tasks = current_company.tasks.order(params[:sort]).page(params[:page]).per(20) if params[:sort] != nil\n @tasks = current_company.tasks.where(user_id: params[:user_id]).reverse_order.page(params[:page]).per(20) if params[:user_id] != nil\n end",
"def tasks(project_id)\n account = Config.details \n c = FreshBooks::Client.new(account[\"account\"], account[\"token\"])\n c.task.list :project_id => project_id\n end",
"def index\n @event_tasks = EventTask.user_event_tasks(current_user)\n end",
"def index\n @checklists = Checklist.get_checklist_entries(current_user).get_pending_tasks.paginate(page: params[:page])\n end",
"def index\n if not user_signed_in?\n redirect_to :controller => 'home', :action => 'index'\n end\n @tasks = Task.where(createdby: current_user.email)\n end",
"def list_all_tasks\n task = Task.all\nend",
"def index\n if params[:user_id]\n @tasks = Task.where('user_id = ? AND (done = ? OR (updated_at > ?))', params[:user_id], '0', DateTime.now.beginning_of_day).all\n else\n @tasks = Task.where('done = ? OR (updated_at > ?)', 0, DateTime.now.beginning_of_day).all\n end\n end",
"def index\n @tasks = @category.tasks\n # @user = current_user\n # @tasks = current_user.tasks.order('created_at desc')\n # @tasks = current_user.tasks.paginate(page: params[:page], per_page: 3).order('created_at desc')\n end",
"def task_lists(current_token)\n session = RedboothRuby::Session.new(token: current_token)\n client = RedboothRuby::Client.new(session)\n\n client.task_list(:index, project_id: self.id).all\n end",
"def index\n authorize Task\n # TODO: should be showing students prompts through assessments...\n # TODO: change route, go through assessments?\n # enrollment = Enrollment.where(student_id: current_user.id)[0]\n # if enrollment then section = enrollment.section_id\n # assessments = Assessment.where(section_id: section)\n # end\n\n @tasks = policy_scope Task.all\n @tasks_grid = initialize_grid @tasks\n end",
"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 show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend",
"def index\n @tasks = current_user.tasks.all.order(id: :desc)\n success_task_index\n end",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"def hpt\n @checklists = Checklist.get_checklist_entries(current_user).get_pending_tasks.get_high_priority_tasks.paginate(page: params[:page])\n end",
"def index\n\n if params[:project_id].nil?\n results = current_user.tasks\n\n else\n @project = Project.user_readable(current_user).find(params[:project_id])\n results = @project.tasks\n end\n\n @tasks = paginate_results(params[:page], results)\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def sync_tasks\n\n #TODO make this line optional\n @account_info = @authenticator.get_account\n\n #Add any tasks that needed to be added\n new_tasks = @tasks.keys.select{|task| task.brand_new?}\n @authenticator.add_tasks(new_tasks.collect {|task| task.json_parsed}) unless @new_tasks.new_tasks.empty?\n\n #Record that the tasks have already been added\n new_tasks.each {|task| task.no_longer_new}\n\n #Delete any tasks that were marked as deleted locally but not yet removed from @tasks\n deleted_tasks = @tasks.keys.select{|task| task.deleted?}\n @authenticator.delete_tasks(deleted_tasks.collect {|task| task.id}) unless deleted_tasks.empty?\n \n if lastedit_task > @last_task_sync\n #Get (recently edited) tasks\n tasks = @authenticator.get_tasks {:after => lastedit_task}\n \n locally_edited = []\n\n #TODO we may need to put this in a loop and load tasks page by page\n tasks.each do |task|\n if not @tasks[task.id]\n #If for some reason the task doesn't exist yet locally, add it\n @tasks[task.id] = task\n else\n #Compare modification times, update local copy when necessary, and resolve editing conflicts\n #Do NOT use task.last_mod, because that will just refer to the time that the get_tasks function was called!\n #Instead, we care about the time that the last edits were actually saved on the Toodledo server\n if task.modified > @tasks[task.id].last_mod\n #The server-stored task was modified more recently than the local task\n #TODO make sure all other locations are properly mutating the task, rather than creating parallel/outdated instances\n #If we simply overwrote the task instead of updating task.json_parsed, any past references to the task would point to an invalid/outdated\n @tasks[task.id].json_parsed = task.json_parsed\n @tasks[task.id].edit_saved\n else\n #The local task was modified more recently than the server-stored task\n #Realistically, the two timestamps cannot be the same, but if they are, we will assume the local copy is more accurate\n locally_edited.push(@tasks[task.id])\n end\n end\n end\n end\n\n if lastdelete_task > @last_task_sync\n #Query the deleted tasks (on the Toodledo server) and delete them here locally\n @user.get_deleted_tasks.collect{|task| task.id}.each do |id| \n #The delete boolean will be set just in case there are other references to the task, in which case it would not be garbage-collected\n @tasks[id].delete!\n @tasks[id].edit_saved #Make sure it won't be edited-saved in the future\n @tasks.delete(id)\n end\n end\n\n locally_edited = locally_edited.select{|task| not task.deleted?}\n @user.edit_tasks(locally_edited.collect{|task| task.json_parsed}) unless locally_edited.empty?\n \n #After this, the modified timestamp on the server will be the current time, which is later than the task.last_mod for any task stored locally\n \n #TODO check if there were repeating tasks that needed to be rescheduled\n \n #Remove any deleted tasks from @tasks. There may still be references elsewhere to them (depending on the application), so they may not necessarily be garbage-collected\n @tasks = @tasks.select{|task| not task.deleted?}\n\n @last_task_sync = Time.now\n end",
"def GetUserStoriesAndTasksFromFile(taskFile)\n\n\tFile.open(taskFile, \"r\") do |infile|\n\n\t defect_tasks = Hash.new(Array.new)\n\t us_tasks = Hash.new(Array.new)\n\t work_product = \"\"\n\n\t while (line = infile.gets)\n\t\t\n\t\tline = line.strip\n\n\t\tif (!work_product.match('\\AUS').nil? && line.match('(\\AUS|\\ADE)').nil?) then us_tasks[work_product] += [line] end\n\t\tif (!work_product.match('\\ADE').nil? && line.match('(\\AUS|\\ADE)').nil?) then defect_tasks[work_product] += [line] end\n\t\tif (!line.match('\\AUS').nil? || !line.match('\\ADE').nil?) then work_product = line end\n\n\t end\n\n\t us_tasks.each_pair { |us,values| CreateTasksForUserStory(us,values) }\n\t defect_tasks.each_pair { |de,values| CreateTasksForDefect(de,values) }\n\t\n\tend\nend",
"def tasklists\n get gtasks_tasklists_url\n end",
"def tasks\n user = validate_user( request.headers[\"authentication-token\"] )\n if user.nil?\n respond_to do |format|\n format.html do\n flash[:error] = 'Not authenticated.'\n redirect_to root_url\n end\n\n format.xml { render :xml => { :status => :error, :message => 'Invalid authentication code.'}.to_xml, :status => 403 }\n\n format.json { render :json => { :status => :error, :message => 'Invalid authentication code.'}.to_json, :status => 403 }\n end\n else\n projects = Task.find_all_by_project_id( params[:id] )\n if projects\n respond_to do |format|\n format.html { \n @title = \"Dasher - Your Projects\"\n @projects = Project.find_all_by_owner(@user.id)\n }\n format.xml { render :xml => projects.to_xml( :only => [:project_id, :id, :description] ) }\n format.json { render :json => projects.to_json( :only => [:project_id, :id, :description] ) }\n end\n end\n end\n end",
"def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end",
"def index\n if params[:sort_expired]\n @tasks = current_user.tasks.order(limit_on: :desc).page(params[:page]).per(5)\n elsif params[:sort_priority]\n @tasks = current_user.tasks.order(priority: :asc).page(params[:page]).per(5)\n elsif\n @tasks = current_user.tasks.order(created_at: :desc).page(params[:page]).per(5)\n end\n \n if params[:search_title].present? && params[:search_status].present?\n @tasks = current_user.tasks.search_title(params[:search_title]).search_status(params[:search_status]).page(params[:page]).per(5)\n elsif params[:search_title].present?\n @tasks = current_user.tasks.search_title(params[:search_title]).page(params[:page]).per(5)\n elsif params[:search_status].present?\n @tasks = current_user.tasks.search_status(params[:search_status]).page(params[:page]).per(5)\n elsif params[:label_id].present?\n @tasks = Task.joins(:labels).where(labels:{id: params[:label_id]}).page(params[:page])\n end\n end",
"def todo_list\n TodoList.find_by(user_id: current_user['sub'])\n end",
"def index\n @brews = current_user.brews.order('date DESC')\n\t@tasks = current_user.steps.where('completed=? OR date>?', false, Date.today).order(:date)\n end",
"def lists\n load_user_lists\n end",
"def redmine_my_tasks(m, params)\n \tbegin\n\t\tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\t## Loading All issues for this user\n\t\t\t# Configuration of the connector\n\t\t\t::Issue.site = @redmine_rapid_url\n\t\t\t::Issue.user = certificate[:username]\n\t\t\t::Issue.password = certificate[:password]\n\t\t\t# Get All Issues for a user\n\t\t\tissues = Issue.find(:all, :params => { :assigned_to_id => 'me',:set_filter => 1 })\n\t\t\tissues.each do |issue|\n\t \t # Display Issues one by one\n\t \t redmine_display_an_issue(m, issue)\n\t \tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\t\n end",
"def tasks_for_timeline\n tasks.where(status: Constants.TASK_STATUSES.completed).order(\"completed_at DESC\")\n .reject { |t| t.assigned_to.is_a?(Organization) && t.children.pluck(:assigned_to_type).include?(User.name) }\n end",
"def show\n @task = Task.new\n @member = @dream.members.find_by(user_id: current_user.id)\n @users = @dream.users\n @comments = @dream.comments.order('created_at DESC').joins(:user)\n end",
"def index\n @status_task_users = StatusTaskUser.all\n end",
"def edit_tasks(list_of_hash_tasks, *args)\n list_of_hash_tasks = [list_of_hash_tasks,] if list_of_hash_tasks.is_a Hash\n list_of_hash_tasks.each do |task|\n raise ArgumentError, 'An id must be specified when a task is edited' if unless task.has_key? :id or task.has_key 'id'\n end\n edit(\"tasks\", Babar::Task, list_of_hash_tasks, 'tasks', false, *args)\n end\n\n \n #Given a list of Task ids, delete all the corresponding tasks from the Toodledo API \n def delete_tasks(list_of_task_ids, *args)\n #TODO modify this to accept Task objects as well\n #TODO check that this will work because array is of IDs, not hashes\n modify(endpoint, 'delete', desired_class, array_of_hashes, array_field_name, delete_first_result, *args)\n end\n\n\n #Implement add/edit/delete methods for each of the following Toodledo User-defined lists: Context, Folder, Goal, Location\n %w(context folder goal location).each do |list|\n current_class = Babar::const_get(list.capitalize)\n define_method(\"get_#{list}s\") { get(\"#{list}s\", param_map = {}, desired_class = current_class, delete_first_result = false) }\n %w(add edit delete).each do |mod_endp|\n #Hash_goal is a Hash representation of the (desired) list AFTER it is added/edited/deleted\n #TODO in the case of deletion, make sure an ID suffices\n define_method(\"#{mod_endp}_#{list}\") { |hash_goal| modify_single( endpoint = \"#{list}s\", action = mod_endp, param_map = hash_goal, desired_class = current_class, delete_first_result = false)}\n end\n end\n\n end",
"def index\n @status_unassigned = Status.find_by_name(\"Unassigned\") \n @unassigned = checkList(@status_unassigned) \n\n @status_implementing = Status.find_by_name(\"Implementing\")\n @implementing = checkList(@status_implementing)\n \n @status_testing = Status.find_by_name(\"Testing\")\n @testing = checkList(@status_testing)\n \n @status_completed = Status.find_by_name(\"Completed\")\n @completed = checkList(@status_completed)\n \n @status_pending = Status.find_by_name(\"Pending\")\n @pending = checkList(@status_pending)\n \n \n @user_id = session[:user_id]\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @tasks }\n end\n end",
"def get_tasks(tasklist)\n tasklist_id = tasklist[\"id\"]\n tasklist.tasks = @client.execute(\n api_method: @api.tasks.list,\n parameters: {tasklist: tasklist_id}\n ).data.to_hash[\"items\"]\n end",
"def task_names \n\t\t\tHelpers::DATABASE[:Tasks].join(:Task_list, :Tasks__Id => :Task_list__Task_Id).join(\n\t\t\t:Lists, :Lists__Id => :Task_list__List_id).select(:Tasks__Id, :Tasks__Task_number, \n\t\t\t:Tasks__Name, :Tasks__Completed, :Tasks__Priority).filter(:Lists__Name => Config[:working_list_name])\n\t\tend",
"def index\n if params[:search]\n @search = Task.search { fulltext params[:search] }\n @tasks = Task.where(id: @search.results.map(&:id), completed: params.include?(:completed)).page(params[:page])\n else\n @tasks = Task.eager.where(completed: params.include?(:completed)).order(:due_at).page(params[:page])\n end\n\n Task.eager.mark_as_read! @tasks.to_a, :for => current_user\n end",
"def user_info(user_id, list_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listings WHERE list_id=?\", list_id)]\nend",
"def index\n @users = User.all\n \n \n @employees = Employee.all\n @eadmin_tasks = EadminTask.all\n @eadmin_tasks = current_user.eadmin_tasks\n\n\n \n end",
"def show\n @users = User.all\n find_ranking(@task)\n end",
"def load_special_tasks\n $bot[:tasks][:list] = {\n block: -> do\n list_tasks\n end,\n desc: 'List all available tasks'\n }\n end",
"def get_users\n work_subtype = WorkSubtype.find(params[:work_subtype_id]) unless params[:work_subtype_id] == \"null\" || params[:work_subtype_id].blank?\n users,complexity = [],nil\n if params[:user_category_type] == 'ClusterUsers'\n unless params[:task_type].eql?(\"LivianTask\")\n if params[:complexity_id].present? && params[:complexity_id] != 'null'\n complexity = WorkSubtypeComplexity.find(params[:complexity_id])\n else\n complexity = work_subtype.work_subtype_complexities.first if work_subtype\n end\n users = Cluster.get_back_office_cluster_livians\n else\n employee_user = User.find(params[:employee_user_id])\n users =livian_users_of_lawyer(employee_user)\n end\n users.uniq!\n elsif params[:user_category_type] == 'CommonPoolAgent'\n if params[:task_type].eql?(\"Back Office\") || params[:task_type].eql?(\"BackofficeTask\")\n users = Cluster.get_back_office_cluster_livians\n if params[:complexity_id].present?\n complexity = WorkSubtypeComplexity.find(params[:complexity_id])\n else\n complexity = work_subtype.work_subtype_complexities.first if work_subtype\n end\n else\n users = Cluster.get_common_pool_livian_users\n end\n end\n if work_subtype\n differentiat_users_on_skills(users, work_subtype,complexity)\n else\n @users_select = [[\"no skilled user\",\"\"],[\"-------Other Users-------\",\"\"]]\n @users_select += users.collect {|u| [ u.full_name, u.id ]}\n end\n @has_complexity = params[:task_type] != 'LivianTask' && current_user.service_provider.has_back_office_access?\n render :update do |page|\n page.replace_html 'task_'+params[:task_index]+'_users', :partial=>'users_select'\n if @has_complexity\n page.show \"tasks_#{params[:task_index]}_complexity_stt_tat_#{complexity.id}\"\n page.replace_html \"tasks_#{params[:task_index]}_complexity_stt_tat_#{complexity.id}\", \"<br>#{complexity.complexity_level} -stt: #{complexity.stt} tat: #{complexity.tat}\"\n end\n end\n end",
"def index\n @tasks = current_user.tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tasks }\n end\n end",
"def index\n create_sessions(current_user.role.name,current_user) if session[:sp_session].nil?\n secretary = is_secretary?\n lawyer_user_ids = get_lawyer_user_ids\n livian_user_ids = @user_ids\n created_by_user_ids = lawyer_user_ids\n created_by_user_ids << current_user.id if secretary\n @notes = Communication.get_notes(params,created_by_user_ids,secretary,current_user,livian_user_ids)\n @notes_count = Communication.get_notes_count(lawyer_user_ids, livian_user_ids, secretary, current_user)\n @tasks_count,@overdue_task_count,@upcoming_task_count,@todays_task_count = UserTask.get_task_count(lawyer_user_ids,livian_user_ids,secretary,current_user)\n filtered_list\n end",
"def index\n #binding.pry\n \n if params[:sort_expired_at]\n #@tasks = Task.all.order(expired_at: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(expired_at: :desc)\n elsif params[:sort_priority]\n #@tasks = Task.all.order(priority: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(priority: :desc)\n\n elsif params[:tag_id]\n if params[:tag_id] != \"\"\n #@tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n @tasks = Tag.find(params[:tag_id]).tasks.page(params[:page]).per(PER) \n else\n #@tasks = Tag.find(params[:tag_id]).tasks.page(params[:page]).per(PER) \n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n end\n \n #@tasks = Tag.find(params[:tag_id]).tasks\n\n elsif params[:status_search] == \"\" && params[:title_search] == \"\"\n #@tasks = Task.all.order(id: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n\n elsif params[:status_search] && params[:title_search] == \"\"\n #@tasks = Task.status_search(params[:status_search]) #default\n #@tasks = Task.where(status: params[:status_search]) #scope\n @tasks = current_user.tasks.page.status_search(params[:status_search]).per(PER) #kaminari\n \n\n elsif params[:title_search] && params[:status_search] == \"\"\n #@tasks = Task.where('title LIKE ?', \"%#{params[:title_search]}%\") #default\n #@tasks = Task.title_search(params[:title_search]) #※scope\n @tasks = current_user.tasks.page.title_search(params[:title_search]).per(PER) #kaminari\n \n elsif params[:title_search] && params[:status_search]\n #@tasks = Task.status_search(params[:status_search]).title_search(params[:title_search]) #scope\n #@tasks = Task.where('title LIKE ?', \"%#{params[:title_search]}%\").where(status: params[:status_search]) #default\n @tasks = current_user.tasks.page.status_search(params[:status_search]).title_search(params[:title_search]).per(PER)\n \n else\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n #@tasks = Task.page(params[:page]).per(PER).order(id: :desc) #全てのユーザーのtask見れる\n #@tasks = Task.all.order(id: :desc)\n end\n end",
"def index\n @todolist = Todolist.find(params[:todolist_id])\n @task = @todolist.tasks.find(params[:id])\n\n @tasks = @todolist.tasks.where(completed: false).order('created_at ASC')\n @completed_tasks = @todolist.tasks.where(completed: true).order('updated_at')\n end",
"def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end",
"def display_tasks_and_comments\n puts \"Displaying tasks... \\n\"\n puts\n if(options.show_tasks == :tasks)\n # Get the maximum width of all task names\n all_displayable_tasks = tasks.select { |t|\n t.comment && t.name =~ options.show_task_pattern\n }\n \n #puts \"Displayable tasks: #{all_displayable_tasks}\\n\"\n \n width = all_displayable_tasks.collect { |t| t.name_with_args.length }.max || 10\n max_column = truncate_output? ? terminal_width() - name.size - width - 7 : nil\n \n @ProjectFileLoader.LoadedProjectFiles().each do |projectFile|\n if(projectFile.HasTasks())\n headline = \"Tasks in project file: '#{projectFile.Path().RelativePath()}'\\n\"\n puts headline\n puts \"-\" * headline.length\n puts projectFile.GetTaskDescriptions(width, max_column)\n end \n end\n else\n super\n end\n end",
"def index\n\t\t@tasks = @event.tasks.all\n\n\n\n\t\t# @task.find(task_id).user.name\n\t\t# user_id = params[:user_id]\n\t\t# @user = User.find(user_id)\n\t\t# render :index\n\t\trespond_to do |format|\n\t\t\tformat.html { render :index}\n\t\t\tformat.json { render json: @tasks }\n\t\tend\n\tend"
] |
[
"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.6481489",
"0.64526117",
"0.6450334",
"0.64355654",
"0.64264905",
"0.642408",
"0.6417146",
"0.64101416",
"0.6396946",
"0.63961947",
"0.63828284",
"0.63742405",
"0.63738006",
"0.63655555",
"0.63494873",
"0.6336908",
"0.62772375",
"0.62750363",
"0.625947",
"0.6246476",
"0.623603",
"0.62327135",
"0.6228036",
"0.62245303",
"0.6220026",
"0.6215164",
"0.6204581",
"0.6198617",
"0.6196147",
"0.6177193",
"0.6171418",
"0.61698633",
"0.61530983",
"0.6151477",
"0.6150898",
"0.61500525",
"0.6145019",
"0.61419016",
"0.6137674",
"0.61221683",
"0.6118383",
"0.6116423",
"0.6107592",
"0.610181",
"0.60997343",
"0.6098174",
"0.6096011",
"0.60812664",
"0.60807735",
"0.6061587",
"0.6060459",
"0.60515404",
"0.6051122",
"0.60472584",
"0.6045786",
"0.6032709",
"0.6025817",
"0.6013847",
"0.601288",
"0.59982866",
"0.59979725",
"0.5996825",
"0.5995342",
"0.59950536",
"0.5990567",
"0.59875816",
"0.5983318",
"0.59748775",
"0.5971888",
"0.5970011",
"0.59678316",
"0.59598386",
"0.5956048",
"0.5952608",
"0.5946255",
"0.59397876",
"0.59391063",
"0.5928993",
"0.5927866",
"0.59147704"
] |
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",
"def test_initialize_objects\n\t# assert_equal @w.nodes, 0\n\t# assert_equal @w.validWordList, 0\n\tassert_kind_of Graph, @w \n\tassert_kind_of Node, @n\n end",
"def init_node\n end",
"def init_node\n end",
"def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end",
"def initialize(attrs = {})\n attrs.stringify_keys!\n @nodes = []\n super(attrs)\n end",
"def initialize\n\t@xml = '<?xml version=\"1.0\"?>\n<?misc:processingInstruction \"with arguments\"?>\n<?other:piNoArgs ?>\n<!DOCTYPE outer PUBLIC \"public id\" \"foobar\" [\n <!ENTITY foo \"bletch\">\n <!ELEMENT el>\n <!ATTLIST el EMPTY>\n <!NOTATION notation ignored>\n]>\n<!-- comment -->\n<outer>\n data&&foo;\nmore on next line<simpleTag>text</simpleTag>\n<inner:tag a=\"tabs\tto\tspaces&foo;\"/><![CDATA[xx<z&xx</\nnewline in cdata\n]]>\n<p>text <b>bold café coffee</b> more text</p>\n</outer>'\n\n\temptyAttrs = Hash.new()\n\t@newlineTok = NQXML::Text.new(\"\\n\")\n\n\tattrs = Hash.new()\n\tattrs['version'] = '1.0'\n\t@xmlDecl = NQXML::XMLDecl.new('xml', attrs, '<?xml version=\"1.0\"?>')\n\n\tsrc = '<?misc:processingInstruction \"with arguments\"?>'\n\t@piWithArgs =\n\t NQXML::ProcessingInstruction.new('misc:processingInstruction',\n\t\t\t\t\t '\"with arguments\"', src)\n\n\t@piNoArgs = NQXML::ProcessingInstruction.new('other:piNoArgs', '',\n\t\t\t\t\t\t '<?other:piNoArgs ?>')\n\n\t@entityTag =\n\t NQXML::GeneralEntityTag.new('foo', 'bletch', nil, nil,\n\t\t\t\t\t'<!ENTITY foo \"bletch\">')\n\t@element = NQXML::Element.new('el', '', '<!ELEMENT el>')\n\t@attlist = NQXML::Attlist.new('el', 'EMPTY', '<!ATTLIST el EMPTY>')\n\t@notation = NQXML::Notation.new('notation', 'ignored',\n\t\t\t\t\t'<!NOTATION notation ignored>')\n\t@doctypePubid =\n\t NQXML::PublicExternalID.new('\"public id\"', '\"foobar\"',\n\t\t\t\t\t'PUBLIC \"public id\" \"foobar\"')\n\t@doctype =\n\t NQXML::Doctype.new('outer', @doctypePubid,\n\t\t\t [@entityTag, @element, @attlist, @notation],\n\t\t\t \"<!DOCTYPE outer PUBLIC \\\"public id\\\" \\\"foobar\\\" [\\n\" +\n\t\t\t \" <!ENTITY foo \\\"bletch\\\">\\n\" +\n\t\t\t \" <!ELEMENT el>\\n\" +\n\t\t\t \" <!ATTLIST el EMPTY>\\n\" +\n\t\t\t \" <!NOTATION notation ignored>\\n\" +\n\t\t\t \"]>\")\n\n\t@comment = NQXML::Comment.new('<!-- comment -->')\n\t@outerStart = NQXML::Tag.new('outer', emptyAttrs, false, '<outer>')\n\t@textDataWithSub = NQXML::Text.new(\"\\n data&bletch\\nmore on next line\")\n\t@simpleTagStart = NQXML::Tag.new('simpleTag', emptyAttrs, false,\n\t\t\t\t\t '<simpleTag>')\n\t@simpleTextData = NQXML::Text.new('text')\n\t@simpleTagEnd = NQXML::Tag.new('simpleTag', nil, true, '</simpleTag>')\n\n\tattrs = Hash.new()\n\tattrs['a'] = 'tabs to spacesbletch'\n\t@innerTagStart = NQXML::Tag.new('inner:tag', attrs, false,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\n\t@innerTagEnd = NQXML::Tag.new('inner:tag', nil, true,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\t@pTagStart = NQXML::Tag.new('p', emptyAttrs, false, '<p>')\n\t@pTagEnd = NQXML::Tag.new('p', nil, true, '</p>')\n\t@bTagStart = NQXML::Tag.new('b', emptyAttrs, false, '<b>')\n\t@bTagEnd = NQXML::Tag.new('b', nil, true, '</b>')\n\t@textText = NQXML::Text.new('text ')\n\t@boldText = NQXML::Text.new('bold café coffee')\n\t@moreTextText = NQXML::Text.new(' more text')\n\n\t@cdata = NQXML::Text.new(\"xx<z&xx</\\nnewline in cdata\\n\",\n\t\t\t\t \"<![CDATA[xx<z&xx</\\nnewline in cdata\\n]]>\")\n\t@outerEnd = NQXML::Tag.new('outer', nil, true, '</outer>')\n\n\t@sub1_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE outer SYSTEM \"foobar\" [\n <!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>\n'\n\tsrc = '<!ENTITY example \"<p>An ampersand (&#38;) may be' +\n\t ' escaped numerically (&#38;#38;) or with a general entity' +\n\t ' (&amp;).</p> >'\n\tval = \"<p>An ampersand (&) may be escaped numerically\" +\n\t \" (&#38;) or with a general entity (&amp;).</p>\"\n\t@sub1Entity = NQXML::GeneralEntityTag.new('example', val, nil, nil,\n\t\t\t\t\t\t src)\n\t\t\t\t\t\t\n\t@sub2_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE test [\n<!ELEMENT test (#PCDATA) >\n<!ENTITY % xx \\'%zz;\\'>\n<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >\n%xx;\n]>\n<test>This sample shows a &tricky; method.</test>\n'\n\t@xxEntity =\n\t NQXML::ParameterEntityTag.new('xx', '%zz;', nil,\n\t\t\t\t\t '<!ENTITY % zz \\'%zz;\\'>')\n\n\tsrc = '<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >'\n\tval = '<!ENTITY tricky \"error-prone\" >'\n\t@zzEntity = NQXML::ParameterEntityTag.new('zz', val, nil, src)\n end",
"def from_node(node); end",
"def initialize\n @assertions = 0\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize( node )\n @node = node\n end",
"def initialize(nodes_fragement)\n @nodes_xml = nodes_fragement\n @children = set_children\n end",
"def initialize(_, context = Ramom::Schema::Definition::Context.new)\n super\n infer_base_relations\n end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#relation#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def test2b\n seq2b = deepcopy(SEQ2)\n res2b = deepcopy(RES2)\n seq2b[1][2] << ['xml:space','default']\n res2b['attributes'] << ['137','xml:space','default']\n check(seq2b, res2b, [1,3,7], {}, false)\n check(seq2b, res2b, [1,3,7], {}, true)\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node:)\n @node = node\n end",
"def initialize\n\t\t\tsuper\n\t\t\t@rubier = Ruby2Ruby.new # used to convert hash AST representations to Hash object\n\t\t\t@relations = {}\n\t\t\t@polymorphics\n\t\t\t@as = {}\n\t\tend",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(b, n, baths)\n @unit = b\n @num_beds = n\n @num_baths = baths\n @tenants = []\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(*args)\n super\n _rewire_dsl! if node\n end",
"def initialize(node)\n @root_node = node\n end",
"def initialize_node(options={})\n raise NotImplementedError\n end",
"def setup\n # setup node w/ attribute\n @crowbar = Barclamp.import_1x 'crowbar'\n assert_not_nil @crowbar\n assert_not_nil @crowbar.template\n assert_equal 2, @crowbar.template.role_instances.count\n @role = @crowbar.template.public_roles.first\n assert_not_nil @role\n \n @node1 = Node.find_or_create_by_name :name=>\"units.example.com\"\n @node2 = Node.find_or_create_by_name :name=>\"tests.example.com\"\n assert_not_nil @node1\n assert_not_nil @node2\n # manual assign\n @hasnode1 = BarclampCrowbar::AttribInstanceHasNode.create :role_instance_id=>@role.id, :node_id=>@node1.id\n assert_not_nil @hasnode1\n assert_instance_of BarclampCrowbar::AttribInstanceHasNode, @hasnode1\n assert @hasnode1.is_a? AttribInstance\n assert_equal HAS_NODE, @node1.attrib_instance_has_nodes.first.attrib.name\n assert_equal @role.id, @hasnode1.role_instance_id\n # Ruby 1.8 and 1.9 throws different exceptions in this case, so handle it\n # accordingly. Simplify once we remove 1.8 support.\n @error_class = (RUBY_VERSION == '1.8.7') ? NameError : ArgumentError\n end",
"def test_children\n #puts \"---------------test_children-----------------\"\n t= {}\n\n batch11 = MyResource.new :batch11\n batch12 = MyResource.new :batch12\n batch21 = MyResource.new :batch21\n batch22 = MyResource.new :batch22\n pos1 = MyResource.new :pos1, [ batch11, batch12 ]\n pos2 = MyResource.new :pos2, [ batch21, batch22 ]\n order = MyResource.new :order, [pos1, pos2]\n\n GraphBuilder::Builder.build do |b|\n t[:order] = [ b.add(Thing0.new(order)) ]\n \n b.children do |pos|\n t[pos.name] = b.add Thing1.new(pos)\n b.children do |batch|\n b1 = b.add Thing11.new(batch)\n b2 = b.add Thing12.new(batch)\n t[batch.name] = [b1, b2]\n end\n end\n t[:order] << b.add( Thing2.new(order))\n end\n\n r = Thing.links(t.values.flatten)\n assert_instance_of Thing0, t[:order].first\n assert_instance_of Thing2, t[:order].last\n assert_instance_of Thing1, t[:pos1]\n assert_instance_of Thing1, t[:pos2]\n assert_instance_of Thing11, t[:batch11].first\n assert_instance_of Thing12, t[:batch12].last\n assert_instance_of Thing11, t[:batch21].first\n assert_instance_of Thing12, t[:batch22].last\n\n assert r.include? [t[:order].first,t[:pos1]]\n assert r.include? [t[:order].first,t[:pos2]]\n assert r.include? [t[:pos1],t[:batch11].first]\n assert r.include? [t[:pos1],t[:batch12].first]\n assert r.include? [t[:pos2],t[:batch21].first]\n assert r.include? [t[:pos2],t[:batch22].first]\n assert r.include? [t[:batch11].first,t[:batch11].last]\n assert r.include? [t[:batch12].first,t[:batch12].last]\n assert r.include? [t[:batch21].first,t[:batch21].last]\n assert r.include? [t[:batch22].first,t[:batch22].last]\n assert r.include? [t[:batch11].last,t[:order].last]\n assert r.include? [t[:batch12].last,t[:order].last]\n assert r.include? [t[:batch21].last,t[:order].last]\n assert r.include? [t[:batch22].last,t[:order].last]\n\n assert_equal 14, r.size\n end",
"def initialize(o)\r\n @xml = o\r\n \r\n # map element names to methods, prolly not the best way to do this\r\n @xml.elements.each do |e|\r\n Mb_obj.class_eval(\"def #{e.name.to_s}() REXML::XPath.first(self.xml, \\\"#{e.name.to_s}).text\\\").text end\") \t \r\n end\r\n end",
"def initialize() end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#funding#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def test_empty_branch\n #puts \"---------------test_branch-----------------\"\n t1 = t2 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2])\n assert_equal 1, r.size\n assert r.include? [t1,t2]\n end",
"def initialize(*args)\n super\n @value = @args.first\n @blocks = {}\n @current_case = nil\n @default = NodeList.new(self)\n end",
"def node=(_arg0); end",
"def initialize(node)\n self.node = node\n self.title = node['title']\n self.author = node['author']\n self.url = node['url']\n end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#person#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def initialize(data)\n @node_data = data\n end",
"def initialize node, page\n\t\t@node = node\n\t\t@page = page\n\t\t@mech = page.mech\n\tend",
"def initialize(children = [], properties = {})\n super(DocumentProperty.ast_type, children, properties)\n end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#nested_#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def initialize_element\n end",
"def initialize_from_element!\n end",
"def test_truth\n assert nodes(:draft_1)\n end",
"def initialize(children = [], properties = {})\n super(Relationship.ast_type, children, properties)\n end",
"def initialize(xml_elem)\n @name = xml_elem.attributes['name']\n @num_bins = xml_elem.attributes['num-bins'].to_i\n @range_min = xml_elem.attributes['min'].to_f\n @range_max = xml_elem.attributes['max'].to_f\n @title = xml_elem.attributes['title']\n end",
"def initialize(attributes = {})\n super(attributes)\n parse_booleans\n end",
"def initialize(height, branching_factor, approx)\n @height = height #get inputs\n @height_count = height\n @branching_factor = branching_factor#get inputs\n @approx = approx#get inputs\n @node_array = []#initialise empty array of nodes\n @node_type = true # set to build daughters first\n get_t_value#get random t_value\n @root_node = RootNode.new\n @root_node.t_value = @t_value # give starting t value to buid tree from\n @node_array << @root_node# to be checked in further building of tree\n build_connecting_nodes(@root_node,@branching_factor)#build first daughters\n @node_type = !@node_type #change to enter next values of interior nodes\n @height_count = @height_count-1 #one layer done\n build_rest_of_tree()\n end",
"def bnode(value = nil)\n @@bnode_cache ||= {}\n @@bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def initialize(name, xml_attribute, rn, version, inp_out, mask,\n field_names, access, verbs)\n\n @name = name\n @xml_attribute = xml_attribute\n @rn = rn\n @version = version\n @inp_out = inp_out\n @mask = mask\n @field_names = field_names\n @access = access\n #@children = children\n #@parents = parents\n @verbs = verbs\n end",
"def initialize(node)\n @node = node # the @ symbol makes is an instance variable Which means you can access these variables in ANY METHOD inside the class.\n end",
"def initialize(run, xml)\n super(run, xml)\n\n @error = false\n @structure = parse_data(xml_first_child(xml))\n\n # cached outputs\n @values = nil\n @refs = nil\n @types = nil\n @sizes = nil\n @total_size = nil\n end",
"def initialize\n @first_node = nil\n end",
"def initialize(attributes)\n super\n end",
"def initialize\n @nodes = []\n end",
"def test_initialize\n assert_not_nil(@root, \"Binary tree's Root should have been created\")\n assert_nil(@root.left_child, \"The initial left child of root should be nil\")\n assert_nil(@root.right_child, \"The initial right child of root should be nil\")\n assert_equal(@root.children.size, 0, \"Initially no children should be present\")\n end",
"def initialize(children = [], properties = {})\n super(BlankLine.ast_type, children, properties)\n end",
"def initialize b\n @build = b\n end",
"def initialize(node)\n\t\t\t@title = node.find_first(\"T\").try(:content)\n\n\t\t\t# Fully qualified URL to the result.\n\t\t\t@link = node.find_first(\"UE\").try(:content)\n\n\t\t\t@description = node.find_first(\"S\").try(:content)\n\n #check for custom search description when not regular search result\n if @description.empty?\n @description = node.find_first(\".//BLOCK /T\").try(:content)\n end\n\t\tend",
"def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end",
"def initialize(data)\n if data[:schema] == \"dc\"\n @root_element = \"//metadata/dc\"\n elsif data[:schema] == \"mods\"\n @root_element = \"//mods\"\n else\n @root_element = data[:root_element]\n end\n\n @raw_data = data[:raw]\n end",
"def initialize(*args)\n\n @xmlStoreMap = nil\n @xmlTool = XMLDocumentHash.new\n @nodeValues = []\n @store = true\n @attributeElementName = nil\n @attributeName = nil\n @nodeAt = 0\n if(args.size == 2)\n initialize_2(args[0], args[1])\n else\n sess = HttpSession.new(123456)\n initialize_2(sess, \"<test/>\")\n end\n end",
"def initialize(attributes)\n super\n end",
"def initialize(*args)\n # was a neo java node provided ?\n if args.length == 1 && args[0].kind_of?(org.neo4j.graphdb.Node)\n # yes, it was loaded from the database\n init_with_node(args[0])\n elsif self.respond_to?(:init_node)\n # does the class provide an initialization method ?\n init_without_node({})\n init_node(*args)\n else\n # no, but maybe it had a hash of properties to initialize it with, create node\n init_without_node(args[0] || {})\n end\n # was a block given in order to initialize the neo4j node ?\n yield self if block_given?\n # must call super with no arguments so that chaining of the initialize method works\n super()\n end",
"def test_initialize\n assert_equal(@vertex.edges.length, 0)\n assert_instance_of(Vertex, @vertex)\n end",
"def initialize(nodes, keys, column_size)\n @nodes = nodes\n @column_size = column_size\n @keys = keys\n @body = ''\n end",
"def initialize\n @nodes = []\n end",
"def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(children = [], properties = {})\n super(Domain.ast_type, children, properties)\n end",
"def initialize(children = [], properties = {})\n super(NamespaceDefinition.ast_type, children, properties)\n end",
"def initialize node, page\n @node = node\n @page = page\n @mech = page.mech\n end",
"def initialize(document, lines, base)\n @document = document\n @lines = lines\n @base = base\n end",
"def initialize( &block )\n\t\t@variables = Set.new\n\t\t@constants = Set.new\n\t\t@axiom = nil\n\t\t@rules = []\n\n\t\t@rules_as_hash = nil\n\n\t\tself.instance_eval( &block ) if block\n\tend",
"def initialize\n @generated = false\n @test_response = false\n end",
"def initialize(an, bn, tn, data=nil)\n @bn = bn\n super(an, tn, data)\n end",
"def initialize(node, twine)\n @twine = twine\n @start = false\n @id = node['pid']\n @name = node['name']\n @tags = node['tags']\n @x = @y = nil\n if node.key?('position')\n @x, @y = node['position'].split(',').map {|e| e.to_i}\n end\n @body = node.text\n @links = []\n end",
"def initialize(children = [], properties = {})\n super(Uri.ast_type, children, properties)\n end",
"def initialize(nodes, edges)\n super()\n self.nodes = nodes\n self.edges = edges.map { |e| Edge.new(e[0], e[1], e[2]) }\n\n self.build\n end",
"def initialize(*nodes, attributes: {}, infos: nil)\n\t\t\t@nodes=[]\n\t\t\t# a node can be a Hash or a Node\n\t\t\t# so nodes really is a list of subgraphs\n\t\t\tbuild(*nodes, attributes: attributes, infos: infos)\n\t\tend",
"def initialize(content)\n @content = Aspen::AST::Nodes::Content.new(content)\n end",
"def initialize(node, attrs={})\n @node = node\n\n @attributes = {tag: node.name}\n ATTRIBUTES.each do |k|\n if node.key?(k.to_s)\n attributes[k] = node[k]\n end\n end\n update_attributes(attrs)\n end",
"def initialize node\n raise ArgumentError, \"Expected SGF::Node argument but received #{node.class}\" unless node.instance_of? SGF::Node\n @root = node\n @current_node = node\n end",
"def initialize(doc); end",
"def initialize(view_context, node_name)\n @node_name = node_name\n super(view_context)\n binding.pry\n end",
"def initialize\n\t\t@nodes = []\n\tend",
"def initialize(xml_node, instance: nil)\n @xml_node = xml_node\n @instance = instance\n end",
"def initialize\n \n end",
"def initialize_xml(xml, root_element)\n @xml = XMLElement.build_xml(xml, root_element)\n\n if OpenNebula.is_error?(@xml)\n @xml = nil\n else\n if NOKOGIRI\n if @xml.size == 0\n @xml = nil\n end\n else\n if @xml.name != root_element\n @xml = nil\n end\n end\n end\n @xml\n end"
] |
[
"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.54869807",
"0.54869807",
"0.5485869",
"0.54637593",
"0.54547167",
"0.54547167",
"0.54257196",
"0.54186034",
"0.54186034",
"0.54186034",
"0.54154676",
"0.54132587",
"0.54110056",
"0.53592163",
"0.53448516",
"0.53413546",
"0.53389806",
"0.533453",
"0.53307915",
"0.53217584",
"0.53207976",
"0.5318646",
"0.5314774",
"0.5313864",
"0.52999765",
"0.5286175",
"0.52755773",
"0.5271068",
"0.5267799",
"0.5267137",
"0.5257121",
"0.52310485",
"0.52308685",
"0.5225551",
"0.52226925",
"0.5221882",
"0.5219538",
"0.5217753",
"0.5212532",
"0.52110785",
"0.52066976",
"0.52029264",
"0.51930386",
"0.5192061",
"0.5190767",
"0.5188534",
"0.5183053",
"0.51767087",
"0.5173238",
"0.51719767",
"0.51707864",
"0.51704395",
"0.5168201",
"0.51665",
"0.51665",
"0.51665",
"0.51659733",
"0.51659733",
"0.51659733",
"0.51659733",
"0.51659733",
"0.5163652",
"0.515973",
"0.5158479",
"0.5157665",
"0.5149055",
"0.51475036",
"0.5146394",
"0.5141707",
"0.5141227",
"0.5133231",
"0.51324695",
"0.5130095",
"0.5128383",
"0.5128226",
"0.51282114",
"0.5125282",
"0.5125214",
"0.51247406",
"0.5121834",
"0.51148957"
] |
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",
"def test_initialize_objects\n\t# assert_equal @w.nodes, 0\n\t# assert_equal @w.validWordList, 0\n\tassert_kind_of Graph, @w \n\tassert_kind_of Node, @n\n end",
"def init_node\n end",
"def init_node\n end",
"def initialize(node, discount_repeated_attributes: T.unsafe(nil)); end",
"def initialize(attrs = {})\n attrs.stringify_keys!\n @nodes = []\n super(attrs)\n end",
"def initialize\n\t@xml = '<?xml version=\"1.0\"?>\n<?misc:processingInstruction \"with arguments\"?>\n<?other:piNoArgs ?>\n<!DOCTYPE outer PUBLIC \"public id\" \"foobar\" [\n <!ENTITY foo \"bletch\">\n <!ELEMENT el>\n <!ATTLIST el EMPTY>\n <!NOTATION notation ignored>\n]>\n<!-- comment -->\n<outer>\n data&&foo;\nmore on next line<simpleTag>text</simpleTag>\n<inner:tag a=\"tabs\tto\tspaces&foo;\"/><![CDATA[xx<z&xx</\nnewline in cdata\n]]>\n<p>text <b>bold café coffee</b> more text</p>\n</outer>'\n\n\temptyAttrs = Hash.new()\n\t@newlineTok = NQXML::Text.new(\"\\n\")\n\n\tattrs = Hash.new()\n\tattrs['version'] = '1.0'\n\t@xmlDecl = NQXML::XMLDecl.new('xml', attrs, '<?xml version=\"1.0\"?>')\n\n\tsrc = '<?misc:processingInstruction \"with arguments\"?>'\n\t@piWithArgs =\n\t NQXML::ProcessingInstruction.new('misc:processingInstruction',\n\t\t\t\t\t '\"with arguments\"', src)\n\n\t@piNoArgs = NQXML::ProcessingInstruction.new('other:piNoArgs', '',\n\t\t\t\t\t\t '<?other:piNoArgs ?>')\n\n\t@entityTag =\n\t NQXML::GeneralEntityTag.new('foo', 'bletch', nil, nil,\n\t\t\t\t\t'<!ENTITY foo \"bletch\">')\n\t@element = NQXML::Element.new('el', '', '<!ELEMENT el>')\n\t@attlist = NQXML::Attlist.new('el', 'EMPTY', '<!ATTLIST el EMPTY>')\n\t@notation = NQXML::Notation.new('notation', 'ignored',\n\t\t\t\t\t'<!NOTATION notation ignored>')\n\t@doctypePubid =\n\t NQXML::PublicExternalID.new('\"public id\"', '\"foobar\"',\n\t\t\t\t\t'PUBLIC \"public id\" \"foobar\"')\n\t@doctype =\n\t NQXML::Doctype.new('outer', @doctypePubid,\n\t\t\t [@entityTag, @element, @attlist, @notation],\n\t\t\t \"<!DOCTYPE outer PUBLIC \\\"public id\\\" \\\"foobar\\\" [\\n\" +\n\t\t\t \" <!ENTITY foo \\\"bletch\\\">\\n\" +\n\t\t\t \" <!ELEMENT el>\\n\" +\n\t\t\t \" <!ATTLIST el EMPTY>\\n\" +\n\t\t\t \" <!NOTATION notation ignored>\\n\" +\n\t\t\t \"]>\")\n\n\t@comment = NQXML::Comment.new('<!-- comment -->')\n\t@outerStart = NQXML::Tag.new('outer', emptyAttrs, false, '<outer>')\n\t@textDataWithSub = NQXML::Text.new(\"\\n data&bletch\\nmore on next line\")\n\t@simpleTagStart = NQXML::Tag.new('simpleTag', emptyAttrs, false,\n\t\t\t\t\t '<simpleTag>')\n\t@simpleTextData = NQXML::Text.new('text')\n\t@simpleTagEnd = NQXML::Tag.new('simpleTag', nil, true, '</simpleTag>')\n\n\tattrs = Hash.new()\n\tattrs['a'] = 'tabs to spacesbletch'\n\t@innerTagStart = NQXML::Tag.new('inner:tag', attrs, false,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\n\t@innerTagEnd = NQXML::Tag.new('inner:tag', nil, true,\n\t\t\t\t\t'<inner:tag a=\"tabs\tto\tspaces&foo;\"/>')\n\t@pTagStart = NQXML::Tag.new('p', emptyAttrs, false, '<p>')\n\t@pTagEnd = NQXML::Tag.new('p', nil, true, '</p>')\n\t@bTagStart = NQXML::Tag.new('b', emptyAttrs, false, '<b>')\n\t@bTagEnd = NQXML::Tag.new('b', nil, true, '</b>')\n\t@textText = NQXML::Text.new('text ')\n\t@boldText = NQXML::Text.new('bold café coffee')\n\t@moreTextText = NQXML::Text.new(' more text')\n\n\t@cdata = NQXML::Text.new(\"xx<z&xx</\\nnewline in cdata\\n\",\n\t\t\t\t \"<![CDATA[xx<z&xx</\\nnewline in cdata\\n]]>\")\n\t@outerEnd = NQXML::Tag.new('outer', nil, true, '</outer>')\n\n\t@sub1_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE outer SYSTEM \"foobar\" [\n <!ENTITY example \"<p>An ampersand (&#38;) may be escaped numerically (&#38;#38;) or with a general entity (&amp;).</p>\" >\n]>\n'\n\tsrc = '<!ENTITY example \"<p>An ampersand (&#38;) may be' +\n\t ' escaped numerically (&#38;#38;) or with a general entity' +\n\t ' (&amp;).</p> >'\n\tval = \"<p>An ampersand (&) may be escaped numerically\" +\n\t \" (&#38;) or with a general entity (&amp;).</p>\"\n\t@sub1Entity = NQXML::GeneralEntityTag.new('example', val, nil, nil,\n\t\t\t\t\t\t src)\n\t\t\t\t\t\t\n\t@sub2_xml = '<?xml version=\"1.0\"?>\n<!DOCTYPE test [\n<!ELEMENT test (#PCDATA) >\n<!ENTITY % xx \\'%zz;\\'>\n<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >\n%xx;\n]>\n<test>This sample shows a &tricky; method.</test>\n'\n\t@xxEntity =\n\t NQXML::ParameterEntityTag.new('xx', '%zz;', nil,\n\t\t\t\t\t '<!ENTITY % zz \\'%zz;\\'>')\n\n\tsrc = '<!ENTITY % zz \\'<!ENTITY tricky \"error-prone\" >\\' >'\n\tval = '<!ENTITY tricky \"error-prone\" >'\n\t@zzEntity = NQXML::ParameterEntityTag.new('zz', val, nil, src)\n end",
"def from_node(node); end",
"def initialize\n @assertions = 0\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize( node )\n @node = node\n end",
"def initialize(nodes_fragement)\n @nodes_xml = nodes_fragement\n @children = set_children\n end",
"def initialize(_, context = Ramom::Schema::Definition::Context.new)\n super\n infer_base_relations\n end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#relation#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def test2b\n seq2b = deepcopy(SEQ2)\n res2b = deepcopy(RES2)\n seq2b[1][2] << ['xml:space','default']\n res2b['attributes'] << ['137','xml:space','default']\n check(seq2b, res2b, [1,3,7], {}, false)\n check(seq2b, res2b, [1,3,7], {}, true)\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(node:)\n @node = node\n end",
"def initialize\n\t\t\tsuper\n\t\t\t@rubier = Ruby2Ruby.new # used to convert hash AST representations to Hash object\n\t\t\t@relations = {}\n\t\t\t@polymorphics\n\t\t\t@as = {}\n\t\tend",
"def initialize(node)\n @node = node\n end",
"def initialize(node)\n @node = node\n end",
"def initialize(b, n, baths)\n @unit = b\n @num_beds = n\n @num_baths = baths\n @tenants = []\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(xml_node)\n @xml = xml_node\n end",
"def initialize(*args)\n super\n _rewire_dsl! if node\n end",
"def initialize(node)\n @root_node = node\n end",
"def initialize_node(options={})\n raise NotImplementedError\n end",
"def setup\n # setup node w/ attribute\n @crowbar = Barclamp.import_1x 'crowbar'\n assert_not_nil @crowbar\n assert_not_nil @crowbar.template\n assert_equal 2, @crowbar.template.role_instances.count\n @role = @crowbar.template.public_roles.first\n assert_not_nil @role\n \n @node1 = Node.find_or_create_by_name :name=>\"units.example.com\"\n @node2 = Node.find_or_create_by_name :name=>\"tests.example.com\"\n assert_not_nil @node1\n assert_not_nil @node2\n # manual assign\n @hasnode1 = BarclampCrowbar::AttribInstanceHasNode.create :role_instance_id=>@role.id, :node_id=>@node1.id\n assert_not_nil @hasnode1\n assert_instance_of BarclampCrowbar::AttribInstanceHasNode, @hasnode1\n assert @hasnode1.is_a? AttribInstance\n assert_equal HAS_NODE, @node1.attrib_instance_has_nodes.first.attrib.name\n assert_equal @role.id, @hasnode1.role_instance_id\n # Ruby 1.8 and 1.9 throws different exceptions in this case, so handle it\n # accordingly. Simplify once we remove 1.8 support.\n @error_class = (RUBY_VERSION == '1.8.7') ? NameError : ArgumentError\n end",
"def test_children\n #puts \"---------------test_children-----------------\"\n t= {}\n\n batch11 = MyResource.new :batch11\n batch12 = MyResource.new :batch12\n batch21 = MyResource.new :batch21\n batch22 = MyResource.new :batch22\n pos1 = MyResource.new :pos1, [ batch11, batch12 ]\n pos2 = MyResource.new :pos2, [ batch21, batch22 ]\n order = MyResource.new :order, [pos1, pos2]\n\n GraphBuilder::Builder.build do |b|\n t[:order] = [ b.add(Thing0.new(order)) ]\n \n b.children do |pos|\n t[pos.name] = b.add Thing1.new(pos)\n b.children do |batch|\n b1 = b.add Thing11.new(batch)\n b2 = b.add Thing12.new(batch)\n t[batch.name] = [b1, b2]\n end\n end\n t[:order] << b.add( Thing2.new(order))\n end\n\n r = Thing.links(t.values.flatten)\n assert_instance_of Thing0, t[:order].first\n assert_instance_of Thing2, t[:order].last\n assert_instance_of Thing1, t[:pos1]\n assert_instance_of Thing1, t[:pos2]\n assert_instance_of Thing11, t[:batch11].first\n assert_instance_of Thing12, t[:batch12].last\n assert_instance_of Thing11, t[:batch21].first\n assert_instance_of Thing12, t[:batch22].last\n\n assert r.include? [t[:order].first,t[:pos1]]\n assert r.include? [t[:order].first,t[:pos2]]\n assert r.include? [t[:pos1],t[:batch11].first]\n assert r.include? [t[:pos1],t[:batch12].first]\n assert r.include? [t[:pos2],t[:batch21].first]\n assert r.include? [t[:pos2],t[:batch22].first]\n assert r.include? [t[:batch11].first,t[:batch11].last]\n assert r.include? [t[:batch12].first,t[:batch12].last]\n assert r.include? [t[:batch21].first,t[:batch21].last]\n assert r.include? [t[:batch22].first,t[:batch22].last]\n assert r.include? [t[:batch11].last,t[:order].last]\n assert r.include? [t[:batch12].last,t[:order].last]\n assert r.include? [t[:batch21].last,t[:order].last]\n assert r.include? [t[:batch22].last,t[:order].last]\n\n assert_equal 14, r.size\n end",
"def initialize(o)\r\n @xml = o\r\n \r\n # map element names to methods, prolly not the best way to do this\r\n @xml.elements.each do |e|\r\n Mb_obj.class_eval(\"def #{e.name.to_s}() REXML::XPath.first(self.xml, \\\"#{e.name.to_s}).text\\\").text end\") \t \r\n end\r\n end",
"def initialize() end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#funding#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def test_empty_branch\n #puts \"---------------test_branch-----------------\"\n t1 = t2 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.branch do \n end\n t2 = b.add(Thing2.new)\n end\n\n r = Thing.links([t1,t2])\n assert_equal 1, r.size\n assert r.include? [t1,t2]\n end",
"def initialize(*args)\n super\n @value = @args.first\n @blocks = {}\n @current_case = nil\n @default = NodeList.new(self)\n end",
"def node=(_arg0); end",
"def initialize(node)\n self.node = node\n self.title = node['title']\n self.author = node['author']\n self.url = node['url']\n end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#person#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def initialize(data)\n @node_data = data\n end",
"def initialize node, page\n\t\t@node = node\n\t\t@page = page\n\t\t@mech = page.mech\n\tend",
"def initialize(children = [], properties = {})\n super(DocumentProperty.ast_type, children, properties)\n end",
"def initialize(uri, parent)\n if uri.try(:node?)\n uri = RDF::URI(\"#nested_#{uri.to_s.gsub('_:', '')}\")\n elsif uri.start_with?(\"#\")\n uri = RDF::URI(uri)\n end\n super\n end",
"def initialize_element\n end",
"def initialize_from_element!\n end",
"def test_truth\n assert nodes(:draft_1)\n end",
"def initialize(children = [], properties = {})\n super(Relationship.ast_type, children, properties)\n end",
"def initialize(attributes = {})\n super(attributes)\n parse_booleans\n end",
"def initialize(xml_elem)\n @name = xml_elem.attributes['name']\n @num_bins = xml_elem.attributes['num-bins'].to_i\n @range_min = xml_elem.attributes['min'].to_f\n @range_max = xml_elem.attributes['max'].to_f\n @title = xml_elem.attributes['title']\n end",
"def initialize(height, branching_factor, approx)\n @height = height #get inputs\n @height_count = height\n @branching_factor = branching_factor#get inputs\n @approx = approx#get inputs\n @node_array = []#initialise empty array of nodes\n @node_type = true # set to build daughters first\n get_t_value#get random t_value\n @root_node = RootNode.new\n @root_node.t_value = @t_value # give starting t value to buid tree from\n @node_array << @root_node# to be checked in further building of tree\n build_connecting_nodes(@root_node,@branching_factor)#build first daughters\n @node_type = !@node_type #change to enter next values of interior nodes\n @height_count = @height_count-1 #one layer done\n build_rest_of_tree()\n end",
"def initialize(name, xml_attribute, rn, version, inp_out, mask,\n field_names, access, verbs)\n\n @name = name\n @xml_attribute = xml_attribute\n @rn = rn\n @version = version\n @inp_out = inp_out\n @mask = mask\n @field_names = field_names\n @access = access\n #@children = children\n #@parents = parents\n @verbs = verbs\n end",
"def bnode(value = nil)\n @@bnode_cache ||= {}\n @@bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def initialize(node)\n @node = node # the @ symbol makes is an instance variable Which means you can access these variables in ANY METHOD inside the class.\n end",
"def initialize(run, xml)\n super(run, xml)\n\n @error = false\n @structure = parse_data(xml_first_child(xml))\n\n # cached outputs\n @values = nil\n @refs = nil\n @types = nil\n @sizes = nil\n @total_size = nil\n end",
"def initialize(attributes)\n super\n end",
"def initialize\n @first_node = nil\n end",
"def initialize\n @nodes = []\n end",
"def test_initialize\n assert_not_nil(@root, \"Binary tree's Root should have been created\")\n assert_nil(@root.left_child, \"The initial left child of root should be nil\")\n assert_nil(@root.right_child, \"The initial right child of root should be nil\")\n assert_equal(@root.children.size, 0, \"Initially no children should be present\")\n end",
"def initialize(children = [], properties = {})\n super(BlankLine.ast_type, children, properties)\n end",
"def initialize b\n @build = b\n end",
"def initialize(node)\n\t\t\t@title = node.find_first(\"T\").try(:content)\n\n\t\t\t# Fully qualified URL to the result.\n\t\t\t@link = node.find_first(\"UE\").try(:content)\n\n\t\t\t@description = node.find_first(\"S\").try(:content)\n\n #check for custom search description when not regular search result\n if @description.empty?\n @description = node.find_first(\".//BLOCK /T\").try(:content)\n end\n\t\tend",
"def test2\n uri = 'http://dbhack1.nescent.org/cgi-bin/phylows.pl/phylows/tree/TB:1999'\n # @x = Net::HTTP.get_response(URI.parse(uri)).body\n @d = Nexml::Document.new(:url => uri)\n end",
"def initialize(data)\n if data[:schema] == \"dc\"\n @root_element = \"//metadata/dc\"\n elsif data[:schema] == \"mods\"\n @root_element = \"//mods\"\n else\n @root_element = data[:root_element]\n end\n\n @raw_data = data[:raw]\n end",
"def initialize(*args)\n\n @xmlStoreMap = nil\n @xmlTool = XMLDocumentHash.new\n @nodeValues = []\n @store = true\n @attributeElementName = nil\n @attributeName = nil\n @nodeAt = 0\n if(args.size == 2)\n initialize_2(args[0], args[1])\n else\n sess = HttpSession.new(123456)\n initialize_2(sess, \"<test/>\")\n end\n end",
"def initialize(attributes)\n super\n end",
"def initialize(*args)\n # was a neo java node provided ?\n if args.length == 1 && args[0].kind_of?(org.neo4j.graphdb.Node)\n # yes, it was loaded from the database\n init_with_node(args[0])\n elsif self.respond_to?(:init_node)\n # does the class provide an initialization method ?\n init_without_node({})\n init_node(*args)\n else\n # no, but maybe it had a hash of properties to initialize it with, create node\n init_without_node(args[0] || {})\n end\n # was a block given in order to initialize the neo4j node ?\n yield self if block_given?\n # must call super with no arguments so that chaining of the initialize method works\n super()\n end",
"def test_initialize\n assert_equal(@vertex.edges.length, 0)\n assert_instance_of(Vertex, @vertex)\n end",
"def initialize(nodes, keys, column_size)\n @nodes = nodes\n @column_size = column_size\n @keys = keys\n @body = ''\n end",
"def initialize\n @nodes = []\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(children = [], properties = {})\n super(Domain.ast_type, children, properties)\n end",
"def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end",
"def initialize(children = [], properties = {})\n super(NamespaceDefinition.ast_type, children, properties)\n end",
"def initialize(document, lines, base)\n @document = document\n @lines = lines\n @base = base\n end",
"def initialize node, page\n @node = node\n @page = page\n @mech = page.mech\n end",
"def initialize( &block )\n\t\t@variables = Set.new\n\t\t@constants = Set.new\n\t\t@axiom = nil\n\t\t@rules = []\n\n\t\t@rules_as_hash = nil\n\n\t\tself.instance_eval( &block ) if block\n\tend",
"def initialize\n @generated = false\n @test_response = false\n end",
"def initialize(an, bn, tn, data=nil)\n @bn = bn\n super(an, tn, data)\n end",
"def initialize(children = [], properties = {})\n super(Uri.ast_type, children, properties)\n end",
"def initialize(node, twine)\n @twine = twine\n @start = false\n @id = node['pid']\n @name = node['name']\n @tags = node['tags']\n @x = @y = nil\n if node.key?('position')\n @x, @y = node['position'].split(',').map {|e| e.to_i}\n end\n @body = node.text\n @links = []\n end",
"def initialize(nodes, edges)\n super()\n self.nodes = nodes\n self.edges = edges.map { |e| Edge.new(e[0], e[1], e[2]) }\n\n self.build\n end",
"def initialize(*nodes, attributes: {}, infos: nil)\n\t\t\t@nodes=[]\n\t\t\t# a node can be a Hash or a Node\n\t\t\t# so nodes really is a list of subgraphs\n\t\t\tbuild(*nodes, attributes: attributes, infos: infos)\n\t\tend",
"def initialize(content)\n @content = Aspen::AST::Nodes::Content.new(content)\n end",
"def initialize(doc); end",
"def initialize(node, attrs={})\n @node = node\n\n @attributes = {tag: node.name}\n ATTRIBUTES.each do |k|\n if node.key?(k.to_s)\n attributes[k] = node[k]\n end\n end\n update_attributes(attrs)\n end",
"def initialize node\n raise ArgumentError, \"Expected SGF::Node argument but received #{node.class}\" unless node.instance_of? SGF::Node\n @root = node\n @current_node = node\n end",
"def initialize(view_context, node_name)\n @node_name = node_name\n super(view_context)\n binding.pry\n end",
"def initialize\n\t\t@nodes = []\n\tend",
"def initialize(xml_node, instance: nil)\n @xml_node = xml_node\n @instance = instance\n end",
"def initialize\n \n end",
"def initialize(expr)\n @expr = expr\n super()\n end"
] |
[
"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.5488077",
"0.5488077",
"0.54868245",
"0.5466174",
"0.5455863",
"0.5455863",
"0.54265124",
"0.5419701",
"0.5419701",
"0.5419701",
"0.5417164",
"0.54143053",
"0.5412426",
"0.53596693",
"0.5343558",
"0.53424567",
"0.5341871",
"0.53354585",
"0.53290063",
"0.5323172",
"0.5321248",
"0.5319471",
"0.5315747",
"0.5314932",
"0.5300395",
"0.52879345",
"0.5276478",
"0.5272666",
"0.5268699",
"0.52664596",
"0.52583855",
"0.5232971",
"0.523261",
"0.5226743",
"0.52242935",
"0.5221199",
"0.5220784",
"0.5219318",
"0.52140844",
"0.52127284",
"0.52074933",
"0.5204079",
"0.51945966",
"0.5193444",
"0.5191054",
"0.51881903",
"0.5183922",
"0.51784396",
"0.51761466",
"0.51727086",
"0.51723737",
"0.5171982",
"0.5168923",
"0.51687825",
"0.51687825",
"0.51687825",
"0.51687825",
"0.51687825",
"0.5165133",
"0.51649725",
"0.51649725",
"0.51649725",
"0.516142",
"0.5160095",
"0.51583505",
"0.515047",
"0.5149113",
"0.51480347",
"0.5142475",
"0.5142005",
"0.5133992",
"0.5132997",
"0.5131251",
"0.5130477",
"0.5129573",
"0.51295394",
"0.5126436",
"0.5126184",
"0.5125403",
"0.51245666",
"0.5116443"
] |
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.packages)\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend",
"def index\n @page_rates = PageRate.all\n end",
"def rates_for_usd\n rates_for 'USD'\n end",
"def get_consumer_rate(options={})\n post 'rates', options.merge(rate_filter: 'consumer')\n end",
"def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end",
"def refresh_rates\n read_from_url\n end",
"def get_rate(id:)\n @client.http_get(\"/#{@resource}/#{id}/rate\")\n end",
"def update\n respond_to do |format|\n if @rate_up.update(rate_up_params)\n format.html { redirect_to @rate_up, notice: 'Rate up was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate_up }\n else\n format.html { render :edit }\n format.json { render json: @rate_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fetch_rate(from, to, args = {})\n from = Money::Currency.wrap(from)\n to = Money::Currency.wrap(to)\n uri = build_uri(from, to, args)\n\n data = JSON.parse(uri.read)\n\n rate = data.fetch(\"rates\").fetch(to.iso_code)\n rate = 1 / extract_rate(build_uri(to, from).read) if rate < 0.1\n rate\n end",
"def fetch_rate(from, to)\n uri = build_uri(from, to)\n data = perform_request(uri)\n extract_rate(data)\n end",
"def rate_up_params\n params.require(:rate_up).permit(:user_id, :review_id)\n end",
"def index\n @users = User.all\n @rates = Value.group(:user_id).count(:value)\n end",
"def to_see\n @rates = Rate.all\n end",
"def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\n end",
"def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end",
"def rates\n @rates + [rate]\n end",
"def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end",
"def rate; end",
"def rate; end",
"def rates(options)\n self.class.bridge.hotel_details(hotel_chain, hotel_code, options).try(:hotel_rate_details) || []\n end",
"def message_rate\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'vhosts', Conn[:vhost]].join('/')} | jq '.messages_details.rate'`\n end",
"def rate_limit_status\n get('/account/rate_limit_status.json')\n end",
"def show\n @shop = Shop.find(params[:id])\n @rates = @shop.rates.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def actual_rate\n retrying_num = 0\n begin\n logger.info('Try to get rate JSON')\n json = JSON.parse(open(URL_FOR_UPDATE, read_timeout: TIMEOUT_SEC).read)\n logger.info('JSON was get successful')\n json['rates']['RUB']\n rescue StandardError\n retrying_num += 1\n logger.info(\"JSON was not download, retry #{retrying_num}\")\n if retrying_num >= MAX_RETRYING_OPEN\n return CurrencyRate.current_online_rate.rate\n end\n retry\n end\n end",
"def query_jurisdiction_rates(options={})\n path = \"/api/v2/compliance/jurisdictionrates\"\n get(path, options)\n end",
"def rate\n return @rate\n end",
"def currency_rates\n response['rates'][currency.target_currency.to_s]\n end",
"def fetch_rates\n rates = {}\n begin\n if @force_expire\n Timeout.timeout(60) do\n doc = Hpricot.XML(open('http://themoneyconverter.com/USD/rss.xml'))\n (doc/:item).each do |item|\n country = (item/:title).inner_html.split('/')[0]\n conversion_match = (item/:description).inner_html[/=.?(\\d+\\.?\\d*)/]\n # 1 USD country rate 'in USD'\n rates[country] = 1.0 / $1.to_f\n end\n rates.update({'USD' => 1.0})\n persist_rates(rates)\n end\n else\n rates = fetch_persisted_rates\n end\n rescue Exception\n rates = fetch_persisted_rates\n end\n rates\n end",
"def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end",
"def rates **_opts\n raise NotImplementedError\n end",
"def interest_rate\n params['interest_rate'] = params['interest_rate'].to_f\n\n old_rate = @@interest_rate\n @@interest_rate = params['interest_rate']\n json_response(old_rate: old_rate, new_rate: @@interest_rate)\n end",
"def index\n @user_question_rates = UserQuestionRate.all\n end",
"def usd_rate\n clean(Typhoeus::Request.get('https://wts.zold.io/usd_rate')).body.to_f\n end",
"def rate\n post('InternetDocument', 'getDocumentPrice', params)['data'][0]['Cost'].to_i\n end",
"def show\r\n @exchange_rates = get_latest\r\n end",
"def provision_rates\n @brands = Brand.with_package_sets\n @services = Service.active.where(:default_referrer_rate.gt => 0.0).order_by(name: :asc).all\n end",
"def rate_class\n super\n end",
"def rate_class\n super\n end",
"def index\n @admin_rates = Admin::Rate.all\n end",
"def index\n @user_replay_rates = UserReplayRate.all\n end",
"def report(rate_from:, rate_to:)\n body = @cache.fetch(rate_from + rate_to) do\n @cache[rate_from + rate_to] = open(url).read\n end\n data = JSON.parse(body)\n Report.new(1 / data['rates'][rate_from], 1 / data['rates'][rate_to])\n end",
"def upvotes\n @ups\n end",
"def upvotes\n @ups\n end",
"def rates\n @page_title = _('Sms_rates')\n #@page_icon = \"\"\n\n a=check_user_id_with_session(@tariff.owner_id)\n return false if !a\n @page_title = _('SMS_Rates_for_tariff') +\": \" + @tariff.name\n\n @st = \"A\"\n @st = params[:st].upcase if params[:st]\n\n @rates = @tariff.rates_by_st(@st, 0, 10000)\n @total_pages = (@rates.size.to_d / session[:items_per_page].to_d).ceil\n\n @page = 1\n @page = params[:page].to_i if params[:page]\n @page = @total_pages if @page > @total_pages\n\n @all_rates = @rates\n @rates = []\n\n iend = ((session[:items_per_page] * @page) - 1)\n iend = @all_rates.size - 1 if iend > (@all_rates.size - 1)\n for i in ((@page - 1) * session[:items_per_page])..iend\n @rates << @all_rates[i]\n end\n @rates = @rates.compact\n #----\n\n @use_lata = false\n @use_lata = true if @st == \"U\"\n\n\n @letter_select_header_id = @tariff.id\n @page_select_header_id = @tariff.id\n\n @dests = @tariff.free_destinations_by_st(@st)\n\n end",
"def get_rates(source)\n\t\t\trequire 'money/bank/open_exchange_rates_bank'\n\t\t\toxr = Money::Bank::OpenExchangeRatesBank.new\n\t\t\toxr.app_id = Rails.application.credentials.openexchangerates[:api_key]\n\t oxr.source = source\n\t oxr.update_rates\n\n\t oxr.cache = '/tmp/cache/exchange_rates.json'\n\t oxr.ttl_in_seconds = 86400\n\n\t return oxr.rates\n\t\tend",
"def get_min_rate(options={})\n post 'rates', options.merge(rate_filter: 'min_rate')\n end",
"def fetch_rate(from, to)\n\n from, to = Currency.wrap(from), Currency.wrap(to)\n\n data = build_uri(from, to)\n rate = extract_rate(data)\n\n rate\n\n end",
"def call_yts_api(count)\n\t \t\traw_data = RestClient.get BASE_URL, \n\t\t\t{ :params => \n\t\t\t\t{ :quality => '720p',\n\t\t\t\t :set => count,\n\t\t\t\t :limit => 50,\n\t\t\t\t :rating => 1,\n\t\t\t\t :sort => \"date\",\n\t\t\t\t :order => \"desc\" \n\t\t\t\t} \n\t\t\t}\n\t\t\tJSON.parse(raw_data)\n\t \tend",
"def rate=(value)\n @rate = value\n end",
"def breakdown\n @points = current_user.points.limit(5)\n render json: @points, status: 200\n end",
"def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end",
"def twitterapp_ratelimits\n\t\tTwitter.get('/1.1/application/rate_limit_status.json')[:body][:resources]\n\tend",
"def get_rate(from, to)\n if self.class.rates_careful\n get_rate_careful(from, to)\n else\n get_rate_straight(from, to)\n end\n end",
"def get_rate(date, base, target)\n uri = make_uri(date, base, target)\n data = get_cached_data(uri)\n data['rates'][target]\n end",
"def index\n @rate_services = RateService.all\n end",
"def ship_prices_for(user)\r\n # package we are shipping\r\n package = Package.new(weight,\r\n [length, width, height],\r\n :units => :imperial)\r\n \r\n # where we are shipping from\r\n origin = Location.new(:country => 'US',\r\n :state => 'NY',\r\n :address1 => '3399 North Rd.',\r\n :city => 'Poughkeepsie',\r\n :zip => '12601')\r\n \r\n # where we are shipping to the user\r\n destination = Location.new(:country => 'US',\r\n :state => user.state,\r\n :city => user.city,\r\n :zip => user.zipcode,\r\n :address1 => user.address)\r\n \r\n # ups api login\r\n ups = UPS.new(:login => 'KayoticSully', :password => 'WiivoUPS310', :key => 'DCA75091423BBDC8')\r\n # get the shipping rates\r\n response = ups.find_rates(origin, destination, package)\r\n # pull out only the data we need\r\n response.rates.sort_by(&:price).collect {|rate| [rate.service_name, rate.price]}\r\n end",
"def extract_rate(data)\n request_hash = JSON.parse(data)\n error = request_hash['error']\n raise JsonRatesRequestError, request_hash['error'] unless (error.nil? || error.empty?)\n BigDecimal.new(request_hash['rate'])\n end",
"def index\n # Setting URL\n url = \"https://v3.exchangerate-api.com/bulk/bd9e41491d3cbe08cc159344/USD\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n response_obj = JSON.parse(response)\n\n # Create an object to get an access from the view\n @rates = response_obj[\"rates\"]\n @currencies = response_obj[\"rates\"].keys\n\n # Format the currency before passed to javascript \n @formated_rates = Hash.new\n @rates.each { |currency, rate|\n @formated_rates[currency] = Money.new((@rates[currency]),currency).format\n }\n\n # Assign @rates object to gon object, so it can be used in the .js file \n gon.exchange_rate = @rates\n\n # To retrieve bank information\n @accounts = Account.all\n end",
"def get_rates(origin, destination, items, booking_type)\n base_url = \"http://www.e-go.com.au/calculatorAPI\"\n puts(\"origin EgoApiWrapper:get_rates is #{origin.class.to_s}\") if Rails.env.test?\n pickup = origin.postal_code\n delivery=destination.postal_code\n \n rates = Array.new\n items.each do |item|\n width=item[:width].to_f.round(0).to_i\n height=item[:height].to_f.round(0).to_i\n length=item[:length].to_f.round(0).to_i\n weight_grams=item[:grams].to_i\n weight_kg = (weight_grams.to_f / 1000).ceil\n quan = item[:quantity].to_i\n \n #only get rate for one box\n query = \"#{base_url}?pickup=#{pickup}&delivery=#{delivery}&type=Carton&width=#{width}&height=#{height}&depth=#{length}&weight=#{weight_kg.to_s}&items=1\"\n \n \n \n unless booking_type.blank?\n query+= \"&bookingtype=#{booking_type}\"\n end\n puts(\"Qeury is #{query}\")\n uri = URI.parse(query)\n \n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n\n response = http.request(request) \n \n ret = parse_response(response.body)\n \n ret[:price] = ret[:price].to_f * quan unless ret.nil?\n rates << ret unless ret.nil?\n end\n \n return_array = Array.new\n service_name =\"E-Go\"\n\n if (rates.empty?)\n return_array = [{\"service_name\" => \"ERROR getting rates from e-go\", 'service_code'=> \"E-go\", 'total_price' => 0.0, 'currency' => \"AUD\"}]\n else\n return_array = rates.collect{ |r| {\"service_name\" => \"#{service_name} (#{r[:eta]})\", 'service_code'=> r[:eta], 'total_price' => r[:price].to_f*100, 'currency' => \"AUD\"} }\n end\n puts(\"return_array is #{return_array.to_s}\") if Rails.env.test?\n \n return return_array \n end",
"def index\n ## store checkin-date and checkout-date\n $checkin_date = params[\"arrival_date\"] || \"\"\n $checkout_date = params[\"departure_date\"] || \"\"\n\n ## get currencies information\n @currencies = Currency.in_ague\n\n ## get nightly rates\n \n @money_sign = MONEY_SIGN[(!params[\"currencyCode\"].blank?) ? params[\"currencyCode\"] : DEFAUL_CURRENCY]\n ## get nightly rates\n @rate_filters = [\n {:name => \"Any Rate\", :value => \"-1\", :selected => 'selected'},\n {:name => \"#{@money_sign}1 - #{@money_sign}100\", :value => \"1-100\", :selected => ''},\n {:name => \"#{@money_sign}100 - #{@money_sign}200\", :value => \"100-200\", :selected => ''},\n {:name => \"#{@money_sign}200 - #{@money_sign}300\", :value => \"200-300\", :selected => ''},\n {:name => \"#{@money_sign}300 - #{@money_sign}500\", :value => \"300-500\", :selected => ''},\n {:name => \"#{@money_sign}500 - #{@money_sign}1000\", :value => \"500-1000\", :selected => ''},\n {:name => \"#{@money_sign}1000+\", :value => \"1000-999999999\", :selected => ''}\n ]\n\n\n ## get star filters\n @star_filters = [\n {:name => \"Any Star Rating\", :value => \"1\", :selected => 'selected'},\n {:name => \"2 Stars (and up)\", :value => \"2\", :selected => ''},\n {:name => \"3 Stars (and up)\", :value => \"3\", :selected => ''},\n {:name => \"4 Stars (and up)\", :value => \"4\", :selected => ''},\n {:name => \"5 Stars (and up)\", :value => \"5\", :selected => ''}\n ]\n ## get sort filters\n @sort_filters = [\n {:name => \"Price (Low to High)\", :value => \"PRICE\", :selected => ''},\n {:name => \"Price (High to Low)\", :value => \"PRICE_REVERSE\", :selected => ''},\n {:name => \"Star Rating (Low to High)\", :value => \"QUALITY_REVERSE\", :selected => ''},\n {:name => \"Star Rating (High to Low)\", :value => \"QUALITY\", :selected => 'true'}\n ]\n render \"index_new\"\n end",
"def trips_stats \n @all = current_user.trip_requests.trips.count\n @completed = current_user.trip_requests.trips.completed.count\n @cancelled = current_user.trip_requests.trips.cancelled.count\n @pending = current_user.trip_requests.trips.pending.count\n @on_going = current_user.trip_requests.trips.on_going.count\n @active = current_user.trip_requests.trips.active.count\n @monthly_successful = current_user.trip_requests.completed.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @monthly_pending = current_user.trip_requests.pending.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, monthly_pending:@monthly_pending, monthly_successful:@monthly_successful, pending: @pending, on_going: @on_going }\n json_response(@response)\n end",
"def pricing\n request('pricing', :get)\n end",
"def make_request\n if @test\n host = 'wwwcie.ups.com'\n else\n host = 'www.ups.com'\n end\n\n path = \"/ups.app/xml/Rate\"\n server = Net::HTTP.new(host, 443)\n data = @xml_pieces.collect{|p| p.to_s}.join(\"\\n\")\n if @debug\n File.open(@debug_request_path, 'w') do |file|\n file.puts data\n end\n end\n headers = { \"Content-Type\" => \"text/xml\"}\n server.use_ssl = true\n resp = server.post(path, data, headers)\n if @debug\n File.open(@debug_response_path, 'w') do |file|\n file.puts resp.body\n end\n end\n prices = parse_response(resp.body)\n end",
"def fetch_currency_rates\n begin\n application_currency_rates\n rescue Exception => e\n render :file => \"#{Rails.root}/public/404.html\", :status => :not_found\n end\n end",
"def vat_rates\n country.vat_rates\n end",
"def rateable\n self\n end",
"def index\n @pushups = current_user.pushups.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pushups }\n end\n end",
"def rate\n @training = Training.all.find(params[:id])\n Rate.create(user_id: current_user.id, training_id: @training.id)\n redirect_to training_path(@training)\n end",
"def index\n @ratecurries = Ratecurry.all.order(date_rate: :desc)\n end",
"def fetch_rate(code)\n currency_rates[code]\n end",
"def destroy\n @rate_up.destroy\n respond_to do |format|\n format.html { redirect_to rate_ups_url, notice: 'Rate up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @spending_rates = SpendingRate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spending_rates }\n end\n end",
"def load_rates(date)\n data = retrieve_rates date\n rate_snapshot = JSON.parse data\n exit 1 unless rate_snapshot['base'].downcase == 'usd' # TODO: better error handling\n\n rate_date = DateTime.strptime(rate_snapshot['timestamp'].to_s, '%s').to_date\n\n upload_usd_rates(rate_date, rate_snapshot['rates'])\n \n puts \"Updated rates for #{rate_date.to_s}\"\nend",
"def get_rate(currency_iso_from, currency_iso_to); end",
"def get_rate(from, to)\n expire_rates\n store.get_rate(from, to) || store.add_rate(from, to, fetch_rate(from, to))\n end",
"def get_rate(from, to)\n expire_rates\n store.get_rate(from, to) || store.add_rate(from, to, fetch_rate(from, to))\n end",
"def index\n session[:future] = params[:future] ? true : false\n session[:past] = params[:past] ? true : false\n\n future_rates = []\n now_rates = []\n past_rates = []\n\n current_date = Time.now.to_date\n\n Rate::RATES.each do |rate_symbol, r|\n rates = Rate.where(\"symbol = '#{rate_symbol}'\" ).order( 'effective_date_of DESC' )\n\n current = false\n\n rates.each do |rate|\n if rate.effective_date_of > current_date\n future_rates << { :rate => rate, :effective_date => :future }\n next\n end\n\n if rate.effective_date_of <= current_date and !current\n now_rates << { :rate => rate, :effective_date => :now }\n current = true\n next\n end\n\n if rate.effective_date_of <= current_date and current\n past_rates << { :rate => rate, :effective_date => :past }\n next\n end\n end\n end\n\n @rates = []\n\n @rates << future_rates if session[:future] \n @rates << now_rates\n @rates << past_rates if session[:past]\n\n @rates.flatten!\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rates }\n end\n end",
"def currency_rates\n @currency_rates = fetch_currency_rates\n end",
"def get_rate(from, to, opts = T.unsafe(nil)); end",
"def index\n @voip_costs = VoipCost.order(\"start_date desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @voip_costs }\n end\n end",
"def index\n @capitaria_rates = Rate.where(provider: 'Capitaria').order(created_at: :desc).limit(20)\n @yahoo_rates = Rate.where(provider: 'Yahoo').order(created_at: :desc).limit(20)\n @bloomberg_rates = Rate.where(provider: 'Bloomberg').order(created_at: :desc).limit(20)\n\n @capitaria_last_day_records = Rate.where(provider: 'Capitaria').where('created_at >= ?', 1.day.ago).count\n @yahoo_last_day_records = Rate.where(provider: 'Yahoo').where('created_at >= ?', 1.day.ago).count\n @bloomberg_last_day_records = Rate.where(provider: 'Bloomberg').where('created_at >= ?', 1.day.ago).count\n end",
"def get_exchange_rates(options = {})\n body = {\n cmd: \"rates\"\n }\n body[:short] = 1 if options[:short]\n body[:accepted] = 1 if options[:accepted]\n response = post body, openstruct: false\n if options[:accepted_only]\n response.to_h.delete_if { |_k, v| v[:accepted] == 0 }\n else\n response.to_h\n end\n end",
"def rate_limit_status(params)\n get \"account/rate_limit_status\", params\n end",
"def show\n @rate = Rate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rate }\n end\n end",
"def check_rates\n @countries = Rate.select(\"country_iso, country\").distinct(\"country_iso\").order(\"country asc\")\n\n unless find_params[:from].nil? && find_params[:to].nil?\n @inbound = Rate.where(\"direction=? and country_iso=?\", \"inbound\", find_params[:from]).take\n @outbound = Rate.where(\"direction=? and country_iso=?\", \"outbound\", find_params[:to]).take\n @number_rent = Rate.where(\"direction=? and country_iso=?\", \"inbound\", find_params[:to]).take\n\n @voice_rates = ((@inbound.voice_rate + @outbound.voice_rate) * Rate::TEHABLO_RATE_MULTIPLIER)\n @phone_rate = ((@number_rent.rent_per_number) * Rate::TEHABLO_RATE_MULTIPLIER)\n end\n\n end",
"def rate\n @story = Story.find(params[:id])\n if @story.rate_for_user(params[:rate], current_user)\n respond_to do |format|\n format.html { redirect_to(story_url(@story), :notice => 'Story was rated.') }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(story_url(@story), :notice => 'You have already rated.') }\n format.xml { head :ok }\n end\n end\n end",
"def show\n @rate_watcher = RateWatcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rate_watcher }\n end\n end",
"def index\n @area = Area.find(params[:area_id])\n @city = @area.city\n\n @rates = Rate.where(\"area_id = ?\",params[:area_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rates }\n end\n end",
"def fetch_rate(from, to)\n\n from, to = Currency.wrap(from), Currency.wrap(to)\n\n data = build_uri(from, to).read\n rate = extract_rate(data);\n\n if (rate < 0.1)\n rate = 1/extract_rate(build_uri(to, from).read)\n end\n\n rate\n\n end",
"def rate\n @route = Route.find(params[:id])\n @route.rate_all_dimensions(params[:rating], current_user)\n\n render :update do |page|\n page.hide \"rate\"\n page.replace \"rates\", :partial => \"shared/rates\", :locals => {:rated => @route}\n page.show \"rates\"\n page.visual_effect :highlight, \"rates\"\n page << javascript_rating(@route, params[:rating])\n end\n end"
] |
[
"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.5911711",
"0.58875376",
"0.5864667",
"0.5849916",
"0.5849186",
"0.5831984",
"0.5831745",
"0.5831745",
"0.5808971",
"0.58085334",
"0.5802136",
"0.57922035",
"0.578262",
"0.576319",
"0.5743668",
"0.57324153",
"0.57236576",
"0.5720167",
"0.5719291",
"0.5716508",
"0.5695604",
"0.56788784",
"0.56723493",
"0.5659937",
"0.56311995",
"0.5628561",
"0.5628561",
"0.5623699",
"0.5610802",
"0.5610653",
"0.5597377",
"0.5597377",
"0.55913913",
"0.5586824",
"0.55862784",
"0.5575696",
"0.5574395",
"0.5563221",
"0.55542713",
"0.5546681",
"0.5535775",
"0.55353916",
"0.55327433",
"0.5525869",
"0.55216485",
"0.55210686",
"0.55192035",
"0.55179745",
"0.5517121",
"0.55170107",
"0.55168813",
"0.5508661",
"0.550526",
"0.55040383",
"0.5497239",
"0.54888755",
"0.5481392",
"0.547962",
"0.54619795",
"0.54598755",
"0.54575527",
"0.5452695",
"0.5448193",
"0.5443551",
"0.5443551",
"0.54434395",
"0.5433332",
"0.542808",
"0.54269004",
"0.54187405",
"0.54182005",
"0.5416967",
"0.54051286",
"0.5405038",
"0.540269",
"0.53924096",
"0.53895944",
"0.5387442",
"0.53716475"
] |
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 = Rate.all\n end",
"def rates; end",
"def rates; end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def index\n @rates = Rate.all\n end",
"def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend",
"def refresh_rates\n read_from_url\n end",
"def find_rate()\n uri_string = \"https://free.currconv.com/api/v7/convert?q=GBP_\"\\\n \"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1\"\n uri = URI(uri_string)\n res = Net::HTTP.get_response(uri)\n return(JSON.parse(res.body)[\"GBP_#{@currency}\"]/100.0)\n end",
"def update\n respond_to do |format|\n if @rate_up.update(rate_up_params)\n format.html { redirect_to @rate_up, notice: 'Rate up was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate_up }\n else\n format.html { render :edit }\n format.json { render json: @rate_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actual_rate\n retrying_num = 0\n begin\n logger.info('Try to get rate JSON')\n json = JSON.parse(open(URL_FOR_UPDATE, read_timeout: TIMEOUT_SEC).read)\n logger.info('JSON was get successful')\n json['rates']['RUB']\n rescue StandardError\n retrying_num += 1\n logger.info(\"JSON was not download, retry #{retrying_num}\")\n if retrying_num >= MAX_RETRYING_OPEN\n return CurrencyRate.current_online_rate.rate\n end\n retry\n end\n end",
"def get_ratings\n begin\n plate_no = params[:plate_no]\n taxi = Taxi.find_by!(plate_no: plate_no)\n if params.has_key? :last_timestamp\n #convert unix time to datetime object\n last_timestamp = Time.at(params[:last_timestamp].to_i).to_datetime\n\n rates = taxi.rates.where(\"updated_at < ?\", last_timestamp).order(\"updated_at DESC\").limit(10)\n else\n rates = taxi.rates.order(\"updated_at DESC\").limit(10)\n end\n\n rates = rates.map do |rate|\n {comment:rate.comment,\n timestamp:rate.updated_at.to_i,\n rating: rate.rating}\n end\n\n render json:{success:true, data:rates}\n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end",
"def fetch_rate(from, to, args = {})\n from = Money::Currency.wrap(from)\n to = Money::Currency.wrap(to)\n uri = build_uri(from, to, args)\n\n data = JSON.parse(uri.read)\n\n rate = data.fetch(\"rates\").fetch(to.iso_code)\n rate = 1 / extract_rate(build_uri(to, from).read) if rate < 0.1\n rate\n end",
"def index\n @page_rates = PageRate.all\n end",
"def show\n @rate_watcher = RateWatcher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rate_watcher }\n end\n end",
"def show\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n render json: rating\r\n end",
"def show\n @shop = Shop.find(params[:id])\n @rates = @shop.rates.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop }\n end\n end",
"def get_consumer_rate(options={})\n post 'rates', options.merge(rate_filter: 'consumer')\n end",
"def show\n @rate = Rate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rate }\n end\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def ups_info\n ups_client.find_rates(order.origin, order.destination, order.packages)\n end",
"def get_min_rate(options={})\n post 'rates', options.merge(rate_filter: 'min_rate')\n end",
"def fetch_rate(from, to)\n uri = build_uri(from, to)\n data = perform_request(uri)\n extract_rate(data)\n end",
"def rates_for_usd\n rates_for 'USD'\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def rate_limit_status\n get('/account/rate_limit_status.json')\n end",
"def show\n @room_rate = RoomRate.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @room_rate }\n end\n end",
"def show\r\n @exchange_rates = get_latest\r\n end",
"def show_rating(opts={})\r\n opts[:output] = 'json'\r\n opts[:callback] = 'callback'\r\n Yahoo::Request.get(\"http://auctions.yahooapis.jp/AuctionWebService/V1/ShowRating\", Yahoo::Api.merge(opts))\r\n end",
"def get_rate(date, base, target)\n uri = make_uri(date, base, target)\n data = get_cached_data(uri)\n data['rates'][target]\n end",
"def interest_rate\n params['interest_rate'] = params['interest_rate'].to_f\n\n old_rate = @@interest_rate\n @@interest_rate = params['interest_rate']\n json_response(old_rate: old_rate, new_rate: @@interest_rate)\n end",
"def query_jurisdiction_rates(options={})\n path = \"/api/v2/compliance/jurisdictionrates\"\n get(path, options)\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: 'Rate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rate }\n else\n format.html { render action: 'new' }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n user = User.find_by(id: params[:user_id])\n return :ratings => [], :status => :not_found if user.nil?\n\n result = []\n # generate pending ratings\n if params.has_key?(:pending)\n user.rides_as_passenger.each do |ride|\n if Rating.find_by(from_user_id: user.id, to_user_id: ride.driver.id, ride_id: ride.id).nil?\n pending_rating = {}\n pending_rating[:from_user_id] = user.id\n pending_rating[:to_user_id] = ride.driver.id\n pending_rating[:ride_id] = ride.id\n result.append(pending_rating)\n end\n end\n respond_with ratings: result, status: :ok\n else\n #generate ratings given\n ratings = user.ratings_given + user.ratings_received\n result = []\n ratings.each do |r|\n rating = {}\n rating[:from_user_id] = r[:from_user_id]\n rating[:to_user_id] = r[:to_user_id]\n rating[:ride_id] = r[:ride_id]\n result.append(rating)\n end\n respond_with ratings: result, status: :ok\n end\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: \"Rate was successfully created.\" }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate\n return @rate\n end",
"def rate=(value)\n @rate = value\n end",
"def extract_rate(data)\n request_hash = JSON.parse(data)\n error = request_hash['error']\n raise JsonRatesRequestError, request_hash['error'] unless (error.nil? || error.empty?)\n BigDecimal.new(request_hash['rate'])\n end",
"def rate_class\n super\n end",
"def rate_class\n super\n end",
"def rating(food)\n url = 'https://thereportoftheweek-api.herokuapp.com/reports'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n puts result[7]['product']\n \n end",
"def new\n @rate_watcher = RateWatcher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rate_watcher }\n end\n end",
"def index\n @admin_rates = Admin::Rate.all\n end",
"def rate_up_params\n params.require(:rate_up).permit(:user_id, :review_id)\n end",
"def rate \n @user = User.find_from_param(params[:id])\n if @user.rateable_by?(current_user)\n @user.rate(params[:rate].to_i, current_user)\n render :layout => false, :text => \"#{@user.rating_count} votes\"\n else\n render :nothing => true, :status => :bad_request\n end\n end",
"def to_see\n @rates = Rate.all\n end",
"def show\n @flat_rate_price = FlatRatePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flat_rate_price }\n end\n end",
"def load_rates(date)\n data = retrieve_rates date\n rate_snapshot = JSON.parse data\n exit 1 unless rate_snapshot['base'].downcase == 'usd' # TODO: better error handling\n\n rate_date = DateTime.strptime(rate_snapshot['timestamp'].to_s, '%s').to_date\n\n upload_usd_rates(rate_date, rate_snapshot['rates'])\n \n puts \"Updated rates for #{rate_date.to_s}\"\nend",
"def rate\n post('InternetDocument', 'getDocumentPrice', params)['data'][0]['Cost'].to_i\n end",
"def currency_rates\n response['rates'][currency.target_currency.to_s]\n end",
"def index\n @user_replay_rates = UserReplayRate.all\n end",
"def rate; end",
"def rate; end",
"def show\n @rate = Rate.find(params[:id])\n @area = @rate.area\n @city = @area.city\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rate }\n end\n end",
"def create\n @currency_rate = RateSaver.new(currency_rate_params)\n respond_to do |format|\n if @currency_rate.save\n format.html { redirect_to '/', notice: 'Currency rate was successfully created.' }\n @usd_rate = @currency_rate.object.formated_rate\n format.json { render :index }\n else\n @currency_rate = @currency_rate.object\n format.html { render :new }\n format.json { render json: @currency_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tax_rate }\n end\n end",
"def message_rate\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'vhosts', Conn[:vhost]].join('/')} | jq '.messages_details.rate'`\n end",
"def rates\n @rates + [rate]\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def show\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating }\n end\n end",
"def rates **_opts\n raise NotImplementedError\n end",
"def index\n @user_question_rates = UserQuestionRate.all\n end",
"def index\n @rate_services = RateService.all\n end",
"def rate\n @training = Training.all.find(params[:id])\n Rate.create(user_id: current_user.id, training_id: @training.id)\n redirect_to training_path(@training)\n end",
"def rates(options)\n self.class.bridge.hotel_details(hotel_chain, hotel_code, options).try(:hotel_rate_details) || []\n end",
"def fetch_rate(code)\n currency_rates[code]\n end",
"def index\n @area = Area.find(params[:area_id])\n @city = @area.city\n\n @rates = Rate.where(\"area_id = ?\",params[:area_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rates }\n end\n end",
"def rateable\n self\n end",
"def fetch_rate(from, to)\n\n from, to = Currency.wrap(from), Currency.wrap(to)\n\n data = build_uri(from, to)\n rate = extract_rate(data)\n\n rate\n\n end",
"def index\n # Setting URL\n url = \"https://v3.exchangerate-api.com/bulk/bd9e41491d3cbe08cc159344/USD\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n response_obj = JSON.parse(response)\n\n # Create an object to get an access from the view\n @rates = response_obj[\"rates\"]\n @currencies = response_obj[\"rates\"].keys\n\n # Format the currency before passed to javascript \n @formated_rates = Hash.new\n @rates.each { |currency, rate|\n @formated_rates[currency] = Money.new((@rates[currency]),currency).format\n }\n\n # Assign @rates object to gon object, so it can be used in the .js file \n gon.exchange_rate = @rates\n\n # To retrieve bank information\n @accounts = Account.all\n end",
"def report(rate_from:, rate_to:)\n body = @cache.fetch(rate_from + rate_to) do\n @cache[rate_from + rate_to] = open(url).read\n end\n data = JSON.parse(body)\n Report.new(1 / data['rates'][rate_from], 1 / data['rates'][rate_to])\n end",
"def get_rate(from, to)\n if self.class.rates_careful\n get_rate_careful(from, to)\n else\n get_rate_straight(from, to)\n end\n end",
"def call_yts_api(count)\n\t \t\traw_data = RestClient.get BASE_URL, \n\t\t\t{ :params => \n\t\t\t\t{ :quality => '720p',\n\t\t\t\t :set => count,\n\t\t\t\t :limit => 50,\n\t\t\t\t :rating => 1,\n\t\t\t\t :sort => \"date\",\n\t\t\t\t :order => \"desc\" \n\t\t\t\t} \n\t\t\t}\n\t\t\tJSON.parse(raw_data)\n\t \tend",
"def show\n post = Post.find(params[:id])\n rate = Rate.find_by user_id: current_user.id, post_id: post.id\n render json: {\n status: \"success\",\n data: {\n post: post.as_json(\n include: [\n {\n images: {\n only: [:id, :src]\n }\n },\n :location,\n {\n user: {\n only: [:name, :avatar]\n }\n }\n ]),\n rate: rate\n }\n }, status: :ok\n\n end",
"def new\n @rate = Rate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rate }\n end\n end",
"def destroy\n @rate_up.destroy\n respond_to do |format|\n format.html { redirect_to rate_ups_url, notice: 'Rate up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def rates\n @page_title = _('Sms_rates')\n #@page_icon = \"\"\n\n a=check_user_id_with_session(@tariff.owner_id)\n return false if !a\n @page_title = _('SMS_Rates_for_tariff') +\": \" + @tariff.name\n\n @st = \"A\"\n @st = params[:st].upcase if params[:st]\n\n @rates = @tariff.rates_by_st(@st, 0, 10000)\n @total_pages = (@rates.size.to_d / session[:items_per_page].to_d).ceil\n\n @page = 1\n @page = params[:page].to_i if params[:page]\n @page = @total_pages if @page > @total_pages\n\n @all_rates = @rates\n @rates = []\n\n iend = ((session[:items_per_page] * @page) - 1)\n iend = @all_rates.size - 1 if iend > (@all_rates.size - 1)\n for i in ((@page - 1) * session[:items_per_page])..iend\n @rates << @all_rates[i]\n end\n @rates = @rates.compact\n #----\n\n @use_lata = false\n @use_lata = true if @st == \"U\"\n\n\n @letter_select_header_id = @tariff.id\n @page_select_header_id = @tariff.id\n\n @dests = @tariff.free_destinations_by_st(@st)\n\n end",
"def show\n @rating_alt = Rating.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rating_alt }\n end\n end",
"def show\n @spending_rate = SpendingRate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @spending_rate }\n end\n end",
"def index\n @users = User.all\n @rates = Value.group(:user_id).count(:value)\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def index\n @ratings = Rating.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ratings }\n end\n end",
"def show\n @roomrate = Roomrate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roomrate }\n end\n end",
"def edit_rates\n @rate = Rate.find_by_id(1)\n end",
"def fetch_rates\n rates = {}\n begin\n if @force_expire\n Timeout.timeout(60) do\n doc = Hpricot.XML(open('http://themoneyconverter.com/USD/rss.xml'))\n (doc/:item).each do |item|\n country = (item/:title).inner_html.split('/')[0]\n conversion_match = (item/:description).inner_html[/=.?(\\d+\\.?\\d*)/]\n # 1 USD country rate 'in USD'\n rates[country] = 1.0 / $1.to_f\n end\n rates.update({'USD' => 1.0})\n persist_rates(rates)\n end\n else\n rates = fetch_persisted_rates\n end\n rescue Exception\n rates = fetch_persisted_rates\n end\n rates\n end",
"def get_rate(from, to)\n expire_rates\n store.get_rate(from, to) || store.add_rate(from, to, fetch_rate(from, to))\n end"
] |
[
"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.60708153",
"0.60505456",
"0.60428536",
"0.60252714",
"0.6012284",
"0.6012284",
"0.6012284",
"0.60036904",
"0.5945809",
"0.5926725",
"0.5918629",
"0.58996445",
"0.58996445",
"0.58996445",
"0.58996445",
"0.5871059",
"0.5862448",
"0.58578044",
"0.58546436",
"0.58379585",
"0.5836322",
"0.5821941",
"0.58196896",
"0.5805514",
"0.5805514",
"0.5805514",
"0.5803383",
"0.5802965",
"0.5800283",
"0.57912827",
"0.579065",
"0.5786585",
"0.5786585",
"0.57846344",
"0.57822484",
"0.5782",
"0.57812387",
"0.5771345",
"0.5764594",
"0.5758886",
"0.57552123",
"0.57535416",
"0.5737731",
"0.57213056",
"0.5720209",
"0.5720209",
"0.5719295",
"0.5716529",
"0.5716347",
"0.5711827",
"0.5710015",
"0.5705329",
"0.5705329",
"0.5705329",
"0.5703667",
"0.5693952",
"0.5693916",
"0.5686022",
"0.5666556",
"0.5665731",
"0.5655343",
"0.5638617",
"0.5630855",
"0.5625282",
"0.5622753",
"0.5610547",
"0.56086093",
"0.56076163",
"0.5604758",
"0.5603764",
"0.5601801",
"0.55964285",
"0.5594274",
"0.5580869",
"0.55793387",
"0.55793387",
"0.55793387",
"0.5563719",
"0.556048",
"0.5556943",
"0.5553036"
] |
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: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: \"Rate was successfully created.\" }\n format.json { render :show, status: :created, location: @rate }\n else\n format.html { render :new }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\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: 'Rate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rate }\n else\n format.html { render action: 'new' }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_post(rating)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.put(rate_post_endpoint, { 'router.params' => { rating: rating }, format: :json })\n end",
"def create_ratyrate\n\t\tself.rate(self.rating, self.user, \"rating\", false)\n\tend",
"def index\n @rate_ups = RateUp.all\n end",
"def create\n o = OvertimeRate.new(:duration => params[:duration], :year => params[:year], \n :pay_rate => params[:pay_rate])\n \n if o.save\n render :json => { :success => 1, \n :message => 'Overtime Rate successfully added.' }\n \n else\n render :json => OvertimeRateHelper.get_errors(o.errors)\n end\n end",
"def update\n respond_to do |format|\n if @rate_up.update(rate_up_params)\n format.html { redirect_to @rate_up, notice: 'Rate up was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate_up }\n else\n format.html { render :edit }\n format.json { render json: @rate_up.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rate = Rate.new(params[:rate])\n\n respond_to do |format|\n if @rate.save\n format.html { redirect_to(@rate, :notice => 'Rate was successfully created.') }\n format.xml { render :xml => @rate, :status => :created, :location => @rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @updaterete = Updaterete.update_rates(params)\n\n respond_to do |format|\n if @updaterete.save\n format.html { redirect_to @updaterete, notice: 'Updaterete was successfully created.' }\n format.json { render json: @updaterete, status: :created, location: @updaterete }\n else\n format.html { render action: \"new\" }\n format.json { render json: @updaterete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate\n @training = Training.all.find(params[:id])\n Rate.create(user_id: current_user.id, training_id: @training.id)\n redirect_to training_path(@training)\n end",
"def create\n @admin_rate = Admin::Rate.new(admin_rate_params)\n respond_to do |format|\n if @admin_rate.save\n format.html { redirect_to admin_root_url, notice: 'Rate was successfully created.' }\n format.json { render :show, status: :created, location: admin_root_url }\n else\n format.html { render :new }\n format.json { render json: admin_root_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_params\n params.require(:rate).permit(:rate)\n end",
"def create\n @fragrance = Fragrance.find(params[:fragrance_id])\n @rating = Rating.new(rating_params)\n @rating.user = @current_user\n @rating.fragrance = @fragrance\n\n if @rating.save\n render json: @rating, status: :created\n else\n render json: @rating.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user_question_rate = UserQuestionRate.new(user_question_rate_params)\n\n respond_to do |format|\n if @user_question_rate.save\n format.html { redirect_to @user_question_rate, notice: 'User question rate was successfully created.' }\n format.json { render :show, status: :created, location: @user_question_rate }\n else\n format.html { render :new }\n format.json { render json: @user_question_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_params\n # rubocop:disable Metrics/LineLength\n params.require(:rate).permit(:visit_type_id, :agency_id, :user_id, :amount, :arrangement)\n # rubocop:enable Metrics/LineLength\n end",
"def transfer_rate_check\n params.require(:rate).permit(:transferringprogram,\n :transfereeprogram,\n :transferratio,\n :transfernotes)\n end",
"def rate_params\n params.require(:rate).permit(:direction, :country, :country_code, :country_iso, :prefix, :voice_rate, :unit_in_seconds, :number_type, :rent_per_number, :setup_cost_per_number)\n end",
"def create\n @exchange_rate = ExchangeRate.new(exchange_rate_params)\n\n respond_to do |format|\n if @exchange_rate.save\n format.html { redirect_to @exchange_rate, notice: 'Exchange rate was successfully created.' }\n format.json { render :show, status: :created, location: @exchange_rate }\n else\n format.html { render :new }\n format.json { render json: @exchange_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @currency_rate = RateSaver.new(currency_rate_params)\n respond_to do |format|\n if @currency_rate.save\n format.html { redirect_to '/', notice: 'Currency rate was successfully created.' }\n @usd_rate = @currency_rate.object.formated_rate\n format.json { render :index }\n else\n @currency_rate = @currency_rate.object\n format.html { render :new }\n format.json { render json: @currency_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_params\n params.require(:rate).permit(:provider, :usdclp, :eurclp, :gbpclp)\n end",
"def rate_params\n params.require(:rate).permit(:val, :book_id, :user_id)\n end",
"def add_rate(from, to, rate); end",
"def create\n @reviewing = Reviewing.new(reviewing_params)\n @book = @reviewing.book\n @user = User.find(current_user.id)\n @user.reviewings << @reviewing\n @book.updateRate(@book.id)\n\n respond_to do |format|\n if @reviewing.save\n format.html { redirect_to book_reviewings_path(@reviewing.book.isbn), notice: 'Reviewing was successfully created.' }\n format.json { render :show, status: :created, location: @reviewing }\n else\n format.html { render :new }\n format.json { render json: @reviewing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n page = Page.find(page_rate_params[:page_id])\n member = Member.find_by(phone: page_rate_params[:phone])\n member ||= Member.create!(user_id: page.user_id, name: page_rate_params[:name], email: \"#{page_rate_params[:phone]}@qq.com\", phone: page_rate_params[:phone], password: '000000', password_confirmation: '000000')\n \n unless @page_rate = PageRate.find_by(page_id: page.id, member_id: member.id)\n @page_rate = PageRate.new(page_rate_params)\n @page_rate.member_id = member.id\n @page_rate.ip_count = 1\n @page_rate.pv_count = 1\n end\n\n respond_to do |format|\n if @page_rate.save\n format.html { redirect_to @page_rate, notice: t('.notice') }\n format.json { render action: 'show', status: :created, location: @page_rate }\n else\n format.html { render action: 'new' }\n format.json { render json: @page_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end",
"def create\n @spending_rate = SpendingRate.new(params[:spending_rate])\n\n respond_to do |format|\n if @spending_rate.save\n format.html { redirect_to(@spending_rate, :notice => 'Spending rate was successfully created.') }\n format.xml { render :xml => @spending_rate, :status => :created, :location => @spending_rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spending_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rider = Rider.new(params[:rider])\n @post_id = session[:post_id]\n @rider.postid = @post_id\n @user_id = session[:user_id]\n @rider.userid = session[:user_id]\n @post =Post.find(@post_id)\n @user=User.find(@user_id)\n @post.increment!(:capacity, by = 1);\n \n respond_to do |format|\n if @rider.save\n format.html { redirect_to profile_path, notice: 'Booking was successfully created.' }\n format.json { render json: @rider, status: :created, location: @rider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rider.errors, status: :unprocessable_entity }\n end\n \n end\n \n end",
"def get_rates(options={})\n post 'rates/full', options\n end",
"def add_rate(currency_iso_from, currency_iso_to, rate); end",
"def create\n @rating = Rating.new\n @rating.user_id = params[:user_id]\n @rating.rate = params[:rate].to_i\n if @answer\n if @answer.user_id == current_user.id\n redirect_to @post, alert: \"You can't rate your own answer.\" and return\n end\n @rating.answer_id = @answer.id\n @answer.rating_score += @rating.rate\n @answer.save\n else\n if @post.user_id == current_user.id\n redirect_to @post, alert: \"You can't rate your own post.\" and return\n end\n @rating.post_id = @post.id\n @post.rating_score += @rating.rate\n @post.save\n end\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @post, notice: 'Rating was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to @post, alert: 'Rating was NOT successfully created.' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_params\n params.require(:rate).permit(:code, :value)\n end",
"def destroy\n @rate_up.destroy\n respond_to do |format|\n format.html { redirect_to rate_ups_url, notice: 'Rate up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def rate_params\n params.require(:rate).permit(:title, :description, :image_name)\n end",
"def create\n @tax_rate = TaxRate.new(params[:tax_rate])\n\n respond_to do |format|\n if @tax_rate.save\n format.html { redirect_to @tax_rate, notice: 'Tax rate was successfully created.' }\n format.json { render json: @tax_rate, status: :created, location: @tax_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_replay_rate = UserReplayRate.new(user_replay_rate_params)\n\n respond_to do |format|\n if @user_replay_rate.save\n format.html { redirect_to @user_replay_rate, notice: 'User replay rate was successfully created.' }\n format.json { render :show, status: :created, location: @user_replay_rate }\n else\n format.html { render :new }\n format.json { render json: @user_replay_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rates; end",
"def rates; end",
"def make_request\n if @test\n host = 'wwwcie.ups.com'\n else\n host = 'www.ups.com'\n end\n\n path = \"/ups.app/xml/Rate\"\n server = Net::HTTP.new(host, 443)\n data = @xml_pieces.collect{|p| p.to_s}.join(\"\\n\")\n if @debug\n File.open(@debug_request_path, 'w') do |file|\n file.puts data\n end\n end\n headers = { \"Content-Type\" => \"text/xml\"}\n server.use_ssl = true\n resp = server.post(path, data, headers)\n if @debug\n File.open(@debug_response_path, 'w') do |file|\n file.puts resp.body\n end\n end\n prices = parse_response(resp.body)\n end",
"def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequest.new('missing parameter(s)') if params[:tax_rate_action].nil? || params[:tax_rate_action][:tax_rate].blank? || params[:tax_rate_action][:settlement_id].blank?\n\n settlement = Settlement::Settlement.find_by_id(params[:tax_rate_action][:settlement_id])\n tax_rate = params[:tax_rate_action][:tax_rate].to_f\n \n raise NotFoundError.new ('Settlement with id #{params[:tax_rate_action][:settlement_id]} not Found.') if settlement.nil?\n raise ForbiddenError.new('tried to set tax rate on a foreign settlement.') unless settlement.owner == current_character\n raise BadRequestError.new('settlement does not own the region.') unless settlement.owns_region?\n raise ForbiddenError.new ('tax rate out of range.') if tax_rate < 0.05 || tax_rate > 0.15\n raise ForbiddenError.new ('no tax rate change possible at the moment') unless settlement.tax_rate_change_possible?\n\n settlement.tax_rate = tax_rate\n settlement.tax_changed_at = Time.now\n settlement.save\n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def create\n @rate = Rate.new(rate_params)\n if @rate.save\n redirect_to \"index\"\n end\nend",
"def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n else\r\n render json: { error: \"Rating creating error\" }, status: :unprocessable_entity\r\n end\r\n end",
"def rate_params\n params.require(:rate).permit(:value, :rating_type_id, :description)\n end",
"def create\n @room_rate = RoomRate.new(params[:room_rate])\n\n respond_to do |format|\n if @room_rate.save\n Notifications.new_room_rate(@room_rate).deliver\n format.html { redirect_to @room_rate, notice: 'Room rate was successfully created.' }\n format.json { render json: @room_rate, status: :created, location: @room_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room_rate.errors, status: :unprocessable_entity }\n \n end\n end\n end",
"def create\n @run_at_rate = RunAtRate.new(run_at_rate_params)\n\n respond_to do |format|\n @run_at_rate.attachment.created_by = current_user\n if @run_at_rate.save\n format.html { redirect_to run_at_rates_url, notice: 'Run at rate was successfully created.' }\n format.json { render json: @run_at_rate, status: :created, location: @run_at_rate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @run_at_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transfer_rate_check\n params.require(:transferrate).permit(:transferringprogram,\n :transfereeprogram,\n :transferratio,\n :transfernotes)\n end",
"def interest_rate\n params['interest_rate'] = params['interest_rate'].to_f\n\n old_rate = @@interest_rate\n @@interest_rate = params['interest_rate']\n json_response(old_rate: old_rate, new_rate: @@interest_rate)\n end",
"def create\n @rate = Rate.new(rate_params)\n @rate.user_id = current_user.id\n @rate.book_id = params[:book_id]\n respond_to do |format|\n if @rate.save\n format.html { redirect_to Book.find(params[:book_id]), notice: 'Rate was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create(unique_name: :unset, friendly_name: :unset, data_enabled: :unset, data_limit: :unset, data_metering: :unset, messaging_enabled: :unset, voice_enabled: :unset, national_roaming_enabled: :unset, international_roaming: :unset, national_roaming_data_limit: :unset, international_roaming_data_limit: :unset)\n data = Twilio::Values.of({\n 'UniqueName' => unique_name,\n 'FriendlyName' => friendly_name,\n 'DataEnabled' => data_enabled,\n 'DataLimit' => data_limit,\n 'DataMetering' => data_metering,\n 'MessagingEnabled' => messaging_enabled,\n 'VoiceEnabled' => voice_enabled,\n 'NationalRoamingEnabled' => national_roaming_enabled,\n 'InternationalRoaming' => Twilio.serialize_list(international_roaming) { |e| e },\n 'NationalRoamingDataLimit' => national_roaming_data_limit,\n 'InternationalRoamingDataLimit' => international_roaming_data_limit,\n })\n\n payload = @version.create(\n 'POST',\n @uri,\n data: data\n )\n\n RatePlanInstance.new(@version, payload, )\n end",
"def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rate_watcher = RateWatcher.new(params[:rate_watcher])\n\n respond_to do |format|\n if @rate_watcher.save\n format.html { redirect_to @rate_watcher, notice: 'Rate watcher was successfully created.' }\n format.json { render json: @rate_watcher, status: :created, location: @rate_watcher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rate_watcher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_cheer_up\n new_cheer_up = current_user.cheer_ups.new(cheer_up_params)\n if new_cheer_up.save\n render json:\n {\n status: 200,\n user: current_user,\n cheer_up: current_user.cheer_ups\n }\n else\n render json:\n {\n status: 400,\n user: current_user,\n cheer_up: cheer_up.errors\n }\n end\n end",
"def create\n\n # merge the raw post data into the params\n params.merge!(Rack::Utils.parse_nested_query(request.raw_post))\n\n url = params[:australia_post_api_connection][:shop]\n\n #try to find the shop preference using url\n preference = Preference.find_by_shop_url!(url)\n\n # recalculate the weight to include blanks\n calculated_weight = params[:australia_post_api_connection][:blanks].to_i * preference.default_weight.to_f\n calculated_weight += params[:australia_post_api_connection][:weight].to_f\n\n items = params[:australia_post_api_connection][:items]\n \n if (preference.offers_flat_rate)\n if (calculated_weight <= preference.under_weight)\n @service_list = Array.new\n @service_list.append({ name: \"Shipping\",\n code: \"Shipping\",\n price: preference.flat_rate.to_s}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return #evil...\n end\n end\n \n weight = params[:australia_post_api_connection][:weight]\n \n if (preference.free_shipping_by_collection)\n subtract_weight = 0\n \n #get free shipping items weight and subtract total weight.\n item_array = items.split(',')\n \n app_shop = Shop.find_by_url(url)\n \n ShopifyAPI::Session.temp(app_shop.myshopify_domain, app_shop.token) do \n item_array.each do |item|\n variant = ShopifyAPI::VariantWithProduct.find(item) \n p = ShopifyAPI::Product.find(variant.product_id)\n \n p.collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n \n p.smart_collections.each do |col|\n fields = col.metafields\n field = fields.find { |f| f.key == 'free_shipping' && f.namespace ='AusPostShipping'}\n unless field.nil?\n subtract_weight += variant.grams if field.value == \"true\" \n end\n end\n end\n end\n \n \n weight = weight.to_f - subtract_weight/1000\n end\n\n\n if (weight.to_f == 0.0)\n #no need to call australia post. no weight of item\n @service_list = Array.new\n @service_list.append({ name: \"Free Shipping\",\n code: \"Free Shipping\",\n price: \"0.0\"}) \n respond_to do |format| \n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false } \n end\n return\n else \n @australia_post_api_connection = AustraliaPostApiConnection.new({:weight=> weight,\n :blanks => params[:australia_post_api_connection][:blanks],\n :from_postcode => preference.origin_postal_code,\n :country_code => params[:australia_post_api_connection][:country_code],\n :to_postcode => params[:australia_post_api_connection][:to_postcode],\n :height=>preference.height, :width=>preference.width, :length=>preference.length,\n :container_weight => preference.container_weight, :items => items\n })\n end\n \n @australia_post_api_connection.domestic = ( @australia_post_api_connection.country_code == \"AUS\" )\n\n # get country list from the API -- we'll format these if there were no errors\n @service_list = @australia_post_api_connection.data_oriented_methods(:service) # get the service list\n\n if @australia_post_api_connection.domestic\n shipping_methods = preference.shipping_methods_allowed_dom\n shipping_desc = preference.shipping_methods_desc_dom\n else\n shipping_methods = preference.shipping_methods_allowed_int\n shipping_desc = preference.shipping_methods_desc_int\n end\n\n respond_to do |format|\n if @australia_post_api_connection.save\n\n @countries = get_country_list(@australia_post_api_connection)\n # TODO right now we are not including the suboptions for each shipping type\n #filter out unwanted methods more efficiently?\n\n @service_list = Array.wrap( @service_list[1]['service'] ).inject([]) do |list, service|\n Rails.logger.debug(\"service code is \" + service['code'])\n if shipping_methods[service['code']]\n price_to_charge = service['price'].to_f\n shipping_name = shipping_desc[service['code']].blank? ? service['name'] : shipping_desc[service['code']]\n unless preference.nil?\n unless preference.surcharge_percentage.nil?\n if preference.surcharge_percentage > 0.0\n price_to_charge =(price_to_charge * (1 + preference.surcharge_percentage/100)).round(2)\n end\n end\n\n unless preference.surcharge_amount.nil?\n if preference.surcharge_amount > 0.0\n price_to_charge = (price_to_charge + preference.surcharge_amount).round(2)\n end\n end\n end\n\n list.append({ name: shipping_name,\n code: service['code'],\n price: price_to_charge})\n end\n \n list\n end\n\n # check if need to add free shipping option\n if (preference.free_shipping_option)\n @service_list.append({ name: preference.free_shipping_description,\n code: \"Free\",\n price: \"0.00\"})\n end\n format.js { render content_type: 'text/html', layout: false }\n format.html { render content_type: 'text/html', layout: false }\n else // if @australia_post_api_connection.save\n # set the flash\n\n flash.now[:error] = @australia_post_api_connection.api_errors.join(', ')\n # format.html { render action: \"new\" }\n # format.json { render json: @australia_post_api_connection.errors, status: :unprocessable_entity }\n # if (flash.now[:error].blank?)\n # format.html { render :text => \"api_error\" }\n # else\n format.html { render partial: \"trouble\", layout: false }\n # end\n end\n end\n end",
"def rate=(value)\n @rate = value\n end",
"def rate_new\n @page_title = _('Add_new_rate_to_tariff') +\": \" + @tariff.name\n @page_icon = \"add.png\"\n\n # st - from which letter starts rate's direction (usualy country)\n @st = \"A\"\n @st = params[:st].upcase if params[:st]\n @page = (params[:page] || 1).to_i\n offset = (@page -1) * session[:items_per_page].to_i\n\n @dests, total_records = @tariff.free_destinations_by_st(@st, session[:items_per_page].to_i, offset)\n @total_pages = (total_records.to_f / session[:items_per_page].to_f).ceil\n\n @letter_select_header_id = @tariff.id\n @page_select_header_id = @tariff.id\n end",
"def create\n #not sure why this was here...? @trips = Trip.all\n\n @expense_report = ExpenseReport.new(expense_report_params)\n authorize @expense_report\n @expense_report.submitter = current_account.accountable\n\n @expense_report.actual_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @expense_report.trip.destination\n req.expense_type = 'actual'\n end\n end\n\n\n respond_to do |format|\n if @expense_report.save\n format.html { redirect_to home_index_path, notice: 'Expense report was successfully created.' }\n format.json { render :show, status: :created, location: @expense_report }\n else\n format.html { render :new }\n format.json { render json: @expense_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rate_service = RateService.new(rate_service_params)\n\n respond_to do |format|\n if @rate_service.save\n format.html { redirect_to @rate_service, notice: 'Rate service was successfully created.' }\n format.json { render :show, status: :created, location: @rate_service }\n else\n format.html { render :new }\n format.json { render json: @rate_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rate_estimates(shipment, options: RateEstimateOptions.new, debug: false)\n rate_request_xml = SerializeRateRequest.call(shipment: shipment, login: login, options: options)\n request = build_request(api: :rates, xml: rate_request_xml, debug: debug)\n\n client.post(request).bind do |response|\n ParseRateResponse.call(response: response, request: request, shipment: shipment, options: options)\n end\n end",
"def create\n @shipping_rate = ShippingRate.new(params[:shipping_rate])\n @shipping_rate.created_by = current_admin.email\n respond_to do |format|\n if @shipping_rate.save\n format.html { redirect_to(admin_shipping_rates_path, :notice => 'ShippingRate was successfully created.') }\n format.xml { render :xml => @shipping_rate, :status => :created, :location => @shipping_rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @link = Link.find_by_slug(params[:format])\n @link.upvotes.create!(user: current_user)\n calculate_points_for(current_user, 1)\n redirect_to root_path\n end",
"def create\n @ratecurry = Ratecurry.new(ratecurry_params)\n\n respond_to do |format|\n if @ratecurry.save\n format.html { redirect_to @ratecurry, notice: 'Ratecurry was successfully created.' }\n format.json { render :show, status: :created, location: @ratecurry }\n else\n format.html { render :new }\n format.json { render json: @ratecurry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rate_register = RateRegister.new(rate_register_params)\n\n respond_to do |format|\n if @rate_register.save\n format.html { redirect_to DevelopmentRate.find(@rate_register.development_rate_id), notice: 'Rate register was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @rate_register.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating = Rating.new(params[:rating])\n\n respond_to do |format|\n if @rating.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gm_rate_params\n params.require(:gm_rate).permit(*%i(kind user_id user_type project_id issue_id val effective_on))\n end",
"def create\n @rating = Rating.new(params[:rating])\n facebook_id = params[:rating][:user_id]\n @user = User.find_by_facebook_id(facebook_id)\n @rating.user_id = @user.id\n dish = Dish.find(params[:rating][:dish_id]) \n @rating.dish_id = dish.id \n \n respond_to do |format|\n if @rating.save\n if @rating.value == 1\n dish.upvotes += 1\n else\n dish.downvotes += 1\n end\n dish.save\n format.html { redirect_to @rating, notice: 'Rating was successfully created.' }\n format.json { render json: @rating, status: :created, location: @rating }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @destination_rating = DestinationRating.new(destination_rating_params)\n\n respond_to do |format|\n if @destination_rating.save\n format.html { redirect_to @destination_rating, notice: 'Destination rating was successfully created.' }\n format.json { render :show, status: :created, location: @destination_rating }\n else\n format.html { render :new }\n format.json { render json: @destination_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_consumer_rate(options={})\n post 'rates', options.merge(rate_filter: 'consumer')\n end",
"def rate_try_to_add\n st = \"A\"\n st = params[:st].upcase if params[:st]\n for dest in @tariff.free_destinations_by_st(st)\n #add only rates which are entered\n if params[(dest.id.to_s).intern].to_s.length > 0\n @tariff.add_new_rate(dest.prefix.to_s, params[(dest.id.to_s).intern])\n end\n end\n\n flash[:status] = _('Rates_updated')\n redirect_to :action => 'rates', :id => params[:id], :st => st\n # render :action => 'debug'\n end",
"def rate score, post\n ratings.create :score => (score.is_a?(Integer) ? score : Rating.score_for(score)), :post_id => Post.wrap(post).id\n end",
"def admin_rate_params\n params.require(:admin_rate).permit(:rate, :finished_at)\n end",
"def rate; end",
"def rate; end",
"def exchange_rate_params\n params.require(:exchange_rate).permit(:rate, :date, :bank_id, :currency_id, :user_id)\n end",
"def rating_params\n params.require(:rating).permit(:post_id, :profile_id, :rate, :rated_at, :type, :Description)\n end",
"def create\n @flat_rate_price = FlatRatePrice.new(params[:flat_rate_price])\n\n respond_to do |format|\n if @flat_rate_price.save\n format.html { redirect_to @flat_rate_price, notice: 'Flat rate price was successfully created.' }\n format.json { render json: @flat_rate_price, status: :created, location: @flat_rate_price }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flat_rate_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_payroll(options={})\n post(\"hours-wages\", options)\n end",
"def create\n @payment_increase = PaymentIncrease.new(payment_increase_params)\n\n respond_to do |format|\n if @payment_increase.save\n format.html { redirect_to @payment_increase, notice: 'Payment increase was successfully created.' }\n format.json { render :show, status: :created, location: @payment_increase }\n else\n format.html { render :new }\n format.json { render json: @payment_increase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rental_rate_params\n params.require(:rental_rate).permit(:code, :name, :model_id, :rental_type_id, :workweek, :weekend, :hour, :note)\n end",
"def range_rate_params\n params.require(:range_rate).permit(:code, :name, :active, :model_class_id, :rental_type_id, :days_range_id, :rate, :note)\n end",
"def saw\n @rates = Rate.all\n end",
"def weekly_pay(rate, hours = 40)\n hours * rate\nend",
"def points_balance\n user = User.find(params[:user_id])\n transactions = Transaction.sort_user_transactions(params[:user_id]) # sort by created_date\n payers = []\n\n transactions.each do |t|\n payer = payers.find{|p| p[:payer_name] == t.payer_name}\n if payer # if payer already exists in array\n payer[:points] = payer[:points] + t.original_points # add new points to existing balance\n else\n entry = {payer_name: t.payer_name, points: t.original_points} # create a new payer entry and add to array\n payers << entry\n end\n end\n payers.each {|p| p[:points] = p[:points].to_s + \" points\"} # convert to \"100 points\" format\n\n render json: payers\n end",
"def page_rate_params\n params.require(:page_rate).permit(:page_id, :member_id, :name, :phone)\n end",
"def create\n @tax_rate = TaxRate.new(params[:tax_rate])\n\n respond_to do |format|\n if @tax_rate.save\n format.html { redirect_to(@tax_rate, :notice => 'Tax rate was successfully created.') }\n format.xml { render :xml => @tax_rate, :status => :created, :location => @tax_rate }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tax_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def overtype_params\n params.require(:overtype).permit(:uid, :name, :mins_of_A, :mins_of_B, :rate_of_A, :amt_of_A, :rate_of_B, :amt_of_B, :rate_of_C, :amt_of_C, :rate_of_H, :amt_of_H, :mins_per_unit, :valid_unit, :is_stoped, :pay_type, :memo)\n end",
"def rates\n @rates + [rate]\n end",
"def create\n @buy_ad = BuyAd.new(buy_ad_params)\n @buy_ad.user = current_user\n @buy_ad.views = 0\n respond_to do |format|\n if @buy_ad.save\n format.html { redirect_to @buy_ad, notice: 'Buy ad was successfully created.' }\n format.json { render :show, status: :created, location: @buy_ad }\n else\n format.html { render :new }\n format.json { render json: @buy_ad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rate_type = RateType.new(params[:rate_type])\n\n respond_to do |format|\n if @rate_type.save\n format.html { redirect_to(@rate_type, :notice => 'Rate type was successfully created.') }\n format.xml { render :xml => @rate_type, :status => :created, :location => @rate_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_answer_upvote = Api::V1::AnswerUpvote.new(api_v1_answer_upvote_params)\n\n respond_to do |format|\n if @api_v1_answer_upvote.save\n format.html { redirect_to @api_v1_answer_upvote, notice: 'Answer upvote was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_answer_upvote }\n else\n format.html { render :new }\n format.json { render json: @api_v1_answer_upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rating = Rating.new(rating_params)\n\n respond_to do |format|\n if @rating.save\n @yellow = Yellowpage.find(@rating.post_id)\n @yellow.AveRating = (@yellow.AveRating*(@yellow.totalRatings) + @rating.rate)/(@yellow.totalRatings + 1)\n @yellow.totalRatings += 1\n @yellow.save\n @notification = Notification.create\n @notification.created_by = @yellow.profile_id\n @notification.responded_by = @rating.profile_id\n @notification.post_id = @yellow.id\n @notification.notification_type = 6\n @notification.view_stat = 0\n @notification.message = @current_profile.firstName + \" \" + @current_profile.LastName + \" Rated your Contact\" + \"(contact_id:\" + \") \" + @rating.rate.to_s\n @notification.save\n format.html { redirect_to @yellow, notice: 'Rating was successfully created.' }\n format.json { render :show, status: :created, location: @rating }\n else\n format.html { render :new }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board_post_upvote = BoardPostUpvote.new(board_post_upvote_params)\n\n respond_to do |format|\n if @board_post_upvote.save\n format.html { redirect_to @board_post_upvote.board_post, notice: 'Board post upvote was successfully created.' }\n format.json { render :show, status: :created, location: @board_post_upvote }\n else\n format.html { render :new }\n format.json { render json: @board_post_upvote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ws_update_amounts\n gs = params[:gs].to_f / 100\n vs = params[:vs].to_f / 100\n ss = params[:ss].to_f / 100\n dp = params[:dp].to_f / 100\n ot = params[:ot].to_f / 100\n # Format number\n gs = number_with_precision(gs.round(2), precision: 2)\n vs = number_with_precision(vs.round(2), precision: 2)\n ss = number_with_precision(ss.round(2), precision: 2)\n dp = number_with_precision(dp.round(2), precision: 2)\n ot = number_with_precision(ot.round(2), precision: 2)\n # Setup JSON\n @json_data = { \"gs\" => gs.to_s, \"vs\" => vs.to_s, \"ss\" => ss.to_s, \"dp\" => dp.to_s, \"ot\" => ot.to_s }\n render json: @json_data\n end",
"def rate_register_params\n params.require(:rate_register).permit(:rate_value, :date_registered,:country_id,:development_rate_id)\n end",
"def create\n @restaurant_table_rating = RestaurantTableRating.new(restaurant_table_rating_params)\n\n respond_to do |format|\n if @restaurant_table_rating.save\n format.html { redirect_to @restaurant_table_rating, notice: 'Restaurant table rating was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_table_rating }\n else\n format.html { render :new }\n format.json { render json: @restaurant_table_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @uptime = Uptime.new(uptime_params)\n\n respond_to do |format|\n if @uptime.save\n format.html { redirect_to @uptime, notice: 'Uptime was successfully created.' }\n format.json { render :show, status: :created, location: @uptime }\n else\n format.html { render :new }\n format.json { render json: @uptime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rate = Rate.new(params[:rate])\n @rate.area = Area.find(params[:area_id])\n @area = @rate.area\n @city = @area.city\n\n respond_to do |format|\n if @rate.save\n format.html { redirect_to [@rate.area.city,@rate.area,@rate], notice: 'Rate was successfully created.' }\n format.json { render json: @rate, status: :created, location: [@rate.area.city,@rate.area,@rate] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.5741818",
"0.57347494",
"0.5726632",
"0.5723164",
"0.5706177",
"0.5685604",
"0.5661932",
"0.56107396",
"0.5592769",
"0.55592763",
"0.55582297",
"0.55431765",
"0.5537505",
"0.55334866",
"0.5527891",
"0.55120856",
"0.55010635",
"0.54960436",
"0.5494824",
"0.5493386",
"0.54831576",
"0.54831576",
"0.54804957",
"0.5476052",
"0.54627824",
"0.54459995",
"0.54419273",
"0.5434776",
"0.5425144",
"0.54169565",
"0.54095465",
"0.5405895",
"0.5397227",
"0.53893054",
"0.53562576",
"0.5355138",
"0.5346775",
"0.5342396",
"0.53303033",
"0.5325538",
"0.5305902",
"0.5279644",
"0.527658",
"0.52619946",
"0.5252741",
"0.5251057",
"0.52490616",
"0.5233224",
"0.52206916",
"0.52143663",
"0.5204292",
"0.52021426",
"0.51903707",
"0.51810133",
"0.5177277",
"0.5177277",
"0.5169623",
"0.5169131",
"0.51589483",
"0.51587373",
"0.5144375",
"0.5143745",
"0.5135929",
"0.51356524",
"0.513337",
"0.5124622",
"0.5115323",
"0.50996083",
"0.50995624",
"0.50944066",
"0.5093765",
"0.5088322",
"0.5086189",
"0.5085248",
"0.5081595",
"0.50813067",
"0.50786024",
"0.50781846",
"0.50735635",
"0.5065098"
] |
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, status: :unprocessable_entity }\n end\n end\n end",
"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 { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @rate_name = args[:rate_name] if args.key?(:rate_name)\n @rate_scope = args[:rate_scope] if args.key?(:rate_scope)\n @retry_delay = args[:retry_delay] if args.key?(:retry_delay)\n end",
"def update\n respond_to do |format|\n if @admin_rate.update(admin_rate_params)\n format.html { redirect_to @admin_rate, notice: 'Rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_rate }\n else\n format.html { render :edit }\n format.json { render json: @admin_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n o = OvertimeRate.find(params[:id])\n \n if o.update_attributes(:duration => params[:duration], :year => params[:year], \n :pay_rate => params[:pay_rate])\n render :json => { :success => 1, \n :message => 'Pay Rate was successfully updated.' }\n \n else\n render :json => OvertimeRateHelper.get_errors(o.errors)\n end\n end",
"def update\n @rate_watcher = RateWatcher.find(params[:id])\n\n respond_to do |format|\n if @rate_watcher.update_attributes(params[:rate_watcher])\n format.html { redirect_to @rate_watcher, notice: 'Rate watcher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rate_watcher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rate.update(rate_params)\n format.html { redirect_to Book.find(params[:book_id]), notice: 'Rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate }\n else\n format.html { render :edit }\n format.json { render json: @rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exchange_rate.update(exchange_rate_params)\n format.html { redirect_to @exchange_rate, notice: 'Exchange rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @exchange_rate }\n else\n format.html { render :edit }\n format.json { render json: @exchange_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rate_service.update(rate_service_params)\n format.html { redirect_to @rate_service, notice: 'Rate service was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate_service }\n else\n format.html { render :edit }\n format.json { render json: @rate_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @run_at_rate = RunAtRate.find(params[:id])\n\n respond_to do |format|\n @run_at_rate.attachment.updated_by = current_user\n\n if @run_at_rate.update_attributes(run_at_rate_params)\n format.html { redirect_to run_at_rates_url, notice: 'Run at rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run_at_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_rate_up\n @rate_up = RateUp.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @page_rate.update(page_rate_params)\n format.html { redirect_to @page_rate, notice: 'Page rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rate = Rate.find(params[:id])\n\n #rate_type = (Rate::RATES.include?( @rate.symbol.to_sym ) ? :general : :management)\n #rate = (rate_type == :general ? Rate::RATES[@rate.symbol.to_sym] : Rate::MANAGEMENT_RATES[@rate.symbol.to_sym])\n\n respond_to do |format|\n if @rate.update_attributes(params[:rate])\n format.html { redirect_to(@rate, :notice => 'Rate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spending_rate = SpendingRate.find(params[:id])\n\n respond_to do |format|\n if @spending_rate.update_attributes(params[:spending_rate])\n format.html { redirect_to(@spending_rate, :notice => 'Spending rate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @spending_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_question_rate.update(user_question_rate_params)\n format.html { redirect_to @user_question_rate, notice: 'User question rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_question_rate }\n else\n format.html { render :edit }\n format.json { render json: @user_question_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ratecurry.update(ratecurry_params)\n format.html { redirect_to @ratecurry, notice: 'Ratecurry was successfully updated.' }\n format.json { render :show, status: :ok, location: @ratecurry }\n else\n format.html { render :edit }\n format.json { render json: @ratecurry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @room_rate = RoomRate.find(params[:id])\n\n respond_to do |format|\n if @room_rate.update_attributes(params[:room_rate])\n format.html { redirect_to @room_rate, notice: 'Room rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @room_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @ride.update(offer_1_ride_params)\n\t\t\t\t@ride.set_routes\n\t\t\t\t@ride.handle_return_date_and_recurring_weeks\n\t\t\t\tformat.html { redirect_to \"/#{@ride.id}/offer-seats/2\" }\n\t\t\t\tformat.json { render :show, status: :created, location: @ride }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @ride.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n if @tax_rate.update_attributes(params[:tax_rate])\n format.html { redirect_to @tax_rate, notice: 'Tax rate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tax_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_rate = ShippingRate.find(params[:id])\n @shipping_rate.updated_by = current_admin.email\n respond_to do |format|\n if @shipping_rate.update_attributes(params[:shipping_rate])\n format.html { redirect_to(admin_shipping_rates_path, :notice => 'ShippingRate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def edit\n @rate = OvertimeRate.find(params[:id])\n @form_id = 'edit-form'\n \n respond_to do |fmt|\n fmt.html { render :partial => 'form' }\n fmt.json { render :json => @rate }\n end\n end",
"def update_rating\n @packages = Packages.find(params[:pid])\n @packages.update(:rating => params[:rate])\n end",
"def rates_update\n @st = params[:st].to_s\n if @tariff and @st.length != 1\n dont_be_so_smart\n redirect_to :controller => :callc, :action => :main and return false\n end\n a=check_user_id_with_session(@tariff.owner_id)\n return false if !a\n @rates = @tariff.rates_by_st(@st, 0, 10000)\n @rates.each { |r|\n if params[:rate] and params[:rate][\"id_#{r.id}\".to_sym] and params[:rate][\"id_#{r.id}\".to_sym][:price] and r.price.to_d != params[:rate][\"id_#{r.id}\".to_sym][:price].to_d\n r.price = params[:rate][\"id_#{r.id}\".to_sym][:price].to_d\n r.save\n end\n }\n flash[:status] = _('Sms_rate_updated')\n redirect_to :action => 'rates', :id => params[:id], :st => @st, :page => params[:page]\n end",
"def update\n @flat_rate_price = FlatRatePrice.find(params[:id])\n\n respond_to do |format|\n if @flat_rate_price.update_attributes(params[:flat_rate_price])\n format.html { redirect_to @flat_rate_price, notice: 'Flat rate price was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flat_rate_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_bonus_offer.update_attributes(params[:shop_bonus_offer])\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rate_register.update(rate_register_params)\n format.html { redirect_to @rate_register, notice: 'Rate register was successfully updated.' }\n format.json { render :show, status: :ok, location: @rate_register }\n else\n format.html { render :edit }\n format.json { render json: @rate_register.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rat.update(rat_params)\n format.html { redirect_to @rat, notice: 'Rat was successfully updated.' }\n format.json { render :show, status: :ok, location: @rat }\n else\n format.html { render :edit }\n format.json { render json: @rat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app = App.find(params[:id])\n \n respond_to do |format|\n if @app.update_attributes(params[:app]) and @app.rating.update_attributes(params[:rating])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @app.errors, :status => :unprocessable_entity }\n format.json { render :json => @app.errors, :status => :unprocessable_entity } \n end\n end\n end",
"def update\n @rate_type = RateType.find(params[:id])\n\n respond_to do |format|\n if @rate_type.update_attributes(params[:rate_type])\n format.html { redirect_to(@rate_type, :notice => 'Rate type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def change_rate(rate) #TODO: separate rate changes to be dependant on dates/reservations/blocks\n @rate = rate\n end",
"def update\n respond_to do |format|\n if @coinrate.update(coinrate_params)\n format.html { redirect_to exchanges_path, notice: 'La cotizacion se ha modificado con exito.' }\n format.json { render :show, status: :ok, location: @coinrate }\n else\n format.html { render :edit }\n format.json { render json: @coinrate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_replay_rate.update(user_replay_rate_params)\n format.html { redirect_to @user_replay_rate, notice: 'User replay rate was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_replay_rate }\n else\n format.html { render :edit }\n format.json { render json: @user_replay_rate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updated_rates\n @rate = Rate.find_by_id(1)\n @rate.ordinary_post = params[:rate][:ordinary_post]\n @rate.speed_post = params[:rate][:speed_post]\n \n if @rate.save\n flash[:notice] = \" Rates are updated successfully\"\n redirect_to :action => \"fix_rates\" \n else\n flash[:notice] = \" Rates are not updated\"\n end #if @rate.save\n\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if @plate.update(plate_params)\n if !(:rate_changed?)\n format.html { redirect_to restaurante_plate_path(@restaurante, @plate),\n notice: 'Restaurante actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @restaurante }\n else\n format.html {redirect_to restaurante_plate_path(@restaurante, @plate)}\n format.json { render :show, status: :ok, location: @restaurante }\n end\n else\n format.html { render :edit }\n format.json { render json: @plate.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, buyer_account\n\n buyer_account.vat_rate = params[:vat_rate].to_f if params[:vat_rate]\n buyer_account.settings.attributes = billing_params\n buyer_account.update_with_flattened_attributes(flat_params)\n\n respond_with(buyer_account)\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def set_rate\n @rate = Rate.find(params[:id])\n end",
"def update\n @heart_rate_type = HeartRateType.find(params[:id])\n\n respond_to do |format|\n if @heart_rate_type.update_attributes(params[:heart_rate_type])\n format.html { redirect_to @heart_rate_type, notice: 'Heart rate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heart_rate_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rate = Rate.find(params[:id])\n @rate.area = Area.find(params[:area_id])\n @area = @rate.area\n @city = @area.city\n\n respond_to do |format|\n if @rate.update_attributes(params[:rate])\n format.html { redirect_to [@rate.area.city,@rate.area,@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, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource @ride, ride_params\n end",
"def updateOffer()\n @offer_operation = :update\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @rating.update(rating_params)\n format.html {redirect_to @rating, notice: 'Payment was successfully updated.'}\n format.json {render :show, status: :ok, location: @rating}\n else\n format.html {render :edit}\n format.json {render json: @rating.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n respond_to do |format|\n if @account.update_attributes(params[:account])\n @account.allocation_rate = params[:allocation_rate]\n @account.save\n format.html { redirect_to accounts_path, notice: 'Account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @travel_claim_mileage_rate = TravelClaimMileageRate.find(params[:id])\n\n respond_to do |format|\n if @travel_claim_mileage_rate.update_attributes(params[:travel_claim_mileage_rate])\n format.html { redirect_to(travel_claim_mileage_rates_url, :notice => t('mileagerates.title2')+\" \"+t('updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @travel_claim_mileage_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rateclass.update(rateclass_params)\n format.html { redirect_to rateclasses_path, notice: 'Rateclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @rateclass }\n else\n format.html { render :edit }\n format.json { render json: @rateclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @sample_rate = args[:sample_rate] if args.key?(:sample_rate)\n end",
"def edit_rates\n @rate = Rate.find_by_id(1)\n end",
"def update\n respond_to do |format|\n if @auto_offer.update(auto_offer_params)\n format.html { redirect_to @auto_offer, notice: 'Auto offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def rate_up_params\n params.require(:rate_up).permit(:user_id, :review_id)\n end",
"def update\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n if @tax_rate.update_attributes(params[:tax_rate])\n format.html { redirect_to(@tax_rate, :notice => 'Tax rate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tax_rate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @point_consumption = PointConsumption.find(params[:id])\n\n respond_to do |format|\n if @point_consumption.update_attributes(params[:point_consumption])\n format.html { redirect_to @point_consumption, :notice => 'Point consumption was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @point_consumption.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rating = Rating.find(params[:id])\n\n respond_to do |format|\n if @rating.update_attributes(params[:rating])\n format.html { redirect_to @rating, notice: 'Rating was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n @book = @reviewing.book\n \n respond_to do |format|\n if @reviewing.update(reviewing_params)\n @book.updateRate(@book.id)\n format.html { redirect_to book_reviewings_path(@reviewing.book.isbn), notice: 'Reviewing was successfully updated.' }\n format.json { render :show, status: :ok, location: @reviewing }\n else\n format.html { render :edit }\n format.json { render json: @reviewing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @restaurante.update(restaurante_params)\n if !(:rate_changed?)\n format.html { redirect_to @restaurante,\n notice: 'Restaurante actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @restaurante }\n else\n format.html {redirect_to @restaurante}\n format.json { render :show, status: :ok, location: @restaurante }\n end\n else\n format.html { render :edit }\n format.json { render json: @restaurante.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update opts={}\n time = helper.assure_time(opts[:at])\n \n Call.new(api_url(time), :at => time, :api => self.class) do |result|\n @base = result['base'].downcase.to_sym\n @rates = extract_rates(result)\n @timestamp = result['timestamp'].to_i\n end\n end",
"def update\n respond_to do |format|\n if @effort_rating.update(effort_rating_params)\n format.html { redirect_to @effort_rating, notice: 'Effort rating was successfully updated.' }\n format.json { render :show, status: :ok, location: @effort_rating }\n else\n format.html { render :edit }\n format.json { render json: @effort_rating.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer.user, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @offer }\n else\n format.html { render :edit }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @review.update(review_params)\n @paper = @review.paper\n @rate = 0.0\n @top = 0.0\n @bottem = 0.0\n @paper.reviews.each do |review| \n @top += review.score * review.confidence\n @bottem += review.confidence\n end\n @rate = @top / @bottem\n @paper.update_attribute(:rating, @paper.rating = @rate)\n format.html { redirect_to @review, notice: 'Review was successfully updated.' }\n format.json { render :show, status: :ok, location: @review }\n else\n format.html { render :edit }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asset.update(price: params[:asset][:price])\n json_response(@asset,:created)\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end"
] |
[
"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.6123026",
"0.61170053",
"0.61149645",
"0.6088208",
"0.60854965",
"0.60807085",
"0.60691935",
"0.6066593",
"0.606487",
"0.6058727",
"0.6052031",
"0.60512334",
"0.60482794",
"0.6048221",
"0.6045698",
"0.60249937",
"0.6017529",
"0.6007252",
"0.59948635",
"0.5977027",
"0.5967742",
"0.5963305",
"0.5962375",
"0.5956544",
"0.5955309",
"0.59306157",
"0.59306157",
"0.59306157",
"0.59103984",
"0.59065485",
"0.5904772",
"0.5904772",
"0.5904772",
"0.5904772",
"0.5899789",
"0.5897237",
"0.5892612",
"0.58923465",
"0.58902025",
"0.5890069",
"0.5888663",
"0.5875667",
"0.58739907",
"0.5872495",
"0.5845495",
"0.58442396",
"0.58380526",
"0.58370435",
"0.5833307",
"0.5817191",
"0.58123535",
"0.5812344",
"0.58085865",
"0.5805001",
"0.5796486",
"0.5794689",
"0.5786411",
"0.5777021",
"0.5775073",
"0.57738256",
"0.5771272",
"0.5771078",
"0.5770751",
"0.5770751",
"0.5770751",
"0.5770751",
"0.5767337",
"0.57669616",
"0.576091",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636",
"0.57517636"
] |
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 run_at_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate = Rate.find(params[:id])\n @rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(rates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate.destroy\n respond_to do |format|\n format.html { redirect_to rates_url, notice: \"Rate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_rate.destroy\n respond_to do |format|\n format.html { redirect_to page_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_rate.destroy\n respond_to do |format|\n format.html { redirect_to admin_rates_url, notice: 'Rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rate_watcher = RateWatcher.find(params[:id])\n @rate_watcher.destroy\n\n respond_to do |format|\n format.html { redirect_to rate_watchers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_rate = ShippingRate.find(params[:id])\n @shipping_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_rates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rate_service.destroy\n respond_to do |format|\n format.html { redirect_to rate_services_url, notice: 'Rate service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exchange_rate.destroy\n respond_to do |format|\n format.html { redirect_to exchange_rates_url, notice: 'Exchange rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @rate_type = RateType.find(params[:id])\n @rate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(rate_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spending_rate = SpendingRate.find(params[:id])\n @spending_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(spending_rates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user_replay_rate.destroy\n respond_to do |format|\n format.html { redirect_to user_replay_rates_url, notice: 'User replay rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_rate_price = FlatRatePrice.find(params[:id])\n @flat_rate_price.destroy\n\n respond_to do |format|\n format.html { redirect_to flat_rate_prices_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @coinrate.destroy\n respond_to do |format|\n format.html { redirect_to exchanges_path, notice: 'La cotizacion se ha eliminado con exito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @room_rate = RoomRate.find(params[:id])\n @room_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to room_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n year = params[:year].blank? ? 0 : params[:year].to_i\n pgnum = params[:pgnum].blank? ? 1 : params[:pgnum].to_i\n pgsize = params[:pgsize].blank? ? 0 : params[:pgsize].to_i\n ids = params[:id]\n \n OvertimeRate.delete_all(:id => ids)\n \n filters = { :year => year }\n \n if year == 0\n itemscount = OvertimeRateHelper.item_message(nil, pgnum, pgsize)\n \n else\n itemscount = OvertimeRateHelper.item_message(filters, pgnum, pgsize)\n end\n \n render :json => { :success => 1, \n :itemscount => itemscount, \n :message => %Q{#{ids.size} Overtime rate(s) was successfully \n deleted.} }\n end",
"def destroy\n @rat.destroy\n respond_to do |format|\n format.html { redirect_to rats_url, notice: 'Rat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heart_rate_type = HeartRateType.find(params[:id])\n @heart_rate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heart_rate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @recall = Recall.find(params[:id])\n @recall.destroy\n\n respond_to do |format|\n format.html { redirect_to [:admin,:recalls], notice: 'Отзыв удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_question_rate.destroy\n respond_to do |format|\n format.html { redirect_to user_question_rates_url, notice: 'User question rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_increase.destroy\n respond_to do |format|\n format.html { redirect_to payment_increases_url, notice: 'Payment increase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(tax_rates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gain = Gain.find(params[:id])\n @gain.destroy\n\n respond_to do |format|\n format.html { redirect_to gains_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rateclass.destroy\n respond_to do |format|\n format.html { redirect_to rateclasses_url, notice: 'Rateclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rebate = Rebate.find(params[:id])\n @rebate.destroy\n\n respond_to do |format|\n format.html { redirect_to rebates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ptel_reup.destroy\n respond_to do |format|\n format.html { redirect_to ptel_reups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineup = Lineup.find(params[:id])\n @lineup.destroy\n\n respond_to do |format|\n format.html { redirect_to lineups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating.destroy\n respond_to do |format|\n format.html {redirect_to ratings_url, notice: 'Payment was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @restaurant_table_rating.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_table_ratings_url, notice: 'Restaurant table rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to ratings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rating_alt = Rating.find(params[:id])\n @rating_alt.destroy\n\n respond_to do |format|\n format.html { redirect_to rating_alts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipcount.destroy\n respond_to do |format|\n format.html { redirect_to shipcounts_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @roomrate = Roomrate.find(params[:id])\n @roomrate.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roomrates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @withdraw.destroy\n respond_to do |format|\n format.html { redirect_to withdraws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substrate = Substrate.find(params[:id])\n @substrate.destroy\n\n respond_to do |format|\n format.html { redirect_to substrates_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers={})\n RestClient.delete url, headers\n end",
"def destroy\n @rate_change_history = RateChangeHistory.find(params[:id])\n @rate_change_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(rate_change_histories_url) }\n format.xml { head :ok }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @currency_m_excng_rate.destroy\n respond_to do |format|\n format.html { redirect_to currency_m_excng_rates_url, notice: 'Currency m excng rate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id:)\n id_check('id', id)\n\n cf_delete(path: \"/zones/#{zone_id}/rate_limits/#{id}\")\n end",
"def destroy\n @avail = Avail.find(params[:id])\n @avail.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @withdrawal_request = WithdrawalRequest.find(params[:id])\n @withdrawal_request.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawal_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @create_rating = CreateRating.find(params[:id])\n @create_rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(create_ratings_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @rum = Rum.find(params[:id])\n @rum.destroy\n\n respond_to do |format|\n format.html { redirect_to rums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_answer_upvote.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answer_upvotes_url, notice: 'Answer upvote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pushup = Pushup.find(params[:id])\n @pushup.destroy\n\n respond_to do |format|\n format.html { redirect_to pushups_url }\n format.json { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_reward.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_rewards_url, notice: 'Reward was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @top_up = TopUp.find(params[:id])\n @top_up.destroy\n\n respond_to do |format|\n format.html { redirect_to top_ups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @rezultate.destroy\n respond_to do |format|\n format.html { redirect_to rezultates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end",
"def destroy\n @sculpture.destroy\n respond_to do |format|\n format.html { redirect_to sculptures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @development_rate=@rate_register.development_rate_id\n @rate_register.destroy\n respond_to do |format|\n format.html { redirect_to '/development_rates/'+@development_rate.to_s+'/edit', notice: 'Rate register was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pay = Pay.find(params[:id])\n @pay.destroy\n\n respond_to do |format|\n format.html { redirect_to pays_url }\n format.json { head :no_content }\n end\n end",
"def delete!\n Recliner.delete(uri)\n end",
"def destroy\n f_respond_destroy(@ratecurry.destroy, @ratecurry.id.to_s, ratecurries_url)\n#\n# @ratecurry.destroy\n# respond_to do |format|\n# format.html { redirect_to ratecurries_url, notice: 'Ratecurry was successfully destroyed.' }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @uriy.destroy\n respond_to do |format|\n format.html { redirect_to uriys_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def delete!\n request! :delete\n end",
"def destroy\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n @shop_bonus_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_bonus_offers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rating = Rating.find(params[:id])\n @rating.destroy\n\n respond_to do |format|\n format.html { redirect_to(ratings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @travel_claim_mileage_rate = TravelClaimMileageRate.find(params[:id])\n @travel_claim_mileage_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to(travel_claim_mileage_rates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finale_rating.destroy\n respond_to do |format|\n format.html { redirect_to finale_ratings_url, notice: 'Finale rating was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to exps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dialer_price.destroy\n respond_to do |format|\n format.html { redirect_to dialer_prices_url, notice: 'Dialer price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end"
] |
[
"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.6480489",
"0.6474104",
"0.6461257",
"0.6455395",
"0.6396824",
"0.6396705",
"0.639398",
"0.63813996",
"0.6377607",
"0.6363253",
"0.6354004",
"0.63482857",
"0.6345582",
"0.63354623",
"0.6331444",
"0.6331444",
"0.63291377",
"0.63188547",
"0.6297061",
"0.6287959",
"0.62855864",
"0.62814164",
"0.6280518",
"0.6270575",
"0.626903",
"0.62641287",
"0.62623006",
"0.62586546",
"0.6250428",
"0.62472445",
"0.6234257",
"0.623354",
"0.6227422",
"0.6224077",
"0.622379",
"0.621926",
"0.6218781",
"0.6207521",
"0.6207053",
"0.6204004",
"0.62027895",
"0.6199901",
"0.61995274",
"0.61953604",
"0.6194655",
"0.6192494",
"0.61908203",
"0.61850274",
"0.618177",
"0.618177",
"0.618177",
"0.618177",
"0.6180792",
"0.6180277",
"0.6175356",
"0.6168537",
"0.6168265",
"0.6165135",
"0.61646694",
"0.61636",
"0.6159475",
"0.6158959",
"0.61573446",
"0.6156887",
"0.61563563",
"0.615333",
"0.6146663",
"0.61410415",
"0.61380047",
"0.6137621",
"0.61371356",
"0.6134494",
"0.6130882",
"0.61282593",
"0.6128023",
"0.612779",
"0.6127081",
"0.6126205",
"0.612482",
"0.6119289"
] |
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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53307265",
"0.5312121",
"0.5298173",
"0.5296388",
"0.52952695",
"0.5258086",
"0.52430934",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.52335346",
"0.5232943",
"0.5226392",
"0.52221715",
"0.5217978",
"0.52136153",
"0.52076435",
"0.52067244",
"0.5175402",
"0.5174649",
"0.5173085",
"0.5165201",
"0.5162052",
"0.5157932",
"0.5152905",
"0.5152353",
"0.5150909",
"0.514719",
"0.5138596",
"0.51333916",
"0.51139015",
"0.5113431",
"0.5113431",
"0.5109581",
"0.51066816",
"0.5091428",
"0.5089407",
"0.5082971",
"0.50822043",
"0.50668514",
"0.5055155",
"0.50525695",
"0.50499475",
"0.50499475",
"0.5034445",
"0.50249445",
"0.5022226",
"0.50167644",
"0.5014211",
"0.4999924",
"0.49996212",
"0.49978727",
"0.4989682",
"0.4989682",
"0.49851838",
"0.49817684",
"0.4979687",
"0.49787104",
"0.49688423",
"0.49664098",
"0.49564412",
"0.49561828",
"0.49547398",
"0.4953481",
"0.4952925",
"0.4946049",
"0.494379",
"0.49319315",
"0.49313048",
"0.49269778",
"0.49263066",
"0.49257493",
"0.4924526",
"0.49212465",
"0.49173486",
"0.4915802",
"0.49151486",
"0.49150333",
"0.49147308"
] |
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]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def params(list)\n @declared_params = list\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"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.63136744",
"0.63001245",
"0.6264419",
"0.62613016",
"0.6259317",
"0.623719",
"0.6227251",
"0.6220037",
"0.621864",
"0.620889",
"0.6199145",
"0.61970234",
"0.61728656",
"0.61563927",
"0.6155928",
"0.6152361",
"0.6136508",
"0.6122662",
"0.6109611",
"0.60738647",
"0.6072253",
"0.6058575",
"0.60571283",
"0.6044282",
"0.6033789",
"0.6018841",
"0.601607",
"0.6014327",
"0.6010113",
"0.60086375",
"0.60080284",
"0.60060716",
"0.6004647",
"0.6004647",
"0.5999453",
"0.59945875",
"0.5990942",
"0.5983142",
"0.5969449",
"0.59688187",
"0.5965012",
"0.5964062",
"0.5960668",
"0.59599936",
"0.59338915",
"0.59288186",
"0.5921217",
"0.59072363",
"0.59049433",
"0.58997554",
"0.58917797",
"0.5890338",
"0.5879621",
"0.5879621",
"0.5879621",
"0.5872355",
"0.58605725",
"0.5853338",
"0.58435106",
"0.5842603",
"0.58328134",
"0.5830374",
"0.5829657",
"0.5828463",
"0.5817261",
"0.58149874",
"0.58147764",
"0.5810487",
"0.5801209",
"0.5801009",
"0.5801009",
"0.5794343",
"0.5785498",
"0.57794553",
"0.5778505",
"0.577467",
"0.57682633",
"0.5768243",
"0.57627535",
"0.5757951"
] |
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_params[key.to_s]\n else\n raise ArgumentError, \"param takes either one (getter) or two (setter) arguments\"\n end\n end",
"def params\n raise NotImplementedError\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params=(value); end",
"def get_params\n @set_params\n end",
"def parameters=(_); end",
"def get_parameters; end",
"def get_parameters; end",
"def params=(_); end",
"def parameters\n @parameters ||= {}\n end",
"def parameters\n @parameters ||= {}\n end",
"def parameters\n attributes.fetch(:parameters)\n end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def parameters; end",
"def params\n @_params\n end",
"def params\n _params\n end",
"def params\n @@params\n end",
"def params\n @parameters\n end",
"def params\n @params ||= {}\n end",
"def params\n @params ||= {}\n end",
"def query_parameters; end",
"def params\n @params ||= {}\n end",
"def params\n @params ||= {}\n end",
"def params\n @params\n end",
"def params\n @params\n end",
"def params\n @params\n end",
"def parameters(params)\n params.each do |key, value|\n send(\"#{key}=\".to_sym, value) if self.respond_to?(key)\n end\n end",
"def params=(pa)\n\t if method == :post\n\t\t @post_params = pa\n\t else\n\t\t @get_params = pa\n\t end\n end",
"def query_parameters\n end",
"def set(params = {})\n self.params.merge!(params)\n end",
"def parameters\n @property_hash[:parameters]\n end",
"def parameters\n @parameters\n end",
"def params\n @params\n end",
"def param; end",
"def param; end",
"def params=(value)\n @_params = value.is_a?(Hash) ? Dynamometer::Parameters.new(value) : value\n end",
"def params=(hash); end",
"def params=(hash); end",
"def set_stored_parameters(params={})\r\n @PARAM_HASH['STORED_INDICATOR'] = params[:stored_indicator] || ''\r\n @PARAM_HASH['STORED_TYPE'] = params[:stored_type] || ''\r\n @PARAM_HASH['STORED_ID'] = params[:stored_id] || ''\r\n end",
"def query_params; end",
"def params\n @_params ||= Dynamometer::Parameters.new(request.parameters)\n end",
"def get_parameters\r\n @parameters\r\n end",
"def parameters\n self.class.parameters.each_with_object({}) do |parameter, hash|\n hash[parameter.name] = send(parameter.name)\n end\n end",
"def set(params = {})\n params.each do |k,v|\n self.class.attributes k.to_s\n send(k.to_s+\"=\",v)\n end\n end",
"def parameters\n data[:parameters]\n end",
"def params\n @parameter_collection ||= ParameterCollection.new(self)\n end",
"def set_params params\n raise \"No Params\" if params.nil?\n params.each do |key, value|\n raise \"key nil\" if key.nil?\n raise \"value nil\" if value.nil?\n self.preferences[key.to_sym] = value if valid_key?(key)\n end\n raise \"save failed: #{errors}\" unless self.save\n assure_created_zip\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def update_params\n raise 'Sovrascrivi in figli'\n end",
"def parameters=(_arg0); end",
"def set_params(params)\n @params = params\n end",
"def parameters\n @parameters ||= get_field_by_type(PARAMETER_FIELDS)\n end",
"def set_parameter \n @parameter = Parameter.find(params[:parameter_id])\n end",
"def attributes=(params)\n end",
"def parameters\n @parameters ||= Parameters.new\n end",
"def update!(**args)\n @parameter = args[:parameter] if args.key?(:parameter)\n end",
"def update!(**args)\n @parameter = args[:parameter] if args.key?(:parameter)\n end",
"def params\n return @params\n end",
"def params\n @params ||= { }\n end",
"def query_params=(_arg0); end",
"def all_params; end",
"def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end",
"def define_parameter(params)\n @properties[:parameters] = Hashie::Mash.new unless @properties.key?(:parameters)\n if params.kind_of? Hash\n @properties[:parameters].merge!(params)\n else\n error \"Cannot define parameter for app '#{self.name}'! Parameter \"+\n \"not passed as a Hash ('#{params.inspect}')\"\n end\n end",
"def update!(**args)\n @parameter_id = args[:parameter_id] if args.key?(:parameter_id)\n @value = args[:value] if args.key?(:value)\n end",
"def get_params\n\n return @params.map { |p| \n Param.new(\n name,\n @params[name].get_data(\"value\"),\n @params[name].get_data(\"type\"),\n true\n ) \n }\n end",
"def params() @param_types end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end",
"def parameters=(value)\n @parameters = value\n end",
"def __assign_params(data, version = nil)\n if not @params.nil? and not @params.empty?\n data[:params] = @params\n elsif not @keyword_params.nil? and not @keyword_params.empty?\n data[:params] = Utils::Hash.map_keys(@keyword_params) { |k| k.to_s } \n end\n end",
"def param(type, title, param)\n param_value(catalogue, type, title, param)\nend",
"def param(type, title, param)\n param_value(catalogue, type, title, param)\nend",
"def context_params(data=nil)\n set_get __method__, data\n end",
"def set_parametrage\n @parametrage = Parametrage.find(params[:id])\n end",
"def params\n RequestStore.store[:params]\n end",
"def params() request.params end",
"def set_parameters_value\n @parameters_value = ParametersValue.find(params[:id])\n end",
"def setup_params(parms, for_download=false)\n report_state_hash = YAML.load(self.view_state)\n\n parms[:parameter_field] = {:excel_only => '0' }\n report_state_hash[:parameter_fields_values].each do |parm_set|\n parms[:parameter_field][parm_set[:field_name]] = parm_set[:field_value]\n parms[:parameter_field][\"#{parm_set[:field_name]}-sign\"] = report_state_hash[:operator_signs][parm_set[:field_value]]\n end\n parms[:parameter_field]['excel_only'] = for_download ? '0' : '1'\n parms['apply_functions_hidden_field'] = report_state_hash[:functions]\n parms['group_by_hidden_field'] = report_state_hash[:search_engine_group_by_columns]\n parms['order_by_hidden_field'] = report_state_hash[:search_engine_order_by_columns]\n end",
"def params\n @params ||= self.class.params.dup\n end"
] |
[
"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.68386817",
"0.6828632",
"0.6756741",
"0.6756741",
"0.6732893",
"0.67109334",
"0.67109334",
"0.66215664",
"0.6591628",
"0.6591628",
"0.6591628",
"0.6591628",
"0.6591628",
"0.6591628",
"0.6591628",
"0.6591628",
"0.65909356",
"0.6590394",
"0.6517823",
"0.64384544",
"0.6429463",
"0.6429463",
"0.642339",
"0.64185435",
"0.64185435",
"0.63898367",
"0.63898367",
"0.63898367",
"0.6375537",
"0.6362603",
"0.6358187",
"0.6351958",
"0.6347449",
"0.6346137",
"0.63214135",
"0.62959516",
"0.62959516",
"0.62889826",
"0.62782913",
"0.62782913",
"0.6265683",
"0.6256694",
"0.6233346",
"0.621626",
"0.6204141",
"0.6203817",
"0.617351",
"0.61318415",
"0.61171377",
"0.61162144",
"0.6109713",
"0.6105365",
"0.61003125",
"0.6096963",
"0.6075258",
"0.60705364",
"0.60663277",
"0.60559064",
"0.60559064",
"0.6052263",
"0.60498005",
"0.6040595",
"0.60405314",
"0.60392565",
"0.60392565",
"0.603093",
"0.6014658",
"0.6008567",
"0.5982744",
"0.5960662",
"0.59545594",
"0.59429014",
"0.593328",
"0.593328",
"0.5929068",
"0.5927539",
"0.5915136",
"0.59102863",
"0.5907503",
"0.59052616",
"0.59025806"
] |
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 # show.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def index\n @causals = Causal.all\n end",
"def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end",
"def show\n @capacite = Capacite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacite }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def show\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end",
"def meals\n get(\"/user/#{@user_id}/meals.json\")\n end",
"def show\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @irregular_verb }\n end\n end",
"def show\n render json: @citation\n end",
"def show\n render json: @citation\n end",
"def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def find_capitals(hash)\n hash.each do |sub_hash|\n sub_hash.each do |result|\n return result\n end\n end\nend",
"def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n order = sortable_column_order, \"capa_number desc\"\n @capas = Capa.all\n @capas = Capa.paginate page: params[:page], order: order, per_page: 50\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capas }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end",
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @arsenals = Arsenal.all\n end",
"def show\n @ca = Ca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ca }\n end\n end",
"def index\n @verbs = Verb.active.to_a \n @lines = @lines.where(:verb_id => params[:verb_id]) unless params[:verb_id].nil? \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lines }\n end\n end",
"def show\n @patentcase = Patentcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patentcase }\n end\n end",
"def show\n render json: @verb\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end",
"def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end",
"def read_data_from_file\n file = File.read(\"condensed_capitals.json\")\n @countries_capitals_as_hash = JSON.parse(file)\n end",
"def create\n @capital = Capital.new(capital_params)\n\n respond_to do |format|\n if @capital.save\n format.html { redirect_to @capital, notice: 'Capital was successfully created.' }\n format.json { render :show, status: :created, location: @capital }\n else\n format.html { render :new }\n format.json { render json: @capital.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_capital\n @capital = Capital.find(params[:id])\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def show\n @creative = Creative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creative }\n end\n end",
"def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end",
"def show\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadet }\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def index\n @captains = Captain.all\n end",
"def update_arizona\n $capitals[:arizona] = \"Phoenix\"\nend",
"def index\n @capacidads = Capacidad.all\n end",
"def give_me_capital_cities(countries_hash)\n capitals=Array.new #note: could have done captials = []\n \n countries_hash.each {|key, value|\n capitals << countries_hash[key][:capital]\n }\n\n return capitals\n\nend",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end",
"def show\n render json: @choice\n end",
"def index\n @cultures = Culture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cultures }\n end\n end",
"def show\n @cap = Cap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cap }\n end\n end",
"def show\n @cap = Cap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cap }\n end\n end",
"def show\n @law = Law.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @law }\n end\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @benefit_category }\n end\n end",
"def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end",
"def show\n @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrest_record_and_conduct }\n end\n end",
"def index\n @benefit_categories = BenefitCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @benefit_categories }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def new\n @capital_account = CapitalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @capital_account }\n end\n end",
"def show\n @vital_sign = VitalSign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vital_sign }\n end\n end",
"def show\n render json: @clan_match\n end",
"def show\n\t\t@pharmacy = Pharmacy.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @pharmacy }\n\t\tend\n\tend",
"def show\n @inkcatagory = Inkcatagory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkcatagory }\n end\n end",
"def show\n @laccount = Laccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laccount }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n add_breadcrumb @challenge.title, @challenge\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optin_contestant }\n end\n end",
"def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def print_states_capitals\n a = $capitals.to_a\n counter = 0\n a.each do |i|\n puts \"The capital of #{a[counter][0].capitalize} is #{a[counter][1]}.\"\n counter += 1\n end\nend",
"def show\n @abuse_category = AbuseCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @abuse_category }\n end\n end",
"def index\n @allies = Ally.all\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @challenge }\n end\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def show\n @secry = Secry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secry }\n end\n end",
"def index\n @cicts = Cict.all\n end",
"def show\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clientcase }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def index\n @cannings = Canning.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cannings }\n end\n end",
"def show\n @continent = Continent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @continent }\n end\n end",
"def show\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasp }\n end\n end",
"def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end",
"def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end",
"def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end",
"def index\n @countries = Country.all\n\n render json: @countries\n end",
"def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end",
"def show\n @english_entry = EnglishEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @english_entry }\n end\n end",
"def index\n @clan_matches = ClanMatch.all\n\n render json: @clan_matches\n end",
"def index\n @encriptions = Encription.all\n respond_to do |format|\n \n format.html \n format.json { render json: @encriptions }\n \n end\n end",
"def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end",
"def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end"
] |
[
"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.5486098",
"0.54847366",
"0.5484314",
"0.5471507",
"0.54639345",
"0.5443702",
"0.5436786",
"0.54331696",
"0.54295504",
"0.5428331",
"0.5419366",
"0.5417906",
"0.5417165",
"0.5415434",
"0.5411556",
"0.54070836",
"0.54001707",
"0.53871137",
"0.5379345",
"0.5374629",
"0.5370679",
"0.53685564",
"0.53685564",
"0.5356573",
"0.534136",
"0.53352565",
"0.5335092",
"0.5335092",
"0.53333616",
"0.5330147",
"0.53266025",
"0.53264606",
"0.53134906",
"0.5298534",
"0.5286275",
"0.52858967",
"0.5285044",
"0.5283612",
"0.528076",
"0.52784497",
"0.5271966",
"0.52667826",
"0.52662665",
"0.52653855",
"0.5256199",
"0.52557355",
"0.5253419",
"0.52524203",
"0.5251294",
"0.5250605",
"0.5243961",
"0.5241631",
"0.5239308",
"0.5237679",
"0.52322346",
"0.5223656",
"0.52158755",
"0.52114797",
"0.52079254",
"0.5204861",
"0.51898587",
"0.51874274",
"0.51847214",
"0.51847214",
"0.51847214",
"0.51831913",
"0.5180266",
"0.5177107",
"0.517553",
"0.5175213",
"0.5173389",
"0.5172705",
"0.51697123",
"0.5166236",
"0.5165503",
"0.5162492",
"0.5159018",
"0.5155358",
"0.51531506",
"0.51525545"
] |
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_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacite }\n end\n end",
"def show\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end",
"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 @causale = Causale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @causale }\n end\n end",
"def show\n @cap = Cap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cap }\n end\n end",
"def show\n @cap = Cap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cap }\n end\n end",
"def show\n @creative = Creative.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @creative }\n end\n end",
"def show\n @ca = Ca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ca }\n end\n end",
"def show\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @irregular_verb }\n end\n end",
"def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def index\n @verbs = Verb.all\n\n render json: @verbs\n end",
"def index\n order = sortable_column_order, \"capa_number desc\"\n @capas = Capa.all\n @capas = Capa.paginate page: params[:page], order: order, per_page: 50\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capas }\n end\n end",
"def show\n @advocacy = Advocacy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @advocacy }\n end\n end",
"def show\n render json: @citation\n end",
"def show\n render json: @citation\n end",
"def show\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @clientcase }\n end\n end",
"def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end",
"def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def show\n @vital_sign = VitalSign.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vital_sign }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadet }\n end\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @county }\n end\n end",
"def show\n @capd = Capd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @capd }\n end\n end",
"def show\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_compliance }\n end\n end",
"def show\n @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrest_record_and_conduct }\n end\n end",
"def show\n @continent = Continent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @continent }\n end\n end",
"def show\n @crust = Crust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crust }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @chapter = Chapter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @voc = Voc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @voc }\n end\n end",
"def show\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chiropractic_assessment }\n end\n end",
"def show\n @cap_date = CapDate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cap_date }\n end\n end",
"def index\n @causals = Causal.all\n end",
"def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def show\n @benefit_category = BenefitCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @benefit_category }\n end\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end",
"def show\n @initiative = Initiative.find(params[:id])\n\n respond_to do |format|\n format.html # _show.html.erb\n format.json { render json: @initiative }\n end\n end",
"def show\n @patentcase = Patentcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @patentcase }\n end\n end",
"def show\n @culture = Culture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @culture }\n end\n end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @criterion }\n end\n end",
"def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end",
"def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optin_contestant }\n end\n end",
"def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end",
"def show\n @court = Court.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def show\n @secry = Secry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secry }\n end\n end",
"def index\n @cultures = Culture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cultures }\n end\n end",
"def index\n @captains = Captain.all\n end",
"def show\n @cover_cat = CoverCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cover_cat }\n end\n end",
"def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end",
"def show\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasp }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @clue = Clue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clue }\n end\n end",
"def show\n @cvi = Cvi.find(params[:id])\n @animals = @cvi.animals\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cvi }\n end\n end",
"def show\n render json: @verb\n end",
"def show\n @clinician = Clinician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinician }\n end\n end",
"def show\n @crunch_company = CrunchCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crunch_company }\n end\n end",
"def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def show\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @click_thru }\n end\n end",
"def show\n @coin_set = CoinSet.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coin_set }\n end\n end",
"def show\n render json: @choice\n end",
"def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospitalization }\n end\n end",
"def show\n @inkcatagory = Inkcatagory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inkcatagory }\n end\n end",
"def show\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end",
"def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end",
"def show\n @catebg = Catebg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @catebg }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\n @capacidads = Capacidad.all\n end",
"def show\n @squishee_cup = SquisheeCup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @squishee_cup }\n end\n end",
"def index\n @choices = Choice.all\n\n render json: @choices\n end",
"def show\n @credit_type = CreditType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit_type }\n end\n end",
"def show\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contacter }\n end\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end",
"def show\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus_characteristic }\n end\n end",
"def show\n render json: @clan_match\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end"
] |
[
"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.5930434",
"0.5923264",
"0.59084797",
"0.59058553",
"0.5905632",
"0.589879",
"0.589879",
"0.58973294",
"0.5885468",
"0.58800966",
"0.58792335",
"0.58758456",
"0.5875535",
"0.5871876",
"0.58676624",
"0.58676624",
"0.5865096",
"0.5861966",
"0.5859545",
"0.5850572",
"0.58424264",
"0.58414483",
"0.58384764",
"0.58287764",
"0.58283585",
"0.5827906",
"0.5820176",
"0.58180434",
"0.5814309",
"0.58142465",
"0.5812463",
"0.58082867",
"0.5806661",
"0.5805811",
"0.5803436",
"0.58030915",
"0.5800052",
"0.57968754",
"0.57959056",
"0.5791115",
"0.57865953",
"0.5779725",
"0.5766729",
"0.5762505",
"0.5754434",
"0.5754434",
"0.57542545",
"0.57492584",
"0.5747824",
"0.5739377",
"0.5731114",
"0.572724",
"0.57260615",
"0.5725952",
"0.5722679",
"0.5721856",
"0.57210296",
"0.571854",
"0.5718192",
"0.571805",
"0.5716073",
"0.5716073",
"0.57108665",
"0.5709736",
"0.5709736",
"0.5709736",
"0.5708398",
"0.5707518",
"0.57066286",
"0.5699114",
"0.5698142",
"0.56958896",
"0.5693909",
"0.56741375",
"0.56739634",
"0.56719303",
"0.5670543",
"0.5668799",
"0.56642973",
"0.56633747",
"0.56623286"
] |
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: @capacitacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @capacitacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capital_account = CapitalAccount.new(params[:capital_account])\n\n respond_to do |format|\n if @capital_account.save\n format.html { redirect_to @capital_account, :notice => 'Capital account was successfully created.' }\n format.json { render :json => @capital_account, :status => :created, :location => @capital_account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @capital_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @causal = Causal.new(causal_params)\n\n respond_to do |format|\n if @causal.save\n format.html { redirect_to @causal, notice: 'Causal was successfully created.' }\n format.json { render :show, status: :created, location: @causal }\n else\n format.html { render :new }\n format.json { render json: @causal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capacidad = Capacidad.new(params[:capacidad])\n\n respond_to do |format|\n if @capacidad.save\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully created.' }\n format.json { render json: @capacidad, status: :created, location: @capacidad }\n else\n format.html { render \"new\" }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @additive = Additive.new(additive_params)\n\n respond_to do |format|\n if @additive.save\n format.html { redirect_to @additive, success: 'Additive was successfully created.' }\n format.json { render :show, status: :created, location: @additive }\n else\n format.html { render :new }\n format.json { render json: @additive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capacidad = Capacidad.new(capacidad_params)\n\n respond_to do |format|\n if @capacidad.save\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully created.' }\n format.json { render :show, status: :created, location: @capacidad }\n else\n format.html { render :new }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cap = Cap.new(params[:cap])\n\n respond_to do |format|\n if @cap.save\n format.html { redirect_to(@cap, :notice => 'Cap was successfully created.') }\n format.xml { render :xml => @cap, :status => :created, :location => @cap }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def capital_params\n params.require(:capital).permit(:sum, :user, :local, :deleted)\n end",
"def create\n @irregular_verb = IrregularVerb.new(params[:irregular_verb])\n\n respond_to do |format|\n if @irregular_verb.save\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully created.' }\n format.json { render json: @irregular_verb, status: :created, location: @irregular_verb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @capitals = Capital.all\n end",
"def create\n @arsenal = Arsenal.new(arsenal_params)\n\n respond_to do |format|\n if @arsenal.save\n format.html { redirect_to @arsenal, notice: 'Arsenal was successfully created.' }\n format.json { render :show, status: :created, location: @arsenal }\n else\n format.html { render :new }\n format.json { render json: @arsenal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sensitive = Sensitive.new(sensitive_params)\n\n respond_to do |format|\n if @sensitive.save\n format.html { redirect_to xmt_press_sensitives_path, notice: '敏感词添加成功.' }\n format.json { render :show, status: :created, location: @sensitive }\n else\n format.html { render :new }\n format.json { render json: @sensitive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @verb = Verb.new(verb_params)\n\n if @verb.save\n render json: @verb, status: :created, location: @verb\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def create\n respond_to do |format|\n if @ai_contest.update_attributes(permitted_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully created.' }\n format.json { render json: @ai_contest, status: :created, location: @ai_contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_arizona\n $capitals[:arizona] = \"Phoenix\"\nend",
"def create\n @capthurit = Capthurit.new(capthurit_params)\n\n respond_to do |format|\n if @capthurit.save\n format.html { redirect_to @capthurit, notice: 'Capthurit was successfully created.' }\n format.json { render action: 'show', status: :created, location: @capthurit }\n else\n format.html { render action: 'new' }\n format.json { render json: @capthurit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cap = Cap.new(params[:cap])\n\n respond_to do |format|\n if @cap.save_with_captcha\n flash[:notice] = 'Cap was successfully created.'\n format.html { redirect_to(@cap) }\n format.xml { render :xml => @cap, :status => :created, :location => @cap }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end",
"def create\n @custom_vital = CustomVital.new(custom_vital_params)\n\n respond_to do |format|\n if @custom_vital.save\n format.html { redirect_to @custom_vital, notice: 'Custom vital was successfully created.' }\n format.json { render :show, status: :created, location: @custom_vital }\n else\n format.html { render :new }\n format.json { render json: @custom_vital.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patentcase = Patentcase.new(params[:patentcase])\n\n respond_to do |format|\n if @patentcase.save\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully created.' }\n format.json { render :json => @patentcase, :status => :created, :location => @patentcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def create\n @advocacy = Advocacy.new(params[:advocacy])\n\n respond_to do |format|\n if @advocacy.save\n format.html { redirect_to @advocacy, notice: 'Advocacy was successfully created.' }\n format.json { render json: @advocacy, status: :created, location: @advocacy }\n else\n format.html { render action: \"new\" }\n format.json { render json: @advocacy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @causale = Causale.new(params[:causale])\n\n respond_to do |format|\n if @causale.save\n format.html { redirect_to @causale, notice: 'Causale creata con successo.' }\n format.json { render json: @causale, status: :created, location: @causalo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cict = Cict.new(cict_params)\n\n respond_to do |format|\n if @cict.save\n format.html { redirect_to @cict, notice: 'Cict was successfully created.' }\n format.json { render :show, status: :created, location: @cict }\n else\n format.html { render :new }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @capital_account = CapitalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @capital_account }\n end\n end",
"def create\n @ally = Ally.new(ally_params)\n\n respond_to do |format|\n if @ally.save\n format.html { redirect_to @ally, notice: 'Ally was successfully created.' }\n format.json { render :show, status: :created, location: @ally }\n else\n format.html { render :new }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_oregon\n $capitals[:oregon] = \"Salem\"\n $capitals\nend",
"def create\n #raise \"breakpoint\"\n \n @initiary = Initiary.new(params[:initiary])\n @initiary.save\n\n params[:country].each do |c|\n country = Country.find c\n \n r = Initiarization.new :country_id => country.id, :initiary_id => @initiary.id\n r.save\n\n monetizations = Monetization.where :country_id => country.id\n\n monetizations.each do |m|\n m.update_attribute :collected, true\n end\n end\n\n respond_to do |format|\n if @initiary.save\n format.html { redirect_to(@initiary, :notice => 'Initiary was successfully created.') }\n format.xml { render :xml => @initiary, :status => :created, :location => @initiary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @initiary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @capd = Capd.new(params[:capd])\n\n respond_to do |format|\n if @capd.save\n format.html { redirect_to(@capd, :notice => 'Capd was successfully created.') }\n format.xml { render :xml => @capd, :status => :created, :location => @capd }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @capd.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @cta = Cta.new(cta_params)\n\n respond_to do |format|\n if @cta.save\n format.html { redirect_to @cta, notice: 'cta was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cta }\n else\n format.html { render action: 'new' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candy = PendingCandy.new(params[:candy])\n\n respond_to do |format|\n if @candy.save\n logger.info \"candy saved successfully\"\n\tlogger.info @candy.to_json\n format.html { redirect_to @candy, :notice => 'Candy was successfully created.' }\n format.json { render :json => { :status => 200, :candy => @candy } }\n else\n logger.info \"error saving candy\"\n logger.info @candy.errors.full_messages\n format.html { render :action => \"new\" }\n format.json { render :json => {:message => @candy.errors.full_messages.join(\"\\n\"), :status => 404} }\n end\n end\n end",
"def create\n @arrest_record_and_conduct = ArrestRecordAndConduct.new(params[:arrest_record_and_conduct])\n\n respond_to do |format|\n if @arrest_record_and_conduct.save\n format.html { redirect_to @arrest_record_and_conduct.personal_detail, notice: 'Arrest record and conduct was successfully created.' }\n format.json { render json: @arrest_record_and_conduct, status: :created, location: @arrest_record_and_conduct }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arrest_record_and_conduct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end",
"def create\n @case_insensitive = CaseInsensitive.new(case_insensitive_params)\n\n respond_to do |format|\n if @case_insensitive.save\n format.html { redirect_to @case_insensitive, notice: 'Case insensitive was successfully created.' }\n format.json { render action: 'show', status: :created, location: @case_insensitive }\n else\n format.html { render action: 'new' }\n format.json { render json: @case_insensitive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candy = Candy.new(candy_params)\n\n respond_to do |format|\n if @candy.save\n format.html { redirect_to @candy, notice: \"Candy was successfully created.\" }\n format.json { render :show, status: :created, location: @candy }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @candy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # TODO 既存 team を含めて保存する場合は認証に対応させる\n @concert = Concert.new(concert_savable_params)\n\n if @concert.save\n render :show, status: :created\n else\n render json: @concert.errors, status: :unprocessable_entity\n end\n end",
"def create\n @county = County.new(params[:county])\n\n respond_to do |format|\n if @county.save\n format.html { redirect_to @county, notice: 'County was successfully created.' }\n format.json { render json: @county, status: :created, location: @county }\n else\n format.html { render action: \"new\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lawsuit = Lawsuit.new(lawsuit_params)\n\n respond_to do |format|\n if @lawsuit.save\n format.html { redirect_to @lawsuit, notice: \"Lawsuit was successfully created.\" }\n format.json { render :show, status: :created, location: @lawsuit }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @lawsuit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey = Survey.new(params[:survey])\n\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Тест добавлен.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @candy = Candy.new(candy_params)\n\n respond_to do |format|\n if @candy.save\n format.html { redirect_to @candy, notice: 'Candy was successfully created.' }\n format.json { render action: 'show', status: :created, location: @candy }\n else\n format.html { render action: 'new' }\n format.json { render json: @candy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objective_textual = ObjectiveTextual.new(objective_textual_params)\n\n respond_to do |format|\n if @objective_textual.save\n format.html { redirect_to @objective_textual, notice: 'Objective textual was successfully created.' }\n format.json { render :show, status: :created, location: @objective_textual }\n else\n format.html { render :new }\n format.json { render json: @objective_textual.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @patentcase = Patentcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patentcase }\n end\n end",
"def create\n @therapy = Therapy.new(therapy_params)\n category = TherapyCategory.create(name: @therapy.name)\n category.therapies << @therapy\n\n respond_to do |format|\n if @therapy.save\n format.html { redirect_to @therapy }\n format.json { render :show, status: :created, location: @therapy }\n else\n format.html { render :new }\n format.json { render json: @therapy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capartment = Capartment.new(capartment_params)\n @capartment.money_uah = capartment.anaprtment.cost_one\n respond_to do |format|\n if @capartment.save\n format.html { redirect_to calc_apartments_path, notice: 'Capartment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @capartment }\n else\n format.html { render action: 'new' }\n format.json { render json: @capartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @creative = Creative.new(params[:creative])\n\n respond_to do |format|\n if @creative.save\n format.html { redirect_to @creative, notice: 'Creative was successfully created.' }\n format.json { render json: @creative, status: :created, location: @creative }\n else\n format.html { render action: \"new\" }\n format.json { render json: @creative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @challenge = Challenge.new(params[:challenge])\n \n respond_to do |format|\n if @challenge.save\n format.html { redirect_to @challenge.lead, notice: 'Challenge was successfully created.' }\n format.json { render json: @challenge, status: :created, location: @challenge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def create\n @sslplan = Sslplan.new(params[:sslplan])\n\n respond_to do |format|\n if @sslplan.save\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully created.' }\n format.json { render :json => @sslplan, :status => :created, :location => @sslplan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @award = Award.new(award_params)\n respond_to do |format|\n if @award.save\n a_data = JSON.parse params[:json_string]\n a_data.each do |a|\n @item = get_new_award_item(@award, a) unless a.nil?\n end\n AwardMailer.approval_request(@award)\n if current_user.admin\n format.html { redirect_to patient_path(@award.patient), notice: 'Award was successfully created.' }\n else\n format.html { redirect_to new_patient_path, notice: 'Award was successfully created.' }\n end\n format.json { render :show, status: :created, location: @award }\n else\n format.html { render :new }\n format.json { render json: @award.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def create\n @continent = Continent.new(params[:continent])\n\n respond_to do |format|\n if @continent.save\n format.html { redirect_to @continent, notice: 'Continent was successfully created.' }\n format.json { render json: @continent, status: :created, location: @continent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @continent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capitulo = Capitulo.new(capitulo_params)\n\n respond_to do |format|\n if @capitulo.save\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully created.' }\n format.json { render :show, status: :created, location: @capitulo }\n else\n format.html { render :new }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @challenge = Challenge.new(params[:challenge])\n\n respond_to do |format|\n if @challenge.save\n format.html { redirect_to @challenge, notice: 'Challenge was successfully created.' }\n format.json { render json: @challenge, status: :created, location: @challenge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exercise_plan = ExercisePlan.new(params[:exercise_plan])\n\n respond_to do |format|\n if @exercise_plan.save\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully created.' }\n format.json { render json: @exercise_plan, status: :created, location: @exercise_plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cadet = Cadet.new(params[:cadet])\n\n respond_to do |format|\n if @cadet.save\n format.html { redirect_to @cadet, notice: 'Cadet was successfully created.' }\n format.json { render json: @cadet, status: :created, location: @cadet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cadet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pharmacy = Pharmacy.new(pharmacy_params)\n respond_to do |format|\n if @pharmacy.save\n format.json { render :show, status: :created, location: @pharmacy }\n else\n format.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params.require(:contest).permit(:number, :description, :medal))\n\n if @contest.save\n flash[:success] = \"Concours ajouté.\"\n redirect_to @contest\n else\n render 'new'\n end\n end",
"def new\n @irregular_verb = IrregularVerb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @irregular_verb }\n end\n end",
"def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend",
"def set_capital\n @capital = Capital.find(params[:id])\n end",
"def create\n @inter_cap = InterCap.new(params[:inter_cap])\n\n respond_to do |format|\n if @inter_cap.save\n format.html { redirect_to(@inter_cap, :notice => 'A asequence was successfully created.') }\n format.xml { render :xml => @inter_cap, :status => :created, :location => @inter_cap }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inter_cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ca = Ca.new(params[:ca])\n\n respond_to do |format|\n if @ca.save\n format.html { redirect_to @ca, notice: 'Ca was successfully created.' }\n format.json { render json: @ca, status: :created, location: @ca }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @concert = @theater.concerts.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n #TODO localise the previous string\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @causale = Causale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @causale }\n end\n end",
"def create\n @challenge = Challenge.new(challenge_params)\n puts challenge_params\n respond_to do |format|\n if @challenge.save\n format.html { redirect_to @challenge, notice: 'Challenge was successfully created.' }\n format.json { render action: 'show', status: :created, location: @challenge }\n else\n format.html { render action: 'new' }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ally = Ally.new(ally_params)\n\n respond_to do |format|\n if @ally.save\n format.html { redirect_to edit_ally_path(@ally), notice: 'Ally was successfully created.' }\n format.json { render :show, status: :created, location: @ally }\n else\n format.html { render :new }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @chalie_vice_letter = ChalieVice::Letter.new(chalie_vice_letter_params)\n\n respond_to do |format|\n if @chalie_vice_letter.save\n format.html { redirect_to @chalie_vice_letter, notice: 'Letter was successfully created.' }\n format.json { render :show, status: :created, location: @chalie_vice_letter }\n else\n format.html { render :new }\n format.json { render json: @chalie_vice_letter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vital_sign = VitalSign.new(params[:vital_sign])\n\n respond_to do |format|\n if @vital_sign.save\n format.html { redirect_to @vital_sign, notice: 'Vital sign was successfully created.' }\n format.json { render json: @vital_sign, status: :created, location: @vital_sign }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vital_sign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.new(params[:capacite])\n\n respond_to do |format|\n if @capacite.save\n format.html { redirect_to @capacite, notice: 'Capacite a été crée avec succès.' }\n format.json { render json: @capacite, status: :created, location: @capacite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @capacite.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def POST; end",
"def create\n assessment = Assessment.find(plan_create_params.fetch(:assessment_id))\n disease_ids = plan_create_params.fetch(:disease_ids).to_s.split(\"-\")\n\n if plan_create_params[:indicators].values.map(&:to_i).any?(&:zero?)\n flash[:alert] = \"Every score and goal must be 1 or higher.\"\n return redirect_back fallback_location: root_path\n end\n\n @plan =\n Plan.create_from_goal_form(\n indicator_attrs: plan_create_params.fetch(:indicators),\n assessment: assessment,\n is_5_year_plan: plan_create_params.fetch(:term).start_with?(\"5\"),\n plan_name: \"#{assessment.country.name} draft plan\",\n disease_ids: disease_ids,\n user: current_user\n )\n unless @plan.persisted?\n flash[:notice] = \"Could not save your plan, something went wrong.\"\n redirect_back fallback_location: root_path\n return\n end\n session[:plan_id] = @plan.id unless current_user\n redirect_to @plan\n rescue Exceptions::InvalidDiseasesError => e\n flash[:notice] = e.message\n redirect_back fallback_location: root_path\n end",
"def create\n @optin_contestant = OptinContestant.new(params[:optin_contestant])\n\n respond_to do |format|\n if @optin_contestant.save\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully created.' }\n format.json { render json: @optin_contestant, status: :created, location: @optin_contestant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_noun = Api::Noun.new(params[:api_noun])\n\n respond_to do |format|\n if @api_noun.save\n format.html { redirect_to @api_noun, notice: 'Noun was successfully created.' }\n format.json { render json: @api_noun, status: :created, location: @api_noun }\n else\n format.html { render action: \"new\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @noun = Noun.new(noun_params)\n\n respond_to do |format|\n if @noun.save\n format.html { redirect_to @noun, notice: 'Noun was successfully created.' }\n format.json { render :show, status: :created, location: @noun }\n else\n format.html { render :new }\n format.json { render json: @noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@pharmacy = Pharmacy.new(params[:pharmacy])\n\n\t\trespond_to do |format|\n\t\t\tif @pharmacy.save\n\t\t\t\tformat.html { redirect_to @pharmacy, notice: 'Pharmacy was successfully created.' }\n\t\t\t\tformat.json { render json: @pharmacy, status: :created, location: @pharmacy }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @pharmacy.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @custodian = Custodian.new(custodian_params)\n\n respond_to do |format|\n if @custodian.save\n format.html { redirect_to @custodian, notice: \"Custodian was successfully created.\" }\n format.json { render :show, status: :created, location: @custodian }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @custodian.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contrac_establishment = ContracEstablishment.new(contrac_establishment_params)\n\n respond_to do |format|\n if @contrac_establishment.save\n format.html { redirect_to @contrac_establishment, notice: 'Contrac establishment was successfully created.' }\n format.json { render :show, status: :created, location: @contrac_establishment }\n else\n format.html { render :new }\n format.json { render json: @contrac_establishment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @english_entry = EnglishEntry.new(params[:english_entry])\n\n respond_to do |format|\n if @english_entry.save\n format.html { redirect_to @english_entry, notice: 'English entry was successfully created.' }\n format.json { render json: @english_entry, status: :created, location: @english_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @english_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @meal_plan = MealPlan.new(meal_plan_params)\n\n respond_to do |format|\n if @meal_plan.save\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully created.' }\n format.json { render :show, status: :created, location: @meal_plan }\n else\n format.html { render :new }\n format.json { render json: @meal_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subcontrat = Subcontrat.new(subcontrat_params)\n\n respond_to do |format|\n if @subcontrat.save\n format.html { redirect_to @subcontrat, notice: 'Subcontrat was successfully created.' }\n format.json { render :show, status: :created, location: @subcontrat }\n else\n format.html { render :new }\n format.json { render json: @subcontrat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clientcase = Clientcase.new(params[:clientcase])\n\n respond_to do |format|\n if @clientcase.save\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully created.' }\n format.json { render :json => @clientcase, :status => :created, :location => @clientcase }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @azul = Azul.new(azul_params)\n\n respond_to do |format|\n if @azul.save\n format.html { redirect_to @azul, notice: 'Azul was successfully created.' }\n format.json { render :show, status: :created, location: @azul }\n else\n format.html { render :new }\n format.json { render json: @azul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def create\n @click_thru = ClickThru.new(params[:click_thru])\n\n respond_to do |format|\n if @click_thru.save\n format.html { redirect_to @click_thru, notice: 'Click thru was successfully created.' }\n format.json { render json: @click_thru, status: :created, location: @click_thru }\n else\n format.html { render action: \"new\" }\n format.json { render json: @click_thru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @captain = Captain.new(captain_params)\n respond_to do |format|\n @captain.user_id = current_user.id if current_user\n if @captain.save\n log_captain @captain\n format.html { redirect_to @captain, notice: 'Captain was successfully created.' }\n format.json { render :show, status: :created, location: @captain }\n else\n format.html { render :new }\n format.json { render json: @captain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dental = Dental.new(params[:dental])\n\n respond_to do |format|\n if @dental.save\n format.html { redirect_to @dental, notice: 'Dental was successfully created.' }\n format.json { render json: @dental, status: :created, location: @dental }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agency = Agency.new(agency_params)\n\n if @agency.save\n render json: @agency, status: :created, location: @agency\n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bounty = Bounty.new(bounty_params)\n\n respond_to do |format|\n if @bounty.save\n format.html { redirect_to @bounty, notice: 'Bounty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bounty }\n else\n format.html { render action: 'new' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @challenge = Challenge.new(challenge_params)\n\n respond_to do |format|\n if @challenge.save\n format.html { redirect_to @challenge, notice: 'Challenge was successfully created.' }\n format.json { render :show, status: :created, location: @challenge }\n else\n format.html { render :new }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @challenge = Challenge.new(challenge_params)\n\n respond_to do |format|\n if @challenge.save\n format.html { redirect_to @challenge, notice: \"Challenge was successfully created.\" }\n format.json { render :show, status: :created, location: @challenge }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @specialty = Specialty.new(params[:specialty])\n\n respond_to do |format|\n if @specialty.save\n format.html { redirect_to posts_path, notice: 'Specialty was successfully created.' }\n format.json { render json: @specialty, status: :created, location: @specialty }\n else\n format.html { render action: \"new\" }\n format.json { render json: @specialty.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.53087306",
"0.5299217",
"0.52511764",
"0.5235945",
"0.5232483",
"0.522641",
"0.52230394",
"0.5211928",
"0.52103806",
"0.52092665",
"0.5200427",
"0.5194175",
"0.51841795",
"0.5183489",
"0.51827836",
"0.5179039",
"0.5171077",
"0.51625764",
"0.515975",
"0.5152292",
"0.51483524",
"0.5130466",
"0.51139206",
"0.51086545",
"0.5106177",
"0.5103796",
"0.5099221",
"0.5098562",
"0.5092978",
"0.5087565",
"0.50847816",
"0.50815433",
"0.50799054",
"0.5073212",
"0.5067933",
"0.50641394",
"0.5061237",
"0.50601137",
"0.5057946",
"0.5055776",
"0.5044713",
"0.50427985",
"0.5035831",
"0.502841",
"0.5022563",
"0.5016142",
"0.501292",
"0.50106114",
"0.50090754",
"0.5008137",
"0.50013506",
"0.49943325",
"0.49932292",
"0.49932292",
"0.49932292",
"0.499141",
"0.4991093",
"0.49902678",
"0.49897218",
"0.49863628",
"0.49735227",
"0.49685976",
"0.49667537",
"0.49619478",
"0.49610972",
"0.49593765",
"0.4952218",
"0.49520686",
"0.4946574",
"0.49418485",
"0.49398306",
"0.49398306",
"0.49368423",
"0.49366453",
"0.4935851",
"0.49335468",
"0.49316654",
"0.4931664",
"0.49301255",
"0.4928228"
] |
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: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n if @capacitacion.update_attributes(params[:capacitacion])\n format.html { redirect_to @capacitacion, notice: 'Capacitacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capacitacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cap = Cap.find(params[:id])\n\n respond_to do |format|\n if @cap.update_attributes(params[:cap])\n format.html { redirect_to(@cap, :notice => 'Cap was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cap = Cap.find(params[:id])\n\n respond_to do |format|\n if @cap.update_attributes(params[:cap])\n flash[:notice] = 'Cap was successfully updated.'\n format.html { redirect_to(@cap) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capartment.update(capartment_params)\n format.html { redirect_to calc_apartments_path, notice: 'Capartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @small_concert.update(small_concert_params)\n format.html { redirect_to '/admin/small_concerts', notice: 'Small concert was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @small_concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @irregular_verb = IrregularVerb.find(params[:id])\n\n respond_to do |format|\n if @irregular_verb.update_attributes(params[:irregular_verb])\n format.html { redirect_to @irregular_verb, notice: 'Irregular verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @irregular_verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @capacidad = Capacidad.find(params[:id])\n\n respond_to do |format|\n if @capacidad.update_attributes(params[:capacidad])\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @verb = Verb.find(params[:id])\n\n if @verb.update(verb_params)\n head :no_content\n else\n render json: @verb.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @causal.update(causal_params)\n format.html { redirect_to @causal, notice: 'Causal was successfully updated.' }\n format.json { render :show, status: :ok, location: @causal }\n else\n format.html { render :edit }\n format.json { render json: @causal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n if @sslplan.update_attributes(params[:sslplan])\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_arizona\n $capitals[:arizona] = \"Phoenix\"\nend",
"def update\n respond_to do |format|\n if @additive.update(additive_params)\n format.html { redirect_to @additive, success: 'Additive was successfully updated.' }\n format.json { render :show, status: :ok, location: @additive }\n else\n format.html { render :edit }\n format.json { render json: @additive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clientcase = Clientcase.find(params[:id])\n\n respond_to do |format|\n if @clientcase.update_attributes(params[:clientcase])\n format.html { redirect_to @clientcase, :notice => 'Clientcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @clientcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n\n respond_to do |format|\n if @arrest_record_and_conduct.update_attributes(params[:arrest_record_and_conduct])\n format.html { redirect_to @arrest_record_and_conduct.personal_detail, notice: 'Arrest record and conduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrest_record_and_conduct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end",
"def update\n respond_to do |format|\n if @capthurit.update(capthurit_params)\n format.html { redirect_to @capthurit, notice: 'Capthurit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capthurit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capacidad.update(capacidad_params)\n format.html { redirect_to @capacidad, notice: 'Capacidad was successfully updated.' }\n format.json { render :show, status: :ok, location: @capacidad }\n else\n format.html { render :edit }\n format.json { render json: @capacidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @case_insensitive.update(case_insensitive_params)\n format.html { redirect_to @case_insensitive, notice: 'Case insensitive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @case_insensitive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appeal.update_attributes(params[:appeal])\n format.html { redirect_to [@conference, @appeal], notice: 'Appeal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appeal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @capital_account = CapitalAccount.find(params[:id])\n\n respond_to do |format|\n if @capital_account.update_attributes(params[:capital_account])\n format.html { redirect_to @capital_account, :notice => 'Capital account was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @capital_account.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @scaff = Scaff.find(params[:id])\n\n respond_to do |format|\n if @scaff.update_attributes(params[:scaff])\n format.html { redirect_to @scaff, notice: 'Scaff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cta.update(cta_params)\n format.html { redirect_to @cta, notice: 'cta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @verb.update(verb_params)\n format.html { redirect_to @verb, notice: 'Verb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @verb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @custom_vital.update(custom_vital_params)\n format.html { redirect_to @custom_vital, notice: 'Custom vital was successfully updated.' }\n format.json { render :show, status: :ok, location: @custom_vital }\n else\n format.html { render :edit }\n format.json { render json: @custom_vital.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def update\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n if @plannegocio.update_attributes(params[:plannegocio])\n format.html { redirect_to @plannegocio, notice: 'Plannegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plannegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @strain = Strain.find(params[:id])\n\n respond_to do |format|\n if @strain.update_attributes(params[:strain])\n format.html { redirect_to @strain, :notice => 'Strain was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @strain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @vital_sign = VitalSign.find(params[:id])\n\n respond_to do |format|\n if @vital_sign.update_attributes(params[:vital_sign])\n format.html { redirect_to @vital_sign, notice: 'Vital sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vital_sign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Тест обновлён.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n if @exercise_plan.update_attributes(params[:exercise_plan])\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chiropractic_compliance = ChiropracticCompliance.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_compliance.update_attributes(params[:chiropractic_compliance])\n format.html { redirect_to @chiropractic_compliance, notice: 'Chiropractic compliance was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_compliance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def update\n @initiative = Initiative.find(params[:id])\n @initiative.phase_id=params[:phase_id]\n\n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n format.html { render :nothing => true }\n #format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patentcase = Patentcase.find(params[:id])\n\n respond_to do |format|\n if @patentcase.update_attributes(params[:patentcase])\n format.html { redirect_to @patentcase, :notice => 'Patentcase was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @patentcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n respond_to do |format|\n if @chosain.update(chosain_params)\n format.html { redirect_to @chosain, notice: 'Chosain was successfully updated.' }\n format.json { render :show, status: :ok, location: @chosain }\n else\n format.html { render :edit }\n format.json { render json: @chosain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @therapist_consent = TherapistConsent.find(params[:id])\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'edit', therapist_consent: @therapist_consent}}\n end\n end",
"def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n @ca = Ca.find(params[:id])\n\n respond_to do |format|\n if @ca.update_attributes(params[:ca])\n format.html { redirect_to @ca, notice: 'Ca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @capd = Capd.find(params[:id])\n\n respond_to do |format|\n if @capd.update_attributes(params[:capd])\n format.html { redirect_to(@capd, :notice => 'Capd was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @capd.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @claimant = Claimant.find(params[:id])\n\n respond_to do |format|\n if @claimant.update_attributes(params[:claimant])\n format.html { redirect_to @claimant, notice: 'Claimant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @claimant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @secry = Secry.find(params[:id])\n\n respond_to do |format|\n if @secry.update_attributes(params[:secry])\n format.html { redirect_to @secry, notice: 'Secry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @secry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cabinet = Cabinet.find(params[:id])\n\n respond_to do |format|\n if @cabinet.update_attributes(params[:cabinet])\n format.html { redirect_to @cabinet, notice: 'Cabinet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cabinet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n if @lunchplan.update_attributes(params[:lunchplan])\n format.html { redirect_to @lunchplan, :notice => 'Lunchplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lunchplan.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n if @clasp.update_attributes(params[:clasp])\n format.html { redirect_to @clasp, notice: 'Clasp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end",
"def update\n @click_thru = ClickThru.find(params[:id])\n\n respond_to do |format|\n if @click_thru.update_attributes(params[:click_thru])\n format.html { redirect_to @click_thru, notice: 'Click thru was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @click_thru.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitulo.update(capitulo_params)\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully updated.' }\n format.json { render :show, status: :ok, location: @capitulo }\n else\n format.html { render :edit }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inter_cap = InterCap.find(params[:id])\n\n respond_to do |format|\n if @inter_cap.update_attributes(params[:inter_cap])\n format.html { redirect_to(@inter_cap, :notice => 'A asequence was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inter_cap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate_cost = PlateCost.find(params[:id])\n\n respond_to do |format|\n if @plate_cost.update_attributes(params[:plate_cost])\n format.html { redirect_to @plate_cost, notice: 'Plate Cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plate_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @ai_contest = AiContest.find(params[:id])\n\n respond_to do |format|\n if @ai_contest.update_attributes(ai_contest_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @county = County.find(params[:id])\n\n respond_to do |format|\n if @county.update_attributes(params[:county])\n format.html { redirect_to @county, notice: 'County was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @county.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chiropractic_assessment = ChiropracticAssessment.find(params[:id])\n\n respond_to do |format|\n if @chiropractic_assessment.update_attributes(params[:chiropractic_assessment])\n format.html { redirect_to @chiropractic_assessment, notice: 'Chiropractic assessment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chiropractic_assessment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_agency = Admin::Agency.find(params[:id])\n\n respond_to do |format|\n if @admin_agency.update_attributes(params[:admin_agency])\n format.html { redirect_to @admin_agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scaff.update(scaff_params)\n format.html { redirect_to @scaff, notice: 'Scaff was successfully updated.' }\n format.json { render :show, status: :ok, location: @scaff }\n else\n format.html { render :edit }\n format.json { render json: @scaff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @captain.update(captain_params)\n format.html { redirect_to @captain, notice: 'Captain was successfully updated.' }\n format.json { render :show, status: :ok, location: @captain }\n else\n format.html { render :edit }\n format.json { render json: @captain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n if @survey.update_attributes(params[:survey])\n format.html { redirect_to root_url, notice: 'Survey was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crust = Crust.find(params[:id])\n\n respond_to do |format|\n if @crust.update_attributes(params[:crust])\n format.html { redirect_to @crust, notice: 'Crust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crust.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n if @cust.update_attributes(params[:cust])\n format.html { redirect_to @cust, notice: 'Cust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @api_noun = Api::Noun.find(params[:id])\n\n respond_to do |format|\n if @api_noun.update_attributes(params[:api_noun])\n format.html { redirect_to @api_noun, notice: 'Noun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_noun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @continent = Continent.find(params[:id])\n\n respond_to do |format|\n if @continent.update_attributes(params[:continent])\n format.html { redirect_to @continent, notice: 'Continent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @continent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cict.update(cict_params)\n format.html { redirect_to @cict, notice: 'Cict was successfully updated.' }\n format.json { render :show, status: :ok, location: @cict }\n else\n format.html { render :edit }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end",
"def update\n respond_to do |format|\n if @candy.update(candy_params)\n format.html { redirect_to @candy, notice: 'Candy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @candy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ca.update(ca_params)\n format.html { redirect_to @ca, notice: 'Ca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agency.update(agency_params)\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n if @proof_cost.update_attributes(params[:proof_cost])\n format.html { redirect_to @proof_cost, notice: 'Proof cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proof_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flavor = Flavor.find(params[:id])\n\n respond_to do |format|\n if @flavor.update_attributes(params[:flavor])\n format.html { redirect_to @flavor, :notice => 'Flavor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @flavor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # build_resource\n if resource.status == 'Open'\n resource.update_attributes permitted_params[:contract]\n if !resource.valid?\n render json: resource.errors, status: :unprocessable_entity\n else\n resource.save\n respond_with json: {}, status: :ok\n end\n else\n respond_with json: [{'error':'The contract must be Open to edit.'}], status: :unprocessable_entity\n end\n end",
"def update_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n\n respond_to do |format|\n if @answer_localized.update_attributes(params[:answer_localized])\n flash[:notice] = 'AnswerLocalized was successfully updated.'\n format.html { redirect_to(@answer_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer_localized.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @causale = Causale.find(params[:id])\n\n respond_to do |format|\n if @causale.update_attributes(params[:causale])\n format.html { redirect_to @causale, notice: 'Causale aggiornata con successo.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @causale.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.60636514",
"0.6061616",
"0.6057367",
"0.6055907",
"0.60489935",
"0.6036888",
"0.60325056",
"0.60317564",
"0.60164565",
"0.6011608",
"0.60105056",
"0.60006875",
"0.59977996",
"0.59941816",
"0.59915054",
"0.59886026",
"0.59872526",
"0.5980377",
"0.5977696",
"0.59765315",
"0.5963298",
"0.59569013",
"0.5954275",
"0.59483963",
"0.5945501",
"0.59432113",
"0.59431314",
"0.5940616",
"0.5934436",
"0.59344083",
"0.5929552",
"0.5925671",
"0.59216446",
"0.5901078",
"0.58990854",
"0.5896816",
"0.5886987",
"0.58835435",
"0.5881116",
"0.5880678",
"0.5878985",
"0.58770424",
"0.5875338",
"0.5875133",
"0.58699554",
"0.5866559",
"0.5865307",
"0.5865233",
"0.58651453",
"0.58647084",
"0.5864007",
"0.58639735",
"0.58639735",
"0.5861212",
"0.5856933",
"0.5852743",
"0.5851795",
"0.5847541",
"0.5846247",
"0.5845171",
"0.58432305",
"0.5840536",
"0.5839693",
"0.5839163",
"0.58382577",
"0.58381635",
"0.583736",
"0.5837142",
"0.5837142",
"0.5834918",
"0.5832367",
"0.58320326",
"0.58307385",
"0.58299434",
"0.58289146",
"0.5827866",
"0.5826884",
"0.58257806",
"0.58237195"
] |
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 respond_to do |format|\n format.html { redirect_to capas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cap = Cap.find(params[:id])\n @cap.destroy\n\n respond_to do |format|\n format.html { redirect_to(caps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cap = Cap.find(params[:id])\n @cap.destroy\n\n respond_to do |format|\n format.html { redirect_to(caps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capartment.destroy\n respond_to do |format|\n format.html { redirect_to capartments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capthurit.destroy\n respond_to do |format|\n format.html { redirect_to capthurits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @capacidad.destroy\n respond_to do |format|\n format.html { redirect_to capacidads_url, notice: 'Capacidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capd = Capd.find(params[:id])\n @capd.destroy\n\n respond_to do |format|\n format.html { redirect_to(capds_url) }\n format.xml { head :ok }\n end\n end",
"def delete_utah\n $capitals.delete(:utah)\nend",
"def destroy\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.find(params[:id])\n @capacite.destroy\n\n respond_to do |format|\n format.html { redirect_to capacites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @captain.destroy\n respond_to do |format|\n format.html { redirect_to captains_url, notice: 'Captain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @causale = Causale.find(params[:id])\n @causale.destroy\n\n respond_to do |format|\n format.html { redirect_to causali_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @causal.destroy\n respond_to do |format|\n format.html { redirect_to causals_url, notice: 'Causal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @case_insensitive.destroy\n respond_to do |format|\n format.html { redirect_to case_insensitives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capitulo.destroy\n respond_to do |format|\n format.html { redirect_to capitulos_url, notice: 'Capitulo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inter_cap = InterCap.find(params[:id])\n @inter_cap.destroy\n\n respond_to do |format|\n format.html { redirect_to(inter_caps_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @creative.destroy\n respond_to do |format|\n format.html { redirect_to creatives_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @capital_account = CapitalAccount.find(params[:id])\n @capital_account.destroy\n\n respond_to do |format|\n format.html { redirect_to capital_accounts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chosain.destroy\n respond_to do |format|\n format.html { redirect_to chosains_url, notice: 'Chosain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @cta.destroy\n respond_to do |format|\n format.html { redirect_to cta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n\n head :no_content\n end",
"def destroy\n @sslplan = Sslplan.find(params[:id])\n @sslplan.destroy\n\n respond_to do |format|\n format.html { redirect_to sslplans_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cta = Cta.find(params[:id])\n @cta.destroy\n\n respond_to do |format|\n format.html { redirect_to ctas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crust = Crust.find(params[:id])\n @crust.destroy\n\n respond_to do |format|\n format.html { redirect_to crusts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aliexpress = Aliexpress.find(params[:id])\n @aliexpress.destroy\n\n respond_to do |format|\n format.html { redirect_to aliexpresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creative = Creative.find(params[:id])\n @creative.destroy\n\n respond_to do |format|\n format.html { redirect_to creatives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @cont = Cont.find(params[:id])\n @cont.destroy\n\n respond_to do |format|\n format.html { redirect_to conts_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @mission_capacity.destroy\n respond_to do |format|\n format.html { redirect_to mission_capacities_url, notice: 'Mission capacity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creative.destroy\n respond_to do |format|\n format.html { redirect_to campaign_creatives_url(@campaign), notice: 'Вид рекламы удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @continent = Continent.find(params[:id])\n @continent.destroy\n\n respond_to do |format|\n format.html { redirect_to continents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end",
"def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @irregular_verb = IrregularVerb.find(params[:id])\n @irregular_verb.destroy\n\n respond_to do |format|\n format.html { redirect_to irregular_verbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to do |format|\n format.html { redirect_to conta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ca.destroy\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_case.destroy\n respond_to do |format|\n format.html { redirect_to line_cases_url, notice: 'Line case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_showcase.destroy\n respond_to do |format|\n format.html { redirect_to admin_showcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ca = Ca.find(params[:id])\n @ca.destroy\n\n respond_to do |format|\n format.html { redirect_to cas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @conductum.destroy\n respond_to do |format|\n format.html { redirect_to conducta_url, notice: 'Conductum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end",
"def destroy\n @short_visit.destroy\n respond_to do |format|\n format.html { redirect_to short_visits_url, notice: 'Short visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patentcase = Patentcase.find(params[:id])\n @patentcase.destroy\n\n respond_to do |format|\n format.html { redirect_to patentcases_url }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @plan.destroy\n\n head :no_content\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @claimant = Claimant.find(params[:id])\n @claimant.destroy\n\n respond_to do |format|\n format.html { redirect_to claimants_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vital_sign = VitalSign.find(params[:id])\n @vital_sign.destroy\n\n respond_to do |format|\n format.html { redirect_to vital_signs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_celula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_celulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @strain = Strain.find(params[:id])\n @strain.destroy\n\n respond_to do |format|\n format.html { redirect_to strains_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format|\n format.html { redirect_to cabinets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accolade.destroy\n respond_to do |format|\n format.html { redirect_to accolades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to cases_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\nrender json: 1\n end"
] |
[
"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.65735877",
"0.6556569",
"0.655451",
"0.654393",
"0.6538086",
"0.65263766",
"0.6522849",
"0.6515419",
"0.6503862",
"0.6499144",
"0.64991283",
"0.6497079",
"0.6483302",
"0.64675033",
"0.6465408",
"0.6457818",
"0.64575845",
"0.6453377",
"0.64505273",
"0.6444721",
"0.6438025",
"0.6434869",
"0.6431592",
"0.6420168",
"0.6414782",
"0.6411209",
"0.640458",
"0.6403647",
"0.6399274",
"0.63946986",
"0.6393786",
"0.63896877",
"0.6385675",
"0.6371371",
"0.6371316",
"0.63710696",
"0.63694555",
"0.6368021",
"0.6367578",
"0.63658226",
"0.6362802",
"0.6361888",
"0.63556415",
"0.63556415",
"0.63556415",
"0.63556415",
"0.63556",
"0.63521653",
"0.63500935",
"0.6347609",
"0.6347609",
"0.6347609",
"0.6347609",
"0.63452584",
"0.63448894",
"0.6343636",
"0.634306",
"0.63343835",
"0.6333287",
"0.63321304",
"0.6330952",
"0.6326184",
"0.632427",
"0.63230515",
"0.6322697",
"0.6322611",
"0.63218075",
"0.63197887",
"0.6316476",
"0.63157016",
"0.6313565",
"0.6309044",
"0.63068086",
"0.63048303",
"0.63045555",
"0.63042027",
"0.63028586",
"0.63006014",
"0.62989116",
"0.6298507"
] |
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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\n end",
"def duas1(action)\n action.call\n action.call\nend",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53307265",
"0.5312121",
"0.5298173",
"0.5296388",
"0.52952695",
"0.5258086",
"0.52430934",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.52335346",
"0.5232943",
"0.5226392",
"0.52221715",
"0.5217978",
"0.52136153",
"0.52076435",
"0.52067244",
"0.5175402",
"0.5174649",
"0.5173085",
"0.5165201",
"0.5162052",
"0.5157932",
"0.5152905",
"0.5152353",
"0.5150909",
"0.514719",
"0.5138596",
"0.51333916",
"0.51139015",
"0.5113431",
"0.5113431",
"0.5109581",
"0.51066816",
"0.5091428",
"0.5089407",
"0.5082971",
"0.50822043",
"0.50668514",
"0.5055155",
"0.50525695",
"0.50499475",
"0.50499475",
"0.5034445",
"0.50249445",
"0.5022226",
"0.50167644",
"0.5014211",
"0.4999924",
"0.49996212",
"0.49978727",
"0.4989682",
"0.4989682",
"0.49851838",
"0.49817684",
"0.4979687",
"0.49787104",
"0.49688423",
"0.49664098",
"0.49564412",
"0.49561828",
"0.49547398",
"0.4953481",
"0.4952925",
"0.4946049",
"0.494379",
"0.49319315",
"0.49313048",
"0.49269778",
"0.49263066",
"0.49257493",
"0.4924526",
"0.49212465",
"0.49173486",
"0.4915802",
"0.49151486",
"0.49150333",
"0.49147308"
] |
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.6289145",
"0.62875307",
"0.6280997",
"0.62420976",
"0.62388235",
"0.6216686",
"0.62122375",
"0.6208949",
"0.619173",
"0.6176307",
"0.6173907",
"0.6170346",
"0.616111",
"0.6150513",
"0.6150023",
"0.61446756",
"0.6120429",
"0.6112975",
"0.6104845",
"0.6102966",
"0.6087884",
"0.6079323",
"0.60699135",
"0.60602236",
"0.60191786",
"0.60170597",
"0.60100305",
"0.6009527",
"0.60052776",
"0.60052776",
"0.600042",
"0.5999317",
"0.59933805",
"0.5991528",
"0.5991221",
"0.5990094",
"0.5979497",
"0.5966058",
"0.5958738",
"0.59579456",
"0.5957759",
"0.5956938",
"0.5951788",
"0.59511644",
"0.59423065",
"0.59373474",
"0.59361076",
"0.59361076",
"0.59331447",
"0.5928005",
"0.5924882",
"0.5924011",
"0.59169155",
"0.5908037",
"0.5907541",
"0.59061426",
"0.59056246",
"0.5897408",
"0.58960444",
"0.58951247",
"0.5893136",
"0.5892312",
"0.5890385",
"0.58853275",
"0.58801144",
"0.58784765",
"0.5872648",
"0.58682626",
"0.5867028",
"0.58661693",
"0.586578",
"0.58643955",
"0.5863193",
"0.58609086",
"0.5859997",
"0.5858935",
"0.5858632",
"0.5853379",
"0.5852741",
"0.584806",
"0.5847703"
] |
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 remove the app from the db when it's installed from shopify\n begin\n uninstall_webhook = ShopifyAPI::Webhook.create(\n topic: 'app/uninstalled',\n address: \"#{base_url}/uninstall\",\n format: 'json'\n )\n rescue => e\n raise unless uninstall_webhook.persisted?\n end\n\n ##################################################\n ##################################################\n\n #######################\n ## Populate Products ##\n #######################\n\n # => Download the products to the local DB and allocate conflict information etc\n @products = ShopifyAPI::Product.find :all\n @shop = Shop.find_by name: shop_name\n\n # => Create intermediary local variable\n # => This gives us the ability to manipulate the data as required\n products = JSON.parse(@products.to_json)\n\n # => Populate new products\n # => This allows us to store the products locally\n old_logger = ActiveRecord::Base.logger\n ActiveRecord::Base.logger = nil\n\n @shop.products.upsert_all products.map {|p|\n p[\"product_id\"] = p.delete(\"id\")\n p.merge!({ \"shop_id\" => @shop.id, \"sku\" => p[\"variants\"][0][\"sku\"], \"image\" => p[\"images\"][0][\"src\"] }) # => @shop.products doesn't populate the shop_id\n p.keep_if { |k,_| Product.column_names.include? k }\n }, unique_by: :shop_products_unique_index # => needs converting into object or hash etc\n\n # => Set the logger again\n ActiveRecord::Base.logger = old_logger\n\n ##################################################\n ##################################################\n\n end ## session\n end",
"def after_shopify_auth\n # shopify_session do\n # create an uninstall webhook, this webhook gets sent\n # when your app is uninstalled from a shop. It is good\n # practice to clean up any data from a shop when they\n # uninstall your app:\n\n # uninstall_webhook = ShopifyAPI::Webhook.new(\n # topic: 'app/uninstalled',\n # address: \"#{base_url}/uninstall\",\n # format: 'json'\n # )\n # begin\n # uninstall_webhook.save!\n # rescue => e\n # raise unless uninstall_webhook.persisted?\n # end\n # end\n end",
"def initialize\n @shop_url = \"https://#{ENV[\"SHOPIFY_API_KEY\"]}:#{ENV[\"SHOPIFY_PASSWORD\"]}@#{ENV[\"SHOP\"]}.myshopify.com/admin\"\n ShopifyAPI::Base.site = @shop_url\n end",
"def post_install\n end",
"def install_pre_hook\n end",
"def post_install; end",
"def install_webhooks(hostname = I18n.t('shopifyconnect.install.hostname'), topic_urls_map = I18n.t('shopifyconnect.install.topic_urls'))\n # remove existing if any\n ShopifyAPI::Webhook.find(:all, params: { limit: 100 }).each {|webhook| webhook.destroy if webhook.address.match(hostname) }\n # create new\n topic_urls_map.each {|topic,url| puts ShopifyAPI::Webhook.where(address: url, topic: topic, format: 'json').first_or_create.inspect if topic.present? && url.present? }\n true # explicit truthy value for aasm\n end",
"def start\n if File.exist? 'config.yml'\n Notifier.notify \"Watching for changes to Shopify Theme\"\n else\n data = <<-EOF\n---\n:api_key: YOUR_API_KEY\n:password: YOUR_PASSWORD\n:store: YOURSHOP.myshopify.com\n:theme_id: 'YOUR_THEME_ID'\n:ignore_files:\n- README.md\n- CHANGELOG.md\nEOF\n File.open('./config.yml', \"w\") { |file| file.write data }\n Notifier.notify \"Created config.yml. Remember to add your Shopify details to it.\"\n end\n end",
"def shopify_config\n @shopify_config ||= Shopifydev::Config.config\n end",
"def create\n # Shopify passes the shop domain (aka uid) as an environment variable,\n # not as part of the request body.\n shop_uid = request.env['HTTP_X_SHOPIFY_SHOP_DOMAIN']\n\n Rails.logger.info(\"Shopify webook received for shop '#{shop_uid}'\")\n\n shop = Shop.find_by(shopify_uid: shop_uid)\n\n if shop\n SynchronizeTeamJob.new.async.perform(shop.team.id)\n else\n Rails.logger.info(\"Shop not found '#{shop_uid}'\")\n end\n\n rescue StandardError => e\n # Rescue any error so that we always respond with 200, otherwise Shopify will disable the webhook.\n # Still log and report an error to newrelic, though, so that we know about it.\n ReportError.call(\"Error processing shopify webhook: #{e.message}\")\n ensure\n head :ok\n end",
"def pre_install; end",
"def install_post_hook\n end",
"def setup!\n return self if @app_is_setup\n puts \"Hatchet setup: #{name.inspect} for #{repo_name.inspect}\"\n create_app\n set_labs!\n # heroku.put_config_vars(name, 'BUILDPACK_URL' => @buildpack)\n buildpack_list = @buildpacks.map {|pack| { buildpack: pack }}\n platform_api.buildpack_installation.update(name, updates: buildpack_list)\n @app_is_setup = true\n self\n end",
"def create_omniauth\n omniauth_params = request.env['omniauth.params']\n org_uid = omniauth_params['state'] if omniauth_params\n response = request.env['omniauth.auth']\n\n return redirect_to root_url unless is_admin && org_uid && response\n\n shop_name = response.uid\n current_organization.from_omniauth(response)\n\n current_organization.instance_url = \"https://#{shop_name}/admin\"\n\n unless current_organization.save\n flash[:alert] = \"Oops, your account could not be linked. #{format_errors(current_organization)}\"\n return redirect_to root_url\n end\n\n token = response['credentials']['token']\n session[:show_popup] = !is_same_currency\n\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n redirect_to root_url\n\n rescue Shopify::Webhooks::WebhooksManager::CreationFailed => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', current_organization, \"Webhooks could not be created: #{e}\")\n redirect_to root_url\n end",
"def on_app_initializing(_event)\n info 'Initializing Karafka framework'\n end",
"def bigcommerce\n\n\t\t@brand = Brand.from_bc_omniauth(auth, extras)\n\n\t\tBigcommerce.configure do |config|\n\t\t\tconfig.store_hash = @brand.store_hash\n\t\t\tconfig.client_id = ENV['BC_CLIENT_ID']\n\t\t\tconfig.access_token = @brand.bctoken\n\t\tend\n\n\t\t@webhook = Bigcommerce::Webhook.create(\n\t\t\tscope: 'store/order/*',\n\t\t\tdestination: 'https://5cd6e141.ngrok.io/webhook'\n\t\t)\n\n\t\tbinding.pry\n\n\t\tif @brand.persisted?\n\t\t\tremember_me(@brand)\n\t\tend\n\n\t\tredirect_to load_path\n\n\tend",
"def setup\n redmine_base_url=ENV['REDMINE_BASE_URL']\n redmine_api_key=ENV['REDMINE_API_KEY']\n slack_webhook_url=ENV['SLACK_WEBHOOK_URL']\n verbose = ENV['VERBOSE'] == '1'\n slack_off = ENV['SLACK_OFF'] == '1'\n\n kv = KeyValueStore.new(ENV[\"DATABASE_URL\"])\n rAPI = RedmineSlack::RedmineAPI.new(redmine_base_url, redmine_api_key, verbose:verbose)\n slack_api = RedmineSlack::SlackAPI.new(slack_webhook_url, verbose:verbose)\n slack_api.channel_override = ENV['SLACK_CHANNEL_OVERRIDE']\n slack_api.enabled = !slack_off\n\n RedmineSlack::RedmineSlackGlue.new(rAPI, slack_api, kv, verbose:verbose)\nend",
"def install\n \n end",
"def create_omniauth\n omniauth_params = request.env['omniauth.params']\n if omniauth_params && org_uid = omniauth_params['state']\n organization = Maestrano::Connector::Rails::Organization.find_by_uid_and_tenant(org_uid, current_user.tenant)\n if organization && is_admin?(current_user, organization) && response = request.env['omniauth.auth']\n shop_name = response.uid\n organization.from_omniauth(response)\n organization.instance_url = \"https://#{shop_name}/admin\"\n organization.save!\n\n token = response['credentials']['token']\n Shopify::Webhooks::WebhooksManager.queue_create_webhooks(org_uid, shop_name, token)\n\n end\n end\n redirect_to root_url\n end",
"def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth referral\n store_register_redirect(reg_redirect)\n end\n\n unless stored_auth_redirect\n auth_redirect = params[:r]\n auth_redirect ||= root_path if params[:state] && (params[:state] == 'w')\n store_auth_redirect(auth_redirect)\n end\n\n remember_remember_me\n remember_signup_flow_scope\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n render :text => \"Setup complete.\", :status => 404\n end",
"def ajax_mf_app_create\n\n domain = params[:domain] + \".myshopify.com\"\n from_email = params[:domain] + \"@custprotection.com\"\n\n digest = OpenSSL::Digest.new('sha256')\n token = Base64.encode64(OpenSSL::HMAC.digest(digest, ENV['SECRET_KEY_BASE'], params[:domain])).strip\n app = App.create(user_id: params[:user_id], name: domain, auth_token: token, from_email: from_email)\n\n response = {\n success: true,\n url: app.name,\n message: 'App Created!'\n }\n\n render json: response\n\n end",
"def post_setup\n end",
"def pre_install(&block)\n @pre_install_callback = block\n end",
"def prepare_for_installation; end",
"def webhook\n @config = ZipMoney::Configuration \n @_webhook = ZipMoney::WebHook if @_webhook.nil?\n @_webhook\n end",
"def action_before_deploy\n install_packages\n end",
"def after_create_notify_client_service\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(self.install_url)\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true if uri.scheme == \"https\"\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest.body = {\n\t\t\t\t\t\tclient_id: self.id,\n\t\t\t\t\t\tsecret: self.secret,\n\t\t\t\t\t\turl: ((MicroService::Client.configuration)? MicroService::Client.configuration.url : \"\"),\n\t\t\t\t\t\ttimestamp: self.created_at.to_i,\n\t\t\t\t\t}.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Failed to register with external service\n\t\t\t\t\tif !response.kind_of? Net::HTTPSuccess\n\t\t\t\t\t\traise ::MicroService::Client::InstallError\n\t\t\t\t\tend\n\t\t\t\tend",
"def pre_connect_hooks; end",
"def pre_connect_hooks; end",
"def setup_apps\n authorize unless @heroku\n\n # get a list of all my current apps on Heroku (so we don't create dupes)\n @my_apps = @heroku.list.map{|a| a.first}\n\n each_heroku_app do |heroku_env, app_name, repo|\n next if @my_apps.include?(app_name)\n\n stack = @config.stack(heroku_env)\n stack_option = \" --stack #{stack}\" if stack.to_s.size > 0\n creation_command \"heroku create #{app_name}#{stack_option} --remote #{app_name}\"\n end\n end",
"def application_before\n run_event(:application_before)\n end",
"def install\n end",
"def setup_handler\n end",
"def webhooks\n @webhooks_manager\n end",
"def applicationDidFinishLaunching(a_notification)\n # Insert code here to initialize your application\n end",
"def action_install\n install_bundler\n run_bundler('install')\n set_state\n end",
"def create_hook!\n hook = client.create_hook(\n full_name,\n 'web',\n {\n url: Constants::HOOK_URL,\n content_type: 'json'\n },\n {\n events: ['release'],\n active: true\n }\n )\n\n self.github_hook_id = hook.id\n end",
"def e_shop_on_install_theme(theme)\n unless theme.site.nav_menus.where(slug: \"eshop_footer_main_menu\").present? # verify if theme was installed before\n group = theme.add_field_group({name: \"Home Slider\", slug: \"home_slider\", description: \"\"})\n # group.add_field({\"name\"=>\"Text Slider\", \"slug\"=>\"home_slider_tabs\"},{field_key: \"text_box\", translate: true, multiple: true})\n # group.add_field({\"name\"=>\"Home Slider Image (1000px1000px)\", \"slug\"=>\"home_slider_bg\"},{field_key: \"image\" })\n # group.add_field({\"name\"=>\"Home Slider Product\", \"slug\"=>\"home_slider_product\"},{field_key: \"select_eval\", required: true, command: 'options_from_collection_for_select(current_site.the_posts(\"commerce\").decorate, :id, :the_title)' })\n # theme.save_field_value('home_slider_tabs', ['One Click Installation', 'Easy Configuration', 'Easy Administration', 'Shop Online'])\n\n menu = current_site.nav_menus.create(name: \"E-shop Header Menu\", slug: \"eshop_header_main_menu\")\n menu.append_menu_item({label: \"Home\", type: \"external\", link: \"root_url\"})\n menu_item = menu.append_menu_item({label: \"MEN\", type: \"external\", link: \"#\"})\n new_in = menu_item.append_menu_item({label: \"NEW IN\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n new_in = menu_item.append_menu_item({label: \"Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n\n new_in = menu_item.append_menu_item({label: \"Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n new_in = menu.append_menu_item({label: \"WOMEN\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n new_in = menu.append_menu_item({label: \"KIDS\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Clothing\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Bags\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Shoes\", type: \"external\", link: \"#\"})\n new_in.append_menu_item({label: \"New in Watches\", type: \"external\", link: \"#\"})\n\n pt_pages = current_site.post_types.where(slug: \"page\").first\n page = pt_pages.add_post(title: \"Contact Form\", content: '<p><iframe style=\"border: 0;\" src=\"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6632.248000703498!2d151.265683!3d-33.7832959!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6b12abc7edcbeb07%3A0x5017d681632bfc0!2sManly+Vale+NSW+2093%2C+Australia!5e0!3m2!1sen!2sin!4v1433329298259\" width=\"100%\" height=\"330\"></iframe></p> <p>[forms slug=eshop]</p>') if pt_pages.present?\n menu.append_menu_item({label: \"Contact\", type: \"post\", link: page.id})\n\n # footer menus\n menu = current_site.nav_menus.create(name: \"E-shop Footer Menu\", slug: \"eshop_footer_main_menu\")\n item = menu.append_menu_item({label: \"Show\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"New Arrivals\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Men\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Women\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Accessories\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Kids\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Brands\", type: \"external\", link: '#'})\n\n item = menu.append_menu_item({label: \"Help\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"New Arrivals\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Men\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Women\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Accessories\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Kids\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Brands\", type: \"external\", link: '#'})\n\n item = menu.append_menu_item({label: \"Popular\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"New Arrivals\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Men\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Women\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Accessories\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Kids\", type: \"external\", link: '#'})\n item.append_menu_item({label: \"Brands\", type: \"external\", link: '#'})\n\n e_shop_add_main_slider\n end\n\n if current_site.plugin_installed?('ecommerce')\n eshop_ecommerce_after_install({})\n else\n plugin_install('ecommerce')\n end\n\n plugin_install('cama_subscriber') unless current_site.plugin_installed?('cama_subscriber')\n\n ### Forms\n plugin_install('cama_contact_form') unless current_site.plugin_installed?('cama_contact_form')\n form_eshop = current_site.contact_forms.create(name: \"eshop\", slug: \"eshop\", settings: '{\"railscf_mail\":{\"previous_html\":\"\\u003cdiv class=\\'contact-form\\'\\u003e\",\"after_html\":\"\\u003c/div\\u003e\",\"to\":\"owenperedo@gmail.com\",\"subject\":\"\\u003c!--:en--\\u003eSite contact\\u003c!--:--\\u003e\\u003c!--:es--\\u003eSite contact\\u003c!--:--\\u003e\",\"body\":\"\\u003c!--:en--\\u003easdasdasdasdas\\u003c!--:--\\u003e\\u003c!--:es--\\u003e\\u003c!--:--\\u003e\",\"to_answer\":\"[c7]\",\"subject_answer\":\"\\u003c!--:en--\\u003eThanks for contact us\\u003c!--:--\\u003e\\u003c!--:es--\\u003egrcas\\u003c!--:--\\u003e\",\"body_answer\":\"\\u003c!--:en--\\u003easdasdas\\u003c!--:--\\u003e\\u003c!--:es--\\u003e\\u003c!--:--\\u003e\"},\"railscf_message\":{\"mail_sent_ok\":\"\",\"mail_sent_ng\":\"\",\"invalid_required\":\"\",\"invalid_email\":\"\",\"captcha_not_match\":\"\"},\"railscf_form_button\":{\"name_button\":\"Send\"}}', value: '{\"fields\":[{\"field_type\":\"text\",\"cid\":\"c2\",\"label\":\"\\u003c!--:en--\\u003eName\\u003c!--:--\\u003e\\u003c!--:es--\\u003eNombre\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"\\u003cdiv class=\\'contact-left\\'\\u003e\\r\\n[ci]\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"email\",\"cid\":\"c7\",\"label\":\"\\u003c!--:en--\\u003eEmail\\u003c!--:--\\u003e\\u003c!--:es--\\u003eCorreo\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"[ci]\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"text\",\"cid\":\"c4\",\"label\":\"\\u003c!--:en--\\u003eSubject\\u003c!--:--\\u003e\\u003c!--:es--\\u003eAsunto\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"[ci]\\r\\n\\u003c/div\\u003e\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"paragraph\",\"cid\":\"c5\",\"label\":\"\\u003c!--:en--\\u003eMessage\\u003c!--:--\\u003e\\u003c!--:es--\\u003eMensaje\\u003c!--:--\\u003e\",\"required\":\"true\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"\\u003cdiv class=\\'contact-right\\'\\u003e\\r\\n[ci]\\r\\n\\u003c/div\\u003e\\r\\n\",\"field_attributes\":\"{\\\"placeholder\\\": \\\"[label ci]\\\"}\"},\"default_value\":\"\"},{\"field_type\":\"submit\",\"cid\":\"c6\",\"label\":\"\\u003c!--:en--\\u003eSubmit\\u003c!--:--\\u003e\\u003c!--:es--\\u003eEnviar\\u003c!--:--\\u003e\",\"field_options\":{\"description\":\"\",\"field_class\":\"na\",\"template\":\"\\u003cdiv class=\\\"clearfix\\\"\\u003e\\u003c/div\\u003e\\r\\n[ci]\",\"field_attributes\":\"\"}}]}')\n\n end",
"def setup_handlers\n # Discord will contact us with HELLO first, so we don't need to hook into READY\n @websocket.on(:message, &method(:handle_message))\n @websocket.on(:close, &method(:handle_close))\n\n # Setup payload handlers\n on(:DISPATCH, &method(:handle_dispatch))\n on(:HEARTBEAT, &method(:handle_heartbeat))\n on(:RECONNECT, &method(:handle_reconnect))\n on(:INVALID_SESSION, &method(:handle_invalid_session))\n on(:HELLO, &method(:handle_hello))\n on(:HEARTBEAT_ACK, &method(:handle_heartbeat_ack))\n on(:READY, &method(:handle_ready))\n end",
"def install\n end",
"def install\n end",
"def run_hook(_resources)\n setup_code_deploy_s3_buckets\n end",
"def setup\n @event = Event.create(eventName: \"socialLogin\")\n @referral = Referral.create(referredBy: \"http://www.jumpstartlabs.com\")\n @request = Request.create(requestType: \"GET\")\n @resolution = Resolution.create(resolutionWidth: \"1920\", resolutionHeight: \"1280\")\n @url = Url.create(url: \"http://www.jumpstartlabs.com\")\n @user_agent = UserAgent.create(userAgent: \"Mozilla/5.0 (Macintosh%3B Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17\")\n @user = User.create(identifier: \"jumpstartlab\", rootUrl: \"hweoaw;eofiawofhawef\")\n end",
"def install\n end",
"def setup()\n \n # validates the hook token\n beef_hook = @data['beefhook'] || nil \n if beef_hook.nil?\n print_error \"[EVENTS] beef_hook is null\"\n return\n end\n\n # validates that a hooked browser with the beef_hook token exists in the db\n zombie = Z.first(:session => beef_hook) || nil\n if zombie.nil?\n print_error \"[EVENTS] Invalid beef hook id: the hooked browser cannot be found in the database\"\n return\n end\n \n events = @data['results']\n\n # push events to logger\n if (events.kind_of?(Array))\n logger = BeEF::Core::Logger.instance\n events.each{|e|\n logger.register('Event', parse(e), zombie.id)\n }\n end\n\n end",
"def install_slack\n if User.with_slack_token.empty?\n current_user.update(slack_access_token: slack_access_token)\n else\n User.with_slack_token.first.update(slack_access_token: slack_access_token)\n end\n\n log(fn: :install_slack, at: :update_slack_token, user: current_user.name)\n redirect_to admin_root_path, notice: \"Updated slack token\"\n end",
"def setup_paypal\n include PayPal::SDK::REST\n\n PayPal::SDK.configure({\n mode: mode,\n client_id: client_id,\n client_secret: client_secret\n })\n end",
"def before_setup; end",
"def after_loading_app_code(options)\n UnionStationHooks.check_initialized\n end",
"def start\n Trello.configure do |config|\n config.developer_public_key = PUBLIC_KEY\n config.member_token = MEMBER_TOKEN\n end\n end",
"def create_carrier_service\n puts \" ____________ CREATE CARRIER SERVICE ______\"\n connectApi\n ShopifyAPI::CarrierService.create({\n \"carrier_service\": {\n \"name\": \"Livraison à domicile avec Urbit\",\n \"callback_url\": \"https://conticini-urbit.herokuapp.com/shipping\",\n \"service_discovery\": true\n }\n })\n end",
"def before_deploy_site\n create\n end",
"def create\n @store = Store.new(store_params)\n\n @store.api_path = @store.name unless @store.api_path.present?\n\n # make sure the store can connect to shopify\n # will return 4xx code if shopify login is bad\n # 401 is bad api secret\n # 403 is bad api key\n # 404 implies bad store name\n\n # validate the return code\n adapter = @store.get_adapter\n return_data = adapter.validate_store(@store)\n if return_data[:return_code] != 200\n render json: return_data, :status => return_data[:return_code] and return\n end\n\n current_user.stores << @store\n\n if @store.save\n render json: @store, status: :created\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def add\n configure_addon('Adding') do |addon, config|\n heroku.install_addon(app, addon, config)\n end\n end",
"def add\n configure_addon('Adding') do |addon, config|\n heroku.install_addon(app, addon, config)\n end\n end",
"def startup_hook; end",
"def after_products\n logger.info 'Heyy!! This is a controller hook provided by sweeper'\n end",
"def connect\n\n # Initialize the gem\n ShopifyAPI::Session.setup({api_key: @api_key, secret: @shared_secret})\n\n # Instantiate the session\n session = ShopifyAPI::Session.new(@url, @password)\n\n # Activate the Session so that requests can be made\n return ShopifyAPI::Base.activate_session(session)\n\n end",
"def setup\n super\n handle_packages\n end",
"def load_rails_hooks(spec)\n spec.before(:all) do\n # Because we create a new Agent after each spec run, we need to make sure\n # that rerun the after_initialize hook to initilize our Agent\n if RailsApp.initialized?\n ActiveSupport.run_load_hooks(:before_initialize, RailsApp)\n ActiveSupport.run_load_hooks(:after_initialize, RailsApp)\n else\n RailsApp.initialize!\n end\n end\n\n spec.before(:each) do\n Honeybadger.configure do |config|\n config.api_key = 'gem testing'\n config.backend = 'test'\n end\n end\n\n spec.after(:each) do\n Honeybadger::Backend::Test.notifications[:notices].clear\n end\nend",
"def lybunt_setup\n end",
"def index\n @stocks = Stock.all\n @webhooks = ShopifyAPI::Webhook.find(:all)\n\n\n # After Authenticate Job / after change in product listings\n if Product.count < 1\n ProductSize.all.each do |size|\n _items = ShopifyAPI::Product.find(:all, params: { collection_id: size.collection_id })\n _items.each do |product|\n prod = Product.create(name: product.title, item_id: product.id, product_size: size)\n product.variants.each do |var|\n prod.variants.create!(quantity: var.inventory_quantity, variant_id: var.id, title: var.title, inventory_item_id: var.inventory_item_id )\n end\n end\n end\n end\n\n\n end",
"def finalize\n shopify_session = ShopifyAPI::Session.new(params[:shop], params[:t], params)\n\n if shopify_session.valid?\n session[:shopify] = shopify_session\n flash[:notice] = 'Logged in to shopify store.'\n\n Shop.find_or_create_by_name_and_api_url(params[:shop], shopify_session.site)\n\n redirect_to return_address\n session[:return_to] = nil\n else\n flash[:error] = 'Could not log in to Shopify store.'\n redirect_to :action => 'index'\n end\n end",
"def webhooks\n @webhooks ||= WebhookRegistry.new\n end",
"def on_app_initializing(_event)\n info \"Initializing Karafka framework #{::Process.pid}\"\n end",
"def set_client_app_initializers\n return unless request.format == 'html'\n @initializers = { soundcloud: { client_id: ENV['SOUND_CLOUD_CLIENT_ID'] } }\n end",
"def before_setup\n # do nothing by default\n end",
"def configure\n Razorpay.setup(publishable_key, secret_key)\n end",
"def set_user_shop_url()\n # add to session so it is easy to access\n session[:shop_url] = ShopifyMultipass.new(Rails.application.credentials.shop_multipass_secret).get_shop_login_url({\n email: @user.email,\n first_name: @user.first_name,\n last_name: @user.last_name,\n tag_string: \"created by multipass\" \n })\n end",
"def action_install\n run_package_action(:install)\n end",
"def site_on_on_install_theme(theme)\n return if theme.get_option('installed_at').present?\n\n # Home page post type\n install_homepage\n\n # Portfolio post type\n install_portfolio\n\n # Reviews\n install_reviews\n\n\n # Template custom fields\n install_theme_settings(theme)\n\n end",
"def initialize( *args )\n super\n @action = :install\nend",
"def initialize( *args )\n super\n @action = :install\nend",
"def action_install\n grunt_package.run_action(:install)\n wh_package.run_action(:install)\n new_resource.installed = true\n end",
"def InitializeHooks\n end",
"def setup(app)\n @app = app\n end",
"def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend",
"def initialize(*args)\n super\n @action = :install\nend",
"def initialize(*args)\n super\n @action = :install\nend",
"def webhook_url(action)\n \"http://#{ENV['COLLECTOR_HOST']}/webhooks/shopify/#{token}/#{action}\"\n end",
"def setup_phase\n if options[:setup].respond_to?(:call)\n log :debug, 'Setup endpoint detected, running now.'\n options[:setup].call(env)\n elsif options[:setup]\n log :debug, 'Calling through to underlying application for setup.'\n setup_env = env.merge('PATH_INFO' => setup_path, 'REQUEST_METHOD' => 'GET')\n call_app!(setup_env)\n end\n end",
"def post_install(&block)\n @post_install_callback = block\n end",
"def auth_setup\n service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)\n service.run\n render :plain => \"Setup complete.\", :status => 404 #This notifies the ominauth to continue\n end",
"def post_install(&block)\n @post_install_callback = block\n end",
"def post_connect_hooks; end",
"def post_connect_hooks; end",
"def index\n Shop.set_store_session\n @products = ShopifyAPI::Product.all\n end",
"def hook_controllers!\n ActionController::Base.extend Storehouse::Controller\n end",
"def before_setup(ant)\n end",
"def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end",
"def merchant_end_point; end",
"def welcome\n puts \"Welcome to Online shopping, see below list of products available\"\n end",
"def cmd_notify_start\n\t\t\t\tprint_status \"Session activity will be sent to you via Slack Webhooks\"\n\t\t\t\tif read_settings()\n\t\t\t\t\tself.framework.events.add_session_subscriber(self)\n\t\t\t\t\tnotifier = Slack::Notifier.new @webhook_url, channel: @user_name, username: 'Meterpreter Helper'\n\t\t\t\t\tprint_good(\"Notify Plugin Started, Monitoring Sessions\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Could not set Slack Web API settings.\")\n\t\t\t\tend\n\n\t\t\tend",
"def configure_frontend\n end",
"def asset_integrate\n \tputs \"<===================create snippet=================>\"\n \tShopifyAPI::Base.site = \"https://#{ShopifyApp.configuration.api_key}:#{self.shopify_token}@#{self.shopify_domain}/admin/\"\n ShopifyAPI::Base.api_version = ShopifyApp.configuration.api_version\n @theme = ShopifyAPI::Theme.find(:all).where(role: 'main').first\n @asset = ShopifyAPI::Asset.create(key: 'snippets/better-cart.liquid', value: \"\n <script>\n window.betterCart = {\n shopify_domain: '{{shop.permanent_domain}}',\n app_url: '#{ENV['DOMAIN']}',\n cart_total: 0\n }\n window.betterCart.cart_total = {{ cart.total_price }}\n console.log(window.betterCart.cart)\n $( \\\"a[href='/cart']\\\" ).each(function( index ) {\n height = $( this ).height();\n b_class=$( this ).attr('class');\n {% if cart.item_count > 0 %}\n \tcart_image = 'cart.gif'\n {% else %}\n \tcart_image = 'cart.svg'\n {% endif %}\n \t\t\t$( this ).replaceWith(\\\"<a href='/cart' class='\\\"+b_class+\\\"'><img src='#{ENV['DOMAIN']}/\\\"+cart_image+\\\"' alt='cart' style='height:\\\"+height+\\\"px;'></a>\\\")\n\t\t\t\t});\n </script>\n\n \", theme_id: @theme.id) rescue nil\n\n @asset = ShopifyAPI::Asset.find('layout/theme.liquid', :params => { :theme_id => @theme.id}) rescue nil\n if @asset.present?\n @asset_value = @asset.value\n @asset.update_attributes(theme_id: @theme.id,value: @asset_value.gsub(\"</body>\",\"{% comment %}This is from betterCart.{% endcomment %}{% include 'better-cart' %}</body>\")) unless @asset_value.include?(\"{% include 'better-cart' %}\")\n end\n end",
"def setup_products\n\t\t@controller = ProductsController.new\n\tend",
"def notify_after_create\n NotifyJob.perform('create', self) if web_hook_actions.include? :create\n end",
"def camaleon_mailchimp_on_active(plugin)\n generate_custom_field_newsletter\n\n current_site.set_meta('mailchimp_config', {api_key: 'XXX', list_id: 'XXX'})\n end",
"def setup\n unless @platform.provisioning.empty?\n script = @platform.provisioning.join(' && ')\n dispatch(script)\n end\n end",
"def setup\n host = request.env['HTTP_HOST']\n @license = nil\n @min_date = DateTime.now - 7\n @max_date = DateTime.now + 1\n date_series \n @app_name = session[:app_name]\n true \n end"
] |
[
"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.53803223",
"0.5366341",
"0.5352875",
"0.5329787",
"0.53295064",
"0.5315691",
"0.5304646",
"0.5287846",
"0.5287846",
"0.5284185",
"0.52790284",
"0.52420264",
"0.52359074",
"0.52319133",
"0.5230501",
"0.52293086",
"0.52284276",
"0.52225477",
"0.5200361",
"0.5195471",
"0.5195471",
"0.51902556",
"0.5183905",
"0.51734674",
"0.5160756",
"0.51515466",
"0.51513904",
"0.5149395",
"0.51453644",
"0.51453376",
"0.5141494",
"0.51412714",
"0.51327",
"0.51294297",
"0.51294297",
"0.51247793",
"0.5118433",
"0.5114705",
"0.51128376",
"0.5098327",
"0.50841486",
"0.5082658",
"0.50809747",
"0.5079745",
"0.50778013",
"0.5077111",
"0.50691336",
"0.5065617",
"0.506315",
"0.50427943",
"0.50426453",
"0.50423217",
"0.50423217",
"0.50405514",
"0.5040021",
"0.5038303",
"0.50379884",
"0.50356525",
"0.50356525",
"0.5030302",
"0.5027643",
"0.5026769",
"0.50157905",
"0.50146735",
"0.5006755",
"0.5006755",
"0.50020725",
"0.49841037",
"0.49833098",
"0.49729466",
"0.49709654",
"0.49669716",
"0.49594742",
"0.49563262",
"0.4953978",
"0.49537224",
"0.495225",
"0.49477762",
"0.4942588",
"0.4941986"
] |
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?(profile)\r\nwhen String\r\n self.profiles.where(:name => profile).select('id').first\r\nwhen Profile\r\n self.profiles.where(:id => profile).select('id').first\r\nend unless @has_profiles.has_key?(profile)\r\nreturn @has_profiles[profile] || profiles.find{|t| self.has_profile?(t) }\r\nend",
"def viewable_for (profile)\n self.by_membership_id(profile.id)\n end",
"def profile; Profile.get(self.profile_id); end",
"def set_profile\n @profile = Profile.friendly.find(params[:id])\n if !(@profile \n (session[:type_user]==\"SimpleUser\" and current_user.profile.family.id==@profile.family.id ) or \n (session[:type_user]==\"Miembro\" and @profile.family and current_user.profile.member.comunity.id==@profile.family.comunity.id) or\n (session[:type_user]==\"Administrador\"))\n redirect_to(root_path,alert: \"Lo sentimos, no tiene permisos para acceder a esta seccion\") \n end\n end",
"def profile\n authorize @profile\n end",
"def show\n @profile=Profile.find(params[:id])\n authorize @profile\n #@profile=Profile.where(user==current_user)\n\n\n #authorize @profile\n\n #scope.where(:id => profile.id).exists?\n\n end",
"def index\n @profiles = current_user\n end",
"def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end",
"def profile\n \t@user = UsersService.findUserById(params[:id])\n end",
"def profile\r\n if params[:id] && User.exists?(params[:id])\r\n @prof = User.find(params[:id])\r\n else\r\n redirect_to_info_page t(:redir)\r\n return\r\n end\r\n end",
"def me?(id)\n id == @profile.id\n end",
"def me?(id)\n id == @profile.id\n end",
"def profile\n\n end",
"def show\n @use = User.find(@profile.my_id)\n if @profile.user_id then\n @target = User.find(@profile.user_id)\n end\n if ((@use.id == 1) && (@use.id == @profile.my_id) && (!@profile.user_id)) then\n do_it\n end\n end",
"def verify_user!\n @profile = current_user.profile\n end",
"def verify_user!\n @profile = current_user.profile\n end",
"def profile\n @profile = current_user\n end",
"def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end",
"def profile\n render_json 0,\"ok\",current_member.as_profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def profile\n end",
"def ensure_user_has_profile\n bounce_user unless current_user and current_user.profile\n end",
"def user\n\n \n @profile = Profile.find_by_user_id(params[:id])\n\n\nend",
"def show\n @profile = @user.profile\n end",
"def other_user_profile?\n !is_owner\n end",
"def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end",
"def manage_profile\n begin\n @has_link_access = true\n if @actor.is_fan? # in case of fan profile login\n @user = @actor\n @additional_info = current_user.additional_info\n get_user_associated_objects\n render :template =>\"/fan/manage_profile\" and return\n elsif @actor.is_artist? # in case of artist profile login\n @user = current_user\n @artist = @actor\n @artist_user = ArtistUser.for_user_and_artist(current_user, @artist).first || ArtistUser.new\n get_artist_objects_for_right_column(@artist)\n render :template =>\"/artist/edit\" and return\n elsif @actor.is_venue? # in case of venue profile login\n @user = current_user\n @venue = @actor\n @venue_user = VenueUser.for_user_and_venue(current_user, @venue).first || VenueUser.new\n get_venue_objects_for_right_column(@venue)\n render :template =>\"/venue/edit\" and return\n end\n rescue =>exp\n logger.error \"Error in User#ManageProfile :=> #{exp.message}\"\n render :nothing => true and return\n end\n respond_to do |format|\n format.js\n format.html\n end\n end",
"def profile\n \n end",
"def profile_show\n @user = User.find(current_user.id)\n\n $admin = User.where(\"admin = ? AND signed_in = ?\", true, true).first\n if $admin.nil?\n $admin = User.where(\"admin = ?\", true).first\n end\n $conversation = Conversation.between(current_user.id,$admin.id).first\n if $conversation.nil?\n $conversation = Conversation.create(sender_id: current_user.id, recipient_id: $admin.id)\n end\n gon.open = $conversation.open\n end",
"def me?(id)\n\t\tid == @profile.id\n\tend",
"def profile\n @user = UserService.getUserById(params[:id])\n end",
"def set_profile\n @profile = Profile.where(user_id: current_user).first\n end",
"def index\n @profiles = current_user.profiles\n end",
"def index\n @profiles = current_user.profiles\n end",
"def set_user_and_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end",
"def set_profile\n @user = current_user\n @profile = @user.profile\n end",
"def profile\n\t\t@user = User.find(current_user)\n\tend",
"def set_current_user_profile\n @profile = custom_find do\n current_v1_user.profiles.find(params[:profile_id])\n end\n end",
"def index\n @created = false\n @user = current_user\n @users = User.all\n @profiles = Profile.all\n @profiles.each do |p|\n if @user && @user.id == p.my_id then\n @created = true\n end\n end\n end",
"def show\n op = present User::Show\n redirect_to edit_user_profile_path(current_user, op.model.profile) && return if op.new_profile?\n redirect_to user_profile_path(current_user, op.model.profile)\n end",
"def user_profile(id)\n users(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def profile\n @user = current_user_with_auths\n @connected = @user.authorizations.collect{|a| a.provider}\n @to_connect = providers - @connected\n unless @user\n redirect_to root_path, :notice => \"Sorry, try logging back in\"\n end\n end",
"def for_profile(profile)\n self.where(:profile_id => profile.id)\n end",
"def profile\n unless @profile\n if associated_profile\n @profile = Profile.new(associated_profile)\n else\n options = {:fields => 'user_id', :includes => 'Profile'}\n options = options.merge(:access_token => token, :access_secret => secret) if (token && secret)\n tmp = User.find(username, options)\n @profile = Profile.new(tmp.associated_profile)\n end\n end\n @profile\n end",
"def user_needs(id)\n needs_data(request(\"users/profile/#{id}.xml\", :auth => true))\n end",
"def has_facebook_profile?\n fb_userid.present?\n end",
"def new?\n profile.empty?\n end",
"def find_profile\n @user = User.find_by_username(params[:id])\n @profile = @user.profile\n end",
"def profile\n if !GraderConfiguration['system.user_setting_enabled']\n redirect_to :controller => 'main', :action => 'list'\n else\n @user = current_user;\n end\n end",
"def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end",
"def set_profile\n @profile = current_user.profiles.find(params[:id])\n end",
"def profile\n @user = current_user\n end",
"def show\n @users = @business_profile.users\n end",
"def profile?\n instance.options[:profile]\n end",
"def set_profile\n @profile = if params[:id]\n Profile.find_by!(user_id: params[:id])\n else\n Profile.find_by(user: current_user)\n end\n end",
"def owned_profile\n @user = User.find_by(user_name: params[:user_name])\n unless current_user == @user\n flash[:alert] = \"That profile does not belong to you!\"\n redirect_to root_path\n end\n end",
"def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end",
"def belongs_to_current_profile_user?\n !!(@current_user.id == @user.id)\n end",
"def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end",
"def set_profile\n if params[:id].to_i != 0\n @profile = Profile.find(params[:id])\n # @user = User.find(params[:id])\n else\n @user = User.find_by_profile_uri(params[:id])\n end\n end",
"def edit\n @user.build_user_profile unless @user.user_profile\n end",
"def xml_query_profile(xml) \n if current_user \n profile_name = (xml.root.get_elements('AccessProfile').first || empty).text \n profile_name = 'public' unless profile_name \n @profile = current_user.profiles.find_by_title(profile_name) \n return render(:text => \"<Response>bad profile</Response>\") unless @profile \n \n properties = @profile.properties.map{|p| p.property_type.title }.join(',') \n return render(:text => \"<Response>#{properties}</Response>\") \n end \n render(:text => \"<Response>Internal Error</Response>\") \n end",
"def set_profile_user\n @profile_user = ProfileUser.find(params[:id])\n end",
"def set_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end",
"def index\n @personal_profiles =current_user.personal_profile\n end",
"def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end",
"def profile\n\t\t@user = current_user\n\tend",
"def profile\n @presenter = Users::ProfilePresenter.new(current_user.id)\n @message = Message.new\n end",
"def set_profile\n u_id = params[:user_id]\n @profile = Profile.where(user_id: u_id)\n end",
"def index\n if user_signed_in?\n if(Profile.exists?(user_id: current_user.id))\n @profile = Profile.find_by(user_id: current_user.id)\n else\n @profile = Profile.new\n @profile.user_id = current_user.id\n @profile.save\n end\n end\n end",
"def show\n authorize @user # Can only see your own profile\n end",
"def set_profile\n @profile = Profile.find(params[:id])\n unless current_user.profiles.find_by(id: @profile.id)\n authorize @profile\n end\n end",
"def show\n @user = User.find(params[:id])\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n @can_edit = can_edit_hash[:has_permission]\n\n #max needs\n @can_see_pref= Permissions.is_at_least_manager(@current_user)\n\n profile_attrs = [:first_name,:last_name, :email,:phone_number]\n @first_name = @user.first_name\n @last_name = @user.last_name\n @email = @user.email\n @phone_number = @user.phone_number\n @role = @user.role\n end",
"def set_profile\r\n @user = Account.find(params[:id])\r\n end",
"def index\n @profile = current_user.payment_profile || Payments::Profile.new(email: current_user.login)\n end",
"def show\n @user = current_user\n @dm_profile = @user.dm_profile\n @player_profile = @user.player_profile\n @new_conversations = find_new_conversations\n @conversations = @user.chat_rooms - @new_conversations\n @similar_profiles = get_similar_profiles(@user) & (User.location(current_user, \"0\") || User.location(current_user, \"0\"))\n end",
"def profile\n @user = User.find(params[:id])\n end",
"def set_profile\n @profile = Profile.find_by_id(params[:id])\n @user = User.find_by_id(@profile.user_id)\n end",
"def user_profile\n @current_user = current_user\n\n if params[:id] == 'me'\n @user = @current_user\n else\n @user = User.find_by_id(params[:id])\n end\n end",
"def owned_by (profile)\n self.by_profile_id(profile.id)\n end",
"def check_profile_enabled(u)\n fn = u.first_name\n ln = u.last_name\n un = u.username\n e = u.email\n visit user_path(u)\n assert page.has_css?('title', text: full_title(\"User: #{fn} #{ln}\"),\n visible: false)\n assert page.has_css?('h1', text: \"User: #{fn} #{ln}\",\n visible: false)\n assert page.has_text?(\"Username: #{un}\")\n assert page.has_text?(\"Email: #{e}\")\n end",
"def set_profile\n @profile = Profile.find_by(user_id: current_user.id)\n end",
"def set_profile\n @profile = current_user\n end",
"def show\n @profile = Profile.find(:first, :conditions => {:user_id => params[:user_id]})\n end",
"def set_profile\n end",
"def set_profile\n @profile = User.friendly.find(params[:user_id]).profile\n end",
"def name\n profile.user.name\n end",
"def profile_has_not_atleast_1_pic?\n current_user.profile.has_atleast_1_pic?\n end",
"def test_validate_new_profile\n u = users(:user_without_profile)\n p = u.profile\n assert p.valid?, \"new blank profile starts off valid\"\n end",
"def user_profile_for(structure)\n user_profile = self.user_profiles.where(structure_id: structure.id).first\n if user_profile.nil?\n user_profile = structure.user_profiles.create(email: self.email)\n end\n user_profile\n end",
"def show\n @profile = Profile.find(params[:id]) || current_user.profile\n end",
"def generate_profile(user)\n if user.profile.nil?\n profile_params = { user_id: user.id, name: \"Subscribed User\", bio: \"Coinmitted investor\", language: \"en\", currency: \"USD\", deleted: false, membership: 0 }\n Profile.create(profile_params) if user.profile.nil?\n end\n end",
"def show\n unless @user==User.find(params[:id])\n flash[:notice]= \"You can only see your own profile.\"\n redirect_to root_path\n end\n @user=User.find(params[:id])\n end",
"def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end",
"def index\n if params[:profile]\n @profile = params[:profile]\n end \n exist_repositorio\n end"
] |
[
"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.63264585",
"0.63264585",
"0.63264585",
"0.63264585",
"0.63264585",
"0.6300828",
"0.63005674",
"0.62898237",
"0.6283885",
"0.6268968",
"0.6262982",
"0.6261509",
"0.6259498",
"0.62563974",
"0.62336254",
"0.6204488",
"0.6203272",
"0.6203272",
"0.61974454",
"0.6196619",
"0.6186431",
"0.6182439",
"0.61783",
"0.617407",
"0.61589384",
"0.6157679",
"0.61543846",
"0.6141646",
"0.6134403",
"0.6130578",
"0.6119594",
"0.611722",
"0.6111772",
"0.61078423",
"0.6105678",
"0.6094544",
"0.6077176",
"0.60635096",
"0.6059688",
"0.6058148",
"0.605533",
"0.605533",
"0.60444146",
"0.60391915",
"0.6036554",
"0.60355043",
"0.6027828",
"0.60260034",
"0.60234225",
"0.6007503",
"0.60043746",
"0.59936756",
"0.59930044",
"0.59857774",
"0.5982",
"0.5978793",
"0.59754616",
"0.59672004",
"0.59616584",
"0.5959991",
"0.5957804",
"0.5957148",
"0.595243",
"0.5952082",
"0.59492356",
"0.5948285",
"0.5948036",
"0.5945245",
"0.59414786",
"0.5934805",
"0.5924792",
"0.592288",
"0.59189314",
"0.5917018",
"0.5916072",
"0.59138715",
"0.5909201",
"0.59065926",
"0.5905515"
] |
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 reviews.map { |r|\n r.user }.uniq\n end",
"def review_user\n self.user\n end",
"def reviews_as_owner\n Review.where(:product_id => product_ids)\n end",
"def create\n @user = User.find(params[:id])\n @user.reviews.push(current_user)\n redirect_to reviews_path\n end",
"def review\n @users = User.all\n @review = Review.new\n end",
"def user_reviews\n list_of_reviews = self.reviews\n list_of_reviews.map{|review| \"User: #{review.user.name}, Rating: #{review.rating}, Review: #{review.description}\"}\n end",
"def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end",
"def customers\n self.reviews.collect do |review|\n review.customer\n end\n end",
"def reviews\n Review.all.select {|review| review.customer == self}\n end",
"def reviews\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review\n # end\n # end\n # output\n Review.all.select { |review| review.user == self }\n end",
"def my_reviews\n Review.all.select do |review_instance|\n review_instance.traveller == self\n end\n end",
"def find_reviews_by_user(user) \n reviewable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s\n \n Review.find(:all,\n :conditions => [\"user_id = ? and reviewable_type = ?\", user.id, reviewable],\n :order => \"created_at DESC\"\n )\n end",
"def index\n @reviews = current_user.reviews\n end",
"def reviews\n self.reviews\n end",
"def viewers\n self.ratings.collect do |rating|\n rating.viewer\n end\n end",
"def reviewers=(value)\n @reviewers = value\n end",
"def reviewers\n return @reviewers\n end",
"def user_name\n reviewee.name\n end",
"def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end",
"def create\n @seller_review = SellerReview.new(seller_review_params)\n @seller_review.reviewer_id = current_user.id\n\n\n respond_to do |format|\n if @seller_review.save\n User.find(@seller_review.seller_id).seller_reviews << @seller_review\n format.html { redirect_to @seller_review, notice: 'Seller review was successfully created.' }\n format.json { render :show, status: :created, location: @seller_review}\n else\n format.html { render :new }\n format.json { render json: @seller_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def viewers(rating)\n self.ratings.find_all do |ratiing|\n ratiing.viewer\n end\n #should return all of the viewers who have left ratings for that movie.\n end",
"def viewers(rating)\n self.ratings.find_all do |ratiing|\n ratiing.viewer\n end\n #should return all of the viewers who have left ratings for that movie.\n end",
"def commenters\n # User.joins(:comments).where(comments: {discussion_id: id}).uniq\n User.where(id: comments.pluck(:author_id))\n end",
"def related_customers\n ratings.customers\n end",
"def movies\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review.movie\n # end\n # end\n # output\n reviews.map { |review| review.movie }\n end",
"def rated_users\n User.where(user_id: ratings.pluck(:user_id))\n end",
"def library_reviewers\n Role.find_by(name: 'library_reviewers').users.to_a\n end",
"def count_ratings\n self.reviews.all.count\n end",
"def index\n @reviews = Review.includes(:user).limit(5)\n end",
"def show\n @reviews = Review.where(user_id: @user.id).includes(:spot)\n end",
"def reviewers\n if review_committee.nil?\n offering_reviewers\n else\n review_committee.members.active_for(quarter_offered)\n end\n end",
"def get_reviewers\n self._get_reviewers\n end",
"def likers\n likes.map do |like|\n like.user\n end\n end",
"def reviewing?(other_user)\n reviewing.include?(other_user)\n end",
"def show\n @owner_id = @product.originaluser_id \n # @reviews = Review.where('owner_id = ?', @owner_id)\n @reviews = Review.where('owner_id = ?', @owner_id).where('reviews.approved = ?', true)\n \n # Review.joins(:user).where('reviews.approved = ?', true).where('users.id = ?', @owner_id)\n end",
"def reviewed_by\n return @reviewed_by\n end",
"def users\n recipes.map {|recipe| recipe.user}\n end",
"def set_reviews\n @reviews = Review.where(restaurant_id: @restaurant.id).order(\"created_at DESC\")\n end",
"def reviewed_books\n self.reviews.map{|r| r.book}\n end",
"def associate_review\n review = Review.find_by(user_id: self.user_id, skin_id: self.skin_id)\n self.review_id = review.id if review\n end",
"def fetch\n Product.includes(:reviews).all\n end",
"def ever_reviewed_by?(user_id)\n\t\tself.reviews.any?{|review| review.user_id == user_id}\n\tend",
"def reviews\n @reviews\n end",
"def logging_in\n guest_reviews = guest_user.reviews.all\n guest_reviews.each do |review|\n review.user_id = current_user.id\n review.save\n end\n # For example:\n # guest_comments = guest_user.comments.all\n # guest_comments.each do |comment|\n # comment.user_id = current_user.id\n # comment.save\n # end\n end",
"def getUserReviews(u)\n @allR = []\n @es = User.find_by(id: u).events\n @es.each do |e|\n @rs = e.reviews\n @rs.each do |r|\n @allR.push(r)\n end\n end\n return @allR\n end",
"def reviewable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :reviewer)\n end",
"def customer\n @@all.select {|review| self.restaurant.customers}\n end",
"def set_review\n @review = current_user.reviews.find(params[:id])\n end",
"def set_review\n @review = current_user.reviews.find(params[:id])\n end",
"def related_employees\n ratings.employees\n end",
"def reviewed_by=(value)\n @reviewed_by = value\n end",
"def show\n @reviews = @user.reviews.includes(:item)\n @favorites = @user.favorites.includes(:item)\n end",
"def review_count\n self.reviews.count\n end",
"def review_count\n self.reviews.count\n end",
"def review_count\n self.reviews.count\n end",
"def set_profile\n @profile = Profile.includes(user: {reviewee: {reviewer: [:profile]}}).find(params[:id])\n end",
"def index\n @reviews = Review.find params[:id]\n\n @user = User.find(params[user:id])\n @review = Review.new\n end",
"def associated\n end",
"def userindex\n @user = User\n .left_joins(:reviews).includes(:reviews)\n .find(current_user.id)\n\n reviews = @user.reviews\n render json: reviews\n end",
"def create\n @review = Presentation.find(params[:id]).reviews.build(reviews_params)\n @review.user_id = current_user.id\n @review.save\n redirect_to current_user\n end",
"def recipe_cards\n user_recipecards = RecipeCard.all.select do |recipecard|\n recipecard.user == self\n end\nend",
"def reviewed_school?(user)\n self.reviews.exists?(user: user)\n end",
"def reviews_count\n \tobject.reviews.count\n end",
"def show\n @user = User.find(params[:id])\n @items = Item.where(user_id: @user.id)\n @reviews = Review.where(user_id: @user.id)\n end",
"def users\n RecipeCard.all.select { |c| c.recipe == self }.map { |c| c.user }\n end",
"def find_reviewers(topic)\n User.all.collect{|u| u if u.reviews.count > 0}.compact\n end",
"def index\n @employee_reviewers = EmployeeReviewer.all\n end",
"def likers \n self.likes.map {|like| like.user_id}\n end",
"def commenters # the user who commented on you\n self.comments.map do |comment|\n comment.user\n end\n end",
"def viewers #returns people\n people = Rating.all.map do |rating|\n if rating.title == self.title\n rating.viewer\n end\n end\n people.map do |peo|\n peo.full_name\n end.uniq\n end",
"def set_user_review\n @user_review = UserReview.find(params[:id])\n end",
"def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n \n return reviewers.uniq\n\n end",
"def create\n @user = current_user\n @review = @user.reviews.build(review_params)\n if @user.save\n render json: @review\n end\n end",
"def reviews\n @items = ProductComment.includes(:account).where({product: @product}).all\n end",
"def reviewer_list\n\n reviewers = []\n design_review_results =\n DesignReviewResult.find_all_by_design_review_id(self.id)\n\n design_review_results.each do |dr_result|\n reviewer = User.find(dr_result.reviewer_id)\n reviewers << reviewer.email if reviewer.active?\n end\n\n return reviewers.uniq\n\n end",
"def users\n recipe_cards.map do |r|\n r.user\n end\n end",
"def get_reviewer\n self\n end",
"def listing_reviews\n Review.where(listing_id: listings.select(:id).collect(&:id))\n end",
"def scorable_reviews\n self.select { |review| review.is_scorable_review? == true }\n end",
"def primary_reviewers\n return @primary_reviewers\n end",
"def liked_by\n User.where(:id => liked_by_ids)\n end",
"def viewers(movie_id)\n set.movie_ratings[movie_id].collect {|user_id, rating| user_id}\n end",
"def users\n RecipeCard.all.select do |recipe_card|\n recipe_card.recipe == self\n end\n end",
"def primary_reviewers=(value)\n @primary_reviewers = value\n end",
"def audit_user\n user\n # TODO Renable/refactor for Questioner 2.0\n # applicable_audit ? applicable_audit.reify(has_many: true) : user\n end",
"def create\n @review = Review.new(review_params)\n current_user.reviews << @review\n respond_to do |format|\n if @review.save\n format.json { render :show, status: :created, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list\n @reviews = current_user.organization.reviews\n end",
"def ratings\n\t\tself.reviews.map{|review| review.rating}\n\tend",
"def review_lender(user)\n\t\t5.times do |m|\n\t\t\tauthor \t\t\t= User.all.sample # random author, User.all bad for memory\n\t\t\treviews_hash \t= random_reviews_hash # generate a radom review (title/stars/summary)\n\t\t\ttitle \t\t\t= reviews_hash[:title]\n\t\t\tstars \t\t\t= reviews_hash[:stars]\n\t\t\tsummary \t\t= reviews_hash[:summary]\n\t\t\tcategory \t\t= random_category\n\n\t\t\t# Create rating\n\t\t\tauthor.ratings_given.create!(lender_id: user.id, stars: stars)\n\t\t\t# Create review\n\t\t\tauthor.reviews_given.create!(lender_id: user.id,\n\t\t\t\t\t\t\t\t\t\t\ttitle: title, \n\t\t\t\t\t\t\t\t\t\t\tstars: stars,\n\t\t\t\t\t\t\t\t\t\t\tsummary: summary, \n\t\t\t\t\t\t\t\t\t\t\tcategory: category)\n\t\tend\n\tend",
"def users\n self.recipe_cards.map {|recipe_card| recipe_card.user}\n end",
"def reviewers\n \n reviewers = self.board_design_entry_users.dup\n reviewers.delete_if { |bde_user| !bde_user.role.reviewer? || bde_user.role.manager? }\n return reviewers.sort_by { |m| m.role.display_name }\n \n end",
"def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end",
"def delete_user\n delete_reviews(self)\n self.destroy\n end",
"def index\n @visitor_reviews = VisitorReview.all\n end",
"def users\n RecipeCard.all.map{|recipe_card| recipe_card.user if recipe_card.recipe_O == self}.compact\n end",
"def my_results(user)\n self.design_review_results.to_ary.find_all { |drr| drr.reviewer == user }\n end",
"def reviews\n Review.all.select do |r|\n r.album == self\n end\n end",
"def cards\n #Card.joins(:duel_user_cards).\n end"
] |
[
"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.59554034",
"0.5930209",
"0.59285873",
"0.59285873",
"0.59233594",
"0.59225875",
"0.5906548",
"0.5899599",
"0.58972055",
"0.58449364",
"0.584455",
"0.5816422",
"0.5792253",
"0.5786376",
"0.5719984",
"0.5717202",
"0.57099587",
"0.569335",
"0.56923383",
"0.56910855",
"0.568742",
"0.5677503",
"0.5668452",
"0.56675935",
"0.5647929",
"0.5623871",
"0.56074864",
"0.56012696",
"0.5593016",
"0.55881625",
"0.55881625",
"0.55801755",
"0.557227",
"0.5569025",
"0.55584157",
"0.55584157",
"0.55584157",
"0.55530417",
"0.5547903",
"0.5538102",
"0.55300057",
"0.5525616",
"0.55250436",
"0.5520954",
"0.55115193",
"0.54969823",
"0.54906523",
"0.5467652",
"0.5467042",
"0.5462743",
"0.5455916",
"0.5449488",
"0.5449453",
"0.5442889",
"0.5442874",
"0.543661",
"0.542594",
"0.54062396",
"0.53838617",
"0.5374087",
"0.53718096",
"0.5370215",
"0.53655463",
"0.5361986",
"0.5361548",
"0.5353474",
"0.5349832",
"0.53402054",
"0.533834",
"0.5337026",
"0.5335418",
"0.5323621",
"0.5311607",
"0.53094923",
"0.5306461",
"0.5305297",
"0.5302866",
"0.529859",
"0.5295485",
"0.5286815"
] |
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 end_date\n self.start_date + self.length.month\n end",
"def end_of_month\n #self - ((self.mday-1).days + self.seconds_since_midnight)\n last_day = ::Time.days_in_month(month, year)\n change(:day => last_day, :hour => 23, :min => 59, :sec => 59, :usec => 0)\n end",
"def determine_end_date\n self.end_date = start_date.next_month.yesterday\n end",
"def end_of_month\n self.class.new year, month + 1, 0\n end",
"def last_day_of_month(date_time=Time.now)\n date_time.end_of_month\n end",
"def end_of_start_month(start_date)\n begin\n end_date = start_date.end_of_month\n raise ArgumentError if end_date > max_date\n end_date\n rescue\n default_end_date\n end\n end",
"def last_of_month\n # See if the month is December\n @last_of_month ||= if @month == 12\n # If so, return the day before the first of next year.\n Date.new(@year + 1, 1 ) - 1\n else\n # If not, return the day before the first of next month.\n Date.new(@year , @month + 1) - 1\n end\n end",
"def merch_month\n # TODO: This is very inefficient, but less complex than strategic guessing\n # maybe switch to a binary search or something\n @merch_month ||= (1..12).detect do |num|\n date_calc.end_of_month(start_of_year.year, num) >= date && date >= date_calc.start_of_month(start_of_year.year, num)\n end\n end",
"def month() end",
"def month? = unit == 'month'",
"def getEndOfMonthDay\n Date.civil(@month1.strftime('%Y').to_i, @month1.strftime('%m').to_i, -1).day.to_i\n end",
"def end_date\n Date.new(date.year, 12, 31)\n end",
"def end_of_month\n last_day = ::Time.days_in_month(month, year)\n last_hour(days_since(last_day - day))\n end",
"def find_next_date_for_monthly start\n if month_end || (start.month == 2 && month_day > 28) || month_day > 30\n next_date = start.end_of_month\n else\n next_date = Date.new(start.year, start.month, month_day)\n end\n return next_date if next_date <= end_date\n #next_date = next_date + 1.month\n #next_date = next_date.end_of_month if month_end\n nil\n end",
"def fy_end(date)\n year = date.year\n # are we in the first three months of the year?\n if(date.month < 4)\n Date.new(date.year,3,31)\n else\n Date.new(date.year+1,3,31)\n end\n end",
"def all_month\n beginning_of_month..end_of_month\n end",
"def end_of_month(year, month_param)\n merch_month = get_merch_month_param(month_param)\n date_calc.end_of_month(year, merch_month)\n end",
"def check_start_date\n self.start_date = Date.current.beginning_of_month.next_month if start_date.nil?\n end",
"def month\n @month || self.starts_at.month\n end",
"def could_be_month?(month); end",
"def month; end",
"def month; end",
"def month\n start_date&.strftime('%b %Y')\n end",
"def change_to_beginning_of_month\n @month.to_date.beginning_of_month\n end",
"def start_of_month\n Date.new(self.strftime('%Y').to_i, self.strftime('%m').to_i, 1)\n end",
"def month\n set_function_and_argument(:month, nil)\n end",
"def day_of_month\n start_on.day.to_s\n end",
"def last_business_day_of_month\n all_working_days_of_month.first\n end",
"def last_month(options={})\n today = Time.now\n last_month = today.last_month\n\n between(last_month.beginning_of_month.to_i, last_month.end_of_month.to_i, options)\n end",
"def start_of_month\n @start_of_month ||= date_calc.start_of_month(year, merch_month)\n end",
"def calculate_start_date\n if !@end_date.blank? && @data_amount > 0\n @start_date = @end_date - (@data_amount-1).month\n @start_date.end_of_month\n end\n end",
"def current_period_end_date\n next_period = current_period_start_date + PERIODICITY\n if (Date.today.month == 1 && start_at.day >= 29) || start_at.day == 31\n # In january, the next month will be February: special rule\n next_period.end_of_month - 1.day\n else\n Date.new(next_period.year, next_period.month, start_at.day) - 1.day\n end\n end",
"def start_date\n weekday = beginning_of_month.cwday\n offset = weekday == 1 ? 0 : (weekday - 1).days\n beginning_of_month - offset\n end",
"def month\n self.range('month')\n end",
"def get_end_date\n end_date\n end",
"def test_should_return_last_day_of_month\n # test an ambiguous last, no weekday defined.\n assert_equal Month.december(2008).last, Date.new(2008,12,31)\n # test a specific last weekday.\n assert_equal Month.september(2004).last(:friday), Date.new(2004,9,24)\n # test a specific ambiguous, fourth, no weekday defined.\n assert_equal Month.june(2004).fourth(:friday), Date.new(2004,6,25)\n end",
"def invoice_from_month_is_empty? date\n if invoices.where(month: date).last.declaration_flag == true\n return true\n else\n return false\n end\n end",
"def in_date_period(month: nil, year: ::Date.today.year)\n from = ::Date.new(year, month || 1, 1)\n to = ::Date.new(year, month || 12, ::Date.civil(year, month || 12, -1).day)\n\n between(from: from, to: to).to_date\n end",
"def all_non_week_days_of_month\n ending_of_month.downto(beginning_of_month).select(&:week_end?)\n end",
"def end_date\n \"Calculate End Date\"\n end",
"def month\n end",
"def last_month_to_date(options={})\n today = Time.now\n last_month = today.last_month\n\n between(last_month.beginning_of_month.to_i, last_month.to_i, options)\n end",
"def month\n Thread.current[:datet_mode] = :months\n return @t_month\n end",
"def month=(_arg0); end",
"def month\n start_on.strftime(MONTH_NAME)\n end",
"def monthly\n end",
"def beginning_of_month\n #self - ((self.mday-1).days + self.seconds_since_midnight)\n change(:day => 1,:hour => 0, :min => 0, :sec => 0, :usec => 0)\n end",
"def all_working_days_of_month\n ending_of_month.downto(beginning_of_month).select(&:working_day?)\n end",
"def end_date\n Date.new((@number + 1), 1, 1).tuesday? ? Date.new((@number + 1), 1, 1) : Date.new(@number, 12, 31)\n end",
"def end_ymd_select_list(original_date = nil)\n ymd_array=[]\n date = Time.now\n ymd_array << [\"#{original_date.strftime(\"%Y-%m\")}-#{original_date.end_of_month.strftime(\"%d\")}\"] unless original_date.nil?\n 12.times do\n ymd_array << [\"#{date.strftime(\"%Y-%m\")}-#{date.end_of_month.strftime(\"%d\")}\"]\n date = date.next_month\n end\n return ymd_array\n end",
"def end_of_quarter\n last_quarter_month = month + (12 - month) % 3\n beginning_of_month.change(month: last_quarter_month).end_of_month\n end",
"def get_end_date\n \n \nend",
"def is_last_month(date)\n lastMonth = Time.now.month - 1\n if lastMonth == 0\n lastMonth = 12\n end\n dateMonth = date.month\n if (dateMonth == 12) and (lastMonth == 12)\n is_last_year(date)\n else\n (dateMonth.between?(lastMonth, lastMonth)) and\n (is_current_year(date))\n end\n end",
"def >>(n)\n date_with_offset(n, :month)\n end",
"def end_date\n return ends if support_deal.nil?\n self.ends ||= support_deal.end_date\n return support_deal.end_date < ends ? support_deal.end_date : ends\n end",
"def month\n @month ||= Date::ABBR_MONTHNAMES.index(@md[1])\n end",
"def month\n @month ||= Date::ABBR_MONTHNAMES.index(@md[4])\n end",
"def pad!\n start = start.beginning_of_month if start\n finish = finish.end_of_month if finish\n end",
"def friendly_date_range\n sessions.first.start.month == sessions.last.start.month ?\n \"#{sessions.first.start.strftime('%B %-d')}-#{sessions.last.start.strftime('%-d, %Y')}\" :\n \"#{sessions.first.start.strftime('%B %-d')} - #{sessions.last.start.strftime('%B %-d, %Y')}\"\n end",
"def month\n @year = params[:year].to_i\n @month = params[:month].to_i\n @first_day = @event.first_day_of_month(@year, @month)\n @last_day_of_month = Date.new(@year, @month, 1).end_of_month\n end",
"def period\n case self.recurring_month\n when 12\n 1.year # 1.year != 12.months\n else\n self.recurring_month.months\n end\n end",
"def start_of_month(year, month)\n begin\n # will raise exception if params are missing or invalid\n start_date = Date.new(year, month)\n raise ArgumentError if start_date < min_date\n raise ArgumentError if start_date > max_date\n start_date\n rescue\n default_start_date\n end\n end",
"def last_day\n @last_day ||= months.last.last_day\n end",
"def beginning_of_month\n self.class.new year, month, 1\n end",
"def months\n Thread.current[:datet_mode] = :months\n return self\n end",
"def month\n @month ||= date_calc.merch_to_julian(merch_month)\n end",
"def final_date\n self.end_date.strftime('%m-%d-%Y')\n end",
"def get_days_month(date=nil)\n date ||= @date\n\n return @schedule.days if @schedule.days > 0\n\n if @schedule.days_month != 'specific'\n if @schedule.days_month == 'last' && @schedule.days_month_day == nil\n return 0b0 | (1 << date.at_end_of_month.day)\n end\n end\n\n return 0b0 | (1 << @schedule.start_date.day)\n end",
"def valid_date_in_month(d,m)\n d >= 1 and Time.days_in_month(m,start.year) >= d ? d : raise(ArgumentError, \"invalid day #{d} for #{m}\") \n end",
"def time_month; Time.now.month; end",
"def ends_at\n @ends_at ||= begin\n if period == :quarter\n starts_at.advance months: length * 3\n else\n starts_at.advance periods => length\n end\n end\n end",
"def find_meetup_date\n Date.new(year, month).next_month.prev_day\n .downto(Date.new(year, month)) do |date|\n return date if correct_date?(date)\n end\n end",
"def end_date\n self.end_at if self.respond_to?(:end_at)\n end",
"def refine_month(m)\n mon = check_num_str(m)\n adjust_month(mon)\n end",
"def last_month_dates\n {\n init_date: Date.today.ago(1.month).beginning_of_month&.to_s,\n end_date: Date.today.ago(1.month).end_of_month&.to_s\n }\n end",
"def timeframe_months\n if self.end_date.present?\n number = (self.end_date.year * 12 + self.end_date.month) - (Date.today.year * 12 + Date.today.month)\n else\n number = 0\n end\n \"#{number} #{'month'.pluralize(number).capitalize}\"\n end",
"def monthly(options = {})\n branch options.merge(every: :month)\n end",
"def monthly(options = {})\n branch options.merge(every: :month)\n end",
"def check_february()\n if @month == 2\n if leap_year? && @day > 29\n return true\n elsif @day > 28\n return true\n end\n end\n return false\n end",
"def empty_due_on?(month:, day:)\n day.zero? && month.zero? || day.zero? && month == -1\n end",
"def month\n months = %w{January February March April May June July August September October November December}\n months[Time.now.month - 1]\n end",
"def month\n sunday = @monday + 6\n return 1 if sunday.month == 1 && sunday.year == @year\n return 12 if @monday.month == 12 && @monday.year == @year\n (@monday + 2).month\n end",
"def end_date\n Time.parse(@end_date) if @end_date\n end",
"def end_date\n Time.parse(@end_date) if @end_date\n end",
"def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end",
"def estimated_end_date\n start_date + 12.days\n end",
"def this_month(options={})\n today = Time.now\n this_month = today.beginning_of_month\n\n between(this_month.beginning_of_day.to_i, today.end_of_day.to_i, options)\n end",
"def extend_empty_end_date\n if self.end_date == self.start_date && !self.repeat_mode.rule.empty?\n self.end_date = Date.today + 10.year\n end\n return self\n end",
"def fmwday\n beginning_of_month.wday\n end",
"def get_next_month(number)\n month = number.to_i < @start.day ? (@start.month == 12 ? 1 : @start.month + 1) : @start.month\n end",
"def syncable_month?(month)\n (self.year < Time.now.year && month <= 12) || (self.year == Time.now.year && month <= Time.now.month)\n end",
"def user_selected_latest_end\n if (\n flash[:filters].length.positive? &&\n flash[:filters][:latest_end.to_s] &&\n # https://stackoverflow.com/questions/15989329/what-is-good-if-an-empty-string-is-truthy\n flash[:filters][:latest_end.to_s].length.positive?\n )\n date_object = Date.strptime(flash[:filters][:latest_end.to_s], \"%Y-%m-%d\")\n else\n date_object = Date.today.next_month\n end\n return date_object\n end",
"def month\n return @month\n end",
"def nth_day_of_month? d, n\n case n <=> 0\n when -1\n nth_last_day_of_month(d) == n\n when 0\n raise ArgumentError.new(\"must be non-zero integer\")\n when 1\n nth_day_of_month(d) == n\n end\n end",
"def first_working_day_of_the_month\n beginning_of_month.upto(ending_of_month).find(&:working_day?)\n end",
"def month\n self.founded.strftime(\"%B\")\n end",
"def meeting_date(date)\n last_day_of_month = date.end_of_month\n total = last_day_of_month.wday + MEETING_WDAY + 1\n total -= 7 if total >= 7\n the_meeting_date = last_day_of_month - total.days\n if the_meeting_date < date\n meeting_date(date.next_month.beginning_of_month)\n else\n the_meeting_date\n end\n rescue\n # TODO: what to return if a DateTime is not passed? should I not worry?\n # TODO: maybe allow passing of month number of the current year as an integer\n \"\"\n end"
] |
[
"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.6538533",
"0.65325624",
"0.6528154",
"0.65096974",
"0.65096974",
"0.65068763",
"0.6501717",
"0.64752316",
"0.6472675",
"0.64225936",
"0.6393213",
"0.6356845",
"0.6345296",
"0.63253766",
"0.6288665",
"0.6272369",
"0.62487274",
"0.62467605",
"0.6241207",
"0.6223487",
"0.6220864",
"0.62101185",
"0.6198002",
"0.619451",
"0.6186119",
"0.6182383",
"0.61769927",
"0.6176219",
"0.616168",
"0.6160796",
"0.61528796",
"0.61508083",
"0.61489135",
"0.6143212",
"0.61335087",
"0.6129864",
"0.61164707",
"0.6115954",
"0.6103423",
"0.6098564",
"0.6070625",
"0.60379183",
"0.6034304",
"0.603055",
"0.60164464",
"0.6013011",
"0.6004439",
"0.6000072",
"0.59935266",
"0.59884715",
"0.59802604",
"0.5978694",
"0.5972536",
"0.5954565",
"0.5935953",
"0.5934719",
"0.5926101",
"0.5925786",
"0.5921393",
"0.5912242",
"0.5912242",
"0.5910734",
"0.5905732",
"0.58941716",
"0.58914393",
"0.58861583",
"0.58861583",
"0.58820105",
"0.5877294",
"0.5876095",
"0.5872622",
"0.5865257",
"0.5864496",
"0.5863254",
"0.58568186",
"0.5849927",
"0.5844975",
"0.5832242",
"0.582426",
"0.5820888"
] |
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 return 3\n else\n return 4\n end\n end",
"def current_quarter\n \n case self.month\n \n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n \n end",
"def all_quarter\n beginning_of_quarter..end_of_quarter\n end",
"def lookup_quarter(x, y)\n return 1 if x >= 0 && y <= -1\n return 2 if x < 0 && y <= -1\n return 3 if x < 0 && y > -1\n return 4\n end",
"def last_five_quarters\n period.to_quarter_period.value.downto(4)\n end",
"def last_five_quarters\n period.to_quarter_period.value.downto(4)\n end",
"def handle_q_s\n next_tag # Q\n @quarter = @tokens[@index].get_tag(Scalar).type\n @number = @quarter\n @index += 1\n @precision = :quarter\n @unit = :quarter\n end",
"def current_quarter_months(date)\n quarters = [1,2,3,4]\n quarters[(date.month - 1) / 3]\n end",
"def apply_function_quarter(scope, ast)\n scope, date = apply_ast(scope, ast.children.first)\n return scope, \"(date_part('quarter', #{date})::integer)\"\n end",
"def score\n @quarters.inject(:+)\n end",
"def quarter_wind; end",
"def end_of_quarter(year, quarter)\n date_calc.end_of_quarter(year, quarter)\n end",
"def start_of_quarter(year, quarter)\n date_calc.start_of_quarter(year, quarter)\n end",
"def quarter\n puts 'Dispensed quarter'\n end",
"def quarter\n puts 'Dispensed quarter'\n end",
"def quo(n) end",
"def qnum(d)\n\t\td = d.to_date\n\t\tif(d.month >= 2 && d.month <= 4)\n\t\t\treturn 1\n\t\telsif(d.month >= 5 && d.month <= 7)\n\t\t\treturn 2\n\t\telsif(d.month >= 8 && d.month <= 10)\n\t\t\treturn 3\n\t\telse\n\t\t\treturn 4\n\t\tend\n\tend",
"def project(value)\n return value * 4 / line[:quarter]\n end",
"def active_quarters(unit=nil)\n unless unit.nil?\n organization_quarters.for_unit(unit).collect{|oq| oq.quarter}\n else\n organization_quarters.collect{|oq| oq.quarter}\n end\n end",
"def quarters_remaining\n return \"Degree Completed\" if degree_completed?\n return_block_or_error_message do\n Quarter.num_quarters_between(first_planned_quarter, last_planned_quarter)\n end\n end",
"def quarter_hours\n partial_hours_from_minutes(minutes)\n end",
"def active_for_quarter?(quarter, unit=nil)\n active_quarters(unit).include? quarter\n end",
"def use_quarters?\n term_system == \"Quarters\"\n end",
"def start_of_quarter\n \n year = self.strftime('%Y').to_i\n current_month = self.strftime('%m').to_i\n \n month = 1\n 1.step(13, 3) do |m|\n break if m > current_month\n month = m\n end\n \n Date.new(year, month, 1)\n \n end",
"def prevQuarter( date )\n m = date.month;\n y = date.year;\n m -= 3;\n if( m < 1 ) then\n m += 12;\n y -= 1;\n end;\n return Date.new( y, m, 1 );\nend",
"def getQuo ( x , y )\n\tq = x / y\n\treturn q\nend",
"def num_quarter_hours=(new_quarter_hours)\n @num_quarter_hours = new_quarter_hours\n post_initialize\n @num_quarter_hours\n end",
"def quarterName\n qtrName = \"\"\n case self.enclaveQuarter\n when 1\n qtrName = \"First\"\n when 2\n qtrName = \"Second\"\n when 3\n qtrName = \"Third\"\n when 4\n qtrName = \"Fourth\"\n end\n qtrName\n end",
"def test_Rational_InstanceMethods_quo\n\t\tassert_equal(2.0, Rational(\"4\").quo(2))\n\t\tassert_equal(1.0, Rational(\"4\").quo(4))\n\tend",
"def quantile q\n cut = (q.to_f * count).ceil\n obs = 0\n for i in 0...size\n obs += self.frequency[i]\n return i if obs > 0 && obs >= cut\n end\n return nil\n end",
"def nextQuarter( date )\n m = date.month;\n y = date.year;\n m += 3;\n if( m > 12 ) then\n m -= 12;\n y += 1;\n end;\n return Date.new( y, m, 1 );\nend",
"def end_of_quarter\n last_quarter_month = month + (12 - month) % 3\n beginning_of_month.change(month: last_quarter_month).end_of_month\n end",
"def count_quizzes\n @worksheet.num_rows\n end",
"def beginning_of_quarter\n first_quarter_month = month - (2 + month) % 3\n beginning_of_month.change(month: first_quarter_month)\n end",
"def currentQuarter\n value = nil\n sql = ActiveRecord::Base.connection();\n #value, dummy = sql.execute(\"SELECT MAX(enclaveQuarter), 0 FROM enclavequarters WHERE enclaveYear = #{self.currentYear}\").fetch_row\n value = sql.select_value(\"SELECT MAX(enclaveQuarter) FROM enclavequarters WHERE enclaveYear = #{self.currentYear}\")\n value\n end",
"def match_quarter\n @quarter ? { 'fiscal_quarter_id' => /#{@quarter}/i } : {}\n end",
"def quarter_issues(d2,s1,cat,dist)\n\n all = Issue.where('extract(year from raised_on) = ?', self.qstart(d2).year)\n number = all.where('extract(month from raised_on) in (?)', self.qmonths(d2))\n if s1 != 0\n number = number.where('structure_id in (?)', s1)\n end\n if cat !=0\n number = number.where(category_id: cat)\n end\n if dist !=0\n number = number.where(district_id: dist)\n end\n return number\n end",
"def q(n)\n if n == 1\n return 1\n else q(n-1) + (n*n*n)\n end\nend",
"def total_quizzes_stats\n Float(self.quizzes.length)\n end",
"def counting_quantity\n product.allow_fractional_quantity? ? 1 : quantity.to_i\n end",
"def current_quarter?\n self == Quarter.current_quarter\n end",
"def to_q\n 1+(self/100.0)\n end",
"def compute_bin_count q\n count = (@data.size / q.to_f).ceil\n count < 2 ? 2 : count\n end",
"def q(x, n, m)\n 1.0 - cdf(x, n, m)\n end",
"def imprime_quantos_filhos()\n count = 0\n if self.esq != -1\n count+= 1\n end\n if self.dir != -1\n count+= 1\n end\n return count\n end",
"def rqcount\n reposts.count + quotes.count\n end",
"def quarter_circle(center, options)\n case options[:quadrant]\n when 1\n start_angle = 0\n end_angle = 90\n when 2\n start_angle = 90\n end_angle = 180\n when 3\n start_angle = 180\n end_angle = 270\n when 4\n start_angle = 270\n end_angle = 360\n end\n pie_slice(center,\n :radius => options[:radius],\n :start_angle => start_angle,\n :end_angle => end_angle,\n :stroke_both_sides => options[:stroke_both_sides])\n end",
"def qing_answer_count(qing)\n # fetch the counts if not already fetched\n if !@answer_counts\n\n # if form is standard, look for answers for copy questionings, since the std questioning will never have answers\n joins = if is_standard?\n %{LEFT OUTER JOIN questionings copies ON questionings.id = copies.standard_id\n LEFT OUTER JOIN answers ON answers.questioning_id = copies.id}\n else\n \"LEFT OUTER JOIN answers ON answers.questioning_id = questionings.id\"\n end\n\n @answer_counts = Questioning.find_by_sql([%{\n SELECT questionings.id, COUNT(DISTINCT answers.id) AS answer_count\n FROM questionings #{joins}\n WHERE questionings.form_id = ?\n GROUP BY questionings.id\n }, id]).index_by(&:id)\n end\n\n # get the desired count\n @answer_counts[qing.id].try(:answer_count) || 0\n end",
"def last_quarter\n return last_planned_quarter if any_planned_courses?\n return last_taken_quarter if any_taken_courses?\n nil\n end",
"def apply_to_quantity(q)\n ops.inject(q){ |tot,op| op.call(tot) }\n end",
"def quantize(denom)\n\tboundary = @sequence.ppqn / denom\n\t@events.each { | event | event.quantize_to(boundary) }\n\trecalc_delta_from_times\n end",
"def update_future_quarter\n # get the next quarter\n next_q = Quarter.quarter_after(self.quarter_id)\n next_es = ExpertSurvey.in_quarter(next_q.id) if next_q.present?\n if next_es.present?\n update_change_value(next_es, self)\n next_es.save\n end\n\n return true\n end",
"def length\n @q.length\n end",
"def quarter_wind_abbreviation; end",
"def is_current_quarter(date)\n currentQuarter = ((Time.now.month - 1) / 3) + 1\n dateQuarter = current_quarter_months(date)\n dateQuarter.between?(currentQuarter, currentQuarter)\n end",
"def number_of_divisors\n return 1 if self == 1\n self.prime_division.map{|num, power| power + 1 }.inject(&:*)\n end",
"def /(n) self * 1.quo(n) end",
"def prev\n prev_qtr_code = quarter_code_id == 1 ? 4 : quarter_code_id - 1\n prev_year = quarter_code_id == 1 ? year - 1 : year\n Quarter.find_easily(prev_qtr_code, prev_year)\n end",
"def endOfQuarter(d)\n\t\td = d.to_date\n\t\tif(d.month >= 2 && d.month <= 4)\n\t\t\treturn Date.new(d.year, 4, 30)\n\t\telsif(d.month >= 5 && d.month <= 7)\n\t\t\treturn Date.new(d.year, 7, 31)\n\t\telsif(d.month >= 8 && d.month <= 10)\n\t\t\treturn Date.new(d.year, 10, 31)\n\t\telsif(d.month == 11 || d.month == 12)\n\t\t\treturn Date.new((d.year+1), 1, 31)\n\t\telsif(d.month == 1)\n\t\t\treturn Date.new(d.year, 1, 31)\n\t\tend\n\tend",
"def dimension\n map { |qnt, exp| qnt.dimension * exp }.reduce SY::Dimension.zero, :+\n end",
"def calculate_dicsount(index)\n ((index + 1) * 9) / 100.0\nend",
"def quarter_gpa(quarter = nil)\n t = transcripts.find(system_key, quarter.year, quarter.quarter_code_id) rescue nil\n raw_gpa = t.nil? ? nil : (t.qtr_grade_points/t.qtr_graded_attmp) rescue nil\n '%.2f' % raw_gpa rescue \"unknown\" \n end",
"def quads\n @analysis[:quads]\n end",
"def period\n 4/frequency\n end",
"def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end",
"def get_total_qnty(line_items)\n line_items.map(&:quantity).sum\n end",
"def compute_percent(rcount, qcount)\n return 100 if qcount.zero?\n (rcount * 100.0 / qcount).to_i\n end",
"def size\n @q.size\n end",
"def get_quarterly\n # get last year earnings\n l_year = latest_eps.year\n\n # get which quarters are the last 4\n fp = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Fiscal Period\" }\n fp = fp.xpath('./td') if fp\n\n if fp.nil?\n puts \"--------------------------------------Cannot get info for #{ticker}\"\n return false\n end\n # Find last year by counting 'td's up to \"TMM\"\n years_available = 0 # Some stocks may not have 10 years worth of data\n for i in 1..fp.size\n if fp[i].nil? || !fp[i].text.match(\"TTM\").nil?\n break\n end\n years_available = i\n end\n\n puts \"Counted #{years_available} years of available data for #{ticker}\"\n\n update_year = 1 # Some stocks may not be updated for 2012 yet\n update_year = 0 if fp[years_available].text.last == \"2\"\n\n\n\n\n #Acces data page\n url = \"http://www.gurufocus.com/financials/#{ticker}\"\n doc = open_url_or_nil(url)\n if doc.nil?\n puts \"Could not get quarterly finantial data from gurufocus.com\"\n return false\n end\n\n # Get last 4 quarters quarterly data\n # Check first if all 4 quarters are available?\n (1..4).each do |i|\n if fp[i].nil? || !fp[i].text.match(\"TTM\").nil?\n break\n end\n years_available = i\n end\n\n puts \"Counted #{years_available} years of available data for #{ticker}\"\n\n update_year = 1 # Some stocks may not be updated for 2012 yet\n update_year = 0 if fp[years_available].text.last == \"2\"\n\n # A boolean to test if current asset values are available\n using_current_data = true\n\n # Scrape data from doc\n # Current Assets\n ca = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Current Assets\" }\n if ca\n ca = ca.xpath('./td')\n else\n using_current_data = false\n end\n\n ta = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Assets\" }\n ta = ta.xpath('./td') if ta\n\n cl = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Current Liabilities\" }\n if cl\n cl = cl.xpath('./td')\n else\n using_current_data = false\n end\n\n tl = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Liabilities\" }\n tl = tl.xpath('./td') if tl\n\n # Debt, book value, net tangible assets\n ltd = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Long-Term Debt\" }\n ltd = ltd.xpath('./td') if ltd\n\n bv = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Total Equity\" }\n bv = bv.xpath('./td') if bv\n\n ocs = doc.xpath('//tr').detect{ |tr| tr.xpath('./td').first != nil && tr.xpath('./td').first['title'] == \"Other Current Assets\" }\n ocs = ocs.xpath('./td') if ocs\n\n # Create balance sheet for 10 years\n (1..years_available).each do |i|\n cas = \"\"\n cls = \"\"\n ntas = \"\"\n if using_current_data\n cas = (clean_string(ca[i].text).to_f.round * MILLION).to_s\n cls = (clean_string(cl[i].text).to_f.round * MILLION).to_s\n if ocs\n ntas = (( clean_string(ca[i].text).to_f - clean_string(ocs[i].text).to_f - clean_string(cl[i].text).to_f ).round * MILLION ).to_s\n else\n ntas = cas\n end\n end\n\n # Some trusts don't have liabilities\n tler = \"\"\n tler = (clean_string(tl[i].text).to_f.round * MILLION).to_s if tl\n der = \"\"\n der = (clean_string(ltd[i].text).to_f.round * MILLION).to_s if ltd\n bver = \"\"\n bver = (clean_string(bv[i].text).to_f.round * MILLION).to_s if bv\n bs = BalanceSheet.create(:stock_id => self.id,\n :year => YEAR - (years_available+1 - i) - update_year, #This reveses the year from i\n :current_assets => cas,\n :total_assets => (clean_string(ta[i].text).to_f.round * MILLION).to_s,\n :current_liabilities => cls,\n :total_liabilities => tler,\n :long_term_debt => der,\n :net_tangible_assets => ntas,\n :book_value => bver,\n :quarter => q)\n puts \"Got bs data for #{ticker}, year: #{bs.year}, ta = #{bs.total_assets}\" if !bs.id.nil?\n end\n\n update_attributes( :has_currant_ratio => using_current_data)\n\n end",
"def quarter_wind_azimuth; end",
"def last_active_quarter\n organization_quarters.with_students_placed.sort.first\n end",
"def num_answered_questions(plan)\n plan&.num_answered_questions.to_i\n end",
"def reset_future_quarter\n # get the next quarter\n next_q = Quarter.quarter_after(self.quarter_id)\n next_es = ExpertSurvey.in_quarter(next_q.id) if next_q.present?\n if next_es.present?\n reset_change_value(next_es)\n next_es.save\n end\n\n return true\n end",
"def startOfQuarter(d)\n\t\td = d.to_date\n\t\tif(d.month >= 2 && d.month <= 4)\n\t\t\treturn Date.new(d.year, 2, 1)\n\t\telsif(d.month >= 5 && d.month <= 7)\n\t\t\treturn Date.new(d.year, 5, 1)\n\t\telsif(d.month >= 8 && d.month <= 10)\n\t\t\treturn Date.new(d.year, 8, 1)\n\t\telsif(d.month == 11 || d.month == 12)\n\t\t\treturn Date.new(d.year, 11, 1)\n\t\telsif(d.month == 1)\n\t\t\treturn Date.new((d.year-1), 11, 1)\n\t\tend\n\tend",
"def number_of_values\n Integer((@upper - @lower) / @step) + 1\n end",
"def quantum_number\n @l + @m + @n\n end",
"def div(y)\n quo(y, ZERO)\n end",
"def qv_count\n self.qv_mappings.size\n end",
"def next\n next_qtr_code = quarter_code_id == 4 ? 1 : quarter_code_id + 1\n next_year = quarter_code_id == 4 ? year + 1 : year\n Quarter.find_easily(next_qtr_code, next_year)\n end",
"def number_of_operating_rounds(phase)\n @config.fetch('operating_rounds').find do |round|\n round.fetch('phase').equal?(phase)\n end.fetch('count')\n end",
"def quarts\n Measurements::USVolume.new(self, :quart)\n end",
"def quartile_inc()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Quartile_Inc::QuartileIncRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def is_last_quarter(date)\n lastQuarter = ((Time.now.month - 1) / 3)\n if lastQuarter == 0 \n lastQuarter = 4\n end\n dateQuarter = current_quarter_months(date)\n if (dateQuarter == 4) and (lastQuarter == 4)\n is_last_year(date)\n else\n (dateQuarter.between?(lastQuarter, lastQuarter)) and\n (is_current_year(date))\n end\n end",
"def suitable_quaters\n required_amount * 2\n end",
"def numerator_quantities\n base_quantities.select { |key| @base_quantity_hash[key] > 0 }\n end",
"def gumball(quarters)\n if quarters == 0 || quarters == 1\n puts \"I don't have enough money for a gumball\"\n elsif quarters == 2 || quarters == 3\n puts \"I have enough money for a gumball\"\n end\nend",
"def set_headquarter\n @headquarter = Headquarter.joins(:country).find_by('countries.slug' => params[:country_id])\n end",
"def set_change_values\n # get the previous quarter\n prev_q = Quarter.quarter_before(self.quarter_id)\n prev_es = ExpertSurvey.in_quarter(prev_q.id) if prev_q.present?\n compute_change_values(self, prev_es)\n\n return true\n end",
"def solution(n, p, q)\n primes = primes(n)\n # puts \"primes:#{primes}\"\n semi_primes_count = Array.new n+1, 0\n primes.each do |p1|\n primes.each do |p2|\n break if p1 * p2 > n\n semi_primes_count[p1 * p2] = 1\n end\n end\n\n 1.upto(n) do |i|\n semi_primes_count[i] += semi_primes_count[i - 1]\n end\n\n queries = [p,q].transpose\n\n res = queries.map do |query|\n semi_primes_count[query.last] - semi_primes_count[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end",
"def ptsub(q, n)\r\n q = q.to_f\r\n if(n == 1 && 0.001 < q && q < 0.01)\r\n eps = 1.0e-4\r\n elsif (n == 2 && q < 0.0001)\r\n eps = 1.0e-4\r\n elsif (n == 1 && q < 0.001)\r\n eps = 1.0e-2\r\n else\r\n eps = 1.0e-5\r\n end\r\n s = 10000.0\r\n w = 0.0\r\n loop do\r\n w += s\r\n if(s <= eps) then return w end\r\n if((qe = 2.0 - p_t(n, w)*2.0 - q) == 0.0) then return w end\r\n if(qe < 0.0)\r\n w -= s\r\n s /= 10.0 #/\r\n end\r\n end\r\n end",
"def q(t)\n \n end",
"def num_questions\n return sections.includes(:questions).joins(:questions).reduce(0){ |m, s| m + s.questions.length }\n end",
"def quarter_name=(quarter)\n self.quarter = Quarter.find_or_initialize_by_name(quarter)\n end",
"def first_quarter\n return first_taken_quarter if any_taken_courses?\n return first_planned_quarter if any_planned_courses?\n nil\n end",
"def number_of_divisors\n (1..Math.sqrt(self)).inject(0) {|sum, i| modulo(i) == 0 ? sum + 2 : sum}\n end",
"def find(set,q)\n\tsum = 0\n\tfor i in 0..set.length-1\n\t\tif i+q>=set.length\n\t\t\tbreak\n\t\tend\n\t\tif set[i]==1&&set[i+q]==1\n\t\t\tsum+=1\n\t\tend\n\tend\n\treturn sum\nend",
"def stock_count(stock_number)\n return stock_number [:pets].count\nend"
] |
[
"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.5784851",
"0.57519263",
"0.5616382",
"0.5594801",
"0.5566521",
"0.5500411",
"0.54982495",
"0.5474797",
"0.5416184",
"0.54013836",
"0.5396181",
"0.5370161",
"0.53657234",
"0.53574914",
"0.5303332",
"0.53022796",
"0.52736443",
"0.52688146",
"0.5250523",
"0.52399665",
"0.5190386",
"0.51883745",
"0.5162612",
"0.5159744",
"0.51583815",
"0.5143165",
"0.5056834",
"0.5052245",
"0.5052059",
"0.5028252",
"0.50063837",
"0.49992546",
"0.49845886",
"0.49804217",
"0.49699706",
"0.49630287",
"0.49435952",
"0.49349222",
"0.49152002",
"0.49127367",
"0.4891017",
"0.4878868",
"0.48748824",
"0.48514572",
"0.48481306",
"0.48389232",
"0.48328012",
"0.48320466",
"0.48320466",
"0.48208642",
"0.48148334",
"0.4805353",
"0.47922",
"0.47791696",
"0.47646365",
"0.47626442",
"0.4752588",
"0.47448692",
"0.47324887",
"0.47265697",
"0.4724053",
"0.47230554",
"0.47228026",
"0.47209617",
"0.4718334",
"0.47136158",
"0.47104958",
"0.4674931",
"0.46695763",
"0.46680248",
"0.46660364",
"0.46653634",
"0.46637347",
"0.46615487",
"0.46461686",
"0.4641246",
"0.46271405",
"0.4616684",
"0.46143174",
"0.45850363"
] |
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'), parent_at_rank('genus')].compact.first\n end",
"def get_parent(generation_level)\n return self if root? || generation_level <= 0\n parent.get_parent(generation_level-1)\n end",
"def default_childs_number=(v)\n @@default_childs_number = v\n end",
"def get_top_parent_id(max_generations = 10)\n k = 0\n org = self\n while\n k += 1\n if k > max_generations\n raise DataCatalog::Error, \"Top-level parent of #{self.id} not found\"\n end\n if org.top_level\n return org.id\n elsif org.parent_id\n org = org.parent\n else\n return nil\n end\n end\n end",
"def third_child\n child 2\n end",
"def parent(i); (i-1)/2; end",
"def ancestor_title(generation=1)\n\t\ttitle = case self.sex\n\t\twhen \"M\" then \"father\"\n\t\twhen \"F\" then \"mother\"\n\t\telse \"parent\"\n\t\tend\n\n\t\tcase generation\n\t\twhen 0 then \"self\"\n\t\twhen 1 then title\n\t\twhen 2 then \"grand\" + title\n\t\twhen 3 then \"great-grand\" + title\n\t\telse (generation-2).to_ordinal + \" great-grand\" + title\n\t\tend\n\tend",
"def nesting\n @parent ? @parent.nesting + 1 : 1\n end",
"def number_of_parents\n if self.is_parent\n return 0\n else\n return 1 + self.parent.number_of_parents\n end\n end",
"def parents; end",
"def parent_name\n @parent_name || super\n end",
"def parent_name\n @parent_name || super\n end",
"def parent\n if @resource[:parent] =~ /^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$/\n gindex = $ngs.index { |i| i['id'] == @resource[:parent] }\n $ngs[gindex]['id']\n else\n @property_hash[:parent]\n end\n end",
"def level\n if parent.nil?\n 0\n else\n parent.level + 1;\n end\n end",
"def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend",
"def get_child_index\n return 0\n end",
"def parent(child)\n return (child - 1) / 2\nend",
"def get_parent(k)\n parent = (k - 1) / 2\n parent if parent >= 0\nend",
"def parent_id_name\n \"#{@parent.class.name.downcase}_id\"\n end",
"def parent(index)\n (index.to_f / 2).ceil - 1\n end",
"def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\nend",
"def ultimate_parent # note: ultimate parent is self, not nil, if self has no parent...\n if parent_id.blank?\n self\n else\n parent.ultimate_parent\n end\n end",
"def _parent; end",
"def level\n parent_id.nil? ? 0 : compute_level\n end",
"def second_child\n child 1\n end",
"def parent_ids\n []\n end",
"def parent_id\n object[\"parent_id\"]\n end",
"def get_level\n level = 1\n p = parent\n while !p.nil?\n level += 1\n p = p.parent\n end\n \n return level\n end",
"def parent_ids_sf_style\n ids = [] \n (ancestors.push self).each do |a|\n case a.rank\n when 'genus'\n ids.push \"#{a.id}g\"\n when 'subgenus'\n ids.push \"#{a.id}s\"\n else\n ids.push a.id.to_s\n end\n end\n ids.join(\"-\")\n end",
"def parent(i)\n (i-1)/2\n end",
"def parent\n self.parents.where('forestify_level = ?', self.forestify_level - 1).first\n end",
"def parent_id\n data[:parent_id]\n end",
"def parent\n @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child\n end",
"def parent_id=(value)\n if value == @defaults['ai.operation.parentId']\n @values.delete 'ai.operation.parentId' if @values.key? 'ai.operation.parentId'\n else\n @values['ai.operation.parentId'] = value\n end\n end",
"def parent_id=(value)\n if value == @defaults['ai.operation.parentId']\n @values.delete 'ai.operation.parentId' if @values.key? 'ai.operation.parentId'\n else\n @values['ai.operation.parentId'] = value\n end\n end",
"def _parent_id\n send parent_column_name\n end",
"def parent\n nil\n end",
"def parent_class_name\n options[:parent] || determine_default_parent_class\n end",
"def ancestor_builder; end",
"def ancestor_builder; end",
"def parent(node_id)\n node_id >> 1 # node_id / 2\n end",
"def parent_id\n parent_ids.last\n end",
"def default_lineage\n if parent.nil? then\n 'New'\n elsif specimen_characteristics.equal?(parent.specimen_characteristics) then\n 'Aliquot'\n else\n 'Derived'\n end\n end",
"def first_child\n child 0\n end",
"def before_save\n if owner\n self.page = owner.page if page.nil?\n if page?\n self.depth = parent ? ((parent.depth || 0) + 1) : 0\n else\n self.depth = (owner.content_depth || 0) + 1\n end\n end\n super\n end",
"def get_parent_object\n nil\n end",
"def root_relation?; !parent end",
"def get_parent\n return nil\n end",
"def parent; @options[:parent]; end",
"def update_parent(node, num, new_node)\n\t\tparent = node.parent\n\t\tunless parent.nil?\n\t\t\tif parent.key > num\n\t\t\t\tparent.left = new_node\n\t\t\telse\n\t\t\t\tparent.right = new_node\n\t\t\tend\n\t\tend\n\tend",
"def set_parent_object\n if(@order_item.blank? || @order_item.new_record?)\n @parent = [@purchasable, :order_items]\n else\n unless(@order_item.order != nil && @order_item.order.type == 'Basket')\n @parent = find_order_item_parent(@order_item)\n else\n @parent = orders_basket_path\n end\n end\n end",
"def before_create\n # Update the child object with its parents attrs\n unless self[:parent_id].to_i.zero?\n self[:depth] = parent[:depth].to_i + 1\n self[:root_id] = parent[:root_id].to_i\n end\n end",
"def build_parents(data)\n data.inject({}) do |h, d|\n (1...d.length).each { |i| h[d[i]] = d[0] }; h\n end\nend",
"def parent_index(i)\n (i / 2).floor\n end",
"def parent_child_index(parent) #:nodoc:\n duck = parent[:builder].instance_variable_get('@nested_child_index')\n\n if duck.is_a?(Hash)\n child = parent[:for]\n child = child.first if child.respond_to?(:first)\n duck[child].to_i + 1\n else\n duck.to_i + 1\n end\n end",
"def parent=(parent_node); end",
"def parent=(parent_node); end",
"def parent(index)\n # Ruby automatically floors integers\n return (index - 1) / 2 if index.even?\n index / 2 \n end",
"def level\n return 0 if root?\n\n @parent.level + 1\n end",
"def change_n_order(mode)\n return false unless self.parent\n\n if mode == 1\n if self.n_order != 1\n kw = self.parent.childs.where(n_order: self.n_order-1).first\n if kw\n kw.n_order += 1\n self.n_order -= 1\n kw.save\n self.save\n end\n end\n\n elsif mode == 2\n kw = self.parent.childs.where(n_order: self.n_order+1).last\n puts \"---- kw: #{kw.n_order} vs self: #{self.n_order}\"\n if kw && self.n_order < kw.n_order\n kw.n_order -= 1\n self.n_order += 1\n kw.save\n self.save\n end\n end\n end",
"def parent\n end",
"def parent\n end",
"def parent\n end",
"def parent\n end",
"def parent_association\n if params[:id].nil?\n return parent_object.all_parent_relations \n end\n # Gotta find it seperately, will get a recursive stack error elsewise\n o = FeatureRelation.find(params[:id])\n parent_object.id == o.parent_node.id ? parent_object.all_child_relations : parent_object.all_parent_relations\n end",
"def depth\n self.parents.size\n end",
"def get_tree_top_id(person)\n person.direct_supervisors.empty? ? person.id : person.direct_supervisors.first.id\n end",
"def level\n case\n when root? then 0\n when depth_column_could_be_used? then depth\n when parent_association_loaded? then parent.level + 1\n # @todo move it adapters\n else ancestors.size\n end\n end",
"def parent\n @parent\n end",
"def parent\n @parent\n end",
"def cyclic_parent_name\n (\"parent_#{self.name.demodulize.underscore.singularize}\").to_sym\n end",
"def new_issue_lft\n 1\n end",
"def parent_name\n @parent ? @parent.full_name : '(unknown)'\n end",
"def parent_id\n @values.fetch('ai.operation.parentId') { \n @values['ai.operation.parentId'] = nil\n }\n end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def parent; end",
"def example_parent_values(use_shallow_route=false)\n example_parent_values = {}\n parent_models = use_shallow_route ? parent_model_names[0..-2] : parent_model_names\n parent_models.each_with_index do |parent_model, index|\n example_parent_values[\"#{parent_model}_id\"] = index + 2\n end\n example_parent_values\n end",
"def parent_name\n self.class.parent_name\n end",
"def parent_count(*args)\n parent_rels(*args).size\n end",
"def insert_case3(node)\n if node.uncle && node.uncle.red?\n node.parent.color = :black\n node.uncle.color = :black\n node.grandparent.color = :red\n\n insert_case1(node.grandparent)\n else\n insert_case4(node)\n end\n end",
"def insert_case3(node)\n if node.uncle && node.uncle.red?\n node.parent.color = :black\n node.uncle.color = :black\n node.grandparent.color = :red\n\n insert_case1(node.grandparent)\n else\n insert_case4(node)\n end\n end",
"def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end",
"def get_parent_tagname\n self.parent_tagname.present? ? self.parent_tagname : nil\n end",
"def parent_id=(v)\n v = nil if v == '#'\n super(v)\n end",
"def parent_association\n @parent_object=parent_object # ResourceController normally sets this\n if params[:id].nil?\n return parent_object.all_parent_relations \n end\n # Gotta find it seperately, will get a recursive stack error elsewise\n o = FeatureRelation.find(params[:id])\n parent_object.id == o.parent_node.id ? parent_object.all_child_relations : parent_object.all_parent_relations\n end",
"def my_depth\n 1\n end",
"def set_ParentID(value)\n set_input(\"ParentID\", value)\n end",
"def set_ParentID(value)\n set_input(\"ParentID\", value)\n end"
] |
[
"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.59026766",
"0.5875109",
"0.58735263",
"0.5872303",
"0.5869444",
"0.58434427",
"0.5830874",
"0.5827682",
"0.581193",
"0.5811507",
"0.5807501",
"0.57786024",
"0.5768576",
"0.5762909",
"0.575153",
"0.57461864",
"0.57461864",
"0.5745303",
"0.57424885",
"0.57386",
"0.57299227",
"0.57299227",
"0.572485",
"0.5717432",
"0.5715815",
"0.571407",
"0.57067454",
"0.57023466",
"0.5685424",
"0.5678096",
"0.5671833",
"0.5664418",
"0.56478864",
"0.56433356",
"0.5642739",
"0.56267405",
"0.5623324",
"0.56229854",
"0.56229854",
"0.56193095",
"0.56186247",
"0.561186",
"0.560632",
"0.560632",
"0.560632",
"0.560632",
"0.55955285",
"0.55924195",
"0.55916524",
"0.55893046",
"0.5587523",
"0.5587523",
"0.55800426",
"0.5573544",
"0.55700713",
"0.5567974",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.555693",
"0.5552743",
"0.55511767",
"0.5537942",
"0.55373144",
"0.55373144",
"0.5532772",
"0.5532772",
"0.55249155",
"0.55154014",
"0.5515382",
"0.5514402",
"0.5514402"
] |
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 has selected to clear the search, or there is no search params, start from the top\n Rails.logger.info(\"Pic Search: #{params.inspect}\")\n if params[:clear] || params[:q] == \"\"\n redirect_to pictures_path\n else \n @picturesandmeta = Pictureandmeta.search(params[:q])\n #@page = 1\n render :index\n end\n end",
"def searchable?\n return @paginable_params[:search].present?\n end",
"def start_new_search_session?\r\n !%w[default online_contents collection_context child_components].include?(params[:view]) && super\r\n end",
"def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end",
"def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end",
"def search_result_page_existed?\r\n displayed?\r\n end",
"def searching?\n return true unless params[:search].nil?\n end",
"def has_simple_search?\n self.search_type.to_s == \"simple\" && !self.is_static?\n end",
"def searchable?\n @args[:search].present?\n end",
"def search\n\n if params[:search].blank?\n flash.now[:notice]= \"Please start to search.\"\n else\n search = params[:search]\n get_flickr_images(search)\n @images = @flickr_images.paginate(page: params[:page], per_page: 50)\n flash.now[:annouce] = \"Click a thumbnail image to view the larger size image.\"\n end\n render :home\n\n end",
"def search\n if params[:tag]\n @pictures = Picture.tagged_with(params[:tag])\n elsif params[:search] \n @pictures = Picture.tagged_with(params[:search])\n else \n redirect_to albums_path and return\n end\n render \"index\"\n end",
"def start_new_search_session?\n !%w[online_contents collection_context child_components].include?(params[:view]) && super\n end",
"def gallery\n if current_user.explicit?\n # Show all items including the ones marked explicit\n @item_pictures = ItemPicture.all\n @heading = \"Picture Records [E*]\"\n\n # search Id\n @search = params[\"search\"]\n\n if @search.present?\n\n @search_term = @search[\"name\"]\n\n @item_pictures = ItemPicture.where(\"name ILIKE ?\", \"%#{@search_term}%\")\n end\n\n @item_pictures = @item_pictures.where(explicit:true).paginate(page: params[:page], :per_page => 200)\n .order(\"id DESC\" )\n\n render action: :gallery\n\n else\n # Show only items not marked as explicit\n @item_pictures = ItemPicture.all\n @heading = \"Picture Records [S*]\"\n\n # search Id\n @search = params[\"search\"]\n\n if @search.present?\n\n @search_term = @search[\"name\"]\n\n @item_pictures = ItemPicture.where(\"name ILIKE ?\", \"%#{@search_term}%\")\n\n end\n @item_pictures = @item_pictures.where(explicit: false).paginate(page: params[:page], :per_page => 200)\n .order( \"id DESC\" )\n\n render action: :gallery\n\n end\n end",
"def expandable_search?\n params[:q].present? and !params[:advanced_search] and !params[:click_to_search]\n end",
"def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n else\n browse\n end\n end",
"def search_pagination_enabled?\n !scaffold_search_results_limit.nil?\n end",
"def has_complex_search?\n self.search_type.to_s == \"complex\" && !self.is_static?\n end",
"def include_global_search\n true\n end",
"def search\n # TODO: uncomment when we have html and js to implement the test variants\n # unless user_signed_in?\n # # A/B test - only for anonymous users\n # @search_landing_banner_appear = ab_test :search_landing_banner_appear\n # end\n render '/home/app'\n end",
"def tag_search\n if params[:search].blank? \n @images = Image.all()\n render 'images/index'\n else\n @images = Image.all()\n tag_array = Array.new\n tags = params[:search]\n\n tag_array = tags.delete_suffix(',').split(',')\n @search_results = helpers.find_images(tag_array)\n \n render 'images/searchResults'\n end\n end",
"def show\n @is_adv_search=params[:advance_search]\n end",
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Image)\n show_selected_images(query)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search')\n end\n end",
"def image_gallery_search_results\n @name = params[\"search_field\"]\n search = @name.split(\"_\")\n @products = Product.where(florist_id: session[\"found_florist_id\"]).where(\"product_type not like '4. Labor'\").where(status: \"Active\").where(\"name ilike ?\", \"%#{search[0]}%\").where(\"name ilike ?\", \"%#{search[1]}%\").where(\"name ilike ?\", \"%#{search[2]}%\").order(\"status\", \"product_type\", \"name\").paginate(:page => params[:page], :per_page => 25)\n render(:image_gallery_search_results, layout:false) and return\n end",
"def search_url_picker\n current_page?(\"/advanced\") ? search_catalog_url : search_action_url\n end",
"def show_sidebar?\n has_search_parameters?\n end",
"def perform_search\n if self.class == Alchemy::Admin::PagesController && params[:query].blank?\n params[:query] = 'lorem'\n end\n return if params[:query].blank?\n @search_results = search_results\n if paginate_per\n @search_results = @search_results.page(params[:page]).per(paginate_per)\n end\n end",
"def noSearchResults\n render :layout => false\n end",
"def search_type\n\t\tif is_user_search == \"1\"\n\t\t\treturn \"User Search\"\n\t\telsif is_tag_search == \"1\"\n\t\t\treturn \"Tag Search\"\n\t\tend\n\tend",
"def searching?\n @searching\n end",
"def show_search_bar_options\n zone = controller.class.name.downcase\n zone =~ /homepage/ || zone =~ /records/\n end",
"def back_to_catalog_needed\n return !session[:search].blank?\n end",
"def search_results_page_type\n action = controller.action_name\n if [\"browse_for_sale\", \"new_developments\"].include? action\n :sales\n elsif [\"browse_for_rent\", \"quick_search\"].include? action\n :rentals\n end\n end",
"def has_search_parameters?\n params[:mlt_id].present? || super\n end",
"def searching?\n @searching\n end",
"def search\n Settings.record_activity \n if @params['show_results'] == 'true' && (@last_search = SearchContacts.last_search)\n @contacts_already_on_device = @last_search.find_contacts_on_device\n end\n render :action => :search, :back => 'callback:', :layout => 'layout_JQM_Lite'\n end",
"def index\n \n if params[:organism_id]\n @parent_object = @organism = Organism.find(params[:organism_id])\n @galleries = @organism.search_galleries(params[:search], params[:page])\n @search_galleries_header = 'galleries_organism_search'\n end\n\n if params[:event_id]\n @parent_object = @event = Event.find(params[:event_id])\n @galleries = @event.search_galleries(params[:search], params[:page])\n @search_galleries_header = 'galleries_event_search'\n end\n\n if !params[:organism_id] && ! params[:event_id]\n @galleries = Gallery.search(params[:search], params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @galleries }\n format.js {\n render :update do |page|\n page.replace_html 'results', :partial => 'galleries_list'\n end\n }\n end\n end",
"def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end",
"def search\n markup = render_to_string :partial => \"search_lightbox\", :layout => false\n render :json => { :code => 200, :klass => 'success', :markup => markup }.to_json and return\n end",
"def search?\n unless /GET|HEAD/ =~ request_method\n return false\n end\n \n if id? \n false\n else\n true\n end\n end",
"def set_search\n @search = Recipe.ransack(params[:q])\n @search_recipes = @search.result.page(params[:page])\n @tag_search = Recipe.tagged_with(params[:search])\n end",
"def start_new_search_session?\n super || params[:action] == 'admin'\n end",
"def image_gallery_post\n if params[\"clear\"]\n redirect_to \"/image_gallery\" and return\n else\n @name = params[\"search_field\"].gsub(\" \", \"_\")\n redirect_to \"/image_gallery/#{@name}\" and return\n end\n end",
"def search_options\n ModelSearchBuilder.new([:pictures], @page).search_options('site_type_code', @stype)\n end",
"def search\n # Rails automatically renders the corresponding \"search\" view.\n render :layout => false\n end",
"def search\n # if the user has selected to clear the search, or there is no search params, start from the top\n if params[:clear] || params[:q] == \"\"\n Rails.logger.info(\"Kind: #{params.inspect}\")\n redirect_to kinds_path\n else \n @kinds = Kind.search(params[:q]).page params[:page]\n #@page = 1\n render :index\n end\n end",
"def search\n unless params[:q].blank?\n ensure_homepage\n term = \"*#{params[:q].split.join('* OR *')}*\"\n @pages=Page.paginate_search(term,:page=>params[:page])\n else\n flash[:notice]='Please Specify a Search Term'\n end\n @search=true\n render :action=>'index'\n end",
"def start_new_search_session?\n super || params[:action] == 'admin'\n end",
"def start_new_search_session?\n super || params[:action] == 'admin'\n end",
"def index\n if has_search_parameters? || advanced_controller?\n super\n else\n respond_to do |format|\n format.html { store_preferred_view }\n end\n end\n end",
"def advanced_search\n return if handle_advanced_search_invalid_q_param?\n\n query = find_query(:Image)\n show_selected_images(query)\n rescue StandardError => e\n flash_error(e.to_s) if e.present?\n redirect_to(controller: \"observer\", action: \"advanced_search\")\n end",
"def search\n params[:search] ||= {}\n @document = Document.public.find_by_path(params[:path].join('/'))\n params[:search].merge!(:parent_id => @document.id)\n params[:search][:state_eq] = 'published'\n @documents = Document.search(params[:search]).paginate :page => params[:page], :per_page => Settings.documents.per_page\n setup_view_environment\n render :template => view_for(:suffix => '_search')\n end",
"def multi_field_search?\n return false\n end",
"def searchResults\n render :layout => false\n end",
"def index\n if params.key?(:sq)\n search_params = {}\n search_params.merge!(original_search_params)\n @photos = Photo.search(search_params).result(distinct: true).page(params[:page])\n @page_h1 = '検索結果'\n elsif params[:tag]\n @photos = Photo.tagged_with(params[:tag]).page(params[:page])\n @page_h1 = \"タグ結果 - #{params[:tag]}\"\n else\n @photos = Photo.page(params[:page])\n @page_h1 = '写真一覧'\n end\n end",
"def search?\n not user.nil?\n end",
"def search_form\n #this is finsihed!!\n end",
"def adjust_for_results_view\n if params[:results_view] == \"false\"\n session[:search][:results_view] = false\n else\n session[:search][:results_view] = true\n end\n end",
"def show\n # find_gallery method gets called here\n end",
"def nothingToSearch? \n\t\treturn $toSearch.empty? \n\tend",
"def start_new_search_session?\n params[:action] == 'show'\n end",
"def scaffold_search_pagination_enabled?\n !scaffold_search_results_limit.nil?\n end",
"def search_status\n if uri_term?\n :single_result\n else\n perform_search\n end\n end",
"def adjust_for_results_view\n if params[:results_view] == 'false'\n session[:search][:results_view] = false\n else\n session[:search][:results_view] = true\n end\n end",
"def index\n if current_user.typeof == false\n @searchers = Searcher.all\n else\n redirect_to home_home_page_path\n end\n end",
"def check_ferret\n if NilClass === self.ferret.enabled && (defined?(::Ferret) != nil) \n # Look for a search action relative to a collection of resources.\n search_route_present= @res.collection_methods.values.flatten.include? :search # << Resource class of Rails\n self.ferret.enabled= search_route_present && resource.model.respond_to?(:find_by_contents)\n end\n \n if self.ferret.enabled\n defaults= { \n :search_limit => :all \n }\n (self.ferret.options||={}).reverse_merge!(defaults)\n else\n self.links.delete :search\n self.methods.delete :search\n end\n end",
"def search\n render: =>'search'\nend",
"def show\n if search_params = params[:search] && params[:search][:query]\n @search = Search.new(query: search_params)\n @search.perform if @search.valid?\n else\n @search = Search.new\n end\nend",
"def show\n\t\t@order_term = build_order\n\t\t@searches = Search.all.order(@order_term)\n\t\t@search.get_photos\n\tend",
"def index\n search = params[:search].present? ? params[:search] : nil\n\n @artists = if search\n\n # Render search results\n\n Artist.search(params[:search], page: params[:page], per_page: 20)\n\n else\n\n # Render blog articles\n\n Artist.all.order(created_at: :desc).page(params[:page])\n\n end\n end",
"def search_results\n pages = Alchemy::PgSearch.config[:page_search_scope].pages\n # Since CanCan cannot (oh the irony) merge +accessible_by+ scope with pg_search scopes,\n # we need to fake a page object here\n if can? :show, Alchemy::Page.new(restricted: true, public_on: Date.current)\n pages.full_text_search(params[:query])\n else\n pages.not_restricted.full_text_search(params[:query])\n end\n end",
"def analyse_search\n if params[:search].nil? && params['action'] == 'index'\n redirect_to root_path\n elsif params[:search].nil? && params['action'] == 'show'\n nil\n elsif params[:search][:age].present?\n @deputies = select_by_age(params[:search][:age])\n elsif params[:search][:grp].present?\n @deputies = select_by_group(params[:search][:grp])\n elsif params[:search][:ini].present?\n @deputies = select_by_initial(params[:search][:ini])\n elsif params[:search][:dep].present?\n @deputies = select_by_department(params[:search][:dep])\n elsif params[:search][:pro].present?\n @deputies = select_by_profession(params[:search][:pro])\n elsif params['action'] == 'index'\n redirect_to root_path\n end\n end",
"def search_load\n @search = current_user.saved_page_infos.find(params[:id]).load(@sssn).model\n draw_search_form\n end",
"def adv_search_button\n @edit = session[:edit]\n @view = session[:view]\n\n # setting default to false\n @edit[:custom_search] = false\n\n case params[:button]\n when \"save\", \"saveit\"\n if adv_search_button_saveid\n adv_search_redraw_left_div\n else\n @edit[:search_type] = nil unless @edit.key?(:search_type)\n adv_search_redraw_search_partials('save')\n end\n\n when \"loadit\"\n adv_search_button_loadit\n adv_search_redraw_search_partials\n\n when 'load'\n adv_search_redraw_search_partials('load')\n\n when \"delete\"\n adv_search_button_delete\n adv_search_button_reset_fields\n adv_search_redraw_left_div\n\n when \"reset\"\n add_flash(_(\"The current search details have been reset\"), :warning)\n adv_search_button_reset_fields\n adv_search_redraw_search_partials\n\n when \"apply\"\n adv_search_button_apply\n\n when \"cancel\"\n @edit[@expkey][:exp_table] = exp_build_table(@edit[@expkey][:expression]) # Rebuild the existing expression table\n @edit[@expkey].prefill_val_types\n adv_search_redraw_search_partials\n\n end\n end",
"def search_all\n params[:search] ||= {}\n params[:search][:state_eq] = 'published'\n @documents = Document.search(params[:search]).paginate :page => params[:page], :per_page => Settings.documents.per_page\n render :template => '/pages/search'\n end",
"def show_links?\n edata = extra_data\n bitvalue = edata[\"m_search_engines\"].to_i\n is_a_search_link_set = [1,2,4,8,16].map do |a| \n (bitvalue & a) > 0 ? 1 : nil \n end.compact.size > 0\n is_a_search_link_set || (edata[\"artist\"] &&\n !edata[\"artist\"][\"name\"].blank? &&\n !edata[\"artist\"][\"url\"].blank?)\n end",
"def search_type\r\n posting_type == 'Freight' ? 'LoadingSpace' : 'Freight'\r\n end",
"def adv_search\r\n\r\n redirect_to :action => :search\r\n end",
"def index\n @search = search_params\n #do your customize query here\n @images = Image.page(params[:page]).order('created_at desc')\n if @search && @search[:keyword]\n @images = @images.where('title like ?', @search[:keyword]+'%')\n end\n end",
"def render_for_search_results(home_search)\n if !home_search \n @renderer = \"WillPaginate::LinkRenderer\"\n render :file => \"games/index.html\", :layout => \"application\"\n else \n @renderer = \"PaginationListLinkRenderer\"\n render :partial => \"games/paginated_game_results\" \n end\n end",
"def has_search_parameters?\n !params[:q].blank? || !params[:f].blank? || !params[:search_field].blank?\n end",
"def get_results\n # 1. if the search is blank do NOT run the search (handled in subclasses)\n !self.search_text.blank? && !self.search_query.blank? && !self.search_type.blank? && !self.search_locale.blank?\n end",
"def advanced_search # :nologin: :norobots:\n begin\n query = find_query(:Location)\n show_selected_locations(query, :link_all_sorts => true)\n rescue => err\n flash_error(err.to_s) if !err.blank?\n redirect_to(:controller => 'observer', :action => 'advanced_search_form')\n end\n end",
"def set_search_path\n render 'layouts/set_search_path'\n end",
"def search\n unless params[:q].blank?\n @posts=Post.paginate_search(params[:q],:page=>params[:page])\n else\n flash[:notice]='Please Specify a Search Term'\n end\n @search=true\n render :action=>'index'\n end",
"def search_model\n end",
"def has_search_parameters?\n params[:search_field].present? || search_state.has_constraints?\n end",
"def index\n raise 'no page params' if params[:search][:page].blank?\n page, value = params[:search][:page], params[:search][:value]\n\n if page.include? 'home'\n logger.debug('!! searging by all')\n @links = Link.search value\n elsif page.include? 'favorit'\n logger.debug('!! searging by favorits')\n @links = Link.search value, :with => {:favorits_user_id => current_user.id}\n elsif page.include? 'links'\n logger.debug('!! searging by my links')\n @links = Link.search value, :with => {:user_id => current_user.id}\n end\n\n respond_to do |format|\n format.html\n end\n end",
"def show_super_search_links_on_index\n false \n end",
"def search_success\n page(SubmissionPage).create_post(\"search query\")\n page(FeedDetailsPage).view_search(\"Microsoft\")\n page(FeedDetailsPage).touch_rec\n page(FeedDetailsPage).view_search(\"Microsoft\")\nend",
"def search_path; end",
"def search_path; end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end",
"def search\n end"
] |
[
"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.61003274",
"0.60552657",
"0.5973798",
"0.59623027",
"0.5950434",
"0.5948306",
"0.5943344",
"0.59323424",
"0.59195876",
"0.5902575",
"0.5902449",
"0.58816195",
"0.5860271",
"0.5847107",
"0.58283126",
"0.58056617",
"0.5803758",
"0.57997763",
"0.57900417",
"0.5771895",
"0.577081",
"0.5747841",
"0.5746966",
"0.5742693",
"0.5725485",
"0.57229745",
"0.5711215",
"0.570638",
"0.57045096",
"0.56947434",
"0.56947434",
"0.56888723",
"0.5681672",
"0.5676837",
"0.5672825",
"0.56604576",
"0.5658622",
"0.56520045",
"0.56497157",
"0.5649201",
"0.56489426",
"0.5645584",
"0.5641626",
"0.56409746",
"0.563922",
"0.5637268",
"0.56206864",
"0.5608191",
"0.5602748",
"0.56021017",
"0.5601555",
"0.55909353",
"0.558675",
"0.558196",
"0.55816466",
"0.55572",
"0.555709",
"0.5554611",
"0.5548441",
"0.55453295",
"0.5543592",
"0.5539279",
"0.55363834",
"0.5522639",
"0.5508907",
"0.55052435",
"0.5498138",
"0.5487316",
"0.5484",
"0.54832476",
"0.5474176",
"0.54733974",
"0.5472603",
"0.5472603",
"0.54641783",
"0.54641783",
"0.54641783",
"0.54641783",
"0.54641783"
] |
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 @gallery_layouts = current_brand.gallery_layouts.all\n @gallery_layout = GalleryLayout.new\n end",
"def show\n \t@gallery = Gallery.find(@collection.gallery_id)\n \t# p \"collections controller\"\n end",
"def only_collections?\n true\n end",
"def within_collection_context?\n return true if record_view?\n\n results_view? && params.dig(:f, 'collection_sim')\n end",
"def photos_widget\n if @photos.any?\n render partial: 'photo_panel'\n end\n end",
"def index\n @gallery = Gallery.find(params[\"gallery_id\"])\n @collections = @gallery.collections.active\n end",
"def collection?\n @resource.collection?\n end",
"def is_collection\n return self.resource_type == Resource::LEARNING_COLLECTION;\n end",
"def collection?\n true\n end",
"def collection? \n true\n end",
"def repository_activity_section?\n %w[admin dashboard status].include?(controller_name)\n end",
"def collection?\n false\n end",
"def view_share\n #~ @folder = Folder.find_folder(params[:folder_id])\n params[:is_lease_agent] == 'true' ? display_lease_agents : display_collaborators\n end",
"def in_my_collection(user)\n collection = Media.count_by_sql([\"select count(c.id) from collections c inner join collections_items ci on \"+\n \"c.id = ci.collection_id and ci.item_id = ? and ci.item_type = 'Media' inner join lightboxes lb on \"+\n \"c.id = lb.link_id and lb.user_id = ? and lb.link_type = 'Collection'\", self.id, user.id]) > 0\n photo = Media.count_by_sql([\"select count(l.id) from lightboxes l where link_id = ? and user_id = ? and link_type = ?\",\n self.id, user.id, 'Media']) > 0\n\n return collection || photo\n end",
"def collection?\n false\n end",
"def collection?\n false\n end",
"def collection?\n false\n end",
"def collection_is_viewable(collection, user, project=nil)\n if collection == nil\n return false\n end\n\n if collection.user == user\n return true\n end\n \n #collection_has_editor(collection) #makes collection viewable to editor in data view\n \n #If collection is part of a project\n if project != nil && collection.projects.include?(project)\n return true\n end\n \n return false\n end",
"def can_collection_query?\n org = active_org\n if org\n org.full_member?\n else\n single_user_access?\n end\n end",
"def collection\n action_name == 'show' ? @presenter : @collection\n end",
"def collection? \n false\n end",
"def gallery_type_museum?\n self.gallery_type == VENUE_TYPES['museum'] rescue false\n end",
"def is_collection?\n contexts.flag11 == 1\n end",
"def viewer\n admin\n end",
"def is_in_admin_view\n !request.path.match(\"/admin\").nil?\n end",
"def is_in_admin_view\n !request.path.match(\"/admin\").nil?\n end",
"def skip_collection?(collection)\n collection.published_at.nil? ||\n Time.parse(collection.published_at).utc > Time.now.utc ||\n collection.handle == 'frontpage' ||\n collection.title.include?('[hidden]') ||\n collection.product_ids.count.zero?\n end",
"def show\n authorize! :read, @collection\n end",
"def show_admin_menu_items?\n can?(:read, :admin_dashboard)\n end",
"def show\n # find_gallery method gets called here\n end",
"def index\n if current_user.role_ids == [1]\n @galleries = Gallery.all \n else \n gallery_ids = Chaper.find_all_by_user_id(current_user.id).map{|x| x.gallery_id}\n @galleries = Gallery.find_all_by_id(gallery_ids)\n end \n end",
"def is_in_admin_view?\n !request.path.match(\"admin\").nil?\n end",
"def show\n is_admin?\n end",
"def show_collection_thumb(document)\n if document.md_url\n link_to(\n thumbnail_image_tag(document),\n document.md_url\n )\n else\n # No other link available, so link thumb to internal collection homepage\n index_collection_thumb(document)\n end\n end",
"def viewable_parent?\n parent.respond_to?(:member_ids) && parent.respond_to?(:thumbnail_id)\n end",
"def viewer?(current_user)\n return false unless current_user\n\n viewers.where(id: current_user).count == 1\n end",
"def can_view_enroller_dashboard?\n has_role?(:enroller)\n end",
"def show\n is_admin?\n end",
"def is_collection?\n @is_collection\n end",
"def show\n @gallery = Gallery.find(params[:id])\n render :layout => false\n end",
"def show\n @collection = Collection.find(params[:id])\n @authorLoggedIn = current_user == @collection.user\n\n if (@collection.private? && !current_user) || (@collection.private? && @collection.collection_users.include?(current_user) == false)\n respond_to do |format|\n format.html {redirect_to errors_unauthorized_path}\n end\n else\n step_ids = Step.joins(:project => :collectifies).where(collectifies: { collection_id: @collection.id }).pluck(:'steps.id')\n\n @questions = Question.where(:step_id => step_ids).where(:featured => nil).order(\"created_at DESC\")\n @activities = PublicActivity::Activity.where(:trackable_type => \"Step\").where(\"trackable_id\" => step_ids).where(\"key\" => \"step.create\").order(\"created_at DESC\").first(5)\n @contributors = @collection.projects.flat_map {|p| p.users}.uniq\n\n respond_to do |format|\n format.html {\n if request.path != collection_path(@collection)\n redirect_to @collection, status: :moved_permanently\n end\n }\n format.json { render :json => @collections }\n end\n\n end\n end",
"def collection?\n File.directory? @src_path\n end",
"def can_view_public_health_dashboard?\n has_role?(:public_health) || has_role?(:public_health_enroller)\n end",
"def show_collection_section(collection, section)\n if [\"intro\", \"faq\", \"rules\"].include?(section) # just a check that we're not using a bogus section string\n !collection.collection_profile.send(section).blank? || collection.parent && !collection.parent.collection_profile.send(section).blank?\n end\n end",
"def collection_action?\n collection_actions.include?(action)\n end",
"def viewer?( id )\n acl.has_permission?( id, AlbumACL::VIEWER_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::MODERATOR_ROLE)\n end",
"def set_collection\n @collection = Collection.find(params[:id])\n\n unless @collection.available?(@current_user)\n respond_to do |format|\n format.html { redirect_back fallback_location: collections_path, error: \"Cannot access the document\"}\n format.json { render json: {msg: 'Cannot access document'}, status: 401 }\n end \n return false\n end\n end",
"def index\n # find the galleries in batches so we can render in groups\n @title = @title + \" : Galleries\"\n @meta_description = @meta_description +\" : Galleries\"\n @galleries = @galleries.collect {|x| x}\n if can? :create, Roxiware::Gallery\n @galleries << Roxiware::Gallery.new({:name=>\"Create New Gallery\"}, :as=>@role) \n end \n end",
"def index\n @admin_galleries = Gallery.all\n end",
"def viewer?\n user_role_id == UserRole::VIEWER\n end",
"def admin?\n !current_user.AdminScreen?\n end",
"def is_dashboard?\n #params[:controller] == 'care_circles'\n #params[:care_circle_id] || (params[:controller] == \"care_circles\")\n params[:controller] == \"care_circles\"\n end",
"def check_and_set_admin_access\n begin\n if params[:venue_name] == 'home'\n @venue = @actor\n @has_admin_access = @venue == @actor\n @has_link_access = @has_admin_access\n @is_homepage = true\n else\n @venue = Venue.where(:mention_name => params[:venue_name]).first\n @has_admin_access = @venue == @actor\n @is_public = true\n @has_link_access = false\n end\n rescue\n @venue = nil\n end\n unless @venue\n render :template =>\"bricks/page_missing\" and return\n end\n end",
"def side_bar_nav?\n # !(@tag.nil? || @tag.entries.first.try(:link_to_tag) || @tag.predefined_class == \"Gallery\")\n !(@tag.nil? || @tag.predefined_class == \"Gallery\")\n end",
"def show\n isadmin\n end",
"def can_view?(object)\n false\n end",
"def set_collection\n @collection = Collection.find(params[:collection_id])\n redirect_to :back, alert: 'Not authorized' unless @collection.available?(@current_user)\n end",
"def show\n if user_signed_in?\n send_image\n else\n evaluate_visibility\n end\n end",
"def display_associated_collection(collection)\n empty_message = \n # If they're equal and it can be read, it's valid; can wrap this into a if class with the latter, but nah.\n if technology_profiles == collection #&& read_attribute(collection)\n \"This project doesn't have a technology profile generated (yet).\"\n elsif photos == collection #&& read_attribute(collection)\n 'No photos regarding this project are available.'\n end\n\n if collection.any?\n return render collection \n else\n return content_tag(:p, empty_message)\n end\n\n end",
"def show\n @images = @galleries_album.galleries\n end",
"def present_collection(collection = resource); nil; end",
"def show\n\t\t@gallery = Gallery.find(params[:id])\n\t\t@albums = @gallery.project_albums\n\t\t@products = @gallery.featured_products.in_groups_of(4,false)\n\t\t@designer = @gallery.designer\n\t\t@other_galleries = @designer.galleries.where('id <> ?' , @gallery.id).in_groups_of(4,false)\n\t\t@sub_galleries = @gallery.sub_category.galleries.where('id <> ?' , @gallery.id).in_groups_of(4,false)\n\tend",
"def parent_collection?\n parent.collection?\n end",
"def admin_signed_in?\n !current_user.nil? && current_user.AdminScreen?\n end",
"def show_explore_button?\n current_user.permissions == User::Permissions::NONE\n end",
"def show_collection_preface(collection)\n show_collection_section(collection, \"intro\") || show_collection_section(collection, \"faq\") || show_collection_section(collection, \"rules\")\n end",
"def collections_created?\n true\n end",
"def index\n @galleries = current_client.galleries\n @title = \"My Galleries\"\n end",
"def check_if_system_visible\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @mediaset = Mediaset.find(params[:id])\n unless @mediaset.system_visible\n respond_to do |format|\n format.html { render :not_viewable }\n end\n end\n end",
"def viewable?\n published? || created? || editing?\n end",
"def admin?\n current_layout == 'admin' || (params[:controller] == 'static' && params[:action] == 'admin_home')\n end",
"def link_visible?(page_name)\n if current_user.manager? || current_user.admin?\n pages = ['dashboard', 'home', 'products', 'categories', 'users', 'offers']\n else\n pages = ['home']\n end\n\n pages.include?(page_name)\n end",
"def check_public_section\n #redirect_to dashboard_path if (Rails.env == 'production' && action_name == 'index')\n end",
"def show\n @title = \"Gallery\"\n begin\n @gallery = Gallery.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to admin_galleries_path, :flash => {:notice => \"Page not found\"}\n end\n\n end",
"def show\n authorize @publishers_test\n end",
"def is_collection_like\n return (self.is_collection || self.is_exhibition)\n end",
"def is_displayed_on_site?\n feed.feed_type.name == \"Article\"\n end",
"def visible?\n true\n end",
"def showGalleries\n @galleries = Gallery.uniq.joins(:arts).where('arts.uploader = ?', current_user.id.to_s)\n end",
"def check_visibility\n if not @organisation.active?\n hidden = false\n if not current_user == @organisation\n hidden = true\n end\n\n current_user.is_a?(User) and current_user.has_role?(:admin) ? hidden = false : nil\n if hidden\n raise Helpedia::ItemNotVisible\n end\n end\n end",
"def supports_view_listing?\n respond_to?(:views)\n end",
"def show\n @sub_collection_images = @sub_collection.sub_collection_images.all\n end",
"def should_render_facet?(display_facet)\n return false if display_facet.name == 'human_readable_type_sim' && display_facet.items.reject { |item| item.value == 'Collection'}.empty?\n super\n end",
"def ensure_authorized_to_view\n @listing = Listing.find(params[:id])\n unless @listing.visible_to?(@current_user, @current_community)\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>unless\"\n if @listing.visibility.eql?(\"everybody\")\n # This situation occurs when the user tries to access a listing\n # via a different community url.\n flash[:error] = \"this_content_is_not_available_in_this_community\"\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>if\"\n redirect_to community_home_path and return\n elsif @current_user\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>elsif\"\n flash[:error] = \"you_are_not_authorized_to_view_this_content\"\n redirect_to community_home_path and return\n else\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>else\"\n session[:return_to] = request.fullpath\n flash[:warning] = \"you_must_log_in_to_view_this_content\"\n redirect_to login_path and return\n end\n end\n end",
"def has_preview?\n\t\tnot parents.map(&:visitable).include?(false)\n\tend",
"def index\n @custom_gallery_layouts = CustomGalleryLayout.all\n end",
"def visible?\n end",
"def in_archive?\n self.display\n end",
"def private_index\n if current_user.profile.user_type == \"customer\"\n @collection = current_user.profile.collections.first\n @cab_configs = CabConfig.where(collection_id: @collection.id)\n render 'collection_index'\n else \n @cab_configs = CabConfig.all\n render 'index'\n end\n\n end",
"def is_collection_object\n return self.resource_type == Resource::COLLECTION_OBJECT;\n end",
"def class_galleries\n if controller.controller_name == 'galleries'\n \"current\"\n end\n end",
"def collection_featurable?\n user_can_feature_collection? && solr_document.public?\n end",
"def admin_layout?\n self.class.name.starts_with?(\"Admin::\")\n end",
"def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end",
"def load_collection\n current_site.links\n end",
"def show?\n user.super_admin? or user.digital_store_admin?\n end",
"def activate\n Page.send :include, ImageGallery\n end",
"def is_main_image?\n self.primary_image == true\n end",
"def show\n admin_only\n end",
"def show\n admin_only\n end"
] |
[
"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.58960515",
"0.5869996",
"0.58577895",
"0.58547616",
"0.5835814",
"0.5835814",
"0.5812014",
"0.58082885",
"0.5758696",
"0.5729979",
"0.5724026",
"0.57193327",
"0.57167417",
"0.57115144",
"0.5704121",
"0.56970733",
"0.5696509",
"0.5683033",
"0.56829447",
"0.568185",
"0.56804353",
"0.56632483",
"0.5642101",
"0.56386",
"0.5637913",
"0.56370705",
"0.56328815",
"0.56302124",
"0.5574524",
"0.5569226",
"0.55633414",
"0.5562557",
"0.5562116",
"0.5549925",
"0.55489975",
"0.5545718",
"0.5535972",
"0.55339205",
"0.55337936",
"0.55315423",
"0.55300516",
"0.5529673",
"0.55244774",
"0.5522218",
"0.5513405",
"0.55119395",
"0.5503991",
"0.5499059",
"0.54943454",
"0.54903466",
"0.5485346",
"0.5483642",
"0.5479249",
"0.5467422",
"0.5467176",
"0.5466599",
"0.5466008",
"0.5465956",
"0.546247",
"0.545503",
"0.5450727",
"0.5445418",
"0.54435056",
"0.54403275",
"0.5437617",
"0.5437077",
"0.5429909",
"0.5421094",
"0.542087",
"0.54200315",
"0.5419532",
"0.54148024",
"0.540876",
"0.54016006",
"0.5395304",
"0.53946245",
"0.53903013",
"0.5387201",
"0.5382776",
"0.5382776"
] |
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_options(options)\n serializer = options[:serializer]\n return unless serializer\n\n # If the given serializer is a class return it.\n return serializer if serializer.is_a? Class\n\n \"#{serializer.to_s.classify}Serializer\".safe_constantize\n end",
"def serializer\n return @serializer if defined?(@serializer)\n\n _serializer = injected_options.fetch(:serializer, serializer_class)\n\n @serializer = instantiated_serializer_for(_serializer)\n end",
"def model_class\n name.sub(/Serializer$/, '').constantize\n end",
"def class_serializer(klass)\n path = klass.name.underscore\n serializer = path_to_class(path + '_serializer', Totem::Core::BaseSerializer)\n serializer.root = path\n serializer.send(:include, Totem::Core::Serializers::ActiveModelSerializer)\n serializer\nend",
"def get_serializer_for(klass, namespace = nil)\n return nil unless config.serializer_lookup_enabled\n\n return NilSerializer if klass == NilClass\n\n cache_key = ActiveSupport::Cache.expand_cache_key(klass, namespace)\n serializers_cache.fetch_or_store(cache_key) do\n # NOTE(beauby): When we drop 1.9.3 support we can lazify the map for perfs.\n lookup_chain = serializer_lookup_chain_for(klass, namespace)\n serializer_class = serializer_class_from_chain(lookup_chain)\n\n if serializer_class\n serializer_class\n elsif klass.superclass\n get_serializer_for(klass.superclass, namespace)\n end\n end\n end",
"def collection_serializer_class\n return @collection_serializer_class if defined?(@collection_serializer_class)\n\n if serializer_class.is_a?(Proc) # TODO: maybe we should do duck typing instead?\n @collection_serializer_class = injected_options[:collection_serializer]\n if @collection_serializer_class.nil?\n raise 'In case of a proc serializer, you need to specify a collection_serializer'\n end\n else\n @collection_serializer_class = serializer_class\n end\n\n @collection_serializer_class\n end",
"def create_default_serializer_class(model, serializer_class_name)\n platform_name = totem_settings.engine.current_platform_name(model)\n error(\"Platform name for model #{model.inspect} is blank.\") if platform_name.blank?\n extend_class = totem_settings.class[platform_name.to_sym].get_class(:base_serializer)\n error(\"Unknown base serializer class for platform name #{platform_name.inspect}.\") if extend_class.blank?\n klass = Class.new(extend_class)\n namespace_name = serializer_class_name.deconstantize\n namespace = namespace_name.safe_constantize\n serializer = namespace.const_set(serializer_class_name.demodulize, klass)\n error(\"Serializer class #{serializer_class_name.inspect} could not be constantized.\") if serializer.blank?\n debug \"Created serializer #{serializer.name.inspect}\" unless is_rake_task?\n end",
"def find_serializer(klass, tag: nil)\n tag ||= DEFAULT_TAG\n hash = klass.instance_variable_get(SERIALIZER_CLASSES)\n serializer = hash&.fetch(tag.to_sym, nil)\n Surrealist::ExceptionRaiser.raise_unknown_tag!(tag) if serializer.nil? && tag != DEFAULT_TAG\n serializer\n end",
"def serializer(params = {})\n self.class.serializer_class.new(self, params:)\n end",
"def serializer(table)\n (table + \"Serializer\").classify.constantize\n end",
"def serializer_for(resource)\n if resource.respond_to?(:to_ary)\n resource.first.class.name\n else\n resource.class.name\n end\n end",
"def get_controller_native_serializer_config\n return nil unless @controller\n\n if @many == true\n controller_serializer = @controller.try(:native_serializer_plural_config)\n elsif @many == false\n controller_serializer = @controller.try(:native_serializer_singular_config)\n end\n\n return controller_serializer || @controller.try(:native_serializer_config)\n end",
"def serializer(name)\n @_serializer = name <= Malba::Serializer ? name : nil\n end",
"def active_model_serializer\n self.class.active_model_serializer\n end",
"def active_model_serializer\n self.class.active_model_serializer\n end",
"def get_serializer_config\n # Return a locally defined serializer config if one is defined.\n if local_config = self.get_local_native_serializer_config\n return local_config\n end\n\n # Return a serializer config if one is defined on the controller.\n if serializer_config = get_controller_native_serializer_config\n return serializer_config\n end\n\n # If the config wasn't determined, build a serializer config from model fields.\n fields = @controller.send(:get_fields) if @controller\n if fields\n if @model\n columns, methods = fields.partition { |f| f.in?(@model.column_names) }\n else\n columns = fields\n methods = []\n end\n\n return {only: columns, methods: methods}\n end\n\n # By default, pass an empty configuration, allowing the serialization of all columns.\n return {}\n end",
"def serializers\n @serializers ||= Readthis::Serializers.new\n end",
"def _serializer(name)\n type = types[name]\n # flatten and cache all the serializers up the tree\n @_serializers ||= all_ancestors(serializers(nil)).reverse.reduce(&:merge)\n @_serializers[name] || @_serializers[type] || ( serializers(base)[type] ||= Serializer.default(type) if type )\n end",
"def serializer_class\n AccountSerializer\n end",
"def _serializer(name)\n self.class.send(:_serializer, name)\n end",
"def active_model_serializer\n self.tire_active_model_serializer || self.class.active_model_serializer\n end",
"def serializer_class\n BudgetSerializer\n end",
"def set_serializer(self_class, serializer_class)\n self_class.instance_variable_set(SERIALIZER_CLASS, serializer_class)\n end",
"def jsonapi_serializer_class_name\n 'MyApp::LongCommentSerializer'\n end",
"def serializer(klass)\n @objects_serializer = klass\n end",
"def serializer_class\n AuthenticationTokenSerializer\n end",
"def resource_class\n case @options[:class]\n when false\n name.to_sym\n when nil\n namespaced_name.to_s.camelize.constantize\n when String\n @options[:class].constantize\n else\n @options[:class]\n end\n end",
"def use_serializer(serializer)\n @serializer = serializer\n end",
"def adapter_class\n @@adapters[configuration[:adapter]]\n end",
"def serializer_class\n UserSerializer\n end",
"def generate_job_serializer(base)\n unless model_class?(base)\n return Log.debug { \"#{__method__}: ignoring #{base.class} argument\" }\n end\n base_name = base.name\n serializer = \"#{base_name}::Serializer\"\n return if safe_const_get(serializer)\n\n base.module_eval <<~HERE_DOC\n\n class #{serializer} < ActiveJob::Serializers::ObjectSerializer\n\n def serialize(item)\n super(item.fields)\n end\n\n def deserialize(hash)\n fields = hash.map { |k, v| [k.to_sym, deserialize(v)] }.to_h\n klass.new(**fields)\n end\n\n private\n\n def klass\n #{base_name}\n end\n\n end\n \n Rails.application.config.active_job.custom_serializers ||= []\n Rails.application.config.active_job.custom_serializers << #{serializer}\n\n HERE_DOC\n\n # NOTE: Under normal circumstances custom_serializers will already exist.\n # This extra check is just for the sake of executing a single file via\n # \"rails runner\" from the desktop.\n\n end",
"def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end",
"def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end",
"def resource_klass\n @resource_klass ||= JsonApi::Resources::Discovery\n .resource_for_name object,\n resource_class: @resource_class\n end",
"def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end",
"def resource_klass\n resource_klass_name.constantize\n end",
"def serializer\n PaperTrail.config.serializer\n end",
"def model_class\n resource_class = @options[:resource]\n if resource_class.nil?\n @name.to_s.camelize.constantize\n elsif resource_class.kind_of? String\n resource_class.constantize\n else\n resource_class # could be a symbol\n end\n end",
"def resource_klass\n @resource_klass ||= resource_name.classify.constantize\n end",
"def resource_class\n @options[:resource_class]\n end",
"def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end",
"def klass\n @klass ||= @options[:klass] || __get_class_value(:klass)\n end",
"def resource_class\n resource_finder.is_a?(Class) ? resource_finder : resource_finder.name.classify.constantize\n end",
"def klass\n @klass ||= class_name.constantize\n end",
"def klass\n @klass ||= class_name.constantize\n end",
"def paginator_klass\n \"#{JSONAPI.configuration.default_paginator}_paginator\".classify.constantize\n end",
"def resource_class\n @resource_class ||= self.class.to_s.split(\":\").last\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def serializer=(value)\n PaperTrail.config.serializer = value\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def resource_class\n @resource_class ||= resource_name.classify.constantize\n end",
"def serialization_config ruby_class_name, scope = nil\n mapping = @ruby_mappings[ruby_class_name]\n if mapping.nil?\n nil\n else\n scope ||= mapping.default_scope\n mapping.scopes[scope.to_sym]\n end\n end",
"def orderer_class\n @orderer_class || \"Spinach::Orderers::Default\"\n end",
"def get_formatter_class\n Formatter::V0::Customer\n end",
"def serializer_class\n CategorySerializer\n end",
"def class_of_resource\n @class_of_resource ||= resource_name.classify.constantize\n end",
"def serializers\n self._additional_serializers # standard:disable Style/RedundantSelf\n end",
"def resource_class\n resource_specification.klass\n end",
"def test_uses_given_parent\n Object.const_set(:ApplicationSerializer, Class.new)\n run_generator [\"Account\", \"--parent=MySerializer\"]\n assert_file \"app/serializers/account_serializer.rb\", /class AccountSerializer < MySerializer/\n ensure\n Object.send :remove_const, :ApplicationSerializer\n end",
"def resource_class\n @resource_class ||= resource_class_name.constantize\n end",
"def klass\n reflection.klass\n end",
"def klass\n reflection.klass\n end",
"def resource_class\n\n ActiveSupport::Dependencies.constantize(resource_class_name)\n\n end",
"def klass\n @klass ||=\n if klass_name\n klass_name.constantize\n else\n nil\n end\n end",
"def serializer_for(renderable, options = {})\n serializer_by_options(options) || serializer_by_renderable(renderable)\n end",
"def resource_class\n @resource_class ||= begin\n resource_parts = params[:namespaces] ? params[:namespaces].split('/') : []\n resource_parts << params[:resource_name]\n resource_parts.map(&:classify).join('::').constantize\n end\n end",
"def resource_class\n # TODO does this need to have draft?\n @resource_class ||= resource_name.classify.constantize\n end",
"def writer_class\n writer_class_name.constantize\n end",
"def resource_class\n\t\t\t\t@resource_class ||= resource_name.classify.constantize\n\t\t\tend",
"def syncer_klass\n case syncer_name.to_s.downcase\n when 's3' then S3Syncer\n when 'ftp' then FTPSyncer\n when 'prepare' then PrepareSyncer\n end\n end",
"def klass\n @options[:class].presence\n end",
"def klass\n type.to_s.classify.constantize\n end",
"def klass\n info.klass\n end",
"def resource_class\n @resource_class ||= self.controller_name.singularize.classify.constantize\n end",
"def add_serializer(self_class, serializer_class, tag: nil)\n tag ||= DEFAULT_TAG\n hash = self_class.instance_variable_get(SERIALIZER_CLASSES) || {}\n hash[tag.to_sym] = serializer_class\n self_class.instance_variable_set(SERIALIZER_CLASSES, hash)\n end",
"def klass\n self.class\n end",
"def klass\n @klass ||= compute_class(class_name)\n end",
"def klass\n @klass ||= compute_class(class_name)\n end",
"def klass\n @klass ||= compute_class(class_name)\n end",
"def adapter_class\n ADAPTERS[Utilities.adapter]\n end",
"def klass\n @klass ||= klasses.select{|k| k.to_s.demodulize == klass_name}.compact.first\n raise EndpointNotDefinedError, \"To call /endpoints/#{params[:klass_name]} you must define 'class #{params[:klass_name].classify} < FfcrmEndpoint::Endpoint'\" if !@klass.present?\n @klass\n end",
"def tenant_class\n @tenant_class ||= if self.model.respond_to?(:call)\n self.model.call\n elsif self.model.respond_to?(:constantize)\n self.model.constantize\n else\n self.model\n end\n end",
"def avro_serializer\n @avro_serializer ||= Hash.new(PassthroughSerializer)\n end",
"def resource_klass_name\n resource_name.classify\n end",
"def get_local_native_serializer_config\n action = self.get_action\n\n if action && self.action_config\n # Index action should use :list serializer config if :index is not provided.\n action = :list if action == :index && !self.action_config.key?(:index)\n\n return self.action_config[action] if self.action_config[action]\n end\n\n # No action_config, so try singular/plural config if explicitly instructed to via @many.\n return self.plural_config if @many == true && self.plural_config\n return self.singular_config if @many == false && self.singular_config\n\n # Lastly, try returning the default config, or singular/plural config in that order.\n return self.config || self.singular_config || self.plural_config\n end",
"def serialize(serializer = nil, options = {})\n serializer ||= self.class::DEFAULT_SERIALIZER\n serializer.new(self, options: options).attributes\n end",
"def resource_class_name\n @resource_class_name ||= resource_name.classify.constantize\n end",
"def model_from_options #nodoc\n @options[:class_name].nil? ? nil : @options[:class_name].constantize\n end",
"def resource_class\n class_name\n end",
"def get_resource_class\n \tresource_name.classify.constantize\n end",
"def client_class\n ActiveSupport::Inflector.constantize(@client_class_name)\n end",
"def klass\n @klass ||= BSON.const_get(description)\n end",
"def resource_class\n \t@resource_class ||= get_resource_class\n end"
] |
[
"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.63228774",
"0.6309654",
"0.6294184",
"0.62922895",
"0.6283378",
"0.6153786",
"0.6152479",
"0.6131748",
"0.6113975",
"0.600568",
"0.59591943",
"0.59532005",
"0.59071165",
"0.5900972",
"0.5869047",
"0.5869047",
"0.5860343",
"0.5837245",
"0.5827234",
"0.58005947",
"0.5792798",
"0.57503396",
"0.5742803",
"0.57407504",
"0.5739782",
"0.57262814",
"0.5721805",
"0.5721805",
"0.5673424",
"0.5658978",
"0.5648799",
"0.5648799",
"0.5648799",
"0.5642404",
"0.5636509",
"0.5636509",
"0.5636509",
"0.5635949",
"0.5635722",
"0.5619972",
"0.5615981",
"0.5611224",
"0.56073",
"0.5606555",
"0.55605555",
"0.5555602",
"0.5548486",
"0.554335",
"0.554335",
"0.55411214",
"0.5515463",
"0.5500083",
"0.54937136",
"0.5483885",
"0.54432005",
"0.54373205",
"0.5425972",
"0.5422195",
"0.5417404",
"0.53906065",
"0.5390401",
"0.53538316",
"0.53538096",
"0.53476965",
"0.53476965",
"0.53476965",
"0.5345153",
"0.53341734",
"0.5315664",
"0.53050846",
"0.5293459",
"0.5285895",
"0.5272521",
"0.5255007",
"0.52530736",
"0.5243707",
"0.5234702",
"0.5232988",
"0.5232094",
"0.5224107"
] |
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.nil?\n @backends = {}\n backend_instances.each do | name, backend|\n @backends[name] = backend.servers\n end\n end\n @backends\n end",
"def filters\n @filters ||= FiltersProvider.new\n end",
"def filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters\n end",
"def filter\n @filter ||= if Platform.linux?\n linux_filter\n elsif Platform.os_x?\n os_x_filter\n else\n raise \"Only works on Linux or OS X\"\n end\n end",
"def default_backend\n attributes_class.defaults[:backend]\n end",
"def backends=(_arg0); end",
"def active_sync_filters\n company.settings.sync_filters[provider]\n end",
"def filters_class\n \"::Queries::CustomFilters::#{self.to_s}\".safe_constantize || \"::Queries::Filters\".safe_constantize\n end",
"def backends(service)\n out = Array.new\n # iterate the servers removing aggregates for FRONT/BACKEND\n @stats[service].each do |k, v|\n if not (k == 'FRONTEND' or k == 'BACKEND')\n out = out << k\n end\n end\n out\n end",
"def available_models\n\t\t\t\t\tif !self.nature.blank?\n\t\t\t\t\t\tmodel_classname = config(:natures, self.nature.to_sym, :model)\n\t\t\t\t\tend\n\t\t\t\t\tif !model_classname.blank?\n\t\t\t\t\t\tmodel_class = model_classname.constantize\n\t\t\t\t\t\treturn model_class.where(config(:natures, self.nature.to_sym, :filters)).order(id: :asc)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn []\n\t\t\t\t\tend\n\t\t\t\tend",
"def default_metric_filters()\n return @metric_filters\n end",
"def backend_name\n config['backend']\n end",
"def for backend\n registry[backend]\n end",
"def config_filters\n []\n end",
"def default_backend\n case environment\n when 'production', 'staging'\n StatsD::Instrument::Backends::UDPBackend.new(ENV['STATSD_ADDR'], ENV['STATSD_IMPLEMENTATION'])\n when 'test'\n StatsD::Instrument::Backends::NullBackend.new\n else\n StatsD::Instrument::Backends::LoggerBackend.new(StatsD.logger)\n end\n end",
"def find_gui_and_backend(gui=nil, gui_select=nil)\n gui = gui.to_sym if gui.kind_of? String\n\n if gui && gui != :auto\n # select backend based on requested gui\n backend = GUI_BACKEND_MAP[gui]\n gui = nil if gui == :agg\n return [gui, backend]\n end\n\n backend = Matplotlib.rcParamsOrig['backend']&.to_sym\n gui = BACKEND_GUI_MAP[backend]\n\n # If we have already had a gui active, we need it and inline are the ones allowed.\n if gui_select && gui != gui_select\n gui = gui_select\n backend = backend[gui]\n end\n\n [gui, backend]\n end",
"def autofilter_services\n @autofilter_services || []\n end",
"def io_selector_backend(backend); end",
"def types_filter\n types_filter = self[:types_filter] || []\n return types_filter if types_filter.any?\n options.fetch 'types_filter', []\n end",
"def backend\n @backend ||= self.class.backend\n end",
"def backend\n # Hard-coded backend\n if @options[:backend]\n return OctocatalogDiff::CatalogUtil::ENC::Noop.new(@options) if @options[:backend] == :noop\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:backend] == :pe\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:backend] == :script\n raise ArgumentError, \"Unknown backend :#{@options[:backend]}\"\n end\n\n # Determine backend based on arguments\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:pe_enc_url]\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:enc]\n\n # At this point we do not know what backend to use for the ENC\n raise ArgumentError, 'Unable to determine ENC backend to use'\n end",
"def backend\n # Hard-coded backend\n if @options[:backend]\n return OctocatalogDiff::CatalogUtil::ENC::Noop.new(@options) if @options[:backend] == :noop\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:backend] == :pe\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:backend] == :script\n raise ArgumentError, \"Unknown backend :#{@options[:backend]}\"\n end\n\n # Determine backend based on arguments\n return OctocatalogDiff::CatalogUtil::ENC::PE.new(@options) if @options[:pe_enc_url]\n return OctocatalogDiff::CatalogUtil::ENC::Script.new(@options) if @options[:enc]\n\n # At this point we do not know what backend to use for the ENC\n raise ArgumentError, 'Unable to determine ENC backend to use'\n end",
"def backend_klass; end",
"def stringify_backends(backends)\n backend_strings = []\n backends.each do |name, spec|\n backend_strings << \"#{name}=#{spec}\"\n end\n backend_strings\nend",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def typus_defaults_for(filter)\n if self.respond_to?(\"admin_#{filter}\")\n self.send(\"admin_#{filter}\")\n else\n Typus::Configuration.config[self.name][filter.to_s].split(', ') rescue []\n end\n end",
"def filters\n @filters ||= {}\n end",
"def backend\n @backend ||= Configurator.new(self, :backend)\n end",
"def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)\n fs\n end",
"def allowed_filters\n []\n end",
"def index\n @backends = Backend.all\n end",
"def filters\n if metaclass.method_defined? :_filters\n self._filters\n else\n []\n end\n end",
"def backend(backend, options = {})\n @backends ||= []\n if backend.is_a?(Symbol)\n require \"global/backend/#{backend}\"\n backend_class = Global::Backend.const_get(camel_case(backend.to_s))\n @backends.push backend_class.new(options)\n elsif backend.respond_to?(:load)\n @backends.push backend\n else\n raise 'Backend must be either a Global::Backend class or a symbol'\n end\n end",
"def platform_filters_available?\n !options.platform.nil?\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def get_filters(object)\n if @options[:using].is_a?(Array)\n gen_array_attribute_filters(object, @options[:using])\n else\n gen_map_attribute_filters(object, @options[:using])\n end\n end",
"def typus_options_for(filter)\n options = read_model_config['options']\n\n unless options.nil? || options[filter.to_s].nil?\n options[filter.to_s]\n else\n Typus::Resources.send(filter)\n end\n end",
"def filters(type=nil)\n unless(type)\n @filters.dup\n else\n const = Splib.find_const(type)\n type = const unless const.nil?\n @filters[type] ? @filters[type].dup : nil\n end\n end",
"def backend_name\n self.class.name.split(\"::\")[-1].split(\"Store\")[0].downcase\n end",
"def list_filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters.keys\n end",
"def get_extensions\n collection = Occi::Collection.new\n BACKEND_TYPES.each { |backend_type| collection.merge! backend_instances[backend_type].get_extensions }\n collection\n end",
"def filters\n self.class.filters\n end",
"def backend=(backend)\n @backend = backend&.to_sym\n set_encoder\n end",
"def typus_defaults_for(filter)\n data = Typus::Configuration.config[name][filter.to_s]\n return (!data.nil?) ? data.extract_settings : []\n end",
"def or_filters_provided?\n true\n end",
"def unsupported_adapters\n []\n end",
"def currency_filters\n\t\t\t[\n\t\t\t\t[I18n.t('filters.currency.any'), 'any'],\n\t\t\t\t[I18n.t('filters.currency.eur'), 'EUR'],\n\t\t\t\t[I18n.t('filters.currency.gbp'), 'GBP'],\n\t\t\t\t[I18n.t('filters.currency.sek'), 'SEK']\n\t\t\t]\n\t\tend",
"def environment_filter\n if self.environment == 'default'\n nil\n else\n self.environment\n end\n end",
"def environment_filter\n if self.environment == 'default'\n nil\n else\n self.environment\n end\n end",
"def inject_backends\n BACKEND_TYPES.each do |backend_type|\n (BACKEND_TYPES - [backend_type]).each do |injected_backend|\n backend_instances[backend_type].add_other_backend(\n injected_backend,\n backend_instances[injected_backend]\n )\n end\n end\n end",
"def filter\n @filter ||= filter_class.new default_filter\n end",
"def typus_defaults_for(filter)\n read_model_config[filter.to_s].try(:extract_settings) || []\n end",
"def filters_for_user(user)\n user.present? ? filters_with_external : public_filters\n end",
"def engine_extensions\n exts = extensions\n\n if offset = extensions.index(format_extension)\n exts = extensions[offset+1..-1]\n end\n\n exts.select { |ext| @environment.engines(ext) }\n end",
"def or_filters\n read_attribute('or_filters') || {}\n end",
"def available?\n @backends.present?\n end",
"def engines\r\n @engines ||= plugins.select(&:engine?)\r\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def backend=(backend)\n RSpec.configuration.formatters\n .find_all { |c| c.is_a?(Inspec::Formatters::Base) }\n .each do |fmt|\n fmt.backend = backend\n end\n end",
"def type\n self.class.name.demodulize.underscore.gsub(/_filter$/, '').to_sym\n end",
"def backend(value = nil)\n if value.is_a?(Symbol)\n require \"down/#{value}\"\n @backend = Down.const_get(value.to_s.split(\"_\").map(&:capitalize).join)\n elsif value\n @backend = value\n else\n @backend\n end\n end",
"def typus_options_for(filter)\n\n data = Typus::Configuration.config[name]\n unless data['options'].nil?\n value = data['options'][filter.to_s] unless data['options'][filter.to_s].nil?\n end\n\n return (!value.nil?) ? value : Typus::Resource.send(filter)\n\n end",
"def filter_extension\n case record.filter_id\n when nil, '', 'WymEditor'\n return \".html\"\n when 'Textile'\n return \".textile\"\n when 'Markdown'\n return \".markdown\"\n end\n end",
"def servers(backend = nil)\n my_servers = []\n if backend.nil?\n # return all servers\n backend_instances.each_value do | backend|\n my_servers << backend.server_names\n end\n else\n begin\n my_servers = backend_instances[backend].server_names\n rescue KeyError => e\n \"The backend #{backend} is not a valid argument\"\n end\n end\n # return a list of serv\n my_servers.flatten.uniq\n end",
"def backend\n set_default_backend unless defined?(@backend)\n raise OEmbed::FormatNotSupported, :xml unless defined?(@backend)\n @backend\n end",
"def user_filter_options(model) #:nodoc:\r\n table_name = @tables.first[1]\r\n if session[table_name]\r\n DcFilter.get_filter(session[table_name][:filter]) || model\r\n else\r\n model\r\n end\r\nend",
"def user_filter_options(model) #:nodoc:\r\n table_name = @tables.first[1]\r\n if session[table_name]\r\n DcFilter.get_filter(session[table_name][:filter]) || model\r\n else\r\n model\r\n end\r\nend",
"def default_filters\n params[:filter].keys.map(&:to_sym) - @request.resource_klass._custom_filters\n end",
"def sync_filters\n super.presence || default_sync_filters\n end",
"def active_backend\n SSHKit::Custom::Config::Store.active_backend\n end",
"def filters\n filters_class&.new(self.scoped)\n end",
"def usage_filters\n get('/1/reporting/filters').to_a\n end",
"def suitable_providers\n return @suitable_providers if @suitable_providers\n @suitable_providers = []\n [\n @resource.class.defaultprovider,\n @resource.class.suitableprovider,\n ].flatten.uniq.each do |provider_class|\n if service_provider_enabled? provider_class\n @suitable_providers << provider_class.name\n end\n end\n @suitable_providers\n end",
"def filter(filter = nil)\n case filter\n when nil\n to_a\n when /^eni-/, /^eth[0-9]+$/, /^[0-9a-f:]+$/i, /^[0-9\\.]+$/\n [*self[filter]]\n when /^subnet-/\n select { |dev| dev.subnet_id == filter }\n end.tap do |devs|\n raise Errors::UnknownInterface, \"No interface found matching #{filter}\" if devs.nil? || devs.empty?\n end\n end",
"def providers\n authentication_strategies.pluck :provider\n end",
"def supportedTextFilters()\n TextFilter.find(:all).collect do |filter|\n MovableTypeStructs::TextFilter.new(:key => filter.name, :label => filter.description)\n end\n end",
"def get_selected_providers\n params.keys.select do |k|\n k.include? \"provider\"\n end.map do |checkbox|\n checkbox.split(\":\").last\n end\n end",
"def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"def resource_type_filter\n return filter_for(:resource_type_id,\n objects_to_names_and_ids(current_user.company.resource_types),\n session[:resource_filters], ResourceType.model_name.human)\n end",
"def initialize_available_filters\n @@available_filters ||= {}\n end",
"def filters_for(model)\n filters = session['search'][model.to_s] if session['search'] && session['search'][model.to_s].presence\n filters.delete_if { |k, v| v.nil? } if filters\n end",
"def compatible_encoders\n encoders2 = ['/generic\\/none/', 'none']\n encoders2\n end",
"def select_filters(target, options)\n found = filters_store.fetch(options, [])\n if\n Hash === options || options.nil?\n then\n options ||={}\n options.merge!(:target => target)\n found +=\n # can not @filters.fetch(options, []) to allow filters provide custom ==()\n filters_store.select do |filter_options, filters|\n options == filter_options\n end.map(&:last).flatten\n end\n found\n end",
"def autofilter_ports\n @autofilter_ports || []\n end",
"def typus_filters\n\n fields_with_type = ActiveSupport::OrderedHash.new\n\n if self.respond_to?('admin_filters')\n fields = self.admin_filters\n else\n return [] unless Typus::Configuration.config[self.name]['filters']\n fields = Typus::Configuration.config[self.name]['filters'].split(', ').collect { |i| i.to_sym }\n end\n\n fields.each do |field|\n attribute_type = self.model_fields[field.to_sym]\n if self.reflect_on_association(field.to_sym)\n attribute_type = self.reflect_on_association(field.to_sym).macro\n end\n fields_with_type[field.to_s] = attribute_type\n end\n\n return fields_with_type\n\n end",
"def filter_pipeline\n @filter_pipeline ||= HTML::Pipeline.new([TypogrubyFilter])\n end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def filters; end",
"def filters; end",
"def acceptable_filter_scopes\n []\n end",
"def engines; engine_names; end",
"def default_backend(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"default_backend \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def adaptors\n @adaptors ||= []\n end",
"def filters\n end"
] |
[
"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.54268783",
"0.54258925",
"0.5407245",
"0.5403534",
"0.5403534",
"0.53518987",
"0.5321197",
"0.5318182",
"0.5318182",
"0.53178424",
"0.5314227",
"0.53109604",
"0.5309841",
"0.528288",
"0.52510834",
"0.52428466",
"0.5232649",
"0.52257985",
"0.5221926",
"0.5175441",
"0.5175441",
"0.5156108",
"0.5151742",
"0.5149759",
"0.5132673",
"0.5116758",
"0.5104979",
"0.5096846",
"0.50953925",
"0.50878245",
"0.50814044",
"0.50728625",
"0.50673777",
"0.50579506",
"0.50579506",
"0.50485605",
"0.50477964",
"0.5029055",
"0.5019771",
"0.5008242",
"0.5002493",
"0.5002057",
"0.4996701",
"0.4985112",
"0.49850997",
"0.49831757",
"0.49822643",
"0.49742284",
"0.49728835",
"0.49589366",
"0.49575746",
"0.49530262",
"0.49530262",
"0.49519604",
"0.49490398",
"0.4942813",
"0.49394873",
"0.49284825",
"0.49009773",
"0.4886069",
"0.48586345",
"0.48059186",
"0.48025465",
"0.47963226",
"0.47947407",
"0.47866958",
"0.47595987",
"0.47535765",
"0.47457272",
"0.4738778",
"0.47376212",
"0.47044656",
"0.4701382",
"0.47001487",
"0.47001487",
"0.46927842",
"0.46869618",
"0.468241",
"0.4681572",
"0.46764553"
] |
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 RESTFramework::ModelFilter, RESTFramework::ModelOrderingFilter\n ]\n end",
"def filter(values); end",
"def filter(values); end",
"def filter(values); end",
"def filters; end",
"def filters; end",
"def filters\n end",
"def get_filters(object)\n if @options[:using].is_a?(Array)\n gen_array_attribute_filters(object, @options[:using])\n else\n gen_map_attribute_filters(object, @options[:using])\n end\n end",
"def filter(&callable)\n filters << callable\n end",
"def filters=(*filters)\n @filters = filters.flatten\n end",
"def filter(filters = {})\n all.select do |rule|\n [:country, :type].each do |condition|\n break false if filters[condition] && filters[condition] != rule[condition]\n true\n end\n end\n end",
"def all_filters(**args)\n params = parameters(args) do\n optional_params :type\n end\n request(:get, 'filters', params)\n end",
"def filters\n mentos(:get_all_filters)\n end",
"def filters=( args )\n @filters.clear\n add_filters(*args)\n end",
"def _call_filters(filter_set)\n (filter_set || []).each do |filter, rule|\n # Both:\n # * no :only or the current action is in the :only list\n # * no :exclude or the current action is not in the :exclude list\n if (!rule.key?(:only) || rule[:only].include?(action_name)) &&\n (!rule.key?(:exclude) || !rule[:exclude].include?(action_name))\n case filter\n when Symbol, String then send(filter)\n when Proc then self.instance_eval(&filter)\n end\n end\n end\n return :filter_chain_completed\n end",
"def add_filters(filters); end",
"def all\n @filters\n end",
"def filter(*args); Typelib.filter_function_args(args, self) end",
"def filtered_dataset\n filter_args_from_query.inject(@dataset) do |filter, cond|\n filter.filter(cond)\n end\n end",
"def filter(options={})\n raise NotImplementedError\n end",
"def filter(*values)\n values.inject(self) { |res, val| res._filter(val) or fail ArgumentError, \"Unknown value for filter: #{val}\" }\n end",
"def data_filter(data, filters)\n if not data.is_a?(Array) or not filters.is_a?(String)\n return data\n end\n data = data.clone\n for filter in array_filter(filters.split(\",\"))\n key, value = array_filter(filter.split(\":\"))\n # find unspecified fields\n if value == nil\n data.select!{|d| d[key] == nil}\n # find fields that match regex\n elsif value.is_a?(String)\n data.select!{|d| d[key].to_s =~ /#{value}/m}\n end\n end\n return data\n end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def filtered(collection, filter)\n collection.grep_v(FILTERS.fetch(filter, FILTERS[:default]))\n end",
"def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end",
"def filter (data)\n # leave the data untouched if we don't support the required filter\n return data if @filter.nil?\n\n # decode the data\n self.send(@filter, data)\n end",
"def filters\n if metaclass.method_defined? :_filters\n self._filters\n else\n []\n end\n end",
"def filter!( *headers, &block )\n return to_enum( :filter!, headers ) unless block_given?\n data.filter!( *headers, &block ); self\n end",
"def apply_filters(o)\n @filters.keys.find_all{|type| Splib.type_of?(o, type)}.each do |type|\n @filters[type].each_pair do |k,v|\n begin\n case k\n when :filters\n v.each{|f|o = f.filter(o)}\n when :procs\n v.each{|pr|o = pr.call(o)}\n end\n rescue ArgumentError\n # ignore this\n end\n end\n end\n o\n end",
"def filter(filtering_params)\n\t\t\tresults = self.where(nil)\n\t\t\tfiltering_params.each do |key, value|\n\t\t\t\tresults = results.public_send(key, value) if value.present?\n\t\t\tend\n\t\t\tresults\n\t\tend",
"def filter(filt = nil, *args, **opts)\n @filter = if filt.nil? && !defined?(@filter)\n Filters.default\n elsif filt\n Filters.resolve(filt, *args, **opts)\n else\n @filter\n end\n\n aggregator.filter = @filter\n\n @filter\n end",
"def filters\n @filters ||= FiltersProvider.new\n end",
"def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if !@taxon.nil? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end",
"def filter( filter_name, value )\n defined? @filters \\\n or return nil\n @filters.respond_to? \"has_key?\" \\\n or return nil\n @filters.has_key? filter_name \\\n or return nil\n f = @filters[filter_name]\n f.call value\n end",
"def filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters\n end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def filter_collection!\n return if filtering_params.blank?\n\n filtering_params.each do |key, value|\n filter_key = \"filter_#{key}\"\n next if value.blank? || !collection.respond_to?(filter_key)\n\n self.collection = collection.public_send(filter_key, value)\n end\n end",
"def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end",
"def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end",
"def set_filters(value)\n valid = []\n value.each do |filter|\n if (!filter['name'].blank? && !filter['to'].blank? && !filter['from'].blank?)\n valid << filter\n elsif (filter['name'] && filter['values'])\n # Hack to accept both an array of values or a JSON\n filter['values'] = if filter['values'].is_a? String\n JSON.parse(filter['values'])\n else\n filter['values']\n end\n valid << filter\n end\n end\n self.write_attribute :filters, valid.to_json\n end",
"def filter(*args, &block)\n if args.length == 1\n args = args.first\n else\n args.freeze\n end\n\n with_opts(:filter=>args, :filter_block=>block)\n end",
"def apply_instance_filters(ds)\n instance_filters.inject(ds){|ds1, i| ds1.where(*i[0], &i[1])}\n end",
"def api_filter(params, options = {})\n new_params = {}\n params.each{|param, value| new_params[param.to_s] = value} \n params = new_params\n\n api_validate params\n \n skip = Proc.new do |key|\n options[:only_filter] && !options[:only_filter].include?(key)\n end\n \n dataset = self\n dataset = dataset.api_include params unless skip.call(:include)\n dataset = dataset.api_sort params unless skip.call(:sort)\n dataset = dataset.api_limit params unless skip.call(:limit)\n dataset = dataset.api_offset params unless skip.call(:offset)\n\n # Prepare the records for serialization\n records = dataset.all\n\n if params['include'] && !skip.call(:include)\n records.each do |record|\n MF::API::IncludeNode.serialize_attrs(record, params['include'], options[:proc])\n end\n end\n \n records\n end",
"def filter(objects) objects end",
"def apply_filter(type, request, ds)\n if filter = filter_for\n ds = filter.call(ds, type, request)\n end\n ds\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def set_filter(agent, filters, vars)\n agent.reset\n if filters[:discovery]\n agent.discover({:nodes => filters[:discovery]})\n else\n ['identity', 'fact', 'class', 'compound'].each do |kind|\n next unless filters[kind]\n add_filter = agent.method(\"#{kind}_filter\".to_sym)\n if filters[kind].is_a?(String)\n add_filter.call(interpolate(filters[kind], vars))\n else\n filters[kind].each do |filter|\n add_filter.call(interpolate(filter, vars))\n end\n end\n end\n end\n agent\nend",
"def filter(name, value=true)\n name = name.to_sym\n raise NameError, \":#{name} isn't in the defined filters\" unless @model.defined_filters.include? name\n new_filters = @options[:filters] + [[name, value]]\n\n chain_scope filters: new_filters\n end",
"def filters\n @filters ||= {}\n end",
"def filters\n\t\t@filters_array = Array(@profile[:filters]) unless(@filters_array)\n\t\t@filters_array.each do |filter|\n\n\t\t\tif respond_to?( \"filter_#{filter}\" )\n\t\t\t\t@form.keys.each do |field|\n\t\t\t\t\t# If a key has multiple elements, apply filter to each element\n\t\t\t\t\t@field_array = Array( @form[field] )\n\n\t\t\t\t\tif @field_array.length > 1\n\t\t\t\t\t\t@field_array.each_index do |i|\n\t\t\t\t\t\t\telem = @field_array[i]\n\t\t\t\t\t\t\t@field_array[i] = self.send(\"filter_#{filter}\", elem)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif not @form[field].to_s.empty?\n\t\t\t\t\t\t\t@form[field] = self.send(\"filter_#{filter}\", @form[field].to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@form\n\tend",
"def apply_filtering(collection)\n @filters = Question.get_advanced_filter_collection(collection,true,'click')\n Question.filtering_scopes.each do |scope|\n collection = collection.filter_by(scope, filter_params[scope], \"email\") unless filter_params[scope].blank?\n end\n return collection\n end",
"def only *filter_list\n filter.only filter_list\n self\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def ensure_filters\n # private_methods returns the list of private methods accessible to obj. If the all parameter is set to\n # false, only those methods in the receiver will be listed.\n private_methods(false).grep(/\\Afilter_by_/)&.each { |filter| send(filter) }\n end",
"def filter(*args)\n raise NotImplementedError, 'Subclass should implement.'\n end",
"def usage_filters\n get('/1/reporting/filters').to_a\n end",
"def filters\n unless (@filters)\n @filters = {}\n return @filters unless @params[:f_inclusive]\n @params[:f_inclusive].each_pair do |field, value_hash|\n value_hash.each_pair do |value, type|\n @filters[field] ||= []\n @filters[field] << value\n end\n end \n end\n return @filters\n end",
"def apply_filter\n end",
"def filter_items=(values)\n values.each do |value|\n filter_items << Filter.new(value)\n end\n end",
"def filter\n @filter ||= if Platform.linux?\n linux_filter\n elsif Platform.os_x?\n os_x_filter\n else\n raise \"Only works on Linux or OS X\"\n end\n end",
"def filtered_dataset\n dataset\n end",
"def filter(pathset)\n raise ActionNotSupportedError.new(:filter, self)\n end",
"def filter!; end",
"def get_ifilters\n retval = Ifilter.order(:name) #retval = Ifilter.all\n get_internal_ifilters.each do |f|\n retval.prepend(f)\n end\n\n return retval\n end",
"def filter(*args,&block)\n if args && args.any? || block_given?\n @filter = Lolita::Configuration::Filter.new(dbi,*args,&block)\n add_observer(@filter)\n end\n @filter\n end",
"def filter\n end",
"def strict_filters=(_arg0); end",
"def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end",
"def from(*args, &block)\n ds = dataset.from(*args)\n block ? ds.filter(&block) : ds\n end",
"def from(*args, &block)\n ds = dataset.from(*args)\n block ? ds.filter(&block) : ds\n end",
"def add_filters(filters)\n filters.each do |field, value|\n Array(value).each { |v| add_filter(field, v) }\n end\n end",
"def filter(filters=nil, options={})\n Filter.new(filters, options, self).nodes()\n end",
"def process_filters(records,filter_params)\n return records unless filter_params\n filter_params.each do |field,filter_param|\n if filter_param.has_key?(\"value\")\n value = filter_param[\"value\"]\n next unless value.present?\n condition = filter_param[\"condition\"] || 'eq'\n case condition\n when \"eq\"\n value = true if value == 'true'\n value = [false, nil] if value == 'false'\n records = records.where(field.to_sym => value)\n when \"cont\"\n records = records.where(\"#{field} LIKE '%#{value}%'\")\n when \"ncont\"\n records = records.where(\"#{field} NOT LIKE '%#{value}%'\")\n when \"gt\"\n records = records.where(\"#{field} > ?\", value)\n when \"lt\"\n records = records.where(\"#{field} < ?\", value)\n end\n end\n end\n return records\n end",
"def filter_data\n @data.map do |currency|\n currency.select { |attribute,_|\n selected_attributes.include? attribute.to_s\n }\n end\n end",
"def clean_filters\n cleaned_filters = {}\n self.filters.each do |name, value|\n if (self.filter_options[name.to_sym][:fields].detect{|f| f[:value] == value } rescue false)\n cleaned_filters[name.to_sym] = value\n end\n end\n self.filters = cleaned_filters\n end",
"def all_apply?(filters)\n self.class.all_apply?(filters)\n end",
"def filters\n unless @filters\n @filters = {}\n return @filters unless @params[:f_inclusive] && @params[:f_inclusive].respond_to?(:each_pair)\n @params[:f_inclusive].each_pair do |field, value_array|\n @filters[field] ||= value_array.dup\n end\n end\n @filters\n end",
"def filter_proc(filters = {})\n lambda do |p|\n (filters[:name].nil? || p.name =~ filters[:name]) &&\n (filters[:appid_name].nil? || p.app_id_name =~ filters[:appid_name]) &&\n (filters[:appid].nil? || p.entitlements.app_id =~ filters[:appid]) &&\n (filters[:uuid].nil? || p.uuid =~ filters[:uuid]) &&\n (filters[:team].nil? || p.team_name =~ filters[:team] || p.team_ids.any? { |id| id =~ filters[:team] }) &&\n (filters[:exp].nil? || (p.expiration_date < DateTime.now) == filters[:exp]) &&\n (filters[:has_devices].nil? || !(p.provisioned_devices || []).empty? == filters[:has_devices]) &&\n (filters[:all_devices].nil? || p.provisions_all_devices == filters[:all_devices]) &&\n (filters[:aps_env].nil? || match_aps_env(p.entitlements.aps_environment, filters[:aps_env])) &&\n true\n end\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end",
"def strict_filters; end",
"def allowed_filters\n []\n end",
"def filter(str)\n FILTERS.each do |f|\n str = f.filter(str)\n end\n str\n end",
"def select_filters(target, options)\n found = filters_store.fetch(options, [])\n if\n Hash === options || options.nil?\n then\n options ||={}\n options.merge!(:target => target)\n found +=\n # can not @filters.fetch(options, []) to allow filters provide custom ==()\n filters_store.select do |filter_options, filters|\n options == filter_options\n end.map(&:last).flatten\n end\n found\n end",
"def apply_global_filters(query, filter_params)\n value = filter_params[:filter][999.to_s] rescue nil\n\n return query if value.blank?\n\n queries = []\n values = []\n\n # iterate over all filter inputs\n ajax_filters.each do |filter|\n next if filter.blank?\n next if filter.having.present?\n\n query, q, v = apply_filter(query, filter, value)\n\n next if q.blank?\n\n queries += Array(q)\n values += Array(v) unless v.nil?\n end\n\n query.where(queries.join(' OR '), *values)\n end",
"def remove_filters!\n @filters = []\n end",
"def list_filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters.keys\n end",
"def list(*_filters)\n raise NotImplementedError\n end",
"def filter(collection)\n collection\n end",
"def filter(collection)\n collection\n end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def reset_filters\n @_filters = []\n end",
"def filter_metadata(data, keys, values, filter_on=nil)\n\n filter_data = data\n\n # If filter_on is defined, iterate through the list and get the array\n # to filter\n if(filter_on)\n Array(filter_on).each do |f|\n filter_data = filter_data.try(:[],f)\n end\n end\n\n\n\n # Define a proc for filtering the array\n # +keys+:: The key(s) under which a value is stored in the array element\n # +v+:: Should contain the current element of the array we're testing\n # +values+:: The values which are valid and should cause the element to be included in the filtered array\n select_function = Proc.new { |keys,v, values|\n value = v\n Array(keys).each do |k|\n begin\n value = value.try(:[], k)\n rescue\n value = nil\n end\n end\n\n if(value.class == Array)\n (values & value).present?\n elsif(value.present?)\n Array(values).include?(value)\n else\n value.present?\n end\n\n }\n\n # Call the above proc\n if(filter_data.class==Hash)\n filter_data.select!{|hk,v|\n select_function.call(keys,v, values)\n }\n else\n filter_data.select!{|v|\n select_function.call(keys,v, values)\n\n }\n end\n\n\n\n\n\n return data\n end"
] |
[
"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.5912601",
"0.59011495",
"0.5900307",
"0.5870983",
"0.58683175",
"0.58683175",
"0.58587664",
"0.58513665",
"0.5850887",
"0.5831021",
"0.5817685",
"0.5804285",
"0.5801676",
"0.579401",
"0.57914835",
"0.57704127",
"0.5764293",
"0.5762751",
"0.57338345",
"0.5724868",
"0.57155424",
"0.57103854",
"0.56756985",
"0.56631774",
"0.56620705",
"0.5648462",
"0.5645119",
"0.56405663",
"0.56364346",
"0.56364346",
"0.5618561",
"0.5613725",
"0.561235",
"0.5605172",
"0.5602129",
"0.55965525",
"0.5580964",
"0.5580964",
"0.5580964",
"0.5570468",
"0.5566657",
"0.55610013",
"0.5560568",
"0.55592424",
"0.55490214",
"0.5547676",
"0.5547504",
"0.5541394",
"0.55220836",
"0.5520757",
"0.55170786",
"0.5510191",
"0.5496164",
"0.54932475",
"0.5486077",
"0.5486077",
"0.54769593",
"0.5472994",
"0.54720014",
"0.5467313",
"0.5467309",
"0.54667807",
"0.5463895",
"0.5459608",
"0.54499173",
"0.54499173",
"0.54418296",
"0.54403013",
"0.54393065",
"0.5436143",
"0.54349965",
"0.54306084",
"0.5424738",
"0.5424439",
"0.54174197",
"0.54174197",
"0.5413895",
"0.53934985",
"0.5386738"
] |
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 => opts[:status]\n elsif opts[:to_json] then\n hash = Hash.from_xml(render_to_string(:template => opts[:to_json], :layout => false))\n hash = hash[hash.keys.first] if hash.keys.length == 1\n content = hash.to_json\n cbparam = params[:callback] || params[:jsonp]\n content = \"#{cbparam}(#{content})\" unless cbparam.blank?\n render :json => content, :layout => false, :status => opts[:status]\n elsif opts[:to_xml]\n content = render_to_string(:template => opts[:to_xml], :layout => false)\n headers[\"Content-Type\"] = \"application/xml;\"\n render :text => content, :layout => false, :status => opts[:status]\n elsif opts[:response]\n render_rest_response opts[:response]\n else\n super opts, &block\n end\nend",
"def render(*args,&blk)\n opts = (Hash === args.last) ? args.pop : {}\n \n action = opts[:action] || params[:action]\n opts[:layout] ||= _layout \n \n choose_template_format(Merb.available_mime_types, opts)\n \n # Handles the case where render is called with an object\n if obj = args.first || opts[:obj]\n # Check for a template\n unless find_template({:action => action}.merge(opts))\n fmt = content_type\n if transform_method = Merb.mime_transform_method(fmt)\n set_response_headers fmt\n transform_args = provided_format_arguments_for(fmt)\n return case transform_args\n when Hash then obj.send(transform_method, transform_args)\n when Array then obj.send(transform_method, *transform_args)\n when Proc then\n case transform_args.arity\n when 3 then transform_args.call(obj, self, transform_method)\n when 2 then transform_args.call(obj, self)\n when 1 then transform_args.call(obj)\n else transform_args.call\n end\n else obj.send(transform_method)\n end\n end \n end\n end \n \n case\n when status = opts[:nothing]\n return render_nothing(status)\n \n when opts[:inline]\n text = opts.delete(:inline)\n return render_inline(text, opts)\n else \n set_response_headers @_template_format\n \n case @_format_value\n when String\n return @_format_value\n when Symbol\n if !Merb.available_mime_types.keys.include?(@_format_value) # render :js => \"Some js value\"\n template = find_template(:action => @_format_value)\n else\n if opts[@_format_value] == @_format_value # An edge case that lives in the specs\n # says that a render :js => :js should be catered for\n template = find_template(:action => @_format_value)\n else\n # when called from within an action as plain render within a respond_to block\n template = find_template(opts.merge( :action => action ))\n end\n end\n else\n if template = opts[:template]\n # render :template => \"this_template\"\n template = find_template( :template => template)\n else\n # a plain action render\n # def index; render; end\n template = find_template(:action => action)\n end\n end\n end\n \n unless template\n raise TemplateNotFound, \"No template matched at #{unmatched}\"\n end\n self.template ||= File.basename(template)\n\n engine = Template.engine_for(template)\n options = {\n :file => template,\n :view_context => (opts[:clean_context] ? clean_view_context(engine) : cached_view_context(engine)),\n :opts => opts\n }\n content = engine.transform(options)\n if engine.exempt_from_layout? || opts[:layout] == :none || [:js].include?(@_template_format)\n content \n else\n wrap_layout(content, opts)\n end\n end",
"def render(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n @response.status = options.delete(:status) || 200\n layout = @layouts[options.delete(:layout) || :default]\n assigns = { :request => request, :response => response, :params => params, :session => session }\n @content = args.last.is_a?(String) ? args.last : Markaby::Builder.new(assigns, self, &(block || @views[args.last])).to_s\n @content = Markaby::Builder.new(assigns, self, &layout).to_s if layout\n @response.headers.merge!(options)\n @response.body = @content\n end",
"def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.response_body = render_to_body(options)\n\t _process_format(rendered_format, options) if rendered_format\n\t self.response_body\n\t end",
"def render opts = {}\n renderer.render opts\n end",
"def render(*args, &block); end",
"def render(*args); end",
"def render(*args); end",
"def render(args={})\n return if @redirect\n @render_nothing = args[:nothing] # TODO hack to block automatic method templates\n json = args[:json]\n action = args[:action]\n html = args[:html]\n content = args[:content_type]\n partial = args[:partial]\n # xxx hack to let me fake scope to other controllers without loading\n temp = @handlerpath\n @handlerpath = args[:controller] if args[:controller]\n @content_type = content if content\n @current_layout = args[:layout] if args[:layout]\n write html if html\n @content_type = 'text/plain' if !content && json\n write json if json\n @render_nothing = true if json\n @rendered_template = true if json\n @current_layout = nil if json\n @rendered_template = true if action\n render_rhtml [\"#{action}.rhtml\"] if action\n # TODO hack end to return scope to current controller\n @handlerpath = temp\n end",
"def render(options = {})\n format = options.delete(:format) || :list\n klass = Breadcrumbs::Render.const_get(format.to_s.classify)\n html = klass.new(self, options).render\n\n html.respond_to?(:html_safe) ? html.html_safe : html\n end",
"def render(html, context = {})\n @context = context = (@context || {}).merge(context)\n html = render_sections(html)\n @context = context\n render_tags(html)\n end",
"def render(*args, &block)\n options = _normalize_render(*args, &block)\n rendered_body = render_to_body(options)\n if options[:html]\n _set_html_content_type\n else\n _set_rendered_content_type rendered_format\n end\n _set_vary_header\n self.response_body = rendered_body\n end",
"def api_render\n # Format?\n request.format = \"xml\" if request.format.html? # weird hack to support legacy behavior, with xml as default\n if params[\"umlaut.response_format\"] == \"jsonp\"\n request.format = \"json\"\n params[\"umlaut.jsonp\"] ||= \"umlautLoaded\"\n elsif params[\"umlaut.response_format\"]\n request.format = params[\"umlaut.response_format\"]\n end\n\n respond_to do |format|\n format.xml do\n render(:layout => false)\n end\n\n format.json do\n # get the xml in a string\n xml_str =\n with_format(:xml) do\n render_to_string(:layout=>false)\n end\n # convert to hash. For some reason the ActionView::OutputBuffer\n # we actually have (which looks like a String but isn't exactly)\n # can't be converted to a hash, we need to really force String\n # with #to_str\n data_as_hash = Hash.from_xml( xml_str.to_str )\n # And conver to json. Ta-da!\n json_str = data_as_hash.to_json\n # Handle jsonp, deliver JSON inside a javascript function call,\n # with function name specified in parameters.\n render(:json => json_str, :callback => params[\"umlaut.jsonp\"] )\n end\n end\n end",
"def render(*args)\n end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def to_html(*args); end",
"def render(opts={})\n opts\n end",
"def render(context, options); end",
"def render_to_body(options); end",
"def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end",
"def render(*)\n respond_to do |format|\n format.jsonapi { super }\n format.json { super }\n end\n end",
"def render_to_body(options = {})\n end",
"def render(props)\n # HTML.\n end",
"def to_html\n\n render_method = redirect? ? :redirect_to : :render\n begin\n render\n rescue ActionView::MissingTemplate\n begin\n if default_action\n #now this is sensitive to success state\n logger.debug \"responder rendering: \\ntrying #{render_method} #{default_action}\"\n send render_method, :action => default_action\n else\n logger.debug \"trying default\"\n default_render\n end\n rescue ActionView::MissingTemplate\n if render_method == :redirect_to\n logger.debug \"falling back to redirect resource to #{widget_action(default_action)}\"\n send render_method, resource || current_user, :action => widget_action(default_action)\n else\n logger.debug \"falling back to generic scaffold for #{widget_action(default_action)}\"\n w = widget_class(default_action)\n logger.warn \"render erector widget #{w}\"\n send render_method, navigation_location\n end\n end\n end\n end",
"def render(options = {})\n template.render options\n end",
"def render_get\n respond_to do |wants|\n wants.html {render :to_xml => 'GET.xml.builder', :layout => false}\n wants.xml {render :to_xml => 'GET.xml.builder', :layout => false}\n wants.json {render :to_json => 'GET.xml.builder'}\n wants.yaml {render :to_yaml => 'GET.xml.builder'}\n end\n \n end",
"def render(*iArgs, &iBlock)\n if (RailsAjax.config.Enabled)\n lArgs = _normalize_args(*iArgs, &iBlock)\n if ((request.xhr?) and\n (!lArgs.has_key?(:partial)) and\n (!lArgs.has_key?(:layout)) and\n (!lArgs.has_key?(:json)) and\n (params['format'] != 'json') and\n (self.content_type != 'application/json'))\n logger.debug \"[RailsAjax] render: iArgs=#{iArgs.inspect} iBlock?#{iBlock != nil} flash=#{flash.inspect} | Normalized arguments: #{lArgs.inspect}\"\n\n # If we have a redirection, use redirect_to\n if (lArgs[:location] == nil)\n # Complete arguments if needed\n # We don't want a special layout for Ajax requests: this was asked using AJAX for a page to be displayed in the main content\n lArgs[:layout] = false\n # Render\n lMainPage = nil\n if (iBlock == nil)\n lMainPage = render_to_string(lArgs)\n else\n lMainPage = render_to_string(lArgs) do\n iBlock.call\n end\n end\n\n # Send JSON result\n # Use 'application/json'\n self.content_type = 'application/json'\n self.response_body = get_json_response(\n :css_to_refresh => {\n RailsAjax::config.MainContainer => lMainPage\n }\n ).to_json\n elsif (lArgs[:status] == nil)\n redirect_to lArgs[:location]\n else\n redirect_to lArgs[:location], lArgs[:status]\n end\n\n elsif (iBlock == nil)\n super(*iArgs)\n else\n super(*iArgs) do\n iBlock.call\n end\n end\n elsif (iBlock == nil)\n super(*iArgs)\n else\n super(*iArgs) do\n iBlock.call\n end\n end\n\n end",
"def render(*args, &block)\n super(*args, &block)\n opts = args.first\n if opts.has_key?(:text) && opts[:text].present?\n self.response_body = opts[:text]\n elsif opts.has_key?(:nothing) && opts[:nothing]\n self.response_body = \" \"\n else\n raise UnsupportedOperationError\n end\n end",
"def render(*args, &block)\n opts = args[0]\n if opts.is_a?(Hash) && resource = opts[:json]\n if serializer = opts.fetch(:serializer, ActiveModel::Serializer.serializer_for(resource))\n render json: serializer.new(opts[:json]) and return\n end\n end\n\n super\n end",
"def render_to_body(options = {})\n\t end",
"def use_renderers(*args); end",
"def render(*args)\n super *args\n end",
"def default_render(*args)\n return super unless request.format.json?\n\n @simple_json_template = simple_renderer.renderer(template_name(action_name))\n if @simple_json_template\n render(*args)\n else\n super\n end\n end",
"def render!(*args); end",
"def render_with(render_class)\n format!\n render_class.new(self).render\n end",
"def render_to_string(*args, &block)\n options = _normalize_render(*args, &block)\n render_to_body(options)\n end",
"def html *args\n @html = true if args.size > 0\n @html\n end",
"def render_to_body(options = T.unsafe(nil)); end",
"def render_to_string(*args, &block)\n options = _normalize_render(*args, &block)\n render_to_body(options)\n end",
"def render\n raise NotImplementedError\n end",
"def render(*_arg0); end",
"def set_html_response_format\n request.format = :html\n end",
"def method_missing(method_name, *args, &block)\n if helper_exists?(method_name)\n parsed_args = merge_optional_string(args)\n render_helper(method_name, parsed_args)\n else\n super method_name, *args, &block\n end\n end",
"def render\n raise NotImplementedError, \"#{self.class} must implement a `#render` method to format its output.\"\n end",
"def render\n raise NotImplementedError, \"#{self.class} must implement a `#render` method to format its output.\"\n end",
"def render(format = :html)\n Renderer.render(\"#{view}.#{format}\", binding)\n end",
"def render(options = {})\n raise double_render! if rendered?\n @render_opts = options\n end",
"def rendering_html?(p = nil)\n p ||= params\n fmt = p[:format].to_s.downcase\n (fmt == 'html') || (respond_to?(:request) && request.format.html?)\n end",
"def render_body(context, options); end",
"def to_html(locals={}, tilt_options={}, &blk)\n html = content(locals, tilt_options, &blk)\n html = layout.to_html(locals, tilt_options) { html } if layout?\n html\n end",
"def render(options=nil, deprecated_status_or_extra_options=nil, &block)\n if ::Rails::VERSION::STRING >= '2.0.0' && deprecated_status_or_extra_options.nil?\n deprecated_status_or_extra_options = {}\n end\n \n unless block_given?\n unless integrate_views?\n if @template.respond_to?(:finder)\n (class << @template.finder; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n else\n (class << @template; self; end).class_eval do\n define_method :file_exists? do; true; end\n end\n end\n (class << @template; self; end).class_eval do\n define_method :render_file do |*args|\n @first_render ||= args[0] unless args[0] =~ /^layouts/\n end\n \n define_method :pick_template do |*args|\n @_first_render ||= args[0] unless args[0] =~ /^layouts/\n PickedTemplate.new\n end\n end\n end\n end\n\n if matching_message_expectation_exists(options)\n expect_render_mock_proxy.render(options, &block)\n @performed_render = true\n else\n if matching_stub_exists(options)\n @performed_render = true\n else\n super(options, deprecated_status_or_extra_options, &block)\n end\n end\n end",
"def render(opts={})\n update(opts)\n render_template\n end",
"def render(format = :html, params = {}, parent_context = nil)\n render_inline(format, params, parent_context)\n end",
"def render(options={})\n status = options[:status] || 200\n response = JSON.dump(options[:json])\n\n [status, { 'Content-Type' => 'application/json' }, [response]]\n end",
"def renders(&block)\n define_method(:renderable) do\n instance_eval(&block).try(:to_page)\n end\n end",
"def api_html page\n <<-STR\n<html>\n <head>\n <title>#{self.class} Api Documentation</title>\n <style>\n#{API_CSS}\n </style>\n </head>\n <body class=\"indexpage\">\n <div>\n #{RDoc::Markup::ToHtml.new.convert page.to_s}\n </div>\n </body>\n</html>\n STR\n end",
"def render\n raise NotImplementedError\n end",
"def render_html\n method = @opts[:method] || 'default'\n respond_to?(method) ? send(method) : \"Error DcCommonRenderer: Method #{method} doesn't exist!\"\nend",
"def render(page=1, arguments=\"\")\n \n view_data = get_view_data(page, arguments)\n \n view_url = '' #/'\n \n if view.url.to_s.strip.length > 0\n view_url << view.url\n else\n view_url << '/'\n view_url << view.view_name\n end \n\n template_path = find_view_holder\n template = Tilt.new(template_path)\n \n result = template.render(context, {:view => @view, \n :view_url => view_url, \n :view_data => view_data, \n :view_body => render_view_body(view_data), \n :view_arguments => arguments})\n \n if String.method_defined?(:force_encoding)\n result.force_encoding('utf-8')\n end\n\n return result\n \n end",
"def render_with(**locals)\n render_with_template(locals: locals)\n end",
"def render(*args, &block)\n captured = helpers.capture do\n helpers.concat(helpers.render(*args, &block))\n helpers.output_buffer.to_s\n end\n rawtext(captured)\n end",
"def render\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end",
"def render(options = {})\n options[:format] ||= :list\n\n klass_name = options.delete(:format).to_s.classify\n klass = Breadcrumbs::Render.const_get(klass_name)\n klass.new(self, options).render\n end",
"def render(*args)\n decorate_all\n super\n end",
"def method_missing(method, *args, &block) \n return super unless part(method)\n part(method).render\n end",
"def rails_render(*args)\n return if rails_api_controller?\n\n rails_controller_instance.render_to_string(*args)\n rescue ActionView::MissingTemplate\n nil\n end",
"def html(*r,&k)\n if ctx = __cheri_ctx\n unless copts = ctx[:html_opts]\n iopts = ctx.ictx[:html_opts] ||= HtmlOptions.new\n copts = ctx[:html_opts] = HtmlOptions.new(iopts)\n end\n if k\n if ctx.tos(HtmlElement)\n HtmlFrame.new(ctx,*r,&k).run\n else\n if r.empty?\n ctx.msend(Cheri::Html,:html,&k)\n else\n copts.ingest_args(*r)\n if args = copts.delete(:args)\n ctx.msend(Cheri::Html,:html,args,&k)\n else\n ctx.msend(Cheri::Html,:html,&k)\n end\n end\n end\n else\n unless r.empty?\n copts.ingest_args(*r)\n copts.delete(:args)\n end\n ctx[:html_proxy] ||= HtmlProxy.new(ctx,*r)\n end\n end\n end",
"def to_html(*args)\n @output_format = :html\n @options += args\n convert\n end",
"def render(options = T.unsafe(nil), locals = T.unsafe(nil), &block); end",
"def render!(options = {})\n render(options.merge(:raise_errors => true))\n end",
"def standard_html( state, encoding = nil, &body_filller )\n html(:language => state.fetch(\"request.language\"), :direction => state.fetch(\"html.direction\", \"ltr\") do\n head do\n meta :charset => @parameters.fetch(:encoding, Encoding.default_internal)\n state.fetch(\"html.headscripts\").each do |script|\n fail_todo \"what now?\"\n end\n state.fetch(\"html.css\").each do |css|\n fail_todo \"what now?\"\n end\n end\n body do\n capture(&body_filler)\n \n state.fetch(\"html.tailscripts\").each do |script|\n fail_todo \"what now?\"\n end\n end\n end\n end\n\n\n #\n # Starts an HTML stream.\n \n def html( attrs = {}, &block )\n @buffer << \"<!DOCTYPE html>\"\n @buffer << \"\\n\" if @pretty_print\n make( :html, attrs, &block )\n flush\n end\n\n\n #\n # Outputs raw text to the stream.\n \n def raw( text )\n @buffer << text\n end",
"def _normalize_render(*args, &block); end",
"def render\n raise NotImplementedError.new \"Please override 'render' in your \"+\n \"concrete implementation\"\n end",
"def render_to_string(*args, &block); end",
"def _render_template(options); end",
"def _render_template(options); end",
"def to_html\n render template\n end",
"def erb(template) render template end",
"def render(*)\n raise NotImplementedError.new(\"Implement a render function in a subclass\")\n end",
"def to_html\n @html ||= format_html\n end",
"def render(*args) #:nodoc:\n raise ::AbstractController::DoubleRenderError if self.response_body\n super\n self.content_type ||= rendered_format.to_s\n self.response_body\n end",
"def api_response\n response api_html(to_markup)\n end",
"def render!; raise NotImplementedError end",
"def render(html, options={})\n require \"haml\" unless defined? Haml\n Haml::Engine.new(html, options).render\nend",
"def render_template(context, options); end",
"def render(data, opts = {})\n opts = { :template_klass => Tilt::StringTemplate }.merge(opts)\n Parched::Page.new(@repo, opts[:template_klass], data).render\n end",
"def inner_html(*args); end",
"def inner_html(*args); end",
"def json_render(json = {})\n json_render_html('success', json)\n end",
"def generate_html_and_build_response!\n controller = self.class_to_model_name\n response_body = Poseidon::View.new.render(controller, meth, self)\n response.merge!(body: response_body)\n return response\n end",
"def get_render_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RenderApi#get_render ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling get_render\" if id.nil?\n \n # resource path\n path = \"/render/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['DeveloperKey']\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RenderResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RenderApi#get_render\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def render( * )\n\t\tnil\n\tend",
"def render( * )\n\t\tnil\n\tend",
"def hello\n render html: \"hello world!\"\n end",
"def render(*args) #:nodoc:\n raise ::AbstractController::DoubleRenderError if response_body\n super\n end",
"def render(options)\n case\n when options.has_key?(:text)\n response.body = options[:text]\n when options.has_key?(:template)\n template_filename = options[:template]\n template_string = IO.read(template_filename)\n view = View.new(self)\n template_engine = engine_for(template_string, :filename => template_filename)\n view.content = template_engine.render(view)\n if has_layout?\n layout_string = IO.read(layout)\n layout_engine = engine_for(layout_string, :filename => layout)\n response.body = layout_engine.render(view) do |*args|\n view.get_content_for(*args)\n end\n else\n response.body = view.content\n end\n else\n raise 'invalid options passed to render'\n end\n @_rendered = true\n response.body\n end",
"def render(options = nil, extra_options = {}, &block)\n # your code goes here\n prep_pagination_info(@results_h[:pagination_info]) if @results_h && @results_h[:pagination_info]\n \n # call the ActionController::Base render to show the page\n super\n end",
"def to_xhrml\n if get? || !has_errors? || response_overridden?\n to_html\n else\n render action: default_action, status: :unprocessable_entity\n end\n end"
] |
[
"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.63000286",
"0.6284129",
"0.62481564",
"0.62262017",
"0.62256217",
"0.6187185",
"0.61705196",
"0.61276525",
"0.61085707",
"0.6092755",
"0.6072093",
"0.6053965",
"0.6050637",
"0.6046368",
"0.6043413",
"0.60354376",
"0.6034454",
"0.60303825",
"0.6007199",
"0.60001194",
"0.59521294",
"0.59351414",
"0.5932419",
"0.58921784",
"0.5885523",
"0.58726084",
"0.58726084",
"0.58681965",
"0.5861088",
"0.58514196",
"0.58497024",
"0.5840886",
"0.583605",
"0.5834294",
"0.58339983",
"0.58298606",
"0.582887",
"0.5816721",
"0.5810119",
"0.58037484",
"0.5762943",
"0.5761998",
"0.57573897",
"0.5757276",
"0.5756064",
"0.57557756",
"0.5750798",
"0.5745628",
"0.5744013",
"0.5731124",
"0.5728533",
"0.572719",
"0.5721117",
"0.57158995",
"0.57088566",
"0.57070124",
"0.57058024",
"0.57058024",
"0.5704991",
"0.56985366",
"0.56965923",
"0.5686152",
"0.568434",
"0.5682094",
"0.5680703",
"0.5675995",
"0.5675062",
"0.5673801",
"0.56677246",
"0.56677246",
"0.56561273",
"0.56507534",
"0.564034",
"0.562787",
"0.562787",
"0.56267667",
"0.5615467",
"0.56141555",
"0.5611064",
"0.5607911"
] |
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 end",
"def owners\n @obj['owners']\n end",
"def getOwners\r\n\t\t\t\t\treturn @owners\r\n\t\t\t\tend",
"def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @owners }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end",
"def show_all\n @owners = Owner.all\n end",
"def filter_owners(path, unknown_owners)\n owners = { clients: [], users: [] }\n unknown_owners.each do |entity|\n if path[0] == \"organizations\" && path.length > 2\n begin\n data.get([\"organizations\", path[1], \"clients\", entity])\n owners[:clients] |= [ entity ]\n rescue\n owners[:users] |= [ entity ]\n end\n else\n owners[:users] |= [ entity ]\n end\n end\n owners\n end",
"def owners=(value)\n @owners = value\n end",
"def owners\n return @owners\n end",
"def show\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner }\n end\n end",
"def index\n @owners = Owner.all\n render 'frontend/owners/index'\n end",
"def owners\n get_user_with_role(:owner)\n end",
"def index\n @object_owners = ObjectOwner.all\n end",
"def owners_contents\n files = applicable_owners_files\n\n return [] if files.nil?\n\n puts \"f: #{files.inspect}\"\n files.map { |f| f[:owners] }\n end",
"def list_owners\n Owner.all.each_with_index do |owner, i|\n puts \"\\n#{i + 1}. #{owner.name} \\nAddress: #{owner.address}\"\n puts \"Food provided: #{owner.food_provided.capitalize}\"\n puts \"Has a cat? #{owner.cat_already.to_s.capitalize} | Has a dog? #{owner.dog.to_s.capitalize}\"\n puts \"Lives in #{owner.neighborhood.name}\"\n all_cats = Cat.all.select { |x| x.owner_id == owner.id}\n cats_list = all_cats.map{ |x| x.name }.join(\", \")\n puts \"#{owner.name}'s cat(s): #{cats_list}\"\n puts \"\\n----------------------------------------------------------------------------\"\n end\n end",
"def index\n @owner = current_owner_user.owner\n end",
"def owners\n self.authors.collect(&:user)\n end",
"def index\n @ownerships = ownerships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ownerships }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n\n end",
"def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @owners.to_json, :callback => params[:callback] }\n end\n end",
"def owners\n # set @owners instance variable by\n # 1) grabbing all Ownerships containing this panlist\n # 2) converting each Ownership into an Owner\n @owners ||= Ownership.where(list_id: self.id).map do |ownership|\n Owner.find_by_netid(ownership.owner_id)\n end\n end",
"def owned\n @relations = @user.owned.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.amp\n format.json\n format.js\n end\n end",
"def find_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def owner\n if params[:owner].blank?\n raise Errors::NotFoundError.new('Owner not found.')\n end\n\n login = params[:owner].downcase\n Owner.find_by!(\"LOWER(login) = ?\", login)\n end",
"def list_of_owners\n @owners = Owner.find(:all, :order=>\"state,city\")\n @report_name = \"List of Owners\"\n end",
"def show\n @owner = Owner.find(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @owner.to_json, :callback => params[:callback] }\n end\n end",
"def get_owner(owner)\n # Looks like a path to follow:\n if owner[0,1] == \"/\"\n return get(owner)\n end\n\n # Otherwise, assume owner key was given:\n get(\"/owners/#{owner}\")\n end",
"def get_orgs_id_owners_with_http_info(org_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_orgs_id_owners ...'\n end\n # verify the required parameter 'org_id' is set\n if @api_client.config.client_side_validation && org_id.nil?\n fail ArgumentError, \"Missing the required parameter 'org_id' when calling UsersApi.get_orgs_id_owners\"\n end\n # resource path\n local_var_path = '/orgs/{orgID}/owners'.sub('{' + 'orgID' + '}', CGI.escape(org_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_orgs_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_orgs_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @reservation_owners = ReservationOwner.all\n end",
"def show\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: @owner}\n end\n end",
"def index\n @assigned_owners = AssignedOwner.all\n end",
"def owners_count\n return @owners_count\n end",
"def index\n @product_owners = ProductOwner.all\n end",
"def index\n @owner_properties = @owner.ownerProperties\n end",
"def index\n render json: @owner.cats\n end",
"def index\n @company_owners = CompanyOwner.all\n end",
"def index\n @owners = Owner.search(params[:search]).paginate(:per_page => 25, :page => params[:page])\n if @owners.count == 1\n redirect_to @owners.first\n end\n end",
"def process_owners(api_story)\n owner_ids = api_story['owner_ids']\n\n cached_owners = owner_ids.map do |owner_id|\n User.get_cached(owner_id)\n end\n\n return cached_owners if cached_owners.none?(&:nil?)\n\n project_id = api_story['project_id']\n story_id = api_story['id']\n User.get_by_project_and_story_id(project_id, story_id)\n end",
"def owner_names\n self.pets.map {|p| p.owner}.pluck(:name).uniq\n end",
"def index\n @property_owners = PropertyOwner.all\n end",
"def get_owner\n owner_id = nil\n owners = Bank::Owner.create_owners(\"./support/owners.csv\")\n CSV.foreach(\"./support/account_owners.csv\") do |line|\n if line[0].to_i == @id\n owner_id = line[1].to_i\n end\n end\n Bank::Owner.find(owner_id)\n end",
"def index\n @ticket_owners = TicketOwner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_owners }\n end\n end",
"def set_owner\n @owner = Owner.find_by(name: params[:owner_name])\n unless @owner.present?\n head 404 and return\n end\n end",
"def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end",
"def get_buckets_id_owners_with_http_info(bucket_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_buckets_id_owners ...'\n end\n # verify the required parameter 'bucket_id' is set\n if @api_client.config.client_side_validation && bucket_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bucket_id' when calling UsersApi.get_buckets_id_owners\"\n end\n # resource path\n local_var_path = '/buckets/{bucketID}/owners'.sub('{' + 'bucketID' + '}', CGI.escape(bucket_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_buckets_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_buckets_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @pre_with_owner = Array.new\n @pre = Pre.find(params[:id])\n @pre_with_owner.push @pre\n @pre_with_owner.push User.find(@pre.owner)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_with_owner }\n end\n end",
"def setOwners(owners)\r\n\t\t\t\t\t@owners = owners\r\n\t\t\t\tend",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def get_scrapers_id_owners_with_http_info(scraper_target_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_scrapers_id_owners ...'\n end\n # verify the required parameter 'scraper_target_id' is set\n if @api_client.config.client_side_validation && scraper_target_id.nil?\n fail ArgumentError, \"Missing the required parameter 'scraper_target_id' when calling UsersApi.get_scrapers_id_owners\"\n end\n # resource path\n local_var_path = '/scrapers/{scraperTargetID}/owners'.sub('{' + 'scraperTargetID' + '}', CGI.escape(scraper_target_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_scrapers_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_scrapers_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def owner()\n sql = \"SELECT * FROM owners\n WHERE id = $1\"\n values = [@owner_id]\n owner_data = SqlRunner.run( sql, values ).first\n result = Owner.new(owner_data)\n end",
"def index\n @shop_owners = ShopOwner.all\n end",
"def index\n @expense_owners = ExpenseOwner.all\n end",
"def owners_by_key\n @owners_by_key ||= owners.group_by do |owner|\n key = owner[owner_key_name]\n key && key.to_s\n end\n end",
"def user_owners\n User.where(id: owners.keys).to_a.map do |_user|\n _user.anonymous_time_verification = owners[_user.id.to_s]\n _user\n end\n end",
"def index\n @images = @owner.images\n end",
"def owned_by\n HubEdos::StudentApi::V2::AcademicPolicy::AdministrativeOwners.new(@data['ownedBy'])\n end",
"def org_members\n @members = @github.orgs.members.list APP_CONF['org']\n render json: @members\n end",
"def find\n @owner = Owner.find(params[:id])\n @dogs = Owner.find(params[:id]).dogs\n end",
"def owner\r\n\t\t\t`#{BITS::BITSADMIN} /getowner {#{@id}}`\r\n\t\tend",
"def index\n owner_id = params[:owner_id]\n if owner_id then\n\t@sumobots = Sumobot.find(owner_id)\n else\n \t@sumobots = Sumobot.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sumobots }\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n @patients = @owner.patients.paginate(page: params[:page])\n end",
"def get_tasks_id_owners_with_http_info(task_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_tasks_id_owners ...'\n end\n # verify the required parameter 'task_id' is set\n if @api_client.config.client_side_validation && task_id.nil?\n fail ArgumentError, \"Missing the required parameter 'task_id' when calling UsersApi.get_tasks_id_owners\"\n end\n # resource path\n local_var_path = '/tasks/{taskID}/owners'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_tasks_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_tasks_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def owner\n User.find_by(id: user_id)\n end",
"def read_owners(config, org_guid)\n user_setup_obj = UsersSetup.new(config)\n\n users_list = []\n users = @client.organization(org_guid).managers\n\n users.each do |user|\n user_guid = user.guid\n username = user_setup_obj.get_username_from_guid(user_guid)\n users_list << Users::User.new(username, 'owner', false, user_guid)\n end\n\n users_list\n end",
"def populate_owners\n ENV['PT_PROJECTS'].split(', ').each do |id|\n\n ownersDatum = make_call_parsed(\"#{pivotal_url}/#{id}/memberships\", pivotal_headers)\n\n ownersDatum.each do |ownerData|\n\n unless Owner.find_by_poid(ownerData['person']['id'])\n\n Owner.create( poid: ownerData['person']['id'],\n initials: ownerData['person']['initials'],\n name: ownerData['person']['name'])\n end\n end\n end\n end",
"def owner_params\n params.fetch(:owner, {})\n end",
"def select_owner(*owners)\n owner_select.click\n wait_for_owner_options\n owners.each do |owner|\n owner_options(text: /\\A#{owner}\\Z/).first.click\n end\n page.find(\"body\").click\n wait_until_owner_options_invisible\n end",
"def get_telegrafs_id_owners(telegraf_id, opts = {})\n data, _status_code, _headers = get_telegrafs_id_owners_with_http_info(telegraf_id, opts)\n data\n end",
"def show\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_owned }\n end\n end",
"def get_telegrafs_id_owners_with_http_info(telegraf_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_telegrafs_id_owners ...'\n end\n # verify the required parameter 'telegraf_id' is set\n if @api_client.config.client_side_validation && telegraf_id.nil?\n fail ArgumentError, \"Missing the required parameter 'telegraf_id' when calling UsersApi.get_telegrafs_id_owners\"\n end\n # resource path\n local_var_path = '/telegrafs/{telegrafID}/owners'.sub('{' + 'telegrafID' + '}', CGI.escape(telegraf_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_telegrafs_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_telegrafs_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def owner_name\n payload['repository']['owner']['name']\n end",
"def owner_id\n data[:owner_id]\n end",
"def owner_id\n data[:owner_id]\n end",
"def list_account_owners_with_http_info(member_guid, user_guid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IdentityApi.list_account_owners ...'\n end\n # verify the required parameter 'member_guid' is set\n if @api_client.config.client_side_validation && member_guid.nil?\n fail ArgumentError, \"Missing the required parameter 'member_guid' when calling IdentityApi.list_account_owners\"\n end\n # verify the required parameter 'user_guid' is set\n if @api_client.config.client_side_validation && user_guid.nil?\n fail ArgumentError, \"Missing the required parameter 'user_guid' when calling IdentityApi.list_account_owners\"\n end\n # resource path\n local_var_path = '/users/{user_guid}/members/{member_guid}/account_owners'.sub('{' + 'member_guid' + '}', member_guid.to_s).sub('{' + 'user_guid' + '}', user_guid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.mx.atrium.v1+json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey', 'clientID']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AccountOwnersResponseBody')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: IdentityApi#list_account_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @howner = Howner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @howner }\n end\n end",
"def index\n\n @people = Person.filter(params.slice(:name_like))\n @people = @people.where([\"union_id = ?\", current_person.union_id]) if request.format.json? && !owner?\n @people = @people.where(\"not invited_by_id is null\").order([:last_name, :first_name, :id])\n \n respond_to do |format|\n format.html \n format.json \n end\n end",
"def owner_params\n params.require(:owner).permit(:name, :owner_user_id)\n end",
"def user_repos\n @repos = @github.repos.list user: params[:username]\n render json: @repos\n end",
"def show\n user= params[:user]\n repo= params[:repo]\n puts user\n puts repo\n url = BASE_URL + \"repos/\" + user + \"/\" + repo + \"/collaborators\"+ \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n # url = BASE_URL + \"repos/rails/rails/collaborators\"\n # url = BASE_URL + \"repositories\"\n @repo = JSON.parse(open(url).read)\n @results = []\n\n\n @repo.each do |doc|\n ids = doc['login']\n url_people = BASE_URL + \"users/\" + ids + \"?client_id=e24305f14f7f9a67c465&client_secret=604015f905f6207ec29f3661b952397663d58347\"\n @results << JSON.parse(open(url_people).read)\n end\n\n end",
"def owner\n events = Event.where(owner: params[:id]).order('created_at ASC')\n\n respond_to do |format|\n if events.nil?\n format.xml {render :xml => ''}\n else\n format.xml { render :xml => events.to_xml }\n end\n\n end\n end",
"def owners_name\n if self.owner.is_a?(Person) && self.owner.user\n self.owner.user.login\n elsif self.owner.respond_to?(:name)\n self.owner.name\n else\n \"disclosed\".t\n end\n end",
"def owner\n User.find(owner_id)\n rescue ActiveRecord::RecordNotFound\n User.missing_user\n end",
"def show\n @owner = Owner.find(params[:id])\n @species = Species.find(:all, :order => \"name ASC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @owner }\n end\n end",
"def people\n Person.find(dogs.map(&:owner_id))\n end",
"def find(owner_id, name)\n response = @user.get([@base_uri, owner_id, name].join(\"/\"))\n params = {\n :name => name,\n :data => response.body,\n :content_type => response.headers['content-type'].first,\n :owner => { :id => owner_id }\n }\n LinkedDocument.new(@user, params)\n end",
"def owned\n @articles = Article.owned_by(current_user, params[:page])\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def index\n render json: current_org.users\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def show\n @product_owner = ProductOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_owner }\n end\n end",
"def get_dashboards_id_owners_with_http_info(dashboard_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_dashboards_id_owners ...'\n end\n # verify the required parameter 'dashboard_id' is set\n if @api_client.config.client_side_validation && dashboard_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dashboard_id' when calling UsersApi.get_dashboards_id_owners\"\n end\n # resource path\n local_var_path = '/dashboards/{dashboardID}/owners'.sub('{' + 'dashboardID' + '}', CGI.escape(dashboard_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_dashboards_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_dashboards_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def owner\n {owner_id: self.object.user.id, \n owner_account: self.object.user.email}\n end",
"def articles \n render json: @owner, custom_key: true\n end",
"def show\n @testbed_owner = TestbedOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testbed_owner }\n end\n end",
"def number_of_owners\n (additional_owners || []).length + 1\n end"
] |
[
"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.65953964",
"0.6581179",
"0.65409726",
"0.6525716",
"0.65020317",
"0.6453935",
"0.6416029",
"0.64094436",
"0.6343119",
"0.63239765",
"0.63132113",
"0.6308671",
"0.6295015",
"0.629153",
"0.62823164",
"0.6281674",
"0.62755054",
"0.6250141",
"0.62343705",
"0.62339497",
"0.6199541",
"0.6196464",
"0.6161877",
"0.61362565",
"0.61308205",
"0.6115842",
"0.6093704",
"0.60934937",
"0.6076098",
"0.6059278",
"0.6036819",
"0.59971035",
"0.59965473",
"0.5967358",
"0.5955638",
"0.59216446",
"0.5907876",
"0.5905763",
"0.5890799",
"0.5889854",
"0.5882355",
"0.58761597",
"0.5869482",
"0.5866258",
"0.5864313",
"0.5863191",
"0.585824",
"0.5855656",
"0.58527446",
"0.5849151",
"0.5846738",
"0.584358",
"0.5835427",
"0.58344585",
"0.5804276",
"0.5801805",
"0.5801805",
"0.579419",
"0.5794137",
"0.57895225",
"0.5780254",
"0.5777094",
"0.57712734",
"0.5765467",
"0.5757983",
"0.5750891",
"0.57456046",
"0.574359",
"0.57232416",
"0.57230496",
"0.572278",
"0.5715863",
"0.5708953",
"0.5702199",
"0.57007706",
"0.56979644",
"0.56973463",
"0.5694424",
"0.5683075"
] |
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 @owners = Owner.all\n end",
"def index\n @owners = Owner.all\n end",
"def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @owners }\n end\n end",
"def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end",
"def owners\n @obj['owners']\n end",
"def show\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner }\n end\n end",
"def getOwners\r\n\t\t\t\t\treturn @owners\r\n\t\t\t\tend",
"def show_all\n @owners = Owner.all\n end",
"def show\n @owner = Owner.find(params[:id])\n\n end",
"def find_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def index\n @owners = Owner.all\n render 'frontend/owners/index'\n end",
"def owners=(value)\n @owners = value\n end",
"def filter_owners(path, unknown_owners)\n owners = { clients: [], users: [] }\n unknown_owners.each do |entity|\n if path[0] == \"organizations\" && path.length > 2\n begin\n data.get([\"organizations\", path[1], \"clients\", entity])\n owners[:clients] |= [ entity ]\n rescue\n owners[:users] |= [ entity ]\n end\n else\n owners[:users] |= [ entity ]\n end\n end\n owners\n end",
"def owner\n if params[:owner].blank?\n raise Errors::NotFoundError.new('Owner not found.')\n end\n\n login = params[:owner].downcase\n Owner.find_by!(\"LOWER(login) = ?\", login)\n end",
"def index\n @owner = current_owner_user.owner\n end",
"def get_owner(owner)\n # Looks like a path to follow:\n if owner[0,1] == \"/\"\n return get(owner)\n end\n\n # Otherwise, assume owner key was given:\n get(\"/owners/#{owner}\")\n end",
"def index\n @ownerships = ownerships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ownerships }\n end\n end",
"def owner()\n sql = \"SELECT * FROM owners\n WHERE id = $1\"\n values = [@owner_id]\n owner_data = SqlRunner.run( sql, values ).first\n result = Owner.new(owner_data)\n end",
"def show\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n format.html\n format.js\n format.json { render json: @owner}\n end\n end",
"def index\n @object_owners = ObjectOwner.all\n end",
"def show\n @owner = Owner.find(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @owner.to_json, :callback => params[:callback] }\n end\n end",
"def owners\n get_user_with_role(:owner)\n end",
"def get_owner\n owner_id = nil\n owners = Bank::Owner.create_owners(\"./support/owners.csv\")\n CSV.foreach(\"./support/account_owners.csv\") do |line|\n if line[0].to_i == @id\n owner_id = line[1].to_i\n end\n end\n Bank::Owner.find(owner_id)\n end",
"def owners\n return @owners\n end",
"def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @owners.to_json, :callback => params[:callback] }\n end\n end",
"def set_owner\n @owner = Owner.find_by(name: params[:owner_name])\n unless @owner.present?\n head 404 and return\n end\n end",
"def list_owners\n Owner.all.each_with_index do |owner, i|\n puts \"\\n#{i + 1}. #{owner.name} \\nAddress: #{owner.address}\"\n puts \"Food provided: #{owner.food_provided.capitalize}\"\n puts \"Has a cat? #{owner.cat_already.to_s.capitalize} | Has a dog? #{owner.dog.to_s.capitalize}\"\n puts \"Lives in #{owner.neighborhood.name}\"\n all_cats = Cat.all.select { |x| x.owner_id == owner.id}\n cats_list = all_cats.map{ |x| x.name }.join(\", \")\n puts \"#{owner.name}'s cat(s): #{cats_list}\"\n puts \"\\n----------------------------------------------------------------------------\"\n end\n end",
"def owners\n self.authors.collect(&:user)\n end",
"def owned\n @relations = @user.owned.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.amp\n format.json\n format.js\n end\n end",
"def get_orgs_id_owners_with_http_info(org_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_orgs_id_owners ...'\n end\n # verify the required parameter 'org_id' is set\n if @api_client.config.client_side_validation && org_id.nil?\n fail ArgumentError, \"Missing the required parameter 'org_id' when calling UsersApi.get_orgs_id_owners\"\n end\n # resource path\n local_var_path = '/orgs/{orgID}/owners'.sub('{' + 'orgID' + '}', CGI.escape(org_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_orgs_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_orgs_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def owner\r\n\t\t\t`#{BITS::BITSADMIN} /getowner {#{@id}}`\r\n\t\tend",
"def index\n @owners = Owner.search(params[:search]).paginate(:per_page => 25, :page => params[:page])\n if @owners.count == 1\n redirect_to @owners.first\n end\n end",
"def owners\n # set @owners instance variable by\n # 1) grabbing all Ownerships containing this panlist\n # 2) converting each Ownership into an Owner\n @owners ||= Ownership.where(list_id: self.id).map do |ownership|\n Owner.find_by_netid(ownership.owner_id)\n end\n end",
"def index\n @owner_properties = @owner.ownerProperties\n end",
"def owner\n User.find_by(id: user_id)\n end",
"def owners_contents\n files = applicable_owners_files\n\n return [] if files.nil?\n\n puts \"f: #{files.inspect}\"\n files.map { |f| f[:owners] }\n end",
"def owner_id\n data[:owner_id]\n end",
"def owner_id\n data[:owner_id]\n end",
"def index\n render json: @owner.cats\n end",
"def index\n @reservation_owners = ReservationOwner.all\n end",
"def show\n @howner = Howner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @howner }\n end\n end",
"def owner\n User.find(owner_id)\n rescue ActiveRecord::RecordNotFound\n User.missing_user\n end",
"def find\n @owner = Owner.find(params[:id])\n @dogs = Owner.find(params[:id]).dogs\n end",
"def list_of_owners\n @owners = Owner.find(:all, :order=>\"state,city\")\n @report_name = \"List of Owners\"\n end",
"def find(owner_id, name)\n response = @user.get([@base_uri, owner_id, name].join(\"/\"))\n params = {\n :name => name,\n :data => response.body,\n :content_type => response.headers['content-type'].first,\n :owner => { :id => owner_id }\n }\n LinkedDocument.new(@user, params)\n end",
"def owner_name\n payload['repository']['owner']['name']\n end",
"def show\n @pre_with_owner = Array.new\n @pre = Pre.find(params[:id])\n @pre_with_owner.push @pre\n @pre_with_owner.push User.find(@pre.owner)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_with_owner }\n end\n end",
"def get_buckets_id_owners_with_http_info(bucket_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_buckets_id_owners ...'\n end\n # verify the required parameter 'bucket_id' is set\n if @api_client.config.client_side_validation && bucket_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bucket_id' when calling UsersApi.get_buckets_id_owners\"\n end\n # resource path\n local_var_path = '/buckets/{bucketID}/owners'.sub('{' + 'bucketID' + '}', CGI.escape(bucket_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_buckets_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_buckets_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n if params.include?(:name)\n @owner = Owner.find_by_name(params[:name])\n @articles = @owner.articles\n else\n @owner = nil\n @articles = Article.includes(:owner).all\n end\n\n respond_to do |format|\n format.html { render :index }\n format.json { render_json_responsibly(articles: @articles) }\n end\n end",
"def index\n @product_owners = ProductOwner.all\n end",
"def owners_count\n return @owners_count\n end",
"def get_scrapers_id_owners_with_http_info(scraper_target_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_scrapers_id_owners ...'\n end\n # verify the required parameter 'scraper_target_id' is set\n if @api_client.config.client_side_validation && scraper_target_id.nil?\n fail ArgumentError, \"Missing the required parameter 'scraper_target_id' when calling UsersApi.get_scrapers_id_owners\"\n end\n # resource path\n local_var_path = '/scrapers/{scraperTargetID}/owners'.sub('{' + 'scraperTargetID' + '}', CGI.escape(scraper_target_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_scrapers_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_scrapers_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @assigned_owners = AssignedOwner.all\n end",
"def show\n @owner = Owner.find(params[:id])\n @patients = @owner.patients.paginate(page: params[:page])\n end",
"def show\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @album_owned }\n end\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def index\n @company_owners = CompanyOwner.all\n end",
"def process_owners(api_story)\n owner_ids = api_story['owner_ids']\n\n cached_owners = owner_ids.map do |owner_id|\n User.get_cached(owner_id)\n end\n\n return cached_owners if cached_owners.none?(&:nil?)\n\n project_id = api_story['project_id']\n story_id = api_story['id']\n User.get_by_project_and_story_id(project_id, story_id)\n end",
"def show\n @owner = Owner.find(params[:id])\n @species = Species.find(:all, :order => \"name ASC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @owner }\n end\n end",
"def show\n @product_owner = ProductOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_owner }\n end\n end",
"def index\n @property_owners = PropertyOwner.all\n end",
"def index\n @ticket_owners = TicketOwner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ticket_owners }\n end\n end",
"def show\n creator = Creator.find(params[:id])\n if !creator.nil?\n render json: creator, status: :ok\n else\n render json: creator.errors, status: :not_found\n end\n end",
"def owner_params\n params.require(:owner).permit(:name, :owner_user_id)\n end",
"def show\n @testbed_owner = TestbedOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testbed_owner }\n end\n end",
"def name\n @owner\n end",
"def set_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def index\n @images = @owner.images\n end",
"def owned_by\n HubEdos::StudentApi::V2::AcademicPolicy::AdministrativeOwners.new(@data['ownedBy'])\n end",
"def person\n Person.find_by_id( owner, @client )\n end",
"def owner_names\n self.pets.map {|p| p.owner}.pluck(:name).uniq\n end",
"def owners_name\n if self.owner.is_a?(Person) && self.owner.user\n self.owner.user.login\n elsif self.owner.respond_to?(:name)\n self.owner.name\n else\n \"disclosed\".t\n end\n end",
"def owner\n {owner_id: self.object.user.id, \n owner_account: self.object.user.email}\n end",
"def owner \n Owner.new(attributes['owner'])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def get_tasks_id_owners_with_http_info(task_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_tasks_id_owners ...'\n end\n # verify the required parameter 'task_id' is set\n if @api_client.config.client_side_validation && task_id.nil?\n fail ArgumentError, \"Missing the required parameter 'task_id' when calling UsersApi.get_tasks_id_owners\"\n end\n # resource path\n local_var_path = '/tasks/{taskID}/owners'.sub('{' + 'taskID' + '}', CGI.escape(task_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_tasks_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_tasks_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_telegrafs_id_owners_with_http_info(telegraf_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.get_telegrafs_id_owners ...'\n end\n # verify the required parameter 'telegraf_id' is set\n if @api_client.config.client_side_validation && telegraf_id.nil?\n fail ArgumentError, \"Missing the required parameter 'telegraf_id' when calling UsersApi.get_telegrafs_id_owners\"\n end\n # resource path\n local_var_path = '/telegrafs/{telegrafID}/owners'.sub('{' + 'telegrafID' + '}', CGI.escape(telegraf_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwners'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.get_telegrafs_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#get_telegrafs_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def owner\n @attributes[:owner]\n end",
"def show\n @call_list_owner = CallListOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @call_list_owner }\n end\n end",
"def show\n @total_owner = TotalOwner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @total_owner }\n end\n end",
"def show\n @owner_patient = OwnerPatient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @owner_patient }\n end\n end",
"def index\n owner_id = params[:owner_id]\n if owner_id then\n\t@sumobots = Sumobot.find(owner_id)\n else\n \t@sumobots = Sumobot.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sumobots }\n end\n end",
"def owner_params\n params.fetch(:owner, {})\n end",
"def index\n @expense_owners = ExpenseOwner.all\n end",
"def owner\n events = Event.where(owner: params[:id]).order('created_at ASC')\n\n respond_to do |format|\n if events.nil?\n format.xml {render :xml => ''}\n else\n format.xml { render :xml => events.to_xml }\n end\n\n end\n end",
"def setOwners(owners)\r\n\t\t\t\t\t@owners = owners\r\n\t\t\t\tend",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def select_owner(*owners)\n owner_select.click\n wait_for_owner_options\n owners.each do |owner|\n owner_options(text: /\\A#{owner}\\Z/).first.click\n end\n page.find(\"body\").click\n wait_until_owner_options_invisible\n end",
"def index\n @shop_owners = ShopOwner.all\n end",
"def owner\n OwnerSerializer.new(self.sporting_good.user)\n end",
"def populate_owners\n ENV['PT_PROJECTS'].split(', ').each do |id|\n\n ownersDatum = make_call_parsed(\"#{pivotal_url}/#{id}/memberships\", pivotal_headers)\n\n ownersDatum.each do |ownerData|\n\n unless Owner.find_by_poid(ownerData['person']['id'])\n\n Owner.create( poid: ownerData['person']['id'],\n initials: ownerData['person']['initials'],\n name: ownerData['person']['name'])\n end\n end\n end\n end"
] |
[
"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.6610739",
"0.66077006",
"0.6587812",
"0.6578741",
"0.6549661",
"0.65264606",
"0.64747524",
"0.6440474",
"0.6424472",
"0.64149606",
"0.63997823",
"0.63693815",
"0.63182914",
"0.63136107",
"0.63016945",
"0.6296901",
"0.62844276",
"0.6265812",
"0.62370306",
"0.62284493",
"0.622482",
"0.622482",
"0.62083334",
"0.6198586",
"0.61861527",
"0.6184367",
"0.614307",
"0.6125748",
"0.6116665",
"0.6116051",
"0.6109525",
"0.6108894",
"0.6086422",
"0.60861874",
"0.6064304",
"0.6062663",
"0.60625887",
"0.6062429",
"0.603986",
"0.6038494",
"0.6035143",
"0.6019366",
"0.5999344",
"0.5992073",
"0.5990556",
"0.59895885",
"0.59894466",
"0.5985843",
"0.5982749",
"0.5979882",
"0.5973422",
"0.59611225",
"0.59577197",
"0.595626",
"0.5941886",
"0.5930691",
"0.5927173",
"0.59260553",
"0.5924158",
"0.5924158",
"0.5924158",
"0.5924158",
"0.5924158",
"0.5924158",
"0.5924158",
"0.59202206",
"0.59180576",
"0.5898758",
"0.5894925",
"0.5894741",
"0.58825433",
"0.5881198",
"0.5876804",
"0.58290696",
"0.5811214",
"0.5803961",
"0.5794623",
"0.5789645",
"0.57865036",
"0.5784162",
"0.5782552"
] |
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 format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 action: 'show', status: :created, location: @owner }\n else\n format.html { render action: 'new' }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owners=(value)\n @owners = value\n end",
"def create\n @owner = Owner.new(owner_params)\n @owner.id = Owner.all.last.id + 1 #manually set id\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 format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_owners\n return make_request(\"#{self.endpoint}/list/owners\")\n end",
"def owner_params\n params.require(:owner).permit(:name, :owner_user_id)\n end",
"def create\n @owner = Owner.new(params[:owner])\n\n respond_to do |format|\n if @owner.save(params[:owner])\n format.html { redirect_to owners_path, notice: 'Oferta a fost creata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @owner = Owner.new(owner_params)\n\n respond_to do |format|\n if @owner.save\n format.html { redirect_to new_owner_path, notice: 'オーナー情報の作成に成功しました。' }\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 # format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n params[:owner].merge!(:status => true)\n @owner = Owner.new(params[:owner])\n\n respond_to do |format|\n if @owner.save\n flash[:notice] = 'Proprietario criado com sucesso'\n format.html { redirect_to :action => 'show', :id => @owner.id}\n format.json { render json: @owner, status: :created, location: @owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rest = Rest.new(rest_params)\n @rest.owners << current_owner\n respond_to do |format|\n if @rest.save\n format.html { redirect_to @rest, notice: 'Rest was successfully created.' }\n format.json { render :show, status: :created, location: @rest }\n else\n format.html { render :new }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @assigned_owner = AssignedOwner.new(assigned_owner_params)\n\n respond_to do |format|\n if @assigned_owner.save\n format.html { redirect_to @assigned_owner, notice: 'Assigned owner was successfully created.' }\n format.json { render :show, status: :created, location: @assigned_owner }\n else\n format.html { render :new }\n format.json { render json: @assigned_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owner_params\n params.require(:owner).permit(:nombre, :tipo, :clave, :pe)\n end",
"def create\n @owner = Owner.new(owner_params)\n if @owner.save\n # Redirect to new owner profile\n redirect_to @owner\n else\n # Render a new owner form\n render 'new_owner'\n end\n end",
"def owner_params\n params.require(:owner).permit(:first_name, :last_name, :street, :city, :state, :zip, :phone, :email, :active)\n end",
"def index\n @owners = Owner.all\n end",
"def index\n @owners = Owner.all\n end",
"def populate_owners\n ENV['PT_PROJECTS'].split(', ').each do |id|\n\n ownersDatum = make_call_parsed(\"#{pivotal_url}/#{id}/memberships\", pivotal_headers)\n\n ownersDatum.each do |ownerData|\n\n unless Owner.find_by_poid(ownerData['person']['id'])\n\n Owner.create( poid: ownerData['person']['id'],\n initials: ownerData['person']['initials'],\n name: ownerData['person']['name'])\n end\n end\n end\n end",
"def owners\n @data['owners']\n end",
"def create\n @object_owner = ObjectOwner.new(object_owner_params)\n\n respond_to do |format|\n if @object_owner.save\n format.html { redirect_to @object_owner, notice: 'Object owner was successfully created.' }\n format.json { render :show, status: :created, location: @object_owner }\n else\n format.html { render :new }\n format.json { render json: @object_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @owners }\n end\n end",
"def owner_params\n params.require(:owner).permit(:name, :name_kana, :post_code, :address, :tel, :tel2, :fax, :property_name, :property_name_kana, :property_post_code, :property_address, :property_type, :bank, :branch, :account_type, :account_num, :account_name, :memo)\n end",
"def owner_params\n params.require(:owner).permit(:id, :first_name, :last_name, :team_name, :place_avg, :total_points_avg, :num_titles)\n end",
"def setOwners(owners)\r\n\t\t\t\t\t@owners = owners\r\n\t\t\t\tend",
"def set_owner\n @owner = Owner.find_by(name: params[:owner_name])\n unless @owner.present?\n head 404 and return\n end\n end",
"def index\n @owners = Owner.all\n render json: @owners, include: [], adapter: :json\n end",
"def create\n @organization = Organization.new(name: params[:name], owner: params[:username]) #owner: params[:username]\n if @organization.save\n #binding.pry\n @owner = @organization.employees.new(username: params[:username], \n password: params[:password], \n organization_id: @organization.id,\n email: params[:email],\n admin: true)\n if @owner.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @owner.errors.full_messages }, status: :unprocessable_entity\n end\n\n else\n render json: { errors: @organization.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\n @user = User.new(params[:user])\n owner = @user.build_owner(params[:managed_object_id]) \n\n respond_to do |format|\n if @user.save\n owner.user = @user\n owner.save\n @user.owner = owner\n @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ownership = ownerships.new(params[:ownership])\n puts @ownership.inspect\n\n respond_to do |format|\n if @ownership.save\n format.html { redirect_to my_games_path, notice: 'Your game was successfully added.' }\n format.json { render json: @ownership, status: :created, location: @ownership }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ownership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reservation_owner = ReservationOwner.new(reservation_owner_params)\n\n respond_to do |format|\n if @reservation_owner.save\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully created.' }\n format.json { render :show, status: :created, location: @reservation_owner }\n else\n format.html { render :new }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owner_params\n params.require(:owner).permit(:cpf_cnpj, :rg, :data_emissao, :orgao_emissor, :nome, :fantasia, :inscricao_estadual, :instricao_municipal,\n :endereco, :numero, :complemento, :bairro, :cidade, :estado, :cep, :obs, \n emails_attributes: [:setor, :contato, :email, :comprovante, :id, :_destroy],\n contacts_attributes: [:contact, :tipo, :nome, :fone, :complemento, :id, :_destroy],\n ownerships_attributes: [:vehicle_id, :id, :_destroy]\n )\n end",
"def create_owner\n begin\n @owner = BoatOwner.new(params[:boat_owner])\n @owner.save!\n flash[:notice] = \"New boat owner created\"\n rescue Exception => e\n RAILS_DEFAULT_LOGGER.info \"error creating boat owner: #{e}\"\n flash[:error] = \"Unable to create boat owner: #{e}\"\n end\n\n return redirect_to(:action => :index)\n end",
"def add_owner(owner_ID)\n if @owners[0] == nil\n @owners = [owner_ID]\n else\n @owners << owner_ID\n end\n end",
"def add_owner(owner_ID)\n if @owners[0] == nil\n @owners = [owner_ID]\n else\n @owners << owner_ID\n end\n end",
"def owner_params\n params.fetch(:owner, {})\n end",
"def new\n @owner = Owner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def owners\n @obj['owners']\n end",
"def create\n @testbed_owner = TestbedOwner.new(params[:testbed_owner])\n\n respond_to do |format|\n if @testbed_owner.save\n format.html { redirect_to @testbed_owner, notice: 'Testbed owner was successfully created.' }\n format.json { render json: @testbed_owner, status: :created, location: @testbed_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testbed_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def filter_owners(path, unknown_owners)\n owners = { clients: [], users: [] }\n unknown_owners.each do |entity|\n if path[0] == \"organizations\" && path.length > 2\n begin\n data.get([\"organizations\", path[1], \"clients\", entity])\n owners[:clients] |= [ entity ]\n rescue\n owners[:users] |= [ entity ]\n end\n else\n owners[:users] |= [ entity ]\n end\n end\n owners\n end",
"def add_owner(user)\n user = User.get_user(user, client)\n response = client.post \"/owners/?actor_token=#{CGI.escape client.system_token}\", {:jid => user.jid}\n if response.success?\n true\n else\n raise APIException.new(response.body)\n end\n end",
"def post_scrapers_id_owners(scraper_target_id, add_resource_member_request_body, opts = {})\n data, _status_code, _headers = post_scrapers_id_owners_with_http_info(scraper_target_id, add_resource_member_request_body, opts)\n data\n end",
"def set_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def update\n redirect_to :owners #no permit\n end",
"def create\n # these lines must be out of the if statement otherwise it doesnt find the id from the url to assign to devise. Ideally they should be inside so validation could be added. Since ran out of time to do validation then better to have it working. \n @owner_user = current_owner_user\n @owner = Owner.create(owner_params)\n @owner_user.owner = @owner\n\n if @owner.save\n redirect_to owners_path\n else\n render :new\n end\n end",
"def assigned_owner_params\n params.require(:assigned_owner).permit(:task_id, :owner_id)\n end",
"def create\n owner = User.find_or_create params[:owner_id]\n name = params[:name]\n\n lobby = Lobby.create! owner: owner, name: name\n render json: lobby.as_json( only: [:id, :name] )\n end",
"def create\n @owner = Owner.new(owner_params)\n qrcode = RQRCode::QRCode.new(@owner.recipient_name)\n png = qrcode.as_png(\n resize_gte_to: false,\n resize_exactly_to: 120,\n fill: 'white',\n color: 'black',\n border_modules: 4,\n module_px_size: 6,\n file: nil # path to write\n )\n @owner.qr_code = png.to_string\n\n Owner.delete_all if Owner.count > 0\n respond_to do |format|\n if @owner.save\n format.html { redirect_to template_owners_path, notice: 'Owner was successfully created.' }\n format.json { render :show, status: :created, location: @owner }\n else\n format.html { render :new }\n format.json { render json: owners_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @howner = Howner.new(params[:howner])\n\n respond_to do |format|\n if @howner.save\n format.html { redirect_to @howner, notice: 'Howner was successfully created.' }\n format.json { render json: @howner, status: :created, location: @howner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @howner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owners_count=(value)\n @owners_count = value\n end",
"def create\n\t\t@owner = Prover.find(params[:owner])\n\t\t@owner.follow(Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def new\n @owner = Owner.new\n @owner.build_owner_address\n @owner.owner_contacts.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @owner }\n end\n end",
"def create\n @total_owner = TotalOwner.new(params[:total_owner])\n\n respond_to do |format|\n if @total_owner.save\n format.html { redirect_to(@total_owner, :notice => 'Total owner was successfully created.') }\n format.xml { render :xml => @total_owner, :status => :created, :location => @total_owner }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @total_owner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def get_owner_info(owner)\n get(\"/owners/#{owner}/info\")\n end",
"def post_telegrafs_id_owners(telegraf_id, add_resource_member_request_body, opts = {})\n data, _status_code, _headers = post_telegrafs_id_owners_with_http_info(telegraf_id, add_resource_member_request_body, opts)\n data\n end",
"def add_owner_ids(ids)\r\n return if ids.nil?\r\n \r\n ids = [ids] unless ids.respond_to?(:each)\r\n ids.each do | id |\r\n @request.OwnerIDList.Add(id)\r\n end\r\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def create\n @business_owner = BusinessOwner.new(business_owner_params)\n\n respond_to do |format|\n if @business_owner.save\n format.html { redirect_to @business_owner, notice: 'Business owner was successfully created.' }\n format.json { render :show, status: :created, location: @business_owner }\n else\n format.html { render :new }\n format.json { render json: @business_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n @user.owner_id = current_owner.id\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: '情報を登録しました' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_owner = StoreOwner.new(params[:store_owner])\n\n authorize! :create, @store_owner\n\n @users = @group.users\n respond_to do |format|\n if @store_owner.save\n format.html { redirect_to group_store_path(@group,@store), notice: 'Store Owner was successfully created.' }\n format.json { render json: @store_owner, status: :created, location: @store_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def number_of_owners\n (additional_owners || []).length + 1\n end",
"def post_orgs_id_owners_with_http_info(org_id, add_resource_member_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_orgs_id_owners ...'\n end\n # verify the required parameter 'org_id' is set\n if @api_client.config.client_side_validation && org_id.nil?\n fail ArgumentError, \"Missing the required parameter 'org_id' when calling UsersApi.post_orgs_id_owners\"\n end\n # verify the required parameter 'add_resource_member_request_body' is set\n if @api_client.config.client_side_validation && add_resource_member_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'add_resource_member_request_body' when calling UsersApi.post_orgs_id_owners\"\n end\n # resource path\n local_var_path = '/orgs/{orgID}/owners'.sub('{' + 'orgID' + '}', CGI.escape(org_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(add_resource_member_request_body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwner'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.post_orgs_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_orgs_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_owner_member\n self.organizations << self.owner\n end",
"def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end",
"def object_owner_params\n params.require(:object_owner).permit(:firstname, :lastname, :email)\n end",
"def select_owner(*owners)\n owner_select.click\n wait_for_owner_options\n owners.each do |owner|\n owner_options(text: /\\A#{owner}\\Z/).first.click\n end\n page.find(\"body\").click\n wait_until_owner_options_invisible\n end",
"def owner=(new_owner)\n if new_owner\n attributes[:owner] = {\n :display_name => new_owner['DisplayName'],\n :id => new_owner['ID']\n }\n end\n end",
"def post_scrapers_id_owners_with_http_info(scraper_target_id, add_resource_member_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_scrapers_id_owners ...'\n end\n # verify the required parameter 'scraper_target_id' is set\n if @api_client.config.client_side_validation && scraper_target_id.nil?\n fail ArgumentError, \"Missing the required parameter 'scraper_target_id' when calling UsersApi.post_scrapers_id_owners\"\n end\n # verify the required parameter 'add_resource_member_request_body' is set\n if @api_client.config.client_side_validation && add_resource_member_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'add_resource_member_request_body' when calling UsersApi.post_scrapers_id_owners\"\n end\n # resource path\n local_var_path = '/scrapers/{scraperTargetID}/owners'.sub('{' + 'scraperTargetID' + '}', CGI.escape(scraper_target_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(add_resource_member_request_body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwner'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.post_scrapers_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_scrapers_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def choose_owner(owner)\n @paragraf = owner.comments.new(comment_params)\n respond_to do |format|\n if @paragraf.save\n format.html { redirect_to owner, notice: 'Comment was successfully created.' }\n format.json { render json: [owner, @paragraf], status: :created, location: [owner, @paragraf] }\n else\n format.html { render :new }\n format.json { render json: @paragraf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owned_by\n HubEdos::StudentApi::V2::AcademicPolicy::AdministrativeOwners.new(@data['ownedBy'])\n end",
"def find_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def index\n @assigned_owners = AssignedOwner.all\n end",
"def create\n @company_owner = CompanyOwner.new(company_owner_params)\n\n respond_to do |format|\n if @company_owner.save\n format.html { redirect_to @company_owner, notice: 'Company owner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @company_owner }\n else\n format.html { render action: 'new' }\n format.json { render json: @company_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @owners = Owner.all\n render 'frontend/owners/index'\n end",
"def owner_params\n params.require(:owner).permit(:header, :title, :subtitle, :recipient_name, :first_paragraph,\n :second_paragraph, :first_assignatory_name , :first_assignatory_position, \n :second_assignatory_name, :second_assignatory_position, :logo)\n end",
"def create\n @owner_property = OwnerProperty.new(owner_property_params)\n @owner.ownerProperties << @owner_property\n\n respond_to do |format|\n if @owner_property.save\n format.html { redirect_to [@owner, @owner_property], notice: 'Owner property was successfully created.' }\n format.json { render :show, status: :created, location: @owner_property }\n else\n format.html { render :new }\n format.json { render json: @owner_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ownerships = ownerships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ownerships }\n end\n end",
"def create\n @product_owner = ProductOwner.new(params[:product_owner])\n\n respond_to do |format|\n if @product_owner.save\n format.html { redirect_to @product_owner, notice: 'Product owner was successfully created.' }\n format.json { render json: @product_owner, status: :created, location: @product_owner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n pt = params[:owner]\n @owner = Owner.new(pt)\n @owner.house_id = params[:house] || pt[:house_id]\n if @owner.save\n @house = @owner.house\n @house.owner_name = @owner.name\n @house.receive_time = Date.today\n @house.save\n redirect_to({:controller=>:houses,:action=>:index, :plot_id=>@house.plot_id,:house_code=>@house.house_code}, :notice => '添加业主成功')\n else\n render :action => \"new\"\n end\n end",
"def destroy\n @owner.destroy\n respond_to do |format|\n format.html { redirect_to owners_url }\n format.json { head :no_content }\n end\n end",
"def index\n @reservation_owners = ReservationOwner.all\n end",
"def post_orgs_id_owners(org_id, add_resource_member_request_body, opts = {})\n data, _status_code, _headers = post_orgs_id_owners_with_http_info(org_id, add_resource_member_request_body, opts)\n data\n end",
"def creator_params\n params.require(:creator).permit(:name)\n end",
"def creator_params\n params.require(:creator).permit(:name)\n end",
"def show\n @pre_with_owner = Array.new\n @pre = Pre.find(params[:id])\n @pre_with_owner.push @pre\n @pre_with_owner.push User.find(@pre.owner)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pre_with_owner }\n end\n end",
"def reservation_owner_params\n params.require(:reservation_owner).permit(:firstname, :lastname, :email)\n end",
"def getOwners\r\n\t\t\t\t\treturn @owners\r\n\t\t\t\tend",
"def index\n @object_owners = ObjectOwner.all\n end",
"def destroy\n redirect_to :owners #no permit\n end",
"def post_buckets_id_owners_with_http_info(bucket_id, add_resource_member_request_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_buckets_id_owners ...'\n end\n # verify the required parameter 'bucket_id' is set\n if @api_client.config.client_side_validation && bucket_id.nil?\n fail ArgumentError, \"Missing the required parameter 'bucket_id' when calling UsersApi.post_buckets_id_owners\"\n end\n # verify the required parameter 'add_resource_member_request_body' is set\n if @api_client.config.client_side_validation && add_resource_member_request_body.nil?\n fail ArgumentError, \"Missing the required parameter 'add_resource_member_request_body' when calling UsersApi.post_buckets_id_owners\"\n end\n # resource path\n local_var_path = '/buckets/{bucketID}/owners'.sub('{' + 'bucketID' + '}', CGI.escape(bucket_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Zap-Trace-Span'] = opts[:'zap_trace_span'] if !opts[:'zap_trace_span'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(add_resource_member_request_body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourceOwner'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['header']\n\n new_options = opts.merge(\n :operation => :\"UsersApi.post_buckets_id_owners\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_buckets_id_owners\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @pool = Pool.new(pool_params)\n @pool.owner = @current_user\n @pool.users.push @current_user\n\n respond_to do |format|\n if @pool.save\n format.html { redirect_to pool_path(@pool), notice: 'Aggregator was successfully created.' }\n format.json { render action: 'show', status: :created, location: pool_path(@pool) }\n else\n format.html { render action: 'new' }\n format.json { render json: @pool.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @album_owned = AlbumOwned.new(params[:album_owned])\n\n respond_to do |format|\n if @album_owned.save\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully created.' }\n format.json { render json: @album_owned, status: :created, location: @album_owned }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owners_count\n return @owners_count\n end",
"def create\n if @owner.nil?\n respond_to do |format|\n format.js { render json: { notice: { base: ['Pass Not Found'] } } }\n end\n\n else\n @visit = Visit.new(owner: @owner)\n\n respond_to do |format|\n if @visit.save\n format.js { render json: { notice: \"#{@owner} successfully checked-in.\", checked_in: true } }\n else\n format.js { render json: { notice: @visit.errors } }\n end\n end\n end\n end",
"def create\n set_owners\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.60953623",
"0.60838795",
"0.6043591",
"0.60373044",
"0.60368097",
"0.6026707",
"0.601686",
"0.5992585",
"0.59917057",
"0.5977048",
"0.5946255",
"0.5946255",
"0.59343743",
"0.593358",
"0.59195745",
"0.59077924",
"0.5901426",
"0.58800423",
"0.5864453",
"0.586069",
"0.5856563",
"0.58550525",
"0.5784493",
"0.57557017",
"0.57404643",
"0.57221645",
"0.57026243",
"0.5684058",
"0.5680786",
"0.5680371",
"0.56716007",
"0.56531346",
"0.56344146",
"0.5631971",
"0.5625536",
"0.5625536",
"0.5625536",
"0.5625536",
"0.5625536",
"0.5625536",
"0.5625536",
"0.5622746",
"0.56091845",
"0.5603412",
"0.5599838",
"0.5595335",
"0.55934066",
"0.5592227",
"0.55847144",
"0.5582308",
"0.5577761",
"0.55768484",
"0.5576501",
"0.5573557",
"0.55481845",
"0.55450445",
"0.5532982",
"0.5529548",
"0.55279994",
"0.55169773",
"0.55042195",
"0.550334",
"0.5500585",
"0.54951435",
"0.54926205",
"0.548621",
"0.548612",
"0.548612",
"0.5485454",
"0.54841846",
"0.54804623",
"0.54707754",
"0.54629594",
"0.546269",
"0.5441945",
"0.54338944",
"0.54289275",
"0.54274577",
"0.54216915"
] |
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 { render json: owners_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to edit_owner_path(@owner), notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to edit_owner_path, notice: 'Owner was successfully updated.' }\n # format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n # format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n # format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n format.html { redirect_to owners_path, notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to :owners #no permit\n end",
"def update\n respond_to do |format|\n if @object_owner.update(object_owner_params)\n format.html { redirect_to @object_owner, notice: 'Object owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @object_owner }\n else\n format.html { render :edit }\n format.json { render json: @object_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @owner = Owner.find(params[:id])\n @owner.house.owner_name = @owner.name\n if @owner.update_attributes(params[:owner])\n redirect_to(owners_url, :notice => '更新业主信息成功')\n else\n render :action => \"edit\"\n end\n end",
"def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n flash[:notice] = 'Proprietario atualizado com sucesso'\n format.html { redirect_to :action => 'show', :id => @owner.id}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @owners = args[:owners] if args.key?(:owners)\n @readers = args[:readers] if args.key?(:readers)\n @writers = args[:writers] if args.key?(:writers)\n end",
"def update\n respond_to do |format|\n if @assigned_owner.update(assigned_owner_params)\n format.html { redirect_to @assigned_owner, notice: 'Assigned owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @assigned_owner }\n else\n format.html { render :edit }\n format.json { render json: @assigned_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owner_params\n params.require(:owner).permit(:name, :owner_user_id)\n end",
"def update\n run_callbacks :update do\n method = self.class.method_for(:update)\n path = request_path(:_owner_path => @owner_path)\n self.class.request(to_params.merge(:_method => method, :_path => path)) do |response|\n load_attributes_from_response(response)\n end\n end\n end",
"def set_owner\n @owner = Owner.find_by(name: params[:owner_name])\n unless @owner.present?\n head 404 and return\n end\n end",
"def update\n respond_to do |format|\n if @reservation_owner.update(reservation_owner_params)\n format.html { redirect_to @reservation_owner, notice: 'Reservation owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @reservation_owner }\n else\n format.html { render :edit }\n format.json { render json: @reservation_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testbed_owner = TestbedOwner.find(params[:id])\n\n respond_to do |format|\n if @testbed_owner.update_attributes(params[:testbed_owner])\n format.html { redirect_to @testbed_owner, notice: 'Testbed owner was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testbed_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_owner\n @owner = Owner.find(params[:owner_id])\n end",
"def update\n @total_owner = TotalOwner.find(params[:id])\n\n respond_to do |format|\n if @total_owner.update_attributes(params[:total_owner])\n format.html { redirect_to(@total_owner, :notice => 'Total owner was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @total_owner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ownership = ownerships.find(params[:id])\n\n respond_to do |format|\n if @ownership.update_attributes(params[:ownership])\n format.html { redirect_to my_games_path, notice: 'Your game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ownership.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @owners = args[:owners] if args.key?(:owners)\n @site = args[:site] if args.key?(:site)\n end",
"def update\n @howner = Howner.find(params[:id])\n\n respond_to do |format|\n if @howner.update_attributes(params[:howner])\n format.html { redirect_to @howner, notice: 'Howner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @howner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_owner(organization, owner_id)\n if owner_id\n new_owner = User.find(owner_id)\n\n unless new_owner.owns\n new_owner.organization = organization\n new_owner.save\n end\n end\n end",
"def update_owner(owner_id, owner_name)\n\t\tif not ActiveRecord::Base.connection.table_exists? 'model_owners'\n\t\t\treturn\n\t\tend\n\t\towner = ModelOwner.where(:inki_model_name => self.class.table_name, :model_id => self.id).first\n\t\tif owner and owner.model_owner_id == owner_id \n\t\t\treturn\n\t\telsif owner # owner exists, but the owner just changed\n\t\t\towner.model_owner_name = owner_name\n\t\t\towner.model_owner_id = owner_id\n\t\t\towner.save\n\t\telse # owner does not exist, create it\n\t\t\tModelOwner.create(:inki_model_name => self.class.table_name, :model_id => self.id, :model_owner_name => owner_name, :model_owner_id => owner_id)\n\t\tend\n\tend",
"def update\n @ticket_owner = TicketOwner.find(params[:id])\n\n respond_to do |format|\n if @ticket_owner.update_attributes(params[:ticket_owner])\n format.html { redirect_to @ticket_owner, notice: 'Ticket Owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ticket_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setOwners(owners)\r\n\t\t\t\t\t@owners = owners\r\n\t\t\t\tend",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def set_owner\n @owner = Owner.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @company_owner.update(company_owner_params)\n format.html { redirect_to @company_owner, notice: 'Company owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @property_owner.update(property_owner_params)\n format.html { redirect_to @property_owner, notice: 'Property owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(event_owner_params)\n format.html { redirect_to @event, notice: 'Event successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owners=(value)\n @owners = value\n end",
"def update_owner(user)\n self.notify = true if self.owner != user\n self.owner = user unless user.nil?\n self.save\n end",
"def update\n @product_owner = ProductOwner.find(params[:id])\n\n respond_to do |format|\n if @product_owner.update_attributes(params[:product_owner])\n format.html { redirect_to @product_owner, notice: 'Product owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @thing = Thing.find(params[:id])\n params[:thing][:place_id] = place_id_from_form\n params[:thing][:owner_ids] = [ ] if params[:thing][:owner_ids].nil?\n params[:thing][:keeper_ids] = [ ] if params[:thing][:keeper_ids].nil?\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to(@thing, :notice => 'Thing was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @project_owner = args[:project_owner] if args.key?(:project_owner)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n end",
"def update\n respond_to do |format|\n if @business_owner.update(business_owner_params)\n format.html { redirect_to @business_owner, notice: 'Business owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_owner }\n else\n format.html { render :edit }\n format.json { render json: @business_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @owner_patient = OwnerPatient.find(params[:id])\n\n respond_to do |format|\n if @owner_patient.update_attributes(params[:owner_patient])\n format.html { redirect_to @owner_patient, notice: 'Owner patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner_patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @organization.remove_members(params[:organization][:user_ids])\n\n if @organization.update_attributes(check_owner(organization_params))\n\n update_owner(@organization, organization_params[:owner_id])\n @organization.notify_and_update_classes\n\n redirect_to @organization, notice: 'Organization was successfully updated.'\n else\n set_errors_render(@organization, :edit)\n end\n end",
"def update\n respond_to do |format|\n if @owner_property.update(owner_property_params)\n format.html { redirect_to [@owner, @owner_property], notice: 'Owner property was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner_property }\n else\n format.html { render :edit }\n format.json { render json: @owner_property.errors, status: :unprocessable_entity }\n end\n end\n end",
"def change_owner\n @seminar = Seminar.find(params[:id])\n @teacher = Teacher.find(params[:new_owner])\n \n @seminar.update(:owner => @teacher)\n SeminarTeacher.find_or_create_by(:user => @teacher, :seminar => @seminar).update(:can_edit => true)\n \n flash[:success] = \"Class Owner Updated\"\n redirect_to @seminar\n end",
"def set_owner(ownername)\n @result.owner = ownername\n end",
"def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end",
"def owner_params\n params.require(:owner).permit(:cpf_cnpj, :rg, :data_emissao, :orgao_emissor, :nome, :fantasia, :inscricao_estadual, :instricao_municipal,\n :endereco, :numero, :complemento, :bairro, :cidade, :estado, :cep, :obs, \n emails_attributes: [:setor, :contato, :email, :comprovante, :id, :_destroy],\n contacts_attributes: [:contact, :tipo, :nome, :fone, :complemento, :id, :_destroy],\n ownerships_attributes: [:vehicle_id, :id, :_destroy]\n )\n end",
"def update!(**args)\n @expected_origins = args[:expected_origins] if args.key?(:expected_origins)\n @name = args[:name] if args.key?(:name)\n @rp_id = args[:rp_id] if args.key?(:rp_id)\n end",
"def update\n respond_to do |format|\n if @product_owner.update(product_owner_params)\n format.html { redirect_to @product_owner, notice: 'Product owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_owner }\n else\n format.html { render :edit }\n format.json { render json: @product_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to_update({thing: @author})\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def owner_params\n params.require(:owner).permit(:first_name, :last_name, :street, :city, :state, :zip, :phone, :email, :active)\n end",
"def owner_params\n params.require(:owner).permit(:nombre, :tipo, :clave, :pe)\n end",
"def set_owner(id)\n self.owner_id = id\n end",
"def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n project_params[:owner_id] = current_user[:id] if project_params[:owner_id].nil? or not current_user.is_admin?\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_url, notice: 'Project was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @conflicting_ownership = args[:conflicting_ownership] if args.key?(:conflicting_ownership)\n @territory = args[:territory] if args.key?(:territory)\n end",
"def update\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n if @album_owned.update_attributes(params[:album_owned])\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end",
"def owner=(new_owner)\n if new_owner\n attributes[:owner] = {\n :display_name => new_owner['DisplayName'],\n :id => new_owner['ID']\n }\n end\n end",
"def update\n @call_list_owner = CallListOwner.find(params[:id])\n\n respond_to do |format|\n if @call_list_owner.update_attributes(params[:call_list_owner])\n format.html { redirect_to @call_list_owner, :notice => 'Call list owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @call_list_owner.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n find_params = document_review_owner_params.slice(:user_id, :project_id)\n review_owner = DocumentReviewOwner.find_or_initialize_by(find_params)\n authorize! :update, review_owner\n review_owner.assign_attributes(document_review_owner_params)\n if review_owner.save\n render json: review_owner\n else\n render json: review_owner.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @requester.update(requester_params)\n format.html { redirect_to @requester, notice: 'Requester was successfully updated.' }\n format.json { render :show, status: :ok, location: @requester }\n else\n format.html { render :edit }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @location_name = args[:location_name] if args.key?(:location_name)\n @ownership = args[:ownership] if args.key?(:ownership)\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end",
"def update\n @reward_owner.update(reward_owner_params)\n @reward_owner = RewardOwner.new\n @reward_owners = RewardOwner.all\n end",
"def update\n respond_to do |format|\n if @expense_owner.update(expense_owner_params)\n format.html { redirect_to @expense_owner, notice: 'Expense owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @expense_owner }\n else\n format.html { render :edit }\n format.json { render json: @expense_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n respond_to do |format|\n if @shop_owner.update(shop_owner_params)\n format.html { redirect_to @shop_owner, notice: 'Shop owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @shop_owner }\n else\n format.html { render :edit }\n format.json { render json: @shop_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @owner_commission.update(owner_commission_params)\r\n format.html { redirect_to @owner_commission, notice: 'Owner commission was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @owner_commission.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if self.user_owner? && @user.update(user_params)\n format.html { redirect_to @user, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def owner_params\n params.fetch(:owner, {})\n end",
"def update!(**args)\n @bbox = args[:bbox] if args.key?(:bbox)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @creator_email = args[:creator_email] if args.key?(:creator_email)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @last_modified_time = args[:last_modified_time] if args.key?(:last_modified_time)\n @last_modifier_email = args[:last_modifier_email] if args.key?(:last_modifier_email)\n @name = args[:name] if args.key?(:name)\n @project_id = args[:project_id] if args.key?(:project_id)\n @resource = args[:resource] if args.key?(:resource)\n @tags = args[:tags] if args.key?(:tags)\n @type = args[:type] if args.key?(:type)\n @writers_can_edit_permissions = args[:writers_can_edit_permissions] if args.key?(:writers_can_edit_permissions)\n end",
"def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def update\n resource_path = \"/projects/#{project_id}/people/#{id}\"\n Request.put(resource_path, self.to_xml('person'))\n end",
"def update\n @employee = current_owner.employees.find(params[:id])\n puts \"#{params}\"\n respond_to do |format|\n if @employee.update_attributes(params[:employee])\n format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @canonical_name = args[:canonical_name] if args.key?(:canonical_name)\n @country_code = args[:country_code] if args.key?(:country_code)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @parent_geo_target = args[:parent_geo_target] if args.key?(:parent_geo_target)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n @target_type = args[:target_type] if args.key?(:target_type)\n end",
"def update\n @brand_owner = BrandOwner.find(params[:id])\n\n respond_to do |format|\n if @brand_owner.update_attributes(params[:brand_owner])\n format.html { redirect_to @brand_owner, notice: 'Brand owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brand_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bob = Bob.find(params[:id])\n\n respond_to do |format|\n if @bob.update_attributes(params[:bob])\n format.html { redirect_to @bob, notice: 'Bob was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bob.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @actor = args[:actor] if args.key?(:actor)\n @etag = args[:etag] if args.key?(:etag)\n @events = args[:events] if args.key?(:events)\n @id = args[:id] if args.key?(:id)\n @ip_address = args[:ip_address] if args.key?(:ip_address)\n @kind = args[:kind] if args.key?(:kind)\n @owner_domain = args[:owner_domain] if args.key?(:owner_domain)\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def create\n @owner = Owner.new(owner_params)\n @owner.id = Owner.all.last.id + 1 #manually set id\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 format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @orphan.update(orphan_params)\n format.html { redirect_to @orphan, notice: 'Orphan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @orphan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @reader = args[:reader] if args.key?(:reader)\n @writer = args[:writer] if args.key?(:writer)\n end",
"def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end",
"def update\n @team = Team.find(params[:id])\n @player = Player.find(params[:player_id])\n if @player.access_key == params[:access_key] && (@team.leader_id == @player.id || @team.game.owner_id == @player.id) then\n @team.name = params[:name]\n @team.leader_id = params[:leader_id]\n\n respond_to do |format|\n if @team.save\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n format.json { render :json => @team.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :unauthorized\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def owner_params\n params.require(:owner).permit(:name, :name_kana, :post_code, :address, :tel, :tel2, :fax, :property_name, :property_name_kana, :property_post_code, :property_address, :property_type, :bank, :branch, :account_type, :account_num, :account_name, :memo)\n end",
"def update\n respond_to do |format|\n params[:patient][:owner_id] = devise_current_user.id.to_s \n if @patient.update(patient_params)\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { render :show, status: :ok, location: @patient }\n else\n format.html { render :edit }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @owners = Owner.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @owners }\n end\n end",
"def update!(**args)\n @api_version = args[:api_version] if args.key?(:api_version)\n @block_owner_deletion = args[:block_owner_deletion] if args.key?(:block_owner_deletion)\n @controller = args[:controller] if args.key?(:controller)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @uid = args[:uid] if args.key?(:uid)\n end",
"def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @waiter.update(waiter_params.slice(:name, :email, :mobile))\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('updated',@waiter) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end"
] |
[
"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.59926564",
"0.59463876",
"0.59392446",
"0.5929472",
"0.5924645",
"0.5923343",
"0.5923343",
"0.5923343",
"0.5923343",
"0.5923343",
"0.5923343",
"0.5923343",
"0.5919694",
"0.589919",
"0.58863616",
"0.58665633",
"0.586069",
"0.5858608",
"0.5844424",
"0.58350295",
"0.5823166",
"0.5816171",
"0.5783739",
"0.57835203",
"0.5772411",
"0.5760815",
"0.5751568",
"0.5751463",
"0.57512003",
"0.5749724",
"0.57470644",
"0.5741186",
"0.5731318",
"0.571919",
"0.571598",
"0.5709685",
"0.56986684",
"0.5689988",
"0.56887305",
"0.5688716",
"0.56850606",
"0.5684636",
"0.56797713",
"0.56568545",
"0.5638861",
"0.56351864",
"0.56338865",
"0.5620693",
"0.5616944",
"0.56019926",
"0.55976945",
"0.5586294",
"0.55820847",
"0.55790144",
"0.5575431",
"0.55707324",
"0.55620074",
"0.5561476",
"0.5544665",
"0.5541086",
"0.5538635",
"0.5533733",
"0.5519273",
"0.5515286",
"0.55148655",
"0.551248",
"0.5510247",
"0.55076474",
"0.5505456",
"0.54966974",
"0.5496029",
"0.54952675",
"0.5493283",
"0.54908395",
"0.54894245",
"0.5485469",
"0.5468891",
"0.54668486",
"0.54639935"
] |
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, notice: 'Owner was successfully removed.' }\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, notice: 'Owner was successfully deleted.' }\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, notice: 'Owner was successfully destroyed.' }\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, notice: 'Owner was successfully destroyed.' }\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, notice: 'Owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(owner_id, name)\n @user.delete([@base_uri, owner_id, name].join(\"/\"))\n end",
"def destroy\n @owner = Owner.find(params[:id])\n @owner.destroy\n\n respond_to do |format|\n format.html { redirect_to owners_path, notice: 'Oferta a fost stearsa cu success.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @howner = Howner.find(params[:id])\n @howner.destroy\n\n respond_to do |format|\n format.html { redirect_to howners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @total_owner = TotalOwner.find(params[:id])\n @total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(total_owners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testbed_owner = TestbedOwner.find(params[:id])\n @testbed_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to testbed_owners_url }\n format.json { head :ok }\n end\n end",
"def destroy\n redirect_to :owners #no permit\n end",
"def destroy\n @object_owner.destroy\n respond_to do |format|\n format.html { redirect_to object_owners_url, notice: 'Object owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assigned_owner.destroy\n respond_to do |format|\n format.html { redirect_to assigned_owners_url, notice: 'Assigned owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @owner_patient = OwnerPatient.find(params[:id])\n @owner_patient.destroy\n\n respond_to do |format|\n format.html { redirect_to owner_patients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @owner = Owner.find(params[:id])\n if owner\n @house = @owner.house\n @house.owner_name = nil\n @house.save\n @owner.destroy\n end\n redirect_to houses_path\n end",
"def destroy\n @company_owner.destroy\n respond_to do |format|\n format.html { redirect_to company_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reservation_owner.destroy\n respond_to do |format|\n format.html { redirect_to reservation_owners_url, notice: 'Reservation owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @call_list_owner = CallListOwner.find(params[:id])\n @call_list_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to call_list_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ownership = ownerships.find(params[:id])\n @ownership.destroy\n\n respond_to do |format|\n format.html { redirect_to my_games_path, notice: 'Your game was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_owners\n @rachel.destroy\n @mark.destroy\n @alex.destroy\n end",
"def destroy\n @album_owned = AlbumOwned.find(params[:id])\n @album_owned.destroy\n\n respond_to do |format|\n format.html { redirect_to album_owneds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @u = U.find_by_name(params[:id])\n @u.destroy\n\n respond_to do |format|\n format.html { redirect_to us_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n arguments(args, required: [:org_name, :user])\n\n delete_request(\"/orgs/#{arguments.org_name}/members/#{arguments.user}\",\n arguments.params)\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.own_servers.length == 0\n if @user.destroy\n render \"/api/users/show\"\n else\n render json: @user.errors.full_messages, status: 422\n end\n else\n render json: [\"Please transfer ownership of all servers or delete all servers your own\"], status: 403\n end\n end",
"def destroy\n @brand_owner = BrandOwner.find(params[:id])\n @brand_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to brand_owners_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @product_owner = ProductOwner.find(params[:id])\n @product_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to product_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ticket_owner = TicketOwner.find(params[:id])\n @ticket_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to ticket_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @owner_commission.destroy\r\n respond_to do |format|\r\n format.html { redirect_to owner_commissions_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @property_owner.destroy\n respond_to do |format|\n format.html { redirect_to property_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_owner.destroy\n respond_to do |format|\n format.html {redirect_to root_path, notice: 'Business owner was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @expense_owner.destroy\n respond_to do |format|\n format.html { redirect_to expense_owners_url, notice: 'Expense owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_owner.destroy\n respond_to do |format|\n format.html { redirect_to @business_owner, notice: 'Business owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_owner.destroy\n respond_to do |format|\n format.html { redirect_to shop_owners_url, notice: 'Shop owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_owner = StoreOwner.find(params[:id])\n\n authorize! :destroy, @store_owner\n\n @store_owner.destroy\n\n respond_to do |format|\n flash[:notice] = \"Store Owner #{@store_owner.user.display_name} was removed.\"\n format.html { redirect_to group_store_path(@group, @store) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @owner = User.find(params[:id])\n @scooter = Scooter.find(params[:id])\n @scooter.destroy\n redirect_to owner_dashboard\n end",
"def destroy\n @stakeholder.destroy\n respond_to do |format|\n format.html { redirect_to stakeholders_url, notice: 'User deleted.' }\n format.json { head :no_content }\n end\n end",
"def remove_project_owner(optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:pattern] = '/projects/removeOwner'\n\t\targs[:query]['Action'] = 'RemoveProjectOwner'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :owners\n\t\t\targs[:query]['Owners'] = optional[:owners]\n\t\tend\n\t\tif optional.key? :project_name\n\t\t\targs[:query]['ProjectName'] = optional[:project_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy\n @car_total_owner = CarTotalOwner.find(params[:id])\n @car_total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(car_total_owners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n author = Author.find params[:author_id]\n author_name = AuthorName.find params[:id]\n author_name.delete\n # Remove the author if there are no more author names that reference it\n unless AuthorName.find_by_author_id params[:author_id]\n author.delete\n end\n render json: nil\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def destroy\n @product_owner.destroy\n respond_to do |format|\n format.html { redirect_to product_owners_url, notice: 'Product owner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Users.delete(params[\"id\"])\n end",
"def delete_creator\n # somehow search for creator based on params\n # creator = Creator.where(\"provider = ? AND p_id = ?\", params[\"provider\"], params[\"p_id\"])\n # remove creator from user's list\n # self.creators.delete(creator)\n # if the creator is no longer followed, delete it\n # creator.delete if creator.users.nil?\n end",
"def destroy\n author = Author.find params[:author_id]\n author_name = AuthorName.find params[:id]\n author_name.delete\n # Remove the author if there are no more author names that reference it\n if AuthorName.find_by_author_id(params[:author_id]).nil?\n author.delete\n end\n render json: nil, content_type: 'text/html'\n end",
"def destroy\n ## note use of method chaining to combine find & destroy into one line\n Person.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @machine_total_owner = MachineTotalOwner.find(params[:id])\n @machine_total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(machine_total_owners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @unique.destroy\n respond_to do |format|\n format.html { redirect_to uniques_url, notice: 'Unique was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n @creator_accession_relationship = CreatorAccessionRelationship.find(params[:id])\n @creator_accession_relationship.destroy\n\n respond_to do |format|\n format.html { redirect_to creator_accession_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caravan_total_owner = CaravanTotalOwner.find(params[:id])\n @caravan_total_owner.destroy\n\n respond_to do |format|\n format.html { redirect_to(caravan_total_owners_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @name = Name.find(params[:id])\n @name.destroy\n\n respond_to do |format|\n format.html { redirect_to names_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if invalid_id params[:id]\n @user = User.find(params[:id])\n\n return if not_owner @user.id\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def destroy \n @oc_member = OcMember.find(params[:id])\n @oc_member.destroy\n\n respond_to do |format|\n format.html { redirect_to oc_members_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reward_owner.destroy\n @reward_owners = RewardOwner.all\n end",
"def destroy\n AlbumOwnership.find_by({album_id: @album.id, user_id: current_user.id}).destroy\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def destroy\n @bob = Bob.find(params[:id])\n @bob.destroy\n\n respond_to do |format|\n format.html { redirect_to bobs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete(@name)\n end",
"def destroy\n @subscription = Subscription.find(params[:id])\n @owner = @subscription.owner\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_url([@owner, :subscriptions]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_name_relationship.destroy\n respond_to do |format|\n format.html { redirect_to taxon_name_relationships_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trustee.destroy\n respond_to do |format|\n format.html { redirect_to trustees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end",
"def destroy\n\t@responsible.bills.each do |bill|\n\t\tbill.destroy\n\tend\n @responsible.destroy\n respond_to do |format|\n format.html { redirect_to responsibles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.user.destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Person was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_old_accounts_and_owners(model:, user_data:, **)\n accounts_data = user_data.fetch('accounts')\n owner_names = accounts_data.map { |acc| acc.fetch('owner') }\n account_ids = accounts_data.map { |acc| acc.fetch('account_id') }\n\n model.award_wallet_owners.where.not(name: owner_names).destroy_all\n model.award_wallet_accounts.where.not(aw_id: account_ids).destroy_all\n end",
"def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to admin_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person = Person.find(params[:id])\n @person.destroy if @person.users.empty?\n \n respond_to do |format|\n format.html { redirect_to(people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @followership = Followership.find(params[:id])\n @followership.destroy\n\n respond_to do |format|\n format.html { redirect_to(followerships_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @org = Org.from_param(params[:abbr])\r\n @org.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to orgs_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @caller = Caller.find(params[:id])\n @caller.destroy\n \n respond_to do |format|\n format.html { redirect_to callers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @surname = Surname.find(params[:id])\n @surname.destroy\n\n respond_to do |format|\n format.html { redirect_to surnames_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @api_v1_follower = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:id]).first\n if @api_v1_follower.destroy\n head :no_content\n else \n render json: { error: 'not allowed' }, status: 401\n end\n end",
"def destroy\n the_org = @person.org_id\n the_name = @person.name\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to org_path(the_org), status: 303, notice: t('.delete_ok', item: the_name) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qualified_info.destroy\n respond_to do |format|\n format.html { redirect_to qualified_infos_url }\n format.json { head :no_content }\n end\n end",
"def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end",
"def destroy\n @owner_invoicing_datum.destroy\n respond_to do |format|\n format.html { redirect_to owner_invoicing_data_url, notice: 'Owner invoicing datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def destroy\n head 404\n # @api_v1_following = Api::V1::Follower.where('following_id =? and user_id =?', @current_user.id, params[:id]).first\n # if @api_v1_following.destroy\n # head :no_content\n # else \n # render json: { error: 'not allowed' }, status: 401\n # end\n end",
"def destroy\n @employee = current_owner.employees.find(params[:id])\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @person.destroy\n head :no_content\n end",
"def destroy\n @reserved_username = ReservedUsername.find(params[:id])\n @reserved_username.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_reserved_usernames_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end",
"def destroy\n @requester.destroy\n respond_to do |format|\n format.html { redirect_to requesters_url, notice: 'Requester was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_person = UserPerson.find(params[:id])\n @user_person.destroy\n\n respond_to do |format|\n format.html { redirect_to user_people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uniqueid = Uniqueid.find(params[:id])\n @uniqueid.destroy\n\n respond_to do |format|\n format.html { redirect_to uniqueids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @autobus.destroy\n respond_to do |format|\n format.html { redirect_to autobuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @creator.destroy\n respond_to do |format|\n format.html { redirect_to creators_url, notice: 'Creator was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end"
] |
[
"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.6546374",
"0.65401405",
"0.65373147",
"0.6532158",
"0.65058637",
"0.65011275",
"0.6477148",
"0.64686525",
"0.64534855",
"0.6431918",
"0.64061725",
"0.63813394",
"0.6377757",
"0.6352266",
"0.63377273",
"0.6322357",
"0.63044125",
"0.63018805",
"0.6275523",
"0.6275446",
"0.6274734",
"0.6241922",
"0.62357545",
"0.6232105",
"0.62317103",
"0.6226127",
"0.6219228",
"0.6207166",
"0.6203791",
"0.61978436",
"0.61908114",
"0.618018",
"0.6170571",
"0.6169403",
"0.61663324",
"0.6159914",
"0.61544085",
"0.6148989",
"0.614249",
"0.6140453",
"0.613713",
"0.6133553",
"0.6133342",
"0.61306924",
"0.6130419",
"0.6128454",
"0.61220884",
"0.6112161",
"0.6111649",
"0.6109378",
"0.61084527",
"0.6107981",
"0.61074966",
"0.61072713",
"0.6107025",
"0.61016995",
"0.61000663",
"0.6095874",
"0.60885596",
"0.6087911",
"0.6085304",
"0.6079017",
"0.607724",
"0.6076197",
"0.60743636",
"0.60743636",
"0.6073773",
"0.6070809",
"0.60701835",
"0.6065644",
"0.60648143",
"0.6061874",
"0.605183",
"0.60514355",
"0.6049414",
"0.6046145",
"0.6045974",
"0.60429054",
"0.60396683"
] |
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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62909746",
"0.62904227",
"0.62837297",
"0.6240993",
"0.6239739",
"0.6217764",
"0.6214983",
"0.62112504",
"0.6194765",
"0.6178",
"0.61755055",
"0.61729854",
"0.61636627",
"0.6153461",
"0.6151674",
"0.61478525",
"0.6122671",
"0.61188513",
"0.61075556",
"0.6105721",
"0.6092412",
"0.6081011",
"0.6071054",
"0.6064436",
"0.6022111",
"0.6018135",
"0.60151577",
"0.60108894",
"0.60070235",
"0.60070235",
"0.6000806",
"0.6000464",
"0.5998811",
"0.59926987",
"0.5992257",
"0.5991173",
"0.5980311",
"0.59660876",
"0.59596545",
"0.5959415",
"0.59589994",
"0.5957478",
"0.5953214",
"0.5952233",
"0.5944033",
"0.59396756",
"0.59396756",
"0.59386414",
"0.59345603",
"0.5931261",
"0.5926345",
"0.5925795",
"0.59174526",
"0.59108645",
"0.5909469",
"0.5908263",
"0.59053195",
"0.58980685",
"0.5897738",
"0.589657",
"0.5895971",
"0.58942044",
"0.5892847",
"0.588742",
"0.58834344",
"0.5880024",
"0.58739793",
"0.5868253",
"0.5867907",
"0.58670515",
"0.58668053",
"0.5865756",
"0.5863549",
"0.5863236",
"0.5862728",
"0.5861283",
"0.58591247",
"0.5855159",
"0.5854291",
"0.58512247",
"0.58498096"
] |
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 weber; end",
"def public; end",
"def public; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def handle; end",
"def refutal()\n end",
"def wrapper; end",
"def suivre; end",
"def operations; end",
"def operations; end",
"def extra; end",
"def who_we_are\r\n end",
"def methods() end",
"def processor; end",
"def internal?; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def isolated; end",
"def isolated; end",
"def formation; end",
"def accessibility; end",
"def private_method; end",
"def berlioz; end",
"def r; end",
"def r; end",
"def overrides; end",
"def terpene; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def context; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def public_method; end",
"def intensifier; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def dh; end",
"def extra_state; end",
"def verdi; end",
"def identify; end",
"def final; end",
"def internal_methods; end",
"def under_construction\n end",
"def initialize\n \n end",
"def zuruecksetzen()\n end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def strategy; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end"
] |
[
"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.6639585",
"0.6593944",
"0.6585662",
"0.6582639",
"0.65769064",
"0.65769064",
"0.6547845",
"0.65234244",
"0.65126085",
"0.6504288",
"0.64570343",
"0.6359627",
"0.6359627",
"0.6359627",
"0.6359627",
"0.6358954",
"0.6358954",
"0.6353889",
"0.6291316",
"0.62757885",
"0.6270943",
"0.6266142",
"0.6266142",
"0.62643987",
"0.62526745",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240626",
"0.6240372",
"0.6240372",
"0.6240372",
"0.6230701",
"0.62239045",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6217482",
"0.6198881",
"0.61858517",
"0.6172329",
"0.6171687",
"0.6170247",
"0.61676586",
"0.6167568",
"0.6166393",
"0.6165248",
"0.61472875",
"0.61472875",
"0.61472875",
"0.61472875",
"0.6123835",
"0.61228037",
"0.61228037",
"0.61228037",
"0.61228037",
"0.61228037",
"0.61228037"
] |
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 user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n @user_groups |= current_user.groups if current_user and current_user.respond_to? :groups\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.is_osu\n @user_groups\n end",
"def users_and_groups=(value)\n @users_and_groups = value\n end",
"def user_groups\n return @user_groups if @user_groups\n @user_groups = default_user_groups\n @user_groups += RoleMapper.roles(@user)\n @user_groups\n end",
"def show_by_user\n @groups = Group.where(user_id: current_user.id)\n \n end",
"def groups\n UserGroups.new(:id => id).get.items\n end",
"def with_group_owner\n self\n end",
"def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end",
"def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n \n if administrator?(usr)\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups order by user_groups.name\n SQL\n else\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups, user_groups_users\n where user_groups.id = user_groups_users.user_group_id\n and user_groups_users.user_id = #{usr.id}\t \n order by user_groups.name\n SQL\n end\n end",
"def get_user_groups\n user_groups.keys\n end",
"def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end",
"def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n # TODO: necessary to include #hyrax_group_names?\n @user_groups |= current_user.hyrax_group_names if current_user.respond_to? :hyrax_group_names\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.roles.count.positive?\n # OVERRIDE: add the names of all user's roles to the array of user_groups\n @user_groups |= all_user_and_group_roles\n\n @user_groups\n end",
"def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n ug_table = Lockdown.user_groups_hbtm_reference.to_s\n if administrator?(usr)\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table} order by #{ug_table}.name\n SQL\n else\n usr_table = Lockdown.users_hbtm_reference.to_s\n if usr_table < ug_table\n join_table = \"#{usr_table}_#{ug_table}\"\n else\n join_table = \"#{ug_table}_#{usr_table}\"\n end\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table}, #{join_table}\n where #{ug_table}.id = #{join_table}.#{Lockdown.user_group_id_reference}\n and #{join_table}.#{Lockdown.user_id_reference} = #{usr.id}\t \n order by #{ug_table}.name\n SQL\n end\n end",
"def index\n @member_groups = @user.groups_where_member\n @admin_groups = @user.groups_where_admin\n end",
"def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end",
"def show_Users\n theUsers = User.select{ |user| user.group_id == self.id}\n theUsers\n end",
"def index\n authorize UserGroup\n @user_groups = UserGroup.all\n end",
"def users_and_groups\n return @users_and_groups\n end",
"def groups\n return @groups if @groups\n return [] if uid.nil?\n\n codes = [\"student\"]\n res = Group.where(code: codes)\n # add eduPersonAffiliation (e.g. student, faculty, staff) to groups that the user is a member of\n @groups = res + affiliations.map{ |code| Group.new(:code=>code) }\n end",
"def owner_of(group)\n current_user.is_owner?(group)\n end",
"def index\n @groups = current_user.groups\n end",
"def index\n @groups = Group.where(:user_id => current_user)\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def index\n\t\t@groups = current_user.groups\n\tend",
"def safe_select_groups\n return unless user_signed_in?\n @groups = current_user.groups\n end",
"def edit_groups\n search_by_type_and_mode(:group, ::ACL.Write).map(&:agent_name)\n end",
"def index\n @user = User.find(current_user.id)\n @groups = @user.groups.all\n end",
"def group_owner?\n super\n end",
"def group_owner?\n super\n end",
"def create\n \n @group = Group.new(group_params)\n @group.owner_id = current_user.id\n @group.users << current_user\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_groups()\n return self.groups\n end",
"def can_be_created_by?(user)\n \n not (user.usergroups & usergroups).empty?\n\n end",
"def nonmembered_groups(user)\n (LogicalAuthz::group_model.all - user.groups).map { |g| [ g.name, g.id ] }\n end",
"def set_groups(user, grouplist)\n\t\t\tend",
"def belongs_to_group\n if current_sys_user # session has been started \n if current_sys_user.hr_employee_id #only check groups for employee users, not inspectors\n # checks if employee user belongs to any group\n if !SysUserXGroup.find_by(sys_user_id: (SysUser.find_by(username: current_sys_user.username)))\n sign_out current_sys_user\n flash[:alert] = 'Usuário não pertence a nenhum grupo' \n redirect_to :action => 'new', :controller => 'devise/sessions' # Redirect to sign in page\n end\n end\n end\n end",
"def current_user_group_ids\n @current_user_group_ids ||= Manage::Group.group_ids_for current_user\n end",
"def associate_in_groups(user, org, groups)\n associate_user_with_org(org.name, user)\n groups.each do |group|\n add_user_to_group(org.name, user, group)\n end\n end",
"def ldap_groups\n User.walk_ldap_groups(User.ldap_member_of(user_key), []).sort\n end",
"def index\n @groups = Group.display_for_user(current_user)\n end",
"def create\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.create(group_params)\n @owner = current_user\n if @group.persisted?\n flash[:green] = \"Group created!\"\n redirect_to groups_path\n else\n render root_path\n end\n end",
"def group_ids\n @group_ids ||= current_user.group_ids\n end",
"def groups\n @groups ||= Groups.call(self)\n end",
"def groups()\n id_list = SQLQuery.new.get('groups_handler', ['group_id']).where.if('user_id', @id).send\n groups_list = []\n id_list.each do |id|\n groups_list << Groupchat.get(id['group_id'])\n end\n return Sorter.last_interaction(groups_list)\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def visible_groups\n @visible_groups ||= begin\n filter_visible_groups_for_user(self.current_groups)\n end\n end",
"def add_user_to_group(user, group)\n\t\t\tend",
"def show\n @owner = current_user\n @users = User.where(\"owner_id = ?\", current_user).order('name ASC')\n @group_locations = AssetLocation.where(\"owner_id = ?\", current_user).order('name ASC')\n @group = current_user.groups.find(params[:id])\n end",
"def current_user_group_ids\n container.current_user_group_ids\n end",
"def all_users\n self.users +\n User.where(institution: self.institution).\n select{ |u| u.belongs_to_user_group?(self) }\n end",
"def with_group_members\n self\n end",
"def usersInGroup\n @users = User.all\n @selected_group = Group.find(params[:selected_group])\n session[:current_group_id] = @selected_group.id\n end",
"def my_managers\n my_groups = group_users.pluck(:group_id)\n CourseUser.joins(group_users: :group).merge(Course::GroupUser.manager).\n where(Course::Group.arel_table[:id].in(my_groups)).distinct\n end",
"def index\n authorize UserGroup\n @user_groups = UserGroup.where(institution: current_institution).order(:name)\n end",
"def index\n @groups_all = current_user.groups.paginate(page: params[:page]).order('name ASC')\n\n @owner = current_user\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n\n respond_to do |format|\n format.html { render @groups }\n format.json { render json: @groups }\n end\n end",
"def is_owned_by_user?(user)\n self.user == user\n end",
"def groups_where_member\n self.groups-self.groups_where_admin_and_wrapper\n end",
"def is_owned_by?(user_id)\n self.user_id == user_id\n end",
"def add_user(user)\n group_members.create(group: self, user: user, accepted: DateTime.now)\n end",
"def groups\n # self[:memberof].map { |dn| Group.select_dn(dn) }\n self[:memberof].map { |dn| self.class.group_klass.select_dn(dn) }\n end",
"def private_groups\n Group.find_private self.id\n end",
"def get_user_groups username_for, options = {}\n do_request 'get_user_groups', options.merge(username_for: username_for)\n end",
"def related_groups_users\n [].tap do |related_users|\n all_groups.each do |group|\n related_users << group.all_users.reject { |group_user| group_user == self }\n end\n end.flatten.uniq\n end",
"def groups\n\t\t\t@groups ||= Group.find(:all, :distinguishedname => @entry.memberOf)\n\t\tend",
"def owns?(group)\n return if group.class != Group\n self.groups.any? {|g| g[:id] == group.id}\n end",
"def groups\n Vedeu::Groups.registered\n end",
"def addable_watcher_groups\n groups = self.project.principals.select{|p| p if p.type=='Group'}\n groups = groups.sort - self.watcher_groups\n if respond_to?(:visible?)\n groups.reject! {|group| !visible?(group)}\n end\n groups\n end",
"def creator_in_group?\n return unless errors.blank?\n if !group.users.include?(user)\n errors.add(:user, user.username + \" isn't in the group\")\n end\n end",
"def set_my_groups(moduleName)\r\n @user = Authentify::User.find(session[:user_id])\r\n up = session[:user_privilege]\r\n groups = up.find_user_module_groups(moduleName)\r\n session[:mygroups] = groups\r\n return groups\r\n end",
"def mine\n @group = Group.includes(:users).where('groups_users.user_id = ? OR created_by = ?', current_user.id, current_user.id).references(:groups_users)\n render json: @group\n end",
"def show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end",
"def index\n @groups = query(GROUP, :name)\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_group_ids = current_user.groups.collect {|g| g.id }\n @groups.delete_if do |g|\n ! allowed_group_ids.member?(g.id)\n end\n end\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @groups }\n end\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def invite_users\n if GroupsController.group_owner? current_user.id, params[:id]\n set_group\n params[:users].each do |email|\n user = User.find_by_email(email) # TODO: only possible because email is unique. Should make magic assist to return user id's\n @group.users << user unless @group.users.include? user or user.nil?\n end unless params[:users].nil?\n respond_to do |format|\n format.html { redirect_to group_path(@group), alert: 'Invited users successfully.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to groups_path, alert: \"Not invited. You are not the group owner\" }\n format.json { render json: \"Only owners can add users to the respective group\", status: :unauthorized}\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n #here we add the current user to the membership collection of the group\n @membership = @group.memberships.build(params[:membership])\n @membership.group = @group\n @membership.user = current_user\n @membership.initiator = false\n @membership.membership_status_id = 2\n \n #and here we set the current_user as the owner of the group\n @group_permission = @group.group_permissions.build(params[:group_permission])\n @group_permission.membership = @membership\n @group_permission.group_role = GroupRole.find_by_name('Owner')\n \n @group.metro_area = MetroArea.find(params[:metro_area_id])\n @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil\n @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country)\n\n \n #current_user.track_activity(:created_a_group)\n \n# unless @user.is_in_group?(@group)\n# @user.memberships << @group\n# end\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n \n end",
"def filter_owner(group_ids)\n group_ids = Array(group_ids)\n group_ids.delete(user.my_group_id)\n group_ids\n end",
"def index\n @groups_user = GroupsUser.find(params[:id])\n @groups_users = GroupsUser.all\n end",
"def add_to_group(team, this_user)\n team[:user_ids] << this_user\n end",
"def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end",
"def index\n\t\t@user = User.find(session[:id])\n\t\t@groups = Group.all\n\tend",
"def index\n\n @groups = User.all\n @group = Group.new\n @available_groups = User.find(current_user.id).groups\n # @not_accepted = User.joins(:group_user).where(accepted:false)\n # @group_post = Post.joins(user: :group).where(group_id: current_user.groups.first)\n end",
"def manage_groups\n \n if request.get?\n course_id = params[:id]\n @course = Course.find(course_id)\n \n group_1 = CourseGroup.find_all_by_course_id_and_group(course_id, 0).collect(&:user_id)\n group_2 = CourseGroup.find_all_by_course_id_and_group(course_id, 1).collect(&:user_id)\n\n course_students = StudentInCourse.find_all_by_course_id(course_id).collect(&:user_id)\n \n @ungrouped = User.find_all_by_id(course_students).reject{ |user| user.id.in? group_1 or user.id.in? group_2 }\n @group_1 = User.find_all_by_id(group_1)\n @group_2 = User.find_all_by_id(group_2)\n else #post request\n course_id = params[:id]\n group1 = params['group1']\n group2 = params['group2']\n ungrouped = params['ungrouped']\n \n \n \n CourseGroup.destroy_all(:course_id => course_id)\n group1.each do |user|\n CourseGroup.create(:course_id => course_id, :user_id => user, :group => 0)\n end\n group2.each do |user|\n CourseGroup.create(:course_id => course_id, :user_id => user, :group => 1)\n end\n \n render :nothing => true\n flash[:notice] = \"Groups updated!\"\n end\n end",
"def suggest_groups_from_membership(user)\n Set.new(Notebook.where(owner: user.groups).map(&:owner_id))\n end",
"def manage_group\n if new_resource.append\n members_to_be_added = [ ]\n if new_resource.excluded_members && !new_resource.excluded_members.empty?\n # First find out if any member needs to be removed\n members_to_be_removed = [ ]\n new_resource.excluded_members.each do |member|\n members_to_be_removed << member if current_resource.members.include?(member)\n end\n\n unless members_to_be_removed.empty?\n # We are using a magic trick to remove the groups.\n reset_group_membership\n\n # Capture the members we need to add in\n # members_to_be_added to be added later on.\n current_resource.members.each do |member|\n members_to_be_added << member unless members_to_be_removed.include?(member)\n end\n end\n end\n\n if new_resource.members && !new_resource.members.empty?\n new_resource.members.each do |member|\n members_to_be_added << member unless current_resource.members.include?(member)\n end\n end\n\n logger.debug(\"#{new_resource} not changing group members, the group has no members to add\") if members_to_be_added.empty?\n\n add_group_members(members_to_be_added)\n else\n # We are resetting the members of a group so use the same trick\n reset_group_membership\n logger.debug(\"#{new_resource} setting group members to: none\") if new_resource.members.empty?\n add_group_members(new_resource.members)\n end\n end",
"def show\n @users = @group.users_del_grupo\n end",
"def groups\n @groups ||= {}\n end",
"def get_changeable_groups\n response = get_current_user_meta('changeablegroups')\n return false unless response\n\n changeablegroups = response['query']['userinfo']['changeablegroups']\n {\n :add => changeablegroups['add'],\n :remove => changeablegroups['remove'],\n :addself => changeablegroups['add-self'],\n :removeself => changeablegroups['add-self']\n }\n end",
"def owns?(user_key)\n user_key.user.id == self.id\n end",
"def grpowned?() end",
"def groups()\n\t\t\tend",
"def group_members\n members(\"Group\")\n end",
"def index\n @groups = Group.all.includes(:user)\n end",
"def list_users\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id\n render json: { size: group.users.count, users: group.users.map { |user| user.as_json(only: [:id, :name], include_root: false) } }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't list users. Not owner.\" }, status: :forbidden\n end\n end\n end",
"def show\n @user = current_user\n @user_groups = @user.groups\n\n @active_groups = []\n @pending_groups = []\n @pending_memberships = []\n @user.memberships.each do |m|\n if (m.status == \"active\")\n group = Group.find(m.group_id)\n @active_groups.push(group)\n elsif (m.status == \"pending\")\n group = Group.find(m.group_id)\n @pending_groups.push(group)\n @pending_memberships.push(m)\n end\n end\n end",
"def groups\n institution_groups + ['registered']\n end",
"def list_groups\n groups = CanvasSpaces.GroupCategory.groups.active.order(:name)\n # filter out non-public groups for non-admins\n groups = groups.where(join_level: 'parent_context_auto_join') unless @current_user.account.site_admin?\n groups_json = Api.paginate(groups, self, api_v1_canvas_spaces_groups_url).map do |g|\n include = @current_user.account.site_admin? || @current_user.id == g.leader_id ? ['users'] : []\n group_formatter(g, { include: include })\n end\n render :json => groups_json\n end",
"def users\n Ecore::User.find(@user_id, :group_ids.like(\"%#{@id}%\")).receive(:all)\n end"
] |
[
"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.59861135",
"0.59797955",
"0.5979751",
"0.5979157",
"0.5964615",
"0.5948508",
"0.59440994",
"0.5941103",
"0.59255517",
"0.5920296",
"0.5914309",
"0.5914309",
"0.5907987",
"0.5869233",
"0.586413",
"0.5819438",
"0.5815661",
"0.58139265",
"0.58032054",
"0.57908326",
"0.57881206",
"0.5787765",
"0.57859427",
"0.57854205",
"0.5783604",
"0.57755184",
"0.5761819",
"0.5757587",
"0.5750052",
"0.5739945",
"0.57111233",
"0.57028",
"0.56991494",
"0.5693683",
"0.5686196",
"0.5679502",
"0.5677229",
"0.5672266",
"0.5662029",
"0.56555337",
"0.5650359",
"0.5648396",
"0.56456506",
"0.56446034",
"0.56433904",
"0.5639542",
"0.5635508",
"0.5629097",
"0.5626953",
"0.56157744",
"0.5612626",
"0.56089246",
"0.56056106",
"0.5596948",
"0.5594607",
"0.5592501",
"0.55878854",
"0.55869013",
"0.55842453",
"0.5583994",
"0.5578936",
"0.5577878",
"0.55768216",
"0.557571",
"0.5568295",
"0.5562196",
"0.5558739",
"0.555715",
"0.55560374",
"0.5553042",
"0.55483556",
"0.55393565",
"0.5537907",
"0.5537323",
"0.553598",
"0.5531484",
"0.55307484",
"0.55267596",
"0.552628",
"0.55254275"
] |
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 Atheme::User.new(@session, match(/\\(account\\s([^\\(]+)\\):/))\n end",
"def user\n user = User.new\n user.read_creddentials\n user.login\n puts user.to_str\n end",
"def to_s\n username \n end",
"def display_user(user)\n user.name\n end",
"def login\n self.user_id ? user.login : self.name\n end",
"def to_s\n username.to_s\n end",
"def account_user(id)\n get(\"accountuser/#{id}\")\n end",
"def to_s\n @username.to_s\n end",
"def get_account(authdata)\n '@' + authdata.info.nickname\n end",
"def user_name\n self.user.login\n end",
"def user_name\n self.user.login\n end",
"def to_s\n return user.name\n end",
"def display_name\n #self.email.split('@')[0]\n self.username\n end",
"def get_login\r\n if ((self.user_id) && (self.user_id > 0))\r\n return self.user.name\r\n else\r\n return false\r\n end\r\n end",
"def user_display_name\n return @user_display_name\n end",
"def user_display_name\n return @user_display_name\n end",
"def user_display_name\n return @user_display_name\n end",
"def to_s\n \"[User: #{get_full_name} - #{email} ID: #{id}]\"\n end",
"def id_string\n return \"user_\"+self.username\n end",
"def user\n return Etc.getlogin\n end",
"def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end",
"def user_account\n @user_account ||= if (parts = new_resource.user.match(/(?<domain>.*)\\\\(?<account>.*)/))\n parts[:account]\n else\n new_resource.user\n end\n end",
"def get_user_login\n #self.network_login.blank? ? self.login : self.network_login.split('-',2)[1]\n self.get_network_login.blank? ? \"\" : self.get_network_login.gsub(self.primary_network.coded_name+'-', '') rescue ''\n end",
"def user_login\n @raw['user']['login']\n end",
"def get_account_id\n if user\n return user.get_account_id\n end\n end",
"def display_name\n username\n end",
"def liaison\n inverse_accounts.last.user\n end",
"def render_user(user)\n if user\n h(user.login)\n else\n '(unknown)'.html_safe\n end\n end",
"def get_user_login\n user = User.first(:id => self.user_id )\n return user.login if user\n return nil\n end",
"def to_s\n\t\tself.name.present? ? \"#{self.name} ( #{self.user} )\" : \"#{self.user}\" ;\n\tend",
"def display_name \n username\n end",
"def user_account\n return @user_account\n end",
"def to_s\n self.class.to_s + ' - ' + user.to_s\n end",
"def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end",
"def user\n user_id.get_object\n end",
"def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end",
"def display_resource(user)\n \"#{user.email}\"\n end",
"def get_login_with_full_name\n self.login.to_s + ' | ' + self.escolar.full_name.to_s\n end",
"def to_s\n\t\tself.name.present? ? \"#{self.name}\" : \"#{self.user}\" ;\n\tend",
"def display_resource(user)\n user.email\n end",
"def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end",
"def my_account\n self.user.my_account\n end",
"def to_s\n uid\n end",
"def to_s\n uid\n end",
"def user_display_name\n @attributes[:user_display_name]\n end",
"def user_id\n username\n end",
"def to_s\n username || sanitized_email || 'Anonymous'\n end",
"def account_to; Account.get(self.account_to_id); end",
"def inspect\n \"<User username=#{@username} id=#{@id} discriminator=#{@discriminator}>\"\n end",
"def string_username\n CaseInsensitiveString.str(current_user.getUsername())\n end",
"def open_user_account\n Account.create(user_id: self.id) \t\n end",
"def full_username\r\n return @user.username + '#' + @user.discriminator\r\n end",
"def to_s\n user_key\n end",
"def to_s\n user_key\n end",
"def user_type\n if self.class.name == \"PubcookieUser\"\n type = self.identity_type == \"Student\" ? self.identity_type : \"UW Standard user\"\n else\n type = \"External user\"\n end\n type\n end",
"def name_of(user)\n user.to_s\n end",
"def user_name\n User.find(self.user_id).name\n end",
"def display_resource(user)\n \"User #{user.email}\"\n end",
"def login_user_name\n user_name.tr('.', '')\n end",
"def user_class()\n @user\n end",
"def user_name\n\t\tobject.user.full_name \n\tend",
"def to_s\n if first_name\n first_name.to_s + ' ' + last_name.to_s\n else\n login\n end\n end",
"def display_name\n \"#{username} <#{email}>\"\n end",
"def usr_disp\n case\n when current_user.present?\n {:acct_type => \"Permanent Account\", :name_or_email => current_user.email }\n when session[:usr].present?\n {:acct_type => \"2 Month Account\", :name_or_email => session[:usr] }\n else\n {:acct_type => \"2 Month Account\", :name_or_email => 'Guest' }\n end\n end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
"def to_label\n login\n end",
"def user_name\n return User.find(user_id).name\n end",
"def user_name\n return User.find(user_id).name\n end",
"def actual_user\n User.find_by_id(session[:user_id])\n end",
"def name\n \"#{self.class.name.titleize}: #{user.email rescue 'unknown user'}\"\n end",
"def get_user_id(username)\n # .........\n end",
"def user_name\n name = self.le_user.nil? ? '' : self.le_user.name\n end",
"def identify\n @user = User.new\n if omniauth = session[:omniauth]\n @provider = omniauth.provider.capitalize\n @user.apply_omniauth(omniauth)\n end\n end",
"def account_type\n User.account_type(current_user)\n end",
"def user; User.find_by_id(user_id); end",
"def display_resource(user)\n user.username\n end",
"def identity\n \"#{email} #{profile.name} \"\n end",
"def account_return\n direct_login = []\n users = []\n ulist = Main.active.account_text.tr(\"\\n \",\",\").split(\",\")\n ulist.each do |n| \n n.strip!\n case n\n when /^.*@[0-9]{2,3}$/ \n direct_login << n.split(\"@\")\n when /^.{1,8}$/\n users << n\n end\n end\n #p Account.find_accounts(users).private.other_accounts.flatten\n accounts = users.empty? ? [] : Account.find_accounts_or_initialize(users)\n accounts.collect! { |account| account.all_accounts } if accounts\n accounts.flatten! if accounts\n if !accounts.empty?\n fill_accounts(accounts)\n else\n Main.active.status = [\"#{users}\", \"existiert nicht\", \"important\", -1]\n end\n end",
"def user\n\t\tif current_user.account_type != Account.roles[:user]\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"def to_param\n self.login\n end",
"def user_account_instance\n Account.new\n end",
"def user_string(with_links = false)\n return self.users.collect { |user|\n with_links ? user.link_to_page_with_first_name : user.first_name\n }.join(\", \")\n end",
"def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end",
"def login\n @user_login\n end",
"def user\n return unless user_id && user_type\n return @user if instance_variable_defined?('@user')\n\n @user = user_type.constantize.find_by(id: user_id)\n end"
] |
[
"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.6438104",
"0.64303994",
"0.64303994",
"0.64303994",
"0.64096266",
"0.64015836",
"0.63848215",
"0.63579476",
"0.6343271",
"0.6340446",
"0.63375294",
"0.63316447",
"0.6323612",
"0.62955755",
"0.62927943",
"0.6287696",
"0.6275638",
"0.6266724",
"0.62580794",
"0.62572455",
"0.6251471",
"0.6229058",
"0.6200398",
"0.6199813",
"0.61970544",
"0.6181884",
"0.61525565",
"0.6150991",
"0.6146157",
"0.6134409",
"0.6134409",
"0.61305493",
"0.6129541",
"0.6120276",
"0.6097403",
"0.6091687",
"0.60863113",
"0.60850006",
"0.60729235",
"0.6071123",
"0.6071123",
"0.60702324",
"0.6062792",
"0.60583127",
"0.6057475",
"0.60531205",
"0.6051026",
"0.6026725",
"0.6024936",
"0.60215753",
"0.6017112",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.6000155",
"0.59951174",
"0.5994688",
"0.5994688",
"0.59894764",
"0.59867585",
"0.5985171",
"0.59785193",
"0.5972339",
"0.59722173",
"0.59689224",
"0.5968545",
"0.5956656",
"0.5948486",
"0.5931466",
"0.59269196",
"0.5926363",
"0.59257996",
"0.59192204",
"0.59153557",
"0.59149563"
] |
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_group \n @members = User.joins(:groups).where(\"group_id = ? and acceptance_status = ?\", params[:id], true) if GroupsController.group_member? current_user.id, params[:id]\n end",
"def group_users\n DiscussionGroupUser.where(\"discussion_group_id=? AND is_member=?\", self.id, true)\n end",
"def manage_groups\n @other_user = @login_user\n @groups = @login_user.groups\n end",
"def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n @user_groups |= current_user.groups if current_user and current_user.respond_to? :groups\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.is_osu\n @user_groups\n end",
"def group_members\n members(\"Group\")\n end",
"def groups_where_member\n self.groups-self.groups_where_admin_and_wrapper\n end",
"def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n \n if administrator?(usr)\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups order by user_groups.name\n SQL\n else\n UserGroup.find_by_sql <<-SQL\n select user_groups.* from user_groups, user_groups_users\n where user_groups.id = user_groups_users.user_group_id\n and user_groups_users.user_id = #{usr.id}\t \n order by user_groups.name\n SQL\n end\n end",
"def groups\n UserGroups.new(:id => id).get.items\n end",
"def members\n @group = Group.find(params[:group_id])\n @members = @group.users\n end",
"def user_groups_assignable_for_user(usr)\n return [] if usr.nil?\n ug_table = Lockdown.user_groups_hbtm_reference.to_s\n if administrator?(usr)\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table} order by #{ug_table}.name\n SQL\n else\n usr_table = Lockdown.users_hbtm_reference.to_s\n if usr_table < ug_table\n join_table = \"#{usr_table}_#{ug_table}\"\n else\n join_table = \"#{ug_table}_#{usr_table}\"\n end\n Lockdown.user_group_class.find_by_sql <<-SQL\n select #{ug_table}.* from #{ug_table}, #{join_table}\n where #{ug_table}.id = #{join_table}.#{Lockdown.user_group_id_reference}\n and #{join_table}.#{Lockdown.user_id_reference} = #{usr.id}\t \n order by #{ug_table}.name\n SQL\n end\n end",
"def get_user_groups\n user_groups.keys\n end",
"def owned_groups\n @owned_groups = Group.where(\"owner_id = ?\", current_user)\n end",
"def user_groups\n return @user_groups if @user_groups\n\n @user_groups = default_user_groups\n # TODO: necessary to include #hyrax_group_names?\n @user_groups |= current_user.hyrax_group_names if current_user.respond_to? :hyrax_group_names\n @user_groups |= ['registered'] if !current_user.new_record? && current_user.roles.count.positive?\n # OVERRIDE: add the names of all user's roles to the array of user_groups\n @user_groups |= all_user_and_group_roles\n\n @user_groups\n end",
"def safe_select_groups\n return unless user_signed_in?\n @groups = current_user.groups\n end",
"def member_of(group)\n current_user.is_member?(group)\n end",
"def users\n GroupMembers.new(:id => id).get.items\n end",
"def user_groups\n return @user_groups if @user_groups\n @user_groups = default_user_groups\n @user_groups += RoleMapper.roles(@user)\n @user_groups\n end",
"def group_member_ids\n member_ids(\"Group\")\n end",
"def show_by_user\n @groups = Group.where(user_id: current_user.id)\n \n end",
"def groups\n\t\t\t@groups ||= Group.find(:all, :distinguishedname => @entry.memberOf)\n\t\tend",
"def groups\n institution_groups + ['registered']\n end",
"def show\n @user = current_user\n @user_groups = @user.groups\n\n @active_groups = []\n @pending_groups = []\n @pending_memberships = []\n @user.memberships.each do |m|\n if (m.status == \"active\")\n group = Group.find(m.group_id)\n @active_groups.push(group)\n elsif (m.status == \"pending\")\n group = Group.find(m.group_id)\n @pending_groups.push(group)\n @pending_memberships.push(m)\n end\n end\n end",
"def users_and_groups=(value)\n @users_and_groups = value\n end",
"def ldap_groups\n User.walk_ldap_groups(User.ldap_member_of(user_key), []).sort\n end",
"def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end",
"def index\n\t\t@groups = current_user.groups\n\tend",
"def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end",
"def index\n @groups = current_user.groups\n end",
"def index\n @group = Group.find(params[:id])\n @members = GroupUser.where(:group_id => params[:id])\n end",
"def owned_groups\n codes = Hydra::LDAP.groups_owned_by_user(uid)\n #puts \"codes: #{codes}\"\n Group.find_all_by_code(codes)\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def groups\n \n \n @groups = @current_user.groups\n render 'groups.json.jbuilder', status: :ok\n end",
"def groups\n return [] if memberOf.nil?\n @groups ||= Group.find(:all, distinguishedname: @entry.memberOf).delete_if(&:nil?)\n end",
"def member_user\n if params[:group_id]\n @group = Group.find(params[:group_id])\n else\n @group = Group.find(by_id)\n end\n unless @group.has_member?(current_user)\n flash[:danger] = \"The page you requested is only available to members.\"\n redirect_to @group\n end\n end",
"def visible_groups\n @visible_groups ||= begin\n filter_visible_groups_for_user(self.current_groups)\n end\n end",
"def index\n # byebug \n @groups = current_user.groups\n @group_members=GroupMember.all\n # @group_members=@group.GroupMember.all\n end",
"def index\n @user = User.find(current_user.id)\n @groups = @user.groups.all\n end",
"def usersInGroup\n @users = User.all\n @selected_group = Group.find(params[:selected_group])\n session[:current_group_id] = @selected_group.id\n end",
"def nonmembered_groups(user)\n (LogicalAuthz::group_model.all - user.groups).map { |g| [ g.name, g.id ] }\n end",
"def get_groups\n\t\tgroup0 = course_groups.find_all_by_group(0).collect(&:user_id)\n\t\tgroup1 = course_groups.find_all_by_group(1).collect(&:user_id)\n\t\t[group0,group1]\n\tend",
"def private_groups\n Group.find_private self.id\n end",
"def set_my_groups(moduleName)\r\n @user = Authentify::User.find(session[:user_id])\r\n up = session[:user_privilege]\r\n groups = up.find_user_module_groups(moduleName)\r\n session[:mygroups] = groups\r\n return groups\r\n end",
"def set_groups(user, grouplist)\n\t\t\tend",
"def groups\n Vedeu::Groups.registered\n end",
"def show\n @group_members = Membership.where(group_id: @group.id).all\n @members_count = @group_members.count \n @is_member = @group_members.exists?(user_id: current_user.id)\n @is_admin = @group_members.exists?(user_id: current_user.id, admin: true)\n end",
"def index\n if user_signed_in?\n @groups = current_user.groups\n else\n redirect_to new_user_session_path\n end\n end",
"def test_group\n \n user = @user_1\n group = 'customer-test'\n \n assert (not @crowd.group_member? user.name, group), \"#{user.name} is already a member of group #{group}\"\n\n @crowd.add_user_to_group user.name, group \n assert (@crowd.group_member? user.name, group) \n\n groups = @crowd.find_group_memberships user.name\n assert (groups.length > 0)\n assert (groups.include? group)\n\n @crowd.remove_user_from_group user.name, group \n assert (not @crowd.group_member? user.name, group)\n\n groups_after_remove = @crowd.find_group_memberships user.name\n\n # ensure the user in one less group \n assert_equal groups.length - 1, groups_after_remove.length\n \n end",
"def groups\n roles\n end",
"def index\n id = -1 \n if params[:id] \n id = params[:id]\n else \n id = current_user.id \n end \n\n @user = User.find(id)\n @group = UserGroup.find_by(user_id: id, name: params[:group])\n\n if !@group.nil?\n @group_members = get_members(@user, @group)\n end \n\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end",
"def users_and_groups\n return @users_and_groups\n end",
"def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_select).select(:owner_id))\n end",
"def group_membership(principal)\n end",
"def get_changeable_groups\n response = get_current_user_meta('changeablegroups')\n return false unless response\n\n changeablegroups = response['query']['userinfo']['changeablegroups']\n {\n :add => changeablegroups['add'],\n :remove => changeablegroups['remove'],\n :addself => changeablegroups['add-self'],\n :removeself => changeablegroups['add-self']\n }\n end",
"def get_groups()\n return self.groups\n end",
"def index\n @groups = Group.where(:user_id => current_user)\n end",
"def my_managers\n my_groups = group_users.pluck(:group_id)\n CourseUser.joins(group_users: :group).merge(Course::GroupUser.manager).\n where(Course::Group.arel_table[:id].in(my_groups)).distinct\n end",
"def groups\n config.redis_connection.smembers \"#{config.prefix}:groups\"\n end",
"def membership(username)\n grlist = []\n begin\n userpw = Etc.getpwnam(username)\n rescue\n return grlist\n end\n begin\n usergr = Etc.getgrgid(userpw.gid)\n grlist.push(usergr.name)\n rescue\n # This shouldn't happen, if it does it means\n # someone was probably hand-editing the passwd/\n # group files and messed up. \n end\n Etc.group { |g|\n if g.mem.index(username)\n grlist.push(g.name)\n end\n }\n return grlist.uniq.sort\n end",
"def member\n group&.member_for(user)\n end",
"def current_user_group_ids\n container.current_user_group_ids\n end",
"def groups\n find_groups if @groups.nil?\n @groups\n end",
"def get_groups_with_membership\n filter = Net::LDAP::Filter.eq('objectclass', 'posixGroup')\n attributes = %w(cn memberUid)\n\n results = Tapjoy::LDAP.client.search(attributes, filter)\n end",
"def recursive_members()\n return @users if @users.present?\n\n # False is the users, true groups\n grouped = member(true).group_by{|g| LdapGroup.dn_is_group? g}\n @users = grouped[false] || []\n groups = grouped[true] || []\n\n cached_groups = {}\n\n groups.each do |g_dn|\n key = dn.rdns.first.values.first\n\n group = cached_groups[key] || LdapGroup.find(g_dn)\n cached_groups[key] = group\n\n group_users = group.member.group_by{ |g| LdapGroup.dn_is_group? g }[false]\n @users.push(*group_users)\n end\n @users\n end",
"def belongs_to_group\n if current_sys_user # session has been started \n if current_sys_user.hr_employee_id #only check groups for employee users, not inspectors\n # checks if employee user belongs to any group\n if !SysUserXGroup.find_by(sys_user_id: (SysUser.find_by(username: current_sys_user.username)))\n sign_out current_sys_user\n flash[:alert] = 'Usuário não pertence a nenhum grupo' \n redirect_to :action => 'new', :controller => 'devise/sessions' # Redirect to sign in page\n end\n end\n end\n end",
"def ifMember(group_id,user_id)\n GroupUser.where(:group_id => group_id, :user_id => user_id).exists? #change to current_user_id \n end",
"def group_admins\n group.blank? ? [] : group.has_admins\n end",
"def view_members()\n a = []\n GroupMember.all.each {|r|\n if r.group_id == @group.id\n a.push(r.username)\n end\n }\n puts a\n end",
"def group_members(id)\n get(\"/groups/#{id}/members\")\n end",
"def list_groups\n if @user.permission_level.value == PermissionLevel.order(\"value DESC\").first.value\n render :json => Group.find(:all).map{|g| g}\n else\n render :json => @user.groups.map{|g| g}\n end\n end",
"def index\n if coordinator? || admin?\n @groups = Group.all\n elsif professor?\n @groups = Group.where(course_id: Course.where(professor_id: current_user.id).all.ids ).all\n elsif student?\n @groups = User.find(current_user.id).groups.references( :students ).where( students: { user_id: current_user.id })\n\n end\n end",
"def member_of\n @member_of ||= Rails.cache.fetch(\"#{uid}/memberof\") do\n memberof = []\n all = LdapGroup.all_cached\n\n all.each do |g|\n if g.is_member?(self) then\n memberof << g\n end\n end\n memberof\n end\n end",
"def groups\n # self[:memberof].map { |dn| Group.select_dn(dn) }\n self[:memberof].map { |dn| self.class.group_klass.select_dn(dn) }\n end",
"def get_user_groups username_for, options = {}\n do_request 'get_user_groups', options.merge(username_for: username_for)\n end",
"def group_member_set(principal)\n end",
"def ismemberof\n []\n end",
"def get_all_usergroups\n response = get_siteinfo('usergroups')\n ret = {}\n response['query']['usergroups'].each do |g|\n ret[g['name']] = g['rights']\n end\n ret\n end",
"def index\n\t\t# si rol mayor a desarrollador, listar todos los grupos \n \tif has_role_with_hierarchy?(:administrador) \n\t\t\t@groups = Group.all\n\t\t# si rol es desarrollador, listar solo sus grupos\n\t\telse\n\t\t\t@groups = Group.all :conditions => { :user_id, current_user.id }\n\t\tend\n end",
"def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end",
"def index\n render json: current_user.membered_groups\n end",
"def group_members\n Notification.where(group_owner_id: id)\n end",
"def hyrax_groups\n roles.where(name: 'member', resource_type: 'Hyrax::Group').map(&:resource).uniq\n end",
"def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end",
"def index\n @groups = Group.display_for_user(current_user)\n end",
"def with_group_members\n self\n end",
"def groups\n @groups ||= {}\n end",
"def groups\n return [] if self.group_list.nil?\n self.group_list\n end",
"def groups()\n id_list = SQLQuery.new.get('groups_handler', ['group_id']).where.if('user_id', @id).send\n groups_list = []\n id_list.each do |id|\n groups_list << Groupchat.get(id['group_id'])\n end\n return Sorter.last_interaction(groups_list)\n end",
"def groups()\n\t\t\t\tuserlist = users()\n\n\t\t\t\tgrouplist = GroupList.new()\n\t\t\t\tFile.open('/etc/group', File::RDONLY) { |fp|\n\t\t\t\t\tregex = /^([a-zA-Z0-9-]+):[^:]+:([0-9]+):([^:]*)/\n\t\t\t\t\tfp.each_line() { |line|\n\t\t\t\t\t\tmatch = regex.match(line)\n\t\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\t\tgroup = GroupInfo.new()\n\t\t\t\t\t\t\tgroup.groupname = match[1]\n\t\t\t\t\t\t\tgroup.gid = match[2].to_i()\n\t\t\t\t\t\t\tgroup.members = UserList.new()\n\t\t\t\t\t\t\tif(match[3] != nil)\n\t\t\t\t\t\t\t\tusers = match[3].split(/,/)\n\t\t\t\t\t\t\t\tusers.each() { |username|\n\t\t\t\t\t\t\t\t\tif(userlist.has_key?(username))\n\t\t\t\t\t\t\t\t\t\tgroup.members[username] = userlist[username]\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tgrouplist[group.groupname] = group\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn(grouplist)\n\t\t\tend",
"def restricted?\n self.groups.any?\n end",
"def can_be_created_by?(user)\n \n not (user.usergroups & usergroups).empty?\n\n end",
"def memberships(refresh = false)\n @memberships = nil if refresh\n @memberships ||= AccessGroupGroupMember.where(member_id: id).includes(:group).map{|v| v.group}.to_a.freeze\n end",
"def manage_group\n if new_resource.append\n members_to_be_added = [ ]\n if new_resource.excluded_members && !new_resource.excluded_members.empty?\n # First find out if any member needs to be removed\n members_to_be_removed = [ ]\n new_resource.excluded_members.each do |member|\n members_to_be_removed << member if current_resource.members.include?(member)\n end\n\n unless members_to_be_removed.empty?\n # We are using a magic trick to remove the groups.\n reset_group_membership\n\n # Capture the members we need to add in\n # members_to_be_added to be added later on.\n current_resource.members.each do |member|\n members_to_be_added << member unless members_to_be_removed.include?(member)\n end\n end\n end\n\n if new_resource.members && !new_resource.members.empty?\n new_resource.members.each do |member|\n members_to_be_added << member unless current_resource.members.include?(member)\n end\n end\n\n logger.debug(\"#{new_resource} not changing group members, the group has no members to add\") if members_to_be_added.empty?\n\n add_group_members(members_to_be_added)\n else\n # We are resetting the members of a group so use the same trick\n reset_group_membership\n logger.debug(\"#{new_resource} setting group members to: none\") if new_resource.members.empty?\n add_group_members(new_resource.members)\n end\n end",
"def retrieve_groups_from_ldap\n LdapUser.retrieve_groups self.login\n end",
"def in_group?(group_or_id)\n group_ids.include?(Ecircle::User.group_id(group_or_id))\n end",
"def option_group_memberships\n @dbi.option_group_memberships\n end"
] |
[
"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.6879773",
"0.6852453",
"0.68405724",
"0.68033695",
"0.67722505",
"0.67679024",
"0.67532396",
"0.67523456",
"0.67490155",
"0.6748012",
"0.67189395",
"0.67181844",
"0.67181545",
"0.6706152",
"0.6692557",
"0.66846746",
"0.6678036",
"0.66658276",
"0.66616386",
"0.66559523",
"0.6634328",
"0.6634288",
"0.6628384",
"0.6625756",
"0.66112244",
"0.6607864",
"0.65895534",
"0.65663105",
"0.655598",
"0.65556836",
"0.6554643",
"0.65488666",
"0.6547297",
"0.65358126",
"0.6526906",
"0.6524233",
"0.6516268",
"0.65110254",
"0.6508128",
"0.6500298",
"0.64953125",
"0.6494858",
"0.64920396",
"0.6481058",
"0.64715546",
"0.6471336",
"0.64672124",
"0.6452007",
"0.64512426",
"0.64431065",
"0.6432725",
"0.64236164",
"0.63974386",
"0.6392138",
"0.6381311",
"0.63775283",
"0.6371117",
"0.63670576",
"0.63661677",
"0.6363319",
"0.6362621",
"0.6356858",
"0.6353213",
"0.63524806",
"0.63488436",
"0.6343977",
"0.6343815",
"0.63368905",
"0.6331743",
"0.6324888",
"0.63238704",
"0.6323602",
"0.63154197",
"0.6309427",
"0.6306604",
"0.63055176",
"0.6303257",
"0.62966305",
"0.6293471"
] |
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 (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end",
"def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend",
"def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend",
"def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend",
"def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend",
"def my_min(arr)\n answer = 0\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1 && ele1 < ele2\n answer = ele1 if answer >= ele1\n end\n end\n end\n answer \nend",
"def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend",
"def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend",
"def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend",
"def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend",
"def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end",
"def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend",
"def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend",
"def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min(array)\n array.find do |ele|\n array.all? do |ele1|\n ele <= ele1\n end\n end\n end",
"def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend",
"def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend",
"def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend",
"def find_min_in_nested_arrays(src)\nrow_index = 0\nouter_results = []\nwhile row_index < src.count do\n element_index = 0\n smallest_integers = 100\n while element_index < src[row_index].count do\n if src[row_index][element_index] < smallest_integers\n smallest_integers = src[row_index][element_index]\n end\n element_index += 1\n end\n outer_results << smallest_integers\n row_index += 1\n end\n outer_results\nend",
"def my_min2(array)\n min = array.first\n array.each {|item| min = item if item <= min}\n return min\nend",
"def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend",
"def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend",
"def my_min2(arr)\n answer = arr[0]\n arr.each_with_index do |ele, idx|\n if idx != arr.length - 1\n answer = arr[idx] if answer >= arr[idx]\n end\n end\n answer\nend",
"def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend",
"def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend",
"def my_min(array)\n min = array.first\n array.each {|el| min = el if min > el}\n min\nend",
"def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend",
"def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend",
"def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end",
"def my_min(arr)\n min = arr[0]\n arr.each do |num|\n if num < min\n min = num\n end\n end\n min\n\nend",
"def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend",
"def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend",
"def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend",
"def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend",
"def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend",
"def my_min_n2(arr)\n smallest_number = true\n arr.each do |first_el|\n smallest_number = true\n arr.each do |second_el|\n smallest_number = false if second_el < first_el\n end\n return first_el if smallest_number\n end\nend",
"def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend",
"def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend",
"def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend",
"def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend",
"def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end",
"def find_min(arr)\n smallest_value = arr.first\n for value in arr\n if value <= smallest_value\n smallest_value = value\n end\n end\n smallest_value\nend",
"def find_min(arr)\n min = arr.first\n (1...arr.length).each do |idx|\n min = arr[idx] if arr[idx] < min\n end\n min\nend",
"def my_min(array)\n sorted = false\n until sorted\n sorted = true\n\n array.each_index do |idx|\n next if idx + 1 == array.length\n if array[idx] > array[idx + 1]\n array[idx], array[idx + 1] = array[idx + 1], array[idx]\n sorted = false\n end\n end\n end\n\n array.first\nend",
"def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend",
"def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend",
"def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend",
"def my_min(arr)\n arr.each do |num|\n return num if arr.select { |other_num| other_num > num }\n end\nend",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend",
"def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend",
"def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend",
"def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend",
"def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend",
"def my_min_2(arr)\n min = arr.shift\n\n (0...arr.length).each do |i|\n min = arr[i] if min > arr[i]\n end\n \n min\nend",
"def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end",
"def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def check_list(array)\n min = array.first\n i = 0\n while i < array.length\n j = i + 1\n while j < array.length\n min = array[i] if array[i] < array[j] && array[i] < min\n j += 1\n end\n i += 1\n end\n min\n end",
"def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def find_min(arr)\n return arr[0] if arr.length == 1\n\n left = 0\n right = arr.length - 1\n\n loop do\n mid = (left + right) / 2\n\n prev_value = arr[mid - 1]\n curr_value = arr[mid]\n next_value = arr[mid + 1]\n\n return curr_value if prev_value && prev_value > curr_value\n return next_value if next_value && curr_value > next_value\n\n curr_value < arr[right] ? right = mid - 1 : left = mid + 1\n end\nend",
"def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend",
"def find_min(array)\n min_difference = nil\n for i in 0..array.length - 1 do\n for j in i + 1..array.length - 1 do\n difference = (array[i] - array[j]).abs\n if min_difference.nil? || difference < min_difference\n min_difference = difference\n end\n end\n end\n min_difference\n end",
"def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend",
"def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend",
"def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend",
"def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend",
"def my_min(arr)\n sorted = false \n while !sorted \n sorted = true \n (0...arr.length-1).each do |i|\n if arr[i] < arr[i+1]\n arr[i], arr[i+1] = arr[i+1], arr[i]\n sorted = false \n end \n end \n end \n arr[-1]\nend",
"def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend",
"def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend",
"def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend",
"def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend",
"def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend",
"def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend",
"def compare_every_element_my_min(integers)\n min = nil\n\n integers.each do |integer_1|\n is_min = true\n\n integers.each do |integer_2|\n is_min = false if integer_1 > integer_2\n end\n\n min = integer_1 if is_min\n break if min\n end\n\n min\nend",
"def my_min_2(array)\n array.sort!\n array.first\nend",
"def check_list_linear(array)\n min = array.first\n array.each do |num|\n min = num if num < min\n end\n min\n end",
"def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend",
"def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend",
"def my_min2(array)\n array.inject { |acc, ele| acc < ele ? acc : ele}\nend",
"def smallest_difference_model(array)\n numbers = [array[0], array[1]]\n min_dif = (array[0] - array[1]).abs\n\n array.each_with_index do |n1, i|\n array[(i + 1)..-1].each do |n2|\n diff = (n1 - n2).abs\n\n if min_dif > diff\n numbers = [n1, n2]\n min_dif = diff\n end\n end\n end\n\n [numbers.min, numbers.max]\nend",
"def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend",
"def phase_two(arr)\n min = arr[0]\n arr.each do |ele|\n if ele < min\n min = ele\n end\n end\n\n min\nend",
"def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend",
"def min\n min = @m[0][0]\n for i in 0...fi\n for k in 0...co\n if @m[i][k] < min then\n min=@m[i][k]\n end\n end\n end \n min\n end",
"def my_min2(arr)\n start = 0\n for i in (0...arr.length)\n start = arr[i] if start > arr[i]\n end\n start\nend",
"def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend",
"def local_min(arr)\n mid = arr.length/2\n min = arr[mid]\n upper = arr.length-1\n lower = 0\n\n while !(arr[mid+lower+1] > min && arr[mid+lower-1] > min)\n # byebug\n #Calculate a new mid point and upper and lower bound.\n if arr[mid+1] < min \n lower = mid\n else\n upper = mid\n end\n mid = ((upper - lower) / 2) \n min = arr[mid + lower] \n end\n min\nend",
"def minimum(arr)\n m = arr.min\n m\n end",
"def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend",
"def decrement_smallest_value(nested_array)\n smallest_value = nested_array.flatten.max\n nested_array.each do |array|\n array.each do |current_value|\n if smallest_value > current_value\n smallest_value = current_valu\n end\n end\n end\n smallest_value -= 1\nend",
"def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n min =1\n a.each{|x|\n if (x==min)\n min = min+1\n end\n }\n return min\nend",
"def smallest(array)\nend",
"def my_second_min(list)\n smallest = list[0]\n list.each do |el|\n next if el == smallest\n if el < smallest\n smallest = el\n end\n end\n return smallest\nend",
"def getMin(arr) \t\n\tminInd = 0\n\tfor i in 1..$n-1 do\n\t\tif (arr[i] < arr[minInd])\n\t\t\tminInd = i\n end \n end \n\treturn minInd\nend"
] |
[
"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.77317476",
"0.77269584",
"0.77222794",
"0.7721826",
"0.7718518",
"0.77175254",
"0.769925",
"0.76751214",
"0.76665795",
"0.7650869",
"0.7641091",
"0.76309305",
"0.76289",
"0.7625377",
"0.76238436",
"0.7622821",
"0.7614391",
"0.7606113",
"0.7597882",
"0.7590387",
"0.75882864",
"0.7577304",
"0.7555649",
"0.7548924",
"0.7513488",
"0.75121856",
"0.7511091",
"0.75083613",
"0.75067586",
"0.7499152",
"0.74972475",
"0.74960005",
"0.7494212",
"0.74771553",
"0.74712664",
"0.74666405",
"0.74223113",
"0.7421955",
"0.7409657",
"0.7407719",
"0.74042654",
"0.73955643",
"0.7347936",
"0.7338608",
"0.73340505",
"0.73213446",
"0.729721",
"0.7288776",
"0.7277677",
"0.72732264",
"0.7265195",
"0.7225098",
"0.7220779",
"0.7214318",
"0.7194684",
"0.7180067",
"0.7179064",
"0.7166031",
"0.7160255",
"0.715421",
"0.71416694",
"0.7136409",
"0.7130987",
"0.71029645",
"0.709626",
"0.7077542",
"0.70767784",
"0.70520633",
"0.70284516",
"0.7025734",
"0.70179814",
"0.69987285",
"0.69890666",
"0.6972129",
"0.69614035",
"0.6953591",
"0.69520855",
"0.6942386",
"0.69410104"
] |
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",
"def implementation; end",
"def custom; end",
"def custom; end",
"def wrapped_causes; end",
"def private_method\n end",
"def checks; end",
"def lint\n []\n end",
"def extra; end",
"def coverage_exceeding_source_warn; end",
"def conscientious_require; end",
"def extra_annotations; end",
"def overrides; end",
"def schubert; end",
"def silence_deprecations; end",
"def fix_offenses!\n run \"rubocop -a --format=simple\"\n end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def anchored; end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def culprit\n @culprit\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def process_fix\n super\n end",
"def diagnostic; end",
"def as_you_like_it_quote; end",
"def one_gradable_ex_only\n end",
"def spec; end",
"def spec; end",
"def big_bad; end",
"def faint; end",
"def faint; end",
"def auto_analyze; end",
"def suivre; end",
"def internal; end",
"def ignore_method_conflicts; end",
"def actual_flow_control\n super\n end",
"def anatomy; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def warnings; end",
"def missing; end",
"def sharp; accidental; end",
"def precheck\n end",
"def terpene; end",
"def hints; end",
"def how_it_works\r\n end",
"def exec_fix\n super\n end",
"def beautify; end",
"def beautify; end",
"def jack_handey; end",
"def miss_reason; end",
"def correct_style_detected; end",
"def correct_style_detected; end",
"def correct_style_detected; end",
"def silly_adjective; end",
"def autofinish; end",
"def common_swiftlint_check\n\n swiftlint.config_file = '.swiftlint.yml'\n swiftlint.lint_files inline_mode: true\n\nend",
"def who_we_are\r\n end",
"def used?; end",
"def exceptions; end",
"def catch_exceptions; end",
"def weber; end",
"def check_errors;\n end",
"def analyze_component_breakdown\n\n end",
"def offences_by; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def ignore_method_conflicts=(_arg0); end",
"def auto_analyze=(_arg0); end",
"def raise_deprecations=(_arg0); end",
"def strategy; end",
"def lint(*args); end",
"def disabled_warnings; end",
"def before_run; end",
"def original_error; end",
"def original_error; end",
"def check_resource_semantics!; end",
"def support\n raise \"Not implemented\"\n end",
"def bad_smell_by_nfunctions\n end",
"def refuse_coverage_drop; 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.55071735",
"0.5485288",
"0.5468638",
"0.5444868",
"0.54441875",
"0.5437414",
"0.5433704",
"0.54293853",
"0.54293853",
"0.54293853",
"0.54011667",
"0.53851646",
"0.53851646",
"0.53851646",
"0.5383184",
"0.53803986",
"0.53803986",
"0.53803986",
"0.53803986",
"0.5379913",
"0.5356675",
"0.5352567",
"0.53437775",
"0.53233856",
"0.53233856",
"0.5322219",
"0.5317231",
"0.5317231",
"0.53154904",
"0.5309598",
"0.5308081",
"0.5294574",
"0.5288808",
"0.52826285",
"0.5277961",
"0.5277961",
"0.5277961",
"0.5277961",
"0.5277961",
"0.5277961",
"0.5277961",
"0.5277961",
"0.5273137",
"0.5271737",
"0.52535105",
"0.5250957",
"0.5236747",
"0.5234146",
"0.5223333",
"0.5215835",
"0.5215835",
"0.5212866",
"0.5212756",
"0.5212143",
"0.5212143",
"0.5212143",
"0.520768",
"0.5207439",
"0.5207155",
"0.52040786",
"0.51975596",
"0.518914",
"0.5174647",
"0.51690155",
"0.5165316",
"0.51636297",
"0.51591873",
"0.51578933",
"0.5150163",
"0.51385456",
"0.5130537",
"0.5125837",
"0.5116103",
"0.5115482",
"0.51137483",
"0.5109208",
"0.5109208",
"0.5108286",
"0.51050025",
"0.5104827",
"0.51032054"
] |
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",
"def specie; end",
"def specie; end",
"def intensifier; end",
"def suivre; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def common\n \n end",
"def anchored; end",
"def custom; end",
"def custom; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def who_we_are\r\n end",
"def processor; end",
"def isolated; end",
"def isolated; end",
"def celebration; end",
"def internal; end",
"def identify; end",
"def internship_passed; end",
"def private_method\n end",
"def villian; end",
"def checks; end",
"def operation; end",
"def prepareForReuse; end",
"def ignores; end",
"def generate_comprehensive\n\n end",
"def apply\n end",
"def weber; end",
"def formation; end",
"def used\n raise NotImplementedError\n end",
"def missing; end",
"def ignore; end",
"def spec; end",
"def spec; end",
"def code_of_conduct; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def calculated; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def same; end",
"def extra; end",
"def appraisals; end",
"def appraisals; end",
"def under_construction\n end",
"def initialize\n \n end",
"def pausable; end",
"def apply()\n end",
"def relatorios\n end",
"def perform\n \n end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize\n \n end",
"def ibu; end",
"def sitemaps; end",
"def offences_by=(_arg0); end",
"def silly_adjective; end",
"def strain; end",
"def missing?; end",
"def jack_handey; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def big_bad; end",
"def usable?; end",
"def returns; end",
"def wrapper; end"
] |
[
"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.560886",
"0.5606118",
"0.5606118",
"0.5604982",
"0.5604982",
"0.5591288",
"0.55738825",
"0.55616415",
"0.55616415",
"0.5559755",
"0.5534399",
"0.55199194",
"0.55111486",
"0.55034965",
"0.54973954",
"0.5491825",
"0.5487595",
"0.54736346",
"0.5452298",
"0.5436608",
"0.5425304",
"0.54249287",
"0.54199356",
"0.5349822",
"0.53293556",
"0.53154004",
"0.5314429",
"0.5314429",
"0.5307322",
"0.5306179",
"0.5306179",
"0.5306179",
"0.5306179",
"0.5289108",
"0.52884555",
"0.52884555",
"0.52884555",
"0.52884555",
"0.52884555",
"0.52884555",
"0.52884555",
"0.52884555",
"0.52884555",
"0.5285406",
"0.52528816",
"0.52408904",
"0.52408904",
"0.5228472",
"0.5222805",
"0.5214739",
"0.52093595",
"0.5207231",
"0.52039164",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.52021796",
"0.5189982",
"0.5189661",
"0.51857346",
"0.51831436",
"0.5180018",
"0.51597357",
"0.5159429",
"0.51550335",
"0.5154142",
"0.5154142",
"0.5154142",
"0.5154142",
"0.51477855",
"0.5137787",
"0.51367277",
"0.5135177"
] |
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', rprof_args, script, '--', args].join(' ')\nend",
"def profile\n profile_memory do\n profile_time do\n profile_gc do\n yield\n end\n end\n end\n end",
"def start(profile = T.unsafe(nil), &block); end",
"def benchmark\nend",
"def profile_stats(outname=\"/#{__FILE__[0...-3]}\",outdir=\"\")\n require 'profile'\n Profiler__.stop_profile # Leave setup out of stats\n\n at_exit do\n Profiler__.stop_profile\n RDL.contract_switch.off {\n puts \"START.\"\n puts \"Performing Profile Analysis\"\n # Class Name => [Times Contract Called | Times Called | Time | Time | Class Profile]\n # Implications:\n # [nil] -> Method exists in object space, but not used\n # [-1] -> Contract exists for method, but method not profiled\n # [-1, ...] -> Method profiled, but no contract exists\n totals = {}\n\n puts \"Retrieving Profiler Data\"\n Profiler__.class_variable_get(:@@maps).values.each do |threadmap|\n threadmap.each do |key, data|\n total_data = (totals[key.to_s] ||= [-1, 0, 0.0, 0.0, key])\n total_data[1] += data[0]\n total_data[2] += data[1]\n total_data[3] += data[2]\n end\n end\n\n puts \"Scanning Object Space\"\n kls = []\n ObjectSpace.each_object { |obj|\n if kls.include? obj.class then\n next\n end\n kls << obj.class\n mthds = obj.public_methods(false) + obj.private_methods(false) + obj.protected_methods(false)\n puts \"Class #{obj.class}\"\n mthds.each{ |mthd|\n puts \" :#{mthd}\"\n totals[\"#{obj.class}::#{mthd.to_s}\".gsub('::','#')] ||= [nil] unless mthd.to_s =~ /new/\n }\n }\n\n p \"Scanning RDL Contract Log\"\n RDL.wrapped_calls.each{ |mname,ct|\n if (totals[mname]) then\n if (totals[mname][0]) then\n totals[mname][0] = ct\n else\n totals[mname][0] = -1\n end\n end\n }\n\n puts \"Analyzing Statistics\"\n filtered = {}\n totals.each{ |k,v|\n if (not (k=~/(rdl)|(RDL)/)) and (v[0].nil? or v[0]==-1) then filtered[k]=v end\n }\n\n puts \"Writing Output\"\n require 'json'\n fpath = \"#{outdir}/#{outname}_rdlstat.json\".gsub('//','')\n File.open(fpath,'w') do |file|\n file.puts \"POTENTIAL PROBLEMS\"\n filtered.each{ |k,v|\n begin\n k =~ /((?:.+\\#)*)(.+)/\n x = $1[0...-1] # Store $1 and $2 before overriden\n y = $2\n if (x =~ /\\<Class\\:/) then\n puts \"Cannot evaluate user-defined class #{x}\"\n else\n kls = eval x.gsub('#','::')\n mthds = kls.public_methods(false) + kls.protected_methods(false) # Ignoring private methods\n if (mthds.include? y.to_sym)\n file.printf \"%-20s %-s\", k, v.to_s\n file.puts \"\"\n else\n puts \"Ignoring inheritance problem for #{k}\"\n end\n end\n rescue\n end\n }\n file.puts \" \"\n file.puts \"JSON OBJECT\"\n file.puts totals.to_json\n end\n puts \"DONE.\"\n }\n end\n\n Profiler__.start_profile # Restart profiler after setup\n end",
"def profile(action, name = '')\n case action\n when :start\n MemoryProfiler.start\n when :stop\n MemoryProfiler.stop.pretty_print(\n to_file: File.join(DIR_LOGS, 'memory_profile.txt'),\n scale_bytes: true,\n detailed_report: true,\n normalize_paths: true\n )\n end\nrescue => e\n lex(e, 'Failed to do memory profiling')\nend",
"def profile; end",
"def profile; end",
"def auto_analyze; end",
"def profile=(_arg0); end",
"def prof_file\n base_info_file + '.profile'\n end",
"def run\n return unless profile\n\n @locked = true\n\n log :info, \"StackProf#{config.raw? ? \" (raw)\" : \"\"} enabled globally: \" \\\n \"mode – #{config.mode}, target – #{config.target}\"\n\n at_exit { dump(\"total\") } if config.suite?\n end",
"def startMultiprofiling(filename, bufferSize=ProfilerControl::DEFAULT_BUFFER_SIZE, mode=ProfilerControl::PROFILE_IN_RAM)\n\n puts \"html> Start Profiling ...\"\n case mode\n when ProfilerControl::PROFILE_IN_RAM\n # Allocate Buffer\n profilerMallocRamBuffer(bufferSize)\n\n # Start profiling\n profilerEnableProfiling(true, ProfilerControl::PROFILE_IN_RAM)\n \n # We dump the whole buffer in the end, exit here\n return\n\n when ProfilerControl:: PROFILE_ON_TRACE\n # Start profiling\n profilerEnableProfiling(true, ProfilerControl:: PROFILE_ON_TRACE)\n\n # Start a thread to dump in real-time in the file.\n @@MultiprofilerThread = Thread.new {\n myfile=File.open(filename, \"wb\")\n\n myfile << \"DBGP\"\n myfile << [0,1,0,1].pack(\"c*\")\n\n firstTs = nil\n lastpfTsWrap = 0\n\n mybypass = CHBPConnection.new($CURRENTCONNECTION, [0x94])\n mybypass.open(false)\n begin\n\n loop {\n begin\n a = mybypass.getPacket(0)\n rescue CHBPConnectionTimeout\n sleep 0.01 \n #Sleep when there ain't no packets \n redo\n end\n CRVERBOSE(a.inspect, 2)\n data = a[1]\n ts = (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | data[0]\n # tag = (data[5] << 8) | data[4]\n # puts \"@%12d: %04x\" % [ts,tag]\n if ( firstTs.nil? ) then\n firstTs = ts;\n end\n relTs=ts-firstTs;\n # trace timestamp is based on Greenstone uptime @16384Hz on 32bits\n # profiling format is defined with 1Mhz timespamp on 13 bits\n pfTs=relTs*1000000/16384\n\n while ((pfTs - lastpfTsWrap) > (1<<13)) do\n myfile << [0xff,0xff,0xff,0x7f].pack(\"c*\")\n lastpfTsWrap += (1<<13)\n end\n\n pfts = (pfTs - lastpfTsWrap)\n data[6] = pfts & 0xff\n data[7] = (pfts >> 8) & 0xff\n\n myfile << data[4..7].pack(\"c*\")\n\n }\n rescue Exception => e\n errputs \"Exception happened in trace profiling thread.\"\n CRExceptionPrint e\n ensure\n myfile << [0xff,0xff,0xfe,0x7f].pack(\"c*\")\n myfile.close\n\n mybypass.close\n CRVERBOSE(\"Thread's dead\",2)\n end\n }\n end # case mode\nend",
"def flamegraph(name: 'test', **options, &block)\n raise \"Use PROFILE mode or set config.cache_classes = true\" unless Rails.application.config.cache_classes\n raise \"Use PROFILE mode or set Rails.logger.level = 1\" unless Rails.logger.level == 1\n\n require 'stackprof' # here because gem is not available in prod where we autoload\n\n options[:raw] = true\n options[:mode] ||= :wall\n\n time_taken = nil\n GC.disable\n dump = ActiveSupport::Deprecation.silence do\n StackProf.run(**options) do\n time_taken = Benchmark.realtime(&block)\n end\n end\n GC.enable\n\n report = StackProf::Report.new(dump)\n file = \"#{name}.js\"\n File.open(file, 'w+') { |f| report.print_flamegraph(f) }\n\n spec = Gem::Specification.find_by_name(\"stackprof\")\n path = File.expand_path(file)\n puts \"open in your browser: file://#{spec.gem_dir}/lib/stackprof/flamegraph/viewer.html?data=#{path}\"\n\n time_taken\n end",
"def fixup_request( request )\n\t\tRubyProf.start if request.params && request.params['profile']\n\n\t\tsuper\n\tend",
"def profile block_description, &block \n \tif $profiling_on\n \t\tstart_time = Time.new\n\t\tblock.call\n\t\tduration = Time.new - start_time\n\t\tputs \"#{block_description}: #{duration} seconds\"\n\telse\n\t\tblock.call\n\tend\nend",
"def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\" if $profiling_status\nend",
"def disable_profiling; end",
"def profile_time\n time_elapsed = Benchmark.realtime do\n yield\n end\n\n puts \"Time: #{time_elapsed.round(3)} seconds\"\n # print \";#{time_elapsed.round(3)}\"\n end",
"def dump_profile(_profile); end",
"def runtime; end",
"def main\n require 'benchmark'\n result_hash = nil\n \n time = Benchmark.measure { result_hash = build_pcrs_hash }\n show do\n title \"operations batched\"\n note \"#{time.to_s}\" \n end\n \n log_info result_hash\n {}\n end",
"def start!\n (@benchmarks ||= []) << Time.now\n @current = @benchmarks.size - 1\n end",
"def get_profile_script(env); end",
"def main\n \n require 'benchmark'\n result_hash = nil\n \n time = Benchmark.measure { result_hash = build_pcrs_hash }\n show do\n title \"operations batched\"\n note \"#{time.to_s}\" \n end\n \n log_info result_hash\n \n {}\n end",
"def test_class_methods_sleep\r\n result = RubyProf::Profile.profile(measure_mode: RubyProf::PROCESS_TIME) do\r\n RubyProf::C1.sleep_wait\r\n end\r\n\r\n thread = result.threads.first\r\n assert_in_delta(0.0, thread.total_time, 0.05)\r\n\r\n methods = result.threads.first.methods.sort.reverse\r\n assert_equal(3, methods.length)\r\n\r\n # Check times\r\n method = methods[0]\r\n assert_equal('MeasureProcessTimeTest#test_class_methods_sleep', method.full_name)\r\n assert_in_delta(0.0, method.total_time, 0.05)\r\n assert_in_delta(0.0, method.wait_time, 0.05)\r\n assert_in_delta(0.0, method.self_time, 0.05)\r\n assert_in_delta(0.0, method.children_time, 0.05)\r\n\r\n method = methods[1]\r\n assert_equal('<Class::RubyProf::C1>#sleep_wait', method.full_name)\r\n assert_in_delta(0.0, method.total_time, 0.05)\r\n assert_in_delta(0.0, method.wait_time, 0.05)\r\n assert_in_delta(0.0, method.self_time, 0.05)\r\n assert_in_delta(0.0, method.children_time, 0.05)\r\n\r\n method = methods[2]\r\n assert_equal('Kernel#sleep', method.full_name)\r\n assert_in_delta(0.0, method.total_time, 0.05)\r\n assert_in_delta(0.0, method.wait_time, 0.05)\r\n assert_in_delta(0.0, method.self_time, 0.05)\r\n assert_in_delta(0.0, method.children_time, 0.05)\r\n end",
"def disable_profiling=(_arg0); end",
"def memory_profiled enabled = true, &block\n if enabled\n require 'memory_profiler'\n report = MemoryProfiler.report &block\n report.pretty_print\n else\n yield\n end\nend",
"def profile block_description, &block\n profiling_on = true\n if profiling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend",
"def start_coverage\n return unless sporkless? # Something funny about numbers right now under spork\n require 'simplecov'\nend",
"def bookend(*args, &block)\n CliMiniProfiler.capture(*args, &block)\nend",
"def start_tests\n recursion = 0\n loop = 0\n Benchmark.bm(20) do |x|\n x.report('recursion') {recursion = recursion_test}\n x.report('loop') {loop = loop_test}\n end\n puts \"\\n\"\n printf(\"Fibonacci recursion: %i\\n\", recursion || 0)\n printf(\"Fibonacci loop: %i\\n\", loop)\n\n end",
"def test_likely_convergence\n system \"cd #{ROOT_DIR} && RUBYLIB=lib ./exe/abprof --fail-on-divergence --pvalue=0.05 --min-trials=2 --max-trials=10 examples/for_loop_10k.rb examples/sleep.rb 2>&1 >> /dev/null\"\n assert $?.success?\n end",
"def initialize(app)\n @app = app\n @count = 0\n\n # Hard-coded sample:\n sample_interval_ns = 100_000\n\n # Or, you could use your expected sample time and have the system\n # figure out an appropriate sampling rate. E.g., if an unprofiled run\n # takes 10 seconds of CPU time, then the following calculates the\n # appropriate sample rate.\n #\n # unprofiled_cputime_seconds = 10\n # sample_interval_ns = Maglev::Gprof.compute_interval(unprofiled_cputime_seconds)\n\n @gprof_monitor = Maglev::Gprof.create(sample_interval_ns)\n end",
"def benchmark(reporter); end",
"def benchmark!\n @benchmark = true\n end",
"def myprofile\n \n end",
"def quick_stats\n\tend",
"def profile(match, &block)\n if match === (ENV['profile'] || ENV['p'])\n block.call\n end\n end",
"def profile()\r\n puts \"#{@name} has #{@hitpoint} and #{@attack_damage} attack damage\"\r\n end",
"def instrument; end",
"def test_likely_divergence\n system \"cd #{ROOT_DIR} && RUBYLIB=lib ./exe/abprof --fail-on-divergence --pvalue=0.0001 --min-trials=5 --max-trials=5 --iters-per-trial=1 examples/sleep.rb examples/sleep.rb 2>&1 >> /dev/null\"\n assert_equal 2, $?.exitstatus\n end",
"def index\n StackProf.run(mode: :cpu, out: 'tmp/stackprof-cpu-myapp.dump', raw: true) do\n @snails = Snail.preload(:trails).all\n\n render :index\n end\n end",
"def library_load_start(file_count)\n puts \"Compilation\"\n end",
"def shutdown\n puts \"Shutting Down...\"\n puts \"Elapsed Time: #{Time.now - @start}\"\n #result = RubyProf.stop\n #printer = RubyProf::GraphHtmlPrinter.new(result) #<= Prints Process Performance\n #file = File.open('result.html', \"w\")\n #printer.print(file, {})\n sleep 10\n @server.close\n exit!\n end",
"def manage_profiling(env)\n start_profiling if @count == 10\n if @count == 500\n stop_profiling\n save_report\n end\n end",
"def profile_memory\n memory_usage_before = `ps -o rss= -p #{Process.pid}`.to_i\n yield\n memory_usage_after = `ps -o rss= -p #{Process.pid}`.to_i\n\n used_memory = ((memory_usage_after - memory_usage_before) / 1024.0).round(2)\n puts \"Memory usage: #{used_memory} MB\"\n # print \";#{used_memory}\\n\"\n end",
"def go_very_slow\n puts \"I am a heavy truck and like going very slow.\"\n end",
"def benchmark\n start = Time.now\n yield\n p Time.now - start\nend",
"def auto_analyze=(_arg0); end",
"def program; end",
"def profiler_report(label='', extra_pids={})\n report_perf_profiler(label, extra_pids)\n end",
"def go_slow\n puts \"I am safe and driving slow.\"\n end",
"def profile name\n num_array = @numbers_to_sort\n start = Time.now\n yield(num_array)\n finish = Time.now\n puts \"%20s %20f\" % [name, finish - start]\nend",
"def load_profile(name); end",
"def warmup(prc = T.unsafe(nil), &block); end",
"def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend",
"def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend",
"def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend",
"def performance(index)\n puts \"\\n#{@testcase.name}\\n\"\n puts \" %-10s %-20s %-8s %s \" % [\"#{@response.runtime.to_s[0..6]}s\", \"[#{result_case}]\", @testcase.request['method'], @response.fully_qualified_path]\n end",
"def calculateMappingStats()\n cmd = \"ruby \" + File.dirname(__FILE__) + \"/BWAMapStats.rb \" + @markedBam\n puts \"Command to generate Mapping Stats : \" + cmd\n return cmd\n end",
"def coverage; end",
"def coverage; end",
"def stats; end",
"def stats; end",
"def initialize\n @num_files = @num_classes = @num_modules = @num_methods = 0\n @start = Time.now\n \n @coverage = { }\n\n [:class, :method, :module].each do |type|\n @coverage[type] = { :covered => [], :not_covered => [] }\n end\n \n @coverage[:tokens] = {}\n end",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def show_usage\n STDERR.puts \"\\nusage: ./build [ profile=<name> ] [ --minify ]\"\n STDERR.puts \"\\nsupported profiles are:\"\n Dir.chdir(PROFILE_PATH) do\n STDERR.puts Dir['*.js'].map {|profile| \"\\t#{profile.sub(/\\.js/, '')}\"}\n end\n STDERR.puts \"\\nIf no profile is selected, 'core' will be used\\n\\n\"\n exit(1)\nend",
"def initialize(opts)\n resume = opts[:resume]\n source_host_def = define_source(opts[:config])\n source_host_ssh = CLI.spinner(\"Logging in to #{source_host_def[:host]}\") do\n host_login(source_host_def)\n end\n\n profile = CLI.spinner(\"Checking source host\") do\n profile = Profile.new(source_host_ssh)\n profile.build\n profile\n end\n platform = Platform::V2.new(profile[:cpe])\n\n memory = profile[:memory]\n memory_percent = memory[:mem_used].to_f / memory[:total] * 100\n swapping = memory[:swapping?]\n ftag = \"#{CLI.bold}%15s#{CLI.reset}:\"\n hist_mem = profile[:memory_hist][:mem_used]\n\n puts\n puts \"#{CLI.bold}System Information#{CLI.reset}\"\n puts \"#{ftag} #{platform} (#{profile[:cpe]})\" % \"OS\"\n puts \"#{ftag} #{profile[:arch]}\" % \"Arch\"\n puts \"#{ftag} #{profile[:hostname]}\" % \"Hostname\"\n puts\n\n puts \"#{CLI.bold}CPU Statistics#{CLI.reset}\"\n puts \"#{ftag} %d\" % [\"CPU Count\", profile[:cpu][:count]]\n puts \"#{ftag} %d MHz\" % [\"CPU Speed\", profile[:cpu][:speed]]\n puts \n\n puts \"#{CLI.bold}Memory Statistics#{CLI.reset}\"\n puts \"#{ftag} %d MiB\" % [\"Total RAM\", memory[:total]]\n puts \"#{ftag} %d MiB (%2.1f%%)\" % [\"RAM Used\", memory[:mem_used],\n memory_percent]\n puts \"#{ftag} %d MiB\" % [\"Swap Used\", memory[:swap_used]] if swapping\n puts \"#{ftag} %d%%\" % [\"Hist. RAM Used\", hist_mem] unless hist_mem.nil?\n puts \n\n puts \"#{CLI.bold}Hard Disk Statistics#{CLI.reset}\"\n puts \"#{ftag} %2.1f GB\" % [\"Disk Used\", profile[:disk]]\n puts\n\n puts \"#{CLI.bold}System Statistics#{CLI.reset}\"\n puts \"#{ftag} #{profile[:io][:uptime]}\" % \"Uptime\"\n puts \"#{ftag} #{profile[:io][:wait]}\" % \"I/O Wait\"\n puts\n\n puts \"#{CLI.bold}IP Information#{CLI.reset}\"\n puts \"#{ftag} #{profile[:ip][:public].join(', ')}\" % \"Public\"\n puts \"#{ftag} #{profile[:ip][:private].join(', ')}\" % \"Private\"\n puts\n\n puts \"#{CLI.bold}MySQL Databases#{CLI.reset}\"\n puts \"#{ftag} #{profile[:db][:count]}\" % \"Number\"\n puts \"#{ftag} #{profile[:db][:size]}\" % \"Total Size\"\n puts\n\n puts \"#{CLI.bold}Libraries#{CLI.reset}\"\n puts \"#{ftag} #{profile[:lib][:libc]}\" % \"LIBC\"\n puts \"#{ftag} #{profile[:lib][:perl]}\" % \"Perl\"\n puts \"#{ftag} #{profile[:lib][:python]}\" % \"Python\"\n puts \"#{ftag} #{profile[:lib][:ruby]}\" % \"Ruby\"\n puts \"#{ftag} #{profile[:lib][:php]}\" % \"PHP\"\n unless profile.warnings.empty?\n puts\n print CLI.red + CLI.bold\n profile.warnings.each { |warning| puts warning }\n print CLI.reset\n end\n\n source_host_ssh.logout!\n end",
"def main profile_log\n # Script options\n # absolute_path doesn't work on 1.8.7 :-(\n # profile_log = File.absolute_path(profile_log)\n # hostname\n hostname = Socket.gethostname\n\n profile_output_file = Dir.pwd + (\"/%s.yml\" % hostname)\n\n puts \"This script is used to provide Puppet Labs with information regarding the\"\n puts \"setup of the puppet master in order to find areas where we can improve the\"\n puts \"puppet masters capacity.\"\n puts\n puts \"We will create a file named #{profile_output_file} with the following information in it:\"\n puts \" - Hardware Specs (OS, RAM, Swap, CPU, Virtual/Physical, Kernel, ect.)\"\n puts \" - Ruby Version and Puppet/Facter/Hiera Versions\"\n puts \" - Puppet Module Count on Master\"\n puts \" - If the Node Classifier is being used on the Master\"\n puts \" - Hiera complexity (How deep the hierarchical tree is)\"\n puts \" - Puppet Master profile data if applicable\"\n puts \" - Estimated Managed Node Count (using number of certs)\"\n puts\n if !continue_or_exit(\"Do you wish to continue and have the script generate a #{profile_output_file} file? \", \"y\", \"y\")\n abort(\"Script canceled by user.\")\n end\n puts\n puts \"--------------------------------------------------\"\n\n answers = {}\n\n # Gather Profile Data\n\n puts \"Gathering Profile Data from '#{profile_log}'\"\n if !File.exist?(profile_log)\n abort(\"File '#{profile_log}' does not exist.\")\n end\n lines = []\n File.open(profile_log).each_line do |line|\n if line =~ /PROFILE/\n lines.push(line)\n end\n end\n answers[\"profile_data\"] = lines.join(\"\\n\")\n\n # Gather system facts\n\n puts \"Gathering Hardware specs from Facter...\"\n answers['facter'] = gather_facts [\n \"architecture\",\n \"facterversion\",\n \"hardwareisa\",\n \"hardwaremodel\",\n \"is_virtual\",\n \"kernel\",\n \"kernelversion\",\n \"memoryfree_mb\",\n \"memorysize_mb\",\n \"os\",\n \"processors\",\n \"puppetversion\",\n \"rubyversion\",\n \"swapfree_mb\",\n \"swapsize_mb\",\n \"virtual\",\n ]\n\n # Get puppet module count\n # Helps us get a rough idea of how much Puppet is being used.\n\n puts \"Gathering modules count\"\n answers['module_count'] = get_module_count\n\n puts \"Gathering certificate count\"\n answers['cert_count'] = get_cert_count\n\n # Using a node classifier?\n\n puts \"Gathering Node Classifier details\"\n answers['node_classifier'] = puppet_master_config(\"node_terminus\")\n\n puts \"--------------------------------------------------\"\n\n # Approximate Number of nodes\n puts\n puts \"About how many nodes does this master manage?\"\n print \"Enter a number: \"\n answers[\"user_nodes\"] = $stdin.gets.chomp\n puts\n\n #while continue_or_exit(\"Would you like us to add additional profiles from a node you specify?\", \"n\", \"y\")\n # puts \"Please specify a node name to profile\"\n # print \"Node name: \"\n # node_name = $stdin.gets.chomp\n # puts \"Compiling a catalog\"\n #end\n\n ymlfile = File.open(profile_output_file, \"w\")\n ymlfile.write(answers.to_yaml)\n ymlfile.close()\n\n puts \"--------------------------------------------------\"\n puts\n puts \"A yaml file with your profile data has been put at #{profile_output_file}.\"\n puts\n puts \"Please email this file to 'britt@puppetlabs.com' along with any additional\"\n puts \"information you would like to include.\"\n puts\n puts \"--------------------------------------------------\"\n\nend",
"def bench(descr)\n start = Time.now\n yield\n puts \"#{descr} : #{Time.now-start} seconds\"\nend",
"def start_run; end",
"def go_faster\n ping_check \"go_faster\"\n end",
"def measure(test,platform)\n Dir.chdir test do |path|\n test_name = test.gsub /^tests\\//, ''\n if (platform == :'jvm') \n if (File.exist? \"#{test_name}.class\")\n command = \"java #{classpath()} #{test_name} #{test_params()}\" \n else \n return \"N/A\"\n end \n elsif (platform == :'stx')\n if (File.exist? \"#{test_name}.st\") \n command = \"smalltalk -I --quick -f #{test_name}.stx #{test_params} 2>&1\"\n else \n return \"N/A\"\n end\n elsif (platform == :'libjava') \n if (File.exist? \"#{test_name}.class\") \n command = \"smalltalk -I --quick -f #{test_name}.libjava #{test_params} 2>&1\"\n else \n return \"N/A\"\n end\n\n else \n raise Exception.new(\"Unssuported platform: #{platform}\") \n end\n \n puts \" running: #{command}\"\n output = `#{command}`\n if ($? != 0) \n puts output\n raise Exception.new(\"Command failed!\")\n end\n execution_time = (output.scan /^EXECUTION TIME: \\d*[\\.\\d]\\d*$/).last()\n execution_time = execution_time.gsub /^EXECUTION TIME: /, ''\n return execution_time \n end \nend",
"def main; end",
"def measure; end",
"def another_way_of_calling_sample(profiler_overhead_stack_thread: Thread.current)\n sample(profiler_overhead_stack_thread: profiler_overhead_stack_thread)\n end",
"def with_profiling\n if options.profile?\n begin\n require \"memory_profiler\"\n MemoryProfiler.report(:top => 10_240) { yield }.pretty_print({\\\n :to_file => \"mem.txt\"\n })\n rescue LoadError\n $stderr.puts \"The gem 'memory_profiler' wasn't found.\"\n $stderr.puts \"You can install it with `gem install memory_profiler'\"\n abort \"Hope you install it so you can report back.\"\n end\n\n else\n yield\n end\n\n rescue Excon::Errors::SocketError\n $stderr.puts \"Unable to connect to your Docker Instance.\"\n $stderr.puts \"Are you absolutely sure that you have the Docker installed?\"\n abort \"Unable to build your images.\"\n\n rescue Exception\n raise unless $ERROR_POSITION\n $ERROR_POSITION.delete_if do |source|\n source =~ %r!#{Regexp.escape(\n __FILE__\n )}!o\n end\n\n raise\n end",
"def custom_benchmark(name)\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"#{name} Time in Seconds: #{elapsed_time}\"\nend",
"def main\n dict={}\n c=0; p=0\n gtf=gtfread(GTFPATH)\n Dir.glob(DIRECTORY+\"/**/*.pre\").each do |path|\n dict[path.split('/')[-1].split('.')[0]]=process(path, gtf)\n end\n genes,c,p=significant(gtf)\n dc=(C/c).floor\n dp=(P/p).floor\n Dir.glob(DIRECTORY+\"/**/*.pre\").each do |path|\n printer(path.split('.')[0]+\".fc\",dict[path.split('/')[-1].split('.')[0]],gtf,dc,dp,genes,\"foldchange\")\n printer(path.split('.')[0]+\".pval\",dict[path.split('/')[-1].split('.')[0]],gtf,dc,dp,genes,\"pval\")\n end\n bashcommands\nend",
"def loadtest()\n\n # Redirect $stdout (Console output) to nil\n\n # Workout the delay time of the script\n $scriptdelaytime = $scriptdelaytime + $ramp_up_time\n\n # Sleep for that delay time, so we can start ramping up users incrementally\n sleep $scriptdelaytime\n\n # Get which cucumber scenario by using the $vuser_inc variable.\n cucumber_scenario = $vuser_scenarios[$vuser_inc]\n # Increase this variable by 1 so the other scenarios can use it\n $vuser_inc = $vuser_inc + 1\n\n # convervate the cucumber scenario name, into the class name\n scenario_name = cucumber_scenario.gsub('(','').gsub(')', '').gsub(/ /, '_').capitalize\n\n # create an instance of the class from the (step_defitions/performance) file\n script = Module.const_get(scenario_name).new\n\n # Increase the variable which keeps track of running virtual users\n $running_v_users = $running_v_users + 1\n\n iteration = 0\n\n # Loop through for the duration of the test, this will run the test each time it loops\n while ((Time.new.to_i) < ($starttime + $duration)) do\n\n iteration += 1\n\n # Works out the start time of the current test (iteration)\n scriptstart_time = Time.now\n\n # We'll run the test in a try/except block to ensure it doesn't kill the thread\n begin\n # Call the threads action step\n script.v_action()\n\n # As the test has finished, work out the duration\n script_duration = (Time.now - scriptstart_time) * 1000\n\n # If the duration is above the x axis current value, let's increase it\n if ((script_duration / 1000) > $max_x) then\n $max_x = (script_duration / 1000).ceil + 1\n end\n\n # If the current cucumber scenario have no results, lets define their arrays\n if ($results_scenarios[cucumber_scenario].nil?) then\n $results_scenarios[cucumber_scenario] = []\n $results_scenarios_graph[cucumber_scenario] = {}\n end\n\n # Add the duration of the test to an array so we can work our max/min/avg etc...\n $results_scenarios[cucumber_scenario] << script_duration\n\n # For each second we need to build up an average, so need to build up another array\n # based on the current time\n current_time_id = $duration - (($starttime + $duration) - Time.new.to_i) + 1\n\n # If the array doesn't exist for the current time, then lets define it\n if($results_scenarios_graph[cucumber_scenario][current_time_id].nil? == true) then\n $results_scenarios_graph[cucumber_scenario][current_time_id] = Array.new()\n end\n\n # Add the value to the array\n $results_scenarios_graph[cucumber_scenario][current_time_id].push(script_duration)\n\n rescue Exception=>e\n # If it fails, keep a log of why, then carry on\n\n error = {}\n error['error_message'] = e.to_s + '<br>' + e.backtrace.to_s\n error['error_iteration'] = iteration\n error['error_script'] = cucumber_scenario\n\n # $stdout.puts 'Error: ' + e + \"\\n\" + backtrace.map {|l| \" #{l}\\n\"}.join\n\n\n $scenario_errors[cucumber_scenario] += 1\n\n #$stdout.puts $scenario_errors\n\n $error_log << error\n\n $total_failures += 1\n # $stdout.puts 'Error: ' + e + \"\\n\" + backtrace.map {|l| \" #{l}\\n\"}.join\n end\n\n $scenario_iterations[cucumber_scenario] += 1\n\n\n # Sleep a second between each scenario. This will need to be parametised soon\n sleep(1)\n\n end\n # Once the test has finished, lets decrease the $running_v_users value\n $running_v_users = $running_v_users - 1\n\nend",
"def benchs\n %w( alchemy_api google_api language_detector language_detector_tc whatlanguage )\n end",
"def record_performance\n File.open('.specjour/performance', 'w') do |file|\n ordered_specs = profiler.to_a.sort_by {|test, data| -data[0].to_f}.map do |test, data|\n file.puts \"%6f:%s:%s\" % [data[0], test, data[1]]\n end\n end\n end",
"def accelerate\n puts \"Stepping on the gas\"\n puts \"Speeding up\"\nend",
"def valgrind_coverage(valgrindTrace)\n\n\t\t\t# Open the valgrind xml trace file\n\t\t\txmlFile = File.open(valgrindTrace, \"r\")\n\t\t\txmlDoc = Nokogiri::XML(xmlFile)\n\n\t\t\t# Delete any previous hit traces\n\t\t\t@attributes.functionHitTrace.clear()\n\n\t\t\t# Parse all the function hits \n\t\t\txmlDoc.xpath(\"//hit\").each do |hit|\n\t\t\t\tfunctionOffset = hit.search(\"offset\").first().inner_text()\n\t\t\t\t#puts \"Function offset hit: #{functionOffset}\"\n\t\t\t\tif(@attributes.functionHash.has_key?(functionOffset)) then\n\t\t\t\t#puts \"Function offset found: #{functionOffset}\"\n\t\t\t\t\tif(!@attributes.functionHitTrace.has_key?(functionOffset)) then\n\t\t\t\t\t\t@attributes.functionHitTrace[functionOffset] = [1] \n\t\t\t\t\telse\n\t\t\t\t\t\t@attributes.functionHitTrace[functionOffset][0] = @attributes.functionHitTrace[functionOffset][0] + 1 \n\t\t\t\t\tend\n\n\t\t\t\t\t# Parse all the functions this function called\n\t\t\t\t\thit.xpath(\"callee\").each do |callee|\n\t\t\t\t\t\tcalleeOffset = callee.search(\"offset\").first().inner_text()\n\t\t\t\t\t\tnumberOfCalls = callee.search(\"numberOfCalls\").first().inner_text().to_i()\n\t\t\t\t\t\tif(@attributes.functionHash.has_key?(calleeOffset)) then\n\t\t\t\t\t\t\tif(!@attributes.functionHitTrace.has_key?(functionOffset)) then\n\t\t\t\t\t\t\t\t@attributes.functionHitTrace[functionOffset] = [numberOfCalls] \n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t@attributes.functionHitTrace[functionOffset][0] = @attributes.functionHitTrace[functionOffset][0] + numberOfCalls \n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t#puts \"Function offset: #{functionOffset} -> #{calleeOffset}\"\n\t\t\t\t\t\t\t# Increment the number of transitions for a state\n\t\t\t\t\t\t\t@attributes.functionHash[functionOffset].numTransitions += BigDecimal(\"#{numberOfCalls}\")\n\n\t\t\t\t\t\t\t# Update the transition matrix\n#\t\t\t\t\t\t\t@attributes.transitionMatrix[@attributes.functionHash[functionOffset].markovIdx, @attributes.functionHash[calleeOffset].markovIdx] = @attributes.transitionMatrix[@attributes.functionHash[functionOffset].markovIdx, @attributes.functionHash[calleeOffset].markovIdx] + BigDecimal(\"#{numberOfCalls}\") \n\n\t\t\t\t\t\t\t# Keep track of call trace and number of times called\n\t\t\t\t\t\t\t@attributes.trace << \"#{@attributes.functionHash[functionOffset].markovIdx}:#{@attributes.functionHash[calleeOffset].markovIdx}:#{numberOfCalls}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend # end callee xpath\n\t\t\t\tend # end function hash check for hit function\n\t\t\tend # end hit xpath\n\n\t\t\t# Cleanup open file\n\t\t\txmlFile.close()\n\t\tend",
"def speed_up\n self.speed += 5\n info\n end",
"def speed_up\n self.speed += 5\n info\n end",
"def start\n require 'irbtools'\n end",
"def bench type\n t1 = Time.now\n yield\n t2 = Time.now\n p \"#{type} used #{t2 - t1} seconds\"\nend",
"def measure_overhead\n t=Benchmark::Tms.new\n cnt=0\n rep=0\n runs=OVERHEAD_CALC_RUNS\n while t.total<OVERHEAD_CALC_MIN_TIME && rep<OVERHEAD_CALC_MAX_REPETITIONS\n t+=Benchmark.measure do\n runs.times {measure(:a) {}}\n end\n rep += 1 # Count the repetitions\n cnt += runs # Count the total runs\n runs *= 2 # Increases the number of runs to quickly adapt to the speed of the machine\n end\n {:time=>t,:count=>cnt}\n end",
"def enable_profiling\n if current_user && CurateND::AdminConstraint.is_admin?(current_user.username)\n Rack::MiniProfiler.authorize_request\n end\n end",
"def procs(to = $stdout)\n procs = {}\n \n ObjectSpace.each_object(Proc) do |blk|\n sloc_arr = blk.source_location\n next if !sloc_arr\n \n sloc = \"#{sloc_arr[0]}:#{sloc_arr[1]}\"\n procs[sloc] = 0 if !procs.key?(sloc)\n procs[sloc] += 1\n end\n \n procs = Knj::ArrayExt.hash_sort(procs) do |ele1, ele2|\n ele2[1] <=> ele1[1]\n end\n \n to.puts \"<h1>Alive procs by source</h1>\"\n to.puts \"<table style=\\\"width: 600px;\\\">\"\n to.puts \"\\t<tbody>\"\n \n procs.each do |sloc, count|\n next if count <= 2\n \n to.puts \"\\t\\t<tr>\"\n to.puts \"\\t\\t\\t<td>\"\n to.puts \"\\t\\t\\t\\t#{sloc}\"\n to.puts \"\\t\\t\\t</td>\"\n to.puts \"\\t\\t\\t<td style=\\\"text-align: right;\\\">\"\n to.puts \"\\t\\t\\t\\t#{_hb.num(count, 0)}\"\n to.puts \"\\t\\t\\t</td>\"\n to.puts \"\\t\\t</tr>\"\n end\n \n to.puts \"\\t</tbody>\"\n to.puts \"</table>\"\n end",
"def profile_parameter; end",
"def acccelerate\n puts \"stepping on the gas\"\n puts \"Speeding up\"\nend",
"def run(*series)\n puts \"\\n\\\"Benchmarking!\\\" -- http://xkcd.com/303/\" \n series = [1] if series.empty?\n series.each_index do |n|\n times = series[n] \n puts \"\\nSeries #{n+1}/#{series.size} - #{times} times\"\n results = {}\n @codes.each do |title, code|\n results[title] = bmark title, times do\n code.call \n end\n end\n\n # Order and display results\n results = results.sort{ |a,b| a[1] <=> b[1] }\n best = results.delete_at(0)\n puts \"Best on #{times} times: #{best[0].upcase} with #{time best[1]}\"\n results.each do |title, result|\n puts \"...it's \" + format(ratio(result,best[1])).to_s + \"x faster than #{title}\"\n end\n end\n puts \"\\nBenchmarks finished, back to work!\\n\\n\"\n end",
"def cpu_usage_information\n super\n end",
"def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapsed_time}\"\nend"
] |
[
"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.58279365",
"0.57853645",
"0.5764695",
"0.57596874",
"0.5708529",
"0.5707755",
"0.5689749",
"0.5662153",
"0.56243265",
"0.56163466",
"0.55792004",
"0.556656",
"0.55560315",
"0.5549489",
"0.5495081",
"0.5494491",
"0.5494318",
"0.5489289",
"0.54891646",
"0.54688054",
"0.5451406",
"0.54508346",
"0.543708",
"0.54222476",
"0.54148144",
"0.5402507",
"0.5379376",
"0.53618294",
"0.53568256",
"0.5336595",
"0.5329244",
"0.5320919",
"0.5317807",
"0.5313595",
"0.5304848",
"0.53044313",
"0.528084",
"0.52732337",
"0.52482563",
"0.5239858",
"0.5239858",
"0.5239858",
"0.5237",
"0.5229071",
"0.5222385",
"0.5222385",
"0.52089804",
"0.52089804",
"0.5208732",
"0.5207608",
"0.5206403",
"0.5206177",
"0.5165608",
"0.51650727",
"0.5153629",
"0.5144577",
"0.51329327",
"0.51318955",
"0.51225233",
"0.51105034",
"0.5091632",
"0.5078186",
"0.507723",
"0.50654006",
"0.5065016",
"0.505981",
"0.5056958",
"0.5054004",
"0.5041475",
"0.5041475",
"0.5035313",
"0.50343144",
"0.50301325",
"0.50231624",
"0.5021677",
"0.50176966",
"0.5014685",
"0.50016207",
"0.49961007",
"0.49936688"
] |
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[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def index\n @pacientes = Paciente.all\n end",
"def index\n @pacientes = current_user.pacientes\n end",
"def index\n @pacientis = Pacienti.all\n end",
"def new\n\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def Plan_Paciente\n id = params[:id]\n plan_paciente = PlanPaciente.find_by_sql(\"SELECT nombre FROM plan_pacientes where laboratorio_id= #{id}\")\n render json: plan_paciente\n end",
"def get_paciente\n @paciente= Paciente.find(params[:id])\n end",
"def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def index\n @enfermeras_pacientes = EnfermerasPaciente.all\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def index\n @pacientes = Paciente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pacientes }\n end\n end",
"def show\n pac_info = PacInfo.find(params[:id])\n render json: pac_info\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def patina\n sectors = Sector.where(user: current_user).load\n subsectors = Subsector.where(sector_id: sectors.map(&:id)).group_by(&:sector_id)\n activities = Activity.where(subsector_id: subsectors.values.flatten.map(&:id)).group_by(&:subsector_id)\n\n @json_locals = { sectors: sectors, subsectors: subsectors, activities: activities }\n\n respond_to do |format|\n format.html { render 'patina' }\n format.json { render partial: 'patina', locals: @json_locals, status: :ok }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n @paciente = @persona.perstable\n #aqui deben ir los datos del paciente tambien\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def create\n @pacient = Pacient.new(pacient_params)\n\n respond_to do |format|\n if @pacient.save\n format.html { redirect_to @pacient, notice: 'Pacient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pacient }\n else\n format.html { render action: 'new' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def set_pacient\n @pacient = Pacient.find(params[:id])\n end",
"def set_pacient\n @pacient = Pacient.find(params[:id])\n end",
"def new\n @paciente = Paciente.new\n @paciente.pessoa = Pessoa.new\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @paciente }\n #end\n end",
"def index\n @persona = Persona.find(params[:persona_id])\n @info_extra_paciente = @persona.info_extra_pacientes.all\n format.html { render :show }\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def show\n @pacient = Pacient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pacient }\n end\n end",
"def patients\n patients = User.patients\n render json: { status: 200, data: patients }\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n pessoa = Pessoa.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded pessoa', data:pessoa},status: :ok\n end",
"def get_paciente\n @paciente= FichaNutricionalAdulto.find(params[:idd]).paciente\n end",
"def index\n @pantries = Pantry.all\n end",
"def set_pacienti\n @pacienti = Pacienti.find(params[:id])\n end",
"def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"def index\n @exames_pacientes = ExamesPaciente.all\n end",
"def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end",
"def index\n @assuntos = Assunto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assuntos }\n end\n end",
"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 format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def show\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vehicule_perso }\n end\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def index\n @puntajes = Puntaje.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end",
"def InfoPlanPaciente\n \tid = params[:id]\n @plan_paciente = TipoPlan.find_by_sql(\"select descripcion FROM tipo_plans where plan_paciente_id = #{id} and tipo = 'Paciente'\")\n render json: @plan_paciente\n end",
"def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def get_paciente\r\n @paciente= FichaOdontologica.find(params[:idd]).paciente\r\n end",
"def create\n @paciente = Paciente.new(paciente_params)\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_prefectures\n server_response = handle_timeouts do\n get '/1/neighborhoods.json?locale=en'\n end\n server_response['response']\n end",
"def create\n @pacienti = Pacienti.new(pacienti_params)\n\n respond_to do |format|\n if @pacienti.save\n format.html { redirect_to @pacienti, notice: 'Pacienti was successfully created.' }\n format.json { render :show, status: :created, location: @pacienti }\n else\n format.html { render :new }\n format.json { render json: @pacienti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end",
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def index\n @paciente_serviciocomplementarios = PacienteServiciocomplementario.all\n end",
"def show\n @puestos_entidad = PuestosEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puestos_entidad }\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n #paciente_by_nutriologo = Paciente.where(nutriologo_id: session[:nutriologo_id])\n @pacientes = Persona.paciente\n # Se opto por crear un scope, de esta forma ya se manda a llamar solo esl scope como muestra arriba. el scope esta definido en el modelo\n # persona.perstable <= esto obtiene el registro que concide con el id seleccionado algo como Paciente.where(id:\n end",
"def show\n @ingridients = get_pizza_ingridients\n end",
"def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def show\n @plato = Plato.find(params[:id])\n\n if !@plato.comentario.first.nil?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def set_paciente\n @persona = Persona.find(params[:id])\n @paciente = @persona.perstable\n end",
"def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def index\n @poblamiento_import_locations = PoblamientoImportLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poblamiento_import_locations }\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n @faculties = Faculty.all\n json_response(@faculties)\n end",
"def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end",
"def index\n @paies = @periode.paies.all\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def index\n @calificaciones = Calificacion.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @calificaciones }\n end\n end",
"def index\n\t\texecutar_acoes\n\t\t@pontos = PontoInteresse.all.order(\"enable DESC, denuncias_count DESC, created_at DESC\").page(params[:page])\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pontos }\n\t\tend\n\tend",
"def index\n authorize! :index, Por, :message => 'Acceso denegado.'\n @pors = @campus.pors.paginate(:per_page => 3, :page => params[:page])\n\t\t@points = @pors\n\t\t@point_name = \"por\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render \"points/index.json.erb\" } # index.json.erb\n end\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end"
] |
[
"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.61329114",
"0.61160535",
"0.6109641",
"0.6076531",
"0.6060428",
"0.6049244",
"0.60153246",
"0.60144794",
"0.6009329",
"0.6008708",
"0.6008708",
"0.6008129",
"0.6005552",
"0.59897673",
"0.5988562",
"0.5964383",
"0.5959477",
"0.5956496",
"0.5956496",
"0.5941309",
"0.5932223",
"0.59304243",
"0.59284365",
"0.58825755",
"0.58725774",
"0.5862154",
"0.58512825",
"0.58377045",
"0.5829042",
"0.58205503",
"0.5816012",
"0.57990414",
"0.5798647",
"0.5797272",
"0.5783881",
"0.57784414",
"0.57765704",
"0.57587206",
"0.57461435",
"0.5742382",
"0.57359",
"0.57264316",
"0.572456",
"0.5722348",
"0.5721735",
"0.57157964",
"0.57130015",
"0.57126087",
"0.57123315",
"0.57025236",
"0.57003856",
"0.5696471",
"0.5689241",
"0.5688969",
"0.56857455",
"0.56775504",
"0.56738955",
"0.5671344",
"0.56678975",
"0.56651187",
"0.56641376",
"0.56634307",
"0.5663337",
"0.5661564",
"0.56612647",
"0.5660779",
"0.5649189",
"0.56475747",
"0.564305",
"0.5643016",
"0.56411606",
"0.5637497",
"0.56314635",
"0.5628701",
"0.56271136",
"0.56216604",
"0.5617692",
"0.56158614",
"0.56116337",
"0.56104696"
] |
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[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paciente }\n end\n end",
"def Plan_Paciente\n id = params[:id]\n plan_paciente = PlanPaciente.find_by_sql(\"SELECT nombre FROM plan_pacientes where laboratorio_id= #{id}\")\n render json: plan_paciente\n end",
"def get_paciente\n @paciente= Paciente.find(params[:id])\n end",
"def index\n @pacientes = Paciente.all\n end",
"def new\n\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n pac_info = PacInfo.find(params[:id])\n render json: pac_info\n end",
"def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def index\n @pacientis = Pacienti.all\n end",
"def show\n @persona = Persona.find(params[:id])\n @paciente = @persona.perstable\n #aqui deben ir los datos del paciente tambien\n end",
"def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end",
"def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end",
"def index\n @pacientes = current_user.pacientes\n end",
"def show\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @papel }\n end\n end",
"def show\n @pacient = Pacient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pacient }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def InfoPlanPaciente\n \tid = params[:id]\n @plan_paciente = TipoPlan.find_by_sql(\"select descripcion FROM tipo_plans where plan_paciente_id = #{id} and tipo = 'Paciente'\")\n render json: @plan_paciente\n end",
"def set_pacient\n @pacient = Pacient.find(params[:id])\n end",
"def set_pacient\n @pacient = Pacient.find(params[:id])\n end",
"def index\n @pacientes = Paciente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pacientes }\n end\n end",
"def show\n pessoa = Pessoa.find(params[:id])\n render json: {status: 'SUCCESS', message:'Loaded pessoa', data:pessoa},status: :ok\n end",
"def show\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @vehicule_perso }\n end\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def new\n @paciente = Paciente.new\n @paciente.pessoa = Pessoa.new\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @paciente }\n #end\n end",
"def get_paciente\n @paciente= FichaNutricionalAdulto.find(params[:idd]).paciente\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end",
"def index\n @persona = Persona.find(params[:persona_id])\n @info_extra_paciente = @persona.info_extra_pacientes.all\n format.html { render :show }\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def get_paciente\r\n @paciente= FichaOdontologica.find(params[:idd]).paciente\r\n end",
"def set_pacienti\n @pacienti = Pacienti.find(params[:id])\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def index\n @papels = Papel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @papels }\n end\n end",
"def show\n @plato = Plato.find(params[:id])\n\n if !@plato.comentario.first.nil?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def index\n @enfermeras_pacientes = EnfermerasPaciente.all\n end",
"def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end",
"def patina\n sectors = Sector.where(user: current_user).load\n subsectors = Subsector.where(sector_id: sectors.map(&:id)).group_by(&:sector_id)\n activities = Activity.where(subsector_id: subsectors.values.flatten.map(&:id)).group_by(&:subsector_id)\n\n @json_locals = { sectors: sectors, subsectors: subsectors, activities: activities }\n\n respond_to do |format|\n format.html { render 'patina' }\n format.json { render partial: 'patina', locals: @json_locals, status: :ok }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @petition = Petition.friendly.find(params[:id])\n\n render json: @petition\n end",
"def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end",
"def set_paciente\n @persona = Persona.find(params[:id])\n @paciente = @persona.perstable\n end",
"def index\n @parishes = Parish.all\n\n render json: @parishes\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def show\n @puestos_entidad = PuestosEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puestos_entidad }\n end\n end",
"def create\n @pacient = Pacient.new(pacient_params)\n\n respond_to do |format|\n if @pacient.save\n format.html { redirect_to @pacient, notice: 'Pacient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pacient }\n else\n format.html { render action: 'new' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def show\n @presenza = Presenza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @presenza }\n end\n end",
"def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def show\n @palestrante = Palestrante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def show\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilnegocio }\n end\n end",
"def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end",
"def index\n @estacionamientos = Estacionamiento.all\n\n @json = Estacionamiento.all.to_gmaps4rails\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @estacionamientos }\n end\n end",
"def show\n @empresa_servicio = EmpresaServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa_servicio }\n end\n end",
"def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def show\n @partecipanti_gruppo = PartecipantiGruppo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipanti_gruppo }\n end\n end",
"def show\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end",
"def show\n @pichanga = Pichanga.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pichanga }\n end\n end",
"def show\n @paise = Paise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paise }\n end\n end",
"def show\n @competicao = Competicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competicao }\n end\n end",
"def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end",
"def show\n @pacient = Pacient.find(params[:pacient_id])\n @evaluare = @pacient.evaluares.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prepagada }\n end\n end",
"def show\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end",
"def show\n @espacio_deportivo = EspacioDeportivo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @espacio_deportivo }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end",
"def set_paciente\r\n @paciente = Paciente.find(params[:id])\r\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @psa = Psa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @psa }\n end\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def show\n @species = Specie.find(params[:id])\n\n @pets = Pet.where(:specie_id => @species).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:secie => @species, :pets => @pets } }\n end\n end",
"def set_paciente\n @paciente = Paciente.find(params[:id])\n end",
"def set_paciente\n @paciente = Paciente.find(params[:id])\n end",
"def set_paciente\n @paciente = Paciente.find(params[:id])\n end",
"def set_paciente\n @paciente = Paciente.find(params[:id])\n end"
] |
[
"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.6289573",
"0.6271414",
"0.62661296",
"0.6234876",
"0.6233813",
"0.6233813",
"0.62064505",
"0.6202931",
"0.6197954",
"0.61957216",
"0.6189741",
"0.61855865",
"0.6169306",
"0.6132246",
"0.6127503",
"0.6125785",
"0.6101573",
"0.60988545",
"0.60864186",
"0.6080753",
"0.6074755",
"0.6065521",
"0.6055038",
"0.60432434",
"0.6040138",
"0.601703",
"0.60144085",
"0.6011765",
"0.6010662",
"0.6005135",
"0.60037535",
"0.59979707",
"0.5995467",
"0.59933275",
"0.5990634",
"0.5989295",
"0.59871674",
"0.59837884",
"0.5983399",
"0.5974858",
"0.59746593",
"0.5971355",
"0.597029",
"0.59651077",
"0.5954438",
"0.5953821",
"0.5951638",
"0.59454185",
"0.59445673",
"0.59426016",
"0.59390026",
"0.59282196",
"0.5926912",
"0.5926877",
"0.5906858",
"0.59008014",
"0.58986986",
"0.58960444",
"0.58958274",
"0.58834976",
"0.5880821",
"0.5878582",
"0.5876773",
"0.5871965",
"0.58663124",
"0.58558017",
"0.58541316",
"0.58523023",
"0.58523023",
"0.58523023",
"0.5851178",
"0.58496153",
"0.5847933",
"0.5843001",
"0.5842154",
"0.58419156",
"0.5835304",
"0.5835304",
"0.5835304",
"0.5835304"
] |
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 format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pacient = Pacient.new(pacient_params)\n\n respond_to do |format|\n if @pacient.save\n format.html { redirect_to @pacient, notice: 'Pacient was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pacient }\n else\n format.html { render action: 'new' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente = Paciente.new(paciente_params)\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pacienti = Pacienti.new(pacienti_params)\n\n respond_to do |format|\n if @pacienti.save\n format.html { redirect_to @pacienti, notice: 'Pacienti was successfully created.' }\n format.json { render :show, status: :created, location: @pacienti }\n else\n format.html { render :new }\n format.json { render json: @pacienti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente = Paciente.new(params[:paciente])\n\n paciente = @paciente\n respond_to do |format|\n if @paciente.save\n\n enviar_correo_nuevo_paciente paciente\n\n format.html { redirect_to @paciente, notice: 'Paciente was successfully created.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n\n\n\n end",
"def create\n @paciente = Paciente.new(paciente_params)\n @persona = @paciente.personas.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to pacientes_url, notice: 'Datos del paciente fueron guardados' }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente = Paciente.new(params[:paciente])\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente registrado com sucesso.' }\n format.json { render json: @paciente, status: :created, location: @paciente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pacientes = Pacientes.all\n render json: @pacientes\n end",
"def create\n @enfermeras_paciente = EnfermerasPaciente.new(enfermeras_paciente_params)\n\n respond_to do |format|\n if @enfermeras_paciente.save\n format.html { redirect_to @enfermeras_paciente, notice: 'Enfermeras paciente was successfully created.' }\n format.json { render :show, status: :created, location: @enfermeras_paciente }\n else\n format.html { render :new }\n format.json { render json: @enfermeras_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n \n respond_to do |format|\n if @paciente.save\n format.html { redirect_to @paciente, notice: 'Paciente creado exitosamente.' }\n format.json { render :show, status: :created, location: @paciente }\n else \n format.html { render :new}\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @paciente = Paciente.new(paciente_params)\n\n respond_to do |format|\n if @paciente.save\n @pactual = {pac: @paciente.id, cen: 0, pro: 0} \n format.html { redirect_to @paciente, notice: \"Paciente was successfully created.\" }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @paciente = Paciente.new(paciente_params)\r\n #raise\r\n respond_to do |format|\r\n if @paciente.save\r\n flash[:notice] = \"Paciente guardado exitosamente!\"\r\n format.html { redirect_to pacientes_path}\r\n #format.html { redirect_to @paciente, notice: 'Paciente fue creado satisfactoriamente' }\r\n #format.json { render :show, status: :created, location: @paciente }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exames_paciente = ExamesPaciente.new(exames_paciente_params)\n\n respond_to do |format|\n if @exames_paciente.save\n format.html { redirect_to @exames_paciente, notice: 'Exames paciente was successfully created.' }\n format.json { render :show, status: :created, location: @exames_paciente }\n else\n format.html { render :new }\n format.json { render json: @exames_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pacient = Pacient.new(pacient_params)\n @pacient.interviewer_email = current_interviewer.email\n\n respond_to do |format|\n if @pacient.save\n format.html { redirect_to @pacient, notice: 'Paciente cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @pacient }\n else\n format.html { render :new }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pacient = Pacient.new(params[:pacient])\n\n respond_to do |format|\n if @pacient.save\n format.html { redirect_to(@pacient, :notice => t(\"flash.notices.model.pacient.created\"))}\n format.xml { render :xml => @pacient, :status => :created, :location => @pacient }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pacient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def pacient_params\n params.require(:pacient).permit(:name, :sex, :birth, :occupation, :phone, :protesis, \n :oralSex, :observation, :street, :number, :neighborhood, :city, :state, :totalExposition,\n :dayPeriod, :startedTabagism, :frequenceSmoking, :stopedSmoking, :startedDrinking, \n :frequenceDrinking, :stopedDrinking, :video, whoHadCancer:[], whatSmoked:[], whatDrinked:[])\n end",
"def create\n @paciente = Paciente.new(params[:paciente])\n\n respond_to do |format|\n if @paciente.save\n format.html { redirect_to(@paciente, :notice => 'El Paciente se creo exitosamente.') }\n format.xml { render :xml => @paciente, :status => :created, :location => @paciente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @paciente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @paciente_serviciocomplementario = PacienteServiciocomplementario.new(paciente_serviciocomplementario_params)\n\n respond_to do |format|\n if @paciente_serviciocomplementario.save\n format.html {redirect_to @paciente_serviciocomplementario, notice: 'Paciente serviciocomplementario was successfully created.'}\n format.json {render :show, status: :created, location: @paciente_serviciocomplementario}\n else\n format.html {render :new}\n format.json {render json: @paciente_serviciocomplementario.errors, status: :unprocessable_entity}\n end\n end\n end",
"def paciente_params\n params.require(:paciente).permit(:nombre, :edad, :fecha_de_ingreso, :antecedentes, :diagnostico, :plan, :genero, :camilla, :pendientes)\n end",
"def paciente_params\n params.require(:paciente).permit(:name, :telefone, :data_nascimento)\n end",
"def create\n @pacient = Pacient.find(params[:pacient_id])\n @evaluare = @pacient.evaluares.create(params[:evaluare])\n\n respond_to do |format|\n if @evaluare.save\n format.html { redirect_to @pacient, notice: 'Evaluare was successfully created.' }\n format.json { render json: @evaluare, status: :created, location: @evaluare }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evaluare.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def pacienti_params\n params.require(:pacienti).permit(:nume, :prenume, :varsta, :stare)\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ponte = Ponte.new(ponte_params)\n\n respond_to do |format|\n if @ponte.save\n format.html { redirect_to pontes_url, notice: 'Ponte criada com sucesso.' }\n format.json { render :show, status: :created, location: @ponte }\n else\n format.html { render :new }\n format.json { render json: @ponte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end",
"def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @paciente = Paciente.new(paciente_params)\n @paciente.user=current_user\n\n respond_to do |format|\n if @paciente.save\n historial=Historial.new\n historial.paciente=@paciente\n historial.save\n\n format.html { redirect_to @paciente, notice: 'Paciente creado exitosamente.' }\n format.json { render :show, status: :created, location: @paciente }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @paciente = Paciente.new\n @paciente.pessoa = Pessoa.new\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @paciente }\n #end\n end",
"def paciente_params\n params.require(:paciente).permit(:rut, :nombre, :apellido, :fono, :email, :fechanac, :prevision)\n end",
"def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pai = Pai.new(pai_params)\n\n respond_to do |format|\n if @pai.save\n format.html { redirect_to pais_path, notice: 'Pais creado existosamente.' }\n format.json { render :index, status: :created, location: @pai }\n else\n format.html { render :new }\n format.json { render json: @pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def paciente_params\n params.require(:paciente).permit(:nome, :cpf, :genero, :hip_diag, :idade)\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def paciente_params\n params.require(:paciente).permit(:name, :lastname1, :lastname2, :padecimiento, :fechaIngreso, :sexo, :observaciones, :fechaDeNacimiento, :activo)\n end",
"def paciente_params\n params.require(:paciente).permit(:name, :last_name, :rut, :address, :birthdate, :phone, :mail, :user_id)\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @periodo_academico = PeriodoAcademico.new(params[:periodo_academico])\n\n if @periodo_academico.save\n render json: @periodo_academico, status: :created, location: @periodo_academico\n else\n render json: @periodo_academico.errors, status: :unprocessable_entity\n end\n end",
"def new\n @pacient = Pacient.find(params[:pacient_id])\n @evaluare = Evaluare.find(params[:pacient_id])\n @paraclinic = pacient.evaluares.create(params[:paraclinic])\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evaluare }\n end\n end",
"def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @form_anat_citologica = FormAnatCitologica.new(form_anat_citologica_params)\n\n begin\n @paciente = Paciente.find(params[:form_anat_citologica][:paciente_id])\n @paciente.form_laboratorio_id=13\n @paciente.save\n rescue Exception => e\n\n end\n \n\n respond_to do |format|\n if @form_anat_citologica.save\n format.html { redirect_to @form_anat_citologica, notice: 'Form anat citologica was successfully created.' }\n format.json { render :show, status: :created, location: @form_anat_citologica }\n else\n format.html { render :new }\n format.json { render json: @form_anat_citologica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @precio_paquete = PrecioPaquete.new(precio_paquete_params)\n\n respond_to do |format|\n if @precio_paquete.save\n format.html { redirect_to action: \"index\", notice: 'Precio paquete creado existosamente.' }\n format.json { render action: 'show', status: :created, location: @precio_paquete }\n else\n format.html { render action: 'new' }\n format.json { render json: @precio_paquete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully created.' }\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def paciente_params\n params.fetch(:paciente).permit(:nome, :telefone, :rg, :convenio_id)\n end",
"def create\n @ponto_parada = PontoParada.new(ponto_parada_params)\n\n respond_to do |format|\n if @ponto_parada.save\n format.html { redirect_to @ponto_parada, notice: 'Ponto parada was successfully created.' }\n format.json { render :show, status: :created, location: @ponto_parada }\n else\n format.html { render :new }\n format.json { render json: @ponto_parada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pizza = Pizza.new(pizza_params)\n if @pizza.save\n ActionCable.server.broadcast 'pizzas', {}\n render json: @pizza\n else\n render json: @pizza.errors, status: :unprocessable_entity\n end\n end",
"def create\n @departamento = Departamento.new(departamento_params)\n\n if @departamento.save\n render json: @departamento, status: :created, location: @departamento\n else\n render json: @departamento.errors, status: :unprocessable_entity\n end\n end",
"def paciente_params\n params.require(:paciente).permit(:primer_nombre, :segundo_nombre, :apellido_paterno, :apellido_materno, :nacimiento, :dni, :direccion, :distrito, :provincia, :departamento, :email)\n end",
"def create\n @endereco = Endereco.new(params[:endereco])\n\n @paciente = session[:paciente]\n\n respond_to do |format|\n \n @paciente.endereco = @endereco\n\n if @paciente.save\n\n session[:paciente] = @paciente\n\n session.delete(:respostas)\n\n format.html { redirect_to \"/questoes/1,1\", :notice => 'Cadastro efetuado com sucesso.' }\n \n else\n format.html { render :action => \"new\" }\n end\n\n end\n \n end",
"def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def paciente_params\n params.require(:persona).require(:paciente).permit(:domicilio, :civil, :nss, :edad, :peso, :talla, :imc, :t_sangre, :nutriologo_id)\n end",
"def create\n @pantry = Pantry.new(pantry_params)\n\n respond_to do |format|\n if @pantry.save\n format.html { redirect_to @pantry, notice: \"Pantry was successfully created.\" }\n format.json { render :show, status: :created, location: @pantry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pantry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @cliente.to_json(include: [:pessoa]) }\n else\n format.html { render :new }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @responsavel = Responsavel.new(responsavel_params)\n\n if @responsavel.save\n render json: @responsavel, status: :created, location: @responsavel\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pocetna = Pocetna.new(pocetna_params)\n\n respond_to do |format|\n if @pocetna.save\n format.html { redirect_to @pocetna, notice: \"Pocetna was successfully created.\" }\n format.json { render :show, status: :created, location: @pocetna }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @pocetna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peticion = Peticion.new(peticion_params)\n\n respond_to do |format|\n if @peticion.save\n format.html { redirect_to @peticion, notice: 'Peticion was successfully created.' }\n format.json { render :show, status: :created, location: @peticion }\n else\n format.html { render :new }\n format.json { render json: @peticion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puestos_entidad = PuestosEntidad.new(params[:puestos_entidad])\n\n respond_to do |format|\n if @puestos_entidad.save\n format.html { redirect_to @puestos_entidad, notice: 'Puestos entidad was successfully created.' }\n format.json { render json: @puestos_entidad, status: :created, location: @puestos_entidad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @puestos_entidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_pacote = Servico::Pacote.new(servico_pacote_params)\n\n respond_to do |format|\n if @servico_pacote.save\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_pacote }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @pantry = current_user.pantries.new(\n pantry_params.merge({ user_id: current_user.id }) \n )\n\n respond_to do |format|\n if @pantry.save\n format.html { redirect_to @pantry }\n format.json\n else\n format.html { render :new }\n format.json { render json: @pantry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tuberculose = Tuberculose.new(tuberculose_params)\n begin\n @paciente = Paciente.find(params[:tuberculose][:paciente_id])\n @paciente.form_laboratorio_id=8\n @paciente.save\n rescue Exception => e\n\n end\n\n respond_to do |format|\n if @tuberculose.save\n format.html { redirect_to @tuberculose, notice: 'Tuberculose was successfully created.' }\n format.json { render :show, status: :created, location: @tuberculose }\n else\n format.html { render :new }\n format.json { render json: @tuberculose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puesto = Puesto.new(puesto_params)\n\n respond_to do |format|\n if @puesto.save\n format.html { redirect_to @puesto, notice: 'Puesto Creado.' }\n format.json { render :show, status: :created, location: @puesto }\n else\n format.html { render :new }\n format.json { render json: @puesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @partecipante = Partecipante.new(params[:partecipante])\n\n respond_to do |format|\n if @partecipante.save\n format.html { redirect_to @partecipante, notice: 'Partecipante was successfully created.' }\n format.json { render json: @partecipante, status: :created, location: @partecipante }\n else\n format.html { render action: \"new\" }\n format.json { render json: @partecipante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pasien = Pasien.new(pasien_params)\n\n respond_to do |format|\n if @pasien.save\n format.html { redirect_to @pasien, notice: 'Pasien was successfully created.' }\n format.json { render :show, status: :created, location: @pasien }\n else\n format.html { render :new }\n format.json { render json: @pasien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enfermeras_paciente_params\n params.require(:enfermeras_paciente).permit(:user_id, :paciente_id)\n end",
"def pacient_params\n params.require(:pacient).permit(:name, :address, :email, :rg, :cpf, :birthday, telephones_attributes: [ :id, :ddd, :number, :preferred, :_destroy], insureds_attributes: [ :id, :insurance_id, :_destroy], treatments_attributes: [ :id, :procedure_id, :tooth, :face, :discount, :done, :_destroy], indicateds_attributes: [:indication_id, :description, :_destroy])\n end",
"def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end",
"def create\n @paradigm_praat = ParadigmPraat.new(paradigm_praat_params[:paradigm_praat])\n\n respond_to do |format|\n if @paradigm_praat.save\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @paradigm_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.new(params[:competency_pertenece_asignatura])\n\n respond_to do |format|\n if @competency_pertenece_asignatura.save\n format.html { redirect_to @competency_pertenece_asignatura, notice: 'Competency pertenece asignatura was successfully created.' }\n format.json { render json: @competency_pertenece_asignatura, status: :created, location: @competency_pertenece_asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @competency_pertenece_asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end",
"def set_pacient\n @pacient = Pacient.find(params[:id])\n end",
"def set_pacient\n @pacient = Pacient.find(params[:id])\n end",
"def create\n @questao = Questao.new(questao_params)\n\n respond_to do |format|\n if @questao.save\n format.html { redirect_to @questao, notice: 'Questao was successfully created.' }\n format.json { render :show, status: :created, location: @questao }\n else\n format.html { render :new }\n format.json { render json: @questao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puesto_salud = PuestoSalud.new(puesto_salud_params)\n\n respond_to do |format|\n if @puesto_salud.save\n format.html { redirect_to @puesto_salud, notice: 'Puesto salud was successfully created.' }\n format.json { render :show, status: :created, location: @puesto_salud }\n else\n format.html { render :new }\n format.json { render json: @puesto_salud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @habito = Habito.new(habito_params)\n\n respond_to do |format|\n if @habito.save\n format.html { redirect_to index_habito_path(params[:habito][:paciente_id]), notice: 'Datos guardados correctamente' }\n format.json { render :show, status: :created, location: @habito }\n else\n format.html { render :new }\n format.json { render json: @habito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n p \"*\" * 50\n p params\n p \"*\" * 50\n @consulta = @paciente.consultas.new(consulta_params)\n\n respond_to do |format|\n if @consulta.save\n format.html { redirect_to pacientes_path, notice: 'Consulta foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @paciente_consultas }\n else\n format.html { render :new }\n format.json { render json: @paciente_consultas.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto_patrocinador = ProyectoPatrocinador.new(proyecto_patrocinador_params)\n\n respond_to do |format|\n if @proyecto_patrocinador.save\n format.html { redirect_to @proyecto_patrocinador, notice: 'Proyecto patrocinador was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto_patrocinador }\n else\n format.html { render :new }\n format.json { render json: @proyecto_patrocinador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pendaftaran_kela = PendaftaranKela.new(pendaftaran_kela_params)\n\n respond_to do |format|\n if @pendaftaran_kela.save\n format.html { redirect_to @pendaftaran_kela, notice: 'Pendaftaran kela was successfully created.' }\n format.json { render :show, status: :created, location: @pendaftaran_kela }\n else\n format.html { render :new }\n format.json { render json: @pendaftaran_kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peralatan = Peralatan.new(peralatan_params)\n\n respond_to do |format|\n if @peralatan.save\n format.html { redirect_to @peralatan, notice: 'Peralatan was successfully created.' }\n format.json { render :show, status: :created, location: @peralatan }\n else\n format.html { render :new }\n format.json { render json: @peralatan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @policeman = Policeman.new(policeman_params)\n\n respond_to do |format|\n if @policeman.save\n format.html { redirect_to @policeman, notice: \"Policía creado con éxito.\" }\n format.json { render :show, status: :created, location: @policeman }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @policeman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiendas_juego = TiendasJuego.new(tiendas_juego_params)\n\n respond_to do |format|\n if @tiendas_juego.save\n format.html { redirect_to @tiendas_juego, notice: 'Tiendas juego was successfully created.' }\n format.json { render :show, status: :created, location: @tiendas_juego }\n else\n format.html { render :new }\n format.json { render json: @tiendas_juego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitud_servicio = SolicitudServicio.new(params[:solicitud_servicio])\n\n respond_to do |format|\n if @solicitud_servicio.save\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully created.' }\n format.json { render json: @solicitud_servicio, status: :created, location: @solicitud_servicio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'El puntaje ha sido registrado con exito. ' }\n CustomLogger.info(\"Un nuevo puntaje: #{@puntaje.puntaje.to_i.inspect} correspondiente a la tarea: #{@puntaje.planificacion_tarea.inspect} del alumno: #{@puntaje.alumno.user_full_name.inspect} , Descripcion:#{@puntaje.descripcion.inspect} ha sido registrado por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n CustomLogger.error(\"Se ha producido un error al querer registrar el puntaje: #{@puntaje.puntaje.to_i.inspect} y sus demas atributos, por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n end",
"def index\n @pacientes = Paciente.all\n end",
"def create\n @antecedente = @patient.create_antecedente(params[:antecedente])\n\n respond_to do |format|\n if @antecedente.save\n format.html { redirect_to [@patient, @antecedente], notice: 'Antecedente creado satisfactoriamente.' }\n format.json { render json: @antecedente, status: :created, location: @antecedente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @antecedente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @espetaculo = Espetaculo.new(espetaculo_params)\n\n respond_to do |format|\n if @espetaculo.save\n format.html { redirect_to @espetaculo, notice: 'Espetaculo was successfully created.' }\n format.json { render :show, status: :created, location: @espetaculo }\n else\n format.html { render :new }\n format.json { render json: @espetaculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @presenza = Presenza.new(params[:presenza])\n\n respond_to do |format|\n if @presenza.save\n format.html { redirect_to @presenza, notice: 'Presenza was successfully created.' }\n format.json { render json: @presenza, status: :created, location: @presenza }\n else\n format.html { render action: \"new\" }\n format.json { render json: @presenza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pichanga = Pichanga.new(params[:pichanga])\n\n respond_to do |format|\n if @pichanga.save\n format.html { redirect_to @pichanga, :notice => 'Pichanga was successfully created.' }\n format.json { render :json => @pichanga, :status => :created, :location => @pichanga }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pichanga.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @paciente = Paciente.new(params[:paciente])\n\n respond_to do |format|\n\n if @paciente.valid?\n session[:paciente] = @paciente\n format.html{ redirect_to new_endereco_path }\n\n else\n\t format.html{render :action => \"new\"}\n end\n end\n end",
"def create\n @tiponovedad = Tiponovedad.new(tiponovedad_params)\n\n respond_to do |format|\n if @tiponovedad.save\n format.html { redirect_to @tiponovedad, notice: 'Tiponovedad was successfully created.' }\n format.json { render :show, status: :created, location: @tiponovedad }\n else\n format.html { render :new }\n format.json { render json: @tiponovedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @padrao = Padrao.new(padrao_params)\n\n respond_to do |format|\n if @padrao.save\n format.html { redirect_to @padrao, notice: 'Padrao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @padrao }\n else\n format.html { render action: 'new' }\n format.json { render json: @padrao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render json: @respuesta, status: :created, location: @respuesta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pouzivatel = Pouzivatel.new(pouzivatel_params)\n\n respond_to do |format|\n if @pouzivatel.save\n format.html { redirect_to @pouzivatel, notice: 'Pouzivatel was successfully created.' }\n format.json { render :show, status: :created, location: @pouzivatel }\n else\n format.html { render :new }\n format.json { render json: @pouzivatel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipomedalla = Tipomedalla.new(params[:tipomedalla])\n\n respond_to do |format|\n if @tipomedalla.save\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully created.' }\n format.json { render json: @tipomedalla, status: :created, location: @tipomedalla }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.6199988",
"0.618554",
"0.61833274",
"0.6174215",
"0.614648",
"0.6144388",
"0.6139667",
"0.61240053",
"0.6113001",
"0.6106448",
"0.6099666",
"0.60994935",
"0.6096974",
"0.6044172",
"0.60414743",
"0.6036341",
"0.6021578",
"0.6018114",
"0.60136133",
"0.6008037",
"0.5977489",
"0.59734046",
"0.59699386",
"0.5953399",
"0.5947405",
"0.58615905",
"0.5859354",
"0.58580464",
"0.58490086",
"0.5836204",
"0.5835223",
"0.5831729",
"0.58304167",
"0.5829174",
"0.58233327",
"0.5807824",
"0.5806969",
"0.5804822",
"0.58031875",
"0.57826865",
"0.5774561",
"0.5771027",
"0.5768677",
"0.57676",
"0.5766412",
"0.5765886",
"0.57531416",
"0.5752942",
"0.5751713",
"0.57390267",
"0.5738453",
"0.5730703",
"0.5729045",
"0.5729045",
"0.5725156",
"0.57186335",
"0.5716483",
"0.57034945",
"0.5702778",
"0.57021505",
"0.57011974",
"0.57009804",
"0.57006603",
"0.5699291",
"0.5697855",
"0.5695135",
"0.5694208",
"0.5693313",
"0.56932724",
"0.5692878",
"0.5692793",
"0.5689846",
"0.5687017",
"0.5681808",
"0.56814784",
"0.56802785",
"0.5680053",
"0.56756145",
"0.56750804"
] |
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 format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pacient.update(pacient_params)\n format.html { redirect_to @pacient, notice: 'Pacient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"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 @paciente, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paciente.update(paciente_params)\n format.html { redirect_to @paciente, notice: \"Paciente was successfully updated.\" }\n format.json { render :show, status: :ok, location: @paciente }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pacient.update(pacient_params)\n format.html { redirect_to @pacient, notice: 'Paciente atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @pacient }\n else\n format.html { render :edit }\n format.json { render json: @pacient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paciente.update(paciente_params)\n format.html { redirect_to @paciente, notice: 'Paciente actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @paciente }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pacienti.update(pacienti_params)\n format.html { redirect_to @pacienti, notice: 'Pacienti was successfully updated.' }\n format.json { render :show, status: :ok, location: @pacienti }\n else\n format.html { render :edit }\n format.json { render json: @pacienti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n respond_to do |format|\n if @paciente.update(paciente_params)\n format.html { redirect_to @paciente, notice: 'Paciente actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @paciente }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paciente_serviciocomplementario.update(paciente_serviciocomplementario_params)\n format.html {redirect_to @paciente_serviciocomplementario, notice: 'Paciente serviciocomplementario was successfully updated.'}\n format.json {render :show, status: :ok, location: @paciente_serviciocomplementario}\n else\n format.html {render :edit}\n format.json {render json: @paciente_serviciocomplementario.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_extra_pacientes.update(info_extra_paciente_params)\n format.html { redirect_to @info_extra_paciente, notice: 'Info extra actualizada.' }\n format.json { render :show, status: :ok, location: @info_extra_paciente }\n else\n format.html { render :edit }\n format.json { render json: @info_extra_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pacient = Pacient.find(params[:id])\n\n respond_to do |format|\n if @pacient.update_attributes(params[:pacient])\n format.html { redirect_to(@pacient, :notice => t(\"flash.notices.model.pacient.updated\"))}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pacient.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @paciente.update(paciente_params)\r\n flash[:notice] = \"Actualización exitosa.!\"\r\n format.html { redirect_to pacientes_path, notice: 'Paciente fue actualizado satisfactoriamente' }\r\n format.json { render :show, status: :ok, location: @paciente }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @enfermeras_paciente.update(enfermeras_paciente_params)\n format.html { redirect_to @enfermeras_paciente, notice: 'Enfermeras paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: @enfermeras_paciente }\n else\n format.html { render :edit }\n format.json { render json: @enfermeras_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id])\n #verificar se existe atendimento cadastrado para o paciente\n #@atendimentos=Atendimento.find_all_by_paciente_id(params[:paciente_id])\n #if @atendimentos.empty?\n # @atendimento=Atendimento.new()\n # @atendimento.paciente_id=@paciente.id\n # @atendimento.save\n #else\n # @atendimento.update_attributes(params[:paciente_id])\n #end\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente]) \n format.html { redirect_to pacientes_path, notice: 'Paciente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id])\n\n @upersona = @paciente.personas.last\n @paciente_edit = @upersona.perstable\n respond_to do |format|\n if @paciente_edit.update(params[:paciente].permit(:domicilio, :civil, :nss, :edad, :peso, :talla, :imc, :t_sangre, :persona))\n format.html { redirect_to pacientes_path , notice: 'Paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: pacientes_path }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"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(@paciente, :notice => 'El Paciente se actualizo exitosamente.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @paciente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @precio_paquete.update(precio_paquete_params)\n format.html { redirect_to action: \"index\", notice: 'Precio paquete actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_paquete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exames_paciente.update(exames_paciente_params)\n format.html { redirect_to @exames_paciente, notice: 'Exames paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: @exames_paciente }\n else\n format.html { render :edit }\n format.json { render json: @exames_paciente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @placa.update(placa_params)\n format.html { redirect_to @placa, notice: 'Placa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @placa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ponte.update(ponte_params)\n format.html { redirect_to pontes_url, notice: 'Ponte atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @ponte }\n else\n format.html { render :edit }\n format.json { render json: @ponte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prospecto_meta_largo_plazo.update(prospecto_meta_largo_plazo_params)\n format.html { redirect_to @prospecto_meta_largo_plazo, notice: 'Prospecto meta largo plazo was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_meta_largo_plazo }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_meta_largo_plazo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @patient = @client.patients.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @palabra = Palabra.find(params[:id])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.update_attributes(params[:palabra])\n format.html { redirect_to @palabra, notice: 'La Palabra fue actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n if @puntaje.update_attributes(params[:puntaje])\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully updated.' }\n format.json { head :no_content }\n else\n atributos\n format.html { render action: \"edit\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @painel.update(painel_params)\n format.html { redirect_to @painel, notice: 'Painel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @painel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paciente = Paciente.find(params[:id]) \n @paciente.attributes= params[:paciente]\n @paciente.fecha_nac=params[:fecha_nac] unless params[:fecha_nac].nil?\n respond_to do |format|\n\n if @paciente.save\n flash[:notice] = 'El paciente ha sido actualizado.'\n format.html {redirect_to(@paciente) }\n format.json {render :json => @paciente}\n else\n format.html {render :action => \"edit\" }\n format.json {render :json => @paciente,:status => 201}\n end\n\n\n format.js { render :action => 'validar'}\n end\n\nend",
"def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @pessoa.update(pessoa_params)\n format.html { redirect_to @pessoa, notice: 'Cadastro alterado com sucesso!.' }\n format.json { render :show, status: :ok, location: @pessoa }\n else\n format.html { render :edit }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n if @partecipante.update_attributes(params[:partecipante])\n format.html { redirect_to @partecipante, notice: 'Partecipante was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @partecipante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parola.update(parola_params)\n format.html { redirect_to parolas_url, notice: 'Parola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @placa_casa = PlacaCasa.find(params[:id])\n @placa_casa.pessoa.update_attributes(params[:pessoa]) \n @placa_casa.placa.update_attributes(params[:placa])\n\n respond_to do |format|\n if @placa_casa.update_attributes(params[:placa_casa])\n format.html { redirect_to(@placa_casa, :notice => ' - Dados atualizados com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @placa_casa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prace_polozka.update(prace_polozka_params)\n format.html { redirect_to @prace_polozka, notice: 'Zaznam byl zmenen.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prace_polozka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n if @tipomedalla.update_attributes(params[:tipomedalla])\n format.html { redirect_to @tipomedalla, notice: 'Tipomedalla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipomedalla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n if @ventas_presupuesto.update_attributes(params[:ventas_presupuesto])\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n if @asiento.update_attributes(params[:asiento])\n format.html { redirect_to @asiento, :notice => 'El apunte fue cambiado.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pai.update(pai_params)\n format.html { redirect_to pais_path, notice: 'Pais actualizado exitosamente.' }\n format.json { render :index, status: :ok, location: @pai }\n else\n format.html { render :edit }\n format.json { render json: @pai.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @papel.update(papel_params)\n format.html { redirect_to @papel, notice: 'Papel foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @papel }\n else\n format.html { render :edit }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pocetna.update(pocetna_params)\n format.html { redirect_to @pocetna, notice: \"Pocetna was successfully updated.\" }\n format.json { render :show, status: :ok, location: @pocetna }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @pocetna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @titulacion.update(titulacion_params)\n format.html { redirect_to @titulacion, notice: 'Titulacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @titulacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n if @articulo.update_attributes(params[:articulo])\n format.html { redirect_to @articulo, notice: 'Articulo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prepagada = Prepagada.find(params[:id])\n\n respond_to do |format|\n if @prepagada.update_attributes(params[:prepagada])\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poligono.update(poligono_params)\n format.html { redirect_to @poligono, notice: 'Poligono was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poligono.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicule_perso = VehiculePerso.find(params[:id])\n\n respond_to do |format|\n if @vehicule_perso.update_attributes(params[:vehicule_perso])\n format.html { redirect_to @vehicule_perso, :notice => 'Le véhicule personnel a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @vehicule_perso.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n if @tipocliente.update_attributes(params[:tipocliente])\n format.html { redirect_to @tipocliente, :notice => 'Tipocliente was successfully updated.' }\n format.json { render json: @tipocliente }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @tipocliente.errors }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\trespond_to do |format|\n\tif @precio_boleto.update(precio_boleto_params)\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n\t\tformat.json { head :no_content }\n\telse\n\t\tformat.html { render action: 'edit' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend",
"def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n if @fortune.update_attributes(params[:fortune])\n format.html { redirect_to @fortune, notice: 'Piosenka pozytywnie zaktualizowana.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fortune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n if @propuesta.update_attributes(params[:propuesta])\n format.html { redirect_to propuestas_periodo_propuestas_path(:id=>@propuesta.periodo_propuesta.id), :notice => 'Propuesta fue actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @propuesta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @peso.update(peso_params)\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { render :show, status: :ok, location: @peso }\n else\n format.html { render :edit }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @comentario_plato.update(comentario_plato_params)\n format.html { redirect_to @comentario_plato, notice: 'Comentario plato was successfully updated.' }\n format.json { render :show, status: :ok, location: @comentario_plato }\n else\n format.html { render :edit }\n format.json { render json: @comentario_plato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @przedmiot = Przedmiot.find(params[:id])\n\n respond_to do |format|\n if @przedmiot.update_attributes(params[:przedmiot])\n format.html { redirect_to @przedmiot, notice: 'Przedmiot został zaktualizowany.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @przedmiot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @paradigm_praat.update(paradigm_praat_params)\n format.html { redirect_to @paradigm_praat, notice: 'Paradigm praat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paradigm_praat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_pessoa.update(sivic_pessoa_params)\r\n format.html { redirect_to @sivic_pessoa, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_pessoa.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @papel = Papel.find(params[:id])\n\n respond_to do |format|\n if @papel.update_attributes(params[:papel])\n format.html { redirect_to @papel, notice: 'Papel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @papel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calificacione = Calificacione.find(params[:id])\n\n respond_to do |format|\n if @calificacione.update_attributes(params[:calificacione])\n format.html { redirect_to @calificacione, notice: 'Calificacione was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacione.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @habito.update(habito_params)\n format.html { redirect_to index_habito_path(params[:habito][:paciente_id]), notice: 'Datos actualizados correctamente' }\n format.json { render :show, status: :ok, location: @habito }\n else\n format.html { render :edit }\n format.json { render json: @habito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n if @repa.update_attributes(params[:repa])\n format.html { redirect_to @repa, notice: 'Repa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"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.63478506",
"0.63210267",
"0.6309528",
"0.62918085",
"0.62730306",
"0.6264152",
"0.6261555",
"0.62553966",
"0.62239873",
"0.62115365",
"0.61996436",
"0.61929333",
"0.618532",
"0.61740303",
"0.6173814",
"0.61665195",
"0.61654955",
"0.6165453",
"0.6158013",
"0.61515826",
"0.61499256",
"0.6144532",
"0.6142649",
"0.61403775",
"0.6139324",
"0.61361617",
"0.6128032",
"0.6120878",
"0.6118004",
"0.6116306",
"0.61136276",
"0.6111581",
"0.6111409",
"0.6111087",
"0.6100424",
"0.6092206",
"0.608865",
"0.60873646",
"0.6082834",
"0.6076286",
"0.6058243",
"0.6057497",
"0.6051065",
"0.6046595",
"0.6046173",
"0.60438204",
"0.6037873",
"0.603312",
"0.6032091",
"0.60272163",
"0.60212594",
"0.60169655",
"0.60104793",
"0.6008882",
"0.6006592",
"0.6002005",
"0.60014975",
"0.60013056",
"0.5999315",
"0.59983134",
"0.59951925",
"0.59920216",
"0.5989779",
"0.59867764",
"0.5983965",
"0.59731334",
"0.59638816",
"0.59635735",
"0.59593236",
"0.5954706",
"0.59507185",
"0.5946918",
"0.5946848",
"0.5946406",
"0.5944213",
"0.5943632",
"0.59419703",
"0.5940901",
"0.59399366"
] |
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 do |format|\n format.html { redirect_to paciente_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pacient.destroy\n respond_to do |format|\n format.html { redirect_to pacients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pacient.destroy\n respond_to do |format|\n format.html { redirect_to pacients_url, notice: 'Paciente excluído.' }\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 do |format|\n format.html { redirect_to \"/administrador/pacientes\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @paciente.destroy\n respond_to do |format|\n format.html { redirect_to pacientes_url, notice: 'Paciente elimiando exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pacienti.destroy\n respond_to do |format|\n format.html { redirect_to pacientis_url, notice: 'Pacienti was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paciente.destroy\n respond_to do |format|\n format.html { redirect_to pacientes_url, notice: \"Paciente fue exitosamente eliminado.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pacient = Pacient.find(params[:id])\n @pacient.destroy\n\n respond_to do |format|\n format.html { redirect_to(pacients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @paciente.destroy\r\n respond_to do |format|\r\n format.html { redirect_to pacientes_url, notice: 'Paciente was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paciente = Paciente.find(params[:id])\n @paciente.destroy\n respond_to do |format|\n format.html { redirect_to(pacientes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @paciente_serviciocomplementario.destroy\n respond_to do |format|\n format.html {redirect_to paciente_serviciocomplementarios_url, notice: 'Paciente serviciocomplementario was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @biometria.destroy\n respond_to do |format|\n format.html { redirect_to index_biometria_path(params[:paciente_id]), notice: 'Biometria elimino correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enfermeras_paciente.destroy\n respond_to do |format|\n format.html { redirect_to enfermeras_pacientes_url, notice: 'Enfermeras paciente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exames_paciente.destroy\n respond_to do |format|\n format.html { redirect_to exames_pacientes_url, notice: 'Exames paciente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @painel.destroy\n respond_to do |format|\n format.html { redirect_to painels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puntaje = Puntaje.find(params[:id])\n @puntaje.destroy\n\n respond_to do |format|\n format.html { redirect_to puntajes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to pessoas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @placa.destroy\n respond_to do |format|\n format.html { redirect_to placas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @precio_paquete.destroy\n respond_to do |format|\n format.html { redirect_to precio_paquetes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habito.destroy\n respond_to do |format|\n format.html { redirect_to index_habito_path(params[:paciente_id]), notice: 'Se elimino el registro' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.html { redirect_to patients_url, notice: 'Paciente removido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ponte.destroy\n respond_to do |format|\n format.html { redirect_to pontes_url, notice: 'Ponte deletada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicule_perso = VehiculePerso.find(params[:id])\n @vehicule_perso.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicule_persos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @patient.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estacionamiento = Estacionamiento.find(params[:id])\n @estacionamiento.destroy\n\n respond_to do |format|\n format.html { redirect_to estacionamientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n @competency_pertenece_asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pichanga = Pichanga.find(params[:id])\n @pichanga.destroy\n\n respond_to do |format|\n format.html { redirect_to pichangas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pantry.destroy\n respond_to do |format|\n format.html { redirect_to pantries_url, notice: \"Pantry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n id_paziente = params[:paziente_id]\n @paziente = Paziente.find(id_paziente)\n @cartellaclinica = CartellaClinica.find(id)\n @cartellaclinica.destroy\n respond_to do |format|\n format.html { redirect_to cartella_clinicas_url, notice: 'La Cartella clinica è stata cancellata con successo.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @panneau.destroy\n respond_to do |format|\n format.html { redirect_to panneaus_url, notice: 'Panneau was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipomedalla = Tipomedalla.find(params[:id])\n @tipomedalla.destroy\n\n respond_to do |format|\n format.html { redirect_to tipomedallas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prepagada = Prepagada.find(params[:id])\n @prepagada.destroy\n\n respond_to do |format|\n format.html { redirect_to prepagadas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n padre=@familia.padre_id\n @familia.destroy\n respond_to do |format|\n format.html { redirect_to familias_url(:id => padre) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_de_pasaje.destroy\n respond_to do |format|\n format.html { redirect_to datos_de_pasajes_url, notice: 'Datos de pasaje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personaje = Personaje.find(params[:id])\n @personaje.destroy\n\n respond_to do |format|\n format.html { redirect_to personajes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puestos_entidad = PuestosEntidad.find(params[:id])\n @puestos_entidad.destroy\n\n respond_to do |format|\n format.html { redirect_to puestos_entidads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apologetic.destroy\n respond_to do |format|\n format.html { redirect_to apologetics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_ot_presupuesto.destroy\n respond_to do |format|\n format.html { redirect_to detalle_ot_presupuestos_url, notice: 'Detalle ot presupuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientepedido = Clientepedido.find(params[:id])\n @clientepedido.destroy\n\n respond_to do |format|\n format.html { redirect_to clientepedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titulacion.destroy\n respond_to do |format|\n format.html { redirect_to titulaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to asiento_de_servicios_url, notice: 'Asiento de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @presenza = Presenza.find(params[:id])\n @presenza.destroy\n\n respond_to do |format|\n format.html { redirect_to presenze_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @peso = Peso.find(params[:id])\n @peso.destroy\n\n respond_to do |format|\n format.html { redirect_to pesos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipe = Equipe.find(params[:equipe_id])\n @adversaire = Adversaire.find(params[:id])\n @adversaire.destroy\n\n respond_to do |format|\n format.html { redirect_to @equipe }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @persona.cargo.update(disponible: true)\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to personas_url, notice: 'Persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @articulo = Articulo.find(params[:id])\n @articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to articulos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @articulo = Articulo.find(params[:id])\n @articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to articulos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @articulo = Articulo.find(params[:id])\n @articulo.destroy\n\n respond_to do |format|\n format.html { redirect_to articulos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pantry.destroy\n respond_to do |format|\n format.html { redirect_to pantry_url, notice: 'pantry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n @calificacion_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to calificaciones_servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @locacao = Locacao.find(params[:id])\n @locacao.destroy\n\n respond_to do |format|\n format.html { redirect_to locacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expediente = Expediente.find(params[:id])\n @expediente.destroy\n\n respond_to do |format|\n format.html { redirect_to expedientes_url }\n format.json { head :no_content }\n end\n end"
] |
[
"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.69326687",
"0.69239026",
"0.69159746",
"0.69139034",
"0.6912361",
"0.6907933",
"0.68978596",
"0.6887731",
"0.6884493",
"0.6880041",
"0.6877946",
"0.68744755",
"0.68675184",
"0.6862789",
"0.68417436",
"0.68301857",
"0.68295383",
"0.68276656",
"0.6825857",
"0.68240756",
"0.68236125",
"0.6815963",
"0.6812271",
"0.6811713",
"0.68090266",
"0.6793407",
"0.67898697",
"0.67893106",
"0.67876184",
"0.6781675",
"0.6780369",
"0.6779305",
"0.677772",
"0.6776074",
"0.677598",
"0.67759705",
"0.6770621",
"0.6770621",
"0.6768318",
"0.6764307",
"0.67606264",
"0.6759334",
"0.6756738",
"0.67526627",
"0.67497075",
"0.67493004",
"0.6745223",
"0.6743468",
"0.6742723",
"0.6742062",
"0.67415404",
"0.6741258",
"0.674067",
"0.6740089",
"0.6736804",
"0.6734452",
"0.6731912",
"0.67278856",
"0.6723736",
"0.6721493",
"0.67205465",
"0.67205465",
"0.67205465",
"0.67195237",
"0.6719456",
"0.6718747",
"0.6718747",
"0.6717948",
"0.67168564",
"0.6716309",
"0.67139685",
"0.67123353",
"0.6711725",
"0.6711456",
"0.6709574",
"0.67069477",
"0.67066383",
"0.67049783"
] |
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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.