Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```
- process :convert => 'png'
- process :tags => ['logo_entreprise']
- version :standard do
- process :resize_to_fill => [150, 150, :north]
- end
- version :thumbnail do
- resize_to_fit(50, 50)
- end
- def public_id
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
- end
- ```
- class Company < ApplicationRecord
- mount_uploader :identitylogo, IdentitylogoUploader
- end
- ```
- def update
- @company.update(company_params)
- redirect_to company_path(@company)
- end
- def company_params
- params.require(:company).permit(:identitylogo, :name, :industry,
- :employees, :website)
- end
- ```
- <%= simple_form_for @company do |f| %>
- <%= f.input :name %>
- <%= f.input :industry %>
- <%= f.input :employees %>
- <%= f.input :website %>
- <%= f.input :identitylogo_cache, as: :hidden %>
- <%= f.input :identitylogo, label: false %>
- <%= f.button :submit %>
- <% end %>
- ```
- <img src="<%= @company.identitylogo %> " alt="Logo de
- l'entreprise">
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement