Jay Killeen

Joined

4,030 Experience
25 Lessons Completed
0 Questions Solved

Activity

Posted in Using Vagrant for Rails Development Discussion

I'm working through this now. https://github.com/applicat... Looks like this issue was closed long ago but has reemerged. Will try to come back with a fix if I figure it out... which I will probably forget to do once I have figured it out :P

Thanks Jacob,

I did have a read of this and have implemented it in my app for now. Would be nice to be able to get the ActiveRecord query builder to also use the SQL 'AS' alias method too so that it asks for:

SELECT [dbo].[dimCustomer].[CustomerCode] AS [id] FROM [dbo].[dimCustomer];

At the moment it will still send

SELECT [dbo].[dimCustomer].[CustomerCode] FROM [dbo].[dimCustomer];

And in BetterErrors if I inspect the Customer object it still refers to methods as the unaliased name.

But works for now so Thank You.

I am thinking it will be some kid of alias method on the model that emulates SQL AS

Essentially I am hoping to be able to use customer.id and rails knows I am meaning customer.CustomerCode or when ActiveRecord runs the SQL it passes something like

SELECT [dbo].[dimCustomer].[CustomerCode] AS [id] FROM [dbo].[dimCustomer];

Hi

I have a rails app that sits over an existing SQL Server database that I have no control over. Purely read only access to.

I have a model like Customer with fields like CustomerCode, CustomerName etc. Which means ugly unconventional Customer.first.CustomerCode and Customer.first.CustomerName.

Is there a way in the app/models/customer.rb to rename these columns so I can instead call Customer.first.id and Customer.first.name

Hopefully this is very straightforward.

Thanks

Posted in Free SSL with Rails and Nginx using Let's Encrypt

Cheers that is what I ended up doing. Had to figure out how to create the two server blocks but ended up with all as follows. This was two apps on one server, one app called example and the other called foo with foo directed to subdomain foo.example.com but using the example.com certificate.

/etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;

server_name example.com;
passenger_enabled on;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
rails_env production;
root /home/deploy/example/current/public;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_dhparam /home/deploy/dhparams.pem;
}

/etc/nginx/sites-available/foo.example.com
server {
listen 80;
listen [::]:80;

server_name foo.example.com;
passenger_enabled on;
passenger_ruby /home/deploy/.rbenv/shims/ruby;
rails_env production;
root /home/deploy/foo/current/public;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

listen 443 ssl;

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_dhparam /home/deploy/dhparams.pem;
}

then symlinked them in the sites-enabled directory

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo ln -s /etc/nginx/sites-available/foo.example.com /etc/nginx/sites-enabled/

then ran the lets encrypt using certbot

sudo certbot certonly --webroot --webroot-path /home/deploy/sales_playbook/current/public --renew-by-default --email me@jaykilleen.com --text --agree-tos -d example.com -d foo.example.com

Posted in Free SSL with Rails and Nginx using Let's Encrypt

Hey Chris Oliver any tips for doing this when running multiple domains on one server or having subdomains. ie example..com and foo.example.com. I have two server blocks for nginx but they are trying to share the same certificate so chrome throws an error around security.

Posted in Free SSL with Rails and Nginx using Let's Encrypt

holy shit it works!

I also added `30 2 * * 1 letsencrypt renew` to my cronjobs as I have letsencrypt installed

Posted in Free SSL with Rails and Nginx using Let's Encrypt

Or in my case as I am running passenger `sudo nano /etc/nginx/sites-enabled/default`

Posted in Free SSL with Rails and Nginx using Let's Encrypt

I followed these steps and found that `sudo apt-get install letsencrypt` got me up and running. No need to install from github source. https://certbot.eff.org/#ub...

Posted in Free SSL with Rails and Nginx using Let's Encrypt

@excid3:disqus what do you mean by `Add the following lines to your server block for your app and be sure to change example.com to your domain.`

Where do I find the `server block`? Is this the `/etc/nginx/nginx.conf` file `server { }`

Posted in Free SSL with Rails and Nginx using Let's Encrypt

Getting the following error after running `./letsencrypt-auto`

`Failed to install a working "virtualenv" command, exiting`

Posted in Deploy Ubuntu 16.04 Xenial Xerus Discussion

Fixed this as per this SO page. http://stackoverflow.com/qu...

Posted in Deploy Ubuntu 16.04 Xenial Xerus Discussion

Also getting an error `There are no Phusion Passenger-served applications running whose paths begin with '/home/deploy/app_name'`. app_name is replaced with the name of my app.

Seems there is another user getting this problem as well.
http://stackoverflow.com/qu...

Posted in Deploy Ubuntu 16.04 Xenial Xerus Discussion

Almost there but when I run `cap production deploy` I get

```
00:00 rbenv:validate
rbenv: 2.3.1 is not installed or not found in $HOME/deploy/.rbenv/versions/2.3.1

```

Is cap checking this on my local machine or the server? I have changed the path to just `$HOME/.rbenv` and still get the same issue.

Posted in Testing your markdown

Oh wow I didn't realize it wasn't official.

I do have the gfm: true on. I might have to dig a little deeper on this one then. Will let you know how I go.

I have had a read of the issues and appears that the html-pipeline gem is not yet compatible with Rails5 so I'll probably have to wait a bit more.

Posted in Testing your markdown

I see your markdown tables aren't being rendered as tables. I have the same problem :( Any idea how we get this fixed?

| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |

I am using the html-pipeline gem and followed the guides in your cast.

Hmm this might be an issue with rails -v 5.0.0beta4

I am getting an error:
uninitialized constant HTML::Pipeline::SyntaxHighlightFilter::Pygments.

my Gemfile shows:

# markdown in comments
gem 'html-pipeline', '~> 1.11.0'
gem 'github-linguist', '~> 4.8', '>= 4.8.4'
gem 'github-markdown', '~> 0.6.7'
gem 'gemoji', '~> 2.1.0'
gem 'sanitize', '~> 3.0.3'

and in application_helper.rb I have:

def markdown(content)
  pipeline_context = {gfm: true, asset_root: "https://a248.e.akamai.net/asse..."}
  pipeline = HTML::Pipeline.new [
    HTML::Pipeline::MarkdownFilter,
    HTML::Pipeline::EmojiFilter,
    HTML::Pipeline::SanitizationFilter,
    HTML::Pipeline::SyntaxHighlightFilter
  ], pipeline_context
  pipeline.call(content)[:output].to_s.html_safe
end

If I add

gem 'pygments.rb', '~> 0.6.3' to my Gemfile I can get it going but I thought pygments was a dependency of github-linguist.

Also the html syntax highlighting doesn't even seem to work when it is up and running. Is there a place where I can set the highlighting theme??

Posted in Deploy Ubuntu 14.04 Trusty Tahr Discussion

@excid3:disqus this was confusing for me as well. MIght need to add another alert box to say when you should jump back to your local machine.

logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.