Getting only the columns you want in Rails
A thing that is often missed when your doing a web service or a rails app is selecting only
the columns you need.
A traditional find:
user = User.find :all
render :xml => user.to_xml
Will give you the bloat of the whole user table.
If you only hae a few small columns then thats not so bad,
but I've seen legacy apps that have very large number of columns,
so it makes since then to control this better.
user = User.find(:all, :select = 'email')
render :xml => user
This also will make your resulting xml file alot more managable.
And since bandwidth is not free, it will help you handle more users
for less money.


Recent comments
1 year 23 weeks ago
1 year 23 weeks ago
1 year 25 weeks ago
1 year 27 weeks ago
1 year 42 weeks ago
1 year 45 weeks ago
1 year 45 weeks ago
1 year 45 weeks ago
1 year 46 weeks ago
1 year 48 weeks ago