lib/query_helper.rb in query_helper-0.1.0 vs lib/query_helper.rb in query_helper-0.1.1

- old
+ new

@@ -129,10 +129,10 @@ # If a custom sql string is passed in, make sure a valid model is passed in as well if @query.class == String raise InvalidQueryError.new("a valid model must be included to run a custom SQL query") unless @model < ActiveRecord::Base # If an active record query is passed in, find the model and sql from the query elsif @query.class < ActiveRecord::Relation - @model = @query.model + @model ||= @query.model @query = @query.to_sql else raise InvalidQueryError.new("unable to determine query type") end end