coba di view source
elemen HTML form-nya bener keluar ada ID nya nggak?
kalo nggak keluar berarti @album.id nya Nil
kalo begitu baris ini :
> <% form_tag :action => "update", :id => @album.id do %>
>
coba diganti jadi :
> <% form_tag :action => "update", :id =>params[:id] do %>
>
dengan pertimbangan restful routes
semoga bener :)
Gozali
On Dec 24, 2009, at 4:21 PM, afrizal wrote:
>
> Hallo teman2,
> saya pemula yg sedang belajar RoR, dan mendapatkan error dengan
> pesan seperti subject email ini di atas.
> Saya membuat edit.rhtml sbb :
> <% form_tag :action => "update", :id => @album.id do %>
> Title : <%= text_field(:album, :title) %> <br/> Artist : <
> %= text_field(:album, :artist) %> <br/> Genre : <%=
> text_field(:album, :genre) %> <br/> Release Date : <%=
> datetime_select(:album, :release_date, :start_year => 1960)
> %> <br/> <br/>
> <%= submit_tag("Edit") %> <br/>
> <% end %>
>
> Dan saya mempunyai action sbb:
> def update @album = Album.find(params[:id]) if
> @album.update_attributes(params[:album]) redirect_to(:action =>
> 'list') else render(:action => 'edit') end end
> Setelah saya menulis di URL : http://localhost:3000/public/edit/
> 1Lalu mengupdate data di form yang muncul, dan meng-click "Edit"
> Muncul pesan error di halaman : http://localhost:3000/public/update
> yaitu :
> ActiveRecord::RecordNotFound
>
> in PublicController#update
>
>
> Couldn't find Album without an ID
> Mohon pencerahannya pada para expert.
> Terima kasih.
>
> [Non-text portions of this message have been removed]
>
>
>
[Non-text portions of this message have been removed]
------------------------------------
ID-Ruby
Berdiskusi dan belajar bersama Bahasa Pemrograman Ruby, termasuk segala varian
Ruby (JRuby, Rubinius, IronRuby, XRuby), dan program yang dibuat dengan Ruby
(Ruby on Rails, JRuby on Rails, Merb)
<*> Follow Ruby Indonesia on Twitter
http://twitter.com/rubyindonesia
<*> Kunjungi Situs Resmi Ruby Indonesia
http://www.ruby-lang.org/id/
<*> Join Ruby Indonesia on Facebook
http://rubyurl.com/QV48
<*> Join Ruby Indonesia on LinkedIn
http://rubyurl.com/eh0i
<*> Kunjungi *arsip milis* id-ruby di
http://groups.yahoo.com/group/id-ruby/messages
http://www.mail-archive.com/[email protected]/
http://rubyurl.com/Q8DD
http://news.gmane.org/gmane.comp.lang.ruby.region.indonesia
<*> Baca peraturan id-ruby sebelum posting
http://rubyurl.com/gay1
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/id-ruby/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/id-ruby/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/