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 |
|---|---|---|---|---|---|---|
Iterates over every element in the collection and calls the block with an instance obtained calling the factory method. The factory method should be implemented by subclasses of PoolCollection | def each(&block)
@data.each { |pelem|
block.call self.factory(@session, pelem)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n @wrapped_collection.each { |member| block.call(@klass.new(member, @context)) }\n end",
"def each_pool\n return enum_for(__method__) unless block_given?\n @pool.each { |_, pool| yield pool }\n end",
"def each(&block)\n if block_given?\n ForkJoinPool.new.invoke(Itera... | [
"0.73428434",
"0.7074579",
"0.67370886",
"0.6692379",
"0.66373587",
"0.663381",
"0.65542465",
"0.6484912",
"0.64779305",
"0.63322324",
"0.6305246",
"0.6257942",
"0.6254976",
"0.6187783",
"0.60987717",
"0.6021459",
"0.6021459",
"0.596405",
"0.5951903",
"0.5940854",
"0.5940416"... | 0.60807675 | 15 |
Return the instance obtained calling the factory method of the element in the given index. The factory method should be implemented by subclasses of PoolCollection | def [](index)
# TODO Handle exception if the index is out of bound
self.factory(@session, @data[index])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](idx)\n self.class.new super\n end",
"def from_index(index)\n self.class.from_index(index)\n end",
"def get_index(index)\n return self.at(index)\n end",
"def [](index)\n @model_class.send(:instantiate, @cursor[index].to_ar_hash)\n end",
"def [](idx)\r\n to_a[idx] || element_c... | [
"0.6808642",
"0.6578473",
"0.6386631",
"0.6366075",
"0.630889",
"0.6187956",
"0.6181718",
"0.6135656",
"0.60933757",
"0.60753024",
"0.60713834",
"0.60679036",
"0.5979836",
"0.5911147",
"0.5875202",
"0.58538985",
"0.5852838",
"0.5839747",
"0.5811985",
"0.5810482",
"0.5772087",... | 0.63306946 | 4 |
Forgets a persistent session. def forget(user) user.forget cookies.delete(:user_id) cookies.delete(:remember_token) end Logs out the current user. | def log_out
forget(current_user)
session.delete(:user_id)
@current_user = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget (user)\n user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget(user)\n user.forget\n cookies.delete(:user_id)\n cookies... | [
"0.9252601",
"0.9232922",
"0.9220021",
"0.9219706",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
"0.92184615",
... | 0.0 | -1 |
Remembers a user in a persistent session. | def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end",
"def change_password\n @user = User.find_by_id(session[:remember_token])\n end",
"def log_in_user!(user)\n session[:session_token] = ... | [
"0.6756274",
"0.6643963",
"0.6311661",
"0.6311661",
"0.6282292",
"0.6236429",
"0.6200759",
"0.6200759",
"0.6180203",
"0.6180168",
"0.61691266",
"0.61579084",
"0.61385846",
"0.61253554",
"0.61195314",
"0.60906595",
"0.6069288",
"0.6063457",
"0.60607594",
"0.60518014",
"0.60494... | 0.5917629 | 70 |
Returns the current loggedin user (if any). def current_user | def signed_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n @current_user if logged_in?\n end",
"def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n ... | [
"0.89950716",
"0.89950716",
"0.8952277",
"0.8908331",
"0.8861863",
"0.8831171",
"0.88192016",
"0.88192016",
"0.8809397",
"0.8809397",
"0.8801622",
"0.8788534",
"0.87736213",
"0.8765679",
"0.87598276",
"0.8742005",
"0.8727968",
"0.87263536",
"0.8721302",
"0.87144554",
"0.87106... | 0.0 | -1 |
Returns true if the user is logged in, false otherwise. | def logged_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r... | [
"0.90820295",
"0.87625194",
"0.8754586",
"0.8717396",
"0.86882013",
"0.86488444",
"0.86449414",
"0.86363584",
"0.8630011",
"0.8626397",
"0.8626397",
"0.858086",
"0.8565111",
"0.8559381",
"0.8559381",
"0.8549472",
"0.8547544",
"0.85425085",
"0.8539451",
"0.85383666",
"0.851565... | 0.0 | -1 |
validate that the rectangle command has the necessary parameters Params: | def validate_rectangule(command)
if command.size == 5
if @drawing_tool.painter.canvas_exist == true
@drawing_tool.painter.new_rectangule(command)
else
puts 'no canvas has been created'
end
else
puts 'missing arguments for this command:'
puts 'R [x1][y1][x2][y2]'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def validate\n valid... | [
"0.709151",
"0.6689326",
"0.6675113",
"0.66623265",
"0.6648969",
"0.6608778",
"0.6523687",
"0.64216167",
"0.6210206",
"0.61646247",
"0.61527556",
"0.61435866",
"0.61313874",
"0.6093442",
"0.6093442",
"0.60522735",
"0.6040615",
"0.59918547",
"0.59867615",
"0.5982652",
"0.59114... | 0.79302037 | 0 |
GET /events GET /events.json | def index
@current_user=current_user
buddies = Buddy.where(:user => current_user)
@events = []
#add buddied pets
pets = []
buddies.each do |buddy|
pets += [buddy.register]
end
pets.each do |pet|
@events += pet.events
end
@events += current_user.events
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.83374274",
"0.8239167",
"0.7943348",
"0.79285383",
"0.77672863",
"0.7741231",
"0.767051",
"0.7665724",
"0.765855",
"0.7642782",
"0.7621404",
"0.7615919",
"0.7615919",
"0.7612841",
"0.75691104",
"0.7522856",
"0.74889225",
"0.74821275",
"0.7470079",
"0.74419075",
"0.7440349"... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
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.75027657",
"0.7400539",
"0.7360897",
"0.7348184",
"0.7346945",
"0.7336607",
"0.73168355",
"0.7287131",
"0.7280633",
"0.7245571",
"0.72305113",
"0.72188705",
"0.72188705",
"0.7218353",
"0.7218353",
"0.72150075",
"0.72042197",
"0.7198604",
"0.7196775",
"0.71922696",
"0.71919... | 0.0 | -1 |
POST /events POST /events.json | def create
#creating new event with parameters
@event = Event.new(event_params)
#set the new event's current user and register
@event.User= current_user
@event.Register = Register.where(:name => @event.pet_name).first
# Start of the addition of records to food table
#counters= starting/ending dates.
#time is the dy and time for feeding to happen.
counter = @event.starts_at
counter2= @event.ends_at
time = @event.time
while counter<=counter2 do
counter=counter+1.day
time =time+1.day
amount_inbowl= @event.amount
ate_random= Random.rand(amount_inbowl)
left = amount_inbowl-ate_random
Food.create(:Register => Register.where(:name =>
@event.pet_name).first, :weight => amount_inbowl, :User => @event.User ,:date => counter,
:ate => ate_random, :leftovers => left, :time => time)
end
# end of adding records to food table , Karim Farid.
#Check conditions for creating events
buddy_pet = Buddy.where(:user => current_user, :register => @event.Register).first
if !editing_destroying_filter_condition then
flash[:notice] = "Check pet's name is correct or you can create events for this pet!"
redirect_to new_event_path
else
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
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.7530572",
"0.7372185",
"0.7176736",
"0.71718925",
"0.7170657",
"0.71421736",
"0.70964724",
"0.70826703",
"0.70826703",
"0.7057757",
"0.7020474",
"0.69892836",
"0.6982003",
"0.69780517",
"0.69597894",
"0.695393",
"0.695393",
"0.6951616",
"0.6921028",
"0.6921028",
"0.6921028... | 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 deleted.' }
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.7693224",
"0.76886576",
"0.76886576",
"0.76886576",
"0.7681075",
"0.7586044",
"0.7569",
"0.7561319",
"0.7541495",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7541186",
"0.7540414",
"... | 0.73361975 | 88 |
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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
find the current user's pet. | def pet
current_user.registers.find_by name: @event.pet_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pet\n @pet = current_user.pets.find(params[:id])\n end",
"def current_poet\n Poet.find_by(id: session[:user_id])\n end",
"def set_user_pet\n @user_pet = UserPet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find_by_id(params[:id]) || Pet.find_by(name: params[:search_query... | [
"0.7257758",
"0.69890344",
"0.69475734",
"0.6631307",
"0.6489425",
"0.6488103",
"0.64471835",
"0.6416743",
"0.6375749",
"0.6352011",
"0.63470936",
"0.6343452",
"0.6283378",
"0.6264878",
"0.6215299",
"0.6207989",
"0.61914",
"0.6186527",
"0.61364883",
"0.61325055",
"0.6121434",... | 0.77955025 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params.require(:event).permit(:pet_name, :amount, :starts_at, :ends_at, :time)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289... | 0.0 | -1 |
condition for creating, editing, destroying privilages. | def editing_destroying_filter_condition
buddy_pet = Buddy.where(:user => current_user, :register => @event.Register).first
((!@event.Register.nil? && @event.Register.User == current_user) || (!buddy_pet.nil? && buddy_pet.can_schedule))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permitted?; end",
"def create?\n @current_user.permission('Bid', :clerk)\n end",
"def put_can_create?\n false\n end",
"def can_destroy? user\n self.un_submit? and user.person==self.person\n end",
"def can_edit\n producer.admin?(user) || group_admin?\n end",
"def can_des... | [
"0.66528875",
"0.6462354",
"0.64532983",
"0.64038527",
"0.6397447",
"0.6326881",
"0.62941253",
"0.629344",
"0.6265116",
"0.62566596",
"0.62420607",
"0.62340254",
"0.62340254",
"0.62340254",
"0.62340254",
"0.618461",
"0.61804456",
"0.6167035",
"0.6161301",
"0.6161017",
"0.6147... | 0.609196 | 34 |
filter for creating, editing and destroying | def editing_destroying_filter
unless editing_destroying_filter_condition
flash[:notice] = "You're not authorized to edit or delete!"
redirect_to events_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter\n end",
"def filter\n super\n end",
"def filters\n end",
"def filters; end",
"def filters; end",
"def destroy_filter\n not actuale?\n end",
"def filter(options={})\n super\n end",
"def filters\n [\n [\"Id\", \"id\"],\n [\"Added By\", \"cre... | [
"0.6643153",
"0.6589274",
"0.65296906",
"0.6472652",
"0.6472652",
"0.6192152",
"0.61384386",
"0.6123383",
"0.6048902",
"0.6048902",
"0.6048902",
"0.6036455",
"0.5999356",
"0.59461135",
"0.59461135",
"0.5912195",
"0.5888386",
"0.588031",
"0.5863743",
"0.5859606",
"0.5857915",
... | 0.656373 | 2 |
list all books GET /books new%20york%20times%20bestseller%20 | def index
base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'
and_key = '&key='
key = ENV['GOOGLE_BOOKS_API_KEY']
googleurl = base_url + and_key + key
response = RestClient.get(googleurl)
@books = JSON.parse(response)
respond_to do |format|
format.html
format.json { render json: @books }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end",
"def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{t... | [
"0.6574737",
"0.6512965",
"0.6406941",
"0.6403643",
"0.639265",
"0.6378496",
"0.63364017",
"0.62823755",
"0.628039",
"0.62725616",
"0.6264768",
"0.6233181",
"0.6230956",
"0.6225182",
"0.62113553",
"0.61759335",
"0.60934335",
"0.60906374",
"0.60858744",
"0.60771304",
"0.603962... | 0.6440141 | 2 |
show a single book GET /books/:id | def show
@book = Book.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @book = Book.where(id: params[:id]).first\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book = Book.find(params[:id])\n end",
"def show\n @book... | [
"0.8860182",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.87956494",
"0.868795",
"0.8587743",
"0.85245574",
"0.84266007",
"0.83051723",
"0.8207208",
"0.8133303",
"0.8118453",
"0.81122506",
"0.81122506",
"0.8024711",
"0.8024711",
"0.80... | 0.86197567 | 9 |
new book creation form GET /books/new | def new
@book = Book.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t@book = Book.new\n\tend",
"def new\n @book = Book.new\n end",
"def new\n @book = Book.new\n end",
"def create\n\t@book = Book.new(book_params)\n\tif @book.save\n\t\tredirect_to root_path\n\telse\n\t\trender 'new'\n\tend\nend",
"def new\n @book = Book.new\n end",
"def n... | [
"0.8106571",
"0.80645764",
"0.80645764",
"0.80461204",
"0.796564",
"0.7950408",
"0.7909847",
"0.7909847",
"0.78766656",
"0.78507346",
"0.7844588",
"0.7816297",
"0.7811607",
"0.7789207",
"0.778869",
"0.77886724",
"0.7776589",
"0.77749383",
"0.7739362",
"0.7725305",
"0.7725305"... | 0.80287987 | 10 |
edit book form GET /books/:id/edit | def edit
@book = Book.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @book = Book.find(params[:id])\n end",
"def edit\n @book = Book.find(params[:id])\n end",
"def edit \n @book = Book.find params[:id]\n end",
"def edit\n\t\t@book = Book.find(params[:id])\n\tend",
"def edit\n\n\t \t@book = Book.find(params[:id])\n\n\t \t# check quy... | [
"0.8895451",
"0.8895451",
"0.8878588",
"0.88532704",
"0.84685713",
"0.8055678",
"0.7769998",
"0.75619185",
"0.7511897",
"0.74881977",
"0.7444019",
"0.7432385",
"0.7426125",
"0.73585135",
"0.7344598",
"0.7344273",
"0.7324524",
"0.73114526",
"0.73114526",
"0.73114526",
"0.73099... | 0.8858947 | 5 |
create a new book POST /books | def create
@book = Book.new(book_params)
@book.save
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @book = Book.create( params[:book] )\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to books_path, notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render ... | [
"0.838368",
"0.8304108",
"0.82515216",
"0.82497156",
"0.81905425",
"0.81901467",
"0.81901467",
"0.81901467",
"0.81901467",
"0.81901467",
"0.81868017",
"0.81836116",
"0.8183202",
"0.81655633",
"0.8095692",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"0.80904466",
"... | 0.8001763 | 37 |
update an existing book PUT /books/:id | def update
@book = Book.find(params[:id])
@book.update(book_params)
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t@book = Book.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book.update_attributes(params[:book])\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t... | [
"0.83026975",
"0.80287564",
"0.801523",
"0.800828",
"0.7988397",
"0.79877347",
"0.7982169",
"0.7956935",
"0.792501",
"0.7908734",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79071456",
"0.79035634",
"0.788... | 0.8020123 | 2 |
destroy an existing book DELETE /books/:id | def destroy
@book = Book.find(params[:id])
@book.destroy
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @book = Book.where(id: params[:id]).first\n @book.destroy\n redirect_to books_path\n end",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n redirect_to books_path\n end",
"def delete\n\t\tBook.find(params[:id]).destroy\n\t\tflash[:success] = \"Delete... | [
"0.8693791",
"0.86770105",
"0.85342723",
"0.8418383",
"0.8411704",
"0.8406299",
"0.83924395",
"0.83873576",
"0.8375257",
"0.8348966",
"0.83411103",
"0.8285003",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088",
"0.8246088"... | 0.8648044 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_other_spiritual_association
@other_spiritual_association = OtherSpiritualAssociation.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def other_spiritual_association_params
params.require(:other_spiritual_association).permit(:organization_name, :association_description, :associated_since_year, :associated_since_month, :duration_of_practice, :sadhak_profile_id)
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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
photos, videos ready KEY = "watsan" photos, videos ready KEY = "security" photos done?, videos ready KEY = "health" photos done, videos ready | def parse_osm
db = OSM::Database.new
parser = OSM::StreamParser.new(:filename => "kibera." + KEY + ".osm", :db => db)
result = parser.parse
db.nodes.each do |key,node|
if node.tags['media:video_device_number'] and node.tags['media:video_number']
video_numbers = node.tags['media:video_number'].split(",")
video_numbers.each do |video_number|
check_and_upload(node.id, node.tags['media:video_device_number'], video_number, node.lat, node.lon, node.name, 'video')
end
end
if node.tags['media:camera_device_number'] and node.tags['media:camera_number']
camera_numbers = node.tags['media:camera_number'].split(",")
camera_numbers.each do |camera_number|
check_and_upload(node.id, node.tags['media:camera_device_number'], camera_number, node.lat, node.lon, node.name, 'camera')
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', reso... | [
"0.5565192",
"0.55613613",
"0.5416615",
"0.53767014",
"0.5350997",
"0.5274317",
"0.52551365",
"0.51702744",
"0.51373285",
"0.5135509",
"0.5084113",
"0.50449467",
"0.5039869",
"0.5034121",
"0.5017879",
"0.50122094",
"0.49931175",
"0.4991815",
"0.49832252",
"0.49827278",
"0.496... | 0.0 | -1 |
required params: comment, receiver, message | def came_comment
@user = @receiver
link = "/#{@comment.commentable_type.downcase.pluralize}/#{@comment.commentable.id}"
@notification = @user.notifications.find_by(link: link) || @user.notifications.find_by(link: "#{link}#latest-comment")
mail to: @user.email, subject: "[FBC] #{@message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_comment(msg)\n end",
"def comment_received(comment)\n# @greeting = \"Hi\"\n @comment = comment\n\n mail :to => \"sandorafoods@gmail.com\"\n end",
"def item_comment(comment, recipient)\n @comment = comment\n @recipient = recipient\n @commentable = comment.commentable\n mail(:to =... | [
"0.71924114",
"0.66960216",
"0.66581726",
"0.6657399",
"0.6440642",
"0.6408755",
"0.6408182",
"0.63921463",
"0.6360294",
"0.6352635",
"0.6345036",
"0.63407266",
"0.631793",
"0.6309358",
"0.6280826",
"0.6258344",
"0.6235866",
"0.6221849",
"0.62119275",
"0.6200361",
"0.6176798"... | 0.6423564 | 5 |
required params: mentionable, receiver | def mentioned
@user = @receiver
@notification = @user.notifications.find_by(link: @mentionable.path)
subject = "[FBC] #{@mentionable.where_mention}で#{@mentionable.sender.login_name}さんからメンションがありました。"
mail to: @user.email, subject: subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_on_mention?; true; end",
"def act_as_mentioner\n include Mentioner\n end",
"def act_as_mentionee\n include Mentionee\n end",
"def on_mention(&block)\n on(:message) do |data|\n debug on_message: data, bot_message: bot_message?(data)\n if !bot_message?(data) &&\n ... | [
"0.7169113",
"0.6805239",
"0.6700532",
"0.62538296",
"0.62462676",
"0.61716443",
"0.61335725",
"0.6038367",
"0.60210955",
"0.6016014",
"0.5931311",
"0.5910494",
"0.5908463",
"0.5868737",
"0.5831521",
"0.5759242",
"0.57286364",
"0.57264876",
"0.57258904",
"0.57204026",
"0.5717... | 0.61298054 | 7 |
required params: sender, receiver | def retired
@user = @receiver
@notification = @user.notifications.find_by(link: "/users/#{@sender.id}")
subject = "[FBC] #{@sender.login_name}さんが退会しました。"
mail to: @user.email, subject: subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receiver; end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def receive_sender sender\n true\n end",
"def recei... | [
"0.7184803",
"0.7184803",
"0.7184803",
"0.7184803",
"0.7184803",
"0.7184803",
"0.71230376",
"0.71230376",
"0.71230376",
"0.6720115",
"0.659095",
"0.65649134",
"0.6417476",
"0.63461334",
"0.63454366",
"0.6289759",
"0.62462395",
"0.62462395",
"0.6230798",
"0.62252563",
"0.62252... | 0.0 | -1 |
required params: report, receiver | def trainee_report
@user = @receiver
@notification = @user.notifications.find_by(link: "/reports/#{@report.id}")
subject = "[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!"
mail to: @user.email, subject: subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def set_report\n end",
"def report\n\t\tend",
"def report\n \n end",
"def reporters=(_arg0); end",
"def reporters=(_arg0); end",
"def reporters=(_arg0); end",
"def reporters; end",
"def repor... | [
"0.70696",
"0.70696",
"0.70696",
"0.70696",
"0.70696",
"0.7007387",
"0.6845081",
"0.6829718",
"0.6791534",
"0.6791534",
"0.6791534",
"0.6751425",
"0.6751425",
"0.6751425",
"0.6751425",
"0.6751425",
"0.6536971",
"0.6527513",
"0.6499747",
"0.6464912",
"0.63922167",
"0.6387477... | 0.6133842 | 34 |
required params: page, receiver | def create_page
@user = @receiver
@notification = @user.notifications.find_by(link: "/pages/#{@page.id}")
subject = "[FBC] #{@page.user.login_name}さんがDocsに#{@page.title}を投稿しました。"
mail to: @user.email, subject: subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page\n\n end",
"def associate_page(page); end",
"def page; self end",
"def c... | [
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.676579",
"0.6654932",
"0.65445954",
"0.64180005",
"0.6279172",
"0.6262774",
"0.62622637",
"0.61906886",
"0.61666644",
"0.61596036",
"0.6157... | 0.5832806 | 38 |
the array of belongs to objects | def allergens_ingredients
Allergen.all.select {|allergen| allergen.ingredient == self}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def associations; end",
"def belongs_to_relations(ar_instance)\n\t\t\tcolumns = ar_instance.class.column_names\n\t\t\tparents = columns.map{ |c| c if c =~ /_id/ }.reject{ |c| c.nil? }\n\t\t\tparents.map!{ |parents| parents.gsub('_id', '') }\n\t\tend",
"def related_objects\n related_objects = Array.new\n\n\t... | [
"0.68250304",
"0.6669817",
"0.6374036",
"0.62789476",
"0.6277494",
"0.6233238",
"0.62074",
"0.6190507",
"0.61620516",
"0.6148181",
"0.6104842",
"0.6104842",
"0.60979056",
"0.6097364",
"0.6094322",
"0.60826516",
"0.6065605",
"0.6056623",
"0.60421115",
"0.6033996",
"0.60241854"... | 0.0 | -1 |
Set topic exchange_name and binding_keys this worker is bound to. | def pre_initialize(**opts)
@topic_name = opts[:topic_name]
@binding_keys = Array(opts[:binding_keys])
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_queue_to_exchange_routing_keys\n binding_keys.each do |key|\n queue.bind(exchange, routing_key: key)\n end\n end",
"def bind(exchange, binding_key, arguments: {})\n @client.exchange_bind(@name, exchange, binding_key, arguments: arguments)\n self\n end",
"... | [
"0.6957795",
"0.6675856",
"0.5977839",
"0.5796765",
"0.57783437",
"0.5705699",
"0.5680375",
"0.5673776",
"0.55384827",
"0.55266863",
"0.55181956",
"0.53939855",
"0.5347486",
"0.53324175",
"0.52546406",
"0.52546406",
"0.52530736",
"0.51774776",
"0.5147119",
"0.5068702",
"0.506... | 0.54743814 | 11 |
Bind this worker's queue to the topic exchange and to the given binding_key patterns | def post_initialize(**opts)
bind_queue_to_exchange_routing_keys
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_queue_to_exchange_routing_keys\n binding_keys.each do |key|\n queue.bind(exchange, routing_key: key)\n end\n end",
"def bind(queue, exchange, binding_key, arguments: {})\n with_connection do |conn|\n conn.channel(1).queue_bind(queue, exchange, binding_key, argumen... | [
"0.7963198",
"0.72307914",
"0.65758204",
"0.65397793",
"0.6513005",
"0.6448646",
"0.63972634",
"0.63922256",
"0.633951",
"0.6093168",
"0.59950817",
"0.58290744",
"0.5794057",
"0.57282114",
"0.56231576",
"0.56067085",
"0.5472938",
"0.5419589",
"0.54102665",
"0.5408475",
"0.527... | 0.539793 | 20 |
The durable RabbitMQ topic exchange from where messages are received | def exchange
@exchange ||= channel.topic(topic_name, durable: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange\n @exchange ||= channel.topic(Proletariat.exchange_name,\n durable: !Proletariat.test_mode?)\n end",
"def rmq_exchange\n rabbitmq_conn = Helper.rabbitmq_connect\n rabbitmq_conn.create_channel.direct('amq.topic')\n end",
"def durable; @message_i... | [
"0.7827947",
"0.7541374",
"0.734184",
"0.71635157",
"0.7152248",
"0.7138307",
"0.7026258",
"0.69942135",
"0.66804373",
"0.6465344",
"0.6464688",
"0.6461403",
"0.6444267",
"0.63305336",
"0.6254032",
"0.6200513",
"0.6107448",
"0.60538304",
"0.59833544",
"0.5960152",
"0.5959861"... | 0.83424234 | 0 |
Bind this worker's listening queue to the topic exchange and receive only messages with routing key matching the patterns in binding_keys. | def bind_queue_to_exchange_routing_keys
binding_keys.each do |key|
queue.bind(exchange, routing_key: key)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', ... | [
"0.6100264",
"0.6064155",
"0.585651",
"0.57221574",
"0.57204074",
"0.5716468",
"0.56840163",
"0.5672507",
"0.56591094",
"0.56452554",
"0.55498654",
"0.54506236",
"0.5443892",
"0.54202586",
"0.53896064",
"0.53474516",
"0.5308581",
"0.5288042",
"0.5280886",
"0.5279132",
"0.5206... | 0.7205004 | 0 |
Export Initializer Use any of the public class methods to create objects of this type. | def initialize(export_id)
@export_id = export_id
@status = nil
@export_uri = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\r\n init_public_members\r\n init_private_members\r\n end",
"def init\n raise NotImplementedError\n end",
"def initialize() end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\n \n end",
"def init; end",
"def init; end",
... | [
"0.720919",
"0.6896945",
"0.6868468",
"0.6826983",
"0.6826983",
"0.6826983",
"0.67676944",
"0.67565286",
"0.67565286",
"0.67565286",
"0.67565286",
"0.6733173",
"0.6733173",
"0.6733173",
"0.6733173",
"0.6733173",
"0.67271936",
"0.6721972",
"0.66665405",
"0.6632977",
"0.6632977... | 0.0 | -1 |
Instance implementation of the Sa::Export.status method that also sets the export_uri if the status is :complete | def status
unless @status == :complete || @status == :error || @status == :failure
status_response = self.class.status(@export_id)
@status = convert_status(status_response['Status'])
update_export_uri(status_response) if @status == :complete
end
@status
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_export_status\n update_status(:export)\n end",
"def set_status\n @completed = @progress == @number\n end",
"def completed\n @status = 'complete'\n end",
"def complete!(status)\n fail(AlreadyCompleteError) if complete?\n\n update!(\n completed_at: Time.now.utc,\n ... | [
"0.73684883",
"0.6537465",
"0.6429914",
"0.6271995",
"0.6219826",
"0.6219826",
"0.620508",
"0.6158405",
"0.6135277",
"0.6109822",
"0.59734446",
"0.59588677",
"0.5956634",
"0.59516364",
"0.5937469",
"0.59373575",
"0.59341425",
"0.5894204",
"0.5858118",
"0.5858118",
"0.5858118"... | 0.834727 | 0 |
Convert YourMembership API codes to readable symbols | def convert_status(status)
case status
when '-1'
return :failure
when '0'
return :unknown
when '1'
return :working
when '2'
return :complete
else
return :error
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\r\n @code.to_s.upcase\r\n end",
"def to_s\n \"#{codepoint} (#{name})\"\n end",
"def lookup_code_string\r\n \"@lookup_codes = #{lookup_codes.to_s}\"\r\n end",
"def to_s\n \"#{@name} \\[#{@unlocode}]\"\n end",
"def to_s\n \"#{@code}: #{@name}\"\n end",
"def to_s... | [
"0.62835354",
"0.61267334",
"0.6023451",
"0.5978955",
"0.59210956",
"0.59210956",
"0.5921033",
"0.5811775",
"0.576919",
"0.5742508",
"0.5742508",
"0.57218236",
"0.5655772",
"0.564331",
"0.564331",
"0.5598753",
"0.55952793",
"0.5557914",
"0.55421656",
"0.5528011",
"0.5524988",... | 0.0 | -1 |
Answers a tree of messages. The nodes of the tree are decorated to act like a linked list, providing pointers to _next_ and _previous_ in the tree. | def tree
return nil if messages.size == 0
build_tree unless @tree
@tree
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread(messages)\n # create id_table\n @id_table = create_id_table(messages)\n\n # create root hierachy siblings out of containers with zero children\n # TODO: would probably be nicer to use a list instead of empty root node\n root = Container.new()\n @id_table.each_pair { |... | [
"0.58822316",
"0.5474144",
"0.5343977",
"0.5229514",
"0.5110403",
"0.51060605",
"0.50866956",
"0.5069726",
"0.5020287",
"0.5011909",
"0.50047123",
"0.49855068",
"0.49716163",
"0.4966702",
"0.4957564",
"0.49504575",
"0.49454376",
"0.49313998",
"0.4927287",
"0.4925083",
"0.4921... | 0.7395399 | 0 |
we'll use the reserved word super to call Monster's initialize and keep our code more DRY | def initialize (threat_level=:medium)
# note that zombies created without a threat level
# will still have a default threat_level of :medium
super(threat_level)
@habitat = "graveyard"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(...)\n super\n mon_initialize\n end",
"def initialize() end",
"def initialize(*args)\n super\n mon_initialize\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(*) end",
"def initialize(*) end",
"def initi... | [
"0.8007021",
"0.7919353",
"0.791829",
"0.7752017",
"0.7752017",
"0.7752017",
"0.7752017",
"0.77134377",
"0.77134377",
"0.77134377",
"0.77134377",
"0.77134377",
"0.76947504",
"0.76947504",
"0.7581099",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882",
"0.7561882... | 0.0 | -1 |
GET /entries GET /entries.xml | def index
#@tags = Entry.author_counts
@filter = params[:filter]
@sort_by = params[:sort_by]
if (@filter)
@entries = Entry.tagged_with(params[:filter], :order => @sort_by)
else
@entries = Entry.find(:all, :order => @sort_by)
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @entries }
format.rss { render :rss => @entries }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entri... | [
"0.73774385",
"0.7352769",
"0.723138",
"0.70918024",
"0.6968695",
"0.6959239",
"0.6927212",
"0.689944",
"0.6817086",
"0.67637634",
"0.6759492",
"0.6714782",
"0.66889846",
"0.66414034",
"0.66272306",
"0.661824",
"0.661824",
"0.661824",
"0.661824",
"0.661824",
"0.661824",
"0.... | 0.60191774 | 52 |
GET /entries/1 GET /entries/1.xml | def show
@entry = Entry.find(params[:id])
@entry.viewed += 1
@entry.update_attributes(params[:entry])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @entry }
format.rss { render :rss => @entry }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entri... | [
"0.7118641",
"0.71141446",
"0.68437636",
"0.6827899",
"0.6716551",
"0.6700706",
"0.6700706",
"0.66596735",
"0.6640895",
"0.656696",
"0.64813584",
"0.6418889",
"0.639086",
"0.6332453",
"0.63303244",
"0.6318188",
"0.62884516",
"0.6286663",
"0.62810963",
"0.6236334",
"0.616893",... | 0.59057677 | 38 |
GET /entries/new GET /entries/new.xml | def new
authenticate_user!
@entry = Entry.new
@systems = Array.new[System.find(:all).size]
@components = Array.new[Component.find(:all).size]
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @entry }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end... | [
"0.7487182",
"0.74756294",
"0.73580587",
"0.72526073",
"0.69531655",
"0.6934435",
"0.6929773",
"0.69131255",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.68986547",
"0.6893476",
"0.68658763",
"0.6830648",
"0.6801082",
"0... | 0.66272086 | 24 |
POST /entries POST /entries.xml | def create
@entry = Entry.new(params[:entry])
@entry.viewed = 0
@entry.user_id = current_user
@systems = params[:systems]
@systems.each do |s|
@entry.system_list.add(s)
end
@components = params[:components]
@components.each do |c|
@entry.comp_list.add(c)
end
respond_to do |format|
if @entry.save
format.html { redirect_to(@entry, :notice => 'Entry was successfully created.') }
format.xml { render :xml => @entry, :status => :created, :location => @entry }
else
format.html { render :action => "new" }
format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n logger.info \"Creating Entry\"\n @entry = Entry.new(params[:entry])\n logger.info \"Entry Created\"\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(entries_url, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry,... | [
"0.62269115",
"0.6189906",
"0.60944426",
"0.6051307",
"0.6038386",
"0.58648914",
"0.58509773",
"0.58441854",
"0.5820264",
"0.5808413",
"0.58058083",
"0.5761974",
"0.5755941",
"0.5737393",
"0.5737393",
"0.5737393",
"0.5736821",
"0.5736727",
"0.57349133",
"0.5724143",
"0.567730... | 0.5343489 | 59 |
PUT /entries/1 PUT /entries/1.xml | def update
@entry = Entry.find(params[:id])
@entry.system_list = ""
@systems = params[:systems]
@systems.each do |s|
@entry.system_list.add(s)
end
@entry.comp_list = ""
@components = params[:components]
@components.each do |c|
@entry.comp_list.add(c)
end
respond_to do |format|
if @entry.update_attributes(params[:entry])
format.html { redirect_to(@entry, :notice => 'Entry was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def put_atom_entry(entry, url = entry.edit_url)\n raise \"Cowardly refusing to PUT a non-Atom::Entry (#{entry.class})\" unless entry.is_a? Atom::Entry\n headers = {\"Con... | [
"0.6826835",
"0.6384481",
"0.63784885",
"0.63533026",
"0.6222491",
"0.61160046",
"0.6093023",
"0.60561115",
"0.60546976",
"0.6050203",
"0.6040439",
"0.6001884",
"0.5946076",
"0.59074014",
"0.5896197",
"0.58877313",
"0.5828895",
"0.5821725",
"0.5819541",
"0.5819541",
"0.576086... | 0.0 | -1 |
DELETE /entries/1 DELETE /entries/1.xml | def destroy
@entry = Entry.find(params[:id])
@entry.destroy
respond_to do |format|
format.html { redirect_to(entries_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @entry ||= Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def delete_entr... | [
"0.7227281",
"0.7106644",
"0.70635635",
"0.6982504",
"0.6865913",
"0.6860874",
"0.67615414",
"0.67322755",
"0.6691479",
"0.6674829",
"0.6633014",
"0.65948296",
"0.6584446",
"0.6557223",
"0.65317374",
"0.65304327",
"0.65259486",
"0.6503882",
"0.6503882",
"0.6494026",
"0.649402... | 0.7109776 | 5 |
configure this after the routes is finalized skip_before_action :authenticate_user!, only: :home | def home
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home\n authenticate!\n end",
"def home\n redirect_to signin_path() and return if ( @current_user.nil? )\n end",
"def home\n if user_signed_in?\n current_user.update_attribute(:login_status, true) if current_user # update login status for logged in user\n if !current_user.is_super_admin... | [
"0.72083336",
"0.71486306",
"0.7038525",
"0.6954358",
"0.6884677",
"0.68303233",
"0.6826214",
"0.6774407",
"0.6745907",
"0.66669214",
"0.66284674",
"0.6537676",
"0.6526583",
"0.6501439",
"0.64968437",
"0.64906543",
"0.6474953",
"0.6445634",
"0.64330965",
"0.64162976",
"0.6405... | 0.0 | -1 |
TODO: reconsider handling of parent resources | def load_ancestors
resource_ancestors.map do |ancestor_name|
# TODO: reconsider namespace handling
instance_variable_set("@#{ancestor_name}", model_namespace.const_get(ancestor_name.camelize).find(params[:"#{ancestor_name}_id"]))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_parent_resources\n # Key to hash for controller relationships information.\n ar_parents_key= @controller.controller_class_name.intern\n parents= @res_parents[@controller.controller_name]\n\n if !parents || parents.empty?\n @controller.ar_controller_parents[ar_parents_... | [
"0.681683",
"0.66582495",
"0.6615209",
"0.6601737",
"0.6456767",
"0.6412563",
"0.6393283",
"0.63446915",
"0.63200015",
"0.6318581",
"0.6298036",
"0.6297628",
"0.62963885",
"0.62863725",
"0.6240965",
"0.6136084",
"0.6127339",
"0.61232996",
"0.61213565",
"0.6111859",
"0.6079084... | 0.0 | -1 |
TODO: reconsider resource filtering | def load_objects
instance_variable_set("@#{model_name.underscore.pluralize}", (@instances = model.where(params || {}) rescue nil))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_resource_semantics!; end",
"def resource; end",
"def resources()\n end",
"def find_resource(obj)\n\n\n\n resources.detect do |r|\n\n\n\n r.resource_name.to_s == obj.to_s || r.resource_class.to_s == obj.to_s\n\n\n\n ... | [
"0.6408725",
"0.6263638",
"0.6250768",
"0.6150716",
"0.6126603",
"0.6126603",
"0.61125785",
"0.60635257",
"0.60473853",
"0.6025615",
"0.5980223",
"0.59429896",
"0.593329",
"0.59237605",
"0.5907516",
"0.5885984",
"0.58440244",
"0.5816659",
"0.580991",
"0.5794237",
"0.578278",
... | 0.0 | -1 |
GET /feedbacks GET /feedbacks.json Admin only index page | def index
@feedbacks = Feedback.all.sort_by(&:created_at).reverse
respond_with @feedbacks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end",
"def index\n @feedbacks = Feedback.all\n respond_to do |format|\n if request.xhr?\n format.html # index.html.erb\n end... | [
"0.8125489",
"0.78079593",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.7805609",
"0.76093894",
"0.7596521",
"0.7515115",
"0.7427078",
"0.7413484",
"0.7413484",
"0.7405309",
"0.7365898",
"0.7277934",
"0.72519225",
"0.7216201",
... | 0.6852526 | 27 |
GET /feedbacks/1 GET /feedbacks/1.json Admin only show feedback page (note there is no link to actually get to this page, but keeping it for possible future use) | def show
@feedback = Feedback.find(params[:id])
respond_with @feedback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end",
"def show\n @title = t('view.feedbacks.show_title')\n @feedback = find_feedback\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feedback }\n end\n end",
"def... | [
"0.80434686",
"0.7733841",
"0.7676877",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7671461",
"0.7535486",
"0.7425618",
"0.73609686",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.7349259",
"0.72710586",
... | 0.71308714 | 26 |
GET /feedbacks/new GET /feedbacks/new.json new feedback page note only gets called when there is an error from popup | def new
@feedback = Feedback.new
respond_with @feedback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end",
"def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback ... | [
"0.78339034",
"0.78339034",
"0.78339034",
"0.75340706",
"0.7406975",
"0.7308081",
"0.7254815",
"0.7224183",
"0.7184945",
"0.71809024",
"0.71809024",
"0.7168144",
"0.7161278",
"0.716113",
"0.716113",
"0.7127967",
"0.7127967",
"0.71135956",
"0.71110505",
"0.71087736",
"0.707607... | 0.7192644 | 8 |
POST /feedbacks POST /feedbacks.json | def create
@feedback = Feedback.new(params[:feedback])
respond_with(@feedback) do
redirect_to "/feedbacks/thank_you" if @feedback.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end",
"def create\n \n @feedback = Feedback.new(params[:feedback])\n \n respond_to... | [
"0.74067223",
"0.7115278",
"0.71128494",
"0.7037425",
"0.7037425",
"0.70201325",
"0.70042884",
"0.69460565",
"0.69074863",
"0.6882927",
"0.6880752",
"0.68361783",
"0.68150926",
"0.6783977",
"0.67001534",
"0.66902465",
"0.6678681",
"0.6675885",
"0.6674073",
"0.66555536",
"0.66... | 0.66641 | 19 |
Thank you page Directed to thank you page after creating a feedback | def thank_you
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thankyou\n end",
"def thankyou\n end",
"def send_feedback\n feedback = FeedbackItem.new(:user_id=>current_user.id, :url=>params[:url], :page=>params[\"feedback-form-select\"], :description=>params[:description])\n if @saved = feedback.save\n flash[:success_message] = \"Thank you for your fee... | [
"0.75734913",
"0.75734913",
"0.7233791",
"0.7076913",
"0.69815683",
"0.68772644",
"0.6871658",
"0.6826509",
"0.6819372",
"0.6752845",
"0.6726881",
"0.67083573",
"0.66840214",
"0.66618514",
"0.6641294",
"0.6628791",
"0.6554005",
"0.655179",
"0.65516657",
"0.6535636",
"0.651272... | 0.75838184 | 2 |
DELETE /feedbacks/1 DELETE /feedbacks/1.json Admin only destroy feedback | def destroy
@feedback = Feedback.find(params[:id])
@feedback.destroy
redirect_to feedbacks_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # only admins can delete feedback\n redirect_to(root_path) unless current_user.admin\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @feedback\n @feedb... | [
"0.852357",
"0.8267735",
"0.8261452",
"0.8261452",
"0.8261452",
"0.8261452",
"0.8261452",
"0.82124066",
"0.819386",
"0.8177167",
"0.8177167",
"0.8177167",
"0.8158311",
"0.8100385",
"0.8100385",
"0.8100385",
"0.8100385",
"0.8100385",
"0.8100385",
"0.7958626",
"0.7944245",
"0... | 0.8009949 | 19 |
method called by admin on feedback index page to change whether the feedback is shown on the home page Admin only | def changeShow
@feedback = Feedback.find(params[:id])
@feedback.show = !@feedback.show
@feedback.save
redirect_to feedbacks_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin?() false end",
"def admin?; false end",
"def show\n is_admin?\n end",
"def show\n is_admin?\n end",
"def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :r... | [
"0.647743",
"0.64446986",
"0.64273584",
"0.64202046",
"0.6408131",
"0.63850063",
"0.6369391",
"0.63389",
"0.6331391",
"0.63211125",
"0.62790716",
"0.6274252",
"0.62531286",
"0.62461543",
"0.623278",
"0.6230182",
"0.6221224",
"0.6220922",
"0.6186508",
"0.61774427",
"0.6167678"... | 0.6036619 | 46 |
check_for_admin called by before_filter | def check_for_admin
unless user_signed_in? && current_user.admin?
redirect_to root_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_should_be_admin\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def check_if_admin\n unless current_user.admin\n redirect_to \"/login\"\n end\n end",
"def verify_admin\n admin_is_logge... | [
"0.80556935",
"0.78866667",
"0.77844906",
"0.76927286",
"0.7562618",
"0.75464356",
"0.75464356",
"0.75140536",
"0.7513962",
"0.75067276",
"0.74892306",
"0.7464292",
"0.7452952",
"0.7445053",
"0.74262816",
"0.7422698",
"0.7413248",
"0.7405049",
"0.7405049",
"0.73890924",
"0.73... | 0.73743427 | 25 |
Method to add a new record based on a hash | def create_record(r, defaults)
rec = Record.new(defaults.merge(r))
rec.save
puts notice(rec)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(hash); end",
"def create(record_hash = {})\n record = new(record_hash)\n record.save\n end",
"def addRecord(rec); @records[rec.key] = rec end",
"def create_record!(hash, inventory_object)\n record = inventory_collection.model_class.create!(hash.except(:id))\n inventory_coll... | [
"0.7653652",
"0.7488804",
"0.73270947",
"0.70142984",
"0.69641143",
"0.69504595",
"0.6812263",
"0.6806295",
"0.6577319",
"0.6520014",
"0.64489734",
"0.64376134",
"0.6424322",
"0.6422087",
"0.6366283",
"0.63463324",
"0.6340782",
"0.6291044",
"0.62716955",
"0.6268501",
"0.62552... | 0.0 | -1 |
Prints the record's details | def notice(r)
' | ' + r.name.to_s.ljust(30) +
' | ' + r.record_type.to_s.ljust(5) +
' | ' + r.aux.to_s.rjust(4) +
' | ' + r.data.to_s.ljust(34) +
' | '
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_display\n \"#{id}. Name: #{name}\\n Email: #{email}\\n Library: #{libraries_display}\"\n end",
"def print_details\n puts \"\"\n puts \"#{@fullname}\"\n puts \"---------\" ' '\n puts \"Date of Birth:#{@dob}\"\n \n puts \"\"\n puts \"Email address... | [
"0.7590206",
"0.7385059",
"0.7381572",
"0.73185515",
"0.7259663",
"0.7201984",
"0.7184323",
"0.7173403",
"0.715688",
"0.71248543",
"0.7067355",
"0.70450807",
"0.702733",
"0.69798493",
"0.6913411",
"0.68935263",
"0.68643063",
"0.68583214",
"0.6857899",
"0.6818568",
"0.6794095"... | 0.0 | -1 |
Validates the size of an uploaded picture. | def picture_size
if picture.size > 5.megabytes
errors.add(:picture, "should be less than 5MB")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"should be less than 5MB\")\n end\n end",
"def picture_size\n errors.add(:pictu... | [
"0.8246438",
"0.8246069",
"0.8203719",
"0.8203224",
"0.8199266",
"0.8188133",
"0.8187386",
"0.8179088",
"0.81592035",
"0.81588674",
"0.8158672",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81494313",
"0.81... | 0.8011205 | 64 |
This is done just for displaying to the seller Armor will charge in their backend | def calculate_store_additional_armor_fee(armor_order)
amount = armor_order.unit_price * armor_order.count
armor_fee = calculate_armor_payments_fee(armor_order, amount)
toadlane_fee_percentage = Fee.find_by(:module_name => "Armor Payments").value
toadlane_fee = amount * toadlane_fee_percentage / 100
seller_charged_fee = armor_fee + toadlane_fee
# armor_order.amount is the order amount
amount_after_fee_to_seller = armor_order.amount - seller_charged_fee
armor_order.update_attributes({
seller_charged_fee: seller_charged_fee,
amount_after_fee_to_seller: amount_after_fee_to_seller
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_buy\n @page_title = _('Buy_Card')\n @page_icon = 'money.png'\n\n @email = params[:email]\n @real_price = @card.balance + @cg.get_tax.count_tax_amount(@card.balance)\n @send_invoice = params[:send_invoice]\n @total_tax_name = Confline.get_value('Total_tax_name')\n @description = params... | [
"0.66683996",
"0.64877623",
"0.64828414",
"0.64150435",
"0.6374034",
"0.6340546",
"0.6161571",
"0.6161571",
"0.61505824",
"0.61219656",
"0.61185586",
"0.60873544",
"0.60845494",
"0.6082554",
"0.6065567",
"0.6065565",
"0.6065565",
"0.6029134",
"0.6025532",
"0.6025532",
"0.6018... | 0.0 | -1 |
Retrieve details on all registrants for a specific training. Registrants can be: UNREGISTERED: registrant withdrew their registration but didn't optout of receiving more training or webinar information DELETED: registrant withdrew their registration and optedout of receiving more information about the training or webinar WAITING: registrant registered and is awaiting approval (where organizer has required approval) APPROVED: registrant registered and is approved DENIED registrant registered and was not approved. IMPORTANT: The registrant data caches are typically updated immediately and the data will be returned in the response. However, the update can take as long as two hours. Endpoint: | def all
url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants")
response = http_client.get(url)
if response.ok?
registrants = response.data.map do |attrs|
Resource::Registrant.new Resource::Registrant.deserialize(attrs)
end
end
[response, registrants]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registrants(training)\n Namespace::Registrants.new(credentials: credentials, training: training)\n end",
"def RetrieveAllRegistrations\n response = @registration_getter.RetrieveAllRegistrations(\n {\"customerUserName\" => @username,\n ... | [
"0.66445243",
"0.6326968",
"0.62716883",
"0.6071931",
"0.60015935",
"0.60015935",
"0.60015935",
"0.60015935",
"0.60015935",
"0.5927897",
"0.5872693",
"0.5836062",
"0.58343875",
"0.57667494",
"0.5693609",
"0.569252",
"0.5671817",
"0.5670852",
"0.56550795",
"0.56523263",
"0.563... | 0.806236 | 0 |
This call cancels a registration in a scheduled training for a specific registrant. If the registrant has paid for the training, a cancellation cannot be completed with this method; it must be completed on the Citrix external admin site. No notification is sent to the registrant or the organizer by default. The registrant can reregister if needed. Endpoint: | def remove(registrant)
url = url_for("organizers", credentials.organizer_key, "trainings", training.key, "registrants", registrant.key)
http_client.delete(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel\n @api_v1_reservation.update(status: :canceled)\n Api::V1::ReservationMailer.cancel_reservation(@api_v1_reservation).deliver_now\n render json: { success: true }, status: 200\n rescue Exception => errors\n render json: errors, status: :unprocessable_entity\n end",
"def cancel_request\n ... | [
"0.6103245",
"0.60252124",
"0.60087955",
"0.5811438",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.57134295",
"0.5707157",
"0.5706176",
"0.5700771",
"0.56697124",
"0.5667243",
"0.56669486",
"0.566521",
"0.56621575",
"0.56609255",
"0.5... | 0.61293393 | 0 |
You get an array of numbers, return the sum of all of the positives ones. Example [1,4,7,12] => 1 + 7 + 12 = 20 Note: if there is nothing to sum, the sum is default to 0. | def positive_sum(arr)
arr.select{|x| x > 0}.reduce(0, :+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def positive_sum(arr)\r\n sum = 0\r\n arr.each do |number|\r\n if number > 0\r\n sum += number\r\n end\r\n end\r\n sum\r\n end",
"def positive_sum(arr)\n arr.select!{|num| num > 0}\n return 0 if arr.empty?\n arr.reduce(:+)\nend",
"def sum_of_positive(arr)\n sum = 0\n ar... | [
"0.8194223",
"0.8155228",
"0.80068475",
"0.796987",
"0.7900624",
"0.78847253",
"0.7822795",
"0.7821847",
"0.7752128",
"0.77304655",
"0.7706112",
"0.76693165",
"0.7596689",
"0.75488156",
"0.74992645",
"0.74900395",
"0.7465904",
"0.7458943",
"0.74519014",
"0.74303967",
"0.73824... | 0.78847736 | 6 |
GET /request_texts GET /request_texts.json | def index
@request_texts = RequestText.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def get_texts(params)\n #first, get the relevant canto and its stanzas\n canto = Canto.find_by_name(params['canto'])\n @stanzas = Stanza.where(canto_id: canto.id).includes(:stanza_translations).order(:number)\... | [
"0.65497273",
"0.6340287",
"0.63128537",
"0.61542857",
"0.6130874",
"0.60848445",
"0.59647423",
"0.5940359",
"0.5923374",
"0.5923374",
"0.5897322",
"0.58849394",
"0.5850994",
"0.58053637",
"0.5800679",
"0.5783335",
"0.57830423",
"0.5680339",
"0.56663704",
"0.56231683",
"0.560... | 0.74384046 | 0 |
GET /request_texts/1 GET /request_texts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @request_texts = RequestText.all\n end",
"def get\n text_file = TextFile.find_by(name: params['name'])\n response = {}\n if text_file\n response = create_response(text_file)\n end\n render json: response\n end",
"def request_translations(texts, options = T.uns... | [
"0.71680796",
"0.64562637",
"0.6167204",
"0.6164141",
"0.6126681",
"0.611253",
"0.6074115",
"0.6062396",
"0.6035272",
"0.6016303",
"0.5938826",
"0.5924549",
"0.5897851",
"0.5897851",
"0.58521515",
"0.5750596",
"0.5712206",
"0.5697288",
"0.5663135",
"0.56581277",
"0.5657775",
... | 0.0 | -1 |
POST /request_texts POST /request_texts.json | def create
@request_text = RequestText.new(request_text_params)
@request_text.ip = request.remote_ip
respond_to do |format|
if @request_text.save
format.html { redirect_to '/', notice: 'Request text was successfully created.' }
format.json { render action: 'show', status: :created, location: @request_text }
else
format.html { render action: 'new' }
format.json { render json: @request_text.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @request_texts = RequestText.all\n end",
"def request_text_params\n params.require(:request_text).permit(:name, :email, :website, :body, :ip)\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def text_params\n params.require(:... | [
"0.6719368",
"0.6506125",
"0.62863934",
"0.6118663",
"0.60813296",
"0.6051296",
"0.603817",
"0.5965374",
"0.5941802",
"0.5921346",
"0.5881889",
"0.587454",
"0.5790046",
"0.5741888",
"0.5737444",
"0.5722283",
"0.5687871",
"0.56675225",
"0.56507343",
"0.5649251",
"0.5600831",
... | 0.6553612 | 1 |
PATCH/PUT /request_texts/1 PATCH/PUT /request_texts/1.json | def update
respond_to do |format|
if @request_text.update(request_text_params)
format.html { redirect_to @request_text, notice: 'Request text was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @request_text.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @api_v1_custom_text.update(api_v1_custom_text_params)\n format.html { redirect_to @api_v1_custom_text, notice: 'Custom text was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_custom_text }\n else\n for... | [
"0.6611145",
"0.65562725",
"0.64173865",
"0.64173865",
"0.6400193",
"0.6373649",
"0.6368891",
"0.63140434",
"0.62895834",
"0.62615544",
"0.62381303",
"0.6223819",
"0.6217745",
"0.6138507",
"0.61103433",
"0.6109359",
"0.6086264",
"0.6058902",
"0.6054726",
"0.60418016",
"0.6036... | 0.74509895 | 0 |
DELETE /request_texts/1 DELETE /request_texts/1.json | def destroy
@request_text.destroy
respond_to do |format|
format.html { redirect_to request_texts_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @text = Text.find(params[:id])\n @text.destroy\n respond_to do |format|\n format.html { redirect_to texts_url, notice: \"Text was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_text.destroy\n respond_to do |format|\n ... | [
"0.69577616",
"0.6938973",
"0.6934526",
"0.6934526",
"0.6898743",
"0.6892599",
"0.68865126",
"0.68121135",
"0.6782535",
"0.6740674",
"0.67274487",
"0.67084813",
"0.6705469",
"0.6683916",
"0.66828996",
"0.6634282",
"0.6622166",
"0.66143703",
"0.6610321",
"0.66070014",
"0.65967... | 0.7916422 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_request_text
@request_text = RequestText.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def request_text_params
params.require(:request_text).permit(:name, :email, :website, :body, :ip)
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.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
Creates a GameStats object and fetches data from the Steam Community for the given user and game | def initialize(id, game_name)
if id.is_a? Numeric
@steam_id64 = id
else
@custom_url = id.downcase
end
@game_friendly_name = game_name
url = base_url + '?xml=all'
@xml_data = REXML::Document.new(open(url, {:proxy => true}).read).root
@privacy_state = @xml_data.elements['privacyState'].text
if public?
@app_id = @xml_data.elements['game/gameLink'].text.match(/http:\/\/store.steampowered.com\/app\/([1-9][0-9]+)/)[1]
@custom_url = @xml_data.elements['player/customURL'].text if @custom_url.nil?
@game_name = @xml_data.elements['game/gameName'].text
@hours_played = @xml_data.elements['stats/hoursPlayed'].text unless @xml_data.elements['stats/hoursPlayed'].nil?
@steam_id64 = @xml_data.elements['player/steamID64'].text.to_i if @steam_id64.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_stats(steam_id)\n return unless has_stats?\n\n GameStats.create_game_stats steam_id, @short_name\n end",
"def steam_user_stats\n @steam_user_stats if initted?\n end",
"def initialize(steam_id, game_name)\n super steam_id, game_name\n\n if public?\n most_recent_game_data = @xml_da... | [
"0.7009098",
"0.63882446",
"0.6170086",
"0.6129993",
"0.6085228",
"0.5936688",
"0.5916315",
"0.58934957",
"0.5889802",
"0.58598995",
"0.5858862",
"0.5840439",
"0.5833535",
"0.5817031",
"0.5793984",
"0.57758486",
"0.5762053",
"0.57380074",
"0.57326174",
"0.56929284",
"0.564265... | 0.5481148 | 32 |
Returns the achievements for this stats' user and game. If the achievements haven't been parsed already, parsing is done now. | def achievements
return unless public?
if @achievements.nil?
@achievements = Array.new
@xml_data.elements.each('achievements/achievement') do |achievement_data|
@achievements << GameAchievement.new(@steam_id64, @app_id, achievement_data)
end
@achievements_done = @achievements.reject{ |a| !a.unlocked? }.size
end
@achievements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_achievements\n\n #TODO: Use a list of achievements in db with conditions stored in db, iterate and award as necessary. \n if (self.games_won_as_pacman == 10)\n self.user.achievements << Achievement.create(:name => \"The Elusive Pacman\", :desc => \"Win 10 games as Pacman\");\n elsif (self.ga... | [
"0.65684885",
"0.6397081",
"0.6334587",
"0.6323498",
"0.630337",
"0.626555",
"0.6222719",
"0.6204567",
"0.6124604",
"0.60512006",
"0.6031974",
"0.58580565",
"0.5852766",
"0.57708806",
"0.5687688",
"0.56250644",
"0.55900407",
"0.55871034",
"0.5569041",
"0.5567442",
"0.5533525"... | 0.7600278 | 0 |
Returns the count of achievements done by this player. If achievements haven't been parsed yet, parsing is done now. | def achievements_done
achievements if @achievements_done.nil?
@achievements_done
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def achievements_done\n @achievements.size\n end",
"def get_num_achievements\n if initted?\n @@dll_SteamAPI_ISteamUserStats_GetNumAchievements.call @i_user_stats\n else\n nil\n end\n end",
"def achievements\n return unless public?\n\n if @achievements.nil?\n @achievements... | [
"0.78981143",
"0.72493595",
"0.7097341",
"0.6803785",
"0.65524167",
"0.63763344",
"0.6237372",
"0.59215206",
"0.5874091",
"0.58633",
"0.5823148",
"0.5783102",
"0.56455743",
"0.5617858",
"0.5589296",
"0.54715437",
"0.5467653",
"0.5427132",
"0.54137695",
"0.53786796",
"0.535248... | 0.69771576 | 3 |
Returns a float value representing the percentage of achievements done by this player. If achievements haven't been parsed yet, parsing is done now. | def achievements_percentage
achievements_done.to_f / @achievements.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def achievements_percentage\n @achievements.size.to_f / @schema.achievements.size\n end",
"def achievements_done\n achievements if @achievements_done.nil?\n @achievements_done\n end",
"def percent_complete\n (accepted_points.to_f / total_points * 100.0).round(1)\n end",
"def get_num_ac... | [
"0.7739478",
"0.6711216",
"0.66586816",
"0.6573813",
"0.6461194",
"0.64467686",
"0.64325994",
"0.6381152",
"0.63409287",
"0.6304703",
"0.62893283",
"0.6215041",
"0.62057483",
"0.62057483",
"0.617332",
"0.616534",
"0.61529654",
"0.61512697",
"0.6124935",
"0.61173296",
"0.61058... | 0.8348275 | 0 |
Returns the base URL for this Steam Communtiy object | def base_url
if @custom_url.nil?
"http://steamcommunity.com/profiles/#{@steam_id64}/stats/#{@game_friendly_name}"
else
"http://steamcommunity.com/id/#{@custom_url}/stats/#{@game_friendly_name}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base\n\t\t\t\tif @api\n\t\t\t\t\treturn @api.base_url\n\t\t\t\telse\n\t\t\t\t\treturn 'http://masterserver.hon.s2games.com/'\n\t\t\t\tend\n\t\t\tend",
"def base_url\n if @custom_url.nil?\n \"http://steamcommunity.com/gid/#{@group_id64}\"\n else\n \"http://steamcommunity.com/groups/#{@custom_u... | [
"0.7727005",
"0.766897",
"0.7629012",
"0.76214135",
"0.76059353",
"0.7595587",
"0.75783515",
"0.75397927",
"0.74995184",
"0.74571794",
"0.7441903",
"0.744091",
"0.7427219",
"0.7427219",
"0.7414",
"0.7377704",
"0.7376052",
"0.736486",
"0.73597",
"0.73528",
"0.73272604",
"0.7... | 0.7772089 | 0 |
A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four). If red tiles are chosen there are exactly seven ways this can be done. If green tiles are chosen there are three ways. And if blue tiles are chosen there are two ways. (See problem_0116.png.) Assuming that colours cannot be mixed there are 7 + 3 + 2 = 12 ways of re placing the black tiles in a row measuring five units in length. How many different ways can the black tiles in a row measuring fifty units in length be replaced if colours cannot be mixed and at least one coloured tile must be used? NOTE: This is related to Problem 117. | def fill( len, row, memo )
return memo[row] if memo[row]
total = 0
if len <= row
total += row - len + 1
(row - len).downto( len ) do |sub|
total += fill( len, sub, memo )
end
end
memo[row] = total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tile_number_generator(board)\n count_hash = {\n 0 => 0,\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n 6 => 0,\n 7 => 0,\n 8 => 0,\n 9 => 1\n }\n \n y_pos = 1\n self... | [
"0.63061494",
"0.61762726",
"0.5951057",
"0.592607",
"0.58918905",
"0.5848015",
"0.5824953",
"0.5807494",
"0.57600635",
"0.5752242",
"0.57450694",
"0.57046735",
"0.56623435",
"0.5648064",
"0.5646536",
"0.5624774",
"0.56208116",
"0.5596462",
"0.558845",
"0.55854005",
"0.557640... | 0.0 | -1 |
vimType and xsiType arg positions are switched here because most strings are MORs, and this makes it easier to set the vimType of the MOR. | def initialize(val = "", vimType = nil, xsiType = nil)
self.xsiType = xsiType
self.vimType = vimType
super(val)
yield(self) if block_given?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types=(_arg0); end",
"def set_type\n case content\n when \"empty\" then self.content_type = \"empty\"\n when /ire/ then self.content_type = \"ire\"\n when /hill|tree/ then self.content_type = \"obstacle\"\n when /axe|sword|lance/ then self.content_type = \"enemy\"\n else raise \"Change type... | [
"0.5479132",
"0.5262888",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.52535504",
"0.51739913",
"0.51069266",
"0.50648713",
"0.5054776",
"0.4999499",
... | 0.6141915 | 0 |
toggles batches between active (one or more pigs alive) and retired (all pigs deceased) states | def toggle
@batch = Batch.find(params[:id])
@batch.update(:active => @batch.active? ? false : true)
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetStates()\r\n @players.each do |player|\r\n if(player.money > 0)\r\n player.state = \"fine\"\r\n else\r\n player.state = \"broke\"\r\n end\r\n end\r\n end",
"def change_obstacle_states\n @linked_obstacles.each do |i|\n i.switch_state\n end\n end",
"def up... | [
"0.57321",
"0.56141716",
"0.5576303",
"0.5532392",
"0.5487746",
"0.5316877",
"0.5314602",
"0.5292675",
"0.5278602",
"0.5269668",
"0.5249165",
"0.5244038",
"0.52401143",
"0.52401143",
"0.5238586",
"0.5234495",
"0.52183086",
"0.520716",
"0.51762766",
"0.5169967",
"0.5159385",
... | 0.6563227 | 0 |
GET /locationtypes GET /locationtypes.json | def index
@locationtypes = Locationtype.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def locations\n get('locations')\n end",
"def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facil... | [
"0.7352875",
"0.6842212",
"0.6791823",
"0.6775262",
"0.6714413",
"0.6421152",
"0.6300943",
"0.62888527",
"0.6257442",
"0.62449807",
"0.62438124",
"0.62159",
"0.6207377",
"0.620486",
"0.62025404",
"0.619011",
"0.6183376",
"0.61257327",
"0.6096692",
"0.6096437",
"0.6079439",
... | 0.7234389 | 1 |
GET /locationtypes/1 GET /locationtypes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(location,types=nil)\n handle_response(get(\"/content/location.json\", :query => {:location => location,:types=>types}))\n end",
"def index\n @locationtypes = Locationtype.all\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.71440804",
"0.7058667",
"0.6853073",
"0.6516962",
"0.6404254",
"0.63825464",
"0.6358858",
"0.63252574",
"0.63129234",
"0.63104516",
"0.6298388",
"0.61981046",
"0.6192654",
"0.6180567",
"0.6174054",
"0.61680275",
"0.61569387",
"0.61561114",
"0.61288524",
"0.6125784",
"0.610... | 0.0 | -1 |
POST /locationtypes POST /locationtypes.json | def create
@locationtype = Locationtype.new(locationtype_params)
respond_to do |format|
if @locationtype.save
format.html { redirect_to @locationtype, notice: 'Locationtype was successfully created.' }
format.json { render :show, status: :created, location: @locationtype }
else
format.html { render :new }
format.json { render json: @locationtype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location_type_params\n params.require(:location_type).permit(:name,\n :location_types => [])\n end",
"def locationtype_params\n params.require(:locationtype).permit(:name, :icon_id, :icon_url, :insideR, :nearR)\n end",
"def postLocation( location_i... | [
"0.7445175",
"0.65673685",
"0.6561545",
"0.6269261",
"0.6061381",
"0.6041028",
"0.6039614",
"0.60343665",
"0.6011429",
"0.59885997",
"0.59835774",
"0.5950121",
"0.59150326",
"0.5885389",
"0.5878175",
"0.5872188",
"0.58581173",
"0.5857324",
"0.585349",
"0.5826545",
"0.5825513"... | 0.68715453 | 1 |
PATCH/PUT /locationtypes/1 PATCH/PUT /locationtypes/1.json | def update
respond_to do |format|
if @locationtype.update(locationtype_params)
format.html { redirect_to @locationtype, notice: 'Locationtype was successfully updated.' }
format.json { render :show, status: :ok, location: @locationtype }
else
format.html { render :edit }
format.json { render json: @locationtype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @location_type = args[:location_type] if args.key?(:location_type)\n end",
"def update\n respond_to do |format|\n if @route_type.update(route_type_params)\n format.html { redirect_to @route_type, notice: 'Route type was successfully updated.' }\n format... | [
"0.67589223",
"0.6427182",
"0.63977265",
"0.6379996",
"0.6379274",
"0.6370938",
"0.6360427",
"0.6338944",
"0.6305313",
"0.6299987",
"0.6298265",
"0.62895554",
"0.62741023",
"0.62737304",
"0.6263542",
"0.62588704",
"0.62507045",
"0.6231161",
"0.62263507",
"0.62204653",
"0.6208... | 0.71162456 | 0 |
DELETE /locationtypes/1 DELETE /locationtypes/1.json | def destroy
@locationtype.destroy
respond_to do |format|
format.html { redirect_to locationtypes_url, notice: 'Locationtype was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @route_type.destroy\n respond_to do |format|\n format.html { redirect_to route_types_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destro... | [
"0.7074522",
"0.7031752",
"0.69829553",
"0.6941483",
"0.69289505",
"0.6921534",
"0.6908175",
"0.6899486",
"0.6896655",
"0.68930936",
"0.68917996",
"0.6871897",
"0.686513",
"0.686513",
"0.686513",
"0.686513",
"0.68597496",
"0.6858222",
"0.6855608",
"0.68317616",
"0.6821802",
... | 0.7630033 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_locationtype
@locationtype = Locationtype.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 locationtype_params
params.require(:locationtype).permit(:name, :icon_id, :icon_url, :insideR, :nearR)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
GET /attachments GET /attachments.json | def index
@attachments = Attachment.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attachments }\n end\n end",
"def index\n @attachments = Attachment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { re... | [
"0.74735296",
"0.74735296",
"0.74024487",
"0.722081",
"0.7219372",
"0.7208093",
"0.7203526",
"0.7203526",
"0.7203526",
"0.7203526",
"0.7187247",
"0.7101844",
"0.70873123",
"0.7087135",
"0.7081746",
"0.70675015",
"0.70458794",
"0.69755876",
"0.6935839",
"0.6916688",
"0.6861383... | 0.7157699 | 15 |
GET /attachments/1 GET /attachments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attachment(id)\n response = conn.get 'api/files/attachments/' + id\n\n unless response.status == 200\n error_model = JSON.load(response.body)\n mailosaur_error = Mailosaur::MailosaurError.new('Operation returned an invalid status code \\'' + response.status.to_s + '\\'', error_model... | [
"0.7399194",
"0.7391738",
"0.7391738",
"0.7391738",
"0.7391738",
"0.72952175",
"0.7252977",
"0.7209151",
"0.71989596",
"0.71989596",
"0.7146606",
"0.70339215",
"0.7025872",
"0.7025872",
"0.7025872",
"0.7025872",
"0.7025872",
"0.698809",
"0.6985993",
"0.69612706",
"0.69198835"... | 0.0 | -1 |
POST /attachments POST /attachments.json | def create
hash = []
params[:files].each do |i,file_io|
path = File.join(Rails.root,'public','attach',file_io.original_filename)
File.open(path, "wb") { |f| f.write(file_io.read)}
attachment = Attachment.create do |attach|
attach.name = file_io.original_filename
attach.describe = params[:describe]
end
hash.push attachment
end
render json: hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @document = Document.new(document_params)\n\n respond_to do |format|\n if @document.save\n if params[:attachments]\n params[:attachments].each do |a|\n @attachment = @document.attachments.create!(:attachment => a)\n end\n end\n format.html {... | [
"0.67848635",
"0.67172647",
"0.67172647",
"0.6709618",
"0.66656864",
"0.66315144",
"0.6592286",
"0.6520801",
"0.65067184",
"0.64586616",
"0.6454223",
"0.6452402",
"0.6448785",
"0.6444251",
"0.6421693",
"0.64028513",
"0.638763",
"0.6360143",
"0.6320735",
"0.63047457",
"0.63042... | 0.67279613 | 1 |
PATCH/PUT /attachments/1 PATCH/PUT /attachments/1.json | def update
respond_to do |format|
if @attachment.update(attachment_params)
format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @attachment.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @attachment = Attachment.find(params[:id])\n\n respond_to do |format|\n if @attachment.update_attributes(params[:attachment])\n format.html { head :no_content }\n format.json { head :no_content }\n else\n format.html { head :no_content }\n format.json { head... | [
"0.7022153",
"0.6942577",
"0.69111156",
"0.68939614",
"0.68939614",
"0.6827708",
"0.6826713",
"0.6723745",
"0.662861",
"0.66023237",
"0.6596154",
"0.6584143",
"0.65676963",
"0.653716",
"0.65124995",
"0.63956416",
"0.63918567",
"0.63918567",
"0.63719565",
"0.63521653",
"0.6332... | 0.68190664 | 8 |
DELETE /attachments/1 DELETE /attachments/1.json | def destroy
@attachment.destroy
respond_to do |format|
format.html { redirect_to attachments_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @attachment = Attachment.find_by_name(params[:id])\n @attachment.destroy\n\n respond_to do |format|\n format.html { redirect_to attachments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @attachments = Attachment.find_by_id(params[:id])\n if @attachments.... | [
"0.79157954",
"0.7911116",
"0.78474337",
"0.7647964",
"0.75549096",
"0.7526275",
"0.7526275",
"0.7502211",
"0.7485029",
"0.747136",
"0.74386835",
"0.7387519",
"0.7363478",
"0.73250425",
"0.7315343",
"0.7278889",
"0.72639626",
"0.7230356",
"0.7229833",
"0.72171277",
"0.7217127... | 0.78026474 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_attachment
@attachment = Attachment.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 attachment_params
params.require(:attachment).permit(:employee_id, :name, :describe)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289... | 0.0 | -1 |
Configure Rails Mini Profiler You may use this to configure where and how Rails Mini Profiler stores profiling and storage information. | def configure
yield(configuration)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _miniprofiler\n if %w(development).include?(Rails.env)\n #if %w(development staging).include?(Rails.env)\n if APP_CONFIG['debug']['miniprofiler_enabled'] && user_signed_in? && current_user.has_role?('admin')\n Rack::MiniProfiler.authorize_request\n else\n Rack::MiniProfiler.deauth... | [
"0.6429279",
"0.63404876",
"0.5803759",
"0.5777419",
"0.55314577",
"0.5265451",
"0.523015",
"0.5227075",
"0.5219919",
"0.5219919",
"0.51583105",
"0.5144832",
"0.50996673",
"0.50848943",
"0.49967018",
"0.49221063",
"0.48974776",
"0.4820689",
"0.4814132",
"0.47953397",
"0.47721... | 0.0 | -1 |
Access the current logger | def logger
@logger ||= configuration.logger
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_logger; @logger; end",
"def logger\n @log\n end",
"def logger\n @log\n end",
"def logger\n @logger\n end",
"def logger\n @logger\n end",
"def logger\n @__logger\n end",
"def logger\n reset_logger! unless defined? @@logger\n @@logger\n ... | [
"0.84841424",
"0.84564626",
"0.84564626",
"0.8434215",
"0.8434215",
"0.83566713",
"0.8309358",
"0.82900506",
"0.82646453",
"0.8196551",
"0.8192056",
"0.81491107",
"0.81439626",
"0.8136586",
"0.8129685",
"0.8129355",
"0.8118863",
"0.8117452",
"0.8101169",
"0.8094447",
"0.80875... | 0.7978824 | 33 |
Authorize the current user for this request | def authorize!(current_user)
RailsMiniProfiler::User.current_user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize_request\n @current_user = AuthorizeApiRequest.new(request.headers).call[:user]\n end",
"def authorize_request\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end",
"def authorize... | [
"0.7938921",
"0.7710668",
"0.7687778",
"0.7662587",
"0.76419526",
"0.76419526",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.755099",
"0.7524629",
"0.75187236",
"0.7489292"... | 0.67787844 | 75 |
Set the current user for this request | def current_user=(current_user)
RailsMiniProfiler::User.current_user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_as_current_user\n @user = @current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n ... | [
"0.8638259",
"0.8526614",
"0.8526614",
"0.8526614",
"0.8526614",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"0.84507424",
"... | 0.0 | -1 |
Gets a path to the java binary: 1) If "java_bin" is configured with the LWRP, then use it 2) Runs a "which java" in shell, and retrieve stdout 3) When all else fails, return "/usr/bin/java" | def get_java_path(resource)
return resource.java_bin if !resource.java_bin.nil? && !resource.java_bin.empty?
cmd = Mixlib::ShellOut.new('which java').tap(&:run_command)
cmd_output = cmd.stdout.chomp
!cmd_output.empty? ? cmd_output : '/usr/bin/java'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruby_bin\n @ruby_bin ||= begin\n c = ::Config::CONFIG\n File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']\n end\n end",
"def path_to_bin(name = nil)\n home = ENV['JAVA_HOME'] or fail 'Are we forgetting something? JAVA_HOME not set.'\n bin = Util.normalize_path(File.... | [
"0.63929486",
"0.62440574",
"0.6168697",
"0.61093855",
"0.6097962",
"0.5963003",
"0.5901154",
"0.5894257",
"0.5864119",
"0.58336717",
"0.58215153",
"0.5816257",
"0.5805665",
"0.5772197",
"0.5766898",
"0.57611716",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096",
"0.5726096... | 0.81067604 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.