ruby on rails - Add condition to devise sign up process -


i'm trying make sign page beta version using devise.

what allow user sign if conditions filled. simple thing :

#app/controllers/registrations_controller.rb  def new if conditions     create account user end end 

any idea ?

edit // partial answer (suggested comments)

here code did using link in comments. not sure if it's best way though...

def new token = params["token"] find_email = invitation.find_by_token(token) if find_email   find_email.approved = true   if build_resource({})     find_email.save     respond_with self.resource   end end 

end

edit 2 works if form correctly filled...so no answer yet problem

what simple before filter. way don't have mess devise code

class registrationscontroller < devise::registrationscontroller   before_filter :check_conditions, only: :new    def new     super   end    private     def check_conditions       #your conditions     end end 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -