similar to: How to Include Associations in #as_json

Displaying 20 results from an estimated 200 matches similar to: "How to Include Associations in #as_json"

2012 Oct 01
1
active_model_serializers, more than one level deep of associations, specifying serializers per association
I am assuming this an appropriate place to discuss this, but if it isn''t my apologies- just let me know. Just a Rails 4-ish thing. Am attempting to pull AMS (active_model_serializers), strong_parameters, and the "permitter" strategy that Adam Hawkins is using: http://broadcastingadam.com/2012/07/parameter_authorization_in_rails_apis/ Code so far is here (in the
2012 Sep 18
4
"best practices" for Rails serving RESTful JSON services for use by AngularJS, Ember.js, etc.
I''ve been writing a gem to implement and extend common controller functionality so that Rails can be used with Javascript frameworks like AngularJS (which we are using), Ember.js, etc. in such a way that the user doesn''t have to tweak a a bunch of rails g controller boilerplate code to provide services for use in these frameworks that in turn would require various changes to
2010 Feb 16
0
as_json and self-referential associations
Hi, I''m using the new(?) as_json methods within a rest api I am working on. However I am not sure how you are supposed to, or whether it is designed to handle multiple variations of association inclusion. For example I have a model using acts_as_tree, so that each instance has children and a parent: class CatalogueCategory < ActiveRecord::Base acts_as_tree JSON_ATTRS =
2012 Jan 27
2
to_json performance
Originally posted on github, reported to the right place. I would like to open a discussion about how `to_json` and `as_json` operates in Rails from a performance standpoint. I''m using Rails 3.2 but this issue applies to almost all versions of Rails. Our use case presents the challenge in sending out potentially large JSON (or XML, but we''ll focus on JSON rendering here)
2011 Feb 03
0
Correct way to exclude attributes from json serialization
Hi I''m using Mongoid and Rails 3, and I want to serialize one of my mongoid documents to json for publishing via a controller, e.g. class ReportController < ApplicationController respond_to :json def show report = Report.where(:report_id => params[:id]).first respond_with report end end This works ok, but pushes out every attribute on the document
2012 Dec 29
3
Update 1.2 -> 2.0 ... INBOX away?
Hi, yesterday I did an update from dovecot 1.2 to 2.0.19 (Ubuntu 10.04 -> 12.04). After fixing the configuration dovecot startups as it should, but with one error, I don't understand: the INBOX will not be delivered to the Mailclient and will not be filled by "deliver". Instead, dovecot create the two dirs "new" and "cur" directly in "Maildir".
2006 May 14
1
[LLVMdev] Recharging the batteries
Hi, I've noticed that http://llvm.org/status/ hasn't been updated for a while, so I tought that some of you might find the following information interesting and/or encouraging... For benchmarking the stuff I'm working on I needed to compile a number of open-source packages. The settings I used: AS=llvm-as lLD=llvm-ld AR=llvm-ar CXX=llvm-g++ CC=llvm-gcc CFLAGS="-g
2012 Sep 15
10
Versioning of Views; Our Approach
My friend Ben Willis and I have developed a gem for the versioning of Rails views. https://github.com/bwillis/versioncake The versioning is done by the naming convention. Image the following series of files : show.v3.json.jbuilder show.v2.json.jbuilder show.v1.json.jbuilder create.v2.json.jbuilder create.v1.json.jbuilder The developer pre-defines all view versions in their config. When a
2010 Dec 22
2
Rails - JSON object with an array?
Hello, I''m able to create and send a JSON object like so: @mylist << { :id => item.id, :name => name.id } render :json => { :result => ''success'', :mylist => @mylist } That works great. Problem I''m having now is that I need to include users which can be 1 or users per item. @mylist << {
2013 Dec 02
1
dovecot.index-Errors with multiple IMAP client access in Dovecot 2.2
Hello list, I hope you can help me! My self-compiled dovecot 2.2.6 (and the two minor versions before, too) throws that errors: Nov 28 18:29:00 mailserv dovecot: imap(martin at example.com): Error: Transaction log /srv/vmail/example.com/martin/Maildir/dovecot.index.log: duplicate transaction log sequence (25) Nov 28 18:29:00 mailserv dovecot: imap(martin at example.com): Error:
2006 Jul 04
4
ROaR: A Ruby on Rails Podcast
I''m starting a new podcast to cover some of the hot topics going on in Rails. Half news, half interactive, all community. As always, the first episode kinda sucks but I''m looking forward to feedback from all of you on how to make it better. http://www.simiancodex.com/roar/ or for iTunes people http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=163609703 Michael
2007 Aug 06
2
used the described Class in a shared behavior
Is it possible to access the described class in a shared behavior? I''m trying to do something like this: describe "Siberian feline", :shared => true do described_class_instance_as :feline, :name => "fluffy", :breed => "Siberian" # or maybe before(:all) do @feline = described_class.new(:name => "fluffy", :breed =>
2011 Oct 25
7
additional model attributes
Hi, i have a "place" model with 2 columns (id, name). I''m calling an external api which gives me data to create a new place object. I would like to add the address from the external place to the place object and render it as a json result, without storing it in the database. i don''t get any errors, but the address never shows up within the json output. i''ve
2013 Apr 15
4
Rails' scaffold controller generator - should it test json format also?
(Forgive me if this is incorrect, because I recognized this initially as something in Rails 4.0.0.beta1 and have just done a cursory look over the latest generator code.) Noticed in Rails 4 that the test generated for a scaffold controller only tests the html format instead of both html and json:
2009 Dec 08
0
ActiveSupport 2.3.5 and json 1.2.0 gem
Hey, I''ve tried every trick I can find, yet I''m still unable to get the json gem and ActiveSupport to play nice. No matter in which order I load json and active support, I still end up with: NoMethodError: undefined method `[]'' for #<JSON::Ext::Generator::State:0x104b7fac0> I''m trying to use the JSON object directly, *not* as a ActiveSupport backend:
2013 Jan 05
1
Disable auth-worker log message?
Hi, is it possible to disable the line auth-worker(17128): mysql(127.0.0.1): Connected to database mailserver in dovecot 2.1.12? Logging is in "standard" mode. Thank you, Martin
2010 Dec 21
3
Does thunderbird 3.x fully supports dovecot 2 shared mailboxes ?
Hello Everything is in the subject ... If not which MUA does it ? Infos welcome Thanks
2013 Oct 11
1
Sieve and Namespace in dovecot 2.0.X
Based on what I read in http://wiki2.dovecot.org/Pigeonhole/Sieve/Usage, if I have a namespace defined as tail conf.d/10-mail.conf namespace inbox { inbox = yes location = prefix = INBOX. separator =. type = private } A global script like cat /etc/dovecot/sieve/global-spam.sieve require ["fileinto", "regex"]; # Must use regex here as 'contains' may not be
2014 Jun 05
2
Outlook 2007 & 2010 hangs in v2.2?
Has anybody noticed Outlook 2007 & 2010 (but apparently not 2013) hanging IMAP connections with Dovecot v2.2 (but not v2.1) when they're FETCHing large mails? I can't think of any reasonable explanation for this.
2011 Aug 17
2
JSON PUT/POST/UPDATE
Hey all... I''m building a RESTful JSON API and I find myself writing this: JSON.parse(request.body.read) ...over and over in every controller action that accepts JSON in the request body (which is a lot of actions). Does rails have a better built-in way to keep the code more DRY? Or should I solve that somehow myself? Thanks, Cainus -- You received this message because you are