Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. ```
  2.  
  3. process :convert => 'png'
  4. process :tags => ['logo_entreprise']
  5.  
  6. version :standard do
  7. process :resize_to_fill => [150, 150, :north]
  8. end
  9.  
  10. version :thumbnail do
  11. resize_to_fit(50, 50)
  12. end
  13.  
  14.  
  15. def public_id
  16. "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  17. end
  18.  
  19. ```
  20. class Company < ApplicationRecord
  21. mount_uploader :identitylogo, IdentitylogoUploader
  22. end
  23.  
  24. ```
  25. def update
  26. @company.update(company_params)
  27. redirect_to company_path(@company)
  28. end
  29.  
  30. def company_params
  31. params.require(:company).permit(:identitylogo, :name, :industry,
  32. :employees, :website)
  33. end
  34.  
  35. ```
  36. <%= simple_form_for @company do |f| %>
  37. <%= f.input :name %>
  38. <%= f.input :industry %>
  39. <%= f.input :employees %>
  40. <%= f.input :website %>
  41. <%= f.input :identitylogo_cache, as: :hidden %>
  42. <%= f.input :identitylogo, label: false %>
  43.  
  44. <%= f.button :submit %>
  45. <% end %>
  46.  
  47. ```
  48. <img src="<%= @company.identitylogo %> " alt="Logo de
  49. l'entreprise">
  50.  
  51. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement