Guest User

Untitled

a guest
Oct 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class AssetsController < ApplicationController
  2. def index
  3. @assets = Asset.all
  4. end
  5.  
  6. def create
  7. resource = OEmbed::Providers.get(params[:asset][:url])
  8. if Asset.create({
  9. :title => resource.title,
  10. :html => resource.html,
  11. :description => resource.description
  12. })
  13. redirect_to assets_path, :notice => "The asset was successfully saved."
  14. else
  15. render :new
  16. end
  17. end
  18.  
  19. def new
  20. @asset = Asset.new
  21. end
  22.  
  23. end
Add Comment
Please, Sign In to add comment