Ruby on Rails - COPLEC
Ruby on Rails - COPLEC
Ruby on Rails - COPLEC
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CONTROLADOR<br />
class AdminC<strong>on</strong>troller < Applicati<strong>on</strong>C<strong>on</strong>troller<br />
def index<br />
list<br />
render :acti<strong>on</strong> => 'list'<br />
end<br />
def list<br />
@product_pages, @products = paginate :products, :per_page => 10<br />
end<br />
def show<br />
@product = Product.find(params[:id])<br />
end<br />
def new<br />
@product = Product.new<br />
end<br />
def create<br />
@product = Product.new(params[:product])<br />
if @product.save<br />
flash[:notice] = 'Product was successfully created.'<br />
redirect_to :acti<strong>on</strong> => 'list'<br />
else<br />
render :acti<strong>on</strong> => 'new'<br />
end<br />
end