query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
GET /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 j... | [
"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.653... | 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_submitte... | [
"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.554707... | 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 ... | [
"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.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.htm... | [
"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.6364845... | 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_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def 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... | [
"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.629... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.