Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add crud for identities, add search capabilities #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ricalanis
Copy link
Collaborator

@ricalanis ricalanis commented Apr 5, 2018

@denialtorres ya vi que andabamos en lo mismo! creo que de aquí puedes rescatar la forma en la que uso has_scope, que me ayuda a tener un buscador sobre una query de SQlite
captura de pantalla 2018-04-05 a la s 02 35 09

Puedes ver más sobre has_scope acá
https://github.com/plataformatec/has_scope

Según yo si quedó pendiente la busqueda, si no, no hay pex (:

@@ -1,3 +1,3 @@
class Identity < ApplicationRecord

scope :by_name, -> (name) { where('first_name LIKE ? OR first_last_name LIKE ?', "%#{name}%", "%#{name}%") }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asi puedes implementar cualquier filtro que tengas en mente. solo agregas el scope en el modelo, y de l lado del controlador lo cargas. Y sobre index aplicas los scopes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y para usarlo de lado de la vista, le mandas el "by_name" como un param

@denialtorres
Copy link
Owner

Hola, se ve bien, solo podrias ayudarme con los merge conflicts ?

una vez que ya este puedes hacerle merge

saludos !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants