Archive for the ‘Ruby on Rails’ tag
Render update with helper methods
At this post I’ll show you how I have been responding to Ajax requests at web apps built on top of rails 2.3.
Ajax completely changed the web experience, and I highly recommend you to embrace it whenever your requirements are not disallowing you.
For the sake of curiosity, at my current project probably more than 90% of post/put/delete requests are performed asynchronously.
If you don’t know the way Rails can handle that, it is a very simple concept.
You write some Ruby code that will generate javascript code, being this js code executed when the request is responded with success.
We can do that writing rjs files, or, my preferred method, we can generate the code directly from a controller call.
This could bring us some SRP problems, if we were writing this code at the controller class.
But my approach is encapsulating the response code at helper methods, because that should be the home of any code taking care of html concerns.
I think this is a good way to keep my code well organized so anyone can easily identify how things are supposed to work looking to the helper methods, without being required to open a lot of rjs files.
At this gist you can see a sample code of this approach.
Do you prefer the rjs option?
Maybe I’m going against one of those Rails conventions?
Right tool for the right job
I’ve become a professional programmer working on the .NET platform.
.NET is pretty cool, C# also.
But it seems like something is missing, while I am working with web applications.
I think the web is pretty cool, and I really like to work on making it even more cool.
But with a static programming language at hands, my work have become so much pragmatic, and kind of boring.
I don’t want to worry about IoC, DI, AOP and all that stuff, when looking for a minimal sense of flexibility, just to please C# compiler.
And I don’t want to take all those framework decisions, writing all that crap infrastructure code, every and every time I start a new project.
Not while working on cool web applications.
What I want is simplicity, polish and freedom.
So I can take out of my brain all that distractions, keeping my focus at the product level.
Static programming showed her face to me.
And she is ugly.
I’m going to give Ruby on Rails a second shot, as I’ve already tweeted.
I really like the Rails mentality, and how Ruby code looks like.
And I’m very interested in work with something that please me, instead of please what I’m working on.
Look, I am not saying .NET and C# sucks.
Okay, maybe I do think so, when we talk about web programming.
This is kind of subjective.
I am okay if you do not agree with what I pointed out.
What I believe is that we should look for the right tool when doing a job.
Because there is no such tool solving all sort of problems, on top of the best suited approach. Sorry, C Sharp.
(Portuguese) Migrations em .Net
Sorry, this entry is only available in Portuguese.
Rails Way
Ten days ago I wrote about my recent interest on Ruby language.
Today I will talk about Rails.

Ruby on Rails
The technology industry is not going to stop with innovative actions.
Every day new ideas, concepts and tools are coming.
The interesting of Ruby on Rails is that all these things seems envolved. It is not just a framework.
They come out every day, and if Rails were just that, the noise would be lower.
Ruby on Rails is something to be followed.
A new way of working and thinking.
Fast, agile and powerful.
I see myself as a pragmatic developer.
I don’t want to write thousands of lines of code building my applications.
And I don’t believe that I should resolve that becoming the greatest (and most expensive) software architect.
Thus my time and intelligence would be wasted, as so my customer’s money.
My application insfrastructure must be opinionated, transparent and automated. Helping me to solve common problems without losing more than a few minutes.
By this way my concerns will focus on more important things, such what the application under development is supposed to do.
Implementation concerns, the platform will help me resolve.
Quickly, easily and with elegance. Without huge efforts.
Ruby on Rails, as it seems, is very useful within this scenario.
Rails may become reference on delivering web applications at a different level, with lower cost and higher quality. And if this happens I will not be unsuspected.
What about you?
Freedom and Ruby
Given Rails increasing popularity, web developers like me started to pay attention to this new technology.
So came my turn to find out some information about that.
I started the studies with Ruby, because without the language, the framework would not even exist.
Ruby’s nature and grammar sounds really interesting. And the dynamic aspects of Ruby makes it a very powerful language.
For those who are familiar with a strongly typed, and static language as C#, Ruby seems like a breath of freedom.

Linguagem Estática
Using a pragmatic approach, I am looking for the following aspects to investigate:
- Under what circumstances Ruby or other dynamic languages would help me within the .net platform.
- How should be work with Ruby on Rails for web development purposes, leaving .net for other scenarios.
On the second point, I know Rails is much more than a framework written on a dynamic language, and therefore I would like to know everything that involves the platform.
In the coming months I will give depth to these studies.
And maybe a new Railer is emerging?