Guest User

Untitled

a guest
Feb 19th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.68 KB | None | 0 0
  1. -> /app/models/user.rb
  2.  
  3. class User < ActiveRecord::Base
  4.  
  5.   devise :database_authenticatable, :registerable, :recoverable, :trackable, :validatable
  6.  
  7.   attr_accessible :email, :password,
  8.     :password_confirmation,
  9.     :remember_me,
  10.     :fname,
  11.     :lname,
  12.     :bday,
  13.     :address,
  14.     :areacode,
  15.     :city,
  16.     :education,
  17.     :info,
  18.     :looking_for,
  19.     :tele
  20.  
  21.   has_attached_file :photo
  22.  
  23. end
  24.  
  25. -> Upload code
  26.  
  27.   <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :multipart => true }) do |f| %>
  28.  
  29.   <div class="field">
  30.     <%= f.file_field :photo %>
  31.   </div>
  32.  
  33. -> Show code
  34.  
  35.   <%= image_tag @user.photo.url %>
Add Comment
Please, Sign In to add comment