Ich verwende das Juwel "Best_in_Place", um Bereiche auf meiner Site an Ort und Stelle bearbeitbar zu machen. Ich habe zwei Modelle: Student und Education, mit der Beziehung, dass jeder Student has_many Educations hat. Ich habe die Best_in_place Funktionalität zu arbeiten, wenn die Bearbeitung von Attributen, die direkt im Studentenmodell sind, wieVerwenden von Best_in_Place zum Bearbeiten von Attributen
<%=best_in_place @student, :name =>
Allerdings habe ich nicht die Attribute eine Ausbildung mit einer Zeile wie
.. zu aktualisieren bekomme<%=best_in_place @education, :college =>
in der Sicht der Schüler/show, erhalten ich den Fehler
2012-03-25 13:06:57 -0400
Action bei "/ educations" für 127.0.0.1 Gestartet PUT :: RoutingError (Nein, ro ute passt [PUT] "/ educations")
und nicht nur funktioniert es nicht, der bearbeitbare Fleck verschwindet komplett. Ich kann nicht herausfinden, was das Problem verursacht, alles scheint für beide Modelle/Controller gleich zu sein. Meine Strecken sind sehr einfach:
resources :students
resources :educations
root :to => 'pages#home'
devise_for :students
als meine Controller sind:
def update
@student = Student.find(params[:id])
respond_to do |format|
if @student.update_attributes(params[:student])
format.html { redirect_to @student, notice: 'Student was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @student.errors, status: :unprocessable_entity }
end
end
end
vs
def update
@education = Education.find(params[:id])
respond_to do |format|
if @education.update_attributes(params[:education])
format.html { redirect_to @education, notice: 'Education was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @education.errors, status: :unprocessable_entity }
end
end
end
Wenn ich Wege harken, erhalte ich:
educations GET /educations(.:format) educations#index
POST /educations(.:format) educations#create
new_education GET /educations/new(.:format) educations#new
edit_education GET /educations/:id/edit(.:format) educations#edit
education GET /educations/:id(.:format) educations#show
PUT /educations/:id(.:format) educations#update
DELETE /educations/:id(.:format) educations#destroy
students GET /students(.:format) students#index
POST /students(.:format) students#create
new_student GET /students/new(.:format) students#new
edit_student GET /students/:id/edit(.:format) students#edit
student GET /students/:id(.:format) students#show
PUT /students/:id(.:format) students#update
DELETE /students/:id(.:format) students#destroy
Alle Hinweise wäre eine große Hilfe.
Haben Sie Lösung finden? Ich habe das gleiche Problem – macler