diff --git a/app/models/collections/context.rb b/app/models/collections/context.rb index c4bd72588d46fdd1d9f631ea98eefb463d1aebb5..5413ff640a5adc65330c5e8afee754c43cd5dd64 100644 --- a/app/models/collections/context.rb +++ b/app/models/collections/context.rb @@ -1,10 +1,12 @@ module Collections class Context - attr_reader :from, :privacy - def initialize - @from = nil - @privacy = nil + def from + raise NotImplementedError, 'This method must be implemented' + end + + def privacy + raise NotImplementedError, 'This method must be implemented' end end diff --git a/app/models/collections/public_context.rb b/app/models/collections/public_context.rb index ad3a7f8a7f1a4e11e3abc716d593115a7ecf1fba..d7013b138c03ca65c2de1e9e5f942ad44bd4b641 100644 --- a/app/models/collections/public_context.rb +++ b/app/models/collections/public_context.rb @@ -3,9 +3,12 @@ # The PublicContext class specify all collections with field privacy=public class Collections::PublicContext < Collections::Context - def initialize - @from = 'Collection' - @privacy = 'public' + def from + 'Collection' + end + + def privacy + 'public' end end \ No newline at end of file diff --git a/app/models/collections/user_context.rb b/app/models/collections/user_context.rb index 5a6d9b1ad6ad0595b92c38d207657373e76ee23b..5c70f92c5fa2e51b3f10b88252b5961bbc4478f1 100644 --- a/app/models/collections/user_context.rb +++ b/app/models/collections/user_context.rb @@ -2,7 +2,10 @@ class UserContext < Collections::Context def initialize(user) @user = user - @from = sprintf "select expand(in('BelongsTo')) from %s)", user.rid + end + + def from + sprintf "select expand(in('BelongsTo')) from %s)", @user.rid end end \ No newline at end of file diff --git a/app/models/collections/user_private_context.rb b/app/models/collections/user_private_context.rb index 4cc6817416b8215438e54bc54c12257dcf5d9c87..3b6b8534507b2bbeccd6cfd7bed67d1b0db40d40 100644 --- a/app/models/collections/user_private_context.rb +++ b/app/models/collections/user_private_context.rb @@ -4,7 +4,7 @@ class Collections::UserPrivateContext < Collections::UserContext def privacy - @privacy = 'private' + 'private' end end \ No newline at end of file diff --git a/app/models/collections/user_public_context.rb b/app/models/collections/user_public_context.rb index 743875c985e474917157c44d73ca09acb55806ba..f1612eb052fe41674c2d51a013516f1187b5d2a0 100644 --- a/app/models/collections/user_public_context.rb +++ b/app/models/collections/user_public_context.rb @@ -4,7 +4,7 @@ class Collections::UserPublicContext < Collections::UserContext def privacy - @privacy = 'public' + 'public' end end \ No newline at end of file