def create
@book = Book.friendly.find(params[:book_id])
@page = @book.pages.friendly.find(params[:page_id])
@picture = @page.images.new(image_params)
if @picture.save
...
end
end
private
def image_params
params.require(:picture).permit(:book_id, :picture)
end