Created
February 22, 2018 05:38
-
-
Save Mk-Etlinger/252495d837b0f92444eb3f69ae1bbb0a to your computer and use it in GitHub Desktop.
First attempt at metaprogramming set_instance_variable method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
def after_sign_in_path_for(resource) | |
request.env['omniauth.origin'] || dashboard_path | |
end | |
def index | |
render "landing/index" | |
end | |
# this is an attempt to metaprogram the instance var. based on controller | |
# def set_instance_variable | |
# controller_name = params['controller'] | |
# controller_name.chop! | |
# model_name = controller_name.capitalize | |
# instance_variable_set('@' + controller_name, model_name.find_by(id: params[:id])) | |
# end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment