:type=>:integer and :type=>:string, :type=>:float etc for MongoMapper
femto opened this issue · 1 comments
Hello, I have a needs which filter lauds on its matches,
like
has_scope :match_id
def index
if params[:match_id]
params[:match_id] = params[:match_id].to_i
@lauds = apply_scopes(Laud).all
#@lauds = Laud.where(:match_id => params[:match_id].to_i)
else
@lauds = Laud.all
end
index!
end
in LaudsController,
but the problem is with if params[:match_id]
params[:match_id] = params[:match_id].to_i
it feels very weird, why not adds
:type=>:integer and :type=>:string, :type=>:float etc
to parse_value?
as commented by that issue:
Laud is using Mongomapper
(reopen a new issue because I can't find how to open the old closed issue).
class Laud
#attr_accessible :dest_user_id, :dest_user_name, :match_id, :message, :source_user_id, :source_user_name, :step_index
include MongoMapper::Document
def self.match_id(match_id)
where(:match_id => match_id)
end
end
I'm sorry I can't really understand what's going on with your issue, can you try editing it and improving the formatting with backticks, and try to explain it a little better? Otherwise I'll close this one as stale in a couple of days. Thanks!