Other Rails templates types - ruby-on-rails

Erb is the default template type in Rails and I read about Haml.
What other types exist and can be used in Rails?
Thanks.

Take a look at the Ruby Toolbox.
I only know Mustache, Liquid and Markaby of those above, but seems there are pretty many other alternatives.

Rails 3 uses Erubis by default.

You may also want to take a look at slim, which is elegant in a HAML fashion but apparently faster! https://github.com/stonean/slim

Related

Alternatives to Rails' client_side_validations?

client_side_validations was a widely used gem that automatically created realtime validations for your Rails' frontend based on your models' validations. Alas, it seems to be unmaintained now. Are there any similar, maintained alternatives out there?
You can use Judge Rails Gem: https://github.com/joecorcoran/judge and there are plugins to use with FormBuilder SimpleForm https://github.com/joecorcoran/judge-simple_form
parsley.js is really nice -http://parsleyjs.org/ and it's been made into a gem for rails here - https://github.com/mekishizufu/parsley-rails
You can also use jQuery.validation. Although I think parsley looks a little better.

Ruby on Rails Views. (Best Practice)

This might seem like a strange question. But have been pondering over this for quite some time now.
Is it better to use RAW HTML in Rails views or to go with Rails view helpers??
If i understand correctly Rails views helpers are converted back to raw HTML. So would it affect the performance of the application by a great deal ??
And is there a tool that would allow me to convert HTML to ERB :)
I'm aware of the HTML to HAML converter.
Thank you,
Certainly better to use a rails helper, as this allows you to create dynamic elements
Use Rails helpers, they guarantee the latest HTML good practice are used and up to date.

Rails-like routing framework

is there any rails-like routing I can use in my non-rails app? I really like the way of defining url matching. Something like:
if matcher.match("/myapp/cart/:id/create")
puts matcher[:id]
end
Something similar. I would prefer simple solution to that. Maybe a snippet or reference to some code that can be used. Or a library. Thanks
You can do it with rack also
https://github.com/mynyml/simple_router
Sounds like Sinatra may be perfect for you:
http://www.sinatrarb.com/
If you just want sinatra like routes inside a rails app you may want to try sinatrify
astaire also seems to offer the same functionality but is not compatible with rails >= 3.2 with which i tried to use it.

Logic free templates for Ruby on Rails

I am looking for a technique for moving Ruby on Rails methods and logic (<% if, link_to etc.) away from templates. So far I have been looking at the mustache template language, but I am not entire sure if this is the way to go.
Any thoughts? Would you recommend mustache or is there a better choice?
In addition to Mustache, there is Liquid (used by Shopify) and Radius (used by Radiant). You may want to check them out.

Using liquid with haml

I'm planning to develop a CMS with ruby/rails. One of the main key features that I'm planning is to give the user to edit their layout (I'm planning to do this through liquid)
meanwhile i have red some good articles on HAML and SaaS. So just wondering whether i can use
haml + liquid + sass for my work
If possible i would thankful if you could point me some resources
thanks in advance
cheers,
sameera
I think that is possible, take a look at this project mixing Jekyll, Haml and SCSS.
I don't think that HAML and Liquid are really compatible. Plus, as HAML has significant whitespace, i don't see it as a good idea to introduce it as the markup for CMS content editing (assuming we are dealing with an average webmaster or a regular user with a WYSIWYG editor here).
I've seen haml and liquid working at least once on this jekyll fork:
http://github.com/henrik/jekyll
So what you are proposing is certainly possible. I don't know whether it will be "easy", though.

Resources