Defect #4056

Rename named_scope :public for Project to something else

Added by Dmitri Kouikoff about 8 years ago. Updated about 8 years ago.

Status:ClosedStart date:2009-10-19
Priority:NormalDue date:
Assignee:Eric Davis% Done:

100%

Category:Projects
Target version:0.9.0
Resolution:Fixed Affected version:

Description

As the word public is reserved in ruby, the attempt to mock/stub the model Project fails, since the line that introduces a new public method fails due to the fact that word 'public' is redefined by the named_scope.

I suspect you may meet the case while setting up the shoulda.

Associated revisions

Revision 2941
Added by Eric Davis about 8 years ago

Renamed Project#public named_scope so it will not override Ruby's public method

#4056

History

#1 Updated by Eric Davis about 8 years ago

  • Category set to Projects
  • Status changed from New to 7

Agreed. I ran into this when I would mock Project.public in my tests. What do you propose renaming it to? Project.public_projects? Project.all_public?

#2 Updated by Dmitri Kouikoff about 8 years ago

I think :all_public is pretty good. As a variant I was thinking about :public_state. :-)

#3 Updated by Eric Davis about 8 years ago

  • Status changed from 7 to Closed
  • Target version set to 0.9.0
  • % Done changed from 0 to 100
  • Resolution set to Fixed

Project.all_public it is. Thanks for the suggestion. r2941

Also available in: Atom PDF