Class: LesliLetter::NoteService
- Inherits:
-
Lesli::ApplicationLesliService
- Object
- Lesli::ApplicationLesliService
- LesliLetter::NoteService
- Defined in:
- app/services/lesli_letter/note_service.rb
Instance Method Summary collapse
Instance Method Details
#find(id) ⇒ Object
36 37 38 |
# File 'app/services/lesli_letter/note_service.rb', line 36 def find id super(current_user.account.letter.notes.find_by_id(id)) end |
#index ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/services/lesli_letter/note_service.rb', line 40 def index current_user.account.letter.notes .select( "lesli_letter_notes.id as id", "lesli_letter_notes.name as title", "SUBSTRING(lesli_letter_notes.content, 1, 35) as excerpt" ) .page(query[:pagination][:page]) .per(query[:pagination][:perPage]) #.order(updated_at: :desc, name: :asc) .order(id: :asc) end |
#show ⇒ Object
53 54 55 |
# File 'app/services/lesli_letter/note_service.rb', line 53 def show self.resource end |
#update(params) ⇒ Object
57 58 59 60 61 62 |
# File 'app/services/lesli_letter/note_service.rb', line 57 def update params if self.resource.update(params) return self end self.error(self.resource.errors..to_sentence) end |