Skip to main content

Posts

Showing posts from 2021

Heroku Deployment in ROR?

Heroku Deployment in ROR?   git push origin main(branch name) heroku create -> Create the repository in heroku heroku push origin main(branch name) heroku db:migrate heroku logs => Checking the heroku logs heroku open -> Open the URL heroku pg:psql

Ruby on Rails Interview Questions Experienced

ROR Interview Questions Experienced  Difference between the map & each? The map will return the new array with modified values. Each will return the same array with an object. Write the  program to sort the array in ruby without using the sort method? def ary_sort(list, new_array = nil) return new_array if list.size <= 0 if new_array == nil min = list.min new_array = [] end ary_sort(list, new_array) new_array << min list.delete(min) end    ary_sort ([1,6,5,3,8,24,18]) Write the   Program for array pass the arguments?  Input will be a = [2,3,4] ,a.add_no(2)   ====> Output - [4,5,6] Array.class_eval do def add_no(n) self.map{|x| x+ n} end end Difference between the find and find_by in rails? find_by () returns the  nil if the record does not exist in the database find () returns the  ActiveRecord::RecordNotFound exception  f the record does not exist in the database. How do acc...