Unnamed
Unnamed

Reputation: 1790

Ruby on rails created_at column is not showing up in my deserialized model

class PostsController < ApplicationController

  # GET /posts
  # GET /posts.json
  def index
    @posts = Post.all
  end

end

In my database I can see that my created posts are getting a created_at and updated_at column set to the correct times. I want to display this value to the user, but created_at is not included in my deserialized object in my response. How can I make sure this value is included in my response so I can display it to my user?

Upvotes: 0

Views: 334

Answers (1)

Jeet
Jeet

Reputation: 1380

Refer this Attribute Methods Before Type Cast

But this could be applied on single active record object, not on array of active record objects

Upvotes: 0

Related Questions