class ProductsController < ApplicationController helper_method :sort_column, :sort_direction def index @products = Product.order(sort_column + " " + sort_direction) end # ... private def sort_column Product.column_names.include?(params[:sort]) ? params[:sort] : "name" end def sort_direction %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc" end end
Sorcery is a full-featured, modular solution to authentication which leaves the controller and view layers up to you.
CreditCard = cleanNumber: (number) -> number.replace /[- ]/g, "" validNumber: (number) -> total = 0 number = @cleanNumber(number) for i in [(number.length-1)..0] n = +number[i] if (i+number.length) % 2 == 0 n = if n*2 > 9 then n*2 - 9 else n*2 total += n total % 10 == 0 jQuery -> $("#order_credit_card_number").blur -> if CreditCard.validNumber(@value) $("#credit_card_number_error").text("") else $
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く