Skip to content

Instantly share code, notes, and snippets.

@Frank004
Created February 23, 2016 14:28
Show Gist options
  • Save Frank004/59f9eeaeebd0e5309352 to your computer and use it in GitHub Desktop.
Save Frank004/59f9eeaeebd0e5309352 to your computer and use it in GitHub Desktop.
def show
@accidents = @employee.accidents.paginate(:page => params[:accidents], :per_page => 5)
@incidents = @employee.incidents.paginate(:page => params[:incidents], :per_page => 5)
@trainings = @employee.trainings.paginate(:page => params[:trainings], :per_page => 5)
end
@durexlw
Copy link

durexlw commented Feb 23, 2016

`
def show
@Accidents = my_call(:accicents)
end

def my_call (method)
@employee.send(method).paginate(:page => params[:accidents], :per_page => 5)
end
`

@Frank004
Copy link
Author

def method (value)  # how can I pass value to :bar. lets say if value = apple. then I get param[:apple]
     param[:bar]      # what's the correct syntax to do :value and grab the value 
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment