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?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to