2008/5/23 Arie Kusuma Atmaja <[EMAIL PROTECTED]>:
> <tr><%= %w{ID Judul Status}.map { |e| content_tag :th, e }.unshift("")
> %></tr>
>
makasih masukannya pak
>
> > class BooksController < ApplicationController
>
> > def stok_habis
> > book = Book.find(params[:id])
>
> ta' tambahin, kalo bukunya yang berdasarkan params[:id] nggak
> ditemukan pasti itu error hayo diapakan biar gak error -_-
>
class BooksController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, :with => :show_404_errors
....
....
protected
def show_404_errors
tampilkan halaman not found atau apalah ke user
end
end
> > def stok_habis_checked
> > ids = params[:books].keys.join(',')
>
> kenapa proses satu baris diatas tidak anda pasang / masukkan di model
> saja sekalian :-) kan lebih bersih..
>
tadinya agar method di model itu nerima param nya generik yaitu string dgn
delimiter "," jadi di spec bisa, di controller jg bisa ga harus formatnya
params hash dri rails. Tp kalo ttp mau dimasukkan sampe batas ke array aja
brarti => ids = params[:books].keys
http://github.com/irfani/case_study/tree/master
--
irfani
http://irfani.web.id
Y! : irfani_s
[Non-text portions of this message have been removed]