Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying User Logo After Upload + Devise
    primarykey
    data
    text
    <p>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. </p> <p>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.</p> <p><strong>Application Helper:</strong></p> <pre class="lang-ruby prettyprint-override"><code>def logo_for(user) if user_signed_in? &amp;&amp; user.logo.present? image_tag user.logo_url(:small) else image_tag("logo.png", :alt =&gt; "Sample App", :class =&gt; "round") end end </code></pre> <p><strong>_header.html.erb</strong></p> <pre class="lang-ruby prettyprint-override"><code>&lt;%= link_to logo_for(@user), root_path %&gt; </code></pre> <p><strong>User.rb</strong></p> <pre class="lang-ruby prettyprint-override"><code>has_attached_file :logo, :styles =&gt; { :small =&gt; "150x150&gt;" }, :url =&gt; "/images/logos/:id/:style/:basename.:extension", :path =&gt; ":rails_root/public/images/logos/:id/:style/:basename.:extension", :convert_options =&gt; { :all =&gt; "-auto-orient" } attr_accessible :users, :logo, :logo_file_name, :logo_content_type, :logo_file_size, :logo_updated_at end </code></pre> <p>I am receiving errors stating <strong>NO HANDLER</strong> undefined Method</p> <p>How do I go about basically tapping into check if the user has uploaded a logo and have that display instead of default?</p> <p>TIA!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload