I have a rails 4 app that I use with simple form and carrierwave.
In my profile view, I have a form that includes a request for users to nominate their university, as follows:
<%= f.collection_select :university, University.all, :id, :name %>
In my university model, I create universities and add their associated logos:
{ :class => 'question-project' }, placeholder: 'Your uni name', :input_html => {:style=> 'width: 650px', class: 'response-project'} %> <%= f.label :'Your university logo', :label_html => { :class => 'question-project' }, placeholder: 'Insert JPG image', :input_html => {:style=> 'width: 650px', class: 'response-project'}%>
<%= f.file_field :logo %>
I have an avatar_uploader which has a logo version to resize the image of the university logo. I call that version: logo.
I use that in my profile view to show the university and the university logo as follows:
<%= image_tag (@profile.university.logo.logo) %>
The first logo is a reference to the logo in the university table and the second is to the name of the avatar uploader version.
I get an error when I test this that says:
undefined method `logo' for nil:NilClass
Does anyone know what this means?
Thank you