#rails
15 posts tagged rails. Clear filter
-
What It Took to Deploy This Site with Kamal
One config file, two accessories, and a one-line deploy script — plus the two things that nearly shipped placeholder posts to a live site.
-
Rails Style Params in Python and Flask
Ruby on Rails does a great job of parsing arrays in form data and populating a params hash, for quick and easy access in your controllers. For instance <input name="item[]" value="item 1"/ <input...
-
Active Admin Rails 5 undefined method per_page_kaminari
If you run into this error in development, using Rails 5 and Active Admin NoMethodError - undefined method perpagekaminari' Try the following. First, make sure you have an initializer in your...
-
Turn Off SSL Verification In Ruby
The following code will disable SSL verification when using Open SSL. OpenSSL::SSL::VERIFYPEER = OpenSSL::SSL::VERIFYNONE It is probably not a good idea to do this in production. But if you are...
-
Change the Default Controller Name in Rails Functional Tests
Rails will infer the controller you want to test from the class name of the test case. For example... class PeopleControllerTest < ActionController::TestCase end will test the...
-
A Couple of Usefule Snippets When Working with Textmate
Here is the snippet f path/to/directory 'search string' | open\in\mate This snippet (technically 2 snippets) will recursively scan the contents of files in a directory and then open all the files...
-
How to Add Additional Sub Directories to the Default Rails Test:Unit File Structure
Edit Rakefile in project root Add a new rake test task... E.g., rake test:lib, below everything else in that file... Alternatively, add a task in lib/tasks/ directory and plop in the same code...
-
Transform Matching Text with Gsub in Ruby and Regular Expression
Here is a gist that demonstrates how easy it is to transform text using gsub and a block with Ruby. "Scs Epc Score".gsub (/scs|epc/i) { |i| i.upcase } =\ SCS EPC Score For more helpful string...
-
Rails Send_File in Production Delivers an Empty File
If you're running Rails in production it will by default be configured to let apache or nginx send files for you. If you're handling file downloads yourself with send\file you will notice that the...
-
Simple String Concatenation of a Collection Written as a Helper for Rails
At Railsconf last week I took Greg Pollack's online course Rails Best Practices. The interface is gorgeous and the instructions are excellent. One of the lessons involved taking a partial and...
-
Installing Ruby on Rails 3, MySQL, Git, Ruby Enterprise Edition, Passenger (Mod_Rails) on Ubuntu with Rackspace Cloud.
Short and sweet. Here all the commands I run in this order to set up a brand new box. It usually takes about 10 - 15 minutes on a 256 MB RAM instance. Compiling Ruby Enterprise Edition, which is...
-
Rails 3 disable_with Does Not Work with Ajax Remote Form_for
It appears that the :disable\with option on the submit\tag form helper method does not behave as expected with remote forms. I'm not sure if this is a bug or not. But the fix is pretty straight...
-
Rails Select Tag and Onchange Event Calling a Remote Function with Default Option Selected
Here is a little code snippet that will fire off a request to update\client\path when you change the select field. This stands alone, rather than being apart of a larger form. The Client::CATEGORY...
-
Ruby Enterprise Edition and Passenger ./script/console production fails and instead returns Loading production environment (Rails 2.3.5) Rails requires RubyGems >= 1.3.2. Please install RubyGems...
After installing Ruby Enterprise Edition, REE, and Passenger on Ubuntu you may see this error message when you run script/console for the first time You then scratch your head and run to find that...
-
How Beautiful is Ruby?
Working with Ruby and in particular Rails, it's easy to take the beauty inherent in the language for granted. I mean look at this code. If you read it aloud to yourself, it reads like an english...