How can I automatically render partials using markdown in Rails 3?

Turns out, the Right Way ™ to do this is using ActionView::Template.register_template_handler: lib/markdown_handler.rb: require ‘rdiscount’ module MarkdownHandler def self.erb @erb ||= ActionView::Template.registered_template_handler(:erb) end def self.call(template) compiled_source = erb.call(template) “RDiscount.new(begin;#{compiled_source};end).to_html” end end ActionView::Template.register_template_handler :md, MarkdownHandler If you require ‘markdown_handler’ in your config/application.rb (or an initializer), then any view or partial can be rendered as Markdown with … Read more

Sass @import using leading underscore

No. If your file is _foo.scss, all of these imports have identical results as long as you don’t have any ambiguous filenames (barring any side effects that might exist): @import “foo”; @import “foo.scss”; @import “_foo”; @import “_foo.scss”; Files with the same name but different extension The only time an extension is necessary is if you … Read more

Devise Custom Routes and Login Pages

With Devise 1.1.3 the following should work devise_for :user, :path => ”, :path_names => { :sign_in => “login”, :sign_out => “logout”, :sign_up => “register” } The routes it creates will not be appended with “/user/…” because of the :path parameter being an empty string. The :pathnames hash will take care of naming the routes as … Read more

Is it possible to import a whole directory in sass using @import?

If you are using Sass in a Rails project, the sass-rails gem, https://github.com/rails/sass-rails, features glob importing. @import “foo/*” // import all the files in the foo folder @import “bar/**/*” // import all the files in the bar tree To answer the concern in another answer “If you import a directory, how can you determine import … Read more