New plugin - Personalise Site

This is a stylistic nit pick, but typically methods that end in "?" return true or false rather than some other value. I would personally name the methods "user_browser_version" or "user_platform" or something like that.


Just some ideas…

Hi Jeremy,

Thanks for your feedback, I have made the changes to remove the ‘?’ based on your comments.

You could also add some methods like the following:



then your example becomes:

<% if running_windows? -%> ruby script/plugin install <% elsif running_os_x? -%> ./script/plugin install <% else -%> script/plugin install <% end -%>

What? Replace methods? No way. Just add some nice convenience methods to pretty up the views.

For example:

def running_osx? which_platform == ‘Mac’ end

def running_windows which_platform == “Windows”


Etc. You’re not replacing methods… you are adding a DSL to your plugin… which makes views much easier.

It also allows you to change the underlying implementation. For example… which_platform might return “Windows” right now… but what if it returns win32 in some cases? It might also return something else in the future.

This is one reason why you access your params in a Rails application via params (a method) and not @params (an instance variable)

Nice plugin btw… have you submitted this to yet?