I want to display a particular image on my landing page that I have uploaded through the dragonfly gem.
I am getting following error: param is missing or the value is empty: photo
this is what I have on my landing.html.erb view:
<%= image_tag @photo.1.image.thumb('150x185#').url if @photo.1.image_stored? %>
this is what I have on my pages controller:
class PagesController < ApplicationController
def landing
@photo = Photo.find(photo_params)
end
def photo_params
params.require(:photo).permit(:image)
end
end
How do I pass an id of 1 to my @photo object? I know this might be a newb question but I have spent several hours trying different things and nothing has worked. Thanks!
These are my routes:
root 'pages#landing'
match '/home', to: 'pages#home', via: 'get'
match '/about', to: 'pages#about', via: 'get'
match '/gallery', to: 'pages#gallery', via: 'get'
match '/events', to: 'pages#events', via: 'get'
match '/menu', to: 'pages#menu', via: 'get'
match '/testing', to: 'pages#testing', via: 'get'
match '/contacts', to: 'contacts#new', via: 'get'
resources "contacts", only: [:new, :create]
match '/events', to: 'pages#mevents', via: 'get'
resources "events", only: [:new, :create]
resources :photos