Technology Insights

What Exactly Does the Scaffold_Resource Generator give you?

The regular scaffold generator (e.g. ruby script/generate scaffold model controller) requires you to create your model and controller first. The scaffold_resource generator, on the other hand, generates the (RESTful) model and controller for you. For example: ruby script/generate scaffold_resource Caregiver first_name:string last_name:string In Rails 2.0, use resource instead: ruby script/generate resource Caregiver first_name:string last_name:string Here’s…

Technology Insights

View for Version Numbers, Hostnames, IPs, Etc.

Here’s some code (and rendered view) for various version numbers, host names, IPs for Ruby, Rails, PostgreSQL, SMTP. <b>Network</b><br> UNIX hostname: <code><%= `hostname` %></code><br> SERVER_ADDR: <code><%= request.env[“SERVER_ADDR”].to_s %></code> <br> HOST_NAME : <code><%= request.host %></code> <br> REMOTE_ADDR: <code><%= request.env[“REMOTE_ADDR”].to_s %></code> <br> <br> <b>Software</b><br> Database: <code><%= ActiveRecord::Base.connection.select_value(“SELECT  VERSION()”) %></code><br> Email delivery method: <code><%= ActionMailer::Base.delivery_method %></code><br> SMTP server:…

Technology Insights

User Profiles with Restful Authentication

  Error when updating the user from a form ActiveRecord::RecordInvalid (Validation failed: Password confirmation can’t be blank, Password is too short (minimum is 4 characters), Password can’t be blank):       Suggestion It’s probably because of the restrictions on the User model (attr_accessible or attr_protected, in particular). But allowing users access to any part…