Hello all,
i want to create a method that i can use to update/count the points of
a village/user in my browser game. Every time the user clicks on a
link, the method should be used. The links should look something like
that :
<%= link_to('Update', village_path, :method => :update_points) %>
right or not?
The question is now: Where do i write this method? I did a test in the
village_controller:
def update_points
@village = Village.find(params[:id])
@village.points = 120
@village.save
end
can this work?
cause when i click on the link i just get :
No route matches "/villages/12"
When i open the /villages/12 without the method it works all fine.
My routes.rb :
Citywar::Application.routes.draw do
devise_for :users
resources :users, :only => [:index, :show]
resources :villages
root :to => 'pages#home'
end
So how can i solve this?
Best regards
Genji
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.