<% semantic_form_for @question, :remote=>true, do |form| %>
...
<% form.inputs do %>
...
<% end %>
<% form.buttons do %>
<%= form.commit_button :commit %>
<% end %>
<% end %>
def update
@question = Question.find(params[:id])
if @question.update_attributes(params[:question])
redirect_to @question
else
render :action => "edit"
end
end
В лог сыпет следущее:
Started POST "/questions/66" for 127.0.0.1 at 2011-01-11 11:43:47 +1000
Processing by QuestionsController#update as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"ZZ5Dw3/KswP1OUwCHcQLODNoQZ1ljkx65lShY3lOAiE=", "question"=>{"src"=>"section 9 qqпывпыв", "level"=>"", "active"=>"true", "section_id"=>"7"}, "teches"=>{"id"=>"1"}, "commit"=>"Update Question", "id"=>"66"}
Question Load (0.1ms) SELECT `questions`.* FROM `questions` WHERE (`questions`.`id` = 66) LIMIT 1
SQL (0.1ms) BEGIN
SQL (0.1ms) COMMIT
Redirected to http://0.0.0.0:3000/questions/66
Completed 302 Found in 59ms
Started GET "/questions/66" for 127.0.0.1 at 2011-01-11 11:43:47 +1000
Processing by QuestionsController#show as HTML
Parameters: {"id"=>"66"}
Question Load (0.1ms) SELECT `questions`.* FROM `questions` WHERE (`questions`.`id` = 66) LIMIT 1
Answer Load (0.1ms) SELECT `answers`.* FROM `answers` WHERE (`answers`.question_id = 66)
Section Load (0.1ms) SELECT `sections`.* FROM `sections` WHERE (`sections`.`id` = 7) LIMIT 1
Rendered questions/show.html.erb within layouts/application (35.9ms)
Completed 200 OK in 75ms (Views: 40.6ms | ActiveRecord: 0.3ms)
Processing by QuestionsController#update as JS - отправка данных, как видно. И проблема вылазит здесь: Processing by QuestionsController#show as HTML - страница попросту не обновляется и никакого перенаправления не происходит.
Единственное, что нашёл - это ругань (в одном месте всего) на jQuery. Но свою работу (фоновые запросы) он выполняет нормально. Роуты в порядке, вроде.
UP: self.request.xhr? возвращает true.
UP2: render :action => «show», :id => @question.id, :layout => 'application'
Теперь даёт:
ActionView::MissingTemplate (Missing template questions/show with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:js, :"*/*"], :locale=>[:en, :en]} in view paths "/home/wyldrodney/site/ameter/app/views"):
app/controllers/questions_controller.rb:40:in `update'