I am getting error at in registrationscontroller at 15 and 99 I have done following in my app
def user_params
#assumption: user params are coming in params[:user]
params.require(:user).permit(:first_name, :last_name, :mobile, :uid, :provider, :avatar )
end
in user.rb
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/
in migration
class AddAvatarToUsers < ActiveRecord::Migration
def change
add_attachment :users, :avatar
end
end
ActiveRecord::UnknownAttributeError in MyDevise::RegistrationsController#create
app/controllers/my_devise/registrations_controller.rb:99:in `build_resource'
app/controllers/my_devise/registrations_controller.rb:15:in `create'
Extracted source (around line #99):
def create
15. self.resource = build_resource(sign_up_params)
if resource.save
# yield resource if block_given?
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_format?
sign_up(resource_name, resource)
respond_with resource, :location => after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
expire_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
# temporary session data to the newly created user.
def build_resource(hash=nil)
99 self.resource = resource_class.new_with_session(hash || {}, session)
end
# Signs in a user on sign up. You can overwrite this method in your own