Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= simple_form_for(@post, html: {class: 'form-horizontal' }) do |f| %>
- <%= f.error_notification %>
- <%= f.input_field :title, placeholder: "Enter Title" %>
- <%= f.input_field :body, id: "body-field", placeholder: "Provide all the facts." %>
- <%= f.input_field :photo %>
- <%= f.input_field :file %>
- <%= f.button :submit, class: "btn btn-primary pull-left" %>
- <% end %>
- class PhotoUploader < CarrierWave::Uploader::Base
- include CarrierWave::RMagick
- storage :fog
- include CarrierWave::MimeTypes
- process :set_content_type
- def store_dir
- "images/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
- end
- version :main_thumb_mobile do
- process :resize_to_fit => [52, 52]
- end
- version :main_thumb do
- process :resize_to_fit => [150, 150]
- end
- version :post_thumb do
- process :resize_to_fit => [200, 200]
- end
- version :large do
- process :resize_to_limit => [400, 400]
- end
- def extension_white_list
- %w(jpg jpeg gif png)
- end
- end
- class FileUploader < CarrierWave::Uploader::Base
- storage :fog
- def store_dir
- "files/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
- end
- def extension_white_list
- %w(pdf doc docx xls xlsx ppt pptx txt mp4 m4v mov avi mkv mp3 wav)
- end
- end
- # == Schema Information
- # truncated for brevity
- # Table name: posts
- #
- # id :integer not null, primary key
- # title :text
- # photo :string(255)
- # body :text
- # user_id :integer
- # file :string(255)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement