edgarjs / ajaxful-rating

Provides a simple way to add rating functionality to your application.
http://rdoc.info/projects/edgarjs/ajaxful-rating
417 stars 127 forks source link

How to write member routes in rails 3.0 above versions #89

Closed RajeshCherukuri closed 7 years ago

RajeshCherukuri commented 11 years ago

Hii

I have seen routes file in ajaxful-rating demo app. they are some thing like

map.resources :users, :member => {:rate => :post} map.resources :cars, :member => {:rate => :post} These syntax is not allowed in latest rails so please tell me How to write routes for ajaxful _rating in rails 3.0 above..

Thanks GalaxyS3

devn commented 11 years ago
resources :cars do
  post :rate, :on => :member
end

or

resources :cars do
  member do
    post :rate
  end
end
Tambe257 commented 11 years ago

I'm still having routing errors. I get this error: No route matches {:action=>"rate", :controller=>"pins", :id=>#<Pin id: nil, description: nil, created_at: nil, updated_at: nil, user_id: 1, image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, image_remote_url: nil, artist: nil, album: nil, date: nil, rank: nil, video_html: nil, video: nil>}

I have this in my routes.rb file: resources :pins do member do post :rate end end

I want the user to rate a pin that he posts, but I can't seem to figure this out! Any help would be appreciated.