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
| // The API accepts the page parameter and returns the pagination info in meta | |
| { | |
| "messages": [ ... ], | |
| "meta": { | |
| "pagination": { | |
| "total_pages": 3, | |
| "current_page": 1, | |
| "total_count": 55 | |
| } |
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
| module ActiveRecord | |
| module RailsAdminEnum | |
| def enum(definitions) | |
| super | |
| definitions.each do |name, values| | |
| define_method("#{ name }_enum") { self.class.send(name.to_s.pluralize).to_a } | |
| define_method("#{ name }=") do |value| | |
| if value.kind_of?(String) and value.to_i.to_s == value |
OlderNewer