Last Updated on November 30, 2019 by Christopher G Mendla
I had a situation where I had a list of records with edit buttons. After editing a record, the normal course of things is to show the document. The user wanted an easy way to get back to the list.
I needed to have a window pop up in a Rails Project without having the header, footer and navigation.
This covers a situation where you need to have rails access an external sql database other than the database used for the application. For example, you might need to pull information from one table to populate fields in your current application. This is further complicated if your application is using a schema prefix.
I use the adauth gem to provide authentication through Active Directory for Rails applications. I wanted to give the apps the ability to store failed logins. In other words, if someone tries to log onto an app and their login fails, the IP and login name used will be written to a file.
I screwed up my droplet (ruby on rails) on my digitalocean hosting by running bundle install as root. When you do that, there is a warning that this will break rails for other users. I haven’t taken the time to figure out how to fix that. Since I was getting started with that hosting, I decided to simply delete the existing droplet and recreate it.
When people are starting out with Ruby on Rails, one of the key elements is to be able to view the contents of the SQL file. For most people, they will use the SQLLite database. This is a limited implementation of SQL. The tables are all stored in one file which is located in /db of your Rails project.
Before starting to use any hosting account for a Ruby on Rails project, check the versions they are offering.
I found a tool called brakeman that does vulnerability scans of rails applications. It installs as a gem and you run it from the command line. I had some issues with it using up memory but found a way around it.
When you create a Rails project, it is helpful to put notes in the project. The notes can look like the following in your controllers:
# TODO change the alignment of the column
# FIXME – User password retrieval is not working as expected
# OPTIMIZE Add indexes
Or, in the case of views, use the following format
link_to can be modified to show a button instead of a text link. The trick is to enclose the link/button text in a button tag and add .html_safe .
<%= link_to “My Blog“.html_safe, ‘http://blog.chrismendlatech.com’, target:’_blank’, class: ‘button’%>
<%= link_to "< button>My Blog< /button>".html_safe, 'http://blog.chrismendlatech.com', target:'_blank', class: 'button'%>