Cookies? sessions? help?

say i wanted for a user to go to http://www.domain.com/intro when they
first hit http://www.domain.com/

subsequent visits to the site while still on the current session would
result in just going to http://www.domain.com/

basically the user only sees www.domain.com/intro once, and only once…
unless they explicitly put in the ‘/intro’ manually.

thoughts? ideas? links? tutorials?

the user hits /intro for the first time in the site, or for the first
time per session? if you want him to see /intro for the first time
entering the site, and the next week when he comes to visit your site,
you don’t want him to see it, you should probably cookie him.
if not, session is the way to go.

and in the controller you’ve routed the homepage to, just do a
before_filter to the homepage action, and add a if session[:visited?]
clause or something like that to do a redirect.

good enough?

On 6/27/07, mason [email protected] wrote:

say i wanted for a user to go to http://www.domain.com/intro when they
first hit http://www.domain.com/

subsequent visits to the site while still on the current session would
result in just going to http://www.domain.com/

basically the user only sees www.domain.com/intro once, and only once…
unless they explicitly put in the ‘/intro’ manually.

Assuming “/” maps to action “index” and “/intro” maps to action
“intro”, you would

def index
unless session[:intro_seen]
redirect_to :action => “intro”
return
end
end

def intro
session[:intro_seen] = true
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs