Wednesday, December 2, 2015

How to add dynamic text to Rails applications

How can you change your application from this...
To this?
It's simple! Just use embedded ruby!

EDIT: Thanks to Action Dan for some feedback that picks into the niche differences of web application frameworks.

Bear in mind this is a Rails specific post, but I will say that for purposes of building larger applications, the ability to organize and refactor code begins to become a problem



Rails also offers uniform ways to add and remove helper functions through package management, so I'm actually using the current_user function generated by adding the Clearance gem to my project. 

The simple markup syntax is one small reason people like using Ruby on Rails to develop web applications.

Using a helper function (that I didn't even have to write) are two "behind the scenes" benefits of using Rails to develop.

If your confused about the current_user helper I'm using, read more here.

Program on!

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. "The simple markup syntax is one small reason people like using Ruby on Rails to develop web applications."

    I don't really see how this is a differentiation, how is this different than any other web application language?

    Such as PHP: " < ? = $data ? > "
    or Embeded Javascript: "<%= current_user.name %>"

    ReplyDelete
    Replies
    1. Bear in mind this is a Rails specific post, but I will say that for purposes of building larger applications, the ability to organize and refactor the code begins to become a problem. Rails also offers uniform ways to add and remove helper functions through package management, so I'm actually using the current_user function generated by adding the Clearance gem to my project. Using a helper function that I didn't even have to write are the two "what you don't see" aspects of Ruby I personally like. I'll add this to the post, thanks Dan!

      Delete