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 7878219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:35:53+00:00 2026-06-03T03:35:53+00:00

As a Rails newbie, I am running into an issue in which I can

  • 0

As a Rails newbie, I am running into an issue in which I can not figure out. I am currently using Devise for authentication and Paperclip for attachments. I have successfully added an upload field to the user edit and the image saves successfully.

My current setup right now is I have a header with a default Logo. I am trying to create a call that checks for if user has logo.

Application Helper:

def logo_for(user)

if user_signed_in? && user.logo.present?
  image_tag user.logo_url(:small)
else 
  image_tag("logo.png", :alt => "Sample App", :class => "round")

   end
end

_header.html.erb

<%= link_to logo_for(@user), root_path %>

User.rb

has_attached_file :logo,
:styles => { :small => "150x150>" },
:url  => "/images/logos/:id/:style/:basename.:extension",
:path => ":rails_root/public/images/logos/:id/:style/:basename.:extension",
:convert_options => { :all => "-auto-orient" }

 attr_accessible :users, :logo, :logo_file_name, :logo_content_type, :logo_file_size, :logo_updated_at
end

I am receiving errors stating NO HANDLER undefined Method

How do I go about basically tapping into check if the user has uploaded a logo and have that display instead of default?

TIA!

  • 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-03T03:35:54+00:00Added an answer on June 3, 2026 at 3:35 am

    I see a couple of things wrong in your logo_for method.

    Try changing user.logo.present? to user.logo? which is functionality provided Paperclip (I believe). Furthermore, your first image_tag reference should read as follows:

    image_tag user.logo.url(:small), notice I removed the underscore.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails newbie question that I can't seem to figure out. At some point I
Rails newbie here. I have a list of items which can have a status
I'm a rails newbie, I've been trying to figure out what is going on
As a newbie to rails I can't find how to solve my issue ^^
Rails newbie working on associating tasks with lists and running into trouble when I
im using Rails 3.2.8 and SQLite 1.3.6 and im running into troubles changing boolian
So, I'm admittedly a Rails newbie, and I'm running into what must be a
I'm a ruby/rails newbie and need to make a hash which can be manipulated
i'm a complete Rails newbie and would appreciate any assistance. I'm currently getting an
Rails newbie here. Can anyone please explain the difference to me between the following

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.