Skip to content

Commit

Permalink
releasing 1.0.1 with caching resource/build_resource in query_include…
Browse files Browse the repository at this point in the history
…s. Thanks to Tommy for noticing
  • Loading branch information
garysweaver committed Dec 16, 2013
1 parent 8c7b6f3 commit c4ec506
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Irie 1.0.1 ##

* Caches resource in query includes to avoid additional query(ies). Thanks to Tommy for noticing!

## Irie 1.0.0 ##

* Renamed restful_json to Irie. It isn't only about json.
Expand Down
10 changes: 10 additions & 0 deletions lib/irie/extensions/query_includes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def collection
end

def resource
cached = get_resource_ivar
if cached
logger.debug("Irie::Extensions::QueryIncludes.resource returning cached resource") if ::Irie.debug?
return cached
end
logger.debug("Irie::Extensions::QueryIncludes.resource") if ::Irie.debug?
this_includes = self.action_to_query_includes[params[:action].to_sym] || self.all_action_query_includes
if this_includes && this_includes.size > 0
Expand All @@ -88,6 +93,11 @@ def resource
end

def build_resource
cached = get_resource_ivar
if cached
logger.debug("Irie::Extensions::QueryIncludes.resource returning cached resource") if ::Irie.debug?
return cached
end
logger.debug("Irie::Extensions::QueryIncludes.build_resource") if ::Irie.debug?
this_includes = self.action_to_query_includes[params[:action].to_sym] || self.all_action_query_includes
if this_includes && this_includes.size > 0
Expand Down
2 changes: 1 addition & 1 deletion lib/irie/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Irie
VERSION = '1.0.0'
VERSION = '1.0.1'
end

0 comments on commit c4ec506

Please sign in to comment.