Close and Go BackBack to Viget

Introducing

Introducing ActsAsMarkup: A Markdown, Textile, Wikitext, and RDoc Plugin for ActiveRecord

Brian Landau
Brian Landau, Web Developer, August 12, 2008 0

On a project I’ve been working on recently, I wanted to be able to enter in Markdown text to a field and convert it into HTML in a view. Having read about BlueCloth’s performance problems though, I didn’t want to use the built in markdown helper in ActionView.

So I decided to give RDiscount a try, but I wanted to have the value for the column stored as a RDiscount Markdown object in the model object. So I started by creating an acts_as_markdown class method that took a list of columns to be represented as markdown objects. Quickly, my fellow Vigeteers and I realized it would be useful for a bunch of other markup languages as well, along with other Markdown libraries.

Continue reading "Introducing ActsAsMarkup: A Markdown, Textile, Wikitext, and RDoc Plugin for ActiveRecord"

Introducing: EmailLabsClient

David Eisinger
David Eisinger, Web Developer, July 31, 2008 0

On my latest project, the client is using EmailLabs to manage their mailing lists. To simplify interaction with their system, we’ve created EmailLabsClient, a small Ruby client for the EmailLabs API. The core of the program is the send_request method:

def self.send_request(request_type, activity)
  xml = Builder::XmlMarkup.new :target => (input = '')
  xml.instruct!
  xml.DATASET do
    xml.SITE_ID SITE_ID
    yield xml
  end
  Net::HTTP.post_form(URI.parse(ENDPOINT),
    :type => request_type, :activity => activity,
    :input => input)
end

Then you can make API requests like this:

def self.subscribe_user(mailing_list, email_address)
  send_request('record', 'add') do |body|
    body.MLID mailing_list
    body.DATA email_address, :type => 'email'
  end
end

If you find yourself needing to work with an EmailLabs mailing list, check it out. At the very least, you should get a decent idea of how to interact with their API. It’s up on GitHub, so if you add any functionality, send those patches our way.

A Development Community for Viget Labs and Beyond

Every team member here at Viget Labs strives to be an innovator. We members of the development team are no different - that's why we're constantly engaging in community discussions and exploring the unknown that is the next generation of open-source web applications.

Viget Is Hiring!

Viget has job openings for Ruby Developers, Interns, and Front-End Developers. Learn More »

Recent Comments

I think that polymorphic_url(@commentable, :anchor => “comment_#{@comment.id}") should work. You can also refactor the “comment_#{@comment.id}” to a separated method, like dom_id, which returns the dom identifier of the comment.