ok langsam dreh ich durch.
hab jetzt die action im controller geändert folgendermaßen:
def index
if !params[:activation].nil?
@title = "Bestätigung"
@number = 1
@object = Object.find(:first, :conditions => ["activation_hash
= ?", params[:activation]])
if @object.nil?
render :text => "Fehler bei @object.nil? in activation"
else
if @object.activated == "ja"
@title = "Bereits aktiviert"
@number = 5
else
if @object.update_attribute(:activated, "ja")
ServiceMail.deliver_notification({:object => "@object"})
else
render :text => "Fehler in update_attribute(:activate, \"ja
\")"
end
end
end
end
if !params[:edit].nil?
@title = "Datenänderung"
@number = 2
@activation_hash = params[:edit]
@object = Object.find(:first, :conditions => ["activation_hash
= ?", @activation_hash])
if @object.nil?
render :text => "Fehler bei @object.nil? in activation"
else
if @object.activated == "ja"
@title = "Keine Änderung möglich"
@number = 5
end
end
end
end
und jetzt werden nur mehr "manchmal" die select tags richtig ausgefüllt
und manchmal nicht. weiters habe ich einen neuen error:
ActiveRecord::MultiparameterAssignmentErrors (1 error(s) on assignment
of multiparameter attributes):
app/controllers/confirmation_controller.rb:75:in `update'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
hier noch die action update
def update
render :text => "#{params}"
if params[:activation_hash].nil?
render :text => "params[:activation_hash] ist nil in action
update"
else
@object = Object.find(:first, :conditions => ["activation_hash = ?",
params[:activation_hash]])
if params[:object].nil?
render :text => "params[:object] ist nil in update"
else
if @object.update_attributes(params[:object])
@new_activation_hash = //Generierung neuer activation_hash
if @object.update_attribute(:activation_hash,
@new_activation_hash)
ServiceMail.deliver_confirmation({:object => @object})
else
render :text => "Fehler bei
update_attribute(:activation_hash, @new_activation_hash) in update"
end
else
render :text => "Fehler bei update_attributes(params[:object])
in update"
end
end
end
end
hoffe ich geb euch genug/die richtigen informationen.
mfg stefan
Am Mittwoch, den 20.05.2009, 09:32 +0200 schrieb Codeblogger:
> Hallo,
>
>
> @object ist bei Dir nil.
>
>
> Aus meiner Sicht klappt da schon die erste Zeile
>
>
> @object = Object.find(:first, :conditions => ["activation_hash
> = ?", params[:activation_hash]])
>
>
> nicht.
>
>
> Wie sieht denn der Parameter activation_hash bei Dir aus. Wird der
> übergeben?
>
>
> Außerdem prüft Dein unless-Statement nicht die Variable @object,
> sondern die Parameter params[:object].
>
>
> Eventuell willst du eher sowas wie
>
>
> unless @object
> # ...
> end
>
>
> Viele Grüße
> Nicolai
> _______________________________________________
> rubyonrails-ug mailing list
> [email protected]
> http://mailman.headflash.com/listinfo/rubyonrails-ug
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug