# Creating a new record without uploading an image- paperclip

**URL:** <https://www.ruby-forum.com/t/creating-a-new-record-without-uploading-an-image-paperclip/173623>\
**Category:** Rails\
**Created:** [August 12, 2009, 7:09am UTC](https://www.ruby-forum.com/t/creating-a-new-record-without-uploading-an-image-paperclip/173623 "2009-08-12T07:09:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbadlands](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jbadlands](https://www.ruby-forum.com/u/jbadlands)\
**Post date:** [August 12, 2009, 7:09am UTC](https://www.ruby-forum.com/t/creating-a-new-record-without-uploading-an-image-paperclip/173623/1 "2009-08-12T07:09:17Z")

</div>

My users have the ability to upload a profile picture, but I don’t want  
to require this upon registration.

I have a model called User, for auth and each User has\_ one a Profile  
The profiles model is where I’ve put my validation and keep the  
information about the upload

When a new user is created, I also want to add a new record to the  
profiles table,

such as

@user = User.new(params[:user])  
@user.save  
if @user.errors.empty?  
self.current\_user = @user

```
@profile = Profile.new(:name => @user.login, :user_id => @user.id)
@profile.save

if @profile.errors.empty?
  flash[:notice] = "Successfull"
  redirect_to('/')
else
  @errors = "Profile not created"
  render 'new'
end
else
flash[:notice] = "User not created fool"
redirect_to 'home'
end

```

The @profile.save is causing the problem because with no avatar data on  
registration, the validation on the profile model is failing.

How can set up paperclip so that if I’m creating a new record then those  
validations are not required?

---

<div class="post-metadata">

**Author:** ![jbadlands](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jbadlands](https://www.ruby-forum.com/u/jbadlands)\
**Post date:** [August 12, 2009, 7:54am UTC](https://www.ruby-forum.com/t/creating-a-new-record-without-uploading-an-image-paperclip/173623/2 "2009-08-12T07:54:07Z")

</div>

Unless you have explicitly validate for the presence of avatars, they  
are not mandatory. So, check your model to see if you have specified  
that. you can also check your table to see if you have marked those  
fields as not null, if so change it to null.

let me know, how it goes.

---

<div class="post-metadata">

**Author:** ![jbadlands](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8dc957/32.png) [@jbadlands](https://www.ruby-forum.com/u/jbadlands)\
**Post date:** [August 12, 2009, 8:27am UTC](https://www.ruby-forum.com/t/creating-a-new-record-without-uploading-an-image-paperclip/173623/3 "2009-08-12T08:27:17Z")

</div>

Removing that validation did allow me to create a record in the Users  
model. Thanks, I figured there was a reason it had to be there as most  
documentation suggests that it should be there.
