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
Enable watching of css files in Sass 3.3+
def watched_directories [File.dirname(archive_file)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sass\n Dir[\"#{RAILS_ROOT}/public/stylesheets/sass/**/*.sass\"]\n end", "def sass_files\n [\n styles_scss, components_scss, pages_scss\n ].flatten!\n end", "def css_to_scss\n Proc.new {|task| task.sub(/^#{CSS_DIR}/, SASS_DIR).\n sub(/\\.c...
[ "0.64912426", "0.6056147", "0.60549134", "0.5970292", "0.5957853", "0.5919863", "0.5919863", "0.5875404", "0.58700407", "0.58250546", "0.5756323", "0.57425994", "0.57360333", "0.5714035", "0.56939477", "0.5683122", "0.56240606", "0.56196827", "0.55729693", "0.5562775", "0.553...
0.0
-1
Enable watching of css files in Sass 3.3+
def watched_file?(file) archive_file == file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sass\n Dir[\"#{RAILS_ROOT}/public/stylesheets/sass/**/*.sass\"]\n end", "def sass_files\n [\n styles_scss, components_scss, pages_scss\n ].flatten!\n end", "def css_to_scss\n Proc.new {|task| task.sub(/^#{CSS_DIR}/, SASS_DIR).\n sub(/\\.c...
[ "0.64912426", "0.6056147", "0.60549134", "0.5970292", "0.5957853", "0.5919863", "0.5919863", "0.5875404", "0.58700407", "0.58250546", "0.5756323", "0.57425994", "0.57360333", "0.5714035", "0.56939477", "0.5683122", "0.56240606", "0.56196827", "0.55729693", "0.5562775", "0.553...
0.0
-1
== gmt_time_from_svn_time == convert svn format times like this: "20080702 10:40:26 0400 (Wed, 02 Jul 2008)" to a GMT format like this: "Wed, 02 Jul 2008 14:40:26 GMT"
def gmt_time_from_svn_time(svn_time) iso8601_time = "#{svn_time[/(.*) -/, 1].gsub(/ /, 'T')}" Time.xmlschema(iso8601_time).gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svn_date(a_time)\n a_time.strftime(\"%Y-%m-%d\")\nend", "def inspect\n if @_st_is_gmt\n strftime(\"%a %b %d %H:%M:%S UTC %Y\")\n else\n strftime(\"%a %b %d %H:%M:%S %z %Y\")\n end\n end", "def google_to_time(dt)\n d = elems[0].content.split('.')\n t = elems[2].content.split(':')\...
[ "0.61431205", "0.603435", "0.5878294", "0.580913", "0.5724064", "0.5708641", "0.56496286", "0.5649507", "0.56436497", "0.56110203", "0.559933", "0.5540888", "0.5503406", "0.5480621", "0.5463068", "0.54244", "0.5401585", "0.53903794", "0.5376057", "0.53631073", "0.5341571", ...
0.8890314
0
GET /transactions or /transactions.json
def index @transactions = Transaction.all @owntransactions = Transaction.where(user: current_user).order(date: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n...
[ "0.7443072", "0.7412816", "0.73257065", "0.7260952", "0.72357196", "0.72271377", "0.7176918", "0.7161287", "0.7145566", "0.7099763", "0.7083526", "0.7083526", "0.7083526", "0.7077574", "0.7057022", "0.7012143", "0.6979211", "0.6975017", "0.69650924", "0.6944728", "0.69018155"...
0.0
-1
POST /transactions or /transactions.json
def create @transaction = Transaction.new(transaction_params.merge(user_id: current_user.id)) @transaction.groups << Group.where(id: params[:transaction][:group_ids]) respond_to do |format| if @transaction.save format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' } format.json { render :show, status: :created, location: @transaction } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @transaction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.succe...
[ "0.7087685", "0.7076234", "0.7045395", "0.7007328", "0.6948236", "0.6933985", "0.690057", "0.68533885", "0.6781453", "0.67718816", "0.67703694", "0.6764475", "0.67454666", "0.6737669", "0.6729105", "0.67147774", "0.6710319", "0.6710273", "0.6699146", "0.6677388", "0.66676146"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_transaction @transaction = Transaction.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 transaction_params params.require(:transaction).permit(:name, :amount, :date, :group_ids) 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.6950644", "0.68134046", "0.68034387", "0.6796522", "0.674668", "0.6742105", "0.6527854", "0.65214247", "0.6491907", "0.64294493", "0.64294493", "0.64294493", "0.64004904", "0.6356768", "0.63556653", "0.6348119", "0.6344521", "0.63386923", "0.632588", "0.632588", "0.632588"...
0.0
-1
Report progress on object
def progress(_object) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress(object)\n reporter.progress(object)\n end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def indicate_progress\n end", "def progressable; end", "def progress_mark; end", "def progress\n data.progress\n en...
[ "0.8604498", "0.75670207", "0.75670207", "0.75670207", "0.75670207", "0.75670207", "0.7191726", "0.711232", "0.7026493", "0.68502414", "0.670864", "0.670864", "0.670864", "0.670864", "0.65755165", "0.64679164", "0.6450984", "0.6400881", "0.63445646", "0.63321525", "0.6274677"...
0.7809453
1
This is tricky because we often don't have an :id
def show_city_cache a = "cities/#{params[:id]}/buses/#{params[:buses]}/sell_locations/#{params[:sell_locations]}" #a = {city_domain: (params[:id] || request.host), buses: params[:buses]} #a = {id: (params[:id] || request.host), buses: params[:buses]} L.l a a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; 1; end", "def id; 1; end", "def id\n #NOOP\n end", "def id\n key?(:id) ? ...
[ "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.67228305", "0.66253126", "0.6622684", "0.656023", "0.65573955", "0.653105", "0.650574", "0.650574", "0.6500587", "0.650...
0.0
-1
def redirect_to_user_city if params[:redirect] and user_city return redirect_to city_url(user_city) end end
def collection @city ||= end_of_association_chain.ordered.visible end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"teams\"\n return (tournament_path(@tournament) + '/control/t...
[ "0.6844658", "0.68416417", "0.68363196", "0.6830071", "0.6822103", "0.65143234", "0.6478576", "0.64067507", "0.6383761", "0.6354633", "0.6353494", "0.6351806", "0.6340754", "0.63127124", "0.62580705", "0.62419176", "0.6209978", "0.61982346", "0.6175846", "0.6175812", "0.61650...
0.0
-1
def create_stripe_customer_and_subscription(user) begin s_customer = Stripe::Customer.create(description: user.first_name, card: self.stripe_card_token,email: user.email) stripe_customer = StripeCustomer.create(object: s_customer.object, description: s_customer.description, livemode: s_customer.livemode, created_timestamp: s_customer.created, reference_id: s_customer.id, user_id: self.user_id) customer = Stripe::Customer.retrieve(stripe_customer.reference_id) user.plan_name = "school_closing" user.plan = "daily" if user.plan_name == "school_closing" && user.plan == "daily"
def create_stripe_customer_and_subscription(user) begin s_customer = Stripe::Customer.create(description: user.first_name, card: self.stripe_card_token, email: user.email) stripe_customer = StripeCustomer.create(object: s_customer.object, description: s_customer.description, livemode: s_customer.livemode, created_timestamp: s_customer.created, reference_id: s_customer.id, user_id: self.user_id) customer = Stripe::Customer.retrieve(stripe_customer.reference_id) if user.plan_name == "school_closing_date" && user.plan == "daily" stripe_charge = Stripe::Charge.create(amount: stripe_charge_amount(user), currency: "usd", customer: s_customer.id, description: "school_closing daily") user.stripe_charges.create(amount: stripe_charge_amount(user), currency: "usd", description: "test", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "school_closing_date" && user.plan == "all_days" stripe_charge = Stripe::Charge.create(amount: stripe_all_dates, currency: "usd", customer: s_customer.id, description: "school_closing all days") user.stripe_charges.create(amount: stripe_all_dates, currency: "usd", description: "test", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "christmas_break" && user.plan == "daily" stripe_charge = Stripe::Charge.create(amount: stripe_charge_amount(user), currency: "usd", customer: s_customer.id, description: "xmas daily") user.stripe_charges.create(amount: stripe_charge_amount(user), currency: "usd", description: "test", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "christmas_break" && user.plan == "all_days" stripe_charge = Stripe::Charge.create(amount: stripe_all_dates, currency: "usd", customer: s_customer.id, description: "Xmas all days") user.stripe_charges.create(amount: stripe_all_dates, currency: "usd", description: "test", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "spring_break" && user.plan == "daily" stripe_charge = Stripe::Charge.create(amount: stripe_charge_amount(user), currency: "usd", customer: s_customer.id, description: "spring break daily") user.stripe_charges.create(amount: stripe_charge_amount(user), currency: "usd", description: "test", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "spring_break" && user.plan == "all_days" stripe_charge = Stripe::Charge.create(amount: stripe_all_dates, currency: "usd", customer: s_customer.id, description: "spring break all days") user.stripe_charges.create(amount: stripe_all_dates, currency: "usd", description: "test", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "charlotte" || user.plan_name == "noresmen_cheer" stripe_charge = Stripe::Charge.create(amount: stripe_football_amount(user), currency: "usd", customer: s_customer.id, description: "Charge For Charlotte") user.stripe_charges.create(amount: stripe_football_amount(user), currency: "usd", description: "Charlotte", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "eden" || user.plan_name == "noresmen_cheer" stripe_charge = Stripe::Charge.create(amount: stripe_football_amount(user), currency: "usd", customer: s_customer.id, description: "Charge for Eden") user.stripe_charges.create(amount: stripe_football_amount(user), currency: "usd", description: "Eden", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "early_bird" || user.plan_name == "norsemen_baseball" stripe_charge = Stripe::Charge.create(amount: stripe_early_bird_amount(user), currency: "usd", customer: s_customer.id, description: "EarlyBird") user.stripe_charges.create(amount: stripe_early_bird_amount(user), currency: "usd", description: "EarlyBird", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "wffull" || user.plan_name == "norsemen_baseball" stripe_charge = Stripe::Charge.create(amount: stripe_wffull_amount(user), currency: "usd", customer: s_customer.id, description: "WFF FULL DAY") user.stripe_charges.create(amount: stripe_wffull_amount(user), currency: "usd", description: "WFF FULL", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "wffhalf" || user.plan_name == "norsemen_baseball" stripe_charge = Stripe::Charge.create(amount: stripe_wffhalf_amount(user), currency: "usd", customer: s_customer.id, description: "WFF HALF DAY") user.stripe_charges.create(amount: stripe_wffhalf_amount(user), currency: "usd", description: "WFF HALF DAY", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "nonfull" || user.plan_name == "norsemen_baseball" stripe_charge = Stripe::Charge.create(amount: stripe_nonfull_amount(user), currency: "usd", customer: s_customer.id, description: "NON FULL DAY") user.stripe_charges.create(amount: stripe_nonfull_amount(user), currency: "usd", description: "NON FULL DAY", stripe_customer_id: stripe_customer.id) elsif user.plan_name == "nonhalf" || user.plan_name == "norsemen_baseball" stripe_charge = Stripe::Charge.create(amount: stripe_nonhalf_amount(user), currency: "usd", customer: s_customer.id, description: "NON HALF DAY") user.stripe_charges.create(amount: stripe_nonhalf_amount(user), currency: "usd", description: "NON HALF DAY", stripe_customer_id: stripe_customer.id) else subscription = customer.subscriptions.create(:plan => payment_discount(user.plan_name)) user.subscriptions.create(stripe_card_token: subscription.id,plan_name: user.plan_name, stripe_customer_id: stripe_customer.id) end rescue Exception => e end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_subscription\n subscription = nil\n stripe_call do\n local_plan = Plan.active.find(@params[:user][:plan_id])\n return false if local_plan.nil?\n stripe_plan = Stripe::Plan.retrieve(local_plan.stripe_id)\n # If the plan has a trial time, it does not need a stripe token to create...
[ "0.83613765", "0.80776757", "0.79620606", "0.7779643", "0.7761049", "0.7604115", "0.7592157", "0.7577827", "0.7418572", "0.73387593", "0.73232806", "0.7311995", "0.7234095", "0.7183505", "0.7140108", "0.71277213", "0.71089906", "0.7086396", "0.7049056", "0.70337427", "0.70319...
0.9548224
0
Install it with npm: [sudo] npm install g coffeescript Made by vifino
def coffee2js(code) rnd= ('a'..'z').to_a.shuffle[0,8].join #`rm /tmp/coffee_#{rnd}` `touch /tmp/coffee_#{rnd}` f=File.open "/tmp/coffee_#{rnd}","w" f.write code f.close `cat /tmp/coffee_#{rnd}|coffee -sc` # "Compiled" coffee to js will be the output. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install\n system \"npm\", \"install\", *Language::Node.std_npm_install_args(libexec)\n bin.install_symlink Dir[\"#{libexec}/bin/*\"]\n end", "def install\n # use the brew python to install the tools needed\n\t system 'python', 'setup.py', 'install', \"--prefix=#{prefix}\", \"--single-v...
[ "0.6885274", "0.6599684", "0.6522166", "0.6515433", "0.6275377", "0.61697507", "0.6096878", "0.60889095", "0.60748416", "0.5964661", "0.5959926", "0.5956359", "0.59429735", "0.5935445", "0.5935445", "0.59329337", "0.59195817", "0.5863067", "0.58555865", "0.58367836", "0.58143...
0.0
-1
=begin :type key: String :type value: String :type timestamp: Integer :rtype: Void =end
def set(key, value, timestamp) @hsh[key] ||= [] @hsh[key].push([timestamp,@hsh[key].size,value]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(key, value, timestamp)\n \n end", "def get(key, timestamp)\n \n end", "def store_value(timestamp, key, value)\n # Prepend the timestamp so we always have unique values\n @redis.zadd(key, timestamp, \"#{timestamp}:#{value}\")\n end", "def set(key, value, timestamp)\n ...
[ "0.80480254", "0.7648041", "0.7131937", "0.6966894", "0.677983", "0.6768092", "0.6584001", "0.6584001", "0.6525296", "0.6518228", "0.65154606", "0.64961565", "0.6417395", "0.63634115", "0.6337941", "0.63169295", "0.6286665", "0.6286665", "0.623505", "0.619658", "0.6186998", ...
0.6617729
6
=begin :type key: String :type timestamp: Integer :rtype: String =end
def get(key, timestamp) arr = @hsh[key] return "" if !arr return "" if arr.first.first > timestamp return arr.last.last if arr.last.first <= timestamp x = arr.bsearch{|t,i,v| t >= timestamp} # First bigger. return "" if x.nil? t,i,v = x if t == timestamp return v else return arr[i-1].last end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(key, timestamp)\n \n end", "def get(key, timestamp)\n return '' if @store[key].nil?\n i = 0\n j = @store[key].length - 1\n m = (i + j) / 2\n while (i <= j) && (j <= @store[key].length - 1) do \n # puts \"i: #{i}, j: #{j}\"\n if @store...
[ "0.78394634", "0.70397204", "0.69467634", "0.67399794", "0.655543", "0.64912677", "0.6460094", "0.6278678", "0.6264092", "0.62239176", "0.62239176", "0.6190828", "0.6190828", "0.6178889", "0.61422026", "0.61422026", "0.61422026", "0.61422026", "0.61422026", "0.61422026", "0.6...
0.694835
2
GET /categories "all advertisements in the category"
def index @categories = Category.all @categories= @categories.sort_by(&:name) render json: @categories end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def categories\n get('venues/categories').categories\n end", "def index\n @advert_categori...
[ "0.78865355", "0.7352067", "0.7311059", "0.7246737", "0.7189263", "0.71399206", "0.7097851", "0.70647323", "0.70603335", "0.70387626", "0.69973594", "0.6979806", "0.69761777", "0.69743955", "0.693767", "0.69174725", "0.69130194", "0.6911639", "0.69047415", "0.68779814", "0.68...
0.0
-1
class methods instance methods initialize method
def initialize(context) super() self.context = context end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize() end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize\n initialize!\n end", "def initialize\n initialize!\n end", "def initialize; end", "def initialize; end", "def init...
[ "0.82564896", "0.8202973", "0.8202973", "0.8202973", "0.8202973", "0.8202973", "0.80120236", "0.80120236", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.79311764", "0.7930983", "0...
0.0
-1
_render block unexpected buffer
def block_buffer(&block) yield if block_given? BLOCK_BUFFER end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(&block) #:nodoc:\r\n instance_eval(&block)\r\n @output_buffer\r\n end", "def render(*args, &block); end", "def render(view, locals, buffer = T.unsafe(nil), add_to_stack: T.unsafe(nil), &block); end", "def _normalize_render(*args, &block); end", "def render\n Vedeu::Outp...
[ "0.7453929", "0.7367175", "0.7225749", "0.7118685", "0.6730538", "0.6686253", "0.6686253", "0.6682767", "0.6678505", "0.6669066", "0.66539896", "0.65539575", "0.6536578", "0.6517802", "0.6517802", "0.6517802", "0.6517802", "0.6517802", "0.651706", "0.6512232", "0.6497809", ...
0.58988816
78
default html data attibutes
def default_data_options {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attributes_options(options)\n html_options = options.stringify_keys!\n self.default_options = {'data-role' => \"listview\", 'data-inset' => \"true\"}\n\n if html_options.has_key?('data-inset')\n self.default_options = default_options.merge({'data-inset' => html_options['data-...
[ "0.70313257", "0.6939268", "0.6818195", "0.68017846", "0.679742", "0.662264", "0.6415896", "0.63660353", "0.6246983", "0.6195075", "0.61855924", "0.61466837", "0.61261845", "0.60938406", "0.60472393", "0.5954473", "0.5951727", "0.5950902", "0.59246325", "0.5887383", "0.587354...
0.5955073
15
Returns the model's tag name if a tag is present.
def tag @model.tag.name if @model.tag end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_name\n return @tag_name\n end", "def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end", "def _tag_name\n @tag_name\n end", "def name\n tag.name\n end", "def tagname\n @tagname.id2name\n end", "def get_tag tag_key_name\n self.tags.joins...
[ "0.7175416", "0.69203454", "0.69119096", "0.68352187", "0.669863", "0.6691768", "0.6591063", "0.6476076", "0.6425442", "0.6395256", "0.6395256", "0.6395256", "0.63854146", "0.6367306", "0.63272464", "0.63196164", "0.6310441", "0.6260948", "0.625725", "0.6234924", "0.62084365"...
0.85167044
0
Sets the model's tag to an existing tag if it exists. Otherwise, creates a new tag.
def tag=(new_tag_name) new_tag=Tag.find_by(name: new_tag_name) if new_tag @model.tag=new_tag else @model.create_tag(name: new_tag_name) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_tag\n begin\n @tag = Tag.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @tag = Tag.find_by(tag_id: params[:id]) || raise(ActiveRecord::RecordNotFound.new)\n end\n end", "def add_tag!(tag)\r\n tag = add_tag(tag)\r\n tag.save\r\n end", "def au...
[ "0.7068598", "0.69793516", "0.6872561", "0.6822214", "0.67420423", "0.6709795", "0.6709795", "0.66916066", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "0.66914046", "...
0.75253075
0
sd = start_date, ed= end_date
def between_dates(sd, es) return true if sd <= self.start_date && es >= self.end_date return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_start_end_dates\n esdate and eedate\n end", "def dates\n start_s = start_date ? start_date.to_s : '?'\n end_s = end_date ? end_date.to_s : '?'\n \"#{start_s} to #{end_s}\"\n end", "def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"ha...
[ "0.77219456", "0.6832269", "0.67910236", "0.6703548", "0.6696157", "0.66875243", "0.6660278", "0.6639319", "0.655972", "0.6543052", "0.6486184", "0.64834934", "0.64624894", "0.64533526", "0.64481366", "0.64407444", "0.6438758", "0.6430943", "0.6428673", "0.64265454", "0.64193...
0.73781955
1
new is either called by the user clicking login or by the authorize before_filter (due to forced shunting of dtu users).
def new unless can? :login, User render(:file => 'public/401', :format => :html, :status => :unauthorized) and return end case when params[:only_dtu] logger.info "Overriding shunt cookie with value from params. Using DTU CAS" session[:only_dtu] = true when params[:public] logger.info "Overriding shunt cookie with value from params. Using local user" session[:public] = true when cookies[:shunt] == 'dtu' logger.info "Shunt cookie set to 'dtu'. Shunting directly to DTU CAS" session[:only_dtu] = true when cookies[:shunt_hint] == 'dtu' logger.info "Shunt hint cookie set to 'dtu'. Shunting with hint to DTU CAS" session[:prefer_dtu] = true when current_user.campus? && !current_user.walk_in? logger.info "Campus request. Shunting with hint to DTU CAS" session[:prefer_dtu] = true end # store given return url in session also, since omniauth-cas in # test mode does not pass url parameter back to sessions_controller#create url = session[:return_url] = params[:url] || '/' redirect_to "#{omniauth_path(:cas)}?#{{ :url => url }.to_query }" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n # If someone is already logged in, skip this step\n login(current_user) and return if logged_in?\n end", "def new\n __log_activity\n __debug_route\n @item = new_record\n user_authorize!\n rescue => error\n failure_status(error)\n end", "def show\n # Authorizing that onl...
[ "0.717691", "0.71701044", "0.70711446", "0.69672555", "0.6827384", "0.6819191", "0.6819191", "0.68006086", "0.6777822", "0.6741721", "0.6735178", "0.67319906", "0.6706283", "0.6703787", "0.6666447", "0.66441965", "0.6634656", "0.66270345", "0.66067564", "0.66027606", "0.65904...
0.6620625
18
setup is called by omniauth before the request phase. We utilize it to setup extra query parameters to Riyosha in the CAS request based on the session
def setup case when session.delete(:only_dtu) request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user' when session.delete(:prefer_dtu) request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user' when session.delete(:public) request.env['omniauth.strategy'].options[:login_url] = '/login?template=local_user' else request.env['omniauth.strategy'].options[:login_url] = '/login' end render :text => "Omniauth setup phase.", :status => 404 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth ...
[ "0.6736953", "0.66431063", "0.63550097", "0.6313256", "0.6263293", "0.61272126", "0.6119854", "0.6036167", "0.60351026", "0.6029177", "0.60249346", "0.59695566", "0.5963112", "0.5878977", "0.5873779", "0.5833347", "0.5813837", "0.578987", "0.578693", "0.5783089", "0.5768267",...
0.61245316
6
Riyosha redirects the user to create upon succesful login (since omniauthcas is configured with create as callback_url).
def create unless can? :login, User render(:file => 'public/401', :format => :html, :status => :unauthorized) and return end # extract authentication data auth = request.env["omniauth.auth"] provider = params['provider'] identifier = auth.uid # try to sync user data from user database # if sync fails # - use cached user_data if it exists # - otherwise fail login user_data = Riyosha.find(identifier) if user_data user = User.create_or_update_with_user_data(provider, user_data) session[:user_id] = user.id else user = User.find_by_provider_and_identifier(provider, identifier) if user session[:user_id] = user.id logger.warn "Could not get user data from Riyosha. Using cached data for user with identifier #{identifier}." else logger.error "Could not get user data from Riyosha and could therefore not create new user. Login failed." redirect_to params[:url] || root_path, :alert => 'Login failed. We apologize for the inconvenience. Please try again later.' and return end end # Make CanCan re-initialize abilities based on new user id @current_ability = nil # Save session search history current_user.searches << searches_from_history current_user.save # Set shunting cookies cookies.permanent[:shunt] = cookies.permanent[:shunt_hint] = user.user_data["authenticator"] unless current_user.walk_in? # redirect user to the requested url session_return_url = session.delete(:return_url) redirect_to params[:url] || session_return_url || root_path, :notice => 'You are now logged in' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_from_omniauth\n auth_hash = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_uid(auth_hash[\"provider\"], auth_hash[\"uid\"]) || Authentication.create_with_omniauth(auth_hash)\n\n # if: previously already logged in with OAuth\n if authenti...
[ "0.71605223", "0.70857066", "0.7009876", "0.6943294", "0.693119", "0.6834771", "0.6822586", "0.68205875", "0.6799796", "0.6797928", "0.679365", "0.67695785", "0.6751467", "0.6749682", "0.6710988", "0.67022943", "0.66953963", "0.6666064", "0.6660519", "0.66413015", "0.66280806...
0.69779634
3
GET /pessoas GET /pessoas.json
def index @cliente = Clienteempresa.where(empresa_id: current_user.empresa_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {...
[ "0.7387573", "0.73654187", "0.72759485", "0.7222796", "0.7139148", "0.70332515", "0.70289993", "0.69802135", "0.6959833", "0.6948439", "0.6947057", "0.69234544", "0.6918215", "0.69053686", "0.68207294", "0.68110824", "0.6733631", "0.67322695", "0.67213917", "0.669133", "0.669...
0.0
-1
GET /pessoas/1 GET /pessoas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {...
[ "0.7616914", "0.7605932", "0.73462224", "0.7248876", "0.7076793", "0.7014455", "0.6997127", "0.6997127", "0.691861", "0.6878145", "0.6858194", "0.6856384", "0.6830739", "0.6820469", "0.6818778", "0.68159974", "0.68159974", "0.68044615", "0.6778125", "0.6777232", "0.67763954",...
0.0
-1
POST /pessoas POST /pessoas.json
def create if params[:cliente_id] == "" @pessoa = Pessoa.new(pessoa_params) if params[:senha] == "" @password = SecureRandom.random_number(99999999) else @password = params[:senha] end @user = User.new @user.email = @pessoa.email @user.password = @password @user.password_confirmation = @password if current_user.id == 1 @user.empresa_id = current_user.empresa_id #@user.role = "ADMIN" else @user.empresa_id = 1 #@user.role = "USER" end @user.role = "USER" respond_to do |format| if @pessoa.save #criando usuário @user.pessoa_id = @pessoa.id if @user.save Userinfo.send_email(@user,current_user.empresa.nome_empresa).deliver end #relacionando usuário com empresa Clienteempresa.create(:empresa_id => current_user.empresa_id, :pessoa_id => @pessoa.id) format.html { redirect_to @pessoa, notice: 'Cadastro realizado com sucesso!.' } format.json { render :show, status: :created, location: @pessoa } else format.html { render :new } format.json { render json: @pessoa.errors, status: :unprocessable_entity } end end else Clienteempresa.create(:empresa_id => current_user.empresa_id, :pessoa_id => params[:cliente_id]) respond_to do |format| format.html { redirect_to pessoas_url, notice: 'Cadastro realizado com sucesso!' } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirec...
[ "0.7089397", "0.7042876", "0.70071715", "0.699476", "0.6932317", "0.6914089", "0.6873405", "0.68388647", "0.6769829", "0.67177093", "0.67110264", "0.6698779", "0.66812253", "0.6641314", "0.66333777", "0.6627719", "0.6608695", "0.6599225", "0.6590115", "0.6571456", "0.65704614...
0.0
-1
PATCH/PUT /pessoas/1 PATCH/PUT /pessoas/1.json
def update respond_to do |format| if @pessoa.update(pessoa_params) format.html { redirect_to @pessoa, notice: 'Cadastro alterado com sucesso!.' } format.json { render :show, status: :ok, location: @pessoa } else format.html { render :edit } format.json { render json: @pessoa.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render actio...
[ "0.69056123", "0.6770499", "0.6701876", "0.66376215", "0.6611621", "0.6592055", "0.6566299", "0.6496665", "0.6478969", "0.64550555", "0.64524204", "0.6430414", "0.6430275", "0.64165235", "0.6402418", "0.63850635", "0.6384151", "0.6380684", "0.63727236", "0.63695145", "0.63663...
0.6745924
2
DELETE /pessoas/1 DELETE /pessoas/1.json
def destroy @pessoa.destroy respond_to do |format| format.html { redirect_to pessoas_url, notice: 'Registro deletado com sucesso!.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to pessoas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueb...
[ "0.75959617", "0.7577778", "0.7525122", "0.74744433", "0.7373033", "0.7326529", "0.73216206", "0.73159456", "0.73159456", "0.7297888", "0.72847253", "0.7280789", "0.72759295", "0.726857", "0.7226427", "0.72175115", "0.72116655", "0.72099775", "0.71974933", "0.71956444", "0.71...
0.736696
5
Use callbacks to share common setup or constraints between actions.
def set_pessoa @pessoa = Pessoa.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pessoa_params params.require(:pessoa).permit(:nome_primeiro, :nome_sobrenome, :cpf, :data_nascimento, :email, :sexo, :codigo_cliente, endereco_attributes: [:id, :endereco, :complemento, :desc_cep, :cidade_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
def test_edit_set only works if there is a set to edit get '/sets/temp_set/edit' assert_equal 200, last_response.status assert_includes last_response.body, 'Save' assert_includes last_response.body, 'form' end
def test_public_sets set_names = File.readlines('data/set_names.txt') set_names.each_with_index do |name, index| get "/sets/public/#{index}" assert_equal 200, last_response.status assert_includes last_response.body, name assert_includes last_response.body, 'Study' assert_includes last_response.body, 'table' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_get_edit\n get :edit, :id => 107\n assert_response :success\n end", "def test_edit\n\n # Try editing without logging in.\n get(:edit, {:id => subsections( :subsection_01_1_1).id }, {})\n assert_redirected_to(:controller => 'user', :action => 'login')\n\n # Try editing from a no...
[ "0.72538406", "0.7156685", "0.706248", "0.6941224", "0.6919599", "0.67562914", "0.67562914", "0.67412114", "0.67276", "0.67269933", "0.6702522", "0.66471887", "0.6642055", "0.66251284", "0.660565", "0.65889037", "0.6584264", "0.6564579", "0.65137774", "0.6513738", "0.6501875"...
0.6869906
5
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil....
[ "0.76497203", "0.76497203", "0.76497203", "0.76497203", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7356452", "0.7334807", "0.72685325", "0.7238964", "0.7231359", "0.72258264", "0.7208294", "0.71760833" ]
0.7170241
84
Check to see if the all the properties in the model are valid
def valid? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :...
[ "0.78992486", "0.78992486", "0.70971805", "0.70782334", "0.7032205", "0.7031276", "0.69510347", "0.6869891", "0.6858077", "0.6858077", "0.68287027", "0.6823878", "0.6820306", "0.68144894", "0.6794656", "0.6752167", "0.66843414", "0.6676546", "0.6667755", "0.66296124", "0.6618...
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && allow_3rd_party_billing == o.allow_3rd_party_billing && allow_cod == o.allow_cod && allow_purchase_order == o.allow_purchase_order && billing_addresses == o.billing_addresses && credit_cards == o.credit_cards && customer_profile_oid == o.customer_profile_oid && dhl_account_number == o.dhl_account_number && dhl_duty_account_number == o.dhl_duty_account_number && email == o.email && fedex_account_number == o.fedex_account_number && free_shipping == o.free_shipping && free_shipping_minimum == o.free_shipping_minimum && maximum_item_count == o.maximum_item_count && minimum_item_count == o.minimum_item_count && minimum_subtotal == o.minimum_subtotal && no_coupons == o.no_coupons && no_free_shipping == o.no_free_shipping && no_realtime_charge == o.no_realtime_charge && pricing_tiers == o.pricing_tiers && shipping_addresses == o.shipping_addresses && signup_dts == o.signup_dts && tax_exempt == o.tax_exempt && ups_account_number == o.ups_account_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en...
[ "0.72932124", "0.7189842", "0.70406866", "0.7007727", "0.68881786", "0.68621296", "0.67085785", "0.66622394", "0.661674", "0.6586541", "0.65844727", "0.65818226", "0.65561724", "0.6545535", "0.6508076", "0.64813215", "0.64577025", "0.64179385", "0.6414028", "0.6414028", "0.64...
0.0
-1
Calculates hash code according to all attributes.
def hash [allow_3rd_party_billing, allow_cod, allow_purchase_order, billing_addresses, credit_cards, customer_profile_oid, dhl_account_number, dhl_duty_account_number, email, fedex_account_number, free_shipping, free_shipping_minimum, maximum_item_count, minimum_item_count, minimum_subtotal, no_coupons, no_free_shipping, no_realtime_charge, pricing_tiers, shipping_addresses, signup_dts, tax_exempt, ups_account_number].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ...
[ "0.7118691", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.68960655", "0.67847186", "0.6707762", "0.670052", "0.6688737", "0.66705376", "0.6489735", "0.6462376", "0.6462376", "0.64444333", "0.6413127", "0.6395483", "0.638...
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ...
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.666...
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = UltracartClient.const_get(type).new temp_model.build_from_hash(value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s...
[ "0.7330926", "0.7274019", "0.72504056", "0.7245751", "0.7218884", "0.7213926", "0.71909", "0.7183136", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71796805", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71791923", "0.71...
0.72291344
12
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "de...
[ "0.901102", "0.8951408", "0.847116", "0.83399886", "0.8337297", "0.8337297", "0.8332112", "0.82551175", "0.8145114", "0.8143849", "0.8134524", "0.8126343", "0.8092803", "0.80863005", "0.8072428", "0.80386686", "0.80304825", "0.80054814", "0.80054814", "0.80054814", "0.8005481...
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.84283537", "0.8347048", "0.8347048" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n ...
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916",...
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @va...
[ "0.6719518", "0.6719518", "0.666832", "0.66565555", "0.6586841", "0.6452931", "0.6414911", "0.6414911", "0.6382046", "0.6346188", "0.6302933", "0.62237245", "0.6151989", "0.6101756", "0.60795677", "0.60795677", "0.60717124", "0.6035991", "0.6021168", "0.5936472", "0.5903488",...
0.0
-1
Create a new userhashtag link. Create the hashtag if it doesn't exist
def create if session[:user] @userhashtag = Userhashtag.new() @userhashtag.user_id = session[:user].id #Strip the '#' if the user put it hashtag_name = params[:userhashtag][:name] if hashtag_name[0] == '#' hashtag_name[0] = '' end #Get the hashtag ID from the name, create if doesn't exist @hashtag = Hashtag.find(:first, conditions:["name = ?",hashtag_name]) if (!@hashtag) h = Hashtag.new() h.name = params[:userhashtag][:name] h.save #Now get the hashtag @hashtag = Hashtag.find(:first, conditions:["name = ?",hashtag_name]) end @userhashtag.hashtag_id = @hashtag.id @userhashtag.save #Set the name of the new element @userhashtag.name = params[:userhashtag][:name] @userhashtag["name"] = params[:userhashtag][:name] render json: @userhashtag, status: :created #render json: @post, status: :created #redirect_to :back end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @message_hashtag = MessageHashtag.new(message_hashtag_params)\n\n respond_to do |format|\n if @message_hashtag.save\n format.html { redirect_to @message_hashtag, notice: 'Message hashtag was successfully created.' }\n format.json { render :show, status: :created, location: @me...
[ "0.6276606", "0.6202676", "0.61001676", "0.59725183", "0.596226", "0.5920033", "0.58886516", "0.5843941", "0.5832488", "0.57839763", "0.577944", "0.5753665", "0.57100356", "0.56897473", "0.5648748", "0.5622995", "0.5612145", "0.56117785", "0.559029", "0.5563605", "0.5550096",...
0.71317446
0
Destroy the userhashtag link.
def destroy if session[:user] logger.debug "Poop: #{params[:id]}" @userhashtag = Userhashtag.find(params[:id]) #Verify that the user isn't sneaky and tried to delete someone else's hashtag if @userhashtag.user_id == session[:user].id @userhashtag.destroy render json: @userhashtag end else render json: {} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @message_hashtag.destroy\n respond_to do |format|\n format.html { redirect_to message_hashtags_url, notice: 'Message hashtag was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = UserLink.find(params[:id])\n @link.destroy\n\...
[ "0.7061887", "0.7016479", "0.67993236", "0.67949414", "0.6739025", "0.6663333", "0.6637318", "0.65807587", "0.65647125", "0.6560475", "0.6554314", "0.65458584", "0.6525744", "0.6525666", "0.6525666", "0.6523783", "0.65194356", "0.65089685", "0.6502533", "0.64780736", "0.64586...
0.7819325
0
Converts CamelCase words into snake_case
def underscore(camel_cased_word) camel_cased_word.to_s.gsub(/::/, '/'). gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2'). tr("-", "_").downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z])([A-Z])/, '\\1_\\2').\n downcase\n end", "def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n ...
[ "0.8538748", "0.8510148", "0.8333288", "0.8276699", "0.82509327", "0.8115528", "0.8103241", "0.805762", "0.80227685", "0.7968855", "0.79246783", "0.78807634", "0.7871423", "0.786908", "0.7819258", "0.780358", "0.7781939", "0.775939", "0.7758842", "0.775335", "0.77234906", "...
0.0
-1
Only allow a trusted parameter "white list" through.
def task_params params.require(:task).permit(:desc, :time, :user_id, :category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Initializa End Adding tenant Method
def add_tenant tenant # Tenant Validation if tenant.credit_rating == "Bad" p "WARNING: Tenant #{tenant.name} has a BAD credit rating" elsif @apt_tenants.size > @apt_bed p "WARNING: Apartment is full" else @apt_tenants << tenant p "Tenant: #{tenant.name} is added to #{@apt_number}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n account.switch do\n create_defaults\n fillin_translations\n add_initial_users\n schedule_recurring_jobs\n true\n end\n end\n end", "def create_tenant!\n Apartmen...
[ "0.7362397", "0.71767366", "0.71449375", "0.69816566", "0.6948081", "0.6908528", "0.69024235", "0.68754977", "0.6847186", "0.6847186", "0.6847186", "0.6847186", "0.6847186", "0.6847186", "0.6787493", "0.6751198", "0.6698958", "0.66185606", "0.6581966", "0.6577646", "0.6560567...
0.72995454
1
Add Tenant End Removing a Tenant
def remove_tenant tenant # Checking if Tenant exsists & Removing a Tenant @apt_tenants.each do |i| p "#{tenant.name} has been removed from apartment #{@apt_number}" @apt_tenants.delete_if{|obj| obj.name == tenant.name} if @apt_tenants.include? 'i' == false p "No Such Tenant found" else end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tenant tenant\n if tenant.to_s == tenant #this is matching the tenant, you could also do tenant.class = \"String\"\n index = @tenants.index { |t| t.name == tenant}\n if index.nil?\n not_found = true\n else\n @tenants.delete_at_index\n end\n else\n deleted = @...
[ "0.68750405", "0.677303", "0.66688025", "0.6382738", "0.62778544", "0.61788285", "0.61788285", "0.61681247", "0.6162323", "0.6139494", "0.61336184", "0.61287415", "0.6107667", "0.60380083", "0.60336614", "0.60230404", "0.60229886", "0.60229886", "0.60229886", "0.60229886", "0...
0.6792177
1
Remove Tanent End Removing all Tenants
def remove_all_tenants @apt_tenants.clear end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_endings(words)\n without_endings = []\n words.each do |word|\n without_endings << delete_ending(word)\n end\n\n without_endings\n end", "def remove_tenant tenant\n\n # Checking if Tenant exsists & Removing a Tenant\n @apt_tenants.each do |i|\n p \"#{tenant.name} has be...
[ "0.5913725", "0.5794198", "0.57462716", "0.5727242", "0.5651412", "0.55635625", "0.5450321", "0.54101455", "0.5331219", "0.53170764", "0.53120434", "0.52626944", "0.52606344", "0.52599806", "0.52569854", "0.52429855", "0.5203306", "0.5200003", "0.51658964", "0.51571745", "0.5...
0.6031212
0
calculating average credit rating
def average_credit_score #Validation if @apt_tenants.size <= 0 p "No Tenants!" else #Isolating credit Scores every_credit = self.apt_tenants.map { |i| i.credit_score } #Summing total, then dividing by arr size average_credit = every_credit.reduce(:+) / every_credit.size #passing to class instance @apt_avg_c = average_credit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_rating\n sum = 0\n self.ratings.each do |rating|\n sum += rating.score\n end\n avg = sum/self.ratings.length\n avg.to_f\n end", "def average_rating\n \ttotal_score = 0\n \tnum_of_ratings = self.ratings.count\n \tself.ratings.each do |rating|\n \t\ttotal_score += rating.overal...
[ "0.7896761", "0.78927726", "0.7869654", "0.78171885", "0.78170496", "0.78020513", "0.7753853", "0.7751833", "0.774462", "0.773833", "0.76897085", "0.76746", "0.76614314", "0.7647812", "0.7638108", "0.7589248", "0.75538844", "0.75538844", "0.751805", "0.75172794", "0.7513618",...
0.75685805
16
average_credit_score ends apartment credit rating
def apartment_credit_rating #Run Rate Credit therating = rate_credit @apt_avg_c #Pass results to model @apt_c_rating = therating end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average_credit_score\n @tenants.inject{ |sum, t| sum + t.credit_score }.to_f / @tenants.size\n end", "def average_credit_score\n\n #Validation\n if @apt_tenants.size <= 0\n p \"No Tenants!\"\n else\n #Isolating credit Scores\n every_credit = self.apt_tenants.map { |i| i.credit_sco...
[ "0.77737933", "0.77653176", "0.7504421", "0.73262286", "0.7214694", "0.7189772", "0.68438995", "0.671789", "0.669527", "0.6686515", "0.6658387", "0.6647913", "0.66439736", "0.66366506", "0.6558271", "0.6540636", "0.6531642", "0.6530246", "0.6506144", "0.6443557", "0.6440802",...
0.6695157
9
GET /varietywines GET /varietywines.json
def index @varietywines = Varietywine.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end", "def index\n @wine_varieties = WineVariety.all\n end", "def index\n @varieties = Variety.all\n\n respond_to do |format|\n ...
[ "0.68413544", "0.6764539", "0.6636776", "0.6258745", "0.6257708", "0.6160771", "0.61144173", "0.60796636", "0.60672235", "0.60672235", "0.6063725", "0.60499007", "0.60467", "0.6041673", "0.60164225", "0.60097885", "0.60019594", "0.5997341", "0.5968229", "0.59652334", "0.59638...
0.7008238
0
GET /varietywines/1 GET /varietywines/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @variety }\n end\n end", "def index\n @varietywines = Varietywine.all\n end", "def index\n @varieties = Variety.all\n\n respond_to do |format|\n ...
[ "0.7168075", "0.68508166", "0.66351855", "0.6612036", "0.65247285", "0.64998865", "0.6366099", "0.6282597", "0.6232104", "0.6217918", "0.6194829", "0.6163426", "0.61350125", "0.61146665", "0.6109532", "0.6105179", "0.6096924", "0.60830396", "0.60740215", "0.6067888", "0.60493...
0.0
-1
POST /varietywines POST /varietywines.json
def create @varietywine = Varietywine.new(varietywine_params) respond_to do |format| if @varietywine.save format.html { redirect_to @varietywine, notice: 'Сорт вина успешно создан.' } format.json { render :show, status: :created, location: @varietywine } else format.html { render :new } format.json { render json: @varietywine.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wine_variety = WineVariety.new(wine_variety_params)\n\n respond_to do |format|\n if @wine_variety.save\n format.html { redirect_to @wine_variety, notice: \"Wine variety was successfully created.\" }\n format.json { render :show, status: :created, location: @wine_variety }\n ...
[ "0.70168585", "0.6558002", "0.634559", "0.62436247", "0.6240683", "0.6120161", "0.60094005", "0.5961578", "0.59249496", "0.5904131", "0.59041035", "0.582339", "0.5781194", "0.5768096", "0.5765113", "0.57627124", "0.56880206", "0.56782246", "0.56782246", "0.5673275", "0.566164...
0.6889664
1
PATCH/PUT /varietywines/1 PATCH/PUT /varietywines/1.json
def update respond_to do |format| if @varietywine.update(varietywine_params) format.html { redirect_to @varietywine, notice: 'Сорт вина успешно изменен.' } format.json { render :show, status: :ok, location: @varietywine } else format.html { render :edit } format.json { render json: @varietywine.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @variety = Variety.find(params[:id])\n\n respond_to do |format|\n if @variety.update_attributes(params[:variety])\n format.html { redirect_to varieties_path, notice: \"#{@variety.name} fue editada exitosamente.\" }\n format.json { head :no_content }\n else\n format...
[ "0.6773086", "0.6761199", "0.665296", "0.6434668", "0.62807226", "0.6183346", "0.6055935", "0.60461706", "0.60333604", "0.6010276", "0.60008746", "0.59948", "0.59894156", "0.59771764", "0.5968626", "0.59674877", "0.5958009", "0.59564215", "0.5940687", "0.59325504", "0.593139"...
0.6614275
3
DELETE /varietywines/1 DELETE /varietywines/1.json
def destroy @varietywine.destroy respond_to do |format| format.html { redirect_to varietywines_url, notice: 'Сорт вина успешно удален.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @variety = Variety.find(params[:id])\n @variety.destroy\n\n respond_to do |format|\n format.html { redirect_to varieties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wine_variety.destroy\n respond_to do |format|\n format.html { redirect_to...
[ "0.7149215", "0.7103098", "0.69729066", "0.69283015", "0.68396616", "0.6832204", "0.6773126", "0.6759269", "0.6757947", "0.6755335", "0.6755335", "0.6710257", "0.67088175", "0.67017597", "0.669993", "0.66856974", "0.66772956", "0.66488045", "0.66441053", "0.66403", "0.6637773...
0.715729
0
Use callbacks to share common setup or constraints between actions.
def set_varietywine @varietywine = Varietywine.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def varietywine_params params.require(:varietywine).permit(:name, :type_of_wine, :color, :aging_in_barrels, :aging_in_bottles, {relationships_attributes: [:_destroy, :id, :ratio, :grapesort_id, {grapesort_attributes: [:destroy, :id, :name, :place_of_production, :date_of_collection]} ]} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
set the volume of the audio resource to value between 0 and 1
def volume=(vol) `#{@sound}.volume = #{vol}` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def music_volume=(value)\n return unless value.between?(0, 100)\n @music_volume = Audio.music_volume = value\n end", "def sound_volume(value)\n @ole.SoundVolume = value\n nil\n end", "def music_volume=(value)\n value = value.to_i.abs\n @music_volume = value < 101 ? value : 100\n...
[ "0.8131661", "0.7935762", "0.7846314", "0.7821399", "0.76464224", "0.7587407", "0.7165034", "0.70305187", "0.69783235", "0.6925852", "0.69167805", "0.6750622", "0.6718642", "0.6671523", "0.663774", "0.663774", "0.65343374", "0.6513619", "0.6461154", "0.6461154", "0.6449806", ...
0.7966775
1
retrieve the current volume of the audio resource
def volume `#{@sound}.volume` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume\n app.speakers.ID(@id).volume.get\n end", "def music_volume\n return @music_volume\n end", "def get_volume\n @volume\n end", "def sound_volume\n @ole.SoundVolume\n end", "def volume; property('volume'); end", "def volume; self.class.volume; end", "def volume\n ...
[ "0.8180773", "0.80607337", "0.80332917", "0.7998777", "0.74877846", "0.7463108", "0.74621826", "0.74368846", "0.73177254", "0.709422", "0.68999285", "0.6895582", "0.6848924", "0.68354607", "0.6809705", "0.6801501", "0.67704874", "0.6693433", "0.6636842", "0.6629667", "0.66196...
0.80826336
1
play the audio resource in the window/tab it was created in if resource was paused, it will start playing from where it left off
def play @sound += 1 @sound %= @overlap `#{@sounds[@sound]}.play()` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\n @playing = true\n Audio.play_wav(@audio)\n @playing = false\n end", "def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end", "def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n ...
[ "0.70804715", "0.671021", "0.6582193", "0.6479036", "0.64304394", "0.6428696", "0.6427691", "0.6422184", "0.63908917", "0.6360171", "0.63428414", "0.63428414", "0.6326327", "0.6319302", "0.63063884", "0.62868285", "0.62850004", "0.6265815", "0.62504923", "0.6238803", "0.62284...
0.6788529
1
pause the audio resource, halting playback
def pause `#{@sound}.pause()` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause\n @av_player.pause unless @av_player.nil?\n end", "def unpause\n @paused -= 1\n end", "def halt!\n @running = false\n @audio.stop_audio\n @hardware_interface.teardown\n end", "def raw_pause\n raw_stop\n end", "def raw_pause\n raw_stop\n end", "def pause\n ...
[ "0.7457411", "0.6960166", "0.69552326", "0.68442154", "0.68442154", "0.68277365", "0.68277365", "0.66823995", "0.6662362", "0.65733254", "0.6567936", "0.6562065", "0.65563726", "0.64941883", "0.6483311", "0.6475135", "0.63849986", "0.62451845", "0.6225041", "0.6206136", "0.61...
0.72891754
1
seek to particular time in playback. Time passed is in seconds.
def time=(time) `#{@sound}.currentTime = #{time}` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seek_to_time(seconds)\n return unless running?\n info \"SEEK TO: #{seconds} seconds\"\n send_command :seek, seconds, 1\n end", "def seek(seconds) \n\t\tsynchronized do\n\t\t\t@vlc.puts \"seek #{seconds}\"\n\t\tend\n\tend", "def test_seek_at_time\n #no sample must have a later logical time\...
[ "0.7677366", "0.7034081", "0.69024414", "0.6260969", "0.62163687", "0.6206402", "0.6150778", "0.61135364", "0.6071782", "0.6019617", "0.6005099", "0.59362286", "0.5934305", "0.5929551", "0.5906692", "0.58487296", "0.58487296", "0.5836787", "0.5740131", "0.572487", "0.57192945...
0.6313878
3
This works for both local tables and hub entity sets
def local_field_values(original_entity, properties, field, aggregate) if !original_entity.group_by || original_entity.group_by == field return properties[field] end entity = original_entity.clone properties.each do |name, value| entity.eq(name, value) end entity.field_values(field, aggregate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entities; end", "def entity_sets\n entity_container.entity_sets\n end", "def entity_sets\n entity_container.entity_sets\n end", "def entity_sets\n entity_container.entity_sets\n end", "def entities_list\n raise 'Not implemented'\n end", "def orm; end", "def entities\...
[ "0.62440723", "0.59533656", "0.59533656", "0.59533656", "0.5934569", "0.5597538", "0.558282", "0.558282", "0.554475", "0.54997355", "0.54861546", "0.54861546", "0.54723126", "0.54640734", "0.5457723", "0.5449984", "0.5442124", "0.5442119", "0.54413325", "0.5439179", "0.542444...
0.0
-1
GET /eventmembers GET /eventmembers.json def index
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members }\n end\n end", "def index\n @members = Member.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @members ...
[ "0.72409046", "0.72409046", "0.72409046", "0.7214566", "0.7171239", "0.7085723", "0.70768297", "0.7059616", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.70374125", "0.703551", "0.6991727", "0....
0.0
-1
GET /eventmembers/1/edit def edit end POST /eventmembers POST /eventmembers.json
def create @event = Event.find(params[:event_id]) @eventmember = Eventmember.new(eventmember_params) # respond_to do |format| # if @eventmember.save # format.html { redirect_to @event } # format.json { render :show, status: :created, location: @event } # else # format.html { render :new } # format.json { render json: @eventmember.errors, status: :unprocessable_entity } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @event = current_user.events.find(params[:id])\n end", "def edit\n#\t\t@event = Event.find(params[:id])\n\tend", "def edit\n @role = get_role\n respond_with @event, @role\n end", "def edit\n\t\t@event = Event.find(params[:id])\n\tend", "def edit\n @event = Event.find(params[:id])\n...
[ "0.69528234", "0.67062414", "0.667374", "0.66605", "0.66258705", "0.66258705", "0.66007715", "0.65258706", "0.64912456", "0.64822054", "0.64638263", "0.64365137", "0.6424329", "0.6417832", "0.639991", "0.637232", "0.62719524", "0.62530535", "0.62372565", "0.62309706", "0.6186...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_eventmember @eventmember = Eventmember.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def eventmember_params params.require(:eventmember).permit(:user_id, :event_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /user_meals GET /user_meals.json
def index @user_meals = UserMeal.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @me...
[ "0.9216661", "0.77348506", "0.7395563", "0.7395563", "0.72733617", "0.700398", "0.6823776", "0.6679504", "0.6644864", "0.6581048", "0.64315736", "0.64064133", "0.6275259", "0.6275259", "0.62651503", "0.62406874", "0.62219524", "0.62125045", "0.6157133", "0.6152667", "0.615266...
0.7024584
5
GET /user_meals/1 GET /user_meals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @me...
[ "0.90346825", "0.77251095", "0.7368014", "0.7368014", "0.7217244", "0.7092562", "0.7029679", "0.68638396", "0.68521076", "0.6734284", "0.662611", "0.65732783", "0.65415543", "0.6540002", "0.6540002", "0.6485172", "0.6476806", "0.6476806", "0.6476806", "0.64532924", "0.6432503...
0.0
-1
POST /user_meals POST /user_meals.json
def create @user_meal = UserMeal.new(user_meal_params) respond_to do |format| if @user_meal.save format.html { redirect_to @user_meal, notice: 'User meal was successfully created.' } format.json { render :show, status: :created, location: @user_meal } else format.html { render :new } format.json { render json: @user_meal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @me...
[ "0.780348", "0.7259802", "0.6707388", "0.65155244", "0.6507159", "0.64489", "0.62967294", "0.62907726", "0.6222356", "0.6189262", "0.6189262", "0.61617744", "0.6084193", "0.6084193", "0.6080981", "0.6080689", "0.60731405", "0.6038379", "0.60367376", "0.60283864", "0.60189366"...
0.71315765
2
PATCH/PUT /user_meals/1 PATCH/PUT /user_meals/1.json
def update respond_to do |format| if @user_meal.update(user_meal_params) format.html { redirect_to @user_meal, notice: 'User meal was successfully updated.' } format.json { render :show, status: :ok, location: @user_meal } else format.html { render :edit } format.json { render json: @user_meal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.7078675", "0.6835769", "0.6633407", "0.651452", "0.6496397", "0.6488832", "0.6474574", "0.6441713", "0.6420901", "0.6410958", "0.6403344", "0.6372808", "0.6361657", "0.6334368", "0.6314967", "0.6277786", "0.6230381", "0.62067914", "0.61754304", "0.6168994", "0.61677194", ...
0.7134466
0
DELETE /user_meals/1 DELETE /user_meals/1.json
def destroy @user_meal.destroy respond_to do |format| format.html { redirect_to user_meals_url, notice: 'User meal was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n ...
[ "0.74902195", "0.7411985", "0.73815763", "0.7140591", "0.71310884", "0.71082133", "0.6961988", "0.6961988", "0.6943542", "0.6933399", "0.688878", "0.686623", "0.685317", "0.682992", "0.6822535", "0.6813917", "0.67400426", "0.6691638", "0.66637266", "0.6652966", "0.6616819", ...
0.7609273
0
Use callbacks to share common setup or constraints between actions.
def set_user_meal @user_meal = UserMeal.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_meal_params params.fetch(:user_meal, {}) 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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
p range_iterative(3,7) exponentation recursion 1
def exp1(num, exponent) return 1 if exponent == 0 # return ( 1 / exp1(num, exponent - 1) ) num * exp1(num, exponent - 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_range(range)\n multi = multiple_of_3_and_5(range - 1)\n sum = addition(multi)\n\n puts sum\nend", "def iterative_factorial(number)\n\nend", "def iterative_factorial(number)\n\nend", "def recursive_exponent_1(base, exponent)\n puts \"#{__method__} called\"\n return 1 if exponent.zero?\n base...
[ "0.6643921", "0.64932615", "0.64932615", "0.63352156", "0.6321269", "0.6271953", "0.626175", "0.6233397", "0.6225768", "0.619121", "0.6178885", "0.6140745", "0.6131115", "0.61230725", "0.6123036", "0.6119506", "0.6099486", "0.6099279", "0.6083398", "0.60801095", "0.607892", ...
0.0
-1
p exp1(2, 0) p exp1(2, 3) exponentation recursion 2
def exp2(num, exponent) return 1 if exponent == 0 exp_recursion = exp2(num, (exponent / 2)) if exponent.even? exp2(num, (exponent / 2)) * exp2(num, (exponent / 2)) else num * exp2(num, (exponent - 1) / 2) * exp2(num, (exponent - 1) / 2) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp1(base, power)\n puts \"exp1\"\n return 1 if power == 0\n base * exp1(base, power - 1)\nend", "def exp_1(base, exp)\n return 1 if exp == 0\n\n base * exp_1(base, exp-1)\nend", "def exp1(base, power)\n return 1 if power == 0\n base * exp1(base, power - 1)\nend", "def exp1(base, power)\...
[ "0.83712566", "0.81268543", "0.79105455", "0.7886124", "0.78494084", "0.78212553", "0.77765256", "0.7769432", "0.7766686", "0.7720705", "0.7678441", "0.763474", "0.76343656", "0.7631437", "0.7617895", "0.7606278", "0.75894874", "0.7557639", "0.7554589", "0.7549023", "0.754087...
0.76857775
10
original = ["1", "2", "3"] copy = original.deep_dup copy[1] << "LED" puts copy puts original fibionacci iteration
def fib_it(n) fib_array = [1, 1] return fib_array if n == 2 return [1] if n == 1 (3..n).count { fib_array << fib_array[-2] + fib_array[-1] } fib_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_copy\n answer = []\n %w[1 2 3 4 5 6].each do |elem|\n answer << elem.dup\n end\n answer\nend", "def duplicate(arr)\n copy = arr\n result = arr.map do |x|\n x + 2\n end\n p result\n p copy\nend", "def deep_dup(arr)\n\nend", "def deep_dup(arr)\n\nend", "def deep_dup(arr)\n\...
[ "0.7054535", "0.70052844", "0.6744352", "0.6744352", "0.6744352", "0.6719133", "0.6611716", "0.6539533", "0.6506038", "0.64236987", "0.6405105", "0.6342492", "0.63408864", "0.6228661", "0.6216116", "0.6184086", "0.6168025", "0.6143065", "0.61417013", "0.61206883", "0.61109424...
0.0
-1
p fib_it(5) fibionacci recursion
def fib_rec(n) return nil if n < 1 return [1] if n == 1 return [1, 1] if n == 2 current = [1, 1] recursive = fib_rec(n - 1) (recursive.length - 1).times do |el| current << recursive[el] + recursive[el + 1] end current end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fib(n)\n return 0 if n == 0\n return 1 if n == 1\n \n\n fib(n - 1) + fib(n - 2)\nend", "def fib(n)\r\n if n == 1 then\r\n 10\r\n elsif n == 0 then\r\n 1\r\n else\r\n fib(n - 1) + fib(n - 2)\r\n end\r\nend", "def fibs(n)\nend", "def fib(n)\n if n == 0 || n == 1\n return n...
[ "0.82992566", "0.8173859", "0.8171077", "0.81431806", "0.81364584", "0.8131829", "0.8127512", "0.81112874", "0.8095844", "0.8091374", "0.80884045", "0.8083399", "0.8082532", "0.8081151", "0.80761147", "0.8069016", "0.80641234", "0.8039872", "0.80366755", "0.80366755", "0.8027...
0.0
-1
p fib_rec(8) def subsets_practice(array) subset_arr=[[], array] array.each_index do |idx| next_idx = idx+1 subset_arr << [array[idx]] subset_arr << [array[idx], array[next_idx] || array[0]] end p subset_arr end
def subsets(array) return [[]] if array.empty? subs = array[0...-1] smaller_subs = subsets(subs) bigger_subs = [] smaller_subs.each do |sub| bigger_subs << sub + [array[-1]] end smaller_subs + bigger_subs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsets(array)\n return [[]] if array.empty?\n number = array.pop\n prev_subsets = subsets(array)\n new_subsets = []\n prev_subsets.each do |subset|\n new_subsets << ([number] + subset)\n end\n prev_subsets + new_subsets\nend", "def subsets(array)\n\nend", "def subsets(array)\n\nend", "def subs...
[ "0.776742", "0.7642401", "0.7642401", "0.7642401", "0.7631329", "0.7573406", "0.7554579", "0.7546825", "0.75399023", "0.7527767", "0.7527104", "0.7451045", "0.7399227", "0.7384727", "0.73667353", "0.7314229", "0.72788465", "0.7266725", "0.7253151", "0.72347283", "0.7219942", ...
0.7574405
5
subsets([1, 2, 3, 4, 5]) permutations from solutions, but rework later
def permutations(array) return [array] if array.length <= 1 first = array.shift perms = permutations(array) total_permutations = [] perms.each do |perm| (0..perm.length).each do |i| total_permutations << perm[0...i] + [first] + perm[i..-1] end end total_permutations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsets(arr)\r\n comb = [] #set up return array\r\n\r\n for x in 0..arr.length do # gives a value from 0 to arr.length to pass below\r\n arr.combination(x) {|y| comb << y} # pushes to the return all of the possible combinations of the array\r\n end # the x insures that al...
[ "0.7278352", "0.7276052", "0.70709395", "0.7019749", "0.70070785", "0.6922254", "0.6807237", "0.6786557", "0.67762256", "0.67367136", "0.6718677", "0.67099756", "0.6698847", "0.6638068", "0.66285825", "0.6628188", "0.6618909", "0.6575037", "0.65309405", "0.6519524", "0.647444...
0.0
-1
p permutations([1, 2, 3])
def bsearch(array, target) return nil unless array.include?(target) middle = (array.length - 1) / 2 return middle if target == array[middle] if target < array[middle] bsearch(array[0...middle], target) elsif target > array[middle] middle + 1 + bsearch(array[(middle + 1)..-1], target) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(array)\n \nend", "def permutations(array)\n\nend", "def permutations(array)\n\nend", "def permutations(array)\n\nend", "def permutations(array)\n\nend", "def get_permutations(n)\r\n return (1..n).to_a.permutation.to_a\r\nend", "def print_permutations_of(array) \n array.permuta...
[ "0.8296482", "0.8218106", "0.8218106", "0.8218106", "0.8218106", "0.8009701", "0.7900354", "0.78121173", "0.7800992", "0.75673807", "0.7543668", "0.75414795", "0.7497943", "0.7489763", "0.7423502", "0.7410712", "0.7303234", "0.73013717", "0.7279626", "0.72430295", "0.7224034"...
0.0
-1
GET /cafeteria GET /cafeteria.json
def index @cafeteria = Cafeterium.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def show\n @cervejaria = Cervejaria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejaria }\n end\n end", "def sh...
[ "0.75647", "0.70506305", "0.68938243", "0.68855804", "0.6780552", "0.6775602", "0.6770315", "0.67238694", "0.66846067", "0.66804296", "0.6669971", "0.6646032", "0.65990245", "0.6592552", "0.6590905", "0.65752727", "0.65680426", "0.65612596", "0.6557963", "0.6540947", "0.65331...
0.65449345
19
GET /cafeteria/1 GET /cafeteria/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end", "def show\n @cer...
[ "0.7491183", "0.6978278", "0.6967292", "0.6901161", "0.6856197", "0.68064713", "0.6784394", "0.6766664", "0.6701423", "0.67002946", "0.66830736", "0.6648445", "0.6646943", "0.66411", "0.6620773", "0.6606457", "0.6598598", "0.6594374", "0.6590194", "0.65894777", "0.6558039", ...
0.0
-1
POST /cafeteria POST /cafeteria.json
def create @cafeterium = Cafeterium.new(cafeterium_params) respond_to do |format| if @cafeterium.save format.html { redirect_to @cafeterium, notice: 'Cafeterium was successfully created.' } format.json { render action: 'show', status: :created, location: @cafeterium } else format.html { render action: 'new' } format.json { render json: @cafeterium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def cre...
[ "0.7250657", "0.6621574", "0.6618546", "0.65646803", "0.6487049", "0.63877565", "0.63803977", "0.6367475", "0.63408524", "0.6338208", "0.62922406", "0.62674403", "0.6248319", "0.62299573", "0.6224079", "0.6215595", "0.62037885", "0.62019455", "0.61973596", "0.61928076", "0.61...
0.6549736
4
PATCH/PUT /cafeteria/1 PATCH/PUT /cafeteria/1.json
def update respond_to do |format| if @cafeterium.update(cafeterium_params) format.html { redirect_to @cafeterium, notice: 'Cafeterium was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @cafeterium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def update\n @oferta = Oferta.find(params[:id])\n...
[ "0.6631359", "0.65522707", "0.6487744", "0.6462324", "0.6413346", "0.6405309", "0.64001495", "0.63958323", "0.63838375", "0.63707155", "0.6347921", "0.6342091", "0.62983274", "0.62928516", "0.6286737", "0.6283196", "0.62810034", "0.6268396", "0.62418675", "0.62286943", "0.621...
0.6308627
12
DELETE /cafeteria/1 DELETE /cafeteria/1.json
def destroy @cafeterium.destroy respond_to do |format| format.html { redirect_to cafeteria_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(par...
[ "0.7249788", "0.72042596", "0.70798326", "0.70749754", "0.7054742", "0.6980377", "0.69713724", "0.69465536", "0.6944013", "0.6928243", "0.6918093", "0.6893774", "0.6884394", "0.6882612", "0.6879807", "0.68471354", "0.6843041", "0.684175", "0.68413794", "0.6839263", "0.6823278...
0.7359775
0
Use callbacks to share common setup or constraints between actions.
def set_cafeterium @cafeterium = Cafeterium.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def cafeterium_params params.require(:cafeterium).permit(:item_name, :item_description, :item_price, :cafeteria_category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
END OF Input view generator modules Graph generator modules
def cols_and_spline type = params[:type] section = Section.find(params[:section_id]) @series = [] @categories = [] @average = [] hash = mark_columns(section) @y_axis_text = 'Marks' @subtitle_text = "Section: #{section.name}" # comparing multiple subjects and tests for one student #This will also be called from 'student_master_graphs' view, since that generates # graphs for only one student if type.eql?('one_student') student = Student.find(params[:student_id]) test_ids = params[:test_ids] subject_ids = params[:subject_ids] @title_text = "#{student.name} Marks" for test_id in test_ids #for the x-axis units @categories << Test.find(test_id).name #for the spline end for sub_id in subject_ids req_col = hash[Subject.find(sub_id).name] marks = [] #Loop for each of the subjects for test_id in test_ids marks << Mark.by_test_id(test_id).by_student_id(student.id).first.send(req_col) end @series << {:name => Subject.find(sub_id).name, :marks => marks} end # comparing one subject in multiple tests for multiple students elsif type.eql?('one_subject') subject = Subject.find(params[:subject_id]) test_ids = params[:test_ids] student_ids = params[:student_ids].split(",") @title_text = "#{subject.name} Marks" for test_id in test_ids #for the x-axis units @categories << Test.find(test_id).name #for the spline #@average << (Mark.total_on(section.id, subject.id, map.test_id))/section.students.count end req_col = hash[Subject.find(subject.id).name] for id in student_ids marks = [] #Loop for each of the subjects for test_id in test_ids marks << Mark.by_test_id(test_id).by_student_id(id).first.send(req_col) end @series << {:name => Student.find(id).name, :marks => marks} end #comparing multiple subjects in one test for multiple students elsif type.eql?('one_test') test = Test.find(params[:test_id]) subject_ids = params[:subject_ids] student_ids = params[:student_ids].split(",") @title_text = "#{test.name} Marks" for sub_id in subject_ids #for the x-axis units @categories << Subject.find(sub_id).name #for the spline #@average << (Mark.total_on(section.id, map.subject_id, map.test.id))/section.students.count end for id in student_ids marks = Array.new #Loop for each of the subjects for sub_id in subject_ids req_col = hash[Subject.find(sub_id).name] marks << Mark.by_test_id(test.id).by_student_id(id).first.send(req_col) end @series << {:name => Student.find(id).name, :marks => marks} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_graph\n end", "def graph\n \n \n @graphml = \"<graphml><key id='label' for='all' attr.name='label' attr.type='string'/><key id='link' for='all' attr.name='link' attr.type='string'/><key id='weight' for='all' attr.name='weight' attr.type='double'/><key id='edgetype' for='edge' attr.name='edg...
[ "0.790648", "0.6355632", "0.6344504", "0.6344504", "0.6344504", "0.61950165", "0.61653584", "0.6109589", "0.6059717", "0.60186565", "0.6003674", "0.5999716", "0.59751296", "0.59612507", "0.59475696", "0.5944077", "0.59389645", "0.59351313", "0.5922543", "0.5887639", "0.585784...
0.0
-1
END OFGraph generator modules UTILTIY MODULES FOR THIS CONTROLLER AND VIEW
def mark_columns(section) h = Hash.new section.sec_sub_maps.each do |map| name =Subject.find(map.subject_id).name mark_col = "sub#{map.mark_column}" h[name] = mark_col end return h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view; end", "def view_flow; end", "def _view; end", "def view_renderer; end", "def view_renderer; end", "def overview\n\n end", "def view_paths; end", "def view_paths; end", "def view_paths; end", "def helpers; end", "def helpers; end", "def helpers; end", "def components\n\n end", ...
[ "0.6637574", "0.6565097", "0.640837", "0.62232405", "0.62232405", "0.61906534", "0.61605495", "0.61605495", "0.61605495", "0.61115706", "0.61115706", "0.61115706", "0.6076323", "0.60508007", "0.5996973", "0.59900814", "0.59674263", "0.5893612", "0.58770144", "0.58180743", "0....
0.0
-1
TO DYNAMICALLY POPULATE THE TEXT FIELDS FOR THE GRAPHS INPUT
def section_dyn_vals name_like = params[:q] type = params[:type] section = Section.find(params[:section_id]) if type.eql?('subjects') @objects = Subject.by_section(section.id) elsif type.eql?('tests') @objects = Test.by_section(section.id) elsif type.eql?('students') @objects = Student.by_section(section.id).name_like("%#{params[:q]}%") #Student.where("section_id =? and name like ?", section.id, "%#{params[:q]}%") end respond_to do |format| format.html format.json { render :json => @objects.map(&:attributes) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_text_montant\n \"\".in_input_text(class:'medium', name:'facture[montant_amount]', id:'facture_montant_amount')\nend", "def fill_inputs\n update(:all,'input').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element[:value] = send($1).send(...
[ "0.61153096", "0.6042582", "0.6022022", "0.59466285", "0.58972037", "0.58564156", "0.58267283", "0.5804377", "0.5782444", "0.5739756", "0.5733525", "0.57216436", "0.5709029", "0.56517506", "0.56136197", "0.5546746", "0.5519948", "0.5455289", "0.54532045", "0.54307896", "0.542...
0.0
-1
Get a single rental cancelation policy item
def rental_cancelation_policy_item(rental_cancelation_policy_item, options = {}) get("rental_cancelation_policy_items/#{rental_cancelation_policy_item}", options).pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_reason\n @subscription_purchase.cancel_reason\n end", "def find_for_cancel(reputable, action, receiver, points, tier=nil)\n conditions = unless tier\n [\"reputations.status = ? AND reputations.reputable_id = ? AND reputations.reputable_type = ? AND reputations.action = ? AN...
[ "0.6087988", "0.56167716", "0.5515436", "0.54824257", "0.5461445", "0.54609674", "0.53933686", "0.5379989", "0.5319571", "0.52780855", "0.5275536", "0.5263097", "0.5244359", "0.5210058", "0.51593626", "0.51530594", "0.51471907", "0.5135119", "0.5119553", "0.5102946", "0.50888...
0.76150334
0
The following 4 methods are for the DEVISE render pages
def resource_name :user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render; end", "def render; end", "def render; end", "def render; end", "def render; end", "def render_calls; end", "def view_renderer; end", "def view_renderer; end", "def first_mandate\n # renders static page\n end", "def rendered; end", "def render\n end", "def render\n\n end"...
[ "0.69691765", "0.69691765", "0.69691765", "0.69691765", "0.69691765", "0.6953017", "0.6926832", "0.6926832", "0.6797047", "0.6771072", "0.67380965", "0.6723867", "0.6723027", "0.6723027", "0.6723027", "0.66710174", "0.6641377", "0.6556785", "0.6556785", "0.6536011", "0.653009...
0.0
-1
Create a new Collection of Resource objects ==== Arguments _session_ Session object _resource_ class of the Resource for this collection _owner_ a Resource object which owns the collection, applies scope to calls ==== Usage Normally you do not call the constructor directly, instead you go via the Session or Deal instance, like this:
def initialize(session, resource, owner = nil) @session = session @resource = resource @owner = owner @prefix = owner ? owner.element_path : '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_collection\n @resource.make_collection\n end", "def resource_collection\n @resource_collection ||= @run_context.resource_collection\n end", "def set_collection_instance\n instance_variable_set(\"@#{resource_plural_name}\", resource_proxy)\n end", "def decorated_collection\n ...
[ "0.596501", "0.5841833", "0.58228415", "0.5755029", "0.57275736", "0.5724049", "0.5662729", "0.56497705", "0.5593336", "0.55649126", "0.55254984", "0.55117667", "0.5508281", "0.55026305", "0.5479653", "0.54759616", "0.54603493", "0.5450446", "0.54471195", "0.5437607", "0.5427...
0.5614945
8
Returns a path to the collection of Resource objects
def collection_path @prefix + '/' + @resource.collection_path.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end", "def collections_path; end", "def collection\n resource_class.all\n e...
[ "0.73934555", "0.727486", "0.70928824", "0.7016644", "0.6987179", "0.6910292", "0.689361", "0.6880156", "0.6845663", "0.6828263", "0.6805364", "0.6777731", "0.67725796", "0.67388463", "0.67388463", "0.67388463", "0.6731893", "0.6729437", "0.67072886", "0.6653743", "0.6612539"...
0.74083126
0
Returns a path to a single Resource
def element_path(id) @prefix + '/' + @resource.collection_path.to_s + '/' + id.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n name = @resource.value(:name)\n if (attrs = self.class.all[name])\n attrs[:path]\n end\n end", "def resource_path(*args)\n resource.path(*args)\n end", "def path\n name = @resource.value(:name)\n # rubocop:disable Style/GuardClause\n if (attrs = self.class.all[nam...
[ "0.78549296", "0.7841048", "0.770448", "0.7329078", "0.7217448", "0.71895903", "0.71292", "0.7100359", "0.7076423", "0.7061897", "0.70526206", "0.7022241", "0.69986403", "0.695419", "0.6952841", "0.69357574", "0.6925645", "0.6804489", "0.67951906", "0.67750204", "0.67750204",...
0.0
-1
Returns a single Resource object, based on its _id_ ==== Arguments _id_ id of Resource
def find(id) code, data = @session.get(element_path(id) + '.json') if code == 200 key = @resource.name.to_s.split('::').last.downcase @resource.new(data[key].merge(:session =>@session)) elsif code == 404 raise ResourceNotFound end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id ...
[ "0.8232799", "0.8091343", "0.78325975", "0.772683", "0.763369", "0.7620556", "0.760358", "0.74612874", "0.7311808", "0.7298465", "0.72212017", "0.7176473", "0.7161151", "0.71201265", "0.71052885", "0.7062926", "0.7056969", "0.7056342", "0.70525306", "0.70272386", "0.70071274"...
0.7596603
7
Returns an Array of Resource objects
def all(params = {}) query = params.map { |key, value| "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}" }.join("&") query = "?" + query unless query.empty? code, data = @session.get(collection_path + '.json' + query) data.collect { |data| key = @resource.name.to_s.split('::').last.downcase @resource.new(data[key].merge(:session => @session, :prefix => @prefix)) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources\n @resources ||= @response[@resource_field].to_a\n end", "def resources\n @resources ||= []\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def resources\n ...
[ "0.777672", "0.7664756", "0.7269483", "0.7269483", "0.7269483", "0.72271603", "0.71752894", "0.71239513", "0.6867364", "0.68267524", "0.68176955", "0.67858124", "0.6774142", "0.6757139", "0.6752189", "0.6734408", "0.67284864", "0.6712926", "0.6686244", "0.6673482", "0.6671617...
0.6012502
82
Creates and returns a Resource object ==== Arguments _attrs_ a Hash of attributes passed to the constructor of the Resource
def create(attrs) resource = @resource.new(attrs.merge(:session => @session, :prefix => @prefix)) resource.save resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(attributes = {})\n resource = new(attributes)\n resource.__send__(:_create)\n resource\n end", "def resource\n resource_klass.new(attributes.symbolize_keys.merge(new_record: false))\n end", "def initialize(attrs = {})\n # Registro Nacional de Transportadores Ro...
[ "0.71360934", "0.6867871", "0.6858949", "0.6736247", "0.6680484", "0.6660236", "0.66534483", "0.662158", "0.66204166", "0.6600757", "0.6591682", "0.65770143", "0.65630984", "0.6530028", "0.6517323", "0.65079045", "0.6505748", "0.6502497", "0.64885", "0.6477456", "0.64578694",...
0.7811263
0