Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@poqudrof
Created July 29, 2020 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save poqudrof/7d392e7e4f25dc6b1a075713bc62873f to your computer and use it in GitHub Desktop.
Save poqudrof/7d392e7e4f25dc6b1a075713bc62873f to your computer and use it in GitHub Desktop.
RUBY - RAILS - Example on how to generate methods app-wide icons
# Example on how to generate methods app-wide icons
# FAS icons
names = %w[dealership profile home users user
ordered delivered
]
icons = %w[hotel user-circle home users user
box-open truck-loading
]
names.each_with_index do |name, index|
define_method "#{name}_icon" do
'fas fa-' + icons[index]
end
end
@poqudrof
Copy link
Author

This code can be added to your application helper.

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