-
[Refactor] Dynamic assignment with coffeescript
Today I was working in Commentator, a gem that was extracted from Aventones, and I had a problem trying to assign a lot of configuration, variables in a class.
Before
This was the initial state:
I had one class that receives the params, and makes a kind of parse,
an then the class that needs that parsed data.
As you can see in the constructor of Commentator, I made a lot of assignments, from data that comes from the CommentatorParams object.
ugly =(
After
In order to refactor this I made a kind of dynamic assignment in the Commentator class, with the help of another method in the CommentatorParams object.
I think this is cool, because I am receiving just the params that I want, and I am defining the methods in one place =)
-
A little help: Making Uncle Bob Happy →
Here at Sonian the Web Development team has a rare opportunity: a green-field, high-impact Web development effort. Here is a peek at the application architecture.

It won’t mean a whole lot without an explanation. And I don’t have the time to explain it all now, though I will over time. And if…
-
Alegría Mexicana En Tenerife. Islas Canarias España
-
User-centric Routing with Devise and Rails
Maybe there is a lot of people know this solution, but before today I didn’t know it, so I want to share this =).
Imagine that you want that the home page of your app for an authenticated user, to be a Dashboard with stadistics or something special, but you want to have an informative page for the people that is not authenticated.
With Devise you can solve this problem beautifully =)
-
Your API in your Views, using Jbuilder
When I initialize a Backbone or a Javascript app, in a Rails view, I like to populate the template with the records that I am going to need. This is because if I dont populate this records in the view, then I have to fetch the record in the javascript app, so I need another call to the server :(.
I think a good way to produce, your JSON objects is with Jbuilder, because in this way you don’t have to override the “as_json” method. Then if you have a template that returns JSON, you can render it in your view.
The example
-
Refactoring my old cucumber tests
Like a year ago, my style to write cucumber test was to use the cucumber’s web steps, the most I can, and the results were some tests like this one.
-
Brené Brown: Listening to shame
-
Susan Cain: The power of introverts