Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9040965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:07:19+00:00 2026-06-16T10:07:19+00:00

My app uses carrierwave and omniauth (facebook) and I have one minor issue. When

  • 0

My app uses carrierwave and omniauth (facebook) and I have one minor issue.

  1. When user first logs in with Facebook account, I make his facebook profile image as his default image. (He doesn’t have to sign up with FB account or anything. When he logs in, he’s signed up to my application without providing any more information)
  2. When user first creates an account “locally” from my app, he can choose to upload a profile image. Therefore, there’s a profile_image field in User model, and ProfileUploader from carrierwave is mounted on this field.

Problem: When I save facebook image url to this field, it gives me error. I think this is happening because there’s an uploader mounted to this field, and although the field is a string type, I can’t just save a URL to this field without uploading images via carrierwave.

I worked around this issue by storing the FB image url to a different field, other_profile_image, and whenever the user’s account is created from FB, I call his image from this field.

For example,

<% if @user.provider == "local" %>
        <% if @user.profile_image.blank? %>
            <%= link_to image_tag('default.jpg'), '/users/'+@user.id.to_s %>
        <% else %>
            <%= link_to image_tag(@user.profile_image_url(:thumb)), '/users/'+@user.id.to_s %>
        <% end %>
<% elsif @user.provider == "facebook" %>
        <%= link_to image_tag(@user.other_profile_image), '/users/'+@user.id.to_s %>
<% end %>

provider=local specifies accounts created on the application, not from other third-parties like FB

My workaround does a job, but it’s bugging me because I know there must be a better solution to handle this problem. I need to find out how to handle the following simple tasks:

  1. When user signs up locally, he can choose to upload a profile picture. If he doesn’t, I want to store my default image’s url to his profile image url field.
  2. When user uses his FB account, his facebook image should be set to his initial profile picture. Right now, I’m using two different field, profile_image and other_profile_image because carrierwave threw errors when I tried to store URL strings into profile_image field, on which a carrierwave uploader was mounted.

I hope there is a great way to solve this issue! I appreciate any help in advance. Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T10:07:20+00:00Added an answer on June 16, 2026 at 10:07 am

    You can upload photo from remote url.

    class User < ActiveRecord::Base
      attr_accessible :profile_image, :remote_profile_image_url
    
      mount_uploader :profile_image, ProfileUploader
    end
    
    
    # somethere
    user.remote_profile_image_url = "http://example.com/userpic.png"
    user.save
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small Rails 3.2.1 app that uses CarrierWave 0.5.8 for file uploads
Our Rails 3 app uses facebook-omniauth, allowing users to authenticate with facebook. It'd be
My Rails app uses carrierwave to manage image uploads. I have a watermark version
My app uses GPS. At first launch, user is asked if he want's to
My app uses gcm. Each time user logs in, new gcm token is registered
My app uses XML to save user data to a file. I have just
I have an app that uses Carrierwave, S3 and rmagci. more or less following
My app uses a landscape only view and requires the user to answer a
My app uses a per-user session to allow multiple sessions from the same user
My app uses a BroadcastReceiver and a service to perform background updates. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.