Tags » Ruby On Rails

Failure Sucks

Zendesk is the third startup I’ve built, making me what everyone is quick to call a “serial entrepreneur.” I’m not a big fan of that moniker. 996 more words

Media

redis integeration in heroku

Follow all steps given here:
https://devcenter.heroku.com/articles/redistogo#using-with-rails-2-3-3

Explanation of some steps:
heroku config --app heroku-app-name | grep REDISTOGO_URL
output:
REDISTOGO_URL: redis://user-name:password@redis-server:11247/

Ruby On Rails

Basics of Active Record

What is Active Record?

Active Record is the model in MVC (Model, View, Controller). It’s the part of the system responsible for representing business data and logic. 400 more words

Rails

Startup Adventures: Code Division, Startup Weekend, and a bunch of awesome new friends

A few months back, I made the decision to quit my job in investments. Many might not know this, but my motivation for doing this was that I wanted to “go startup”. 558 more words

Code Division

Advantage of using find_each and find_in_batches in rails

Usually when we want to loop through all rows of an active record model, we do

User.all.each  { |user| user.update_role  }

But when we do this in Rails console, it loads all the User objects in to memory and performs the action. 

82 more words
Ruby On Rails

RESTful New vs Create

What is the difference between New and Create Restful actions? We already know New action create a new object but not yet save the instance to the database, but Create will save the object to the databases (if validations pass) [ 420 more words

Ruby On Rails

Issue fixed - "Rollback Transaction" when uploading images using Carrierwave

I was enhancing posts and profiles for my reddit-like website with images. But I encountered a very tough bug (for me) shown as below:

Started PATCH "/users/9" for 127.0.0.1 at 2014-12-12 21:44:01 -0800
 Processing by UsersController#update as HTML
 Parameters: {"utf8"=>"✓", "authenticity_token"=>"h2D65tyn6XKhiieXBNs6JsnErstczdEIcptEJzpfQkE=", "user"=>{"name"=>"", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x007fc70ba17a00 @tempfile=#<Tempfile:/var/folders/x3/x2wx_trj4xl4dqt2h2zdx2vm0000gn/T/RackMultipart20141212-4389-1ugdarh>, @original_filename="jpg2.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"user\"; filename=\"jpg2.jpg\"\r\nContent-Type: image/jpeg\r\n">, "avatar_cache"=>""}, "commit"=>"Update", "id"=>"9"}
 User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 9 ORDER BY "users"."id" ASC LIMIT 1
 Unpermitted parameters: avatar_cache
 (0.1ms) begin transaction
 (0.2ms) rollback transaction
 Redirected to http://0.0.0.0:3000/users/edit
 Completed 302 Found in 221ms (ActiveRecord: 0.7ms)
… 627 more words
Ruby On Rails