Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parameters on generated methods #15

Open
mtjhax opened this issue Feb 11, 2012 · 0 comments
Open

Support parameters on generated methods #15

mtjhax opened this issue Feb 11, 2012 · 0 comments

Comments

@mtjhax
Copy link

mtjhax commented Feb 11, 2012

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]).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant