This is my Rails 4 app: http://wheels2015.herokuapp.com
I want the entries (events) to be listed in chronological order, as opposed to the order in which I entered them into the database (as they are currently).
This question isn't the same as mine, but it appears to be in the general ballpark, so when a user suggested that OP look up the ActiveRecord query methods in the Rails API (http://apidock.com/rails/ActiveRecord/QueryMethods/order) I did.
Do you think this would do what I want it to?
Event.order('date_time')
=> SELECT "events".* FROM "event" ORDER BY event_date_time
This is the portion of my event controller that's responsible for the index
page, as well as the event params
:
def event_params
params.require(:event).permit(:event_name, :location, :description, :event_date_time, :organizer, :category) if params[:event]
end
def index
@events = Event.all
end