Session in the model

Hello,

I needed a couple of session variables to allow a reader of a blog to
be redirected to the correct URL if the blog name he’s visiting
(app/:blogname) gets updated;
Question: is it convenient to pass ‘base’ to the model or would it be
more efficient to do everything in the controller?

ex. in blog.rb

def self.locate(base)
if !base.session[:last_visited_blog_id].nil? && base.params[:blog]
== base.session[:last_visited_blog_seo]
return Blog.find_by_id(base.session[:last_visited_blog_id])
end
end

thanks!

redirection and related stuff is handled inside your controllers.

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