Skip to main content
Ask A Question
Notifications
You’re not receiving notifications from this thread.
Subscribe

Limit CSV export by Day, Week and Month

General • Asked by Sascha M.

Hi there,

is there an easy way to limit the results inside a CSV export to a specific time-frame, like day, week and month?

Thanks!


Hey Sacha, you would just want to use a where query to scope to a date range before calling to_csv on it. You may need to change it from all.each to scoped.each in order for Rails to respect the scope if it wants to override your where query. That should do it!


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.