Tampilkan postingan dengan label ruby on rails. Tampilkan semua postingan
Tampilkan postingan dengan label ruby on rails. Tampilkan semua postingan

Minggu, 08 April 2012

cucumber-rails-1.0.2/lib/cucumber/rails.rb:4:in `dirname': can't convert nil into String (TypeError)

cucumber-rails-1.0.2/lib/cucumber/rails.rb:4:in `dirname': can't convert nil into String (TypeError)

gem update cucumber-rails

should solve the problems ;)

Sabtu, 07 April 2012

protocol.rb:135 - Resource temporarily unavailable - read would block

if youre having that error.

reinstalling rvm may resolve your problem.

here is the link

Click here

Rabu, 04 April 2012

bundle install not install the gems

i was having a problem when im running bundle install, and the process are not fecth completely

to fix that i just have one source on my .gemrc file


---
:update_sources: true
:sources:
- http://gems.github.com
:benchmark: false
:bulk_threshold: 1000
:backtrace: false
:verbose: true
gem: --no-ri --no-rdoc

Senin, 02 April 2012

open xls files in rails 3

when i m stuck working on my projects to open xlsx files into my ruby on rails app,
i found this gems, and its easy to use :


  [sudo] gem install roo


For further information you could refer to this :

Click here...

Kamis, 15 Desember 2011

making a gem

if you want to make gem , or it is same as our own library,
and you don't know how to do it.

here some reference how to build that

Railscats :
http://railscasts.com/episodes/135-making-a-gem

rubyonrails.org

http://guides.rubyonrails.org/plugins.html

Eager Loading

When we are building a website, a small website, it wont be feel slow, if we are querying a large of data from database.

But.. if you re building a large scale rails application. This is one of the methods you have to use, Eager Loading

Eager loading is One way to improve performance is to cut down on the number of SQL queries.
It will improve query on rails application

I dont quite understand how rails do it.
But simple, programmer doesnt have to know all the things(code) that written down. lol.

This is the example


      class Post < ActiveRecord::Base
           belongs_to :author
           has_many   :comments
       end
  

Then you are querying it on the view.


for post in Post.all
  puts "Post:            " + post.title
  puts "Written by:      " + post.author.name
  puts "Last comment on: " + post.comments.first.created_on
end
 

What happened?
they will querying to comments table, as much as data on the posts tables.
So it's really painfull.

So with code below :

for post in Post.find(:all, :include => :author)
 

There will be just 1 query to the database.

And it will make your application lightener..

Rabu, 14 Desember 2011

basic gem for building rails application

There are some various gem for building application.
but here i will list, the most common rails application gem used.


1. Devise
Used for authentication

gem install devise

source : https://github.com/plataformatec/devise

2. Easy Roles
Used for user roles.


gem install easy_roles


source : https://github.com/platform45/easy_roles
 
Copyright 2009 ruby on rails. Powered by Blogger
Blogger Templates created by Deluxe Templates
Wordpress by Wpthemescreator