Alan Reid

Joined

55,040 Experience
459 Lessons Completed
8 Questions Solved

Activity

Hi
I have a helper method, which converts currency to pounds. Is there any reason why this donest get picked up in the mailer templates, but works thoughtout the rest of the site?

Posted in Changing currency

@sites.currency.downcase.to_sym worked a treat buddy, thanks :)

Posted in Changing currency

I would like to change the currency in my app for each site.

So i currently have number_to_currency(aNumber, :locale => :gb) which works well. I have a number of sites which use different currencies and have their country set in @sites.currency - this passes in gb, eu, us, vi for example.

How would i go about changing the :locale => :fr to :locale => :gb as currently i can only get it passing in as a string, which is not obviously valid.

Posted in 5.0.1 out of RC?

Oh cool, i only hit their homepage, slight relief that is a final release. I will keep going as i was :)

For reference - http://weblog.rubyonrails.org/2016/12/21/Rails-5-0-1-has-been-released/

Posted in 5.0.1 out of RC?

I just did a bundle update and my app updated to Rails 5.0.1, it looks like this may have come out of RC. However there is nothing on their site yet. However their github is stating the buuld is failing :/

Just thought i would give a heads up not to update your rails install just yet.

Posted in Meaning of “Expected string default value for …”

It is odd, but least its sorted and i can now build projects again. Hopefully this will help someone else who faces the issue cause there wasnt much out there.

Trust me to run into the issue haha

Posted in Jekyll, MiddleMan or CMS for a blog site?

For your guest post i would simply use the front matter. The following example is from a post off my site.

---
layout:         default
title:          Setting up Rails and Jekyll (Part 1)
type:           post
navigation:     false

date:           2016-10-14
excerpt:        In part 1 we are going to get Rails setup, and test our install.
categories:     rails jekyll setup guide
image:          articles/setting-up-rails-and-jekyll/setting-up-rails.png
details:        false

author:         Alan Reid
bio:            I'm a freelance designer/developer who enjoys creating beautiful and standard compliant solutions for my clients from all around the world.
---

All you would need to do is change the author and bio and your done. Saves messing around too much.

Posted in Meaning of “Expected string default value for …”

So I started to test this out. And I created a couple of different projects rails new testapppg and rails new testapp-pg.

On both of apps I changed the thor gem gem 'thor', '0.19.1'. I then went on to run bundle update, and create the DB. Now both of these projects created the test models when running rails g model sample

Cool! So that is the fix. So I went back and recreated my pxl-insight app, updated the thor gem, created the DB. Now when I went to create the model I get the errors again!?

So my next question is does Rails cache project names? which is why the new projects worked fine, but the one with the previously used name causes the error?

Posted in Meaning of “Expected string default value for …”

Cool thanks Chris, that didnt work though. I am really not too sure why this is now suddenly happening.

Posted in Meaning of “Expected string default value for …”

The only change to my system that i can think of is that i updated to macOS 10.12.2 the other day, and I had not created any project after that until now. Previously they always worked fine.

$ rails -v
Rails 5.0.0.1
$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin16]

I thought i would try running $ rails g --help and i am getting the error there too.

Running via Spring preloader in process 32228
Expected string default value for '--jbuilder'; got true (boolean)
Usage: rails generate GENERATOR [args] [options]

General options:
  -h, [--help]     # Print generator's options and usage
  -p, [--pretend]  # Run but do not make any changes
  -f, [--force]    # Overwrite files that already exist
  -s, [--skip]     # Skip files that already exist
  -q, [--quiet]    # Suppress status output

Please choose a generator below.

Expected boolean default value for '--markerb'; got :erb (string)
Expected string default value for '--helper'; got false (boolean)
Expected string default value for '--assets'; got true (boolean)
Rails:
  assets
  channel
  controller
  generator
  helper
  integration_test
  jbuilder
  job
  mailer
  migration
  model
  resource
  responders_controller
  scaffold
  scaffold_controller
  task

ActiveRecord:
  active_record:devise

Coffee:
  coffee:assets

Devise:
  devise
  devise:controllers
  devise:install
  devise:views

Js:
  js:assets

Mongoid:
  mongoid:devise

Responders:
  responders:install

Sidekiq:
  sidekiq:worker

TestUnit:
  test_unit:generator
  test_unit:plugin

I found these 2 issues on the rails repo which discuss this issue.

https://github.com/rails/rails/issues/27256

https://github.com/rails/rails/issues/27310

Posted in Meaning of “Expected string default value for …”

So i am starting a new project, and have done this meany times now. However this is the first time i have hit this issue!

I created the app as normal rails new myapp -d postgresql

I've created the DB using rails db:create and ran the site rails s. Awesome!! It all works, and i see the Rails welcome/holding page.

Now i start to create my models, rails g model user for example. And i get this!

Expected string default value for '--jbuilder'; got true (boolean)
      invoke  active_record
The name 'User' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.

ok fair enough, i get the error message. So i thought i would test out another model. So i run rails g model testing, and i get...

Running via Spring preloader in process 31815
Expected string default value for '--jbuilder'; got true (boolean)
      invoke  active_record
      create    db/migrate/20161217171019_create_testings.rb
      create    app/models/testing.rb
      invoke    test_unit
      create      test/models/testing_test.rb
      create      test/fixtures/testings.yml

Has anyone else had this issue and if so any ideas why? I have tried running bundle install and bundle update with no luck.

Posted in Jekyll, MiddleMan or CMS for a blog site?

I use Jekyll a lot, its fantastic! I would advise using it if its a simple blog or site which does not need users to login and have accounts. If you need comments on your articles just use Disqus. Its pretty expandable!

Why? Well, you're not reliant on a DB so no slow down there, or additional failure point. Jekyll also uses markdown, which means you get nice HTML generated and dont have to worry about rouge styles getting in there and messing hings up.

As a starting point you could start with a Jekyll site, and the update it to somthing more later if you feel the site is growing well. - You can add a forum as a subdomain, and you can even have guest posting too.

Posted in Announcing the GoRails Forum

It has grown so much since i joined, you should be proud mate

Dont forget the Shrie videos Chris made, i found them really handy. And i would go with this over CarrierWave now personally.

First one is here https://gorails.com/episodes/file-uploading-with-shrine

Posted in Announcing the GoRails Forum

Loo how far its come. Keep up the good work Chris!

Posted in What is your dream app?

Further more to my post above, I have now started looking at using cookies to store the tracking ID which gets set when a user clicks a link. I then get the cookie, pull out the tracking ID and add it to the pixel! This means a company could essentially create different tracking ID's to see which product links perform the best ;)

I have decided i will use the previous tracking pixel for email tracking, as this is an awesome way to see if they get opened or ignored etc.

Posted in What is your dream app?

@Exequiel R I made my own Sass library - it needs some work... http://doughnut.r3id.io it started as a project in my previous job, but when i left i improved it and kept building it. It works well but needs some improvements.

As for the pixel currently i am generating a random ID and using that to assing that ID to a tracking pixel. Then when a visitor hits that pixel it fires the visits controller which then processes the data using the tracking pixel ID - its working fine, and i use the following to get the basic data i need.

pixel_id: @pixel.id, ip_address: request.remote_ip, referrer_uri: request.referrer 

This allows me to get the ID remote IP address and refferrer url. moving forwards i will get JS to append extra data to the pixel. I am looking at other ways to track conversions etc too.

Posted in What is your dream app?

Yelp-like app to help people find mental health resources sounds like a good idea Shakycode

I am working on

  • Drinks portal (with Jacob)
  • Pixel Tracking app, basically an analytics app which will allow the tracking of product purchases.
  • Not rails, but i am building a Jekyll blog for movie reivews. Actually it is kinda Rails related ;)

Posted in Prevent spam bots from hitting app

I agree with Jacob, sign up for a free cloudflare account, they can help prevent things like this happening. I use cloudflare for all my DNS needs, there are many additonal features for too such as caching and SSL.

Posted in Devise User Follow System

Michael Hartl does a video Tutorial via the Learn Enough site, you need to subscribe though. It's good but its everything thats in the book.