Ruby on Rails
I have tried to define and explain API in this post. I again, put it in simple words “ API is program which let the user to use methods of your application from outside the application “. I will create a REST API here which will implement CRUD ( create, read, update, delete ) operation on users table from outside the application. I assume you all have implemented CRUD for user in your application. The API implementation will remain same, with below difference.
Wave the flag! I recently ran into an interesting issue while working on a Rails 3, Ruby 1.9.3 project. My needs were simple: I had a single text field that allowed the user to enter a date in MM/DD/YYYY format.
March 19, 2012 We’ve got all the tools we need for building a solid, reliable test suite—now it’s time to put them to work. We’ll get started with the app’s core building blocks—its models.
paper_trail is a gem used for auditing and versioning of your models. We can easily use it with active_admin to show a list of recently modified items in the admin screen. Example: Integration instructions Install PaperTrail as a gem via your Gemfile : gem 'paper_trail' Generate a migration which will add a versions table to your database: rails generate paper_trail:install Run the migration: rake db:migrate Add user_for_paper_trail to controller so paper_trail knows which user updated the item. (optional)
Recently I was tasked to write tests for the transactions of an existing application. This gave me the opportunity to learn more about the codebase, while also improving the test coverage. Generally, most of the transaction code looked fine.
What about editing? I create this post to answer Pierre’s question in the comment section in my previous tutorial here . The edit part is actually not much different from the new part. Therefore, I wanted to just edit that previous post. But somehow, there is something wrong with my blog, I could not update that post. Well, I tried this and that and nothing worked while my lunch time is almost over now.
Sometimes you need to get rid of .svn hidden folders on your Mac. In my case it was about resyncing my local working copy with client subversion repository. Everything was broken at both ends.
By Ilya Grigorik on July 11, 2007 /* Typical ActiveRecord insert * number of records = slow */ mysql > insert into widgets ( title , price ) values ( 'gizmo' , 5 ); Query OK , 1 row affected ( 0 . 01 sec ) /* Multi-record insert with ar-extensions * 1 insert = fast */ mysql > insert into widgets ( title , price ) values ( 'gizmo' , 5 ),( 'super-gizmo' , 10 ),( 'hammer' , 6 ); Query OK , 3 rows affected ( 0 . 01 sec ) Records : 3 Duplicates : 0 Warnings : 0 ActiveRecord is a fantastic database abstraction layer and is rightfully one of the core pillars of Rails, but that doesn't mean we can't improve it.
activerecord-import activerecord-import is a library for bulk inserting data using ActiveRecord. Note: activerecord-import requires Rails 3.×. It does not work with Rails 2.×.