Vidal Graupera
2008-Aug-05 21:25 UTC
[Facebooker-talk] profile_publisher_extensions.rb line #17
Hi, def render_publisher_interface (fbml,publish_enabled=true,comment_enabled=false) render :json = > {:content = > {:fbml = > fbml,:publishEnabled=>publish_enabled,:commentEnabled=>comment_enabled}, :method=>"publisher_getInterface"} end The end of that line doesnt have ".to_json" Is this intentional or a bug? Seems like an oversight to me. Thanks, Vidal. ================ Vidal Graupera vidalg at a2z.com 650-331-2714 130 Lytton Ave., Suite 300 Palo Alto, CA 94301 UnSpun by Amazon: Community Opinions ... Ranked! http://unspun.amazon.com
Mike Mangino
2008-Aug-05 21:44 UTC
[Facebooker-talk] profile_publisher_extensions.rb line #17
Doesn''t Rails automatically call to_json on anything passed to render :json? The existing code is working for me. Mike On Aug 5, 2008, at 5:25 PM, Vidal Graupera wrote:> Hi, > > def > render_publisher_interface > (fbml,publish_enabled=true,comment_enabled=false) > > render > :json > = > > > {:content > = > > > {:fbml > = > > > fbml > ,:publishEnabled=>publish_enabled,:commentEnabled=>comment_enabled}, > :method=>"publisher_getInterface"} > end > > The end of that line doesnt have ".to_json" > > Is this intentional or a bug? Seems like an oversight to me. > > Thanks, > > Vidal. > > > > > ================> > Vidal Graupera > vidalg at a2z.com > 650-331-2714 > 130 Lytton Ave., Suite 300 > Palo Alto, CA 94301 > > UnSpun by Amazon: Community Opinions ... Ranked! > http://unspun.amazon.com > > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk-- Mike Mangino http://www.elevatedrails.com
Vidal Graupera
2008-Aug-05 23:33 UTC
[Facebooker-talk] profile_publisher_extensions.rb line #17
Hi Mike, It didn''t seem to do it for me, but the project I am working on is on Rails 1.2.6. (Maybe it does on 2.x.) Note: on line #24 of the same file, there is a "to_json" so as a minor point it should be removed for consistency. It was confusing to me. I know this is probably not an issue for most people since they are on Rails 2.x, but, for anyone who hits this problem. I found that Rails 1.x does not generate valid JSON (at least not valid enough for FB) so Facebook will reject the output render_publisher_interface call. As a work around, I used the ruby json gem instead--adding "require ''json''" and used JSON.unparse to make this call work. Cheers, Vidal. On Aug 5, 2008, at 2:44 PM, Mike Mangino wrote:> Doesn''t Rails automatically call to_json on anything passed to > render :json? > > The existing code is working for me. > > Mike > > On Aug 5, 2008, at 5:25 PM, Vidal Graupera wrote: > >> Hi, >> >> def >> render_publisher_interface >> (fbml,publish_enabled=true,comment_enabled=false) >> >> render >> :json >> >>> >> {:content >> >>> >> {:fbml >> >>> >> fbml >> ,:publishEnabled=>publish_enabled,:commentEnabled=>comment_enabled}, >> :method=>"publisher_getInterface"} >> end >> >> The end of that line doesnt have ".to_json" >> >> Is this intentional or a bug? Seems like an oversight to me. >> >> Thanks, >> >> Vidal. >> >> >> >> >> ================>> >> Vidal Graupera >> vidalg at a2z.com >> 650-331-2714 >> 130 Lytton Ave., Suite 300 >> Palo Alto, CA 94301 >> >> UnSpun by Amazon: Community Opinions ... Ranked! >> http://unspun.amazon.com >> >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > >================ Vidal Graupera vidalg at a2z.com 650-331-2714 130 Lytton Ave., Suite 300 Palo Alto, CA 94301 UnSpun by Amazon: Community Opinions ... Ranked! http://unspun.amazon.com
Mike Mangino
2008-Aug-06 11:59 UTC
[Facebooker-talk] profile_publisher_extensions.rb line #17
Okay. I''ll add the to_json call there. At this point, Rails 1.2 is two versions out of date, so I don''t plan on working too hard to support it. Mike On Aug 5, 2008, at 7:33 PM, Vidal Graupera wrote:> Hi Mike, > > It didn''t seem to do it for me, but the project I am working on is > on Rails 1.2.6. (Maybe it does on 2.x.) > > Note: on line #24 of the same file, there is a "to_json" so as a > minor point it should be removed for consistency. It was confusing > to me. > > I know this is probably not an issue for most people since they are > on Rails 2.x, but, for anyone who hits this problem. I found that > Rails 1.x does not generate valid JSON (at least not valid enough > for FB) so Facebook will reject the output > render_publisher_interface call. As a work around, I used the ruby > json gem instead--adding "require ''json''" and used JSON.unparse to > make this call work. > > Cheers, > > Vidal. > > On Aug 5, 2008, at 2:44 PM, Mike Mangino wrote: > >> Doesn''t Rails automatically call to_json on anything passed to >> render :json? >> >> The existing code is working for me. >> >> Mike >> >> On Aug 5, 2008, at 5:25 PM, Vidal Graupera wrote: >> >>> Hi, >>> >>> def >>> render_publisher_interface >>> (fbml,publish_enabled=true,comment_enabled=false) >>> >>> render >>> :json >>> >>>> >>> {:content >>> >>>> >>> {:fbml >>> >>>> >>> fbml >>> ,:publishEnabled=>publish_enabled,:commentEnabled=>comment_enabled}, >>> :method=>"publisher_getInterface"} >>> end >>> >>> The end of that line doesnt have ".to_json" >>> >>> Is this intentional or a bug? Seems like an oversight to me. >>> >>> Thanks, >>> >>> Vidal. >>> >>> >>> >>> >>> ================>>> >>> Vidal Graupera >>> vidalg at a2z.com >>> 650-331-2714 >>> 130 Lytton Ave., Suite 300 >>> Palo Alto, CA 94301 >>> >>> UnSpun by Amazon: Community Opinions ... Ranked! >>> http://unspun.amazon.com >>> >>> _______________________________________________ >>> Facebooker-talk mailing list >>> Facebooker-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/facebooker-talk >> >> -- >> Mike Mangino >> http://www.elevatedrails.com >> >> >> > > ================> > Vidal Graupera > vidalg at a2z.com > 650-331-2714 > 130 Lytton Ave., Suite 300 > Palo Alto, CA 94301 > > UnSpun by Amazon: Community Opinions ... Ranked! > http://unspun.amazon.com >-- Mike Mangino http://www.elevatedrails.com