en en en en id en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en sk es en en en en en en en en fr en en en en en pl en en en en en en en en en en en en en en en en en en en fa en en en en en en en en ja en pl en en en en en en en en en en en en en en en en en en en en en es en en hbs_lat en en en en en en en et en en en ar en en en en en en en en en en en en pt en en en en en en en
As I stumble through the world of linux, I've decided to log new tricks I learn because I often forget. I decided to share the log because…. eh, why not.
Formatting Numerical Input with Rails
Kubuntu 16.04 GUI Audio Controls not working
Polymorphic Associations The Smart Way: Using Global Ids
Get Firefox to display warning message when exiting multiple tabs
jaehoo on Kubuntu 16.04 GUI Audio Contro…
BennyBeat on How to download a file from so…
fastrapidleech.com on How to download a file from so…
neanderslob on How to download a file from so…
Adding a devise user or admin in a Heroku app
February 18, 2015February 18, 2015 neanderslobadd, devise, heroku, rails, ruby, ruby on rails, userLeave a comment
To add a devise user on a Heroku site we combine two commands
Command 1: With devise a person can enter the following into their rails console to create a user: User.new(:email => "user@name.com", :password => 'password', :password_confirmation => 'password')
Command 2: To run commands in the Heroku terminal, simply go into local directory of the corresponding app and type heroku run [whatever you want to run]
So if we put those together we get the following, assuming that your user model is in fact called User:
Change your directory to your app: cd ~/yourapp
Enter into the rails console on Heroku with the following: heroku run rails c
Run the create user code: U=User.new(:email => "user@name.com", :password => 'password', :password_confirmation => 'password')
Finally, if you want to do this for a separate admin model, simply replace User in the instructions above with Admin (provided of course that’s what your separate admin model is called; if not adjust accordingly).
That’s it! You should be good to go!
Adding a devise user or admin in a Heroku app
Styling Fields Dynamically Added With Cocoon
February 5, 2015 neanderslobcocoon, dynamic, fields, jQuery, nested, rails, ruby, ruby on railsLeave a comment
I recently ran into a situation where I realized that the nice slick J-Query styling that I’d given to my select menus hadn’t carried over to my dynamically added fields.  This is because, my javascript ran $('select').customSelect(); when the page loaded but at no point after. I therefore needed to figure out how to trigger that function once a dynamic field was added.
After quite a bit of searching around (on the order of hours) and several dead ends, I finally learned that cocoon has many different actions that can be used with on() In my case, all I needed was the following:
And I was good to go.
Styling Fields Dynamically Added With Cocoon
A beginners look at RVM: Installs, Upgrades and the rest
January 27, 2015February 25, 2016 neanderslobinstall, ruby, ruby on rails, rvm, update, upgrade1 Comment
One of the most confusing things about learning rails is in dealing with the Ruby Version Manager (RVM). Being a noob myself in the Ruby world, I wanted to give some clarification on stuff that I’d wondered at the outset regarding this tool.
RVM is basically a package manager (like apt for fellow linux users); it upgrades packages, downgrades them, allows you to switch out versions, etc. The big question on my mind was “why doesn’t ruby just use apt!?” Indeed, apt had served me well for php and it seemed to be a needless complication to use some other package manager for this language.  “Why was Ruby so special that it needed its own package manager!?”  I’m still not entirely sure of the rationale behind this, but my guess is that one of the things that makes Ruby so useful is its “Gems” (Rails is one of them), for which Ruby sort of acts as a package manager in itself.  I figure this makes it much more important for users to have a more control over the versions of ruby that they’re using; either way RVM (and a few others like it) are the ways to manage ruby, so here are a few tips to make it work.
Note: These instructions might have an Ubuntu flavor to them here and there, because that’s what I use.  For the most part, they’re universal though.
\curl -sSL https://get.rvm.io | bash -s stable --ruby
To check the version of ruby:
How can I upgrade to the latest version of ruby!?
There is no way to just upgrade ruby to the latest (whatever it happens to be). RVM seems to be all about giving control to YOU; it’s not going to make the choice for you. Here’s how I go about it.
First, I update my list of known stable ruby versions
Then, I check that updated list with:
My output looked like this:
[ruby-]1.8.7[-head] # security released on head
# for forks use: rvm install ruby-head- --url https://github.com/github/ruby.git --branch 2.1
The real output was actually a lot longer as it gives you ALL the packages you can get with RVM but I cut it off (we’re not interested in JRuby or anything like that).  Anyway, I checked out the list and saw that 2.2.0 was the latest so I entered:
RVM also allows a user to have many “Rubies” installed (versions of ruby).  To see which ones are installed:
Mine looks like this:
ruby-1.9.2-p320 [ x86_64 ]
* ruby-1.9.3-p392 [ x86_64 ]
=> ruby-2.2.0 [ x86_64 ]
# => – current
# =* – current && default
# * – default
I’m using 2.2.0. If I wanted to use the version of 1.9.3 I have, I would type
Also my default was 1.9.3. If I wanted to change the default to 2.2.0, I would enter
rvm --default use 2.2.0
Every month or so it’s good to upgrade your rvm. To do so:
A beginners look at RVM: Installs, Upgrades and the rest
Create a free website or blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.