Tag: rails
Phone Gap Whitelist Rejection Error
by coffeencoke on Jan.19, 2012, under Development, Ruby on Rails, iOS
My mobile app continues. As I was testing my registration API through the iOS emulator I got the following error:
MyApp [97185:15603] ERROR whitelist rejection: url='http://localhost:3000'
After some quick google searching, I discovered that in order to make requests outside of the file system I had to add the host to the phone gap’s plist file. For my project this file is located at /MyApp/PhoneGap.plist. You can either edit this file with a text editor or edit it in Xcode. The end result for me to be able to hit localhost within the app looks like this:
<?xml version="1.0" encoding="UTF-8"?> ... <key>ExternalHosts</key> <array> <string>localhost</string> </array> ...
After I made that change, I restarted my app through Xcode and the app was able to hit the rails server.
Ruby Midwest Conf – Day 1 Part 1
by coffeencoke on Nov.04, 2011, under Ruby on Rails
So far the day has been filled with great pastries, excellent coffee, typically frustrated conference wifi, and fantastic talks about Ruby and craftsmanship.
The day started off with the why you should not use sudo, for most things. Your ruby development computer should be setup using a number of tools that should not be installed with sudo, simply because with most if the tools, they can’t. Your development environment should be isolated in your profile, one step deeper though; isolated in your project.
Use RVM .
Ro
RVM is a ruby version master (err, manager). It allows you to install multiple versions of Ruby, JRuby, Rubinius, etc. on the same computer. Further yet, it allows you to have completely separate gems for each project by using gemsets.
The Ruby Safari
Ola
Ola did a great job throwing out some technical intricacies which really pushed me to get to know my language more. As I develop using Ruby I use and reuse the same methods and classes. His talk has encouraged me to look into deeper implementation of Ruby and to ‘play’ with creative patterns.
One thing I particularly liked is commenting and writing Regular Expressions with group names. However, the big bang from his talk for me was requiring a fake library. I am constantly growing and learning (trying to) and one place I have been focusing on is speed of tests and design of tests, unit tests to be more specific. With rails, it is very difficult to write true unit specs that are blazing fast. More to come on this in future posts.
Rails 3 Finally
by Matt on Jul.08, 2010, under Ruby on Rails
To setup a new rails 3 app with cucumber, no prototype and mysql database using ruby 1.9.2
This guide assumes you have ruby 1.9.2, rubygems and bundler gem installed
[msimpson@dakota ~] $ mkdir rails3 [msimpson@dakota ~] $ cd rails3 [msimpson@dakota rails3] $ git clone git://github.com/rails/rails.git rails3 . [msimpson@dakota rails3] (master) $ ruby bin/rails new /path/to/my/new/app --dev -d mysql -J [msimpson@dakota rails3] $ cd /path/to/my/new/app
Open and edit Gemfile so that it looks like this:
source 'http://rubygems.org' gem 'rails', :path => '/Users/mattsimpson/Projects/_resources/Code/Rails3' gem 'arel', :git => 'git://github.com/rails/arel.git' gem 'mysql' group :cucumber do gem 'cucumber-rails' gem 'cucumber' gem 'factory_girl' gem 'webrat' gem 'ruby-debug19' end
Install your gems
[msimpson@dakota rails3] $ bundle install
Install Cucumber with webrat and test unit
[msimpson@dakota rails3] $ rails generate cucumber:install --webrat --testunit
Open and edit config/database.yml and create your database by running the following:
[msimpson@dakota app] $ rake db:create:all
You are good to go!
Originally I was having troubles with rake test and rake cucumber, but after recreating my rails app this way it all worked great. Hope it works for you.
Rails 3 Updates
by Matt on Jul.07, 2010, under Ruby on Rails
In this I will explore and solve issues I had in upgrading rails 3 to the latest rails 3 version.
Following the rails 3 update saga continues. After taking a break to make some leaps in the design process on an application, I came back to programming the app. After writing some cucumber tests I received a series of deprecated messages. One thing I would like to note is that rails 3 is very good at letting you know what is going on and what you need to do. Let’s get started:
My gemfile for cucumber looks like this:
group :cucumber do gem 'capybara' gem 'database_cleaner' gem 'cucumber-rails' gem 'cucumber' gem 'spork' gem 'launchy' # So you can do Then show me the page gem 'factory_girl' gem 'webrat' end
When I tried to run my cucumber test I got this message: ”undefined method `config’ for nil:NilClass (NoMethodError)”
So I updated my gems via bundle:
[msimpson@dakota Code] $ bundle install
and I got the message:
No compatible versions could be found for required dependencies: Conflict on: "bundler": * bundler (0.9.25) activated by bundler (= 0.9.25, runtime) * bundler (>= 1.0.0.beta.2, runtime) required by rails (>= 0, runtime) All possible versions of origin requirements conflict.
so I installed the new bundler
[msimpson@dakota Code] $ sudo gem install bundler -v 1.0.0.beta.2
reran the cucumbers and got this:
Rails 3 doesn't officially support Ruby 1.9.1 since recent stable releases have segfaulted the test suite. Please upgrade to Ruby 1.9.2 before Rails 3 is released! You're running ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.3.0]so I noticed I needed to install the new ruby 1.9.2 release candidate. Since I use rvm I had to update rvm, remove my old ruby 1.9.2, re-install it and reinstall bundler:
[msimpson@dakota Code] $rvm update [msimpson@dakota Code] $rvm reload [msimpson@dakota Code] $rvm remove 1.9.2 [msimpson@dakota Code] $rvm install 1.9.2 [msimpson@dakota Code] $rvm use 1.9.2 [msimpson@dakota Code] $sudo gem install bundler -v 1.0.0.beta.2 [msimpson@dakota Code] $ bundle installI didn't get all the way through but I'm pretty sure I got closer
, currently I'm working on getting cucumber to install and run. Hope this helps, if anyone gets any further let me know.
Rails 3 update
by Matt on May.25, 2010, under Ruby on Rails
I’ve had to revert from ruby 1.9.2-preview to ruby 1.9.1 p378.
[msimpson@dakota Code] (master) $ rvm install 1.9.1
[msimpson@dakota Code] (master) $ rvm use 1.9.1
Install rails 3 with the new ruby install
[msimpson@dakota Code] (master) $ sudo gem install rails --prerelease
Create a new rails app using mysql
[msimpson@dakota Code] (master) $ rails myapp --edge -d mysql
Now you will be able to create your db and start your app
[msimpson@dakota Code] (master) $ rake db:create:all [msimpson@dakota Code] (master) $ rails server
Yay!! Rails 3, here we go!