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
unapply the coupon to this specific order
def unapply return return_with(:error, I18n.t('coupon.cannot_remove')) unless unappliable_order? return return_with(:error, I18n.t('coupon.error_occurred_applying')) unless reset_order! && reset_coupon! return_with(:success) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_coupon!(order, coupon)\n CouponHandler.new(nil, order.coupon, order).update_order!\n CouponHandler.new(nil, order.coupon, order).update_coupon!\nend", "def remove_from_old_order\n coupon.orders&.first&.update(\n coupon_discount: 0,\n coupon_applied_at: nil,\n coupon_id: ...
[ "0.71773773", "0.71350116", "0.67571735", "0.6513718", "0.6430614", "0.6333667", "0.61667174", "0.61388826", "0.6110477", "0.6079408", "0.6023786", "0.59649014", "0.58986527", "0.58534867", "0.57848305", "0.5782135", "0.5777011", "0.5761611", "0.5649534", "0.5591537", "0.5576...
0.72870934
0
often with AJAX call we change prices on the fly we will need to reset the application to the coupon from here
def reset unapply apply end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_coupon\n if params[:user_id].present? #params[\"original_amt\"].present?\n data = params[:offer_id].present? ? params[:offer_id] : 1\n percentage = Offer.find(data).percentage.to_f\n app_amount = ENV[\"app_amount\"].to_f\n discount_price = app_amount * (percentage / 100) #params...
[ "0.64901805", "0.6321327", "0.6251521", "0.62469035", "0.6177788", "0.60842735", "0.6049626", "0.5934891", "0.59297174", "0.5927739", "0.59273165", "0.58934665", "0.58934665", "0.5887407", "0.58692604", "0.5866889", "0.5865228", "0.5862644", "0.586082", "0.5858706", "0.585128...
0.0
-1
we unapply the coupon from the order
def reset_order! order.update( coupon_discount: 0, coupon_applied_at: nil, coupon_id: nil ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unapply\n return return_with(:error, I18n.t('coupon.cannot_remove')) unless unappliable_order?\n return return_with(:error, I18n.t('coupon.error_occurred_applying')) unless reset_order! && reset_coupon!\n return_with(:success)\n end", "def apply_coupon!(order, coupon)\n CouponHandler.new(nil, orde...
[ "0.7510364", "0.7450647", "0.74466306", "0.6669054", "0.65530264", "0.6546222", "0.6474553", "0.63129205", "0.6287594", "0.627969", "0.61968714", "0.61110556", "0.6046841", "0.60325265", "0.5985125", "0.5984579", "0.58991647", "0.58984643", "0.5868211", "0.5844049", "0.583900...
0.697329
3
we update the order with the correct datas
def update_order! order.update( coupon_discount: coupon_discount, coupon_applied_at: Time.now, coupon_id: coupon.id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_order_item\n \n end", "def update\n @ordered.each do |ord|\n #уничтожаем все объекты из таблице многие ко многим, чтобы обновление было корректно\n if @order.id==ord.order_id\n Ordered.find(ord.id).destroy\n end\n end\n respond_to do |format|\n if @or...
[ "0.7743608", "0.7441593", "0.71290123", "0.6821755", "0.68003756", "0.677264", "0.6657181", "0.6622883", "0.6606139", "0.6598994", "0.6596694", "0.6593128", "0.65844905", "0.6577298", "0.65760165", "0.65651673", "0.65529865", "0.6533468", "0.6527363", "0.6492257", "0.6485706"...
0.6254711
41
if there's no user referrer linked to this ore we try to refresh with the coupon referrer if it exists
def update_referrer! if order.referrer && order.referrer_origin == :user true elsif coupon.referrer order.update( referrer: coupon.referrer, referrer_origin: :coupon ) else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def referrer\n if params[:code]\n wechat_api_connect_solver = WechatApi::ConnectSolver.new(params[:code]).resolve\n\n # this is taken from application controller\n if wechat_api_connect_solver.success?\n user = wechat_api_connect_solver.data[:customer]\n\n # we turn him into a real ...
[ "0.5980002", "0.5975442", "0.59698045", "0.5918677", "0.5901647", "0.58389896", "0.5834406", "0.5799403", "0.5795096", "0.5721248", "0.5717409", "0.56883085", "0.56802744", "0.561824", "0.56054634", "0.558286", "0.5556263", "0.5531599", "0.5490329", "0.54761416", "0.54582834"...
0.7767586
0
we update the coupon
def update_coupon! coupon.update(last_applied_at: Time.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_order!\n order.update(\n coupon_discount: coupon_discount,\n coupon_applied_at: Time.now,\n coupon_id: coupon.id\n )\n end", "def update\n @coupon = current_user.coupons.find(params[:id])\n params[:coupon][:used_at] = DateTime.now if params[:coupon][:status]==\"...
[ "0.8042682", "0.76754534", "0.7634751", "0.76116186", "0.7607296", "0.7602433", "0.7592444", "0.7592444", "0.7561056", "0.750171", "0.7445592", "0.73746717", "0.730629", "0.7288043", "0.72761637", "0.72478604", "0.7234176", "0.72334075", "0.72334075", "0.72334075", "0.7233407...
0.80457026
0
we consider the coupon as unused
def reset_coupon! coupon.update(last_applied_at: nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_coupon\n coupon = self.orders.where(state: \"paused\").first.coupon\n valid_coupon = Coupon.is_valid?(coupon.coupon_code) if coupon.present?\n valid_coupon.present? ? valid_coupon.coupon_code : nil\n end", "def apply_coupon\n if self.behavior == 'coupon'\n item = self.item\n ...
[ "0.65454507", "0.6377418", "0.626323", "0.6260351", "0.6184871", "0.61605656", "0.61547077", "0.61451703", "0.60949785", "0.6030058", "0.6010284", "0.600412", "0.5976228", "0.5964863", "0.59397537", "0.59346664", "0.5898758", "0.5873622", "0.5850753", "0.5849044", "0.5847089"...
0.5699096
36
all the calculations will be based on the result of this method for more flexibility
def original_price order.total_price_with_taxes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculated; end", "def calculation\n end", "def recalculate\n end", "def recalculate\n\tend", "def result\n @result ||= calculate_result\n end", "def calculate\n self.total\n end", "def do_calculation\n index = 0\n total = 0.0\n\n num_list_length = num_list.length\n\n ...
[ "0.80610305", "0.77382773", "0.7405313", "0.7324188", "0.6954269", "0.68562025", "0.6822051", "0.677994", "0.6600796", "0.6518265", "0.64606947", "0.64101005", "0.6405829", "0.63967454", "0.63854194", "0.6358865", "0.633958", "0.631033", "0.62989527", "0.6297926", "0.629414",...
0.0
-1
order that already bought shouldn't remove any coupon (obviously)
def unappliable_order? order.bought? == false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_from_old_order\n coupon.orders&.first&.update(\n coupon_discount: 0,\n coupon_applied_at: nil,\n coupon_id: nil\n )\n end", "def unapply\n return return_with(:error, I18n.t('coupon.cannot_remove')) unless unappliable_order?\n return return_with(:error,...
[ "0.72070795", "0.6656115", "0.660632", "0.65210986", "0.65041083", "0.64508486", "0.64109826", "0.6406066", "0.6402463", "0.63250864", "0.6296258", "0.62715167", "0.6228053", "0.6214585", "0.6204889", "0.62024194", "0.61700565", "0.61542845", "0.6147561", "0.61199856", "0.611...
0.6399481
9
we check for the minimum order price and if the order doesn't have a coupon already
def valid_order? order.coupon.nil? && coupon.cancelled_at.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_less_min_order_charge\n if self.branch.use_min_order_charge && self.amount <= self.branch.non_service_order_charge\n self.errors[:amount] = \"低于最小起送金额#{self.branch.non_service_order_charge}元,无法下单\"\n return\n end\n end", "def enough_order_size?(quantity, price)\n quantity * pric...
[ "0.716815", "0.6762509", "0.65680987", "0.6469923", "0.64494044", "0.64365363", "0.6415405", "0.64121765", "0.64066386", "0.6249154", "0.6240905", "0.61946917", "0.6161786", "0.6145566", "0.60271025", "0.60264534", "0.5982296", "0.59679526", "0.5966777", "0.5949843", "0.59480...
0.6076273
14
if the coupon is unique it shouldn't have been used already
def valid_coupon? (coupon.unique == false || available?) && (coupon.expired_at == nil || coupon.expired_at > Time.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_coupon?(coupon, cart)\n cart.has_key?(coupon[:item]) && cart[coupon[:item]].fetch(:count) >= coupon[:num]\nend", "def coupon\n @coupon ||= Coupon.create!(user: reward.user, discount: money, minimum_order: money, unit: :value, unique: true, origin: :reward)\n end", "def set_coupon_code\n\n ...
[ "0.64969116", "0.649214", "0.6407164", "0.6379035", "0.6374123", "0.634117", "0.6248354", "0.6079944", "0.5997378", "0.5968019", "0.5949711", "0.590171", "0.58867043", "0.58817154", "0.5880067", "0.5876914", "0.5871278", "0.58650273", "0.5859105", "0.58541006", "0.58214164", ...
0.6258024
6
Removes the coupon from the last order that applied it
def remove_from_old_order coupon.orders&.first&.update( coupon_discount: 0, coupon_applied_at: nil, coupon_id: nil ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_coupon_in_cart\n cart = get_current_cart\n if cart.coupon\n cart.coupon = nil\n cart.discount_price = nil\n cart.save\n end\n end", "def delete_coupon\n self.class.delete_coupon(cart_id)\n end", "def reset_coupon!\n coupon.update(last_applied_at: nil)\n end", "...
[ "0.74013853", "0.70763695", "0.70206404", "0.68968517", "0.6815566", "0.6803234", "0.67495936", "0.6592266", "0.65528744", "0.6014242", "0.5995618", "0.59068906", "0.5838143", "0.5813579", "0.58115655", "0.57642466", "0.5756875", "0.57316494", "0.57251084", "0.5706829", "0.57...
0.81171817
0
we calculate the discount depending on EUR or PERCENT
def coupon_discount if coupon.unit == :value coupon.discount elsif coupon.unit == :percent original_price * (coupon.discount / 100) else 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_discount_for(total)\n if self.discount_percentage.present? && self.discount_percentage != 0.0\n (total / 100) * self.discount_percentage.round(2)\n else\n 0\n end\n end", "def calculate_discount(price:, discount:, discount_type:)\n if discount_type == 'a'\n ((price.to_f ...
[ "0.78726715", "0.7668523", "0.76662797", "0.7617032", "0.75785536", "0.7565385", "0.75486904", "0.75034285", "0.74646556", "0.74192166", "0.7396453", "0.73916364", "0.7364312", "0.73526525", "0.7345817", "0.734212", "0.7335153", "0.7326872", "0.73127234", "0.72969025", "0.726...
0.737653
12
GET /news/1 GET /news/1.json
def show @news = News.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @news } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \n @news = News.all\n @latest_news = News.latest_news\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @news }\n end\n end", "def show\n @news = News.find(params[:id])\n \n respond_to do |format|\n format.html # show.ht...
[ "0.7815696", "0.76536703", "0.7649074", "0.7595847", "0.73423666", "0.73018026", "0.72966933", "0.72711104", "0.72301525", "0.7229993", "0.7228589", "0.72241205", "0.7211648", "0.7210009", "0.7184221", "0.7180074", "0.7165995", "0.7131228", "0.71089554", "0.70824724", "0.7066...
0.7686168
3
GET /news/new GET /news/new.json
def new @news = News.new respond_to do |format| format.html # new.html.erb format.json { render json: @news } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @news = News.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "def new\n # Create new news\n @news = News.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n...
[ "0.8299795", "0.8297776", "0.80394983", "0.799374", "0.792347", "0.792347", "0.7883417", "0.750458", "0.7467028", "0.74511075", "0.7441081", "0.7378197", "0.7378197", "0.7378197", "0.73156077", "0.7241846", "0.7219911", "0.7205118", "0.7205118", "0.7205118", "0.7205118", "0...
0.83082664
1
POST /news POST /news.json
def create @news = News.new(params[:news]) respond_to do |format| if @news.save format.html { redirect_to @news, notice: 'Новость добавлена.' } format.json { render json: @news, status: :created, location: @news } else format.html { render action: "new" } format.json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @news = New.new(news_params)\n\n if @news.save\n render json: @news, status: :created\n else\n render json: @news.errors, status: :unprocessable_entity\n end\n end", "def create\n @news = News.new(params[:news])\n\n respond_to do |format|\n if @news.save\n fo...
[ "0.77889776", "0.74912935", "0.7343813", "0.73230803", "0.7277019", "0.7167892", "0.71512437", "0.7151047", "0.7151047", "0.7086479", "0.6996427", "0.69866496", "0.69860035", "0.6985851", "0.6980995", "0.6975966", "0.6968422", "0.6965393", "0.69583726", "0.6880726", "0.687695...
0.7275398
5
PUT /news/1 PUT /news/1.json
def update @news = News.find(params[:id]) respond_to do |format| if @news.update_attributes(params[:news]) format.html { redirect_to @news, notice: 'Новость изменена.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @news.update_attributes(news_params)\n render json: @news, status: :ok\n else\n render json: {message: \"Not found\"}, status: :not_found\n end\n end", "def update\n @news = News.find(params[:id])\n pt = params[:news]\n @news.node_id = pt[:node_id]\n @news.title = ...
[ "0.7179396", "0.7174172", "0.6964476", "0.6900903", "0.66972977", "0.6686171", "0.66643786", "0.66643786", "0.6655565", "0.6648247", "0.6638577", "0.65819013", "0.65730274", "0.6551379", "0.64751804", "0.6456605", "0.6452463", "0.6452463", "0.6452463", "0.6452463", "0.6426301...
0.67102873
4
DELETE /news/1 DELETE /news/1.json
def destroy @news = News.find(params[:id]) @news.destroy respond_to do |format| format.html { redirect_to news_index_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @news.destroy\n respond_to do |format|\n format.html { redirect_to news_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @news = News.find(params[:id])\n @news.destroy\n\n respond_to do |format|\n format.html { redirect_to news_index_path...
[ "0.77763623", "0.7764016", "0.77518404", "0.7737358", "0.7599612", "0.7589493", "0.7574557", "0.75620157", "0.7550304", "0.75419104", "0.7514583", "0.74850947", "0.74732846", "0.7467053", "0.7467053", "0.7467053", "0.7440285", "0.7440285", "0.7440285", "0.7422816", "0.7422764...
0.77563584
5
Function to generate a new order number Args : Returns : Raises :
def generate_order_number record = true while record random = "R#{Array.new(9){rand(9)}.join}" record = self.class.where(:number => random).first end self.number = random if self.number.blank? self.number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_order_number\n alpha = %w[0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]\n # try a short order number first\n # in case of collision, increase length of order number\n (4..10).each do |length|\n self.order_number = Time.now.strftime(\"%Y%m%d-\")\n length.t...
[ "0.80222803", "0.8006565", "0.763834", "0.73905563", "0.7377531", "0.68406767", "0.6726696", "0.6651924", "0.66358733", "0.6607987", "0.65431255", "0.65431255", "0.6496835", "0.6348649", "0.60096693", "0.5869698", "0.5860107", "0.585496", "0.58519906", "0.5839847", "0.5818638...
0.71912235
5
Function to send the order read notificaiton Args : Returns : Raises :
def send_ready_notification end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_order(order)\n puts \"Received order for #{order}\"\n return order\nend", "def recevied(order)\n @order = order\n\n mail to: \"tariq.sulehir@khaleef.com\", subject: \"Rails Store Order Conformation..\"\n end", "def take_order(order)\n puts \"Received order for #{order}\"\nend", "def orde...
[ "0.6433085", "0.63625467", "0.6248735", "0.6184532", "0.61057985", "0.60194874", "0.60169315", "0.59807163", "0.59807163", "0.59577537", "0.59510267", "0.5940881", "0.58913565", "0.5831954", "0.5818983", "0.5786959", "0.5770335", "0.5766573", "0.5738511", "0.5738511", "0.5732...
0.0
-1
Associates the specified user with the order.
def associate_user!(user) self.user = user # disable validations since they can cause issues when associating # an incomplete address during the address step save(:validate => false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user(user)\n order.associate_user!(user) if !order.user && user\n end", "def associate_user\n if current_order.user.anonymous? and current_user\n current_order.associate_user!(current_user)\n end\n end", "def set_user_order\n @user_order = UserOrder.find(params[:id])\n end",...
[ "0.81003284", "0.732865", "0.7114411", "0.70830095", "0.69898856", "0.6892258", "0.6816208", "0.67697895", "0.67465156", "0.66970253", "0.66950047", "0.66688603", "0.65765935", "0.6574172", "0.6504007", "0.6438308", "0.6427546", "0.6426691", "0.6426691", "0.6425467", "0.64158...
0.63411474
21
This is a multipurpose method for processing logic related to changes in the Order. It is meant to be called from various observers so that the Order is aware of changes that affect totals and other values stored in the Order. This method should never do anything to the Order that results in a save call on the object (...
def update! update_totals # update_payment_state shipments.each { |shipment| shipment.update!(self) }#(&:update!) update_shipment_state update_adjustments # give each of the shipments a chance to update themselves # update totals a second time in case updated adjustments have an effect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!\n update_totals\n update_payment_state\n # update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes_without_callbacks({\n :state => \"complete\"\n }) \n \n logger.info 'UPDATED...
[ "0.7268685", "0.6878757", "0.66894037", "0.66716945", "0.6669018", "0.6586202", "0.6567416", "0.64232963", "0.64151627", "0.6355066", "0.6342922", "0.6337933", "0.63281465", "0.6317038", "0.6268664", "0.62015843", "0.61887145", "0.6161509", "0.6132563", "0.6054398", "0.604355...
0.55213284
80
Function to process payments Args : Returns : Raises :
def process_payments! ret = payments.each(&:process!) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_payments!\n if group_buy\n process_payments_with(:authorize!)\n else\n process_payments_with(:purchase!)\n end\n end", "def process_payment!\n @payment_type.pay\n end", "def process_with_payu\n process_purchase\n end", "def pay(payment)\n r...
[ "0.7511053", "0.7113619", "0.6907479", "0.68392783", "0.67036617", "0.6419497", "0.639505", "0.63698083", "0.63249665", "0.63188684", "0.6281075", "0.6261556", "0.6204446", "0.6202857", "0.6195992", "0.61670595", "0.61522025", "0.61483836", "0.6142484", "0.613845", "0.6113713...
0.7436894
1
Indicates whether or not the user is allowed to proceed to checkout. Currently this is implemented as a check for whether or not there is at least one LineItem in the Order. Feel free to override this logic in your own application if you require additional steps before allowing a checkout.
def checkout_allowed? line_items.count > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkout_allowed?\n order_items.count > 0\n end", "def checkout_needed?\n\t\ttrue\n\tend", "def purchase_order_required?\n if self.solution.purchase_order_required && self.purchase_order.blank?\n errors.add(:purchase_order_required, \"PROBLEM: A purchase order is required for solution #{self.s...
[ "0.7549266", "0.64525723", "0.64462376", "0.64005494", "0.6362245", "0.6272134", "0.6272134", "0.6272134", "0.62685215", "0.61911863", "0.61911863", "0.6134001", "0.61112124", "0.5966988", "0.59453624", "0.5918343", "0.58637017", "0.5859926", "0.5847845", "0.5800141", "0.5785...
0.7893464
0
convenience method since many stores will not allow user to create multiple shipments
def shipment @shipment ||= shipments.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shipment!\n shipping_method(true)\n\n if shipment.present?\n shipment.update_attributes!(:shipping_method => shipping_method)\n else\n self.shipments << Shipment.create!({ :order => self,\n :shipping_method => shipping_method,\n ...
[ "0.69896233", "0.6966808", "0.67817855", "0.67548865", "0.67548865", "0.67491716", "0.6733714", "0.6733714", "0.67180526", "0.66254866", "0.6531698", "0.65294933", "0.65213066", "0.6477784", "0.6447781", "0.64407635", "0.64322853", "0.6427304", "0.6427135", "0.64218986", "0.6...
0.61323106
46
Creates a new shipment (adjustment is created by shipment model)
def create_shipment! shipping_method(true) if shipment.present? shipment.update_attributes!(:shipping_method => shipping_method) else self.shipments << Shipment.create!({ :order => self, :shipping_method => shipping_method, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n shipment_args = params[:shipment].clone\n \n Shipment.prepare_industry(shipment_args)\n \n # unless Industry.exists?(shipment_args[:industry_id])\n # shipment_args[:new_industry_name] = shipment_args[:industry_id]\n # shipment_args[:industry_id] = nil\n # end\n\n shipmen...
[ "0.72686046", "0.72271013", "0.71155643", "0.7087684", "0.7078339", "0.7072255", "0.7072255", "0.7062922", "0.70457166", "0.6993949", "0.69925135", "0.6987256", "0.69698864", "0.69401544", "0.6935823", "0.69299716", "0.6903983", "0.68800646", "0.687417", "0.6860894", "0.68572...
0.74782604
0
Helper methods for checkout steps
def available_shipping_methods(display_on = nil) return [] unless ship_address ShippingMethod.all_available(self, display_on) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkout\n end", "def checkout\n\tend", "def checkout_method\n end", "def checkout\n raise NotImplementedError\n end", "def checkout_needed?\n\t\ttrue\n\tend", "def checkout(&block)\n raise NotImplementedError\n end", "def checkout(&block)\n raise NotImplementedErro...
[ "0.7757533", "0.75685596", "0.7481271", "0.71605", "0.69358855", "0.651358", "0.651358", "0.6467729", "0.6427458", "0.63259006", "0.6320037", "0.6279415", "0.62729573", "0.62684494", "0.6247009", "0.62136644", "0.6149857", "0.61001474", "0.6061647", "0.60218817", "0.5985351",...
0.0
-1
destroy any previous adjustments. Adjustments will be recalculated during order update.
def clear_adjustments! adjustments.tax.each(&:destroy) price_adjustments.each(&:destroy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculation_destroyed(options = {})\n if calculations.empty?\n # If the calculation got deleted due to a question cascading delete,\n # and there are no more calculations, the report is empty so it has to go.\n destroy if options[:source] == :question\n else\n fix_calculation_ranks\n ...
[ "0.66025835", "0.6410351", "0.63101816", "0.6230853", "0.61924267", "0.61871654", "0.6176876", "0.6176876", "0.6151106", "0.6128674", "0.6120355", "0.608283", "0.60272163", "0.59896195", "0.5950757", "0.5926432", "0.59259856", "0.5917033", "0.58913815", "0.587216", "0.5842677...
0.77259314
0
Finalizes an in progress order after checkout is complete. Called after transition to complete state when payments will have been processed
def finalize! touch :completed_at # InventoryUnit.assign_opening_inventory(self) # lock all adjustments (coupon promotions, etc.) # adjustments.each { |adjustment| adjustment.update_column('state', "closed") } # update payment and shipment(s) states, and save # update_payment_state shipmen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finalize!\n update_attribute(:completed_at, Time.now)\n update_attribute(:payment_method_name, self.payment_method.name) unless self.payment_method_name\n self.out_of_stock_items = InventoryUnit.assign_opening_inventory(self)\n # lock any optional adjustments (coupon promotions, etc.)\n adjustme...
[ "0.7069207", "0.6854559", "0.6725314", "0.6719874", "0.6625206", "0.66131824", "0.65649533", "0.65628386", "0.63315797", "0.61731213", "0.61580455", "0.6151953", "0.6048162", "0.6043034", "0.6043034", "0.6043034", "0.5975011", "0.5973769", "0.59597063", "0.5940238", "0.593648...
0.5470186
44
Updates the +payment_state+ attribute according to the following logic: paid when +payment_total+ is equal to +total+ balance_due when +payment_total+ is less than +total+ credit_owed when +payment_total+ is greater than +total+ failed when most recent payment is in the failed state The +payment_state+ value helps with...
def update_payment_state #line_item are empty when user empties cart if self.line_items.empty? || round_money(payment_total) < round_money(total) self.payment_state = 'balance_due' self.payment_state = 'failed' if payments.present? and payments.last.state == 'failed' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_payment_state\n last_state = order.payment_state\n if payments.present? && payments.valid.empty?\n order.payment_state = 'failed'\n elsif order.canceled? && order.payment_total == 0\n order.payment_state = 'void'\n else\n order.payment_state = 'balance_due' if or...
[ "0.8350084", "0.83358103", "0.8240439", "0.82229704", "0.69538593", "0.6481058", "0.6435796", "0.6392479", "0.63393223", "0.6199676", "0.608948", "0.60299003", "0.582127", "0.5774789", "0.57185596", "0.5712141", "0.5711291", "0.5634072", "0.56180274", "0.56148034", "0.5579353...
0.84749556
0
Updates the following Order total values: +payment_total+ The total value of all finalized Payments (NOTE: nonfinalized Payments are excluded) +item_total+ The total value of all LineItems +adjustment_total+ The total value of all adjustments (promotions, credits, etc.) +total+ The socalled "order total." This is equiv...
def update_totals # update_adjustments self.payment_total = payments.completed.map(&:amount).sum self.item_total = line_items.map(&:amount).sum self.adjustment_total = adjustments.eligible.map(&:amount).sum self.total = item_total + adjustment_total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n \n self.item_total = order_items.map(&:amount).sum\n self.billing_total = order_items.map(&:cost).sum\n self.customer_total = item_total\n self.full_total = order_items.map(&:fu...
[ "0.79717153", "0.76274216", "0.75809574", "0.7410586", "0.702739", "0.70246214", "0.69325984", "0.69035184", "0.6890278", "0.68213224", "0.680808", "0.67912924", "0.67794865", "0.6774949", "0.67552114", "0.673143", "0.67205346", "0.66905", "0.661895", "0.65712416", "0.6561534...
0.7907569
1
Updates each of the Order adjustments. This is intended to be called from an Observer so that the Order can respond to external changes to LineItem, Shipment, other Adjustments, etc. Adjustments will check if they are still eligible. Ineligible adjustments are preserved but not counted towards adjustment_total.
def update_adjustments self.adjustments.reload.each { |adjustment| adjustment.update!(self) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_adjustments\n self.adjustments.reload.each { |adjustment| adjustment.update!(self) }\n end", "def update_adjustments\n self.adjustments.reload.each do |adjustment|\n if adjustment.originator.class == Spree::Shipment\n adjustment.update!\n else\n adjustment.update!(self)\...
[ "0.75174433", "0.75009817", "0.7297269", "0.71731645", "0.6927075", "0.68300277", "0.6782845", "0.6680267", "0.66322213", "0.66082126", "0.66082126", "0.65411675", "0.6517718", "0.64465094", "0.6419291", "0.639603", "0.6385361", "0.6289478", "0.61840546", "0.60855746", "0.608...
0.75707793
0
Updates the +shipment_state+ attribute according to the following logic: shipped when all Shipments are in the "shipped" state partial when at least one Shipment has a state of "shipped" and there is another Shipment with a state other than "shipped" or there are InventoryUnits associated with the order that have a sta...
def update_shipment_state # get all the shipment states for this order shipment_states = shipments.states if shipment_states.size > 1 # multiple shiment states means it's most likely partially shipped self.shipment_state = 'partial' else # will return nil if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_shipment_state\n if order.backordered?\n order.shipment_state = 'backorder'\n else\n # get all the shipment states for this order\n shipment_states = shipments.states\n order.shipment_state = if shipment_states.size > 1\n # multiple s...
[ "0.876321", "0.8265569", "0.6574814", "0.64510304", "0.63029987", "0.6288161", "0.62436587", "0.59254", "0.59083426", "0.58264846", "0.58127165", "0.57595384", "0.57160395", "0.56916094", "0.56834376", "0.5655928", "0.56310385", "0.56244475", "0.5621532", "0.5604663", "0.5583...
0.8776762
0
takes markdown and returns html (as a string) content markdown content
def to_html(content) case @parser when :kramdown, 'kramdown' require 'kramdown' Kramdown::Document.new(content).to_html when :redcarpet, 'redcarpet' require 'redcarpet' markdown = Redcarpet::Markdown.new( Redcarpet::Render::HTML, smart: true, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_markup_markdown(text); end", "def html\n Markdown.render(self.content)\n end", "def html\n Markdown.render(self.content)\n end", "def markdown content\n require \"kramdown\"\n\n content = content.\n gsub(/^``` *(\\w+)/) { \"{:lang=\\\"#$1\\\"}\\n~~~\" }.\n gsub(/^```/, '~~~')...
[ "0.82984203", "0.8278673", "0.8278673", "0.8173441", "0.8173441", "0.8137568", "0.8008869", "0.79565734", "0.79372275", "0.7880968", "0.78761405", "0.785853", "0.7858321", "0.7839632", "0.7839632", "0.780221", "0.779561", "0.7786823", "0.7780723", "0.77529275", "0.77259785", ...
0.69147193
90
Try building a slug based on the following fields in increasing order of specificity.
def slug_candidates [ :name ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_slug\n if slug.blank? or title_changed?\n self.slug = self.title.blank? ? Time.now.strftime('%s') + id.to_s : ActiveSupport::Inflector.transliterate(title).downcase.gsub(/[^\\w]+/, '-')\n\n\n i = 0\n # Slug must be unique, so we try guess a good one\n loop do\n if Post.wher...
[ "0.76347935", "0.7309088", "0.7293913", "0.7233866", "0.7233866", "0.71862185", "0.7179961", "0.714693", "0.7020318", "0.7017181", "0.7014637", "0.6969852", "0.6946057", "0.6920418", "0.69096786", "0.6901099", "0.68822026", "0.6844709", "0.68375224", "0.6816876", "0.6814991",...
0.0
-1
Search for the specific cientific name
def search(q) begin client=Savon.client(wsdl: @wsdl) begin Timeout::timeout(@timeout) do @response = client.call(:data_taxon, message: { scientific_name: CGI.escape(q.gsub(' ', '_')), key: @key }) end rescue Timeout::Error raise Timeout::Error, "Conabio didn't res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myfind (str)\n if str.match(/^[[:graph:]]+$/) # name of the vaccine\n Vaccine.where(\"lower(name) like ?\", \"%#{str.downcase}%\")\n end\n end", "def search_by_name\n puts 'Enter a name to search for'\n lookup_name = gets.chomp\n result = @search.name(loo...
[ "0.61863166", "0.6143058", "0.613072", "0.6070173", "0.5932562", "0.58417755", "0.583955", "0.58384466", "0.57888913", "0.5749273", "0.5709124", "0.5707482", "0.5698377", "0.5688841", "0.5687816", "0.56748205", "0.5653846", "0.56513697", "0.56168413", "0.55598605", "0.5549781...
0.5148472
73
GET /translations GET /translations.xml
def index if params[:main_language_id] != nil && params[:main_language_id] != '' session[:main_language_id] = params[:main_language_id] end @locales = Locale.all if session[:main_language_id] == nil || session[:main_language_id] == '' session[:main_language_id] = @locales.firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translations(language = nil)\n Birdman::Requester.get(\"movies/#{id}/translations/#{language}\")\n end", "def translations; end", "def translations( params={} )\n translations = get_connections(\"translations\", params)\n return map_connections translations, :to => Facebook::Graph::Generic\n end...
[ "0.70056814", "0.65558565", "0.6547365", "0.6410881", "0.6400768", "0.6377228", "0.6363447", "0.63590175", "0.63526636", "0.62734824", "0.6247409", "0.622827", "0.618342", "0.6155855", "0.61209166", "0.6104372", "0.60953", "0.6057846", "0.6048227", "0.6025083", "0.6023345", ...
0.0
-1
Return image for a given race
def race_icon(race) case race when "zerg" then image_tag("race_zerg_icon.png", class: "race-icon") when "protoss" then image_tag("race_protoss_icon.png", class: "race-icon") when "terran" then image_tag("race_terran_icon.png", class: "race-icon") when "random" then image_tag("race_rando...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def icon_for_race(race)\n case race\n when \"protoss\" then image_tag \"race_protoss_icon.png\"\n when \"zerg\" then image_tag \"race_zerg_icon.png\"\n when \"terran\" then image_tag \"race_terran_icon.png\"\n else\n raise \"Invalid race parameter\", ArgumentError\n end\n end", "def g...
[ "0.6959954", "0.6342832", "0.602751", "0.5961933", "0.5802566", "0.576376", "0.5728423", "0.5726971", "0.5700666", "0.5699025", "0.56968194", "0.569565", "0.56845284", "0.56329376", "0.5610589", "0.5573331", "0.5561881", "0.55549634", "0.555361", "0.5544333", "0.5527736", "...
0.7152679
0
Return image for a given league
def league_icon(league) image = case league when "Bronze" then "league_bronze_icon.png" when "Silver" then "league_silver_icon.png" when "Gold" then "league_gold_icon.png" when "Platinum" then "league_platinum_icon.png" when "Diamond" then "league_diamond_icon.png" when ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_summoner_image(name)\n begin\n query_string = \"SELECT id FROM summoners WHERE name = '#{name}'\"\n query = @@db.query(query_string)\n link = []\n img = query.first['id'].to_s + \".png\"\n return img\n end\n end", "def get_actor_image(id, leader)\n leader = false\n i...
[ "0.63393414", "0.63384324", "0.62875384", "0.6239434", "0.6179971", "0.6008402", "0.59576565", "0.5950452", "0.5888039", "0.5780951", "0.57671946", "0.57593524", "0.5748909", "0.57328045", "0.5718204", "0.56511396", "0.5596383", "0.5590232", "0.55755097", "0.5568603", "0.5538...
0.6775201
0
Propriedades da Classe width height cells_played number_of_mines map_of_board is_still_playing is_gamer_finished
def initialize(width, height, number_of_mines) @width = width @height = height @cells_played = 0 @@cells_already_played = 0 @@total_of_unknown_cells = width * height @number_of_mines = number_of_mines @is_still_playing = true @is_gamer_finished = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size \n\n\t\t# Set the basic metrics\n\t\tcase @board_size\n\t\twhen :small \t\t\t\t# A 20x20 grid\n\t\t\t@width = 30\n\t\t\t@height = 20\n\t\t\t@dragon_count = 50 * @board_level\n\t\t\t@cell_size = 30\n\t\t\t@cover_png = 'sprites/cover_30.png'\n\t\t\t@dragon_png = 'sprites/dragon_30.png'\n\t\t\t@gold_png = 's...
[ "0.67805976", "0.65543413", "0.6352746", "0.6310992", "0.6133004", "0.6104049", "0.606157", "0.6055491", "0.60264593", "0.60078895", "0.5993942", "0.5944072", "0.58980614", "0.58975726", "0.58942705", "0.58785087", "0.58659905", "0.58598846", "0.58508444", "0.58469045", "0.58...
0.699369
0
Cuenta las inasistencias totales
def option2(arr_hash) puts 'Las inasistencias totales de los alumnos son: ' arr_hash.each { |alumno| inasistencias_totales(hash_data(alumno, :name), hash_data(alumno, :grades)) } inicio_programa(arr_hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcular_total\n\t\treturn calcular_seguro*calcular_incremento\n\tend", "def calculo_valor_calorico_total\n recorrido = lista_alimentos.head\n cantidad = lista_cantidades.head\n acumulador = 0\n\n while (recorrido != nil && cantidad != nil)\n acumulador = acumulador + (((recorrido....
[ "0.69926035", "0.6988486", "0.6920531", "0.68852174", "0.68231624", "0.68231624", "0.6731036", "0.66968334", "0.668657", "0.66741616", "0.6639668", "0.6624239", "0.66047686", "0.659393", "0.6579107", "0.65498877", "0.654282", "0.6540691", "0.6509796", "0.6476969", "0.6460747"...
0.0
-1
Muestra los alumnos aprobados
def option3(arr_hash) alumnos_aprobados(arr_hash) inicio_programa(arr_hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @many_alumnos_has_many_asignaturas = ManyAlumnosHasManyAsignatura.all\n end", "def index\r\n @alumnos = Alumno.all\r\n end", "def allize(collumns_for_all)\n arr = []\n for col in collumns_for_all\n arr << \"'all' as #{keyize_indices(col)}\"\n end\n arr\n end", ...
[ "0.62167495", "0.6086506", "0.6073866", "0.60677034", "0.60677034", "0.59576595", "0.5866888", "0.5858257", "0.5812589", "0.5792885", "0.5621031", "0.56011593", "0.5577481", "0.55686617", "0.5563846", "0.55476975", "0.5538983", "0.552243", "0.5511764", "0.5400654", "0.5357546...
0.0
-1
Finds available stemcell's pivotal network release. If it can not find the exact version it will try to find the newest minor version available.
def find_stemcell_release(version, product_name) version = OpsManager::Semver.new(version) releases = stemcell_releases(product_name).collect do |r| { release_id: r['id'], version: OpsManager::Semver.new(r['version']), } end releases.keep_if{ |r| r[:version].major == ve...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_version(i)\n p_data = package_info(i)\n\n # nothing is available\n return nil if p_data.empty?\n\n p_data[\"versions\"][\"stable\"]\n end", "def latest_version\n versions.reverse_each.detect do | version|\n version_dir = SERVER_TOP_DIR + \"r#{versi...
[ "0.6573786", "0.62902814", "0.6229245", "0.61691326", "0.6108327", "0.6001425", "0.5996839", "0.59775585", "0.59536284", "0.5938163", "0.59007305", "0.5893562", "0.5881578", "0.5856276", "0.58237386", "0.58209676", "0.5807132", "0.57981443", "0.57977843", "0.57977843", "0.577...
0.63033783
1
Finds stemcell's pivotal network release file.
def find_stemcell_file(release_id, filename, product_name) files = JSON.parse(get_product_release_files(product_name, release_id).body).fetch('product_files') file = files.select{ |r| r.fetch('aws_object_key') =~ filename }.first return file['id'], file['aws_object_key'].split('/')[-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_pre_version(pe_family)\n open(\"http://getpe.delivery.puppetlabs.net/latest/#{pe_family}\").read\nend", "def downloadable_versions\n base_url = 'https://www.drupal.org/node/3060/release?&page=%i'\n page_id = 0\n versions = {}\n\n loop do\n page = Nokogiri::HTML(Typhoeus.get(format(b...
[ "0.5466303", "0.53919554", "0.52974385", "0.5180031", "0.5160168", "0.5151116", "0.5148461", "0.5126564", "0.51044", "0.50119615", "0.50097615", "0.50012386", "0.49992272", "0.49852368", "0.49712107", "0.49593133", "0.49512166", "0.49438447", "0.49110225", "0.49072865", "0.48...
0.47828698
29
Lists all the available stemcells in the current installation_settings. Downloads those stemcells.
def download_current_stemcells print "====> Downloading existing stemcells ...".green puts "no stemcells found".green if list_current_stemcells.empty? FileUtils.mkdir_p current_stemcell_dir list_current_stemcells.each do |stemcell_info| stemcell_version = stemcell_info[:version] product_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_stemcell\n @stemcell_files << generate_image << generate_manifest << stemcell_files\n # package up files\n package_files\n end", "def get_linux_stemcells\n products = Uhuru::BoshCommander::Versioning::Product.get_products\n current_product = products[@form.product_name]\n ...
[ "0.54184824", "0.52364576", "0.523174", "0.510659", "0.5096291", "0.5096291", "0.5087863", "0.50584185", "0.5013222", "0.48274693", "0.47710752", "0.4753759", "0.47075772", "0.4703813", "0.4689438", "0.46883053", "0.46595067", "0.46590483", "0.4654627", "0.46483126", "0.46432...
0.714478
0
Given two integers, which can be positive and negative, find the sum of all the numbers between including them too and return it. If both numbers are equal return a or b. Note! a and b are not ordered! Example: get_sum(1, 0) == 1 1 + 0 = 1 get_sum(1, 2) == 3 1 + 2 = 3 get_sum(0, 1) == 1 0 + 1 = 1 get_sum(1, 1) == 1 1 S...
def get_sum(a, b) if a <= b (a..b).inject(:+) elsif a > b (b..a).inject(:+) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sum(a,b)\n return a if a == b\n \n result = 0\n min = a < b ? a : b\n max = min == a ? b : a\n num = min\n \n until num == max\n result += num\n num += 1\n end\n \n result + max\nend", "def get_sum(a,b)\n if a > b\n [ *b..a ].sum\n elsif a == b\n a\n else\n [ *a..b ].sum\n e...
[ "0.83638823", "0.8249392", "0.8224499", "0.812346", "0.798225", "0.7933601", "0.78388715", "0.78176653", "0.7774349", "0.7697954", "0.7651852", "0.76241356", "0.76202273", "0.7618988", "0.7524454", "0.7385495", "0.7348009", "0.7241848", "0.72383595", "0.7228995", "0.71149653"...
0.8127997
3
Creates an application instance, internal method should not be called directly
def initialize(name,belongs_to) @name = name @belongs_to = belongs_to @domain = belongs_to.domain @plant = belongs_to.plant @attributes = {} @child_of = [] @parent_of = [] @runtime_config = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_app()\n app = OpenShift::TestApplication.new(self)\n\n $logger.info(\"Created new application #{app.name} for account #{@name}\")\n\n @apps << app\n app\n end", "def application!\n res = get!(APPLICATION_PATH)\n build_application(res)\n end", "def app\n ...
[ "0.7957753", "0.7855332", "0.7372649", "0.72289824", "0.7192369", "0.71799994", "0.71602875", "0.71373564", "0.70843554", "0.7041473", "0.6985995", "0.69733995", "0.69645387", "0.69091654", "0.6894236", "0.67576593", "0.67547834", "0.6754336", "0.6729385", "0.6681143", "0.666...
0.0
-1
get the value of the specified attribute
def get_attribute(attribute) @attributes[attribute.intern] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_attribute_value(attribute)\n data[attribute]\n end", "def get_attribute(name); end", "def get_attribute(name); end", "def get attribute\n attributes[attribute]\n end", "def attribute_value\n @attributes.each { | id, value | return value }\n end", "def attribute_get(att...
[ "0.85570925", "0.8187953", "0.8187953", "0.8151835", "0.7904028", "0.7879643", "0.7879643", "0.7814706", "0.7716577", "0.77088404", "0.76954854", "0.7693259", "0.7661794", "0.7654702", "0.7634473", "0.7597522", "0.75958043", "0.7503999", "0.746209", "0.7457647", "0.7451752", ...
0.7359425
23
delete this application in the database (should never, ever, ever be called directly!)
def delete results = submit_cmd('delete app instance',:db, " -env #{self.belongs_to.env} -app_instance #{self.name}") if ( results.to_s =~ /failure/i || results.to_s =~ /error/i) raise "update attribute failed" else self.belongs_to.appTemplates.delete(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_application\n node.rm(new_resource.node_attribute, new_resource.resource_name, new_resource.name)\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def delete_appdata\n @restv9.delete_appdata(person_id, appId, field)\n end", "def destroy\n @appli...
[ "0.7541204", "0.7323859", "0.7305017", "0.72856545", "0.72856545", "0.7262328", "0.7209867", "0.71604496", "0.7123325", "0.69802326", "0.6959666", "0.67286557", "0.67165893", "0.67165893", "0.66581124", "0.6652044", "0.6617317", "0.6617004", "0.66068184", "0.6581012", "0.6514...
0.73186004
2
Set the value of this attribute to
def update_attribute(attribute, attribute_type, value) results = submit_cmd('update app attribute',:db, "-env #{self.belongs_to.env} \ -app_instance #{self.name} -attribute #{attribute} -attribute_type #{attribute_type} \ -new_value #{value}") if ( results.to_s =~ /failure/i || results.to_s =~ /error/i) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_attribute(name, value); end", "def []= (attr_name, value) \n write_attribute(attr_name, value)\n end", "def value=(value)\n `#{@element}.value = #{value}`\n end", "def set_attribute(name, value)\n @attributes[name] = value\n end", "def set(value)\n value\n ...
[ "0.77856386", "0.74548155", "0.73350424", "0.7320852", "0.7310635", "0.7273494", "0.7256475", "0.7202528", "0.71506864", "0.7131015", "0.7124583", "0.7122939", "0.7122939", "0.7122939", "0.7113047", "0.70843714", "0.7075997", "0.7075997", "0.7075997", "0.7049583", "0.7045451"...
0.0
-1
returns the number of attributes defined for this application
def number_of_attributes return self.attributes.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attribute_count\n product_family.product_attributes.size\n end", "def count\n @attributes['count']\n end", "def size\n @components.values.inject(0) { |component_count, attribute| component_count + attribute.size }\n end", "def num_attributes_remaining item_name\n num_attributes_use...
[ "0.73327047", "0.7146795", "0.71078897", "0.69466716", "0.6893424", "0.68892264", "0.67847717", "0.65072024", "0.6454203", "0.64475965", "0.64149845", "0.6341284", "0.62954736", "0.62891847", "0.6265576", "0.62422174", "0.6239663", "0.62337357", "0.62337357", "0.6198145", "0....
0.7902316
0
returns the prod id this application runs as
def get_prodid @attributes[:app_prod_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_identifier\n return @app_identifier\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def app_id\n @app.id\n end"...
[ "0.7202367", "0.7147439", "0.7147439", "0.7147439", "0.69586176", "0.6894444", "0.6836295", "0.6793796", "0.6746747", "0.6723997", "0.6715287", "0.6712769", "0.6712769", "0.6671075", "0.66198003", "0.65593004", "0.6555746", "0.64785326", "0.64785326", "0.6461677", "0.6397032"...
0.7727503
0
returns the schedule associated with this application
def schedule @attributes[:schedule].empty? ? nil : self.belongs_to.schedules.find { |schedule| schedule.name == @attributes[:schedule].intern } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule\n return @schedule\n end", "def schedule\n return @schedule\n end", "def schedule\n return @schedule\n end", "def schedule\n @schedule ||= all_schedules\n @schedule || {}\n end", "def schedule\n ...
[ "0.79876834", "0.79876834", "0.79876834", "0.7621987", "0.7141252", "0.69873625", "0.68246436", "0.6762104", "0.6689546", "0.66811895", "0.66487515", "0.65681356", "0.6521557", "0.64890236", "0.6479363", "0.64085406", "0.6365037", "0.63184905", "0.62948096", "0.6268651", "0.6...
0.6870718
6
gets all attributes defined for this application including inherited values
def get_aggregated_attributes self.attributes[:parents] = "" #self.attributes.each { |k,v| puts "#{k} ====> #{v}" } parent = self.attributes[:parent] #pp attributes return attributes if parent.empty? template = self.belongs_to.templates.find { |temp| temp.name.downcase ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attrs\r\n @attrs ||= Utils.deep_merge(@attributes, _package_.env)\r\n end", "def attributes\n self.class::ATTRIBUTES\n end", "def attributes\n load_attributes! unless attributes_loaded?\n @attributes.values\n end", "def get_attributes\n\t\t\t@@attributes\n\t\tend", "def att...
[ "0.7771168", "0.75244564", "0.72984225", "0.7263329", "0.7225788", "0.7117947", "0.71174234", "0.71128714", "0.71021485", "0.70890754", "0.7078022", "0.707608", "0.70699507", "0.7022069", "0.7013339", "0.7012872", "0.70121586", "0.6995316", "0.69768196", "0.69768196", "0.6976...
0.0
-1
From Gregorian Date To Julian
def gtojd(year, month, day) #if (year < 0) { year++; } // No year zero if ( year < 0 ) year = 1 end if ( month < 3 ) month = month + 12 year = year - 1 end a = (year / 100).floor b = 2 - a + (a / 4).floor return (365.25 * (year + 4716)).floor + (30.6001 * (month + 1)).floor + day + b - 1524....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def julian_date\r\n return Date.jd(@jd)\r\n end", "def julian(year, month, day)\n a = (14 - month) / 12\n y = year + 4800 - a\n m = (12 * a) - 3 + month\n day + (153 * m + 2) / 5 + (365 * y) + y / 4 - y / 100 + y / 400 - 32_045\nend", "def to_gregorian\n\t\tJalaliDate.to_gregorian(self.year,self.mo...
[ "0.79279107", "0.76938593", "0.73254925", "0.7197864", "0.69650114", "0.6944228", "0.69286346", "0.68875784", "0.68075854", "0.67578024", "0.6744676", "0.666729", "0.66166836", "0.65072954", "0.63508844", "0.63294584", "0.6284135", "0.6275324", "0.6256711", "0.6243531", "0.62...
0.6881212
8
=begin ======================================================================== Gregorian calendar Extra Functions ======================================================================== =end >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> => ADD DAYS TO HIJRI DATE >>>>>>>>>>>>>>>>>>>>>>>>>>>>...
def add_days(year, month, day , offest ) ### From Hijri to Julian to Gregorian date gd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i)) ### Add months to Gregorian date parsed_date = Date.new( gd[0] , gd[1] , gd[2]) gd_after_add = parsed_date + offest gd_after_add = gd_after_add.to_s(:db) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_months(year, month, day , offest )\n\n\n\t### From Hijri to Julian to Gregorian date \n\n\tgd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i))\n\n\t### Add months to Gregorian date \n\n\tparsed_date = Date.new( gd[0] , gd[1] , gd[2]) \n\n\tgd_after_add = parsed_date.months_since(offest)\n\n\tgd_...
[ "0.7011812", "0.695368", "0.6421926", "0.63676083", "0.6342619", "0.6208218", "0.60946715", "0.6023531", "0.59322894", "0.59256446", "0.58776754", "0.5857807", "0.58576417", "0.5812734", "0.57956076", "0.57807064", "0.5771532", "0.5716992", "0.5693833", "0.5693126", "0.567525...
0.77798903
0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> => ADD MONTHS TO HIJRI DATE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def add_months(year, month, day , offest ) ### From Hijri to Julian to Gregorian date gd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i)) ### Add months to Gregorian date parsed_date = Date.new( gd[0] , gd[1] , gd[2]) gd_after_add = parsed_date.months_since(offest) gd_after_add = gd_after_add...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_days(year, month, day , offest )\n\n\n\t### From Hijri to Julian to Gregorian date \n\n\tgd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i))\n\n\t### Add months to Gregorian date \n\n\tparsed_date = Date.new( gd[0] , gd[1] , gd[2]) \n\n\tgd_after_add = parsed_date + offest\n\n\tgd_after_add = gd...
[ "0.7009165", "0.70057875", "0.6562634", "0.65444237", "0.6542515", "0.6363295", "0.63614213", "0.6282797", "0.62519366", "0.62351805", "0.6224333", "0.6224333", "0.62065333", "0.62027466", "0.6200767", "0.611022", "0.5999948", "0.598395", "0.5974889", "0.59630954", "0.5959143...
0.7846728
0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> => ADD YEARS TO HIJRI DATE >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def add_years(year, month, day , offest ) ### From Hijri to Julian to Gregorian date gd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i)) ### Add months to Gregorian date parsed_date = Date.new( gd[0] , gd[1] , gd[2]) gd_after_add = parsed_date.years_since(offest) gd_after_add = gd_after_add.to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_months(year, month, day , offest )\n\n\n\t### From Hijri to Julian to Gregorian date \n\n\tgd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i))\n\n\t### Add months to Gregorian date \n\n\tparsed_date = Date.new( gd[0] , gd[1] , gd[2]) \n\n\tgd_after_add = parsed_date.months_since(offest)\n\n\tgd_...
[ "0.70875233", "0.7019228", "0.68567693", "0.685657", "0.6794096", "0.6741695", "0.67286307", "0.66846216", "0.66400045", "0.66265345", "0.65876245", "0.65841395", "0.655852", "0.65471244", "0.65360016", "0.65360016", "0.65210366", "0.64552176", "0.6377692", "0.63696957", "0.6...
0.8281336
0
========================================================================== ========================================================================== =begin ============================================================================================================ implimintation of the Islamic calendar ===============...
def fromjdtoislamic(jd) jd = (jd).floor + 0.5 year = ((30 * (jd - $jdepoch) + 10646) / 10631).floor #year = (year <= 0 ? year - 1 : year) if ( year < 0 ) year = -1 end month = [12, ((jd - 29 - islamictojd(year, 1, 1)) / 29.5).ceil + 1].min day = (jd - islamictojd(year, month, 1) + 1).to_i return year...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def julian\n # super doesn't call #new_start on MRI, so each method has to be\n # individually overridden.\n if_period(super) {|p,dt| dt.localize(p) }\n end", "def alt_to_calendar(date)\n y = to_calendar(gregorian_epoch - 1 + date + 306)\n prior_days = date - to_fixed(date(y - 1, ...
[ "0.6482773", "0.64393234", "0.62656677", "0.61639935", "0.6010647", "0.5963614", "0.59517866", "0.59479195", "0.59476715", "0.59230226", "0.5917577", "0.5884448", "0.5874637", "0.5821483", "0.56984234", "0.5672043", "0.56601745", "0.56219435", "0.56149304", "0.55729663", "0.5...
0.6790342
0
From Islamic Date To Julian
def islamictojd(year, month, day) # year = (year <= 0 ? year + 1 : year) if ( year < 0 ) year = 1 end return day + (29.5 * (month - 1)).ceil + (year - 1) * 354 + ((3 + (11 * year)) / 30).floor + $jdepoch - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def julian_date\r\n return Date.jd(@jd)\r\n end", "def fromjdtoislamic(jd)\n\n\tjd = (jd).floor + 0.5\n\n\tyear = ((30 * (jd - $jdepoch) + 10646) / 10631).floor\n\n\t#year = (year <= 0 ? year - 1 : year)\n\n\tif ( year < 0 )\n\n\t\tyear = -1\n\n\tend\n\n\tmonth = [12, ((jd - 29 - islamictojd(year, 1, 1))...
[ "0.7724647", "0.76442266", "0.74846387", "0.71903425", "0.70640755", "0.69494665", "0.6830001", "0.6740736", "0.6581133", "0.6479072", "0.6423818", "0.63752097", "0.63362706", "0.6308607", "0.6205208", "0.6141735", "0.6091918", "0.6022977", "0.6017443", "0.5932672", "0.592545...
0.66795135
8
GET /ative_posts def active_posts
def submitted_designs # binding.pry # @project = Project.where(customer: current_user).find(params[:project_id]) @designs = Design.all.where(designer: current_user).order("created_at DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @active_posts = current_user.feed.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end", "def index\n\t\t@user_posts = Post.where(user_id: current_user.id).where(active: true).order(\"created_at DESC\")\n\ten...
[ "0.7600453", "0.73417693", "0.718144", "0.7142953", "0.71000874", "0.7050047", "0.70362407", "0.7000563", "0.69858724", "0.69811755", "0.69626355", "0.69129366", "0.69079226", "0.6897981", "0.6893438", "0.687312", "0.68687564", "0.68641496", "0.68448776", "0.6818218", "0.6815...
0.0
-1
GET /designs GET /designs.json
def index @designs = Design.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @designs = Gooey::Design.all\n end", "def index\n @designs = if params[:sort]\n Design.liked\n elsif params[:body_style_id]\n BodyStyle.find(params[:body_style_id]).designs.ordered\n elsif params[:size_id]\n Size.find(params[:size_id]).designs.ordered\n elsif pa...
[ "0.71915877", "0.7082127", "0.7036977", "0.6999999", "0.67870545", "0.67200506", "0.6622444", "0.65901154", "0.6584385", "0.6458173", "0.64339393", "0.64290816", "0.63912576", "0.6367959", "0.6290534", "0.6217674", "0.62116694", "0.620829", "0.6160854", "0.61560166", "0.61558...
0.7312059
0
GET /designs/1 GET /designs/1.json
def show @project = @design.project_id @reviews = Review.where(design_id: @design.id).order("created_at DESC") if @reviews.blank? @avg_rating = 0 else @avg_rating = @reviews.average(:rating).round(2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @design = Design.find(params[:id])\n @products = @design.products\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @design }\n end\n end", "def show\n @designation = Designation.find(params[:id])\n\n respond_to do |format|\n format...
[ "0.7318025", "0.72523224", "0.72068346", "0.7141631", "0.71295923", "0.70239294", "0.7022185", "0.7020559", "0.70147604", "0.69668835", "0.6918521", "0.6889654", "0.6831653", "0.6769768", "0.65820444", "0.6568141", "0.65600145", "0.6535585", "0.65084535", "0.64890933", "0.648...
0.0
-1
POST /designs POST /designs.json
def create @design = Design.new(design_params) @project = Project.find(params[:project_id]) @customer = @project.user @design.project_id = @project.id @design.designer_id = current_user.id @design.customer_id = @customer.id respond_to do |format| if @design.save format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @design = Design.new(params[:design])\n\n respond_to do |format|\n if @design.save\n format.html { redirect_to @design, notice: 'Design has been created.' }\n format.json { render json: @design, status: :created, location: @design }\n else\n format.html { render ac...
[ "0.72317195", "0.6933088", "0.6721443", "0.66406214", "0.66395015", "0.654348", "0.6534082", "0.6446638", "0.6391002", "0.6347728", "0.6284102", "0.62818015", "0.6272894", "0.6245906", "0.62266135", "0.6170489", "0.6122016", "0.6081957", "0.6079205", "0.60773736", "0.60524344...
0.6700213
3
PATCH/PUT /designs/1 PATCH/PUT /designs/1.json
def update respond_to do |format| if @design.update(design_params) format.html { redirect_to submitted_designs_path, notice: 'Design was successfully updated.' } format.json { render :show, status: :ok, location: @design } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @design = Design.find(params[:id])\n\n respond_to do |format|\n if @design.update_attributes(params[:design])\n format.html { redirect_to @design, notice: 'Design has been updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\"...
[ "0.69812614", "0.6760781", "0.641263", "0.6362202", "0.63147026", "0.62872434", "0.61811787", "0.61499536", "0.61374766", "0.6125361", "0.59757733", "0.5968855", "0.5961473", "0.59581274", "0.5944275", "0.593769", "0.5917784", "0.59175736", "0.59150815", "0.5904845", "0.59005...
0.7047738
0
DELETE /designs/1 DELETE /designs/1.json
def destroy @design.destroy respond_to do |format| format.html { redirect_to designs_url, notice: 'Design was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @design = Design.find(params[:id])\n @design.destroy\n\n respond_to do |format|\n format.html { redirect_to designs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @design = Design.find(params[:id])\n\n @design.destroy\n respond_to do |format|\n...
[ "0.7926417", "0.7535582", "0.74774057", "0.73898387", "0.7311651", "0.73016614", "0.7273831", "0.7269348", "0.72202754", "0.7213529", "0.7189406", "0.71638614", "0.69974303", "0.69511163", "0.693869", "0.6903854", "0.6883466", "0.6881601", "0.6847351", "0.6836948", "0.6797703...
0.7727206
2
Use callbacks to share common setup or constraints between actions.
def set_design # @design = @project.designs.find(params[:id]) @design = Design.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
Gets API key (with prefix if set).
def api_key_with_prefix(param_name) if @api_key_prefix[param_name] "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" else @api_key[param_name] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_key_with_prefix(param_name, param_alias = nil)\n key = @api_key[param_name]\n key = @api_key.fetch(param_alias, key) unless param_alias.nil?\n if @api_key_prefix[param_name]\n \"#{@api_key_prefix[param_name]} #{key}\"\n else\n key\n end\n end", "def api_key_with_...
[ "0.705724", "0.705724", "0.70465815", "0.70063376", "0.6916332", "0.69047594", "0.67333835", "0.66778684", "0.6631652", "0.6619381", "0.66111404", "0.65910155", "0.6573876", "0.6562512", "0.6562512", "0.6492323", "0.64898425", "0.6428653", "0.6424521", "0.63998616", "0.639422...
0.7549068
11
Gets Basic Auth token string
def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_auth\n \"#{username}:#{access_token}\"\n end", "def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n To...
[ "0.8079147", "0.7480385", "0.7460489", "0.73848736", "0.7304212", "0.7288342", "0.72596633", "0.72588724", "0.7168906", "0.7120086", "0.7096467", "0.7084442", "0.7083038", "0.70716256", "0.7034056", "0.6997527", "0.69828045", "0.69747615", "0.6974652", "0.6949313", "0.6916151...
0.8764102
11
Returns Auth Settings hash for api client.
def auth_settings { 'api-key' => { type: 'api_key', in: 'header', key: 'api-key', value: api_key_with_prefix('api-key') }, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_settings\n {\n 'apikey' =>\n {\n type: 'api_key',\n in: 'header',\n key: 'api-key',\n value: api_key_with_prefix('api-key')\n },\n 'userid' =>\n {\n type: 'api_key',\n in: 'header',\n ...
[ "0.71406543", "0.7087326", "0.6954041", "0.687631", "0.68737316", "0.68737316", "0.68737316", "0.6814299", "0.679257", "0.6688857", "0.6636704", "0.66007525", "0.6592892", "0.6567032", "0.65302515", "0.6513404", "0.64813", "0.64549476", "0.64283437", "0.6419678", "0.64189315"...
0.70081425
2
GET /users/1 GET /users/1.json
def show require 'will_paginate/array' @user = User.find(params[:id]) @user_vital_signs = @user.vital_signs.last(5) @user_diagnostics = @user.diagnostics.last(5) @user_files = @user.single_files.last(5) @personal_cites = @user.doctor_cites.last(7) @other_cites = @user.cite_doctors.last(7) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81052274", "0.7701836", "0.77005506", "0.76248205", "0.75818425", "0.74804497", "0.7460003", "0.7446873", "0.7304538", "0.7298309", "0.72877806", "0.7276015", "0.7233492", "0.7231195", "0.7231195", "0.7231195", "0.7231195", "0.7231195", "0.7231195", "0.7231195", "0.722299"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
The conversions to farenheit
def Farenheit(intemp, inunit) if inunit == 'c' ((intemp * C_TO_F_CONVERSION1) + C_TO_F_CONVERSION2) elsif inunit == 'k' ((intemp * K_TO_F_CONVERSION1) - K_TO_F_CONVERSION2) elsif inunit == 'r' intemp - R_TO_F_CONVERSION end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_f() end", "def to_f() end", "def to_f() end", "def to_f() end", "def converters; end", "def converters; end", "def converters; end", "def convert!; end", "def convert\n end", "def convert\n end", "def farenheit\n self.to_f\n end", "def to_f; end", "def converter...
[ "0.7067686", "0.7067686", "0.7067686", "0.7067686", "0.68857753", "0.68857753", "0.68857753", "0.6808096", "0.67793584", "0.67793584", "0.6675385", "0.66528875", "0.6582663", "0.64289635", "0.622574", "0.622574", "0.622574", "0.62156814", "0.61547583", "0.61367774", "0.612739...
0.0
-1
The conversions to Celsius
def Celsius(intemp, inunit) if inunit == 'f' ((intemp - F_TO_C_CONVERSION1) / F_TO_C_CONVERSION2) elsif inunit == 'k' intemp - K_TO_C_CONVERSION elsif inunit == 'r' ((intemp - R_TO_C_CONVERSION1) / R_TO_C_CONVERSION2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_celcius(temp)\n temp - 273.15\n end", "def toCelsius\n\t\t\tcase @scale\n\t\t\t\twhen 'C'\n\t\t\t\t\tTemperature.new(@degrees, 'C')\n\t\t\t\twhen 'F'\n\t\t\t\t\tTemperature.new((@degrees - 32.0) * 5.0 / 9.0, 'C')\n\t\t\t\twhen 'K'\n\t\t\t\t\tTemperature.new(@degrees - 273.15, 'C')\n\t\t\tend\n\t\tend"...
[ "0.7893644", "0.78828806", "0.78807825", "0.77876896", "0.77876246", "0.7679484", "0.75787115", "0.7546798", "0.7546584", "0.75294596", "0.75204164", "0.7502656", "0.7480721", "0.747521", "0.7454268", "0.74289876", "0.7423706", "0.7401382", "0.73966867", "0.73856395", "0.7376...
0.77471757
5
The conversions to Kelvin
def Kelvin(intemp, inunit) if inunit == 'f' (((intemp - F_TO_K_CONVERSION1) / F_TO_K_CONVERSION2) + F_TO_K_CONVERSION3) elsif inunit == 'c' intemp + C_TO_K_CONVERSION elsif inunit == 'r' intemp / R_TO_K_CONVERSION end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertKelvin\r\n case self.myScale\r\n when 'F'\r\n self.myDegrees = (self.myDegrees + 459.67) * (5.0/9.0)\r\n self.myScale = 'K'\r\n when 'C'\r\n self.myDegrees = (self.myDegrees + 273.15)\r\n self.myScale = 'K'\r\n end\r\n end", "def to_kelvin(**options) ...
[ "0.7170498", "0.7013242", "0.6872378", "0.6731667", "0.6649416", "0.6394447", "0.6366707", "0.6333302", "0.6250785", "0.62404644", "0.6199706", "0.61678994", "0.61676985", "0.6124109", "0.6087797", "0.60845405", "0.60646176", "0.5986271", "0.5978453", "0.59211", "0.58946425",...
0.64217496
5
The conversions to Rankine
def Rankine(intemp, inunit) if inunit == 'c' ((intemp + C_TO_R_CONVERSION1) * C_TO_R_CONVERSION2) elsif inunit == 'k' intemp * K_TO_R_CONVERSION elsif inunit == 'f' intemp + F_TO_R_CONVERSION end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marines_rank; end", "def calc_rank\n return (self.score * 20001) + self.speaks;\n end", "def army_rank; end", "def reindeer_ranking\n\t\t\treindeer = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n\t\tend", "def navy_rank; end", ...
[ "0.6285587", "0.61195976", "0.6104832", "0.5980158", "0.59701717", "0.5949231", "0.59404486", "0.59404486", "0.59142846", "0.591029", "0.58544046", "0.58328193", "0.5767254", "0.5759545", "0.5758447", "0.57440084", "0.5735589", "0.5686305", "0.56786245", "0.56520164", "0.5651...
0.6504563
0
Returns the class of the correct database adapter according to the database engine that is used in Rails project.
def adapter_class case Utilities.adapter when "mysql2" Adapters::Mysql2Adapter when "postgresql" Adapters::PostgreSQLAdapter when "sqlite3" Adapters::SQLite3Adapter when "sqlserver" Adapters::SQLServerAdapter end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDatabaseType\n return ActiveRecord::Base.connection.adapter_name\n end", "def adapter_class\n @@adapters[configuration[:adapter]]\n end", "def adapter\n if ActiveRecord::VERSION::STRING.to_f >= 6.1\n ActiveRecord::Base.connection_db_config.adapter.to_s\n else\n ...
[ "0.77953947", "0.77262706", "0.77115315", "0.75845444", "0.73965883", "0.73669267", "0.7298285", "0.70373744", "0.6851592", "0.67980874", "0.66493684", "0.66485864", "0.6614668", "0.6613339", "0.65851724", "0.65514255", "0.65514255", "0.64844614", "0.64810145", "0.6467013", "...
0.8071764
0
GET /bundle_contents GET /bundle_contents.xml
def index @bundle_content_count = BundleContent.count respond_to do |format| format.html # index.html.erb format.xml { render :xml => @bundle_content_count } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bundle_content }\n end\n end", "def show\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bundle }\n end...
[ "0.7018721", "0.69331056", "0.6831111", "0.6831111", "0.6740203", "0.66175556", "0.66175556", "0.6597297", "0.6408129", "0.6401298", "0.628364", "0.6282546", "0.6251463", "0.6192973", "0.6192973", "0.6143703", "0.60036606", "0.60020924", "0.5939051", "0.5925504", "0.58995897"...
0.6124966
16
GET /bundle_contents/1 GET /bundle_contents/1.xml
def show respond_to do |format| format.html # show.html.erb format.xml { render :xml => @bundle_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bundle }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bundle_source }\n end\...
[ "0.6952154", "0.6742141", "0.66529", "0.66529", "0.6423599", "0.6423599", "0.636481", "0.63570684", "0.6253122", "0.619528", "0.61941504", "0.61727613", "0.611612", "0.5963034", "0.5899621", "0.5894157", "0.5863293", "0.5863293", "0.5845589", "0.5842665", "0.5814317", "0.57...
0.70726705
0
GET /bundle_contents/new GET /bundle_contents/new.xml
def new @bundle_content = BundleContent.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @bundle_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @bundle = Bundle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bundle }\n end\n end", "def new\n @bundle_source = BundleSource.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bun...
[ "0.75414026", "0.7196821", "0.7047043", "0.66968846", "0.66481054", "0.6580259", "0.64270806", "0.6383508", "0.6342166", "0.6322648", "0.6306355", "0.6200653", "0.6195014", "0.6180979", "0.6180979", "0.61605257", "0.61520034", "0.61480737", "0.6118393", "0.61094695", "0.60830...
0.7779071
0
POST /bundle_contents POST /bundle_contents.xml
def create @bundle_content = BundleContent.new(params[:bundle_content]) respond_to do |format| if @bundle_content.save flash[:notice] = 'BundleContent was successfully created.' format.html { redirect_to(@bundle_content) } format.xml { render :xml => @bundle_content, :status => :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bundle = Bundle.new(params[:bundle])\n\n respond_to do |format|\n if @bundle.save\n flash[:notice] = 'Bundle was successfully created.'\n format.html { redirect_to(@bundle) }\n format.xml { render :xml => @bundle, :status => :created, :location => @bundle }\n els...
[ "0.62662345", "0.6228811", "0.60253954", "0.59880584", "0.5863903", "0.5805749", "0.5632719", "0.5625647", "0.56168896", "0.5560602", "0.5515095", "0.5494979", "0.5488322", "0.5472773", "0.5472773", "0.54696506", "0.5381783", "0.5381783", "0.5346209", "0.5318285", "0.53164864...
0.6642678
0
PUT /bundle_contents/1 PUT /bundle_contents/1.xml
def update respond_to do |format| if @bundle_content.update_attributes(params[:bundle_content]) flash[:notice] = 'BundleContent was successfully updated.' format.html { redirect_to(@bundle_content) } format.xml { head :ok } else format.html { render :action => "edit" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n flash[:notice] = 'Bundle was successfully updated.'\n format.html { redirect_to(@bundle) }\n format.xml { head :ok }\n else\n format.html { rende...
[ "0.6465385", "0.6465385", "0.60694915", "0.6064947", "0.591812", "0.5776274", "0.5762025", "0.5688693", "0.56609946", "0.5564111", "0.55256736", "0.54832584", "0.5407231", "0.5404294", "0.5363712", "0.5363712", "0.53506243", "0.5334326", "0.53305286", "0.5290279", "0.5271305"...
0.67055905
0
DELETE /bundle_contents/1 DELETE /bundle_contents/1.xml
def destroy @bundle_content = BundleContent.find(params[:id]) @bundle_content.destroy respond_to do |format| format.html { redirect_to(bundle_contents_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_bundle(bundle)\n args = [\"bundle=#{u(bundle)}\"]\n get('tags/bundles/delete?' << args.join('&amp;'))\n nil\n end", "def destroy\n @bundle = Bundle.find(params[:id])\n @bundle.destroy\n\n respond_to do |format|\n format.html { redirect_to(bundles_url) }\n format.xml { hea...
[ "0.7340575", "0.72725785", "0.71852833", "0.6920183", "0.68173504", "0.6709485", "0.6706878", "0.65120703", "0.6367527", "0.63430554", "0.6131635", "0.6128175", "0.6128175", "0.61097383", "0.6107466", "0.60963553", "0.60924643", "0.60752136", "0.6071668", "0.604896", "0.60477...
0.7746153
0
easily add enhancements to an existing object layer features atop one another to construct exactly what you need layer features on to a basic object drawbacks: using or building/assembling all these classes into a working w whole i.e. client has to pull of the pieces together also, performance overhead of long chain of...
def SimpleWriter def initialize(path) @file = File.open(path, 'w') end def write_line(line) @file.print(line) @file.print("\n") end def pos @file.pos end def rewind @file.rewind end def close @file.close end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_subclass_or_interface(params)\n defaults = {:template => \"InheritingClass\", :method_base => \"all\", :method_include => \"\", :method_exclude => \"\", :force => false, :implements => \"\"}\n params = defaults.merge(params)\n params[:package] = verify_package unless params[:package]\n\n class_des...
[ "0.5500819", "0.53850645", "0.53683", "0.5253966", "0.52136797", "0.5189421", "0.51690865", "0.51658714", "0.51608706", "0.51573086", "0.5151949", "0.5136203", "0.51233494", "0.511577", "0.50842416", "0.5051823", "0.5026923", "0.5020396", "0.501451", "0.49980813", "0.49953765...
0.0
-1
Initialize `BundledAsset` from serialized `Hash`.
def init_with(environment, coder) super @source = coder['source'] @required_assets = coder['required_paths'].map { |p| unless environment.paths.detect { |path| p[path] } raise UnserializeError, "#{p} isn't in paths" end p == filename ? self : environment.find_asset...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(hash)\n load_hash(hash)\n end", "def initialize(raw_hash)\n if valid_hash?(raw_hash)\n self.replace(raw_hash)\n @version, @cost, @salt, @checksum = split_hash(self)\n else\n raise Errors::InvalidHash.new(\"invalid hash\")\n end\n end", "def initiali...
[ "0.6443309", "0.63599694", "0.6359671", "0.63287413", "0.6095904", "0.59708863", "0.596549", "0.5888991", "0.5858999", "0.58425695", "0.58136624", "0.5810027", "0.5774983", "0.575685", "0.574934", "0.5688595", "0.56548744", "0.5602559", "0.559363", "0.5573234", "0.5535529", ...
0.5314537
46
Serialize custom attributes in `BundledAsset`.
def encode_with(coder) super coder['source'] = source coder['required_paths'] = required_assets.map(&:filename) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def to_json(*args)\n JSON.generate @_attributes.me...
[ "0.6573945", "0.6573945", "0.6573945", "0.6573945", "0.6573945", "0.62224764", "0.59653074", "0.5953586", "0.5924423", "0.59192586", "0.5882968", "0.5848555", "0.57554984", "0.57508904", "0.57508904", "0.5575753", "0.5534854", "0.5519011", "0.5506419", "0.54828835", "0.548288...
0.5245242
35
GET /grapes or /grapes.json
def index @grapes = Grape.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_A...
[ "0.6138411", "0.6109479", "0.60958165", "0.6059693", "0.5904892", "0.5900623", "0.5843975", "0.58153427", "0.5809394", "0.5780578", "0.5758832", "0.5751191", "0.57501817", "0.57302386", "0.57283694", "0.56946886", "0.56896806", "0.56865245", "0.56811315", "0.56591237", "0.565...
0.71752334
0
GET /grapes/1 or /grapes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @grapes = Grape.all\n end", "def show\n @gig = Gig.find(params[:id])\n\n respond_to do |format|\n format.html {render json: @gig, status: :ok}\n format.json { render json: @gig, status: :ok }\n end\n end", "def show\n @glass = Glass.find(params[:id])\n\n respond_to do ...
[ "0.65902317", "0.6302508", "0.61344075", "0.59524524", "0.5922133", "0.5918559", "0.5909713", "0.59029007", "0.5897034", "0.5829215", "0.5802528", "0.57911783", "0.57896763", "0.5782973", "0.57682896", "0.57570285", "0.57523304", "0.5734307", "0.5720773", "0.57098985", "0.570...
0.0
-1
POST /grapes or /grapes.json
def create @grape = Grape.new(grape_params) respond_to do |format| if @grape.save format.html { redirect_to @grape, notice: "Grape was successfully created." } format.json { render :show, status: :created, location: @grape } else format.html { render :new, status: :unprocess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grape_params\n params.require(:grape).permit(:name)\n end", "def create\n @grape = Composition.new(grape_params)\n @grape.grapename = Grape.find( params[ :grapename ] )\n respond_to do |format|\n if @grape.save\n format.html { redirect_to @grape, notice: 'Composition was successf...
[ "0.6101632", "0.60215867", "0.6012148", "0.59001887", "0.58238375", "0.58191615", "0.5778064", "0.5758887", "0.5758593", "0.5753627", "0.572875", "0.56747234", "0.5672303", "0.5662736", "0.5630953", "0.5626785", "0.5582119", "0.5574188", "0.55468464", "0.55431545", "0.5531499...
0.71740437
0
PATCH/PUT /grapes/1 or /grapes/1.json
def update respond_to do |format| if @grape.update(grape_params) format.html { redirect_to @grape, notice: "Grape was successfully updated." } format.json { render :show, status: :ok, location: @grape } else format.html { render :edit, status: :unprocessable_entity } form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @grape.update(grape_params)\n format.html { redirect_to @grape, notice: 'Composition was successfully updated.' }\n format.json { render :show, status: :ok, location: @grape }\n else\n format.html { render :edit }\n format.json { ren...
[ "0.6878418", "0.6351392", "0.6165217", "0.6101806", "0.60023004", "0.5969243", "0.5963122", "0.59552944", "0.5893613", "0.5888596", "0.58856624", "0.58515024", "0.58204377", "0.5794302", "0.5776777", "0.5768189", "0.5759436", "0.57546717", "0.574569", "0.5745271", "0.5734869"...
0.7126125
0
DELETE /grapes/1 or /grapes/1.json
def destroy @grape.destroy respond_to do |format| format.html { redirect_to grapes_url, notice: "Grape was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @gig = Gig.fin...
[ "0.6640924", "0.6536969", "0.6475701", "0.6443999", "0.64242816", "0.64242816", "0.6401473", "0.63998914", "0.63998914", "0.6395488", "0.63945425", "0.63806224", "0.63726294", "0.63679075", "0.6355783", "0.63538754", "0.6352299", "0.63505536", "0.6347187", "0.63231546", "0.63...
0.6946856
0
Use callbacks to share common setup or constraints between actions.
def set_grape @grape = Grape.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def grape_params params.require(:grape).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /games GET /games.json
def index @games = Game.all.page(params[:page]).per(10) # @games = Game.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n render json: @games\n end", "def index\n @games = current_user.games\n \n respond_to do |format|...
[ "0.801388", "0.7969819", "0.7854131", "0.7795904", "0.77952725", "0.77952725", "0.77952725", "0.7618289", "0.75276613", "0.74230546", "0.74158394", "0.7390365", "0.73540944", "0.7318076", "0.72921306", "0.7247407", "0.7209582", "0.7190768", "0.7177297", "0.7177297", "0.717729...
0.0
-1
GET /games/1 GET /games/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end", "def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end", "def index\n @games = Game.all\n render json: @...
[ "0.7778303", "0.7749944", "0.77346104", "0.7597316", "0.75970954", "0.75970954", "0.75970954", "0.7543423", "0.74728286", "0.74728286", "0.74728286", "0.74728286", "0.74728286", "0.74728286", "0.74728286", "0.74291676", "0.7405018", "0.73962075", "0.73376346", "0.73351246", "...
0.0
-1
POST /games POST /games.json
def create @game = Game.new(game_params) respond_to do |format| if @game.save format.html { redirect_to @game, notice: 'Game was successfully created.' } format.json { render :show, status: :ok, location: game_url(@game, format: :json) } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end", "def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end", "def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end", "def...
[ "0.7666801", "0.75520563", "0.7413892", "0.70869124", "0.7075019", "0.70485115", "0.70426613", "0.7039214", "0.702508", "0.702508", "0.702508", "0.702508", "0.702508", "0.6992957", "0.69471335", "0.6937076", "0.69172454", "0.6903971", "0.6903971", "0.6903971", "0.6903971", ...
0.702803
8
PATCH/PUT /games/1 PATCH/PUT /games/1.json
def update respond_to do |format| if @game.update(game_params) format.html { redirect_to @game, notice: 'Game was successfully updated.' } format.json { render :show, status: :ok, location: game_url(@game, format: :json) } else format.html { render :edit } format.json { r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end", "def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n ...
[ "0.7157309", "0.7029037", "0.70235133", "0.7022238", "0.70219064", "0.70219064", "0.70219064", "0.70219064", "0.70219064", "0.70219064", "0.70219064", "0.699033", "0.6979274", "0.69443756", "0.6894251", "0.68479854", "0.68479854", "0.68479854", "0.6822679", "0.6814825", "0.68...
0.6737359
25
DELETE /games/1 DELETE /games/1.json
def destroy @game.destroy respond_to do |format| format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end", "d...
[ "0.7731453", "0.7710896", "0.7656178", "0.7650335", "0.7650335", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.7646082", "0.75746906", "0.75746906", "0.75746906", "0.75746906",...
0.72737855
65
Use callbacks to share common setup or constraints between actions.
def set_game @game = Game.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 game_params params.require(:game).permit(:date, :white_id, :black_id, :movetext) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1