Open chandler-huang opened 8 years ago
# config/initializers/her.rb
Her::Model.class_eval do
def as_json(options = nil)
attributes.as_json(options)
end
end
# controllers - no change here in theory
affiliate = Affiliate.find(9991104)
render json: affiliate
Hi sir,
When i use the latest version of her on my rails project, i follow the document to set up and use her. Now i have two questions about the return value from her.
Background: OS: Mac gem 'rails', '4.1.5' gem 'rails-api'
Example: I have an Affiliate model and initialize her like:
And in the controller, the code is
And get a result like this:
So how can I get the response only include attributes like
And another question is when i call Affiliate.all in controller
And the result is
Dose anyone encounter the same problem like me? Thanks for all of you help.