I am getting a Rails error when i create a new "car_image"... the AJAX response is
undefined method `car_image_path' for #<CarImage:0x007fdbb1b79258>
Route defined
resources :car_images, :only => [:index, :create, :destroy]
Rake Routes
car_images GET /car_images(.:format) car_images#index
POST /car_images(.:format) car_images#create
car_image DELETE /car_images/:id(.:format) car_images#destroy
However, the route is setup and i can see it when i rake routes, so i am not sure what the issue is. I am using the route in my model method:
class CarImage < ActiveRecord::Base
belongs_to :car
attr_accessible :description, :image, :title, :car_id, :file
mount_uploader :file, CarImageUploader
def to_jq_upload
{
"name" => read_attribute(:file),
"size" => file.size,
"url" => file.url,
"thumbnail_url" => file.thumb.url,
"delete_url" => car_image_path(:id => id),
"delete_type" => "DELETE"
}
end
end
What would be causing the undefined method here? The record does save, but i get the error response...