background preloader

Model

Facebook Twitter

JSONLint - The JSON Validator. Prototype JSON APIs with Fortune.js. Rails gets automatic EXPLAIN logging for slow SQL queries. In a fresh commit, Rails edge now has the ability to automatically add query plan info to the standard Rails logger: # Log the query plan for queries taking more than this (works# with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.5.

Rails gets automatic EXPLAIN logging for slow SQL queries

Nesquena/rabl. Rails/jbuilder. Gowalla/boxer. A few tools to craft JSON output in a Ruby web app API. It seems a solid API that returns JSON is almost a prerequisite for any new web app these days.

A few tools to craft JSON output in a Ruby web app API

Often these JSON data structures return nested associated data, composed from several models in the system. There has been some discussion this week around tools and approaches to building JSON data structures in a Ruby web app API. Perhaps the biggest buzz this week has been around Jbuilder which DHH announced on Twitter. While the world doesn’t need another J_Anything_, it does provide a nice API that can be used stand alone from controllers or as a view template:

Admin_view: minimal admin interface generator for your Rails 3 models — Rendered Text. We’ve released the first version of admin_view, a gem that adds a minimal admin interface generator for your models.

admin_view: minimal admin interface generator for your Rails 3 models — Rendered Text

It works with Rails 3 and gives you a controller, views and specs, with an assumption that you’re authenticating users with Devise. For example, if you type: bundle exec rails g admin_view User --search_by name you’ll get something like this: The search form is powered by meta_search, and you can easily tweak it to cover more columns. The markup is bare bones, and this is on purpose - our only guideline was that it should look good with the Railscasts stylesheet, which we use for admin interface in all our applications. Subscribe to gem updates on RubyGems or watch the repo to stay up-to-date on future improvements. #93: Sass, Bourbon and Product Design with Phil LaPier. Shopify/identity_cache. Identity_cache/README.md at master · Shopify/identity_cache. Search · rails ajax. Optimizing your Rails App Part 1: N + 1 Queries - Codemy.

This post is old and has been deprecated. We have created videos that will help guide you to solving the N+1 problem in Rails. Awkward Change Flow or: How I Learned to Stop Worrying and Love the Application Cache - A Modest Proposal. Snappy title, yes...?

Awkward Change Flow or: How I Learned to Stop Worrying and Love the Application Cache - A Modest Proposal

Let's just move on... The application cache API introduced by HTML5 is a very powerful tool which is particularly useful for web applications whose intended primary use is on mobile devices. Not only can it significantly speed up the load time of your app, but if implemented correctly you can make your application work quite well even when the user is not connected to the Internet. I'm not going to write too much about how the application cache works as it has already been covered very well elsewhere. If that's what you're looking for I'd recommend the following articles: These articles describe the API really well, and also notes several of the "gotchas" that might trip you up if you're not aware of them. One of the more annoying quirks of developing with the application cache is that it has no mechanism for detecting updates to already cached resources. Rails can't save a nested resource via ActiveResource.

Rails - how to join/group nested tables and get joined values out. Quick Start Guide to PhoneGap+AngularJS. I’ve created a sample mobile application to help developers get started building mobile applications with PhoneGap and AngularJS quickly.

Quick Start Guide to PhoneGap+AngularJS

The sample application includes view navigation, some standard user interface components and code to help avoid common pitfalls in mobile application development (click delays etc). Below are a few screenshots showing parts of the application. It basically includes a header and a scrollable mobile list of different PhoneGap API samples to try out. Main App View showing Topcoat Navigation Bar and List Settings View (Topcoat Overlay) Other Views Libraries Used **Updated the above list to remove fastclick.js and replace with using the ngMobile module from angular-mobile.js (new in angular versions => 1.14). angular-mobile.js includes the fastclick.js code by default and in version 1.1.5 also includes directives for ngSwipe (left and right).

The sample application can be found here on my github account. Martin Fowler: NoSQL Distilled to an Hour. NoSQL Concept and MongoDB. In recent years, we often hear the name of NoSQL as a new star that is rising in the world of IT and it has emerged as a different and alternative approach compared to relational database management systems (RDBMS).

NoSQL Concept and MongoDB

The reason of occurrence of this concept and therefore, databases enhanced by this alternative approach is to meet the required speed to read/write for the data on internet that its size increases day after day and the systems with high traffic. There are fundamental differences between the horizontally scalable NoSQL systems and relational database management systems. StatementInvalid: Could not find table 'users' Ruby on rails - ArgumentError: Factory not registered: user - Hartl Chapter 7.1.3. Adding foreign key constraints in rails migrations. More often than not models have associations.

Adding foreign key constraints in rails migrations

And foreign key constraints are sometimes used for keeping them in good shape. The role of such constraints can be indispensable or trivial, depending on how your database is managed. 4.2. Creating Database/“Model” Obtain row locks on ActiveRecord objects. Posted almost 2 years ago.

Obtain row locks on ActiveRecord objects

Visible to the public. Repeats. When requests arrive at the application servers simultaneously, weird things can happen.