Ticket #484 (closed enhancement: fixed)

Opened 7 months ago

Last modified 7 months ago

[PATCH] to allow cookie setting through the cookies variable.

Reported by: dbalma..@gmail.com Assigned to:
Priority: trivial Milestone: 0.5.3
Component: Merb Keywords: cookies
Cc:

Description

Currently the only way to set cookies is through the Merb::ControllerMixin?.set_cookie method, despite what the documentation for that method states. It would be nice to be able to set cookies through the cookies variable as in rails. ie.

  # Writing
  
  cookies[:user]  = "dave" # => Sets a simple session cookie
  cookies[:token] = { :value => user.token, :expires => Time.now + 2.weeks }
    # => Will set a cookie that expires in 2 weeks

  # Reading
  
  cookies[:user] # => "dave"
  cookies.size   # => 2 (the number of cookies)

  # Deleting
  cookies.delete(:user)

Attachments

merb_cookies.patch (7.5 kB) - added by dbalma..@gmail.com on 01/26/08 15:13:12.
Merb cookies patch

Change History

01/26/08 15:13:12 changed by dbalma..@gmail.com

  • attachment merb_cookies.patch added.

Merb cookies patch

(follow-up: ↓ 2 ) 01/26/08 16:52:46 changed by e.@brainspl.at

  • status changed from new to closed.
  • resolution set to fixed.

(In [1325]) add Merb::Cookies class to manage cookies. Allows setting cookies via cookies[:foo] = 'bar', closes #484 [dbalma..@gmail.com]

(in reply to: ↑ 1 ) 01/26/08 17:13:04 changed by dbalma..@gmail.com

Hey dude, I think you may have missed a few files in the last commit. I can't see lib/merb/cookies.rb.

01/27/08 14:28:20 changed by dbalma..@gmail.com

  • priority changed from medium to trivial.
  • status changed from closed to reopened.
  • resolution deleted.

cookies_spec.rb still hasn't been added from the patch. Not really that important, especially since we are soon going to Merb 0.9, but it may as well be added.

01/27/08 15:14:35 changed by e.@brainspl.at

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [1327]) forgot to svn add cookie_spec.rb, closes #484