Problem mit in_place_editor

Hallo,

ich benutze den in_place_editor und habe das Problem, dass wenn ich auf
“OK” drücke, kommt “Saving…” und danach passiert nichts mehr. Die
Datenbankänderung wird auch nicht vorgenommen.

Weiß jemand, woran das liegen könnte?

Hallo Heinz,

ohne den Code zu kennen kann man Dir sicher schwer helfen. Poste Ihn
doch
einfach mal dann kann man dazu auch was sagen.

Herzliche
Grüße,Michael

Am 22.02.2008 16:45 Uhr schrieb “Heinz S.” unter
[email protected]:

Am 22.02.2008 um 16:45 schrieb Heinz S.:

Hallo,

ich benutze den in_place_editor

mhh. kannste mal nen link posten… interessiert mich. guter editor ?

Gruß

Werner L.
Lindenburger Allee 22 - 50931
Köln
0221.8805 635


http://www.webagentur-laude.de

Hallo Heinz,

magst Du auch den Controller-Quelltext posten?

Viele Grüße,
Sebastian

Hi,

@Michael:
Hier der verwendete Code.

index:

<% base_language_only do -%>

Please choose language for translation

<% end -%>

<% not_base_language do -%>

<%= "Language: " + Locale.language.native_name %>

<% @view_translations.each do |tr| -%> <%= render :partial => 'translation_form', :locals => {:tr => tr}%> <% end -%>
<% end -%> ------------------------------

translation_form:

<%=tr.tr_key%>
<%= render :partial => 'translation_text', :object => tr.text %> <%= in_place_editor "tr_#{tr.id}", :url => { :action => :set_translation_text, :id => tr.id }, :load_text_url => url_for({ :action => :translation_text, :id => tr.id })%>

------------------------------

Und das Ergebnis im Browser:

dsadsa
[no translation]

... ------------------------------

Hoffe, es hilft.

@Werner:
Habe ein Globalize-Tutorial gemacht
(http://wiki.globalize-rails.org/globalize/show/Example+Application) und
dabei wird in_place_editor
(Peak Obsession)
verwendet.

welche Rails Version benutzt Du?
Was steht im Log, nachdem der Fehler aufgetreten ist?
Gruss,
Roman

Heinz S. schrieb:

Hi,

habe gerade mal mit protect_from_forgery rumgespielt. Wenn ich es ändere
mit dem Parameter :only => [:update] bei geht es. Aber wenn ich es
umstell hab ich ehrlich gesagt, bisschen Sicherheitsbedenken.
protect_from_forgery soll ja von irgendwelchen Attacken bzw.
Sicehrheitslücken schützen…

das ist der Fehler!

ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):

Falls Du cookie based sessions benutzt, solltest Du im
ApplicationConroller bei protect_from_forgery den :secret Key
auskommentieren.
Im Falle einer ActiveRecord based session sollte der Key gesetzt sein.
So sollte es funktionieren.
Gruss,
Roman

Heinz S. schrieb:

Hallo,

danke erstmal für die Hilfsbereitschaft!

@Sebastian:
Der Controller, der fürs übersetzen zuständig ist:

class Admin::TranslateController < ApplicationController
def index
@view_translations = ViewTranslation.find(:all,
:conditions => [ ‘text IS NULL AND language_id = ?’,
Locale.language.id ],
:order => ‘tr_key’)
end

def translation_text
@translation = ViewTranslation.find(params[:id])
render :text => @translation.text || “”
end

def set_translation_text
@translation = ViewTranslation.find(params[:id])
previous = @translation.text
@translation.text = params[:value]
@translation.text = previous unless @translation.save
render :partial => “translation_text”, :object => @translation.text
end
end

@Roman:
Benutze folgende Versionen:
Rails 2.0.2
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
gem 1.0.1

Log ist etwas größer, habe sie komplett geleert, Server gestartet und
dann nur Seite aufgerufen, in_place_editor aufgerufen und dann Änderung
abgeschickt:

Processing TranslateController#index (for 127.0.0.1 at 2008-02-23
14:03:32) [GET]
Session ID:
BAh7BzoMY3NyZl9pZCIlMzQ4NmM2ZGQyNTdlMTczZTYxNmFhMTNiZmQwYTRj%0AMTkiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D–ca0d21d90806f68a22c3dbb1261e67ab56908875
Parameters: {“action”=>“index”, “controller”=>“admin/translate”,
“locale”=>“es”}
WARNING: You’re using the Ruby-based MySQL library that ships with
Rails. This library is not suited for production. Please install the
C-based MySQL library instead (gem install mysql).
e[4;36;1mSQL (0.000000)e[0m e[0;1mSET SQL_AUTO_IS_NULL=0e[0m
Cookie set: locale=es; path=/
e[4;35;1mGlobalize::Language Columns (0.005000)e[0m e[0mSHOW FIELDS
FROM globalize_languagese[0m
e[4;36;1mGlobalize::Language Load (0.003000)e[0m e[0;1mSELECT * FROM
globalize_languages WHERE (globalize_languages.iso_639_1 = ‘es’)
LIMIT 1e[0m
e[4;35;1mGlobalize::ViewTranslation Columns (0.007000)e[0m e[0mSHOW
FIELDS FROM globalize_translationse[0m
e[4;36;1mGlobalize::ViewTranslation Load (0.015000)e[0m e[0;1mSELECT

  • FROM globalize_translations WHERE (text IS NULL AND language_id =
  1. AND ( (globalize_translations.type = ‘ViewTranslation’ ) )
    ORDER BY tr_keye[0m
    Rendering template within layouts/application
    Rendering admin/translate/index
    e[4;35;1mGlobalize::Language Load (0.004000)e[0m e[0mSELECT * FROM
    globalize_languages WHERE (globalize_languages.rfc_3066 = ‘de-DE’)
    LIMIT 1e[0m
    e[4;36;1mGlobalize::Language Load (0.004000)e[0m e[0;1mSELECT * FROM
    globalize_languages WHERE (globalize_languages.iso_639_1 = ‘de’)
    LIMIT 1e[0m
    Rendered admin/translate/_translation_text (0.00300)
    Rendered admin/translate/_translation_form (0.02000)
    Rendered admin/translate/_translation_text (0.00100)
    Rendered admin/translate/_translation_form (0.00100)
    Rendered admin/translate/_translation_text (0.00000)
    Rendered admin/translate/_translation_form (0.00200)
    Rendered admin/translate/_translation_text (0.00000)
    Rendered admin/translate/_translation_form (0.00100)
    Completed in 0.14200 (7 reqs/sec) | Rendering: 0.07000 (49%) | DB:
    0.03800 (26%) | 200 OK [http://localhost/es/admin/translate]

Processing TranslateController#translation_text (for 127.0.0.1 at
2008-02-23 14:03:36) [GET]
Session ID:
BAh7BzoMY3NyZl9pZCIlMzQ4NmM2ZGQyNTdlMTczZTYxNmFhMTNiZmQwYTRj%0AMTkiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D–ca0d21d90806f68a22c3dbb1261e67ab56908875
Parameters: {“action”=>“translation_text”, “id”=>“7046”,
“controller”=>“admin/translate”, “editorId”=>“tr_7046”, “locale”=>“es”}
Cookie set: locale=es; path=/
e[4;35;1mGlobalize::ViewTranslation Load (0.002000)e[0m e[0mSELECT *
FROM globalize_translations WHERE (globalize_translations.id =
7046) AND ( (globalize_translations.type = ‘ViewTranslation’ ) )
e[0m
Completed in 0.01500 (66 reqs/sec) | Rendering: 0.00100 (6%) | DB:
0.00200 (13%) | 200 OK
[http://localhost/es/admin/translate/translation_text/7046?editorId=tr_7046]

Processing TranslateController#set_translation_text (for 127.0.0.1 at
2008-02-23 14:03:40) [POST]
Session ID:
BAh7BzoMY3NyZl9pZCIlMzQ4NmM2ZGQyNTdlMTczZTYxNmFhMTNiZmQwYTRj%0AMTkiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh%0Ac2h7AAY6CkB1c2VkewA%3D–ca0d21d90806f68a22c3dbb1261e67ab56908875
Parameters: {“action”=>“set_translation_text”, “id”=>“7046”,
“value”=>“Test”, “controller”=>“admin/translate”, “editorId”=>“tr_7046”,
“locale”=>“es”}

ActionController::InvalidAuthenticityToken
(ActionController::InvalidAuthenticityToken):
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/request_forgery_protection.rb:79:in
verify_authenticity_token' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:469:in send!’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:469:in
call' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:441:in run’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:716:in
run_before_filters' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:695:in call_filters’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in
perform_action_without_benchmark' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue’
D:/ruby/lib/ruby/1.8/benchmark.rb:293:in measure' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
perform_action_without_caching' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in perform_action’
D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
cache' D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in cache’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in
perform_action' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in send’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in
process_without_filters' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in process_without_session_management_support’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
process' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in process’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
handle_request' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in dispatch’
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
dispatch_cgi' D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in dispatch’
D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in
handle_dispatch' D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in service’
D:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' D:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run’
D:/ruby/lib/ruby/1.8/webrick/server.rb:173:in start_thread' D:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start’
D:/ruby/lib/ruby/1.8/webrick/server.rb:162:in start_thread' D:/ruby/lib/ruby/1.8/webrick/server.rb:95:in start’
D:/ruby/lib/ruby/1.8/webrick/server.rb:92:in each' D:/ruby/lib/ruby/1.8/webrick/server.rb:92:in start’
D:/ruby/lib/ruby/1.8/webrick/server.rb:23:in start' D:/ruby/lib/ruby/1.8/webrick/server.rb:82:in start’
D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in
dispatch' D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66 D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require’
D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in require’
D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in' D:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in require’
D:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' D:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in require’
./script/server:3
-e:2:in `load’
-e:2

Rendering
D:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
(unprocessable_entity)