Created
July 24, 2017 17:19
-
-
Save basicavisual/8fc8fe0cfed74e7779ffc6e08d62e99a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fiscal < ApplicationRecord | |
def self.search(search) | |
if search | |
where(["nombre LIKE ?", "%#{search}%"]) | |
else | |
last(5) | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FiscalsController < ApplicationController | |
def index | |
@fiscals = Fiscal.search(params[:search]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment