Stewart wrote in post #989366:
> Hello,
>
> I am using the to_json method to encode models to json. Standard
> stuff. I am using the :include option so that a relation model gets
> added to the encoded json. Again this is fine however the related
> model is a user model that has things like md5 password strings. Whats
> the best way of excluding these fields form the encoding. Here is the
> current line of code that calls the to_json method
>
> format.js { render :json => @shifts.to_json(:include => [ :users ]) }

I believe you want:

@shifts.to_json(:include => { :users => { :except =>[ 'password'] }})

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to