Skip to content

Instantly share code, notes, and snippets.

@julesfern
Created November 24, 2008 00:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesfern/28330 to your computer and use it in GitHub Desktop.
Save julesfern/28330 to your computer and use it in GitHub Desktop.
# The code:
class MerbAuthSliceFullfat::AuthenticatingClient
include DataMapper::Resource
# Key it
property :id, Serial
# The registration will belong to a user, who will be able to edit the client properties.
property :user_id, Integer, :writer => :protected
end
# The problem:
>> c = AuthenticatingClient.new
=> #<MerbAuthSliceFullfat::AuthenticatingClient id=nil user_id=nil name=nil web_url=nil icon_url=nil api_key=nil secret=nil kind=nil callback_url=nil>
>> c.attributes = {:user_id=>10}
=> {:user_id=>10}
>> c.inspect
=> "#<MerbAuthSliceFullfat::AuthenticatingClient id=nil user_id=10 name=nil web_url=nil icon_url=nil api_key=nil secret=nil kind=nil callback_url=nil>"
>> c.user_id = 10
NoMethodError: protected method `user_id=' called for #<MerbAuthSliceFullfat::AuthenticatingClient:0x2574b60>
from (irb):5
from :0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment