Rashmi Yadav


Rails Routing Constraints

Routing is backbone of a web applications. When we are building applications using Rails we can manage routing for our app easily. I am going to explain a bit advance feature of routing in Rails

What is routing constraints

Few many times we require routes to behave differently and also want to do some routing based on specific conditions.

For example

  • Constraint routes for http methods( put, post )

  • Want to show different home page for different users.

  • Want to restrict URL for some sub domain or range of IP addresses

We can easily constraints our routes in Rails

How many ways we can constraint our routes

Segment Constraints(Parameter Restriction)

You can filter any parameter based on Regular expression

Read on →

jQuery attr(‘value’) and val()

Here is a short tip about using $(obj).val() and $(obj).attr(‘value’). I was fixing a bug in ajax request with some params then i found that there is a difference val() method and attr(‘value’) I never faced this problem before. I thought to share this with you guys.

Read on →

Rails 4 Directory Structure

Rails 4 is released. Lots of new features has been added to rails. Here we will see what new directories have been added.

We will create a sample app in rails 4 so that it will be easy to see the new structure. I am assuming you have updated your rails. To check current version of rails run following command:

rails -v

It should be Rails 4.0.0

Read on →

Enhance Rails Models

In Rails Models play a important part in our Rails App.We should keep are model pretty,not having dirty code Here i am just reminding you some basic points to refactor a model.

Read on →

Background Processing Using Rails Runner

Rails comes with a built-in tool for running tasks independent of the web cycle. The rails runner command simply loads the default Rails environment and then executes some specified Ruby code.

Read on →