Created
January 19, 2012 22:21
-
-
Save regedarek/1643261 to your computer and use it in GitHub Desktop.
Chcę aby po kliknięciu w Fast Verification, a następnie Verify aby redirect_to było do ostatniego niezweryfikowanego ogłoszenia.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#verifications/index.haml | |
- unless @ads.unverified_ads.empty? | |
= link_to "Szybka Weryfikacja", fast_verify_info_verification_path(@ads.unverified_ads.last), :method => :put | |
= link_to "Ogłoszenia do zweryfikowania", verifications_path(:scope => "unverified_ads") | |
= @ads.unverified_ads.count | |
= link_to "Normal Verify", verify_info_verification_path(ad), :method => :put | |
#verifications/verify_info.haml | |
= link_to "Verify", verify_verification_path(@ad) | |
#verifications/fast_verify_info.haml | |
= link_to "Weryfikuj", fast_verify_verification_path(Ad.unverified_ads.last), :method => :put | |
#verification_controller.rb | |
class VerificationsController < ApplicationController | |
before_filter :require_login | |
before_filter :load_ad, :except => [:index] | |
before_filter :verify_ad, :only => [:fast_verify, :verify] | |
def index | |
@ads = Ad.with_some_scope(params[:scope], params[:email]) | |
end | |
def verify_info | |
end | |
def fast_verify_info | |
end | |
def fast_verify | |
redirect_to (Ad.unverified_ads.blank? ? verifications_path : fast_verify_info_verification_path(Ad.unverified_ads.last)) | |
end | |
def verify | |
redirect_to verifications_path | |
end | |
private | |
def load_ad | |
@ad = Ad.find(params[:id]) | |
end | |
def verify_ad | |
@ad.verify!(current_user.id) | |
end | |
end |
Author
regedarek
commented
Jan 23, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment