Skip to content

Support parameters on generated methods #15

@mtjhax

Description

@mtjhax

EDIT: Actually, what I propose below is already possible but is not mentioned in the documentation! It seems like any of the options that can be defined when the report is declared with 'reportable' can be included in a hash at runtime.

Let's say I have a User model that has_many Posts and I would like to report on the Posts belonging to the current user (e.g. show the user how many posts they have submitted each day this month). This does not appear to be possible in the current version of reportable.

I can't add a condition based on current_user because it is evaluated when the class is loaded, e.g. the following does not work:

reportable :my, :conditions => ["user_id LIKE ?", current_user]

I would need to be able to specify conditions when the query is run, e.g.:

Posts.my_report(:conditions => ["user_id LIKE ?", current_user]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions