Falls @depth = params[:books][:depth] noch so in Deinem Controller steht
kann es auch nicht gehen. params[:books] gibt es nicht und ist somit
nil.
Am 12.10.2009 um 22:41 schrieb player man:
ja das stimmt es heisst f.submit ;-) bin jetzt zwar ein schritt
weiter aber nicht ganz ;-)
das problem ist das es zwar für source einwandfrei funktioniert aber
für die anderen variablen leider nicht ! ich hab jetzt die andere
variablen auskommentiert und gebe es in der view aus und prompt
kommt der fehler wieder :
NoMethodError in BooksController#index
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
RAILS_ROOT: C:/FORCE-~1/INSTAN~1/rails_apps/books_with_simple_data
Application Trace | Framework Trace | Full Trace
app/controllers/books_controller.rb:10:in `index'
meine view sieht so aus :
<% form_for :book do |f| %>
<p>
<label> :source </label><br>
<%=f.text_field :source %>
</p>
<p>
<label>:depth </label><br>
<%= f.text_field :depth %>
</p>
<p>
<label>:destination </label><br>
<%= f.text_field :destination %>
</p>
<p>
<label>:dest_space </label><br>
<%= f.text_field :dest_space %>
</p>
<p>
<label>:parentId </label><br><br>
<%= f.text_field :parentId %>
</p>
<p>
<%= f.submit "Create" %>
</p>
<% end %>
<%= @source %>
<%= @depth %>
<%= @destination %>
<%= @dest_space %>
<%= @parentId %>
und mein controller so :
class BooksController < ApplicationController
def index
require 'little_helpers_spezial'
#confluence = Confluence::Server.new("https://spoi.telekom.de/info")
#confluence.login(Einloggen_spezial::X_login,
Einloggen_spezial::X_pwd)
@source = params[:book][:source]
@depth = params[:books][:depth]
#x = Little_Helpers_spezial.make_ready_for_export(confluence,
source , depth)
@destination = params[:book][:destination]
@dest_space = params[:book][:dest_space]
@parentId = params[:book][:parentId]
#Little_Helpers_spezial.save(confluence, x, destination,
dest_space,parentId)
end
end
ausschnitt von der logdatei :
Processing BooksController#index (for 127.0.0.1 at 2009-10-12
22:36:09) [GET]
Session ID:
BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsABjoKQHVzZWR7AA%3D%3D--
c1d089a733b03d166ae645c6747eb02fb8800287
Parameters: {"action"=>"index", "controller"=>"books"}
NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]):
/app/controllers/books_controller.rb:10:in `index'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/base.rb:1158:in
`perform_action_without_filters'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/filters.rb:697:in
`call_filters'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/filters.rb:689:in
`perform_action_without_benchmark'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/1.8/benchmark.rb:293:in
`measure'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in
`perform_action_without_rescue'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/rescue.rb:199:in
`perform_action_without_caching'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/caching.rb:678:in
`perform_action'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/connection_adapters/abstract/
query_cache.rb:33:in `cache'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/caching.rb:677:in
`perform_action'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/base.rb:524:in
`process_without_filters'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/filters.rb:685:in
`process_without_session_management_support'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/session_management.rb:123:in
`process'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in
`handle_request'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in
`dispatch_cgi'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/rails.rb:76:in `process'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/rails.rb:74:in `synchronize'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/rails.rb:74:in `process'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:159:in `process_client'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:158:in `each'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:158:in `process_client'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:285:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:285:in `initialize'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:285:in `new'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:285:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:268:in `initialize'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:268:in `new'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel.rb:268:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/configurator.rb:282:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/configurator.rb:281:in `each'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/configurator.rb:281:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/mongrel_rails:128:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/../lib/mongrel/command.rb:212:in `run'
C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-
x86-mswin32/bin/mongrel_rails:281
C:/FORCE-~1/INSTAN~1/ruby/bin/mongrel_rails:19:in `load'
C:/FORCE-~1/INSTAN~1/ruby/bin/mongrel_rails:19
Rendering C:/FORCE-~1/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/
actionpack-2.0.2/lib/action_controller/templates/rescues/layout.erb
(internal_server_error)
aber immerhin bin ich ein schritt weiter dank euch ;-))))))))
From: ro...@sladeczek.de
To: rubyonrails-ug@headflash.com
Date: Mon, 12 Oct 2009 22:35:57 +0200
Subject: Re: [Rubyonrails-ug] controller problem !
sorry, es muss f.submit und nicht f.submit_tag heissen.
Falls es wieder nicht klappen sollte, schick mir mal den Ausschnitt
aus dem log, welcher beim abschicken des Formulars generiert wird.
Mich interessiert vor allem der params-Hash.
Am 12.10.2009 um 22:27 schrieb player man:
tag "Create" %>
Windows Live Hotmail: Your friends can get your Facebook updates,
right from Hotmail®._______________________________________________
rubyonrails-ug mailing list
rubyonrails-ug@headflash.com
http://mailman.headflash.com/listinfo/rubyonrails-ug
Roman Sladeczek
Consulting & IT
Voßstr. 4
81543 München
TEL.: +49 89 54075045
Mobil: +49 163 7348177
Email: ro...@sladeczek.de
_______________________________________________
rubyonrails-ug mailing list
rubyonrails-ug@headflash.com
http://mailman.headflash.com/listinfo/rubyonrails-ug