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.
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 =)
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
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 =)
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.
Brené Brown: Listening to shame
Susan Cain: The power of introverts