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

need a way to pass custom variables onto RABL #63

Closed
paulkoegel opened this issue Oct 25, 2012 · 4 comments
Closed

need a way to pass custom variables onto RABL #63

paulkoegel opened this issue Oct 25, 2012 · 4 comments

Comments

@paulkoegel
Copy link

in my controller i'd like to pipe two collections of users through the same RABL template (users/index).

at the moment i have to overwrite my instance variable @users to get this working:

@users = current_account.users
gon.rabl 'app/views/users/index', as: 'users'
@users = @deal.users
gon.rabl 'app/views/users/index', as: 'team'

i'm aware that my RABL template is using @users, would be nice if there was a way for gon.rabl to take an :object or :locals parameter, such as:

gon.rabl 'app/views/users/index', as: 'team', locals: {users: @deal.users }
@gazay
Copy link
Owner

gazay commented Oct 25, 2012

Nice one, I'll look what can be done with it on this weekend:) Thank you!

@gazay
Copy link
Owner

gazay commented Oct 26, 2012

Done in 4.0.1, will push it soon

@gazay gazay closed this as completed Oct 26, 2012
@gazay
Copy link
Owner

gazay commented Oct 26, 2012

Here is the doc for locals with rable usage: https://github.com/gazay/gon/wiki/Usage-with-RABL

Actually just as in rabl and everywhere.

@paulkoegel
Copy link
Author

awesome! thanks a lot, especially for the exceptional swiftness. i'll try it out later today.

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

2 participants