Skip to content

Instantly share code, notes, and snippets.

@satblip satblip/Json_except.rb
Last active Dec 20, 2015

Embed
What would you like to do?
Exception with JSON Rendering in Rails
# I use this code to render the JSON
format.js { render :json => @courses_list.to_json( :except => [ :account_id, :default_view, :public_syllabus, :storage_quota_mb, :apply_assignment_group_weights, :calendar ] )}
# But it still give me this as result :
[
{
"account_id":1,
"course_code":"Audio Mastering 101 - 0913",
"default_view":"feed",
"id":1,
"name":"Audio Mastering 101",
"start_at":"2013-09-16T00:00:00+02:00",
"end_at":"2013-10-13T23:55:00+02:00",
"public_syllabus":false,
#.....
},
{
"account_id":1,
"course_code":"Sound Design 101",
"default_view":"feed",
"id":2,
"name":"Sound Design 101",
"start_at":"2013-08-06T16:55:25+02:00",
"end_at":null,
"public_syllabus":false,
#.....
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.