Regular expression checking of landline/mobile UK numbers in Ruby on Rails

You want to have validations for phone numbers in Ruby on Rails code.

The mobile numbers in UK should start with a 0, followed by 7, then a number between 5 and 9, and finally another 8 numbers.
For the landline numbers in UK the number should start with 0, followed by either 1 and 8 or 9 digits, or by 2 or 3 and then 9 digits.
So in order to use a regular expression in your validations, you could use something like the following in your model:

Red Box progress indicator with active_scaffold_upload branch

You need to display a splash screen when uploading files to a Ruby on Rails application.

My model:

The steps I have followed.

  1. Install redbox plugin from project path run:
  2. If files redbox.js, redbox.css and redbox_spinner.gif haven’t been copied over to the public folders copy them over manually or go to vendor/plugins/redbox and run:
  3. Find an animated gif for the progress indicator to be used (ie pleasewait.gif) and copy it over to public/images.
  4. In order to be able to use the progress indicator in different parts of the application, add the following to the app/views/layouts/ :

    near the place where <= javascript_include_tag :default > is located.
    Also at the bottom of the page create the content of the redbox:
  5. Copy _update_form.rhtml, update_form.rhtml and update.rjs from vendor/plugins/active_scaffold_upload/frontends/default/views/ to the app/views/numbers (model you want to use).
  6. To display the redbox in the numbers/_update_form.rhtml add the following in the submit_tag:
  7. To close the redbox after the uploading was successful, add the following in numbers/update.rjs as the first line inside controller.send :successful? clause: