Skip to content

Commit

Permalink
support split design documents per view
Browse files Browse the repository at this point in the history
  • Loading branch information
jweiss committed Apr 4, 2011
1 parent 8a506d3 commit 5dfbc51
Show file tree
Hide file tree
Showing 3 changed files with 317 additions and 310 deletions.
8 changes: 6 additions & 2 deletions lib/rocking_chair/view.rb
Expand Up @@ -18,10 +18,10 @@ def initialize(database, design_document_name, view_name, options = {})
@design_document = JSON.parse(database.storage["_design/#{design_document_name}"], :create_additions => false)
@view_document = design_document['views'][view_name] || RockingChair::Error.raise_404
end

@database = database
@keys = database.storage.keys
@design_document_name = design_document_name
@design_document_name = normalize_design_document_name(design_document_name)
@view_name = view_name
initialize_ruby_store

Expand Down Expand Up @@ -311,5 +311,9 @@ def normalize_descending_options
end
end

def normalize_design_document_name(design_doc_name)
design_doc_name.to_s.gsub(/_view_\w+/, '')
end

end
end
2 changes: 1 addition & 1 deletion test/fixtures/simply_stored_fixtures.rb
Expand Up @@ -29,7 +29,7 @@ class Manager
has_one :project
end

class CustomViewUser
class CustomFiewUser
include SimplyStored::Couch

property :tags
Expand Down

0 comments on commit 5dfbc51

Please sign in to comment.