query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
GET /observations/new def new
def edit @observation.valid? @observation.faunas.build @observation.photos.build end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @observation_type = ObservationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation_type }\n end\n end", "def new\n @historial_odt = HistorialOdt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial_odt }\n end\n end", "def new\n # These are needed to create pulldown menus in form.\n init_license_var\n init_new_image_var(Time.zone.now)\n\n # Clear search list. [Huh? -JPH 20120513]\n clear_query_in_session\n\n @observation = Observation.new\n @naming = Naming.new\n @vote = Vote.new\n @what = \"\" # can't be nil else rails tries to call @name.name\n @names = nil\n @valid_names = nil\n @reasons = @naming.init_reasons\n @images = []\n @good_images = []\n init_specimen_vars_for_create\n init_project_vars_for_create\n init_list_vars_for_create\n defaults_from_last_observation_created\n end", "def new\n @predict = Predict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @predict }\n end\n end", "def new\n @historical = Historical.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historical }\n end\n end", "def new\n @prediction = Prediction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prediction }\n end\n end", "def create\n @observation = Observation.new(params[:observation])\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render json: @observation, status: :created, location: @observation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dataset }\n end\n end", "def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end", "def new\n # Observation.id is passed as a query param (rather than route :id param)\n # in order to give :id param a consistent meaning (the sequence id)\n # in this controller and in order to avoid an extra, non-standard route\n return if params[:observation_id].blank?\n\n @observation = find_or_goto_index(Observation, params[:observation_id].to_s)\n return unless @observation\n\n @sequence = Sequence.new\n\n respond_to do |format|\n format.html\n format.js do\n render_modal_sequence_form(\n title: helpers.sequence_form_new_title\n )\n end\n end\n end", "def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end", "def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end", "def new\n @dummy = Dummy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy }\n end\n end", "def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end", "def new\n @exposure = Exposure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @exposure }\n end\n end", "def new\n @weather_record = WeatherRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather_record }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @dataset = Dataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dataset }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n @weather = Weather.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "def new\n @likelihood = Likelihood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @likelihood }\n format.csv { render :csv => @likelihood }\n format.json { render :json => @likelihood }\n end\n end", "def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end", "def new\n @raw_datum = RawDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @raw_datum }\n end\n end", "def new\n @population = Population.new(:access_level => 'creator')\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @population }\n end\n end", "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end", "def new\n @datum = Datum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datum }\n end\n end", "def new\n @datum = Datum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datum }\n end\n end", "def new\n @dummy_record = DummyRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dummy_record }\n end\n end", "def new_observation(args)\n if args\n Observation.new(args.permit(permitted_observation_args).to_h)\n else\n Observation.new\n end\n end", "def new\n @annual_stat = AnnualStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @annual_stat }\n end\n end", "def new\n @law = Law.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @law }\n end\n end", "def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "def create\n @observation = scope.new(observation_params)\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render :show, status: :created, location: @observation }\n else\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @historico = Historico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @historico }\n end\n end", "def new\n @simulation = Simulation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @simulation }\n end\n end", "def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @interest }\n end\n end", "def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end", "def new\n @dummy_table = DummyTable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dummy_table }\n end\n end", "def new\n @regulation = Regulation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @regulation }\n end\n end", "def new\n @event_interest = EventInterest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_interest }\n end\n end", "def new\n @serving = Serving.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serving }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n @interests = Interests.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interests }\n end\n end", "def new\n @evidence_batch = EvidenceBatch.new\n @count = Evidence.all.count\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @evidence_batch }\n end\n end", "def new\n @neural_population = NeuralPopulation.new\n @quote_targets = QuoteTarget.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neural_population }\n end\n end", "def new\n @history_study = HistoryStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @history_study }\n end\n end", "def new\n @vocabtype = Vocabtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocabtype }\n end\n end", "def new\n @spdatum = Spdatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spdatum }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.json { render json: @interest }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @county }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end", "def new\n @stable = Stable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stable }\n end\n end", "def new\n @simulation = Simulation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @simulation }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end", "def new\n @study = Study.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @study }\n end\n end", "def new\n @title = \"New Medic\"\n @medic = Medic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medic }\n end\n end", "def new\n @nave = Nave.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nave }\n end\n end", "def new\n\t\t\n\tend", "def new\n\t\t\n\tend", "def new\n @ident = Ident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ident }\n end\n end", "def new\n @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end", "def new\n @entry = Entry.new(dob: Date.new(Date.today.year - 18, 1, 1))\n get_events\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @indicativo = Indicativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indicativo }\n end\n end", "def new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end", "def new\n @orc = Orc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orc }\n end\n end", "def new\n @slice = Slice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slice }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @experiment }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @experiment }\n end\n end", "def new\n @soil = Soil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @soil }\n end\n end", "def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @experiment }\n end\n end", "def new\n @study = Study.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @study }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interest }\n end\n end", "def new\n @patient = Patient.new\n end", "def new\n @patient = Patient.new\n end", "def new\n @patient = Patient.new\n end", "def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end", "def new\n @socioeconomic_study = SocioeconomicStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @socioeconomic_study }\n end\n end", "def create\n user = current_user.person\n @observation = user.observations.new(observation_params)\n @observation.company = user.default_company\n flash[:form] = @observation.save ? 'Observation was successfully created.' : 'Observation creation failed'\n flash[:error] = @observation.errors.full_messages.to_sentence\n respond_with @observation\n end", "def new\n @observation = Observation.new(:user => current_user)\n\n if params[:copy] && (copy_obs = Observation.find_by_id(params[:copy])) && copy_obs.user_id == current_user.id\n %w(observed_on_string time_zone zic_time_zone place_guess geoprivacy map_scale positional_accuracy).each do |a|\n @observation.send(\"#{a}=\", copy_obs.send(a))\n end\n @observation.latitude = copy_obs.private_latitude || copy_obs.latitude\n @observation.longitude = copy_obs.private_longitude || copy_obs.longitude\n copy_obs.observation_photos.each do |op|\n @observation.observation_photos.build(:photo => op.photo)\n end\n copy_obs.observation_sounds.each do |os|\n @observation.observation_sounds.build( sound: os.sound )\n end\n end\n \n @taxon = Taxon.find_by_id(params[:taxon_id].to_i) unless params[:taxon_id].blank?\n unless params[:taxon_name].blank?\n @taxon ||= TaxonName.where(\"lower(name) = ?\", params[:taxon_name].to_s.strip.gsub(/[\\s_]+/, ' ').downcase).\n first.try(:taxon)\n end\n \n if !params[:project_id].blank?\n @project = if params[:project_id].to_i == 0\n Project.includes(:project_observation_fields => :observation_field).find(params[:project_id])\n else\n Project.includes(:project_observation_fields => :observation_field).find_by_id(params[:project_id].to_i)\n end\n if @project\n @place = @project.place\n @project_curators = @project.project_users.where(\"role IN (?)\", [ProjectUser::MANAGER, ProjectUser::CURATOR])\n @tracking_code = params[:tracking_code] if @project.tracking_code_allowed?(params[:tracking_code])\n @kml_assets = @project.project_assets.select{|pa| pa.asset_file_name =~ /\\.km[lz]$/}\n end\n end\n\n @place ||= Place.find(params[:place_id]) unless params[:place_id].blank? rescue nil\n\n if @place\n @place_geometry = PlaceGeometry.without_geom.where(place_id: @place).first\n end\n\n sync_flickr_photo if params[:flickr_photo_id] && current_user.flickr_identity\n sync_picasa_photo if params[:picasa_photo_id] && current_user.picasa_identity\n sync_local_photo if params[:local_photo_id]\n \n @welcome = params[:welcome]\n \n # this should happen AFTER photo syncing so params can override attrs \n # from the photo\n [:latitude, :longitude, :place_guess, :location_is_exact, :map_scale,\n :positional_accuracy, :positioning_device, :positioning_method,\n :observed_on_string].each do |obs_attr|\n next if params[obs_attr].blank?\n # sync_photo indicates that the user clicked sync photo, so presumably they'd \n # like the photo attrs to override the URL\n # invite links are the other case, in which URL params *should* override the \n # photo attrs b/c the person who made the invite link chose a taxon or something\n if params[:sync_photo]\n @observation.send(\"#{obs_attr}=\", params[obs_attr]) if @observation.send(obs_attr).blank?\n else\n @observation.send(\"#{obs_attr}=\", params[obs_attr])\n end\n end\n if @taxon\n @observation.taxon = @taxon\n @observation.species_guess = if @taxon.common_name\n @taxon.common_name( user: current_user ).name\n else\n @taxon.name\n end\n elsif !params[:taxon_name].blank?\n @observation.species_guess = params[:taxon_name]\n end\n \n @observation_fields = ObservationField.recently_used_by(current_user).limit(10)\n @observation.set_time_zone if @observation.time_zone.blank?\n respond_to do |format|\n format.html do\n @observations = [@observation]\n end\n format.json { render :json => @observation }\n end\n end", "def new\n @cut = Cut.new\n @animals = Animal.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cut }\n end\n end", "def new\n @competition_interaction_observation = CompetitionInteractionObservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition_interaction_observation }\n end\n end", "def new\n @predicition = Predicition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @predicition }\n end\n end", "def new\r\n \r\n end", "def new\n @beasts = Beast.all\n @noise = Noise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @noise }\n end\n end", "def new\r\n end", "def new\r\n end", "def new\n @rep = Rep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rep }\n end\n end", "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end" ]
[ "0.78374404", "0.78374404", "0.7298769", "0.688027", "0.68540156", "0.6849362", "0.67917943", "0.67137784", "0.66932607", "0.66801655", "0.66774184", "0.66134554", "0.6611344", "0.65848166", "0.657256", "0.65677047", "0.65643674", "0.6546845", "0.653827", "0.65351903", "0.65351903", "0.651377", "0.6505047", "0.6505047", "0.6503979", "0.64974374", "0.6495573", "0.6491733", "0.6488499", "0.64858776", "0.64803743", "0.64749634", "0.64749634", "0.6471507", "0.6466925", "0.6461161", "0.6448544", "0.64457595", "0.64299446", "0.64217496", "0.6418262", "0.64125025", "0.6411432", "0.6402827", "0.640257", "0.6401663", "0.639754", "0.639712", "0.6392234", "0.63799655", "0.6377186", "0.6375016", "0.6372511", "0.63709885", "0.63663495", "0.6361053", "0.63606477", "0.6360227", "0.6352194", "0.6348352", "0.6347316", "0.6342448", "0.6342448", "0.63388145", "0.63371015", "0.6336647", "0.6336647", "0.6331837", "0.6331532", "0.6328601", "0.6326285", "0.6326285", "0.63232064", "0.6319715", "0.6319457", "0.6319261", "0.6319028", "0.6317131", "0.63169414", "0.63168037", "0.63168037", "0.6311857", "0.63116", "0.63091993", "0.6305982", "0.63034195", "0.63034195", "0.63034195", "0.63022524", "0.63021225", "0.6299827", "0.6298712", "0.6295768", "0.6291776", "0.6291244", "0.62907994", "0.6290508", "0.62892413", "0.62892413", "0.6286676", "0.6285865" ]
0.0
-1
POST /observations POST /observations.json
def create @cruise = Cruise.find(params[:cruise_id]) @observation = @cruise.build_observation respond_to do |format| if @observation.save validate: false format.html { redirect_to edit_observation_path(@observation), notice: 'Observation was successfully created.' } format.json { render :show, status: :created, location: @observation } else format.html { render :new } format.json { render json: @observation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # Handle the case of a single obs\n params[:observations] = [['0', params[:observation]]] if params[:observation]\n \n if params[:observations].blank? && params[:observation].blank?\n respond_to do |format|\n format.html do\n flash[:error] = t(:no_observations_submitted)\n redirect_to new_observation_path\n end\n format.json { render :status => :unprocessable_entity, :json => \"No observations submitted!\" }\n end\n return\n end\n \n @observations = params[:observations].to_h.map do |fieldset_index, observation|\n next if observation.blank?\n observation.delete('fieldset_index') if observation[:fieldset_index]\n unless observation.is_a?( ActionController::Parameters )\n observation = ActionController::Parameters.new( observation )\n end\n\n # If the client is trying to create an observation that already exists,\n # update that observation instead of returning an error. This is meant to\n # handle cases where the client submits a create request, the server\n # receives it, but the client loses its connection before receiving a\n # response. The client then thinks the request was not successful and\n # tries to submit a create request again when it has network. We are not\n # simply returning the existing state of the observation here because the\n # client might have changed its copy of the observation in the interim.\n o = unless observation[:uuid].blank?\n current_user.observations.where( uuid: observation[:uuid] ).first\n end\n # when we add UUIDs to everything and either stop using strings or\n # ensure that everything is lowercase, we can stop doing this\n if o.blank? && !observation[:uuid].blank?\n o = current_user.observations.where( uuid: observation[:uuid].downcase ).first\n end\n\n o ||= Observation.new\n o.assign_attributes(observation_params(observation))\n o.user = current_user\n o.editing_user_id = current_user.id\n o.user_agent = request.user_agent\n unless o.site_id\n o.site = @site || current_user.site\n o.site = o.site.becomes(Site) if o.site\n end\n if doorkeeper_token && (a = doorkeeper_token.application)\n o.oauth_application = a.becomes(OauthApplication)\n elsif ( auth_header = request.headers[\"Authorization\"] ) && ( token = auth_header.split(\" \").last )\n jwt_claims = begin\n ::JsonWebToken.decode(token)\n rescue JWT::DecodeError => e\n nil\n end\n if jwt_claims && ( oauth_application_id = jwt_claims[\"oauth_application_id\"] )\n o.oauth_application_id = oauth_application_id\n end\n end\n\n # We will process the photos if this is really a new observation or if the\n # client actually specified some photos. Without this, there's a\n # significant risk clients will resubmit photos without the local_photos\n # param and we'll assume its absence means the client wants to remove\n # existing photos\n if o.new_record? || !params[:local_photos].blank?\n # Get photos\n # This is kind of double-protection against deleting existing photos\n photos = o.photos\n Photo.subclasses.each do |klass|\n klass_key = klass.to_s.underscore.pluralize.to_sym\n if params[klass_key] && params[klass_key][fieldset_index]\n photos += retrieve_photos(params[klass_key][fieldset_index],\n :user => current_user, :photo_class => klass)\n end\n if params[\"#{klass_key}_to_sync\"] && params[\"#{klass_key}_to_sync\"][fieldset_index]\n if photo = photos.to_a.compact.last\n photo_o = photo.to_observation\n PHOTO_SYNC_ATTRS.each do |a|\n o.send(\"#{a}=\", photo_o.send(a)) if o.send(a).blank?\n end\n end\n end\n end\n photo = photos.compact.last\n if o.new_record? && photo && photo.respond_to?(:to_observation) && !params[:uploader] &&\n (o.observed_on_string.blank? || o.latitude.blank? || o.taxon.blank?)\n photo_o = photo.to_observation\n if o.observed_on_string.blank?\n o.observed_on_string = photo_o.observed_on_string\n o.observed_on = photo_o.observed_on\n o.time_observed_at = photo_o.time_observed_at\n end\n if o.latitude.blank?\n o.latitude = photo_o.latitude\n o.longitude = photo_o.longitude\n end\n o.taxon = photo_o.taxon if o.taxon.blank?\n o.species_guess = photo_o.species_guess if o.species_guess.blank?\n end\n o.photos = ensure_photos_are_local_photos( photos )\n o.will_be_saved_with_photos = true\n end\n\n # Same logic we use for photos: try to avoid deleting sounds if they\n # weren't specified, but make sure we add them for new reocrds\n if o.new_record? || !params[:local_sounds].blank?\n new_sounds = Sound.from_observation_params(params, fieldset_index, current_user)\n o.sounds << ensure_sounds_are_local_sounds( new_sounds )\n end\n\n # make sure the obs get a valid observed_on, needed to determine research grade\n o.munge_observed_on_with_chronic\n o.set_quality_grade\n o\n end\n \n @observations.compact.each do |o|\n o.user = current_user\n # all observations will be indexed later, after all associated records\n # have been created, just before responding\n o.skip_indexing = true\n o.save\n end\n create_project_observations\n update_user_account\n\n # check for errors\n errors = false\n if params[:uploader]\n @observations.compact.each { |obs|\n obs.errors.delete(:project_observations)\n errors = true if obs.errors.any?\n }\n else\n @observations.compact.each { |obs| errors = true unless obs.valid? }\n end\n Observation.elastic_index!(\n ids: @observations.compact.map( &:id ),\n wait_for_index_refresh: params[:force_refresh]\n )\n respond_to do |format|\n format.html do\n unless errors\n flash[:notice] = params[:success_msg] || t(:observations_saved)\n if params[:commit] == t(:save_and_add_another)\n o = @observations.first\n redirect_to :action => 'new', \n :latitude => o.coordinates_obscured? ? o.private_latitude : o.latitude, \n :longitude => o.coordinates_obscured? ? o.private_longitude : o.longitude, \n :place_guess => o.place_guess, \n :observed_on_string => o.observed_on_string,\n :location_is_exact => o.location_is_exact,\n :map_scale => o.map_scale,\n :positional_accuracy => o.positional_accuracy,\n :positioning_method => o.positioning_method,\n :positioning_device => o.positioning_device,\n :project_id => params[:project_id]\n elsif @observations.size == 1\n redirect_to observation_path(@observations.first)\n else\n redirect_to observations_by_login_path( self.current_user.login )\n end\n else\n if @observations.size == 1\n if @project\n @place = @project.place\n @project_curators = @project.project_users.where(\"role IN (?)\", [ProjectUser::MANAGER, ProjectUser::CURATOR])\n @tracking_code = params[:tracking_code] if @project.tracking_code_allowed?(params[:tracking_code])\n @kml_assets = @project.project_assets.select{|pa| pa.asset_file_name =~ /\\.km[lz]$/}\n end\n render :action => 'new'\n else\n render :action => 'edit_batch'\n end\n end\n end\n format.json do\n if errors\n json = if @observations.size == 1 && is_iphone_app_2?\n {:error => @observations.map{|o| o.errors.full_messages}.flatten.uniq.compact.to_sentence}\n else\n {:errors => @observations.map{|o| o.errors.full_messages}}\n end\n render :json => json, :status => :unprocessable_entity\n else\n if @observations.size == 1 && is_iphone_app_2?\n render :json => @observations[0].to_json(\n :viewer => current_user,\n :methods => [:user_login, :iconic_taxon_name],\n :include => {\n :taxon => Taxon.default_json_options\n }\n )\n else\n render :json => @observations.to_json(viewer: current_user,\n methods: [ :user_login, :iconic_taxon_name, :project_observations ])\n end\n end\n end\n end\n end", "def create\n @observation = Observation.new(params[:observation])\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render json: @observation, status: :created, location: @observation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @observation = Observation.new(params[:observation])\n\n @coral = Coral.find(params[:coral_id])\n @observation = @coral.observations.create(observation_params)\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to coral_path(@coral), flash: {success: 'The observation was successfully created.' } }\n format.json { render json: @observation, status: :created, location: @observation }\n else\n format.html { redirect_to coral_path(@coral), flash: {danger: \"The observation was NOT created. Please make sure the fieldtrip ID is a number and unique.\" } }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @observation = scope.new(observation_params)\n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render :show, status: :created, location: @observation }\n else\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = current_user.person\n @observation = user.observations.new(observation_params)\n @observation.company = user.default_company\n flash[:form] = @observation.save ? 'Observation was successfully created.' : 'Observation creation failed'\n flash[:error] = @observation.errors.full_messages.to_sentence\n respond_with @observation\n end", "def index\n @observations = Observation.all()\n end", "def index\n @observations = scope.all\n end", "def fetch_observations(station)\n\n scraper_logger.info(\"Fetching latest weather observations for #{station.id} - #{station.name}\")\n\n new = 0\n\n json = extract_observations(station.json_url)\n json['observations']['data'].each do |o|\n\n Time.zone = 'UTC'\n recording_time = Time.zone.parse(\"#{o['aifstime_utc']}Z\")\n\n unless Observation.already_exists?(station, recording_time)\n observation = Observation.new\n observation.station = station\n observation.recording_time = recording_time\n observation.save\n\n parse_readings(o, observation)\n\n new += 1\n\n end\n\n end\n\n scraper_logger.info(\"Added #{new} new observations\")\n\n end", "def list_observations # :nologin:\n query = create_query(:Observation, :all, by: :date)\n show_selected_observations(query)\n end", "def update\n observation_user = current_user\n \n unless params[:admin_action].nil? || !current_user.is_admin?\n observation_user = Observation.find(params[:id]).user\n end\n \n # Handle the case of a single obs\n if params[:observation]\n params[:observations] = [[params[:id], params[:observation]]]\n elsif params[:id] && params[:observations]\n params[:observations] = [[params[:id], params[:observations][0]]]\n end\n \n if params[:observations].blank? && params[:observation].blank?\n respond_to do |format|\n format.html do\n flash[:error] = t(:no_observations_submitted)\n redirect_to new_observation_path\n end\n format.json { render :status => :unprocessable_entity, :json => \"No observations submitted!\" }\n end\n return\n end\n\n @observations = params[:observations].to_h.map do |id, obs|\n Observation.where( uuid: id, user_id: observation_user ).first ||\n Observation.where( id: id, user_id: observation_user ).first\n end.compact\n \n # Make sure there's no evil going on\n unique_user_ids = @observations.map(&:user_id).uniq\n more_than_one_observer = unique_user_ids.size > 1\n admin_action = unique_user_ids.first != observation_user.id && current_user.has_role?(:admin)\n if [email protected]? && more_than_one_observer && !admin_action\n msg = t(:you_dont_have_permission_to_edit_that_observation)\n respond_to do |format|\n format.html do\n flash[:error] = msg\n redirect_to(@observation || observations_path)\n end\n format.json do\n render :status => :forbidden, :json => {:error => msg}\n end\n end\n return\n end\n \n # Convert the params to a hash keyed by ID. Yes, it's weird\n hashed_params = Hash[params[:observations].to_h.map do |id, obs|\n instance = @observations.detect{ |o| o.uuid == id || o.id.to_s == id }\n instance ? [instance.id.to_s, obs] : nil\n end.compact]\n errors = false\n extra_msg = nil\n @observations.each_with_index do |observation,i|\n fieldset_index = observation.id.to_s\n observation.skip_indexing = true\n \n # Note: this ignore photos thing is a total hack and should only be\n # included if you are updating observations but aren't including flickr\n # fields, e.g. when removing something from ID please\n if !params[:ignore_photos] && !is_mobile_app?\n # Get photos\n keeper_photos = []\n old_photo_ids = observation.photo_ids\n Photo.subclasses.each do |klass|\n klass_key = klass.to_s.underscore.pluralize.to_sym\n next if klass_key.blank?\n if params[klass_key] && params[klass_key][fieldset_index]\n keeper_photos += retrieve_photos(params[klass_key][fieldset_index],\n :user => current_user, :photo_class => klass, :sync => true)\n end\n end\n\n if keeper_photos.empty?\n observation.observation_photos.destroy_all\n else\n keeper_photos = ensure_photos_are_local_photos( keeper_photos )\n reject_obs_photos = observation.observation_photos.select{|op| !keeper_photos.map(&:id).include?( op.photo_id )}\n reject_obs_photos.each(&:destroy)\n keeper_photos.each do |p|\n if p.new_record? || !observation.observation_photos.detect{|op| op.photo_id == p.id }\n observation.observation_photos.build( photo: p )\n end\n end\n end\n\n Photo.subclasses.each do |klass|\n klass_key = klass.to_s.underscore.pluralize.to_sym\n next unless params[\"#{klass_key}_to_sync\"] && params[\"#{klass_key}_to_sync\"][fieldset_index]\n next unless photo = observation.observation_photos.last.try(:photo)\n photo_o = photo.to_observation\n PHOTO_SYNC_ATTRS.each do |a|\n hashed_params[observation.id.to_s] ||= {}\n if hashed_params[observation.id.to_s][a].blank? && observation.send(a).blank?\n hashed_params[observation.id.to_s][a] = photo_o.send(a)\n end\n end\n end\n end\n\n # Kind of like :ignore_photos, but :editing_sounds makes it opt-in rather than opt-out\n # If editing sounds and no sound parameters are present, assign to an empty array \n # This way, sounds will be removed\n if params[:editing_sounds]\n params[:soundcloud_sounds] ||= {fieldset_index => []} \n params[:soundcloud_sounds][fieldset_index] ||= []\n params[:local_sounds] ||= {fieldset_index => []} \n params[:local_sounds][fieldset_index] ||= []\n sounds = Sound.from_observation_params(params, fieldset_index, current_user)\n ensured_sounds = ensure_sounds_are_local_sounds( sounds )\n observation.sounds = ensured_sounds\n end\n \n observation.editing_user_id = current_user.id\n\n observation.force_quality_metrics = true unless hashed_params[observation.id.to_s][:captive_flag].blank?\n permitted_params = ActionController::Parameters.new( hashed_params[observation.id.to_s].to_h )\n unless observation.update( observation_params( permitted_params ) )\n errors = true\n end\n\n if !errors && params[:project_id] && !observation.project_observations.where(:project_id => params[:project_id]).exists?\n if @project ||= Project.find(params[:project_id])\n project_observation = ProjectObservation.create(:project => @project, :observation => observation)\n extra_msg = if project_observation.valid?\n \"Successfully added to #{@project.title}\"\n else\n \"Failed to add to #{@project.title}: #{project_observation.errors.full_messages.to_sentence}\"\n end\n end\n end\n end\n\n Observation.elastic_index!(\n ids: @observations.to_a.compact.map( &:id )\n )\n\n respond_to do |format|\n if errors\n format.html do\n if @observations.size == 1\n @observation = @observations.first\n render :action => 'edit'\n else\n render :action => 'edit_batch'\n end\n end\n format.xml { render :xml => @observations.collect(&:errors), :status => :unprocessable_entity }\n format.json do\n render :status => :unprocessable_entity, :json => {\n :error => @observations.map{|o| o.errors.full_messages.to_sentence}.to_sentence,\n :errors => @observations.collect(&:errors)\n }\n end\n elsif @observations.empty?\n msg = if params[:id]\n t(:that_observation_no_longer_exists)\n else\n t(:those_observations_no_longer_exist)\n end\n format.html do\n flash[:error] = msg\n redirect_back_or_default(observations_by_login_path(current_user.login))\n end\n format.json { render :json => {:error => msg}, :status => :gone }\n else\n format.html do\n flash[:notice] = \"#{t(:observations_was_successfully_updated)} #{extra_msg}\"\n if @observations.size == 1\n redirect_to observation_path(@observations.first)\n else\n redirect_to observations_by_login_path(observation_user.login)\n end\n end\n format.xml { head :ok }\n format.js { render :json => @observations }\n format.json do\n if @observations.size == 1 && is_iphone_app_2?\n render :json => @observations[0].to_json(\n viewer: current_user,\n methods: [:user_login, :iconic_taxon_name],\n include: {\n taxon: Taxon.default_json_options,\n observation_field_values: {},\n project_observations: {\n include: {\n project: {\n only: [:id, :title, :description],\n methods: [:icon_url]\n }\n }\n },\n observation_photos: {\n include: {\n photo: {\n methods: [:license_code, :attribution],\n except: [:original_url, :file_processing, :file_file_size, \n :file_content_type, :file_file_name, :mobile, :metadata, :user_id, \n :native_realname, :native_photo_id]\n }\n }\n },\n } )\n else\n render json: @observations.to_json( methods: [:user_login, :iconic_taxon_name], viewer: current_user )\n end\n end\n end\n end\n end", "def save_observation(observation)\n success = true\n args = {}\n if observation.new_record?\n args[:method] = \"post\"\n args[:action] = \"observation\"\n args[:date] = observation.when\n if observation.location_id\n args[:location] = observation.location\n else\n args[:location] = observation.where\n end\n args[:notes] = observation.notes.to_s\n args[:specimen] = observation.specimen ? true : false\n args[:thumbnail] = observation.thumb_image_id.to_i\n args[:is_collection_location] = observation.is_collection_location\n else\n args[:method] = \"put\"\n args[:action] = \"observation\"\n args[:set_date] = observation.when if observation.when_changed?\n if observation.where_changed? || observation.location_id_changed?\n if observation.location_id\n args[:set_location] = observation.location\n else\n args[:set_location] = observation.where\n end\n end\n args[:set_notes] = observation.notes if observation.notes_changed?\n if observation.specimen_changed?\n args[:set_specimen] = observation.specimen\n end\n if observation.thumb_image_id_changed?\n args[:set_thumbnail] = observation.thumb_image_id.to_i\n end\n args[:set_is_collection_location] = observation.is_collection_location\n end\n if observation.save\n args[:id] = observation\n Transaction.create(args)\n else\n flash_error(:runtime_no_save_observation.t)\n flash_object_errors(observation)\n success = false\n end\n success\n end", "def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @observations.destroy\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def create_project_observations\n return unless params[:project_id]\n if params[:project_id].is_a?(Array)\n params[:project_id].each do |pid|\n errors = create_project_observation_records(pid)\n end\n else\n errors = create_project_observation_records(params[:project_id])\n if !errors.blank?\n if request.format.html?\n flash[:error] = t(:your_observations_couldnt_be_added_to_that_project, :errors => errors.to_sentence)\n else\n Rails.logger.error \"[ERROR #{Time.now}] Failed to add #{@observations.size} obs to #{@project}: #{errors.to_sentence}\"\n end\n end\n end\n end", "def create\n @ice_observation = IceObservation.new(ice_observation_params)\n\n respond_to do |format|\n if @ice_observation.save\n format.html { redirect_to @ice_observation, notice: 'Ice observation was successfully created.' }\n format.json { render :show, status: :created, location: @ice_observation }\n else\n format.html { render :new }\n format.json { render json: @ice_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_observations\n query = create_query(:Observation, :all, by: :date)\n show_selected_observations(query)\n end", "def create\n @observation = Observation.new(observation_params)\n\n \n\n respond_to do |format|\n if @observation.save\n format.html { redirect_to @observation, notice: 'Observation was successfully created.' }\n format.json { render :show, status: :created, location: @observation }\n else\n @services_of_dependence = current_user.dependence.service_of_dependences\n agents_of_service = AgentOfService.where(service_of_dependence: @services_of_dependence)\n @agents = Agent.where(id: agents_of_service.pluck(:agent_id))\n format.html { render :new }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def new\n @observation = Observation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation }\n end\n end", "def set_obersvation\n @observations = Observation.find(params[:id])\n end", "def index\n @ice_observations = IceObservation.all\n end", "def observation_params\n params.require(:observation).permit(:classroom_id, :specialist_id, :principal_id, :comments, :observation_date, :complete, :principal_comments)\n end", "def observation_params\n params.require(:observation).permit(:user_id, :location_id, :specie_id, :resource_id, :access, :approved, :resource_secondary_id, measurements_attributes: [:id, :user_id, :trait_id, :standard_id, :methodology_id, :value, :value_type, :valuetype_id, :precisiontype_id, :precision_type, :precision, :precision_upper, :replicates, :measurement_description, :_destroy])\n end", "def gather!\n @observations = get_datas!\n @last_observation_at = Observation.last(:select => :observed_at).try(:observed_at)\n collection = @last_observation_at.nil? ? @observations : only_the_ones_we_care_about\n collection.each do |observation|\n o = Observation.create observation\n Observation.logger.info \"created #{o.inspect}\"\n end\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def index\n if !logged_in? && params[:page].to_i > 100\n authenticate_user!\n return false\n end\n params = request.params\n showing_partial = (params[:partial] && PARTIALS.include?(params[:partial]))\n # Humans should see this, but scrapers like social media sites and curls\n # will set Accept: */*\n human_or_scraper = request.format.html? || request.format == \"*/*\"\n # the new default /observations doesn't need any observations\n # looked up now as it will use Angular/Node. This is for legacy\n # API methods, and HTML/views and partials\n if human_or_scraper && !showing_partial\n @shareable_description = begin\n generate_shareable_description\n rescue StandardError => e\n Logstasher.write_exception( e, request: request, session: session, user: current_user )\n \"\"\n end\n else\n h = observations_index_search(params)\n params = h[:params]\n search_params = h[:search_params]\n @observations = h[:observations]\n end\n respond_to do |format|\n\n format.html do\n if showing_partial\n pagination_headers_for(@observations)\n return render_observations_partial(params[:partial])\n end\n # one of the few things we do in Rails. Look up the taxon_name param\n unless params[:taxon_name].blank?\n sn = params[:taxon_name].to_s.strip.gsub(/[\\s_]+/, ' ').downcase\n t = Taxon.active.where( name: sn ).first\n t ||= Taxon.where( name: sn ).first\n t ||= TaxonName.joins(:taxon).where(\"taxa.is_active AND lower(taxon_names.name) = ?\", sn).first.try(:taxon)\n t ||= TaxonName.where(\"lower(taxon_names.name) = ?\", sn).first.try(:taxon)\n if t\n t = t.current_synonymous_taxon unless t.is_active?\n params[:taxon_id] = t.id\n end\n end\n @asynchronous_google_maps_loading = true\n render layout: \"bootstrap\", locals: { params: params }\n end\n\n format.json do\n Observation.preload_for_component(@observations, logged_in: logged_in?)\n Observation.preload_associations(@observations, :tags)\n render_observations_to_json\n end\n \n format.geojson do\n render :json => @observations.to_geojson(:except => [\n :geom, :latitude, :longitude, :map_scale, \n :num_identification_agreements, :num_identification_disagreements, \n :delta, :location_is_exact])\n end\n \n format.atom do\n @updated_at = Observation.last.updated_at\n end\n \n format.dwc do\n Observation.preload_for_component(@observations, logged_in: logged_in?)\n Observation.preload_associations(@observations, [ :identifications ])\n end\n\n format.csv do\n render_observations_to_csv\n end\n \n format.kml do\n render_observations_to_kml(\n :snippet => \"#{@site.name} Feed for Everyone\",\n :description => \"#{@site.name} Feed for Everyone\",\n :name => \"#{@site.name} Feed for Everyone\"\n )\n end\n \n format.widget do\n if params[:markup_only] == 'true'\n render js: render_to_string(\n partial: \"widget\",\n handlers: [:erb],\n formats: [:html],\n locals: {\n show_user: true,\n target: params[:target],\n default_image: params[:default_image],\n silence: params[:silence]\n }\n )\n else\n render js: render_to_string(\n partial: \"widget\",\n handlers: [:erb],\n formats: [:js],\n locals: {\n show_user: true\n }\n )\n end\n end\n end\n rescue Elasticsearch::Transport::Transport::Errors::InternalServerError => e\n raise e unless e.message =~ /window is too large/\n msg = \"Too many results. Try using smaller searches or the id_above parameter.\"\n response.headers[\"X-Error\"] = msg\n respond_to do |format|\n format.html do\n flash[:error] = msg\n redirect_to( observations_path )\n end\n format.json { render json: { error: msg } }\n format.all { @observations = [] }\n end\n end", "def index\n @cruise = Cruise.find(params[:cruise_id])\n @observations = @cruise.observations.order(observed_at: :desc).accessible_by(current_ability)\n \n \n \n respond_to do |format|\n format.csv { send_data build_csv, filename: \"observations-#{@cruise.id}.csv\"}\n format.json { send_data build_json, filename: \"observations-#{@cruise.id}.json\"}\n format.geojson { send_data build_geojson, filename: \"observations-#{@cruise.id}.geojson\"}\n format.sigrid3\n end\n end", "def set_observation\n @observation = Observation.where(id: params[:id]).includes(:ice_observations).first\n end", "def observation_params\n params.require(:observation).permit(:year, :month, :service_of_dependence_id, observation_details_attributes: [:id, :url, :_destroy, :agent_id, :observation_description_id, :date_from, :total_days, :description, :porporcional, :porporcional2])\n end", "def create\n @observation = Observation.find(params[:observation_id])\n @observer = Observer.new(params[:observer])\n @observer.observation = @observation;\n\n respond_to do |format|\n if @observer.save\n format.html { redirect_to observation_observers_path(@observation), notice: 'Hospitující byl přídán k hospitaci.' }\n format.json { render json: @observer, status: :created, location: @observer }\n else\n format.html { redirect_to new_observation_observer_path(@observation)}\n format.json { render json: @observer.errors, status: :unprocessable_entity }\n end\n end\n end", "def extract_observations(url)\n\n JSON.load(open(url))\n\n end", "def create\n @observation_type = ObservationType.new(params[:observation_type])\n\n respond_to do |format|\n if @observation_type.save\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully created.' }\n format.json { render json: @observation_type, status: :created, location: @observation_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @competition_interaction_observations = CompetitionInteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competition_interaction_observations }\n end\n end", "def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end", "def observing(scope, action, traversal, values)\n @observations ||= []\n @observations << {\n scope: scope,\n action: action,\n traversal: traversal,\n values: values\n }\n end", "def index\n obstype = ObservationType.find(params[:obstype]) if params[:obstype].present?\n\n query = params[:query]\n if obstype\n @observations = obstype.observations\n @obstype = obstype\n elsif query\n @observations = Observation.ordered_by_date.basic_search(comment: query)\n @query = query\n else\n @observations = Observation.all\n end\n\n year = params[:year]\n if year.present?\n @observations = @observations.by_year(year.to_i)\n @year = year\n end\n\n areas = params[:areas_as_text] # TODO: what happens when you add multiple areas\n if areas.present?\n @observations = @observations.by_area(areas)\n myareas = Area.find(areas)\n @areas_as_text = [myareas].map(&:attributes).to_json\n end\n\n @observations = @observations.by_page(params[:page])\n\n respond_with @observations do |format|\n format.salus_xml { render 'index', formats: %i[salus_xml] }\n format.salus_csv { render 'index', formats: %i[salus_csv] }\n end\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def params_medical_record\n #params.require(:medicalRecord).permit(:observations)\n params.permit(:observations)\n end", "def create\n @note_features = request.parameters['_json'].map do |n|\n note = NoteFeature.new(n)\n note.save\n end\n # @note_features.each(&:save)\n render json: @note_features\n end", "def index\n @pain_observations = PainObservation.all\n end", "def add_taxa_from_observations\n self.user.observations.all(:select => 'taxon_id', \n :group => 'taxon_id', \n :conditions => 'taxon_id IS NOT NULL').each do |observation|\n self.add_taxon(observation.taxon_id)\n end\n end", "def index_observation # :nologin: :norobots:\n query = find_or_create_query(:Observation, by: params[:by])\n show_selected_observations(query, id: params[:id].to_s, always_index: true)\n end", "def create\n #@visit = params[:visits]\n Visit.collection.insert_many(params[:visits]) #save to batch to database mongoid awesome\n \n end", "def import_observations(station, date)\n self.send(:initialize)\n api_data = self.get_api_data(station, date)\n\n # Check for minutely data\n self.collect_processed_minutely_data(station, api_data).each do |d|\n self.save(d)\n end if self.supported_periods.include? PERIOD_MINUTE\n\n # Check for hourly data\n self.collect_processed_hourly_data(station, api_data).each do |d|\n self.save(d)\n end if self.supported_periods.include? PERIOD_HOUR\n\n # Check for daily data\n self.collect_processed_daily_data(station, api_data).each do |d|\n self.save(d)\n end if self.supported_periods.include? PERIOD_DAY\n\n Rails.logger.debug \"Processed #{self.results[:processed]} observations\"\n Rails.logger.debug \"Created #{self.results[:created]} observations\"\n Rails.logger.debug \"Updated #{self.results[:updated]} observations\"\n Rails.logger.debug \"Skipped #{self.results[:skipped]} observations\"\n Rails.logger.debug \"#{self.results[:failed]} observations failed saving\"\n return self.results\n end", "def create\n @imaging_observation = ImagingObservation.new(params[:imaging_observation])\n @imaging_observations = ImagingObservation.all.find_all { |io| io.template.user_id == current_user.id }\n respond_to do |format|\n if @imaging_observation.save\n flash[:notice] = \"<br>Created imaging observation <%= ImagingObservation.last.id.to_s %>\"\n @imaging_observations = ImagingObservation.all.find_all { |io| io.template.user_id == current_user.id }\n format.html { render :text => 'why html?' }\n format.js # { render :layout => false }\n# format.html { redirect_to(@imaging_observation) }\n# format.xml { render :xml => @imaging_observation, :status => :created, :location => @imaging_observation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @imaging_observation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def gather!\n Observation.prune!\n\n @observations = get_datas!\n @last_observation_at = Observation.select(:observed_at).last.try(:observed_at)\n collection = @last_observation_at.nil? ? @observations : only_the_ones_we_care_about\n collection.each do |observation|\n o = Observation.create observation\n Observation.logger.info \"created #{o.inspect}\"\n end\n end", "def latest_observations\n path = 'stations/%s/observations/latest' % [@id]\n get(path)['properties']\n end", "def index_observation\n query = find_or_create_query(:Observation, by: params[:by])\n show_selected_observations(\n query, id: params[:id].to_s, always_index: true\n )\n end", "def submit_blank_observation_data\n question = self\n parent = self.parent\n survey_template = self.survey_template\n surveys = survey_template.surveys\n surveys.each do |s|\n if parent.blank?\n Observation.create_with(\n answer: ''\n ).find_or_create_by(\n survey_id: s.id,\n question_id: self.id,\n entry: 1\n )\n # if new question is in a repeater must add observation for each instance of repeater saved in previous surveys\n else\n s.observations.where(question_id: parent.id).each do |o|\n Observation.create_with(\n answer: ''\n ).find_or_create_by(\n survey_id: s.id,\n question_id: self.id,\n entry: o.entry\n )\n end\n end\n # calling save so that before_save method apply_group_sort is called to resort observations after inserting new ones for new questions-kdh\n s.save\n end\n end", "def create\n\n if !params[:name].nil? && !params[:email].nil?\n user = User.find_by_email(params[:email])\n if user\n pet = user.pets.create(name:params[:name], observations: params[:observations])\n if pet\n render json: pet, status: :created\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error saving pet, please try it again'}, status: :bad_request\n end\n else\n render json: {message: 'Pet name not provided'}, status: :bad_request\n end\n end", "def new\n @observation = Observation.new(:user => current_user)\n\n if params[:copy] && (copy_obs = Observation.find_by_id(params[:copy])) && copy_obs.user_id == current_user.id\n %w(observed_on_string time_zone zic_time_zone place_guess geoprivacy map_scale positional_accuracy).each do |a|\n @observation.send(\"#{a}=\", copy_obs.send(a))\n end\n @observation.latitude = copy_obs.private_latitude || copy_obs.latitude\n @observation.longitude = copy_obs.private_longitude || copy_obs.longitude\n copy_obs.observation_photos.each do |op|\n @observation.observation_photos.build(:photo => op.photo)\n end\n copy_obs.observation_sounds.each do |os|\n @observation.observation_sounds.build( sound: os.sound )\n end\n end\n \n @taxon = Taxon.find_by_id(params[:taxon_id].to_i) unless params[:taxon_id].blank?\n unless params[:taxon_name].blank?\n @taxon ||= TaxonName.where(\"lower(name) = ?\", params[:taxon_name].to_s.strip.gsub(/[\\s_]+/, ' ').downcase).\n first.try(:taxon)\n end\n \n if !params[:project_id].blank?\n @project = if params[:project_id].to_i == 0\n Project.includes(:project_observation_fields => :observation_field).find(params[:project_id])\n else\n Project.includes(:project_observation_fields => :observation_field).find_by_id(params[:project_id].to_i)\n end\n if @project\n @place = @project.place\n @project_curators = @project.project_users.where(\"role IN (?)\", [ProjectUser::MANAGER, ProjectUser::CURATOR])\n @tracking_code = params[:tracking_code] if @project.tracking_code_allowed?(params[:tracking_code])\n @kml_assets = @project.project_assets.select{|pa| pa.asset_file_name =~ /\\.km[lz]$/}\n end\n end\n\n @place ||= Place.find(params[:place_id]) unless params[:place_id].blank? rescue nil\n\n if @place\n @place_geometry = PlaceGeometry.without_geom.where(place_id: @place).first\n end\n\n sync_flickr_photo if params[:flickr_photo_id] && current_user.flickr_identity\n sync_picasa_photo if params[:picasa_photo_id] && current_user.picasa_identity\n sync_local_photo if params[:local_photo_id]\n \n @welcome = params[:welcome]\n \n # this should happen AFTER photo syncing so params can override attrs \n # from the photo\n [:latitude, :longitude, :place_guess, :location_is_exact, :map_scale,\n :positional_accuracy, :positioning_device, :positioning_method,\n :observed_on_string].each do |obs_attr|\n next if params[obs_attr].blank?\n # sync_photo indicates that the user clicked sync photo, so presumably they'd \n # like the photo attrs to override the URL\n # invite links are the other case, in which URL params *should* override the \n # photo attrs b/c the person who made the invite link chose a taxon or something\n if params[:sync_photo]\n @observation.send(\"#{obs_attr}=\", params[obs_attr]) if @observation.send(obs_attr).blank?\n else\n @observation.send(\"#{obs_attr}=\", params[obs_attr])\n end\n end\n if @taxon\n @observation.taxon = @taxon\n @observation.species_guess = if @taxon.common_name\n @taxon.common_name( user: current_user ).name\n else\n @taxon.name\n end\n elsif !params[:taxon_name].blank?\n @observation.species_guess = params[:taxon_name]\n end\n \n @observation_fields = ObservationField.recently_used_by(current_user).limit(10)\n @observation.set_time_zone if @observation.time_zone.blank?\n respond_to do |format|\n format.html do\n @observations = [@observation]\n end\n format.json { render :json => @observation }\n end\n end", "def observation_params\n params.require(:observation).permit(:team_id, :challenge_id, :user_id)\n end", "def create\n @predict = Predict.new(params[:predict])\n\n respond_to do |format|\n if @predict.save\n format.html { redirect_to @predict, notice: 'Predict was successfully created.' }\n format.json { render json: @predict, status: :created, location: @predict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @predict.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n PlaceVisit.collection.insert_many(params[:place_visits]) #save to batch to database mongoid awesome\n end", "def new\n @observation_type = ObservationType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @observation_type }\n end\n end", "def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n sanitized_params = parse_params(simulation_where_params)\n simulations = Simulation.find_all(sanitized_params)\n\n render json: simulations\n end", "def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end", "def create\n @pain_observation = PainObservation.new(pain_observation_params)\n\n respond_to do |format|\n if @pain_observation.save\n format.html { redirect_to @pain_observation, notice: 'Pain observation was successfully created.' }\n format.json { render :show, status: :created, location: @pain_observation }\n else\n format.html { render :new }\n format.json { render json: @pain_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def map_observation\n pass_query_params\n obs = find_or_goto_index(Observation, params[:id].to_s)\n return unless obs\n\n @title = :map_observation_title.t(id: obs.id)\n @observations = [\n MinimalMapObservation.new(obs.id, obs.public_lat, obs.public_long,\n obs.location)\n ]\n render(template: \"observations/map\")\n end", "def destroy\n @observation = Observation.find(params[:id])\n @observation.destroy\n\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def new\n @predict = Predict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @predict }\n end\n end", "def create_observation # :prefetch: :norobots:\n # These are needed to create pulldown menus in form.\n @licenses = License.current_names_and_ids(@user.license)\n @new_image = init_image(Time.now)\n\n # Clear search list. [Huh? -JPH 20120513]\n clear_query_in_session\n\n # Create empty instances first time through.\n if request.method != \"POST\"\n create_observation_get\n else\n create_observation_post(params)\n end\n end", "def edit_batch\n observation_ids = params[:o].is_a?(String) ? params[:o].split(',') : []\n @observations = Observation.where(\"id in (?) AND user_id = ?\", observation_ids, current_user).\n includes(\n :quality_metrics, :observation_field_values, :sounds, :taggings,\n { observation_photos: :photo },\n { taxon: { taxon_photos: :photo } },\n )\n @observations.map do |o|\n if o.coordinates_obscured?\n o.latitude = o.private_latitude\n o.longitude = o.private_longitude\n o.place_guess = o.private_place_guess\n end\n if qm = o.quality_metrics.detect{|qm| qm.user_id == o.user_id}\n o.captive_flag = qm.metric == QualityMetric::WILD && !qm.agree? ? 1 : 0\n else\n o.captive_flag = \"unknown\"\n end\n o\n end\n end", "def create\n @observation = Observation.new(observation_params)\n # @observation.approval_status = \"pending\"\n\n # puts @observation.resource_doi\n \n # if params[:resource_doi]\n # resource = Resource.where(:doi_isbn => params[:resource_doi])\n # if resource.present?\n # @observation.resource_id = resource.first.id\n # puts \"----- WAS present ==============================\"\n # else\n # puts \"----- WAS NOT present ==============================\"\n # begin\n # @doi = JSON.load(open(\"https://api.crossref.org/works/#{params[:resource_doi]}\"))\n # if @doi[\"message\"][\"author\"][0][\"family\"] == \"Peresson\"\n # @doi = \"Invalid\"\n # end\n # rescue\n # @doi = \"Invalid\"\n # end\n # puts @doi\n\n # if not @doi == \"Invalid\"\n\n\n # @resource = Resource.new(resource_params)\n\n # authors = \"\"\n # @doi[\"message\"][\"author\"].each do |a|\n # authors = authors + \"#{a[\"family\"].titleize}, #{a[\"given\"].titleize}, \"\n # end\n\n # @resource.author = authors\n # @resource.year = @doi[\"message\"][\"issued\"][\"date-parts\"][0][0]\n # @resource.title = @doi[\"message\"][\"title\"][0]\n # @resource.journal = @doi[\"message\"][\"container-title\"][0]\n # @resource.volume_pages = @doi[\"message\"][\"volume\"], @doi[\"message\"][\"page\"]\n # @resource.save!\n\n # if @resource.save\n # @observation.resource_id = @resource.id\n # else\n # @observation.errors.add(:base, 'The oid was invalid')\n # end\n # else\n # @observation.errors.add(:base, 'The oid was invalid')\n # end\n # end\n # end\n\n if @observation.save\n # Todo: Uncomment following line in production\n #UploadApprovalMailer.approve(current_user).deliver\n redirect_to @observation, flash: {success: \"Observation was successfully created.\" }\n else\n render action: 'new'\n end\n end", "def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def set_observation\n @observation = Observation.find(params[:id])\n end", "def set_observation\n @observation = Observation.find(params[:id])\n end", "def create\n params[:predictions].each do |prediction|\n @prediction = current_user.predictions.new(prediction)\n if @prediction.valid?\n @prediction.save\n end\n end\n redirect_to root_path\n end", "def create\n @ontology = Ontology.new(ontology_params)\n\n respond_to do |format|\n if @ontology.save\n format.html { redirect_to @ontology, notice: 'Ontology was successfully created.' }\n format.json { render :show, status: :created, location: @ontology }\n else\n format.html { render :new }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\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 #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end", "def create\n respond_to do |format|\n if @input_datum.update(params[:input_data].keys, params[:input_data].values)\n format.html { redirect_to @input_datum, notice: 'Input datum was successfully created.' }\n format.json { render :show, status: :created, location: @input_datum }\n else\n format.html { render :new }\n format.json { render json: @input_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_observation(obs)\n return if observations.include?(obs)\n\n observations.push(obs)\n obs.update(specimen: true) unless obs.specimen\n obs.log(:log_collection_number_added, name: format_name, touch: true)\n end", "def new\n @evidence_batch = EvidenceBatch.new\n @count = Evidence.all.count\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @evidence_batch }\n end\n end", "def observation_index # :nologin: :norobots:\n query = create_query(:Name, :with_observations)\n show_selected_names(query)\n end", "def create\n @user = User.find(params[:user])\n @animal = Animal.find(params[:animal])\n @interest = Interest.new(user_id: @user.id, animal_id: @animal.id, date: Date.today)\n\n respond_to do |format|\n if @interest.save\n format.html { redirect_to :back, notice: 'You sent an interest to the animal' }\n format.json { head :no_content }\n else\n format.html { redirect_to animals_url, notice: @interest.errors.full_messages[0] }\n format.json { head :no_content }\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 new_observation(args)\n if args\n Observation.new(args.permit(permitted_observation_args).to_h)\n else\n Observation.new\n end\n end", "def create\n @serving = Serving.new(params[:serving])\n\n respond_to do |format|\n if @serving.save\n format.html { redirect_to @serving, notice: 'Serving was successfully created.' }\n format.json { render json: @serving, status: :created, location: @serving }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n data = reload(get_series('sleep'), str(Date.strptime(params[:sleep].values.join(\"-\"))))\n saved = false\n get_series('sleep').each do |s|\n data[s].each do |day|\n logger.debug \"data=#{day} date=#{day['dateTime']} value=#{day['value']}\"\n @sleep = for_date(day['dateTime'])\n\t# get variable name from last part of series\n @sleep.send(s.rpartition('/')[2] + '=', day['value'])\n saved = @sleep.save\n if not saved\n flash[:error] = @sleep.errors\n end\n end\n end\n \n respond_to do |format|\n flash[:success] = 'Sleep was successfully created.'\n format.html { redirect_to sleeps_path }\n format.json { render :json => sleeps_path, :status => :created, :location => sleeps_path }\n end\n end", "def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(params[:observation])\n format.html { redirect_to @observation, notice: 'Observation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end", "def postReadings(info, state)\r\n params = {\r\n :device_id => info.deviceId,\r\n :sensor_data => [\r\n {\r\n :type => \"Temperature\",\r\n :value => state.temperature,\r\n :time => Time.now.to_i\r\n },\r\n {\r\n :type => \"Humidity\",\r\n :value => state.humidity,\r\n :time => Time.now.to_i\r\n }\r\n ]\r\n }\r\n res = apiPostJson(\"readings\", params)\r\n if res.status != 201\r\n $LOG.warn(\"Failed to post readings to backend! Status: #{res.status}, Response: #{res.body}\")\r\n end\r\n end", "def destroy\n @observation.wait_for_index_refresh = true\n @observation.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = t(:observation_was_deleted)\n redirect_to(observations_by_login_path(current_user.login))\n end\n format.xml { head :ok }\n format.json do\n head :ok\n end\n end\n end", "def observation_params\n params.require(:observation).permit(\n :cruise_id, :observed_at, :latitude, :longitude, :uuid,\n :lat_minutes, :lat_seconds, :lon_minutes, :lon_seconds,\n :primary_observer_id_or_name, additional_observers_id_or_name: [],\n ship_attributes: [:id, :heading, :power, :speed, :ship_activity_lookup_id],\n notes_attributes: [:id, :text],\n ice_attributes: [:id, :total_concentration, :open_water_lookup_id,\n :thick_ice_lookup_id, :thin_ice_lookup_id],\n ice_observations_attributes: [:id, :partial_concentration, :ice_lookup_id,\n :thickness, :floe_size_lookup_id, :snow_lookup_id, :snow_thickness,\n :algae_lookup_id, :algae_density_lookup_id, :algae_location_lookup_id,\n :sediment_lookup_id, :obs_type,\n topography_attributes: [:id, :concentration, :ridge_height, :consolidated,\n :snow_covered, :old, :topography_lookup_id\n ],\n melt_pond_attributes: [:id, :surface_coverage, :pattern_lookup_id,\n :surface_lookup_id, :freeboard, :max_depth_lookup_id, :bottom_type_lookup_id,\n :dried_ice, :rotten_ice\n ]\n ],\n meteorology_attributes: [:id, :visibility_lookup_id, :weather_lookup_id,\n :total_cloud_cover, :wind_speed, :wind_direction, :water_temperature,\n :air_pressure, :air_temperature, :relative_humidity,\n clouds_attributes: [:id, :cloud_lookup_id, :cover, :height, :cloud_type]\n ],\n faunas_attributes: [:id, :name, :count, :_destroy],\n photos_attributes: [:id, :file, :on_boat_location_lookup_id, :_destroy]\n )\n end", "def index\n show and return if params[:id].present?\n\n @query = find_or_create_query(:Observation)\n apply_content_filters(@query)\n @query = restrict_query_to_box(@query)\n\n find_locations_matching_observations\n end", "def create\n @historial_odt = HistorialOdt.new(params[:historial_odt])\n\n respond_to do |format|\n if @historial_odt.save\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully created.' }\n format.json { render json: @historial_odt, status: :created, location: @historial_odt }\n else\n format.html { render action: \"new\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @studies = Study.all\n #render json: @studies\n end", "def destroy\n @observation.destroy\n respond_to do |format|\n format.html { redirect_to observations_url, notice: 'Observation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @prediction = Prediction.new(prediction_params)\n\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to @prediction, notice: 'Prediction was successfully created.' }\n format.json { render :show, status: :created, location: @prediction }\n else\n format.html { render :new }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_data\n \n # Parse parameters\n rank = 'new'\n \n # Format the rank we want to search on\n if (params[:category_new])\n rank += \"_%s_apps\" % params[:category_new]\n else\n rank += \"_apps\"\n end\n \n # Get query parameters and add the rank\n query = get_query.merge!({rank => {:$gt => 0}})\n\n # Get list of fields to return\n fields = get_fields\n \n # Get list of fields to remove\n without = get_without_fields\n\n # Check if sorting method is specified\n sort_field = get_sorting(rank)\n \n # If the limit is specified set it otherwise default to 100\n limit_num = get_limit\n \n # Create mongo query.\n # Select based on store where both criteria match:\n # => country is the specified one\n # => rank is greater than 0\n apps = AppData.where(query)\n .sort(sort_field)\n .fields(fields)\n .limit(limit_num)\n .all\n \n # Apply interests weighting if interests exist \n apps = weight_interests(apps, request.query_parameters['interests'])\n \n # Return result as json\n render :json => apps.as_json(:only => fields, :except => without)\n \n end", "def create\n @iot_datum = IotDatum.new(iot_datum_params)\n\n respond_to do |format|\n if @iot_datum.save\n format.html { redirect_to @iot_datum, notice: 'Iot datum was successfully created.' }\n format.json { render :show, status: :created, location: @iot_datum }\n else\n format.html { render :new }\n format.json { render json: @iot_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @patient_samples = PatientSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_samples }\n end\n end", "def trends\n data = generate_data(data_factory)\n respond_with data\n end", "def create\n @serving = Serving.new(serving_params)\n\n respond_to do |format|\n if @serving.save\n format.html { redirect_to @serving, notice: 'Serving was successfully created.' }\n format.json { render :show, status: :created, location: @serving }\n else\n format.html { render :new }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end", "def create\n @notebook = Notebook.new(params[:notebook])\n\n if @notebook.save\n render json: @notebook, status: :created, location: @notebook\n else\n render json: @notebook.errors, status: :unprocessable_entity\n end\n end", "def set_observation\n @observation = Observation.find(params[:id])\n end", "def index\n @observations = Observation.where(service_of_dependence: current_user.dependence.service_of_dependences)\n end" ]
[ "0.6815235", "0.63848794", "0.60884935", "0.6074431", "0.6030065", "0.59960806", "0.58845776", "0.5849277", "0.5688321", "0.5684957", "0.5681144", "0.5679821", "0.56469214", "0.56435794", "0.56387925", "0.5626174", "0.5620451", "0.5614174", "0.5614174", "0.5612944", "0.5547071", "0.55140775", "0.54179573", "0.5391213", "0.5382174", "0.5366401", "0.5345051", "0.5337069", "0.5331", "0.531177", "0.5302985", "0.5252256", "0.5236395", "0.52294296", "0.5226496", "0.5157944", "0.5151316", "0.5134741", "0.51177764", "0.5114183", "0.5109863", "0.50841445", "0.50642896", "0.5062733", "0.5050772", "0.5044782", "0.5042536", "0.5027636", "0.50093114", "0.5008779", "0.5008635", "0.49989918", "0.49893913", "0.49731424", "0.496972", "0.49658474", "0.4960208", "0.49568522", "0.49466503", "0.49297702", "0.49267742", "0.49156353", "0.49106544", "0.4908116", "0.49062186", "0.49048507", "0.48940262", "0.48940262", "0.48826385", "0.48610547", "0.48435983", "0.48423558", "0.4837282", "0.48290756", "0.4825961", "0.48236898", "0.48224488", "0.48180714", "0.4798441", "0.47980556", "0.47877473", "0.47797185", "0.47721204", "0.47609633", "0.47605824", "0.47601855", "0.47588676", "0.4758816", "0.47538942", "0.47516713", "0.47496176", "0.4748249", "0.47307816", "0.47262454", "0.47252142", "0.4724445", "0.4720773", "0.47192407", "0.47148162", "0.47135198" ]
0.50453436
45
PATCH/PUT /observations/1 PATCH/PUT /observations/1.json
def update @observation.assign_attributes observation_params respond_to do |format| if @observation.save(validate: false) if params[:commit] == 'Save and Exit' format.html { redirect_to root_url } else format.html { redirect_to edit_observation_path(@observation), notice: 'Observation was successfully updated.' } end else format.html { render :edit } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(params[:observation])\n format.html { redirect_to @observation, notice: 'Observation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n observation_user = current_user\n \n unless params[:admin_action].nil? || !current_user.is_admin?\n observation_user = Observation.find(params[:id]).user\n end\n \n # Handle the case of a single obs\n if params[:observation]\n params[:observations] = [[params[:id], params[:observation]]]\n elsif params[:id] && params[:observations]\n params[:observations] = [[params[:id], params[:observations][0]]]\n end\n \n if params[:observations].blank? && params[:observation].blank?\n respond_to do |format|\n format.html do\n flash[:error] = t(:no_observations_submitted)\n redirect_to new_observation_path\n end\n format.json { render :status => :unprocessable_entity, :json => \"No observations submitted!\" }\n end\n return\n end\n\n @observations = params[:observations].to_h.map do |id, obs|\n Observation.where( uuid: id, user_id: observation_user ).first ||\n Observation.where( id: id, user_id: observation_user ).first\n end.compact\n \n # Make sure there's no evil going on\n unique_user_ids = @observations.map(&:user_id).uniq\n more_than_one_observer = unique_user_ids.size > 1\n admin_action = unique_user_ids.first != observation_user.id && current_user.has_role?(:admin)\n if [email protected]? && more_than_one_observer && !admin_action\n msg = t(:you_dont_have_permission_to_edit_that_observation)\n respond_to do |format|\n format.html do\n flash[:error] = msg\n redirect_to(@observation || observations_path)\n end\n format.json do\n render :status => :forbidden, :json => {:error => msg}\n end\n end\n return\n end\n \n # Convert the params to a hash keyed by ID. Yes, it's weird\n hashed_params = Hash[params[:observations].to_h.map do |id, obs|\n instance = @observations.detect{ |o| o.uuid == id || o.id.to_s == id }\n instance ? [instance.id.to_s, obs] : nil\n end.compact]\n errors = false\n extra_msg = nil\n @observations.each_with_index do |observation,i|\n fieldset_index = observation.id.to_s\n observation.skip_indexing = true\n \n # Note: this ignore photos thing is a total hack and should only be\n # included if you are updating observations but aren't including flickr\n # fields, e.g. when removing something from ID please\n if !params[:ignore_photos] && !is_mobile_app?\n # Get photos\n keeper_photos = []\n old_photo_ids = observation.photo_ids\n Photo.subclasses.each do |klass|\n klass_key = klass.to_s.underscore.pluralize.to_sym\n next if klass_key.blank?\n if params[klass_key] && params[klass_key][fieldset_index]\n keeper_photos += retrieve_photos(params[klass_key][fieldset_index],\n :user => current_user, :photo_class => klass, :sync => true)\n end\n end\n\n if keeper_photos.empty?\n observation.observation_photos.destroy_all\n else\n keeper_photos = ensure_photos_are_local_photos( keeper_photos )\n reject_obs_photos = observation.observation_photos.select{|op| !keeper_photos.map(&:id).include?( op.photo_id )}\n reject_obs_photos.each(&:destroy)\n keeper_photos.each do |p|\n if p.new_record? || !observation.observation_photos.detect{|op| op.photo_id == p.id }\n observation.observation_photos.build( photo: p )\n end\n end\n end\n\n Photo.subclasses.each do |klass|\n klass_key = klass.to_s.underscore.pluralize.to_sym\n next unless params[\"#{klass_key}_to_sync\"] && params[\"#{klass_key}_to_sync\"][fieldset_index]\n next unless photo = observation.observation_photos.last.try(:photo)\n photo_o = photo.to_observation\n PHOTO_SYNC_ATTRS.each do |a|\n hashed_params[observation.id.to_s] ||= {}\n if hashed_params[observation.id.to_s][a].blank? && observation.send(a).blank?\n hashed_params[observation.id.to_s][a] = photo_o.send(a)\n end\n end\n end\n end\n\n # Kind of like :ignore_photos, but :editing_sounds makes it opt-in rather than opt-out\n # If editing sounds and no sound parameters are present, assign to an empty array \n # This way, sounds will be removed\n if params[:editing_sounds]\n params[:soundcloud_sounds] ||= {fieldset_index => []} \n params[:soundcloud_sounds][fieldset_index] ||= []\n params[:local_sounds] ||= {fieldset_index => []} \n params[:local_sounds][fieldset_index] ||= []\n sounds = Sound.from_observation_params(params, fieldset_index, current_user)\n ensured_sounds = ensure_sounds_are_local_sounds( sounds )\n observation.sounds = ensured_sounds\n end\n \n observation.editing_user_id = current_user.id\n\n observation.force_quality_metrics = true unless hashed_params[observation.id.to_s][:captive_flag].blank?\n permitted_params = ActionController::Parameters.new( hashed_params[observation.id.to_s].to_h )\n unless observation.update( observation_params( permitted_params ) )\n errors = true\n end\n\n if !errors && params[:project_id] && !observation.project_observations.where(:project_id => params[:project_id]).exists?\n if @project ||= Project.find(params[:project_id])\n project_observation = ProjectObservation.create(:project => @project, :observation => observation)\n extra_msg = if project_observation.valid?\n \"Successfully added to #{@project.title}\"\n else\n \"Failed to add to #{@project.title}: #{project_observation.errors.full_messages.to_sentence}\"\n end\n end\n end\n end\n\n Observation.elastic_index!(\n ids: @observations.to_a.compact.map( &:id )\n )\n\n respond_to do |format|\n if errors\n format.html do\n if @observations.size == 1\n @observation = @observations.first\n render :action => 'edit'\n else\n render :action => 'edit_batch'\n end\n end\n format.xml { render :xml => @observations.collect(&:errors), :status => :unprocessable_entity }\n format.json do\n render :status => :unprocessable_entity, :json => {\n :error => @observations.map{|o| o.errors.full_messages.to_sentence}.to_sentence,\n :errors => @observations.collect(&:errors)\n }\n end\n elsif @observations.empty?\n msg = if params[:id]\n t(:that_observation_no_longer_exists)\n else\n t(:those_observations_no_longer_exist)\n end\n format.html do\n flash[:error] = msg\n redirect_back_or_default(observations_by_login_path(current_user.login))\n end\n format.json { render :json => {:error => msg}, :status => :gone }\n else\n format.html do\n flash[:notice] = \"#{t(:observations_was_successfully_updated)} #{extra_msg}\"\n if @observations.size == 1\n redirect_to observation_path(@observations.first)\n else\n redirect_to observations_by_login_path(observation_user.login)\n end\n end\n format.xml { head :ok }\n format.js { render :json => @observations }\n format.json do\n if @observations.size == 1 && is_iphone_app_2?\n render :json => @observations[0].to_json(\n viewer: current_user,\n methods: [:user_login, :iconic_taxon_name],\n include: {\n taxon: Taxon.default_json_options,\n observation_field_values: {},\n project_observations: {\n include: {\n project: {\n only: [:id, :title, :description],\n methods: [:icon_url]\n }\n }\n },\n observation_photos: {\n include: {\n photo: {\n methods: [:license_code, :attribution],\n except: [:original_url, :file_processing, :file_file_size, \n :file_content_type, :file_file_name, :mobile, :metadata, :user_id, \n :native_realname, :native_photo_id]\n }\n }\n },\n } )\n else\n render json: @observations.to_json( methods: [:user_login, :iconic_taxon_name], viewer: current_user )\n end\n end\n end\n end\n end", "def update\n @observation = Observation.find(params[:id])\n\n respond_to do |format|\n if @observation.update_attributes(observation_params)\n format.html { redirect_to coral_path(@observation.coral), flash: {success: 'Observation was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation.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 respond_to do |format|\n if @observations.update(obersvation_params)\n format.html { redirect_to @obersvation, notice: 'Obersvation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obersvation.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 do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @observation.update(observation_params)\n format.html { redirect_to @observation, notice: 'Observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @observation }\n else\n @services_of_dependence = current_user.dependence.service_of_dependences\n agents_of_service = AgentOfService.where(service_of_dependence: @services_of_dependence)\n @agents = Agent.where(id: agents_of_service.pluck(:agent_id))\n format.html { render :edit }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_name_merge_one_with_observations\n old_name = names(:mergeable_no_notes) # mergeable, ergo no observation\n assert(old_name.observations.none?, \"Test needs a different fixture.\")\n new_name = names(:coprinus_comatus) # has observations\n assert(new_name.observations.any?, \"Test needs a different fixture.\")\n\n params = {\n id: old_name.id,\n name: {\n text_name: new_name.text_name,\n author: new_name.author,\n rank: old_name.rank,\n citation: \"\",\n deprecated: (old_name.deprecated ? \"true\" : \"false\")\n }\n }\n login(\"rolf\")\n put(:update, params: params)\n\n assert_flash_success\n assert_redirected_to(name_path(new_name.id))\n assert_no_emails\n assert(new_name.reload)\n assert_not(Name.exists?(old_name.id))\n end", "def update # PATCH\n raise NotImplementedError\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 @ice_observation.update(ice_observation_params)\n format.html { redirect_to @ice_observation, notice: 'Ice observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @ice_observation }\n else\n format.html { render :edit }\n format.json { render json: @ice_observation.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def patch!\n request! :patch\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!(**args)\n @observations = args[:observations] if args.key?(:observations)\n @namespaced_types = args[:namespaced_types] if args.key?(:namespaced_types)\n end", "def update\n respond_to do |format|\n if @serving.update(serving_params)\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { render :show, status: :ok, location: @serving }\n else\n format.html { render :edit }\n format.json { render json: @serving.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(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @observ.update(observ_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @observ.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n if @observation_type.update_attributes(params[:observation_type])\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @predict = Predict.find(params[:id])\n\n respond_to do |format|\n if @predict.update_attributes(params[:predict])\n format.html { redirect_to @predict, notice: 'Predict was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @predict.errors, status: :unprocessable_entity }\n end\n end\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 animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @experiment = Experiment.find(@datapoint.experiment_id)\n respond_to do |format|\n if @datapoint.update(datapoint_params)\n format.html { redirect_to @experiment, notice: 'Datapoint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @datapoint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @observation_field.update(params[:observation_field])\n format.html { redirect_to(@observation_field, :notice => 'ObservationField was successfully updated.') }\n format.json { render :json => @observation_field }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => {:errors => @observation_field.errors.full_messages}, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n\t\trespond_to do |format|\n\t\t\tif @ontology.update(ontology_params)\n\t\t\t\tformat.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @ontology.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @notebook = Notebook.find(params[:id])\n\n if @notebook.update_attributes(params[:notebook])\n head :no_content\n else\n render json: @notebook.errors, status: :unprocessable_entity\n end\n end", "def update\n put :update\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 note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end", "def update\n respond_to do |format|\n if @kata.update(kata_params)\n format.html { redirect_to @kata, notice: 'Kata was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kata.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @interesting_thing.update(interesting_thing_params)\n format.html { redirect_to student_interesting_things_path(@student), notice: 'Interesting thing was successfully updated.' }\n format.json { render :show, status: :ok, location: @interesting_thing }\n else\n format.html { render :edit }\n format.json { render json: @interesting_thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n standard_update(Interest, params[:id], interest_params)\n end", "def update\n pass_query_params\n # basic sanitizing of the param. ivars needed in js response\n # checked is a string!\n @reviewed = params[:reviewed] == \"1\"\n return unless (obs = Observation.find(params[:id]))\n\n # update_view_stats creates an o_v if it doesn't exist\n @obs_id = obs.id # ivar used in the js template\n ov = ObservationView.update_view_stats(@obs_id, User.current_id)\n # now we can update it\n ov.update(reviewed: @reviewed)\n respond_to do |format|\n format.js\n format.html do\n return redirect_to(identify_observations_path)\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @notebook = Notebook.find(params[:id])\n\n respond_to do |format|\n if @notebook.update_attributes(params[:notebook])\n format.html { redirect_to @notebook, notice: 'Notebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notebook = Notebook.find(params[:id])\n\n respond_to do |format|\n if @notebook.update_attributes(params[:notebook])\n format.html { redirect_to @notebook, notice: 'Notebook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notebook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n respond_to do |format|\n if @observance.update(observance_params)\n format.html { redirect_to @observance, notice: 'Observance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @observance.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n respond_with []\n end", "def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end", "def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient].except(:person_attributes))\n format.html { redirect_to people_url, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\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 if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n puts \"update\"\n h = item_params\n unless current_user.admin?\n puts \"Item params before: \" + item_params.inspect\n h = item_params.slice(:observations, :status)\n end\n\n puts \"========================================\"\n puts h.inspect\n puts \"========================================\"\n if\n respond_to do |format|\n if @item.update(h)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end", "def update\n respond_to do |format|\n if @pain_observation.update(pain_observation_params)\n format.html { redirect_to @pain_observation, notice: 'Pain observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_observation }\n else\n format.html { render :edit }\n format.json { render json: @pain_observation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(path)\n output { patch(path, params) }\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\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 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 update(data = :object || :json)\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n if @historial_odt.update_attributes(params[:historial_odt])\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial_odt.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!(sobject, attrs)\n id = attrs.has_key?(:Id) ? attrs.delete(:Id) : attrs.delete('Id')\n raise 'Id field missing.' unless id\n api_patch \"sobjects/#{sobject}/#{id}\", attrs\n true\n end", "def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end", "def update\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset.update(dataset_params)\n format.html { redirect_to @dataset, notice: 'Dataset was successfully updated.' }\n format.json { render :show, status: :ok, location: @dataset }\n else\n format.html { render :edit }\n format.json { render json: @dataset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def save\n @client.patch(@endpoint, :content=>@changed)\n return nil\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\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end", "def update\n\n sub_obj_non_attributes = study_params.select { |key| !key.to_s.match(/_attributes$/) }\n\n @study = Study.find(session[:current_study_id])\n\n \n if ! sub_obj_non_attributes.empty?\n @study.update(sub_obj_non_attributes.to_h.except('_destroy', 'id', 'rec_id', 'updated', 'rec_delete'))\n end\n \n traverse_study_attr(study_params.select { |key| key.to_s.match(/_attributes$/)}, @study)\n \n respond_to do |format|\n format.html { redirect_to study_steps_path}\n format.json { render action: 'show', status: :created, location: @study }\n\n end\n\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n @recording = Recording.find(params[:id])\n\n respond_to do |format|\n if @recording.update_attributes(params[:recording])\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end", "def update\n @animal = Animal.find(params[:id])\n @species = ['Lion', 'Koala', 'Panda']\n @zoo = Zoo.find(params[:zoo_id])\n\n respond_to do |format|\n\n if @animal.update_attributes(params[:animal])\n format.html { redirect_to zoo_animal_path(params[:zoo_id],@animal.id),\n notice: 'animal was successfully updated.' }\n format.json { head :no_content }\n else\n\n format.html { render action: \"edit\"}\n format.json { render json: @animal.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\n end", "def update\n @set.update_attributes({ :data => params[:data] })\n render_json :entry => @set and return\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 req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @obsah.update(obsah_params)\n format.html { redirect_to @obsah, notice: 'Obsah was successfully updated.' }\n format.json { render :show, status: :ok, location: @obsah }\n else\n format.html { render :edit }\n format.json { render json: @obsah.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def set_obersvation\n @observations = Observation.find(params[:id])\n end", "def update\n @operation = Operation.find(params[:id])\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n format.html { redirect_to user_model_path(@model.user,@model), notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing = Thing.find(params[:id])\n\n respond_to do |format|\n if @thing.update_attributes(params[:thing])\n format.html { redirect_to things_path, notice: 'Your thing was successfully updated!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @thing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if @observation.update(observation_params)\n # Todo: Uncomment following line in production\n #UploadApprovalMailer.approve(current_user).deliver\n redirect_to @observation, flash: {success: \"Observation was successfully updated.\" }\n else\n render action: 'edit'\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 respond_to do |format|\n if @request_datum.update(request_datum_params)\n format.html { redirect_to @request_datum, notice: 'Request datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dataset = Dataset.find(params[:id])\n\n respond_to do |format|\n if @dataset.update_attributes(params[:dataset])\n format.html { redirect_to(@dataset, :notice => 'Dataset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dataset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dataset_datum.update(dataset_datum_params)\n format.html { redirect_to @dataset_datum, notice: 'Dataset datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dataset_datum.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6700708", "0.6571747", "0.6346048", "0.6245954", "0.6142329", "0.6107137", "0.6089586", "0.6083961", "0.5994983", "0.59897083", "0.5959389", "0.5952031", "0.59458584", "0.59311676", "0.5919486", "0.590934", "0.59059125", "0.5905324", "0.58734167", "0.58606005", "0.58568853", "0.583714", "0.5828278", "0.5821616", "0.58096725", "0.5797661", "0.5787636", "0.5772525", "0.5771689", "0.5765911", "0.5757552", "0.5740544", "0.5738644", "0.5715401", "0.5713203", "0.5712672", "0.5710533", "0.5708873", "0.5706279", "0.57010925", "0.5691501", "0.56844074", "0.5678271", "0.5677701", "0.5667881", "0.56513053", "0.56513053", "0.5647866", "0.5645085", "0.56439114", "0.5642031", "0.5624073", "0.56141144", "0.5613833", "0.56112206", "0.56087846", "0.56041026", "0.56003016", "0.55991936", "0.5581921", "0.5580003", "0.557964", "0.5577067", "0.55736333", "0.55693775", "0.55693775", "0.5565245", "0.5563398", "0.5561345", "0.5555524", "0.55553675", "0.5548567", "0.55431837", "0.554303", "0.55393976", "0.5535218", "0.55335647", "0.55323505", "0.5529711", "0.5525086", "0.5520678", "0.5518099", "0.5518099", "0.55145884", "0.55144256", "0.5513722", "0.5513722", "0.55130476", "0.5510082", "0.54995805", "0.54990906", "0.5498774", "0.5498524", "0.54957116", "0.549328", "0.54876864", "0.5486361", "0.54855", "0.5485477", "0.5484143" ]
0.58308655
22
DELETE /observations/1 DELETE /observations/1.json
def destroy @observation.destroy respond_to do |format| format.html { redirect_to root_url, notice: 'Observation was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @observations.destroy\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @observation = Observation.find(params[:id])\n @observation.destroy\n\n respond_to do |format|\n format.html { redirect_to observations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @observation.wait_for_index_refresh = true\n @observation.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = t(:observation_was_deleted)\n redirect_to(observations_by_login_path(current_user.login))\n end\n format.xml { head :ok }\n format.json do\n head :ok\n end\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 @observation.destroy\n respond_to do |format|\n format.html { redirect_to observations_url, notice: 'Observation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n # @observation = Observation.find(params[:id])\n # @observation.destroy\n\n @coral = Coral.find(params[:coral_id])\n @observation = @coral.observations.find(params[:id])\n @observation.destroy\n # redirect_to coral_path(@coral)\n \n respond_to do |format|\n format.html { redirect_to coral_path(@coral) }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @experiment_raw_dataset.destroy\n respond_to do |format|\n format.html { redirect_to experiment_raw_datasets_url }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @imaging_observation = ImagingObservation.find(params[:id])\n @imaging_observation.destroy\n respond_to do |format|\n format.html { redirect_to(imaging_observations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @historial_odt = HistorialOdt.find(params[:id])\n @historial_odt.destroy\n\n respond_to do |format|\n format.html { redirect_to historial_odts_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @ice_observation.destroy\n respond_to do |format|\n format.html { redirect_to ice_observations_url, notice: 'Ice observation was successfully destroyed.' }\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 @dataset.destroy\n respond_to do |format|\n format.html { redirect_to study_path(@dataset.study), notice: 'Dataset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset_datum.destroy\n respond_to do |format|\n format.html { redirect_to dataset_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @observation_type = ObservationType.find(params[:id])\n @observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_types_url }\n format.json { head :ok }\n end\n end", "def destroy\n @datapoint.destroy\n respond_to do |format|\n format.html { redirect_to datapoints_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @predict = Predict.find(params[:id])\n @predict.destroy\n\n respond_to do |format|\n format.html { redirect_to predicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obs = Observation.find(params[:id])\n @obs.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.mobile { redirect_to :back }\n end\n end", "def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @raw_datum = RawDatum.find(params[:id])\n @raw_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to raw_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tFile.delete(@ontology.url)\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to ontologies_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\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 @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def destroy\n @observation = Observation.find(params[:observation_id])\n @observer = Observer.find(params[:id])\n @observer.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_observers_path(@observation), notice: 'Hospitující byl odebrán z hospitace.' }\n format.json { head :ok }\n end\n end", "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(*rest) end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datum = Datum.find(params[:id])\n @datum.destroy\n\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @patient_sample = PatientSample.find(params[:id])\n @patient_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_samples_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 @observ.destroy\n respond_to do |format|\n format.html { redirect_to observs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to datasets_url }\n format.xml { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @datum.destroy\n respond_to do |format|\n format.html { redirect_to data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interesting = Interesting.find(params[:id])\n @interesting.destroy\n\n respond_to do |format|\n format.html { redirect_to interestings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dummy = Dummy.find(params[:id])\n @dummy.destroy\n\n respond_to do |format|\n format.html { redirect_to dummies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dataset = Dataset.find(params[:id])\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mood_datum.destroy\n respond_to do |format|\n format.html { redirect_to mood_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample_line = SampleLine.find(params[:id])\n @sample_line.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect(person_animals_url, :delete, 'animal') }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n puts @iot_datum.count\n if @iot_datum.count > 0\n @deleted_rec = IotDatum.new\n @deleted_rec.workbench_number = @iot_datum.workbench_number\n @deleted_rec.part_number = @iot_datum.part_number\n @deleted_rec.target = @iot_datum.target\n @deleted_rec.lot_size = @iot_datum.lot_size\n @deleted_rec.employee_name = @iot_datum.employee_name\n @deleted_rec.shift = @iot_datum.shift\n @deleted_rec.device_id = @iot_datum.device_id\n @deleted_rec.count = @iot_datum.count\n @deleted_rec.status = 'Deleted'\n @deleted_rec.save!\n @iot_datum.destroy\n else\n @iot_datum.destroy\n end\n respond_to do |format|\n format.html { redirect_to iot_data_url, notice: 'Planner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @observance.destroy\n respond_to do |format|\n format.html { redirect_to observances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n\n respond_to do |format|\n format.html { redirect_to zoo_animals_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @socioeconomic_study = SocioeconomicStudy.find(params[:id])\n @socioeconomic_study.destroy\n\n respond_to do |format|\n format.html { redirect_to socioeconomic_studies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @competition_interaction_observation = CompetitionInteractionObservation.find(params[:id])\n @competition_interaction_observation.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_interaction_observations_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\n end", "def destroy\n @simulation = Simulation.find(params[:id])\n @simulation.destroy\n\n respond_to do |format|\n format.html { redirect_to simulations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datashows = Datashow.find(params[:id])\n @datashows.destroy\n\n respond_to do |format|\n format.html { redirect_to(datashows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @historical = Historical.find(params[:id])\n @historical.destroy\n\n respond_to do |format|\n format.html { redirect_to historicals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end", "def delete!\n request! :delete\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @pain_observation.destroy\n respond_to do |format|\n format.html { redirect_to pain_observations_url, notice: 'Pain observation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tracked_datum.destroy\n respond_to do |format|\n format.html { redirect_to tracked_data_url, notice: 'Tracked datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Delete.new('/offsets/doit.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(',')})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def destroy\n @obsah.destroy\n respond_to do |format|\n format.html { redirect_to obsahs_url, notice: 'Obsah was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.75186217", "0.71679884", "0.70662516", "0.6777801", "0.6772828", "0.6704908", "0.6695091", "0.66723424", "0.65656424", "0.65312195", "0.64650345", "0.646201", "0.645995", "0.6450792", "0.64245844", "0.642367", "0.6395409", "0.6394913", "0.6374511", "0.63703805", "0.63648456", "0.6359603", "0.63261884", "0.63188076", "0.6306069", "0.63026214", "0.6301403", "0.63003224", "0.6296833", "0.628519", "0.62834525", "0.6282977", "0.6282977", "0.6282977", "0.6282977", "0.6282568", "0.62790525", "0.62790525", "0.62746584", "0.62715274", "0.62713027", "0.6271277", "0.6267648", "0.626547", "0.6256037", "0.62546486", "0.62546486", "0.6252442", "0.62521803", "0.62457716", "0.62400776", "0.6225056", "0.6224075", "0.62174475", "0.62053365", "0.6201526", "0.62007326", "0.61951673", "0.6186892", "0.61863136", "0.61863136", "0.61838835", "0.6180955", "0.61799765", "0.617375", "0.61733437", "0.61733437", "0.6171457", "0.61707544", "0.61665696", "0.6162966", "0.6158515", "0.61483544", "0.6146776", "0.6146776", "0.61460984", "0.61443543", "0.61435634", "0.6142726", "0.61426115", "0.6141229", "0.61406046", "0.61405885", "0.613564", "0.6134153", "0.6130418", "0.6122731", "0.612272", "0.6122312", "0.6119864", "0.6118916", "0.61077976", "0.61033344", "0.61032313", "0.61014766", "0.6097728", "0.6097524", "0.6096586", "0.6086487", "0.6086412" ]
0.6739188
5
Use callbacks to share common setup or constraints between actions.
def set_observation @observation = Observation.where(id: params[:id]).includes(:ice_observations).first 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 observation_params params.require(:observation).permit( :cruise_id, :observed_at, :latitude, :longitude, :uuid, :lat_minutes, :lat_seconds, :lon_minutes, :lon_seconds, :primary_observer_id_or_name, additional_observers_id_or_name: [], ship_attributes: [:id, :heading, :power, :speed, :ship_activity_lookup_id], notes_attributes: [:id, :text], ice_attributes: [:id, :total_concentration, :open_water_lookup_id, :thick_ice_lookup_id, :thin_ice_lookup_id], ice_observations_attributes: [:id, :partial_concentration, :ice_lookup_id, :thickness, :floe_size_lookup_id, :snow_lookup_id, :snow_thickness, :algae_lookup_id, :algae_density_lookup_id, :algae_location_lookup_id, :sediment_lookup_id, :obs_type, topography_attributes: [:id, :concentration, :ridge_height, :consolidated, :snow_covered, :old, :topography_lookup_id ], melt_pond_attributes: [:id, :surface_coverage, :pattern_lookup_id, :surface_lookup_id, :freeboard, :max_depth_lookup_id, :bottom_type_lookup_id, :dried_ice, :rotten_ice ] ], meteorology_attributes: [:id, :visibility_lookup_id, :weather_lookup_id, :total_cloud_cover, :wind_speed, :wind_direction, :water_temperature, :air_pressure, :air_temperature, :relative_humidity, clouds_attributes: [:id, :cloud_lookup_id, :cover, :height, :cloud_type] ], faunas_attributes: [:id, :name, :count, :_destroy], photos_attributes: [:id, :file, :on_boat_location_lookup_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 user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 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 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 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.6292164", "0.62917984", "0.62836355", "0.6242686", "0.6241917", "0.62210834", "0.6214862", "0.62125784", "0.619428", "0.617912", "0.617705", "0.61735916", "0.6163706", "0.61532795", "0.6152666", "0.6148062", "0.6123372", "0.61180484", "0.61088324", "0.6106139", "0.60925204", "0.608326", "0.60711503", "0.606551", "0.60216546", "0.6018924", "0.6015004", "0.60106766", "0.6008301", "0.6008301", "0.60028726", "0.60020626", "0.5999236", "0.59931505", "0.5993037", "0.59917194", "0.5982164", "0.5968051", "0.5960277", "0.5960268", "0.5960012", "0.59594494", "0.5954652", "0.5954304", "0.59440255", "0.59404963", "0.59404963", "0.59401006", "0.593522", "0.5932182", "0.5925528", "0.5924541", "0.5918796", "0.59123147", "0.5910144", "0.5909186", "0.5907257", "0.5899382", "0.5897783", "0.58972496", "0.58958495", "0.58948576", "0.5892734", "0.5888056", "0.58843875", "0.58818483", "0.5873746", "0.58700997", "0.5870056", "0.5869255", "0.58668107", "0.58662325", "0.5865003", "0.5862908", "0.5862406", "0.58614665", "0.5859661", "0.585562", "0.5855185", "0.58523446", "0.58504915" ]
0.0
-1