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 /bookcabinets GET /bookcabinets.json | def index
@bookcabinets = Bookcabinet.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cabinets(options={})\n parser.cabinets_parser(get({ path: ROUTES[:get_cabinets].call, headers: authorization_header_for_rest_api }))\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n forma... | [
"0.7108591",
"0.65429944",
"0.6479955",
"0.6412073",
"0.6344024",
"0.63288933",
"0.62921363",
"0.62691593",
"0.62605774",
"0.6242907",
"0.6206254",
"0.61970776",
"0.6153855",
"0.61435294",
"0.61379546",
"0.61225915",
"0.61205816",
"0.6109806",
"0.6103198",
"0.6103198",
"0.610... | 0.75216985 | 0 |
GET /bookcabinets/1 GET /bookcabinets/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bookcabinets = Bookcabinet.all\n end",
"def set_bookcabinet\n @bookcabinet = Bookcabinet.find(params[:id])\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # in... | [
"0.7262491",
"0.67946005",
"0.64999634",
"0.64511704",
"0.64073396",
"0.6392574",
"0.633294",
"0.6323679",
"0.6301914",
"0.62261075",
"0.6214377",
"0.6204648",
"0.61874795",
"0.6173551",
"0.6172149",
"0.6125879",
"0.6112622",
"0.60854673",
"0.6066968",
"0.60641426",
"0.605915... | 0.0 | -1 |
POST /bookcabinets POST /bookcabinets.json | def create
@bookcabinet = Bookcabinet.new(bookcabinet_params)
respond_to do |format|
if @bookcabinet.save
format.html { redirect_to @bookcabinet, notice: 'Bookcabinet was successfully created.' }
format.json { render :show, status: :created, location: @bookcabinet }
else
format.html { render :new }
format.json { render json: @bookcabinet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bookcabinets = Bookcabinet.all\n end",
"def create\n @cabinet_balancer = Balancer.new(create_params)\n\n respond_to do |format|\n if @cabinet_balancer.save\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('created') }\n format.json { render :show, statu... | [
"0.6418041",
"0.62655586",
"0.6252635",
"0.5960558",
"0.58731496",
"0.57050717",
"0.56715137",
"0.5666042",
"0.5653863",
"0.56499404",
"0.563261",
"0.5610858",
"0.55953425",
"0.55565053",
"0.554575",
"0.55383307",
"0.55328923",
"0.55287266",
"0.54824287",
"0.5477062",
"0.5465... | 0.7314254 | 0 |
PATCH/PUT /bookcabinets/1 PATCH/PUT /bookcabinets/1.json | def update
respond_to do |format|
if @bookcabinet.update(bookcabinet_params)
format.html { redirect_to @bookcabinet, notice: 'Bookcabinet was successfully updated.' }
format.json { render :show, status: :ok, location: @bookcabinet }
else
format.html { render :edit }
format.json { render json: @bookcabinet.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @cabinet = Cabinet.find(params[:id])\n\n respond_to do |format|\n if @cabinet.update_attributes(params[:cabinet])\n format.html { redirect_to @cabinet, notice: 'Cabinet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"... | [
"0.67270744",
"0.64590704",
"0.64002806",
"0.63918453",
"0.6379275",
"0.6305187",
"0.6266453",
"0.6212475",
"0.62092507",
"0.62078875",
"0.6174557",
"0.6115696",
"0.61122155",
"0.61040527",
"0.60952073",
"0.6093924",
"0.6078504",
"0.6077888",
"0.6069233",
"0.6046953",
"0.6040... | 0.73731565 | 0 |
DELETE /bookcabinets/1 DELETE /bookcabinets/1.json | def destroy
@bookcabinet.destroy
respond_to do |format|
format.html { redirect_to bookcabinets_url, notice: 'Bookcabinet was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format|\n format.html { redirect_to cabinets_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @cabinet_balancer.destroy\n respond_to do |format|\n format.html { redirect_to cabi... | [
"0.7400914",
"0.72874117",
"0.7048587",
"0.69108254",
"0.6838088",
"0.68328494",
"0.68318135",
"0.681945",
"0.68136674",
"0.68076444",
"0.6783123",
"0.6772598",
"0.6761732",
"0.6748673",
"0.6748126",
"0.67389804",
"0.6727399",
"0.6721363",
"0.6720508",
"0.67118776",
"0.668894... | 0.77007776 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bookcabinet
@bookcabinet = Bookcabinet.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def bookcabinet_params
params.require(:bookcabinet).permit(:title, :description, :price, :image, :previewo, :previewt, :previewth, :sdescription, :offerprice, :coupon, :brand, :color, :warrenty, :material)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
GET /events GET /events.json | def index
@event_tags = EventTag.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.83372355",
"0.8240056",
"0.79437226",
"0.7928057",
"0.7768322",
"0.7741097",
"0.76704425",
"0.7665877",
"0.7659134",
"0.76427555",
"0.76214844",
"0.7616007",
"0.7616007",
"0.76134557",
"0.75691116",
"0.7523018",
"0.7489189",
"0.7481164",
"0.7470412",
"0.74423337",
"0.74405... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
@event = Event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.7502569",
"0.7400972",
"0.73606694",
"0.7349199",
"0.73472464",
"0.7338071",
"0.7317574",
"0.72872615",
"0.72816217",
"0.72463787",
"0.7232033",
"0.72194093",
"0.72194093",
"0.7218932",
"0.7218932",
"0.72140914",
"0.7204847",
"0.71987826",
"0.7196607",
"0.71924305",
"0.719... | 0.0 | -1 |
POST /events POST /events.json | def create
#transform address to lat+long
address = "#{event_params[:address]} #{event_params[:state]} #{event_params[:city]} #{event_params[:zip_code]}"
coordinates = GoogleGeocoder.geocode(address)
#transform datetime_select form field to a datetime object
start_t = DateTime.new(event_params["start_time(1i)"].to_i,
event_params["start_time(2i)"].to_i,
event_params["start_time(3i)"].to_i,
event_params["start_time(4i)"].to_i,
event_params["start_time(5i)"].to_i)
end_t = DateTime.new(event_params["end_time(1i)"].to_i,
event_params["end_time(2i)"].to_i,
event_params["end_time(3i)"].to_i,
event_params["end_time(4i)"].to_i,
event_params["end_time(5i)"].to_i)
#MANUALLY add field values to event - using a Hash caused a ton of errors
@event = Event.new(title:event_params[:title],
description:event_params[:description],
event_tag_id:event_params[:event_tag_id],
address:event_params[:address],
state:event_params[:state],
city:event_params[:city],
zip_code:event_params[:zip_code],
start_time: start_t,
end_time: end_t,
longitude:coordinates.longitude,
latitude:coordinates.latitude,
person_count_cap:event_params[:person_count_cap],
user_id: current_user.id)
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render :show, status: :created, location: @event }
else
format.html { render :new }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036... | 0.0 | -1 |
PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.7530757",
"0.73730147",
"0.7177204",
"0.71724564",
"0.71712637",
"0.7143226",
"0.70965534",
"0.7083339",
"0.7083339",
"0.70583916",
"0.7021172",
"0.69903284",
"0.6983127",
"0.6978976",
"0.69609094",
"0.69550467",
"0.69550467",
"0.695262",
"0.6921984",
"0.6921984",
"0.69219... | 0.0 | -1 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.7693181",
"0.7687918",
"0.7687918",
"0.7687918",
"0.76818216",
"0.75862354",
"0.7569196",
"0.7561378",
"0.7541531",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.754035",
... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_event
@event = Event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params[:event]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /spec_days GET /spec_days.json | def index
drop_page_title("节假日管理")
drop_breadcrumb
@spec_days = SpecDay.page(params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def days\n @trainings = Training.all\n @activities = Activity... | [
"0.6544347",
"0.6360498",
"0.6283865",
"0.6110522",
"0.6039113",
"0.60186493",
"0.5948687",
"0.58675784",
"0.58654845",
"0.58526015",
"0.58448464",
"0.57884943",
"0.57425183",
"0.5737013",
"0.5714257",
"0.57127357",
"0.5701554",
"0.56900644",
"0.5675562",
"0.56480724",
"0.563... | 0.5703964 | 16 |
GET /spec_days/1 GET /spec_days/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_spec_day\n @spec_day = SpecDay.find(params[:id])\n end",
"def get(days,start_cep,end_cep)\n self.class.get(\"/api/v1/quote/available_scheduling_dates/#{days}/#{start_cep}/#{end_cep}\")\n end",
"def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |for... | [
"0.6386077",
"0.6368943",
"0.60502666",
"0.6034452",
"0.6020112",
"0.5971272",
"0.5925929",
"0.5925737",
"0.5887045",
"0.58689976",
"0.58561474",
"0.58228165",
"0.5821123",
"0.580021",
"0.57716256",
"0.57626057",
"0.5760068",
"0.57565814",
"0.57516193",
"0.572724",
"0.5689786... | 0.0 | -1 |
POST /spec_days POST /spec_days.json | def create
@spec_day = SpecDay.new(spec_day_params)
drop_page_title("新增假日")
drop_breadcrumb
respond_to do |format|
if @spec_day.save
format.html { redirect_to spec_days_path, notice: '添加成功.' }
format.json { render :show, status: :created, location: @spec_day }
else
flash.now[:alert] = @spec_day.errors.full_messages
format.html { render :new }
format.json { render json: @spec_day.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spec_day_params\n params.require(:spec_day).permit(:sdate, :is_workday, :comment)\n end",
"def create_day\n trip = Trip.find(params[:id])\n offset = 0\n trip.days.all.each do |day|\n offset += 1\n end\n @day = Day.new({\"date\" => trip.beginning + offset , \"trip\" => trip})\n ... | [
"0.6622386",
"0.61643875",
"0.5991614",
"0.5868338",
"0.5867991",
"0.58510023",
"0.5841275",
"0.5813383",
"0.5785013",
"0.5774195",
"0.5768987",
"0.57685083",
"0.5732929",
"0.5731105",
"0.57246625",
"0.57237035",
"0.5662187",
"0.5653804",
"0.56531715",
"0.56006485",
"0.557614... | 0.64547837 | 1 |
PATCH/PUT /spec_days/1 PATCH/PUT /spec_days/1.json | def update
respond_to do |format|
if @spec_day.update(spec_day_params)
format.html { redirect_to spec_days_path, notice: '更新成功!' }
format.json { render :show, status: :ok, location: @spec_day }
else
flash.now[:alert] = @spec_day.errors.full_messages
format.html { render :edit }
format.json { render json: @spec_day.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_spec_day\n @spec_day = SpecDay.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @theory_day.update(theory_day_params)\n format.html { redirect_to @theory_day, notice: 'Theory day was successfully updated.' }\n format.json { head :no_content }\n else\n... | [
"0.639359",
"0.6393343",
"0.6260495",
"0.61888325",
"0.61389995",
"0.6068621",
"0.60189945",
"0.6017492",
"0.6015559",
"0.60137457",
"0.6012616",
"0.6012469",
"0.5978826",
"0.59677416",
"0.59375495",
"0.59364533",
"0.5923533",
"0.59016186",
"0.5874358",
"0.58677036",
"0.58506... | 0.68159443 | 0 |
DELETE /spec_days/1 DELETE /spec_days/1.json | def destroy
@spec_day.destroy
respond_to do |format|
format.html { redirect_to spec_days_url, notice: 'Spec day was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @theory_day.destroy\n respond_to do |format|\n format.html { redirect_to theory_days_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @day.destroy\n respond_to do |format|\n format.html { redirect_to days_url }\n format.json { head :no_conten... | [
"0.7267308",
"0.70401174",
"0.69833386",
"0.69449836",
"0.6943419",
"0.6905456",
"0.68770975",
"0.6834322",
"0.6816724",
"0.67884284",
"0.6755453",
"0.67458296",
"0.67314875",
"0.670433",
"0.6694704",
"0.66808075",
"0.6668645",
"0.66613036",
"0.6590525",
"0.657653",
"0.657239... | 0.7520056 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_spec_day
@spec_day = SpecDay.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def spec_day_params
params.require(:spec_day).permit(:sdate, :is_workday, :comment)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
Formatting the input before parsing. | def format_input
# removing white spaces at the beginning and the end
@input_params = @input_params.downcase.strip()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_input(input)\n input\n end",
"def format(input)\n input\n end",
"def format_user_input strip = true\n format_ruby self.user_input, strip\n end",
"def format_input\n hash = IoManager.parse_layer_input(@layer)\n @layer = hash[:layer]\n hash[:input]\n end",
"def prefor... | [
"0.695289",
"0.67442787",
"0.65074617",
"0.6490917",
"0.6428663",
"0.63905275",
"0.63885814",
"0.63885814",
"0.6266271",
"0.6079631",
"0.6000088",
"0.5947683",
"0.590985",
"0.5806601",
"0.57843536",
"0.57686764",
"0.57686764",
"0.57345754",
"0.57155514",
"0.56612223",
"0.5595... | 0.69877785 | 0 |
Parsing the Input provided by the user. | def parse_input
format_input
p "Input is #{@input_params}"
#begin
# check if the input refers to an explicit datetime like today etc
if explicit_date? @input_params
interpret_explicit_date @input_params
# check if the input refers to relative input like next friday or next month etc
elsif relative_date? @input_params
interpret_relative_date @input_params
# check if the input refers to a past of future date and interpret it
elsif date = past_or_future_date(@input_params)
date
# Try Ruby Date Parser
else
DateTime.parse(@input_params)
end
#rescue
# p "Sorry!! Something went wrong. Pls. check and try again"
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(input = nil, options = 0)\n end",
"def parse_input(input)\n\tinput.split(\" \")\nend",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def process_input\n\n while movement = connection.gets.chomp\n begin\n parse movement\n end\n end... | [
"0.75142586",
"0.7148743",
"0.7101238",
"0.7101238",
"0.7041908",
"0.6933894",
"0.6929543",
"0.6862341",
"0.6709948",
"0.66297394",
"0.6546315",
"0.65462404",
"0.6533675",
"0.6503891",
"0.64498514",
"0.6397832",
"0.63900656",
"0.63724965",
"0.6361074",
"0.6354731",
"0.6266969... | 0.7257142 | 1 |
check if the input refers to an explicit datetime like today etc | def explicit_date?(date)
!(/(?<relative_date>#{EXISTING_PATTERNS[:explicit_dates]})/.match(date)).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid?\n is_valid_datetime?\n end",
"def datetime?\n !@arg[:datetimeValue].nil?\n end",
"def is_valid_datetime?\n Chronic.parse(@value.respond_to?(:to_date) ? @value.to_date : @value.to_s)\n end",
"def datetime?\n type == \"DATETIME\"\n end",
"def looks_like_date?... | [
"0.7582145",
"0.7547799",
"0.74837404",
"0.7382278",
"0.7200867",
"0.71473855",
"0.71155226",
"0.69948375",
"0.6903797",
"0.68938357",
"0.68542176",
"0.6842575",
"0.6820595",
"0.6789636",
"0.67519665",
"0.67196566",
"0.6704201",
"0.6694365",
"0.6652773",
"0.66376346",
"0.6600... | 0.6846143 | 11 |
check whether date is of the form next friday or next month etc & return boolean | def relative_date? date
all_durations = EXISTING_PATTERNS[:weekdays] + EXISTING_PATTERNS[:months] + EXISTING_PATTERNS[:durations]
!(/(#{EXISTING_PATTERNS[:relative_tense]}) (#{all_durations})/.match(date)).nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friday_13th?(year)\n fridays = 0\n 1.upto(12) do |month|\n fridays += 1 if Time.new(year, month, 13).friday?\n end\n fridays\nend",
"def vendredi_13? #methode dinstance\n Date.today.day == 13 and Date.today.friday? # on appelle methode today qui renvoie lobjet date et on compare test le jour par a... | [
"0.715703",
"0.7072465",
"0.70131654",
"0.69244814",
"0.69204575",
"0.68110454",
"0.6802554",
"0.6754775",
"0.6738453",
"0.6713178",
"0.66838896",
"0.6672247",
"0.666193",
"0.66539896",
"0.6629564",
"0.6607577",
"0.6586491",
"0.65762883",
"0.65198016",
"0.651839",
"0.6480355"... | 0.0 | -1 |
asiigning values for few explicit dates like tomorrow, yesterday etc. | def interpret_explicit_date date
case date
when 'today'
DateTime.now
when 'tomorrow'
1.days.from_now
when 'yesterday'
1.days.ago
when 'day after tomorrow'
2.days.from_now
when 'day before yesterday'
2.days.ago
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yday() end",
"def imply_dates\n return unless !@properties['end'].nil? && !@properties['start'].nil?\n\n start_date = nil\n\n @properties['start'].each do |start_val|\n if start_val =~ /^(\\d{4}-[01]\\d-[0-3]\\d)/\n start_date = Regexp.last_match(1) if start_date.nil?\n ... | [
"0.61605066",
"0.6148981",
"0.61232585",
"0.60816073",
"0.6049297",
"0.6035261",
"0.6024293",
"0.60149676",
"0.6013834",
"0.59849656",
"0.59720886",
"0.5967911",
"0.59268445",
"0.59268445",
"0.59268445",
"0.59135664",
"0.5903414",
"0.5888777",
"0.5871823",
"0.58514935",
"0.58... | 0.72308964 | 0 |
Parsing relative date like next friday or next month | def interpret_relative_date date
all_durations = EXISTING_PATTERNS[:weekdays] + EXISTING_PATTERNS[:months] + EXISTING_PATTERNS[:durations]
relative_date = /(?<tense>#{EXISTING_PATTERNS[:relative_tense]}) (?<type>#{all_durations})(\s at)*/.match(date)
# Check if the user is referring to a weekday
if weekday?(relative_date[:type])
if (relative_date[:tense] == 'next')
date_of_next(relative_date[:type])
else
date_of_previous(relative_date[:type])
end
else
tense = (relative_date[:tense] == 'next') ? 'from_now' : 'ago'
calculate_datetime(relative_date[:type], 1, tense)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_parser(date)\n date = Chronic.parse(\"#{date.downcase}\")\n while date.wday < 6\n date = date += 1 # makes start date the next saturday from the input date\n end\n return date\nend",
"def date_of_next(day)\r\n date = Date.parse(day)\r\n delta = date > Date.today ? 0 : 7\r\n date + delta\r\nen... | [
"0.68461674",
"0.66868645",
"0.65441453",
"0.6535606",
"0.64133674",
"0.63254946",
"0.6307054",
"0.6045189",
"0.5961365",
"0.59310544",
"0.5836221",
"0.57968974",
"0.57230276",
"0.5718622",
"0.5535669",
"0.5527844",
"0.5525011",
"0.55105317",
"0.5509636",
"0.5508134",
"0.5467... | 0.67182964 | 1 |
returns if its a valid day of the week | def weekday?(day)
day && (EXISTING_PATTERNS[:weekdays].split('|').include? day)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_week_of\n input_week_of = self.week_of\n # correct day, assuming input week is a Time object\n # http://ruby-doc.org/core-2.2.0/Time.html#method-i-sunday-3F\n return input_week_of.monday?\n end",
"def valid_day_of_week(str)\n n = str.kind_of?(Numeric) ? str : (DATES_M... | [
"0.8000908",
"0.79605925",
"0.78240794",
"0.77720153",
"0.77454543",
"0.76826787",
"0.76077634",
"0.74522185",
"0.7419516",
"0.7396434",
"0.7301253",
"0.72971195",
"0.7255042",
"0.71835744",
"0.71622145",
"0.7096439",
"0.7037691",
"0.70348656",
"0.70246446",
"0.70090944",
"0.... | 0.75866866 | 7 |
Return the next specific weekeday. Example: next tuesday | def date_of_next(day)
day_required = DateTime.parse(day)
delta = day_required > DateTime.now ? 0 : 7
(day_required + delta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_week_in weeks\n Week.find_by(initial_day: initial_day+( weeks * 7.days))\n end",
"def get_next_date_for_next_weekday(week_day)\n DateTime.now + days_to_add(week_day)\nend",
"def next_weekday\n if next_day.on_weekend?\n next_week(:monday, same_time: true)\n else\n next_day\... | [
"0.81187254",
"0.8087644",
"0.80599594",
"0.80599594",
"0.7970234",
"0.7939948",
"0.77549654",
"0.76833916",
"0.7677427",
"0.7677427",
"0.7548137",
"0.7423673",
"0.7420285",
"0.73533016",
"0.7308758",
"0.7257118",
"0.7257118",
"0.7249627",
"0.7168586",
"0.7151448",
"0.7139373... | 0.7297373 | 15 |
Return the previous specific weekeday. Example: previous tuesday | def date_of_previous(day)
day_required = DateTime.parse(day)
delta = day_required < DateTime.now ? 0 : 7
(day_required - delta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_week\n if self.class == Date\n self - 7\n elsif self.class == Time\n self - (60 * 60 * 24 * 7)\n end\n end",
"def previous_week\n if self.class == Date\n self - 7\n elsif self.class == Time\n self - (60 * 60 * 24 * 7)\n end\n end",
"d... | [
"0.8150084",
"0.81496894",
"0.782375",
"0.7637272",
"0.7637272",
"0.7590038",
"0.7451269",
"0.7339337",
"0.7339337",
"0.7058264",
"0.70505774",
"0.6882068",
"0.6875868",
"0.66848403",
"0.6627133",
"0.6612613",
"0.6535367",
"0.64999187",
"0.64766604",
"0.6370376",
"0.63498855"... | 0.7325221 | 9 |
Defining the DateTime object based on parameters. | def calculate_datetime(type, quantity, tense)
# converting week to days as ruby doesnt have explicit method for week.
if type.singularize == 'week'
type = 'days'
quantity = quantity * 7
end
quantity.send(type).send(tense)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_initialize_datetime_with_datetime()\n time = DateTime.new(2017, 11, 7, 17, 30, 10)\n datetime = @ad_manager.datetime(time, 'America/New_York')\n assert_equal(2017, datetime.year)\n assert_equal(11, datetime.month)\n assert_equal(7, datetime.day)\n assert_equal(17, datetime.hour)\n ass... | [
"0.66256505",
"0.6362572",
"0.63601834",
"0.6286665",
"0.6270296",
"0.6227139",
"0.6226146",
"0.6176446",
"0.61608434",
"0.61527747",
"0.6109771",
"0.6094115",
"0.6083727",
"0.6077379",
"0.6074703",
"0.6066374",
"0.6015489",
"0.6013661",
"0.59810853",
"0.59762996",
"0.5974250... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_mobject
@mobject = Mobject.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def mobject_params
params.require(:mobject).permit(:mini, :maxi, :alert, :alertlow, :sum_paufwand_ist, :sum_pkosten_ist, :sum_paufwand_plan, :sum_pkosten_plan, :risk, :quality, :costinfo, :parent, :online_pub, :eventpart, :owner_id, :owner_type, :mtype, :msubtype, :mcategory_id, :company_id, :user_id, :status, :name, :description, :reward, :interest_rate, :due_date, :date_from, :date_to, :time_from, :time_to, :days, :amount, :price, :tasks, :skills, :offers, :social, :price_reg, :price_new, :active, :signage, :keywords, :homepage, :address1, :address2, :address3, :latitude, :longitude, :geo_address, :allow, :allowdays, :sponsorenart, :sponsorenperiode, :sponsorenbetragantrag, :sponsorenbetraggenehmigt,:sponsorenantwort, :sponsorenstatus, :sponsorenok, :requester_id, :requester_type)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
GET /evaluations GET /evaluations.json | def index
# Evaluation.archive_old_eva
@evaluation = Evaluation.new
@evaluation.type = 'Course'
if params[:type].eql? 'test'
@inscriptions = Inscription.test.pendents.joins(:user).order('last_name ASC')
@schedules = Schedule.prueba
@title = "Pruebas"
@evaluation.type = 'Test'
@evaluation.start = Test.next_saturday_test
@evaluation.cost = GeneralParameter.costo_prueba.value if GeneralParameter.costo_prueba
@evaluation.schedule_id = GeneralParameter.horario_prueba.value if GeneralParameter.horario_prueba
@evaluation.location = GeneralParameter.ubicacion_prueba.value if GeneralParameter.ubicacion_prueba
begin
flash[:success] = "Creada Prueba automática" if Test.check_actives_tests
rescue Exception => e
flash[:danger] = 'No se pudo revisar la creación de Pruebas automáticas'
end
@schedules = Schedule.where(evatype: 'test')
@actives = Test.activa
elsif params[:type].eql? 'course'
@evaluation.type = 'Course'
@title = "Cursos"
@inscriptions = Inscription.course.pendents.joins(:user).order('last_name ASC')
@actives = Course.activa
@schedules = Schedule.curso
else
@title = "Evaluaciones"
@actives = Evaluation.activa
@inscriptions = Inscription.pendents.limit(50)
@schedules = Schedule.all
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def index\n @score_evaluations = ScoreEvaluation.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.j... | [
"0.7649412",
"0.7279398",
"0.72450113",
"0.7144004",
"0.7141227",
"0.70988876",
"0.7048806",
"0.702481",
"0.702481",
"0.702481",
"0.702481",
"0.702481",
"0.6986356",
"0.68509716",
"0.679744",
"0.67658156",
"0.67023426",
"0.66693366",
"0.6639267",
"0.6623286",
"0.6612441",
"... | 0.0 | -1 |
GET /evaluations/1 GET /evaluations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_eval\n\t\t@student = Student.find(params[:student_id])\n\t\t@evaluation = @student.evaluations.find(params[:eval_id])\n\t\trender json: @evaluation\n\tend",
"def show\n @evaluations = Evaluation.find(params[:id])\n end",
"def evaluations(id)\n connection.get do |req|\n req.url \"job... | [
"0.7764384",
"0.6982576",
"0.69390005",
"0.68615055",
"0.6812206",
"0.6739474",
"0.67193705",
"0.6696659",
"0.6679959",
"0.66740364",
"0.66740364",
"0.66740364",
"0.66740364",
"0.66740364",
"0.66607505",
"0.6624642",
"0.6611929",
"0.66038275",
"0.6582462",
"0.6462219",
"0.643... | 0.0 | -1 |
POST /evaluations POST /evaluations.json | def create
@evaluation = Evaluation.new(evaluation_params)
if @evaluation.save
flash[:success] = 'Evaluación creada con éxito.'
if @evaluation.is_a? Course and params[:areas]
params[:areas].each do |a|
area = Area.find a
area.inscriptions.preinscrito.each do |pr|
pr.evaluation_id = @evaluation.id
pr.save
end
@evaluation.area_courses.create(area_id: a)
end
end
else
flash[:danger] = "Error: #{@evaluation.errors.full_messages.to_sentence}"
end
redirect_back fallback_location: "#{evaluations_path}?#{@evaluation.type}=true"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @evaluations = Evaluation.new(evaluation_params)\n\n respond_to do |format|\n if @evaluation.save\n format.html { redirect_to @evaluation, notice: 'evaluation was successfully created.' }\n format.json { render :show, status: :created, location: @evaluation }\n else\n ... | [
"0.72737324",
"0.7063939",
"0.6935287",
"0.68586046",
"0.68586046",
"0.67890453",
"0.6770237",
"0.67336255",
"0.6724495",
"0.660389",
"0.6553898",
"0.65197086",
"0.6499413",
"0.6492196",
"0.6416034",
"0.64079785",
"0.6376799",
"0.63258034",
"0.63131016",
"0.63131016",
"0.6296... | 0.56909835 | 87 |
PATCH/PUT /evaluations/1 PATCH/PUT /evaluations/1.json | def update
if @evaluation.update(evaluation_params)
flash[:success] = 'Evaluación actualizada con éxito.'
else
flash[:danger] = @evaluation.errors.full_messages.to_sentence
end
redirect_back fallback_location: evaluations_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @evaluation.update(evaluation_params)\n format.html { redirect_to @evaluation, notice: 'Evaluation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render ... | [
"0.67569864",
"0.67569864",
"0.67502415",
"0.6688519",
"0.65855354",
"0.65573",
"0.6551156",
"0.6551156",
"0.6551156",
"0.65159565",
"0.65155464",
"0.6453373",
"0.6448353",
"0.64405817",
"0.6433332",
"0.642494",
"0.63654107",
"0.63291883",
"0.6310158",
"0.6297031",
"0.6281983... | 0.0 | -1 |
DELETE /evaluations/1 DELETE /evaluations/1.json | def destroy
@evaluation.area_courses.delete_all if @evaluation.is_a? Course
@evaluation.destroy
flash[:info] = "¡Evaluación Eliminada!"
redirect_back fallback_location: evaluations_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evaluation.destroy\n respond_to do |format|\n format.html { redirect_to evaluations_url }\n format.json { h... | [
"0.7423415",
"0.7423415",
"0.742291",
"0.74181527",
"0.71981627",
"0.7197589",
"0.7195351",
"0.7195351",
"0.7195351",
"0.7195351",
"0.7195351",
"0.7195351",
"0.71747017",
"0.71078193",
"0.70771676",
"0.70721006",
"0.70721006",
"0.70574003",
"0.70446515",
"0.70344424",
"0.7000... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_evaluation
@evaluation = Evaluation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def evaluation_params
# if params[:duration]
# a = DateTime.parse params[:evaluation][:start]
# params[:evaluation][:end] = (a + params[:duration].to_i.hours).to_s
# end
params.require(:evaluation).permit(:start, :title, :location, :type, :schedule_id, :cost, :status)
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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
GET /users GET /users.json | def index
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n para... | [
"0.8210063",
"0.78731877",
"0.78600395",
"0.78103924",
"0.78053653",
"0.76777875",
"0.76582843",
"0.7632195",
"0.75826395",
"0.7529077",
"0.7487757",
"0.7448671",
"0.7439283",
"0.7437491",
"0.74267244",
"0.739832",
"0.739832",
"0.739832",
"0.739832",
"0.73765147",
"0.73729014... | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
# binding.pry
if session[:user_id] && session[:user_id] == params[:id].to_i
render :show
else
redirect_to '/'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.722... | 0.0 | -1 |
POST /users POST /users.json | def create
@user = User.new(user_params)
return redirect_to controller: 'users', action: 'new' unless @user.save
session[:user_id] = @user.id
redirect_to user_path(@user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end",
"def post b... | [
"0.7717357",
"0.75198936",
"0.7383226",
"0.72406703",
"0.7197973",
"0.71413565",
"0.7104487",
"0.70593977",
"0.7042063",
"0.702464",
"0.70033044",
"0.70027703",
"0.70027703",
"0.70027703",
"0.6993518",
"0.6990875",
"0.69810915",
"0.69793195",
"0.69793195",
"0.697907",
"0.6976... | 0.0 | -1 |
PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
@user = User.find_or_create_by(name: user_params[:name])
return redirect_to controller: 'users', action: 'edit' unless @user.save
session[:user_id] = @user.id
redirect_to controller: 'users', action: 'show'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"de... | [
"0.7224859",
"0.7128554",
"0.7003616",
"0.690352",
"0.6821481",
"0.68151546",
"0.6708411",
"0.6692893",
"0.6680146",
"0.66730475",
"0.66725844",
"0.66651213",
"0.66651213",
"0.66596603",
"0.66596603",
"0.6655346",
"0.6648638",
"0.66431737",
"0.66419953",
"0.6634677",
"0.66177... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user.destroy
redirect_to controller: 'users', action: 'index'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.7874973",
"0.7751847",
"0.7714271",
"0.76097655",
"0.747189",
"0.74068373",
"0.74068373",
"0.73683155",
"0.73451865",
"0.73396176",
"0.73275775",
"0.73089314",
"0.73086506",
"0.7305896",
"0.7296799",
"0.72913444",
"0.7290504",
"0.7287776",
"0.7283143",
"0.7249658",
"0.7249... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:name, :password, :nausea, :happiness, :tickets, :height, :admin)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. Only allow a list of trusted parameters through. | def product_params
params.require(:product).permit(:title, :body_html, :image, :price, :product_type, :compare_at_price, :cost, :sku, :barcode,:tracked, :available,:quantity, :incoming, :continue_selling, :weight, :weight_unit, :countries, :inventory_quantity, :inventory_item_id, :inventory_management, :inventory_policy, :requires_shipping, :fulfillment_service, :location_id, :location, :vendor)
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 set_caller_params\n end",
"def define_action_hook; end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def revisable_shared_s... | [
"0.611595",
"0.57441926",
"0.55911624",
"0.5579766",
"0.549979",
"0.5476848",
"0.547398",
"0.54669726",
"0.5455354",
"0.54442745",
"0.54322463",
"0.5386561",
"0.53851956",
"0.5339095",
"0.5320896",
"0.5320896",
"0.5320896",
"0.53074646",
"0.52857226",
"0.528263",
"0.5277717",... | 0.0 | -1 |
Get corporation names Resolve a set of corporation IDs to corporation names Alternate route: `/v1/corporations/names/` Alternate route: `/legacy/corporations/names/` Alternate route: `/latest/corporations/names/` This route is cached for up to 3600 seconds | def get_corporation_name(corporation_ids, opts = {})
data, _status_code, _headers = get_corporation_name_with_http_info(corporation_ids, opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_corporation_name_with_http_info(corporation_ids, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CorporationApi.get_corporation_name ...\"\n end\n # verify the required parameter 'corporation_ids' is set\n fail ArgumentError, \"Missin... | [
"0.7345886",
"0.64161575",
"0.5992575",
"0.5964687",
"0.5964687",
"0.5945636",
"0.57545125",
"0.5738085",
"0.5710203",
"0.5639791",
"0.56281257",
"0.5619155",
"0.5612144",
"0.55748045",
"0.5549823",
"0.54978704",
"0.54765004",
"0.5470295",
"0.54540014",
"0.5437592",
"0.543186... | 0.6256072 | 2 |
Get corporation names Resolve a set of corporation IDs to corporation names Alternate route: &x60;/v1/corporations/names/&x60; Alternate route: &x60;/legacy/corporations/names/&x60; Alternate route: &x60;/latest/corporations/names/&x60; This route is cached for up to 3600 seconds | def get_corporation_name_with_http_info(corporation_ids, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CorporationApi.get_corporation_name ..."
end
# verify the required parameter 'corporation_ids' is set
fail ArgumentError, "Missing the required parameter 'corporation_ids' when calling CorporationApi.get_corporation_name" if corporation_ids.nil?
if corporation_ids.length < 1
fail ArgumentError, 'invalid value for "corporation_ids" when calling CorporationApi.get_corporation_name, number of items must be greater than or equal to 1.'
end
if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])
fail ArgumentError, 'invalid value for "datasource", must be one of tranquility, singularity'
end
# resource path
local_var_path = "/corporations/names/".sub('{format}','json')
# query parameters
query_params = {}
query_params[:'corporation_ids'] = @api_client.build_collection_param(corporation_ids, :csv)
query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?
query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<CorporationName>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CorporationApi#get_corporation_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def corporate_names\n @mods_ng_xml.corporate_name.map { |n| n.display_value }\n end",
"def get_corporation_name(corporation_ids, opts = {})\n data, _status_code, _headers = get_corporation_name_with_http_info(corporation_ids, opts)\n return data\n end",
"def corporate_creators\n no_ne... | [
"0.6760638",
"0.60503185",
"0.60161847",
"0.59790355",
"0.59790355",
"0.5949987",
"0.56727624",
"0.5668674",
"0.56436527",
"0.5591587",
"0.5504108",
"0.5500671",
"0.5470629",
"0.5451568",
"0.54446715",
"0.54126847",
"0.5409498",
"0.5395128",
"0.5394417",
"0.539394",
"0.537221... | 0.7221406 | 0 |
Get npc corporations Get a list of npc corporations Alternate route: `/v1/corporations/npccorps/` Alternate route: `/legacy/corporations/npccorps/` Alternate route: `/latest/corporations/npccorps/` This route is cached for up to 3600 seconds | def get_npc_corporations(opts = {})
data, _status_code, _headers = get_npc_corporations_with_http_info(opts)
return data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_npc_corporations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CorporationApi.get_npc_corporations ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail Argumen... | [
"0.7300747",
"0.66853875",
"0.66853875",
"0.59336364",
"0.5533607",
"0.5521799",
"0.5504551",
"0.5363465",
"0.53227586",
"0.53137976",
"0.5294964",
"0.5266",
"0.5259308",
"0.5242024",
"0.5239831",
"0.5228648",
"0.51429397",
"0.51400274",
"0.5130385",
"0.50769365",
"0.5075414"... | 0.75346833 | 0 |
Get npc corporations Get a list of npc corporations Alternate route: &x60;/v1/corporations/npccorps/&x60; Alternate route: &x60;/legacy/corporations/npccorps/&x60; Alternate route: &x60;/latest/corporations/npccorps/&x60; This route is cached for up to 3600 seconds | def get_npc_corporations_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug "Calling API: CorporationApi.get_npc_corporations ..."
end
if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])
fail ArgumentError, 'invalid value for "datasource", must be one of tranquility, singularity'
end
# resource path
local_var_path = "/corporations/npccorps/".sub('{format}','json')
# query parameters
query_params = {}
query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?
query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].nil?
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Array<Integer>')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: CorporationApi#get_npc_corporations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_npc_corporations(opts = {})\n data, _status_code, _headers = get_npc_corporations_with_http_info(opts)\n return data\n end",
"def index\n @corps = Corp.all\n end",
"def index\n @corps = Corp.all\n end",
"def index\n @corporacions = Corporacion.all\n end",
"def get_informati... | [
"0.742545",
"0.61799985",
"0.61799985",
"0.53990334",
"0.53620183",
"0.5351893",
"0.52145064",
"0.51955116",
"0.5151902",
"0.5098881",
"0.50917274",
"0.5077627",
"0.50520736",
"0.5035101",
"0.50084937",
"0.49652618",
"0.49454734",
"0.49164337",
"0.4900136",
"0.48938558",
"0.4... | 0.7072492 | 1 |
See build_conditions under Searchgasm::ActiveRecord::Base. This is the same thing but for associations. | def build_conditions(options = {}, &block)
conditions = @reflection.klass.build_conditions(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = params.dup\n\n query_params.reject! do |k, v|\n !model_fields.keys.include?(k.to_sym) &&\n !model_relationships.keys.include?(k.to_sym) &&\n !(k.to_sym == :search)\n ... | [
"0.74005914",
"0.74005914",
"0.7372377",
"0.71886903",
"0.71886903",
"0.71315485",
"0.70743316",
"0.6907021",
"0.68919474",
"0.6756634",
"0.67438096",
"0.67438096",
"0.6737634",
"0.6723184",
"0.6690625",
"0.6674562",
"0.66729206",
"0.66682065",
"0.66652936",
"0.66634303",
"0.... | 0.7186232 | 5 |
See build_conditions! under Searchgasm::ActiveRecord::Base. This is the same thing but for associations. | def build_conditions!(options = {}, &block)
conditions = @reflection.klass.build_conditions!(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = params.dup\n\n query_params.reject! do |k, v|\n !model_fields.keys.include?(k.to_sym) &&\n !model_relationships.keys.include?(k.to_sym) &&\n !(k.to_sym == :search)\n ... | [
"0.7323187",
"0.7323187",
"0.7157187",
"0.7145472",
"0.70500267",
"0.70500267",
"0.7031196",
"0.6952399",
"0.6842647",
"0.67627805",
"0.67627805",
"0.67448145",
"0.6735609",
"0.6734633",
"0.6733645",
"0.6730002",
"0.6702199",
"0.67009246",
"0.6680433",
"0.66450894",
"0.664508... | 0.7365326 | 0 |
See build_search under Searchgasm::ActiveRecord::Base. This is the same thing but for associations. | def build_search(options = {}, &block)
conditions = @reflection.klass.build_search(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_associations_for_searches\n # Advanced search fields\n @master.pro_infos.build\n @master.player_infos.build\n @master.addresses.build\n @master.player_contacts.build\n @master.trackers.build\n @master.tracker_histories.build\n @master.scantrons.build if @master.res... | [
"0.7089912",
"0.6724027",
"0.6367913",
"0.62693596",
"0.61857677",
"0.61621195",
"0.6107245",
"0.60974634",
"0.60910493",
"0.6053855",
"0.60460675",
"0.6039332",
"0.60102123",
"0.5997802",
"0.5987308",
"0.5965927",
"0.59485507",
"0.5938869",
"0.5932589",
"0.59117526",
"0.5907... | 0.64836735 | 2 |
See build_conditions! under Searchgasm::ActiveRecord::Base. This is the same thing but for associations. | def build_search!(options = {}, &block)
conditions = @reflection.klass.build_search!(options, &block)
conditions.scope = scope(:find)[:conditions]
conditions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_conditions!(options = {}, &block)\n conditions = @reflection.klass.build_conditions!(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = ... | [
"0.7366908",
"0.73250157",
"0.73250157",
"0.71586156",
"0.71461505",
"0.7052348",
"0.7052348",
"0.70325106",
"0.69535184",
"0.684287",
"0.67627513",
"0.67627513",
"0.67449737",
"0.67362",
"0.6734693",
"0.67346853",
"0.6703982",
"0.67000884",
"0.6681032",
"0.66456515",
"0.6645... | 0.6729107 | 16 |
GET /quests GET /quests.json | def index
@title = "All quests"
@categories = find_all_categories
@active_quests = Quest.where("start <= ? AND enddate >= ?", Date.today, Date.today)
@upcoming_quests = Quest.where("start > ?", Date.today)
@completed_quests = Quest.where("enddate < ?", Date.today)
sort_upcoming = "start ASC, Joiners_count DESC"
sort_active = "start DESC, Joiners_count DESC"
sort_completed = "start DESC, Joiners_count DESC"
if (!params[:quest].blank?)
if (!params[:quest][:sort].blank?)
@selected_sort = params[:quest][:sort]
if (@selected_sort == "2")
sort_upcoming = "Joiners_count DESC, start ASC"
sort_active = "Joiners_count DESC, start DESC"
sort_completed = "Joiners_count DESC, start DESC"
end
end
end
@active_quests = @active_quests.order(sort_active)
@upcoming_quests = @upcoming_quests.order(sort_upcoming)
@completed_quests = @completed_quests.order(sort_completed)
if (!params[:search].blank?)
@active_quests = @active_quests.search(params[:search])
@upcoming_quests = @upcoming_quests.search(params[:search])
@completed_quests = @completed_quests.search(params[:search])
end
if (!params[:quest].blank?)
if (!params[:quest][:category].blank?)
@selected_category = params[:quest][:category]
@active_quests = @active_quests.search_by_category(@selected_category)
@upcoming_quests = @upcoming_quests.search_by_category(@selected_category)
@completed_quests = @completed_quests.search_by_category(@selected_category)
end
end
@active_quests_size = @active_quests.size
@upcoming_quests_size = @upcoming_quests.size
@completed_quests_size = @completed_quests.size
@active_quests = @active_quests.paginate(:page => params[:apage], :per_page => 5)
@upcoming_quests = @upcoming_quests.paginate(:page => params[:upage], :per_page => 5)
@completed_quests = @completed_quests.paginate(:page => params[:cpage], :per_page => 5)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @quests }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def get_all\n\t\trender json: {quests: Quest.all.as_json(include: :images)}\n\tend",
"def index\n @quests = Quest.all\n end",
"def ... | [
"0.68585455",
"0.68206483",
"0.6779325",
"0.6779325",
"0.66884506",
"0.6500263",
"0.64827764",
"0.6456038",
"0.645227",
"0.64367706",
"0.6409376",
"0.6207272",
"0.6165179",
"0.61303896",
"0.6129801",
"0.61246645",
"0.6080638",
"0.6005601",
"0.5999599",
"0.59911287",
"0.597996... | 0.0 | -1 |
GET /quests/1 GET /quests/1.json | def show
@quest = Quest.find(params[:id])
@comments = @quest.comments.paginate(:page => params[:page], :per_page => 5)
@users = @quest.joiners.paginate(:page => params[:page])
@status = get_status(@quest)
@length = (@quest.enddate - @quest.start).to_i + 1
@launchdays = (Date.today - @quest.start).to_i
@creator = @quest.user_id ? User.find(@quest.user_id) : User.find(1)
@category = @quest.category_id ? Category.find(@quest.category_id) : Category.find(1)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @quest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f... | [
"0.76056147",
"0.7118397",
"0.70763475",
"0.69822156",
"0.69306135",
"0.6844869",
"0.6844869",
"0.68218243",
"0.67399603",
"0.6685072",
"0.6570278",
"0.6555295",
"0.65247333",
"0.65208167",
"0.65208167",
"0.65208167",
"0.65208167",
"0.6479781",
"0.64224666",
"0.6421584",
"0.6... | 0.61382484 | 30 |
GET /quests/new GET /quests/new.json | def new
@quest = Quest.new
@categories = find_all_categories
respond_to do |format|
format.html # new.html.erb
format.json { render json: @quest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutor... | [
"0.81241924",
"0.7668481",
"0.762495",
"0.7385807",
"0.7374465",
"0.7305892",
"0.72783524",
"0.7170316",
"0.70900637",
"0.6974153",
"0.6968612",
"0.6941386",
"0.6873848",
"0.6799914",
"0.6766904",
"0.6763151",
"0.6728878",
"0.6728878",
"0.6728878",
"0.6728878",
"0.6728878",
... | 0.7666286 | 2 |
POST /quests POST /quests.json | def create
@quest = Quest.new(params[:quest])
@categories = find_all_categories
respond_to do |format|
if @quest.save
current_user.join!(@quest)
format.html { redirect_to @quest, notice: 'Quest was successfully created.' }
format.json { render json: @quest, status: :created, location: @quest }
else
format.html { render action: "new" }
format.json { render json: @quest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @quest = Quest.new(quest_params)\n respond_to do |format|\n if @quest.save\n format.html { redirect_to @quest, notice: 'Quest was successfully created.' }\n format.json { render :show, status: :created, location: @quest }\n else\n format.html { render :new }\n ... | [
"0.6727865",
"0.6721418",
"0.6709919",
"0.65502864",
"0.648252",
"0.6439615",
"0.6386107",
"0.6346671",
"0.6341171",
"0.6269725",
"0.61612374",
"0.6094985",
"0.6072719",
"0.5889624",
"0.5876326",
"0.5876326",
"0.5876326",
"0.5876326",
"0.5845286",
"0.5845286",
"0.582747",
"... | 0.6310279 | 9 |
PUT /quests/1 PUT /quests/1.json | def update
@quest = Quest.find(params[:id])
respond_to do |format|
if @quest.update_attributes(params[:quest])
format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @quest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @quest.update(quest_params)\n format.html { redirect_to @quest, notice: 'Quest was successfully updated.' }\n format.json { render :show, status: :ok, location: @quest }\n else\n format.html { render :edit }\n format.json { render js... | [
"0.7338439",
"0.7034341",
"0.70259273",
"0.6819567",
"0.6819567",
"0.6819567",
"0.6819567",
"0.6806069",
"0.67867976",
"0.6472856",
"0.64431816",
"0.6355782",
"0.62796694",
"0.6259594",
"0.6242032",
"0.6237354",
"0.62054425",
"0.6193595",
"0.6145441",
"0.6140577",
"0.61163825... | 0.7403956 | 0 |
DELETE /quests/1 DELETE /quests/1.json | def destroy
@quest = Quest.find(params[:id])
@quest.destroy
respond_to do |format|
format.html { redirect_to quests_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n return\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to(q... | [
"0.76820177",
"0.76167643",
"0.75861734",
"0.7548189",
"0.7470491",
"0.73915195",
"0.71756953",
"0.7087538",
"0.70439684",
"0.70075136",
"0.69989276",
"0.6955528",
"0.6927387",
"0.6911211",
"0.6885517",
"0.6781852",
"0.67719716",
"0.67398393",
"0.67302847",
"0.6724551",
"0.67... | 0.7821818 | 0 |
GET /cnics GET /cnics.json | def index
@cnics = Cnic.where(:user_id => current_user)
@acnics = Cnic.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cicts = Cict.all\n end",
"def get_nics(token, nics_url)\n nic_ids = Array.new \n endpoint = nics_url.scan(/\\/organizations.*nics/)\n resp_hash = get_url(token, endpoint[0], {})\n resp_hash[:embedded][:nics].each do |nic|\n nic_ids.push extract_id(nic[:_links][:self][:href], '... | [
"0.63690716",
"0.6321942",
"0.6280151",
"0.6169747",
"0.6132222",
"0.61106133",
"0.6108408",
"0.6089801",
"0.60603666",
"0.60488355",
"0.60176533",
"0.6011997",
"0.6005791",
"0.60029745",
"0.5966159",
"0.5940293",
"0.5936983",
"0.5921057",
"0.5916324",
"0.58874714",
"0.586379... | 0.65606993 | 0 |
GET /cnics/1 GET /cnics/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cnics = Cnic.where(:user_id => current_user)\n @acnics = Cnic.all\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end",
"def index\n @cicts = Cict.all\n end",
... | [
"0.6619694",
"0.64096147",
"0.63549304",
"0.6335126",
"0.62836015",
"0.62400764",
"0.6223573",
"0.6193492",
"0.61763763",
"0.6117035",
"0.609827",
"0.6068496",
"0.6045725",
"0.6045725",
"0.6009848",
"0.5998414",
"0.59736854",
"0.59223837",
"0.59045964",
"0.58923566",
"0.58816... | 0.0 | -1 |
POST /cnics POST /cnics.json | def create
@cnic = Cnic.new(cnic_params)
@cnic.user = current_user
@cnic.save
redirect_to new_appointment_path and return
respond_to do |format|
if @cnic.save
format.html { redirect_to @cnic, notice: 'Cnic was successfully created.' }
format.json { render :show, status: :created, location: @cnic }
else
format.html { render :new }
format.json { render json: @cnic.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.... | [
"0.62915516",
"0.6116649",
"0.6107641",
"0.58364236",
"0.5827522",
"0.5772316",
"0.5768057",
"0.5694698",
"0.55751395",
"0.5566364",
"0.55645",
"0.5510801",
"0.550428",
"0.55016714",
"0.5499066",
"0.5495314",
"0.54625887",
"0.5434742",
"0.54286367",
"0.54184324",
"0.5404335",... | 0.55498827 | 11 |
PATCH/PUT /cnics/1 PATCH/PUT /cnics/1.json | def update
respond_to do |format|
if @cnic.update(cnic_params)
format.html { redirect_to @cnic, notice: 'Cnic was successfully updated.' }
format.json { render :show, status: :ok, location: @cnic }
else
format.html { render :edit }
format.json { render json: @cnic.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entit... | [
"0.6842568",
"0.6352238",
"0.6221623",
"0.61904025",
"0.6154375",
"0.6095869",
"0.60798156",
"0.59681314",
"0.59650314",
"0.5938245",
"0.5893941",
"0.58777034",
"0.58655447",
"0.5854788",
"0.5847111",
"0.5846859",
"0.58383155",
"0.58288634",
"0.5828638",
"0.58122605",
"0.5811... | 0.5833987 | 17 |
DELETE /cnics/1 DELETE /cnics/1.json | def destroy
@cnic.destroy
respond_to do |format|
format.html { redirect_to cnics_url, notice: 'Cnic was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @csosn = Csosn.find(params[... | [
"0.6989057",
"0.6926576",
"0.6835398",
"0.679587",
"0.6760288",
"0.6598962",
"0.6588034",
"0.6570351",
"0.65667766",
"0.65503705",
"0.65437436",
"0.65290326",
"0.6518379",
"0.65172315",
"0.6488542",
"0.6487112",
"0.6480404",
"0.64638656",
"0.646351",
"0.646351",
"0.646205",
... | 0.67962646 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_cnic
@cnic = Cnic.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def cnic_params
params.require(:cnic).permit(:full_name, :father_name, :gender, :country_of_stay, :b_form, :current_address, :permanent_address, :dob, :image, :sign, :expiry_date, :issue_date)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
GET /transactions GET /transactions.json | def index
if current_user.is_admin?
@transactions = Transaction.order('created_at DESC')
else
@transactions = current_user.transactions.order('created_at DESC')
end
@transactions = @transactions.page(params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transactions\n JSON.parse(response.body).fetch('transactions')\n end",
"def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end",
"def index\n @transactions = Transaction.all\n render json: @transactions\n end",
"def all_transactions\n json_respo... | [
"0.8164624",
"0.796332",
"0.77854896",
"0.7751081",
"0.7728147",
"0.7706774",
"0.7691088",
"0.7651612",
"0.7590682",
"0.7567767",
"0.7548055",
"0.751779",
"0.75108814",
"0.745996",
"0.745996",
"0.745996",
"0.73983127",
"0.7326831",
"0.7299761",
"0.7288485",
"0.7288485",
"0.... | 0.0 | -1 |
POST /transactions POST /transactions.json | def create
@transaction = Transaction.new(transaction_params)
respond_to do |format|
if @transaction.save
format.html { redirect_to transactions_path,
notice: 'Transaction was successfully created.' }
format.json { render :show, status: :created, location: @transaction }
else
@users = User.order(:name)
format.html { render :new }
format.json { render json: @transaction.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/js... | [
"0.71249044",
"0.71086043",
"0.71076274",
"0.70617485",
"0.69709885",
"0.69397956",
"0.6880664",
"0.6874014",
"0.6864833",
"0.6838009",
"0.68287945",
"0.67914796",
"0.6790471",
"0.6740941",
"0.67209196",
"0.67054206",
"0.6681679",
"0.667744",
"0.6675303",
"0.6651673",
"0.6649... | 0.6797416 | 11 |
Never trust parameters from the scary internet, only allow the white list through. | def transaction_params
params.require(:transaction).permit(:value, :user_id, :details, :date, :kind)
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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
General handler utility functions This is a template method that is used to escape results values (returned in execute) that would cause the XML to be invalid. This method is not necessary if values do not contain character that have special meaning in XML (&, ", ), however it is a good practice to use it for all return variable results in case the value could include one of those characters in the future. This method can be copied and reused between handlers. | def escape(string)
# Globally replace characters based on the ESCAPE_CHARACTERS constant
string.to_s.gsub(/[&"><]/) { |special| ESCAPE_CHARACTERS[special] } if string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml_escape(input); end",
"def escape_xml(value)\n value.to_s.gsub(/[&<>\"']/) { |s| ESCAPE_TABLE[s] } # or /[&<>\"']/\n end",
"def xml_escape(input)\n return input.to_s.to_xs\n end",
"def escape(val)\n return val\n end",
"def escape_xml(string) \n string.gsub(/... | [
"0.65849704",
"0.630052",
"0.61448634",
"0.60994136",
"0.60151446",
"0.5980982",
"0.591022",
"0.5875001",
"0.5798485",
"0.57609296",
"0.5635574",
"0.56347525",
"0.56261474",
"0.5520064",
"0.55147004",
"0.5498493",
"0.5495008",
"0.5470674",
"0.5468405",
"0.5448469",
"0.5440953... | 0.0 | -1 |
This is the same as the V1 UI as there is currently no V2 UI for creating these as of 20141114 | def create_non_rewarded_currency
visit "#{TestChamber.target_url}/dashboard/apps/#{id}/non_rewarded"
# if the #terms_of_service checkbox isn't there, that indicates the non_rewarded
# currency is already there.
if el = first("#terms_of_service")
el.click
find_button("Setup").click
end
page.find('#currency_submit').trigger('click')
Util.wait_for do
page.find('.tapjoy-enabled').text == "Enabled"
end
page.find(:xpath,"//div[@id='help_nonreward_currency_id']/../../td").text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def custom; end",
"def custom; end",
"def extra; end",
"def operations; end",
"def operations; end",
"def overrides; end",
"def notations; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def apis; end",
"def vi... | [
"0.63987285",
"0.5708909",
"0.5708909",
"0.5510623",
"0.5504342",
"0.5504342",
"0.54612553",
"0.5433546",
"0.54241884",
"0.54241884",
"0.54241884",
"0.54241884",
"0.54212815",
"0.53546864",
"0.5340306",
"0.53275245",
"0.5296224",
"0.5296224",
"0.5296224",
"0.5296224",
"0.5287... | 0.0 | -1 |
Add the newly created app to the network specified in the constuctor's `apps_network_id` | def add_to_apps_network
raise "This method can only be called if apps_network_id is set" unless apps_network_id
visit "#{TestChamber.target_url}/dashboard/tools/apps_network_association/#{apps_network_id}"
fill_in('app_ids', :with => id)
click_button('Add')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_apps_network\n visit \"#{TestChamber.target_url}/dashboard/tools/apps_network_association/#{apps_network_id}\"\n fill_in('app_ids', :with => id)\n click_button('Add')\n end",
"def add_org_network_to_vapp(vAppId, network, config)\n network_section = generate_network_secti... | [
"0.79311866",
"0.7049813",
"0.65384936",
"0.6154877",
"0.5947169",
"0.5939809",
"0.59197056",
"0.5761461",
"0.5675872",
"0.5651866",
"0.5650596",
"0.56400466",
"0.55818063",
"0.5579447",
"0.5569646",
"0.55316436",
"0.5510121",
"0.55060536",
"0.5484938",
"0.54418576",
"0.54222... | 0.814103 | 0 |
add "unique" flag to dns class | def unique_add(str)
tmp = str.dup
tmp[0] |= 0x80
return tmp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allows_unique?\n true\n end",
"def unique=(val)\n self['unique'] = val\n end",
"def create_unique_key\n begin\n self.unique_key = UrlShort.generate_key\n rescue ActiveRecord::RecordNotUnique\n if (count +=1) < 5\n retry\n else\n raise\n end\n end\n end... | [
"0.6692375",
"0.6325159",
"0.59675103",
"0.5958234",
"0.59482044",
"0.5915001",
"0.58913493",
"0.57756567",
"0.5717708",
"0.5702637",
"0.5699096",
"0.56811947",
"0.5613946",
"0.560433",
"0.5593377",
"0.5577339",
"0.55681694",
"0.5545394",
"0.55422413",
"0.55364335",
"0.550619... | 0.5081551 | 73 |
GET /groups/1 GET /groups/1.xml | def show
@group = Group.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html { @groups = Group.get_groups(current_user, params) }\n format.xml { render :xml => Group.get_groups(params.merge({:show => 'all'})) }\n end\n end",
"def index\n respond_to do |format|\n format.html { @groups = Group.get_groups(current_use... | [
"0.7457283",
"0.7457283",
"0.73482746",
"0.7278812",
"0.7278812",
"0.7197596",
"0.7168496",
"0.7168496",
"0.70996237",
"0.7044914",
"0.7025066",
"0.69451755",
"0.6944729",
"0.69393563",
"0.6914174",
"0.68582296",
"0.6830637",
"0.678068",
"0.6772312",
"0.6768116",
"0.67527604"... | 0.701914 | 15 |
GET /groups/new GET /groups/new.xml | def new
@group = Group.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n for... | [
"0.7769969",
"0.76758593",
"0.76745856",
"0.7673317",
"0.7649658",
"0.7647979",
"0.7647979",
"0.76447934",
"0.75070655",
"0.7494794",
"0.7486221",
"0.7481707",
"0.74618113",
"0.73941106",
"0.7377087",
"0.733064",
"0.72883546",
"0.72883546",
"0.72852725",
"0.7256639",
"0.72036... | 0.7768821 | 9 |
POST /groups POST /groups.xml | def create
@group = Group.new(params[:group])
respond_to do |format|
if @group.save
flash[:notice] = 'Group was successfully created.'
format.html { redirect_to(@group) }
format.xml { render :xml => @group, :status => :created, :location => @group }
else
format.html { render :action => "new" }
format.xml { render :xml => @group.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(groups)\n groups_params = groups.inject({}) do |params, (k, v)|\n params[\"groups[#{k}]\"] = 1\n params\n end\n\n response = RouteNGN.put self.class.base_url, {:id => self.id}.merge!(groups_params)\n response.success?\n end",
"def create\n #logger.info \"Post parameters... | [
"0.66096884",
"0.6603057",
"0.6587717",
"0.6587717",
"0.65674216",
"0.6546595",
"0.65186745",
"0.6396171",
"0.6392499",
"0.6381925",
"0.6381592",
"0.6364457",
"0.6355767",
"0.63219523",
"0.62973297",
"0.6214118",
"0.61912113",
"0.6169199",
"0.6165479",
"0.6152969",
"0.614973"... | 0.6354073 | 15 |
PUT /groups/1 PUT /groups/1.xml | def update
@group = Group.find(params[:id])
respond_to do |format|
if @group.update_attributes(params[:group])
flash[:notice] = 'Group was successfully updated.'
format.html { redirect_to(@group) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @group.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n \n @group = Group.find(... | [
"0.66876763",
"0.66732633",
"0.6664911",
"0.6664911",
"0.664609",
"0.65764666",
"0.65686107",
"0.6565995",
"0.65658015",
"0.654173",
"0.654013",
"0.65170485",
"0.6508561",
"0.64685065",
"0.6427705",
"0.6407432",
"0.6386747",
"0.6365301",
"0.63293046",
"0.63178754",
"0.6314402... | 0.6640589 | 10 |
DELETE /groups/1 DELETE /groups/1.xml | def destroy
@group = Group.find(params[:id])
@group.destroy
respond_to do |format|
format.html { redirect_to(groups_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Group.destroy(params[:id])\n\n respond_to do ... | [
"0.7521533",
"0.746793",
"0.7415357",
"0.7415357",
"0.7407291",
"0.7387372",
"0.7369884",
"0.7268451",
"0.72525096",
"0.72365737",
"0.71849257",
"0.71665525",
"0.7165238",
"0.7137553",
"0.7118781",
"0.71096253",
"0.7081424",
"0.705098",
"0.70239425",
"0.7017666",
"0.6985274",... | 0.73832047 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_anneeacademique
@anneeacademique = Anneeacademique.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def anneeacademique_params
params.require(:anneeacademique).permit(:libelle, :date_debut, :date_fin, :deleted_at, :statut)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69480115",
"0.6813417",
"0.68023044",
"0.67950493",
"0.67457634",
"0.6741017",
"0.65274155",
"0.6519536",
"0.6491671",
"0.64317423",
"0.64317423",
"0.64317423",
"0.63975054",
"0.6354703",
"0.63543284",
"0.6346128",
"0.63437325",
"0.63382536",
"0.6327421",
"0.6327421",
"0.6... | 0.0 | -1 |
Method one, that in hindsight is a bit unneccessary | def create
@plant = Plant.find(params[:plant_id])
tags = Tag.where(id: params[:plant_tag][:tag])
valid_tag = true
tags.each do |t|
@plant_tag = PlantTag.new
@plant_tag.plant = @plant
@plant_tag.tag = t
if !@plant_tag.save
valid_tag = false
end
end
if valid_tag
redirect_to garden_path(@plant.garden)
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def anchored; end",
"def suivre; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def terpene; end",
"def offences_by; end",
"def same; end",
"def silly_adjective; end",
"def ignores; end",
"d... | [
"0.67964077",
"0.66630846",
"0.6523675",
"0.64435434",
"0.6340853",
"0.6305209",
"0.6305209",
"0.6305209",
"0.6305209",
"0.6250753",
"0.6066955",
"0.6049437",
"0.5973079",
"0.5972231",
"0.59508437",
"0.59508437",
"0.592753",
"0.5903142",
"0.5841411",
"0.58245057",
"0.580907",... | 0.0 | -1 |
Method two, that in hindsight is cleaner | def create
@plant = Plant.find(params[:plant_id])
if params[:plant_tag][:tag].present?
tags = Tag.where(id: params[:plant_tag][:tag])
tags.each do |t|
@plant_tag = PlantTag.new
@plant_tag.plant = @plant
@plant_tag.tag = t
@plant_tag.save
end
redirect_to garden_path(@plant.garden)
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def anchored; end",
"def suivre; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def terpene; end",
"def same; end",
"def romeo_and_juliet; end",
"def custom; end",
"def... | [
"0.6679041",
"0.64631355",
"0.63532215",
"0.6352915",
"0.6210829",
"0.6046807",
"0.6046807",
"0.6046807",
"0.6046807",
"0.6038776",
"0.59946483",
"0.597999",
"0.58278996",
"0.58254105",
"0.58254105",
"0.5822386",
"0.58062327",
"0.58054537",
"0.5783167",
"0.5760615",
"0.576042... | 0.0 | -1 |
Method to add an item to a list < 2 input: item name, optional quantity, method 1 list steps: determine a key as grocery item and it's value as quantity output: updated grocery list with added grocery item and quantity | def add_item(grocery_list, item, quantity)
grocery_list = grocery_list.each {|item,quantity|}
if grocery_list.has_key?(item)
grocery_list[item] += quantity
else
grocery_list[item] = quantity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_grocery_list(grocery_list, item_name, quantity=1)\n # steps: add item to hash and set quantity\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend",
"def add_an_item(grocery_list, new_item, qty = 1)\n grocery_list[new_item] = qty\n grocery_lis... | [
"0.8896291",
"0.88281286",
"0.8781556",
"0.8781306",
"0.8760608",
"0.8703942",
"0.8643402",
"0.8627308",
"0.8627308",
"0.8602139",
"0.8594602",
"0.85648936",
"0.8563449",
"0.8560357",
"0.8528791",
"0.84864795",
"0.84864795",
"0.8460906",
"0.8456081",
"0.845207",
"0.84513307",... | 0.8389671 | 25 |
Method to remove an item from the list <3 input: item name, quantity, method 2 list steps: search for the item (key) in the method 2 list IF found in list, remove output: Updated grocery list without item/quantity | def delete_item(grocery_list, item)
grocery_list.delete(item)
p grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend",
"def remove_an_item(grocery_list, item_to_be_removed)\n grocery_list.delete(item_to_be_removed)\n grocery_list\nend",
"def remove_item(grocery_list, item)\n groce... | [
"0.81733215",
"0.8140092",
"0.8079578",
"0.8079578",
"0.8055786",
"0.8003192",
"0.8003192",
"0.8003192",
"0.79764134",
"0.7975644",
"0.7966086",
"0.79475224",
"0.79475224",
"0.7923051",
"0.79120725",
"0.79120725",
"0.78954923",
"0.78858",
"0.7881904",
"0.78466123",
"0.7845658... | 0.73041433 | 58 |
Returns the output path of a page. | def path
@pathname.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_path\n return @render_path.dup unless @page_url.nil?\n generate_file_name()\n @render_path.dup\n end",
"def path\n @global_page.path\n end",
"def path\n raise NotImplementedError, \"implement me to support page.visit, e.g. '/relatve_URI_of_this_pa... | [
"0.7042236",
"0.693861",
"0.69313836",
"0.68563795",
"0.67611754",
"0.67356765",
"0.6733617",
"0.6655248",
"0.66539454",
"0.65541124",
"0.6538002",
"0.6503058",
"0.6477547",
"0.6471481",
"0.6457247",
"0.6443035",
"0.6416141",
"0.6415091",
"0.6405474",
"0.6384091",
"0.6352365"... | 0.59579384 | 56 |
Initialize a new movie object by its IMDb ID as a string movie = Spotlite::Movie.new("0133093") Spotlite::Movie class objects are lazy loading. No HTTP request will be performed upon object initialization. HTTP request will be performed once when you use a method that needs remote data Currently, all data is spead across 5 pages: main movie page, /releaseinfo, /fullcredits, /keywords, and /trivia | def initialize(imdb_id)
@imdb_id = imdb_id
@url = "http://www.imdb.com/name/nm#{imdb_id}/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(id, movie_id)\n @id = id\n @movie_id = movie_id\n @url = \"http://www.kinopoisk.ru/film/#{movie_id}/video/#{id}/\"\n @title = title\n end",
"def initialize(imdb_id, title = nil, year = nil)\n @imdb_id = \"%07d\" % imdb_id.to_i\n @title = title\n @yea... | [
"0.76884156",
"0.7514893",
"0.70999336",
"0.6759917",
"0.6705169",
"0.6668525",
"0.65979576",
"0.6584183",
"0.6553626",
"0.64484495",
"0.6442769",
"0.640398",
"0.6403728",
"0.63887584",
"0.632292",
"0.6290795",
"0.6273201",
"0.6273201",
"0.62371016",
"0.6229483",
"0.61936593"... | 0.76098794 | 1 |
Returns title as a string | def title
@title ||= details.at("h1.header").text.strip rescue nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n title.to_s\n end",
"def to_s\n title.to_s\n end",
"def to_s\n title\n end",
"def to_string\n title\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def ... | [
"0.83769834",
"0.83769834",
"0.8343592",
"0.82908154",
"0.82772416",
"0.82772416",
"0.82772416",
"0.82440525",
"0.8223567",
"0.82124746",
"0.82096565",
"0.82066",
"0.82066",
"0.82066",
"0.8196205",
"0.8164626",
"0.8146691",
"0.8135149",
"0.8135149",
"0.81237245",
"0.81162256"... | 0.0 | -1 |
GET /players GET /players.json | def index
@players = Player.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n player = Player.all\n render json: players, status: 200\n end",
"def index\n @players = Player.all\n render json: @players, status: 200\n end",
"def index\n @players = Player.all\n render json: @players\n end",
"def index\n @players = Player.all\n\n respond_to do |forma... | [
"0.79156584",
"0.79113954",
"0.78345305",
"0.77007717",
"0.76846415",
"0.7469328",
"0.74054956",
"0.7394884",
"0.7312477",
"0.72557384",
"0.72332716",
"0.71793514",
"0.7175857",
"0.71708554",
"0.71468437",
"0.71468437",
"0.71468437",
"0.71468437",
"0.71468437",
"0.711006",
"0... | 0.694039 | 45 |
GET /players/1 GET /players/1.json | def show
@player = Player.find params[:id]
@clubs = Club.all
@matches =[]
@matches_first = Match.where('winner_id = ? OR loser_id = ?', @player.id, @player.id)
@matches = @matches_first.where(:winner_games.nil? == false)
# @matches = @matches.sort_by(:date, value) { |match| match.date }
# @matches = []
# @matches_won = Match.where(:winner_id => @player.id)
# @matches_lost = Match.where(:loser_id => @player.id)
# @matches << @matches_won << @matches_lost
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @players = Player.all\n render json: @players, status: 200\n end",
"def index\n player = Player.all\n render json: players, status: 200\n end",
"def show\n @player = Player.find(params[:id])\n\n render :json => @player\n end",
"def index\n @players = Player.all\n render... | [
"0.7674457",
"0.7652058",
"0.7611544",
"0.7583079",
"0.7523494",
"0.7508564",
"0.74019736",
"0.74019736",
"0.74019736",
"0.74019736",
"0.74019736",
"0.73785496",
"0.7310287",
"0.72753274",
"0.7247365",
"0.72356427",
"0.72171664",
"0.7207992",
"0.7114986",
"0.7079196",
"0.7054... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_player
@player = Player.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163927",
"0.6046165",
"0.59465253",
"0.59167755",
"0.58904207",
"0.58346355",
"0.577713",
"0.5703502",
"0.5703502",
"0.56531286",
"0.56215113",
"0.54224145",
"0.5410795",
"0.5410795",
"0.5410795",
"0.53924775",
"0.5379919",
"0.53580743",
"0.53401667",
"0.53397506",
"0.533... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def player_params
params.require(:player).permit(:name, :email, :avatar, :id, :player_num, :club_id, :password, :password_confirmation)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Creates a new finder. | def initialize(ts_server, domain)
set_tuple_space_server(ts_server)
@domain = domain
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(name, *args)\n dyna = DynamicFinder.new(name, *args)\n finder, conditions = dyna.finder, dyna.conditions\n results = find(finder, :conditions => conditions)\n results ? results : dyna.create(self)\n end",
"def finder(criteria)\n @finder = criteria\n end",
"def ... | [
"0.67096317",
"0.6593098",
"0.5988831",
"0.596849",
"0.5772858",
"0.57706535",
"0.5769942",
"0.57630134",
"0.5693658",
"0.5655452",
"0.5654408",
"0.5489712",
"0.545101",
"0.5419916",
"0.5318936",
"0.5287335",
"0.52765554",
"0.5229582",
"0.521177",
"0.5197366",
"0.5190481",
... | 0.0 | -1 |
Find tuple combinations by data expressions from tuple space server. | def find(type, exprs, vtable)
raise ArgumentError.new(vtable) unless vtable.kind_of?(VariableTable)
# variable table
new_vtable = VariableTable.new(vtable)
case type
when :input
# alias for I
new_vtable.set(Variable.new("INPUT"), Variable.new("I"))
when :output
# alias for O
new_vtable.set(Variable.new("OUTPUT"), Variable.new("O"))
end
find_rec(type, exprs, 1, new_vtable)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tuples(params = {})\r\n quantity = calculate_quantity(params[:quantity])\r\n read_tuples(params)\r\n @log.info(\"Found #{@tuples.size} tuples.\")\r\n if @tuples.size > -1 then\r\n @tuples[0..quantity].each do |tuple|\r\n if params[:hostnames]\r\n filter_tuple_... | [
"0.60893714",
"0.5971104",
"0.5955331",
"0.5955331",
"0.56652814",
"0.5628342",
"0.5483311",
"0.5449716",
"0.54224247",
"0.5375437",
"0.5247361",
"0.5235718",
"0.5229466",
"0.512948",
"0.50943464",
"0.5031804",
"0.50105184",
"0.50077444",
"0.49824208",
"0.49656698",
"0.496564... | 0.0 | -1 |
Finds all data tuples by the expression from a tuple space server. | def find_by_expr(expr)
expr = DataExpr.new(expr) if expr.kind_of?(String)
query = Tuple[:data].new(name: expr, domain: @domain)
return tuple_space_server.read_all(query)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tuples(params = {})\r\n quantity = calculate_quantity(params[:quantity])\r\n read_tuples(params)\r\n @log.info(\"Found #{@tuples.size} tuples.\")\r\n if @tuples.size > -1 then\r\n @tuples[0..quantity].each do |tuple|\r\n if params[:hostnames]\r\n filter_tuple_... | [
"0.63766766",
"0.5889708",
"0.5864308",
"0.581746",
"0.5432735",
"0.5410982",
"0.5266047",
"0.5234067",
"0.5234067",
"0.5151738",
"0.51435757",
"0.513364",
"0.5087321",
"0.5032423",
"0.50163114",
"0.4961705",
"0.49601376",
"0.49530652",
"0.49364763",
"0.48884067",
"0.48783466... | 0.67748624 | 0 |
Find input tuple combinatioins recursively. | def find_rec(type, exprs, index, vtable)
# return empty when we reach the recuirsion end
return [DataFinderResult.new([], vtable)] if exprs.empty?
# expand variables and compile to regular expression
head = exprs.first.eval(vtable)
tail = exprs.drop(1)
# find an input data by name from tuple space server
tuples = find_by_expr(head)
# make combination results
prefix = (type == :input ? "I" : "O")
if head.all?
# case all modifier
new_vtable =
make_auto_variables_by_all(prefix, head, tuples, vtable)
unless tuples.empty?
return find_rec_sub(type, tail, index, tuples, new_vtable)
end
else
# case each modifier
return tuples.map {|tuple|
args = [prefix, head, tuple, vtable, index]
new_vtable = make_auto_variables_by_each(*args)
find_rec_sub(type, tail, index, tuple, new_vtable)
}.flatten
end
# available combinations were not found
return []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_solution(possibilities, *rest)\n return [possibilities.first] if rest.empty?\n\n possibilities.each do |inst|\n copy = rest.map(&:clone)\n\n copy.each { |instrs| instrs.delete(inst) }\n\n codes = [inst].concat(find_solution(*copy))\n\n return codes if codes.none?(&:nil?)\n end\n\n [nil]\ne... | [
"0.54426026",
"0.53148496",
"0.5268816",
"0.5257261",
"0.52366316",
"0.5230987",
"0.51367664",
"0.50943863",
"0.5039688",
"0.50358623",
"0.5001254",
"0.49990276",
"0.49487942",
"0.49342763",
"0.49202323",
"0.49032903",
"0.48603782",
"0.4854803",
"0.4851185",
"0.48511446",
"0.... | 0.5169744 | 6 |
Make autovariables by the name modified 'all'. | def make_auto_variables_by_all(prefix, expr, tuples, vtable)
# create new table
new_vtable = VariableTable.new(vtable)
# variable
var = Variable.new(prefix)
# setup rule-io list
list = new_vtable.get(var)
list = RuleIOList.new unless list
io_list = RuleIOList.new
new_vtable.set!(var, list.add(io_list))
# convert each tuples
tuples.each do |tuple, i|
elt = RuleIOElement.new(PioneString.new(tuple.name))
elt.uri = PioneString.new(tuple.uri)
elt.match = PioneList.new(
*expr.match(tuple.name).to_a.map{|m| PioneString.new(m)}
)
io_list.add!(elt)
end
return new_vtable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_all **kwargs\n kwargs.each { |name, value|\n set_var(name.to_s, value)\n }\n end",
"def make_io_auto_variables_by_all(type, prefix, expr, tuples)\n # FIXME: output\n return if type == :output\n\n # variable\n var = Variable.new(prefix)\n\n # setup rule-io list... | [
"0.6496851",
"0.59189755",
"0.58618116",
"0.57091296",
"0.56582755",
"0.5604722",
"0.55666065",
"0.5403853",
"0.5362389",
"0.534852",
"0.53386086",
"0.52969587",
"0.5283335",
"0.52751005",
"0.527423",
"0.5255648",
"0.5255648",
"0.5255648",
"0.5255648",
"0.5255648",
"0.5255648... | 0.61557996 | 1 |
Make autovariables by the name modified 'each'. | def make_auto_variables_by_each(prefix, expr, tuple, vtable, index)
# create new table
new_vtable = VariableTable.new(vtable)
# variable
var = Variable.new(prefix)
# matched data
md = expr.match(tuple.name).to_a
# setup rule-io list
list = new_vtable.get(var)
list = RuleIOList.new unless list
elt = RuleIOElement.new(PioneString.new(tuple.name))
elt.uri = PioneString.new(tuple.uri)
elt.match = PioneList.new(*md.map{|d| PioneString.new(d)})
new_vtable.set!(var, list.add(elt))
# set special variable if index equals 1
if prefix == 'I' && index == 1
new_vtable.set(Variable.new("*"), PioneString.new(md[1]))
end
return new_vtable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_variable()\n @var_set.values.each { |var| yield(var) }\n end",
"def make_io_auto_variables_by_each(prefix, expr, tuple, index)\n return if tuple.nil?\n # variable\n var = Variable.new(prefix)\n # matched data\n md = expr.match(tuple.name).to_a\n\n # setup rule-io list\n... | [
"0.6219421",
"0.6143329",
"0.614127",
"0.6016598",
"0.5942083",
"0.5937597",
"0.5937597",
"0.59173894",
"0.55437934",
"0.55224156",
"0.5453362",
"0.53609556",
"0.53577983",
"0.5329961",
"0.53237885",
"0.53140396",
"0.53127736",
"0.52967036",
"0.5294175",
"0.5294175",
"0.52832... | 0.6364429 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.