ruby on rails - Authorisation through url -


say, have posts app. there's form can fill in fields title,text,email , subm button. no registration required.

after form submission post should moderated. if it's approved appears in main list.

after form submission , approval, user receives link(link sent user's email) editing post. -- how this?

upd

the question not how moderate or validate post/usr but how give him link editing post

whenever user record created can generate token bound record so:

in user.rb

before_save :generate_token  def generate_token   self.token = securerandom.hex(6) end 

then when submitting user registration confirmation link so:

link_to "validate account", validate_user_path(token: user.token) 

and example of userscontroller

def validate   user = user.find_by_token(params[:token])   if user     user.update_attributes(validated: true)     flash[:notice] = 'user succesfully validated.'   else     flash[:error] = 'couldn't find user token'   end end 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -