I have the following class that works fine as a controller:

class Foo < ApplicationController

  def check
    unless cookies[:user_id].nil?
      logger.info("Cookies value is : #{cookies[:user_id]}")
      redirect_to "http://www.yahoo.com";
    else
      cookies[:user_id] = { :value => "198", :expires => 180.days.from_now }
      redirect_to "http://www.google.com";
    end

  end
end


When I try to convert it to Metal : class Foo < ActionController::Metal
it complains about cookies method available I included the following line:
   include ActionController::Session::CookieStore

it still gives me the same error. When the metal class is in the controller
directory it is at least finding the class. If I move it to lib directory I
get : uninitialized constant Foo error. I included the line:

require File.expand_path('../../../config/environment',  __FILE__) unless
defined?(Rails)

it still gives the same error.

My questions are:
  1) What do I need to include my metal class in order to use the cookies
method in Rails 3.0 ?
  2) Where should I save my Rails metal app class file? in the controllers
or lib directory?

TIA.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to