A simple Ruby class for matching Rails controller/action patterns against current routes. Perfect for adding active states to navigation elements.
Drop nav_matcher.rb into your Rails app (e.g., lib/nav_matcher.rb or app/models/nav_matcher.rb).
| <%= search_form_for @q do |f| %> | |
| <%= f.label :title_cont %> | |
| <%= f.search_field :title_cont %> | |
| <%= f.submit "Search" %> | |
| <% end %> | |
| <table> | |
| <thead> | |
| <tr> |
Hay muchas ventajas de estar al día con Ruby on Rails (main), así como desventajas.
Si vas a empezar de cero una aplicación o te gustaría explorar Rails 7 antes que nadie, los siguientes pasos te ayudarán.
Te recomiendo utilizar la versión 3 de Ruby para estas instrucciones.
| Capítulo I. Que trata de la condición y ejercicio del famoso hidalgo don Quijote de la Mancha | |
I hereby claim:
To claim this, I am signing this object:
| def sort(values) | |
| length = values.size - 1 | |
| 1.upto(length) do |i| | |
| temp = values[i] | |
| j = i - 1 | |
| while j >= 0 and values[j] > temp | |
| values[j+1] = values[j] | |
| j -= 1 |
| def sort(values) | |
| length = values.size - 2 | |
| swapped = true | |
| while swapped | |
| swapped = false | |
| 0.upto(length) do |i| | |
| if values[i] > values[i+1] | |
| values[i], values[i+1] = values[i+1], values[i] |
| def findIndex(values, target) | |
| binarySearch(values, target, 0, values.size - 1) | |
| end | |
| def binarySearch(values, target, start, finish) | |
| return -1 if start > finish | |
| middle = ((start+finish)/2).floor | |
| value = values[middle] |