Topic: Best practice of writing Rails code

Hello guys,

I'm dealing with some issue about best practice of how to use Rails code.
So, what's the best way to write the following lines that basicaly does the same thing?

Let's say we have a link that needs to be a button with some parameters (theme, size and icon)


= link_to "Login", "#", class: "button", data: {theme: "green", size: "large", icon: "small-arrow"}



= link_to "Login", "#", class: :button, data: {theme: :green, size: :large, icon: "small-arrow"}

both of them should generate something like this

<a class="button" data-theme="green" data-size="large" data-icon="small-arrow">Login</a>

Personaly I prefer 1. because when it comes to maintanability is easier:
let's say that we have to add a second class "login" to this link/button and to change the theme to "dark-red"

- adding the class: just click after the n letter after the word button, hit a space and write the second class login
- changing the theme: double click on green word and write dark-red

- adding the class: delete the : character, select the word button, wrap it in quotes, add a space and after that the class
- changing the theme: select :green, add quotes and write the dark-red theme

I find the first version to be more faster to perform than the second one -> improves mentainability

Other points could be:
- using :word notation doesn't work with spaces and dashes (other characters), but the "quoted string" notation works
- keeping a single way of coding (the one that handles all the cases) -> more as a standard

So, what do you think? How do you code when you have something like this?
I would like some opinions about this from some experts in coding Rails.

Thank you very much!

Re: Best practice of writing Rails code

use the one you feel more confortable to code, I prefer the attribute: "value" way

Re: Best practice of writing Rails code

Thank you for your reply. I've found that there is no best way, but the way you're confortable with, as you said.
Thanks again!