embed a video with embedly in a rails app

275 Views Asked by At

I try to use embedly in my rails 3.2 application. I register on embed.ly and have my key that I put in my application.js like this :

$.embedly.defaults.key = 'mykeycodexxxxxxxxxxxxx';

I have a field @mean.link that I would like to embed I look about embedly-ruby and embedly-jquery but I was not able to add nothing working. Perhaps because I'm not familiar with jquery or javascript and only with rails ?

Sorry for the very newbie's question

1

There are 1 best solutions below

0
On

Just add gem 'embedly' and run bundle install. then set require 'embedly' in your controller and initialiser/application.rb then add key in your view like

<%embedly_api = Embedly::API.new :key => 'xxxxxxxxxxxxxxxxxxxxxxxxxx'%>
<%=obj[0].marshal_dump %>

and require 'rails/all' require 'embedly' require 'json' to config/application.rb thats it you may also follow https://github.com/embedly/embedly-ruby...enjoy coding.