You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
🏡
Working from home
Andrej Antas
redrick
🏡
Working from home
Ruby on Rails developer based around Prague, born in Slovakian mountains spending my time in @GlobalWebIndex. Drinking accessive amounts of coffee through day..
Last active
December 26, 2015 10:19— forked from rajraj/es.sh
This file contains 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
If the namespace is not used then the commands will perform on top of the default database.
bundle exec rake db:createbundle exec rake db:migrate
By using the namespace we are going to use all the configuration for our alternate DB.
bundle exec rake store:db:createbundle exec rake store:db:migrate
Ruby module that you can use in a `before_action` on sensitive controllers for which you'd like a usage audit trail
Adding an audit log to your Rails app
If you have any sort of administrative interface on your web site, you can easily imagine an intruder gaining access and mucking about. How do you know the extent of the damage? Adding an audit log to your app is one quick solution. An audit log should record a few things:
controller entry points with parameter values
permanent information about the user, like user_id
transient information about the user, like IP and user_agent
Using the Rails framework, this is as simple as adding a before_action to your admin controllers. Here’s a basic version that I’m using in production.
This file contains 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
New expect syntax + new hash syntax and couple corrections
This file contains 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