The Stormtrooper's Dilemma http://stormtroopersdilemma.posterous.com "The Death Star plans are not in the main computer..." posterous.com Fri, 25 May 2012 10:54:00 -0700 Rails play with Devise and Mongoid http://stormtroopersdilemma.posterous.com/rails-play-with-devise-and-mongoid http://stormtroopersdilemma.posterous.com/rails-play-with-devise-and-mongoid

Media_httpgemsgithubc_ygjiq

Here's a recent github repo https://github.com/rujmah/bearded-octo that I've set up.

Just playing with Devise to see what I can do with User models. I'm not too experienced with understanding how User models can work so this has been a learning curve. 

From the readme: 

Currently, Admin and Company. For 'Company' read 'regular User'.

Wanted to set up a User model that allowed for overall SuperAdmin/Access-All-Areas for Admin and restricted areas for other groups of users.

Several ways to go from here, but I have implemented (this round at least) a system where the controllers before filters figure out who gets access.

Quick but messy as I had to define methods on each controller (see below).  

Will be looking at other ways of doing this going forward. (Probably from looking at the Devise example apps: https://github.com/plataformatec/devise/wiki/Example-Applications)

 

Ryan Bates RailsCasts really got me up to speed very quickly on Rails authentication. Particularly, the following:

http://railscasts.com/episodes/250-authentication-from-scratch-revised

http://railscasts.com/episodes/209-introducing-devise

http://railscasts.com/episodes/235-omniauth-part-1

http://railscasts.com/episodes/241-simple-omniauth

 

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/66875/rjjm_profile_bluesky_greenfield.jpg http://posterous.com/users/PV20aKAxiN Robin Mayfield rujmah Robin Mayfield
Thu, 29 Mar 2012 08:25:00 -0700 Gist: Ubuntu + RVM cheatsheet http://stormtroopersdilemma.posterous.com/gist-ubuntu-rvm-cheatsheet http://stormtroopersdilemma.posterous.com/gist-ubuntu-rvm-cheatsheet

Just created the following GIST cheatsheet based on this post by Ryan Bigg. Never start ruby dev on a fresh Ubuntu distro without it! 

https://gist.github.com/2238366

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/66875/rjjm_profile_bluesky_greenfield.jpg http://posterous.com/users/PV20aKAxiN Robin Mayfield rujmah Robin Mayfield
Sun, 11 Mar 2012 10:54:00 -0700 MacOSX VirtualBox 1.4 upgrade error - Cannot handle settings version '1.2-macosx' http://stormtroopersdilemma.posterous.com/macosx-virtualbox-14-upgrade-error-cannot-han http://stormtroopersdilemma.posterous.com/macosx-virtualbox-14-upgrade-error-cannot-han

Came across this annoying bug when attempting to install VirtualBox so as to run Vagrant on my iMac. 

Not realising I had already installed VirtualBox a couple of years ago, I completed the new install (obviously more an upgrade) and had the following error when attempting to start the software:

Failed to create the VirtualBox COM object.

The application will now terminate.

 

Error in /Users/rjjm/Library/VirtualBox/VirtualBox.xml (line 3) -- Cannot handle settings version '1.2-macosx'.

/Users/vbox/tinderbox/4.1-mac-rel/src/VBox/Main/src-server/VirtualBoxImpl.cpp[485] (nsresult VirtualBox::init()).

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: VirtualBox
Interface: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}

To cut to the chase the resolution was to delete (or backup and delete, if you're paranoid like me) the file at  /Users/rjjm/Library/VirtualBox/VirtualBox.xml (replace 'rjjm' with your username). 

Then restarted the app - and ping! New config file created.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/66875/rjjm_profile_bluesky_greenfield.jpg http://posterous.com/users/PV20aKAxiN Robin Mayfield rujmah Robin Mayfield