In set_phone_attributes method, we are setting up the phone attributes mainly
sanitizing phone number and generating unique phone verification code. In
send_sms_for_phone_verification method, we send SMS to the user. Creation of
SMS for the phone verification message is handled in PhoneVerificationService
class.

But to make it work, we need our Rails app on the public internet. There are two
options for this:

Deploy Rails app to your VPS or PaaS of choice.

Use a tunneling service to take the server running on your development machine and
make it available at an address on the public internet.

I’m going to use Ngrok tunneling service for the purpose of this blog.
You can check this blog
for more about its usage.

Step 5: Create phone verification controller

We need one more controller, which will handle phone verification when request
comes from Twilio. When a user replies back with a verification code, it will
trigger request URL through Twilio API. To handle that request, let’s add phone
verifications controller.

In this controller, we added skip_before_action :verify_authenticity_token,
this is because we need to allow twilio request in our Rails app which is
actually an outside request (e.g. not secured request). This means we have
disabled CSRF detection for this controller.

Now look at the verify_from_message method, in this method we take phone verification
code and phone number from params hash. Using those data, we find the user from the database.
Once we get the user, then we mark user’s phone number as a verified phone number.

Finally we are set to send business level text messages to the verified phone number.

This blog
has more infomation
about how to make secure twilio requests.

BigBinary’s blog
is powered by jekyll.
In every blog we display author’s name,
author’s twitter handle,
author’s github id
and
author’s avatar.
In this blog
I’m going to discuss
how we collect all that information
in a simple manner.

We create a directory called _data
in the root folder.
This directory has a single file called authors.yml
which in our case looks like this.

Short summary

In year 2014
we presented at
following 8 conferences
across 6 countries.

RubyConf Goa, India

RubyConf Philippines

RedDotRubyConf Singapore

DeccanRubyConf Pune, India

Madion+Ruby Wisconsin, USA

RubyConf Brazil

RubyKaigi Tokyo, Japan

Golden Gate Ruby Conference San Francisco, USA

Rails and Ruby Conferences

At the start of our travel, we visited RubyConfIndia 2014.
The conference took place at an amazing beach resort in Goa. The two days of conference
were full of fun and interactions with the best ruby people around India. During the
conference our team announced launch of Ruby India to help
spread ideas and experiments from the Ruby Indian Community, as well as highlight
content from people.

Back in Pune, we hosted the first ever DeccanRubyConf.
Our team was busy working on tasks right from building the website, inviting speakers,
planning, and other arrangements. The conference had good talks and some really useful workshops.
it was a fun one day conference, with attendance of over 170+ people.

The conference also saw our team announce the launch of RubyIndia Podcast,
which does regular podcast interviews with notable people from the Ruby Community and
Indian Community.

Prathamesh and I, then left on around a one and a half month
travel, to attend and speak at multiple conferences.

We started with Madison+Ruby, in Madison, WI. After several
missed flights, and a storm, we visited our first US conference after a travel of 48
hours. MadisonRuby was a conference like no other. Several topics touched the humane
side of Ruby and the community. We spoke on ‘Building an own ORM using ARel’. Set in the
cultural town of Madison, we immensely enjoyed the cheese-curds, farmers markets and game night
arranged by the Conf team. A huge thanks to Jim and
Jennifer Remsik,
for hosting such an amazing event. Thanks also to Scott Ruttencutter
for giving us space to work from his office and giving us a tour of the state capital.

2014, was an amazing year for our team. Together we presented or were part of 8 conferences,
launched RubyIndia Newsletter as well as the RubyIndia Podcast, started with 6 new video
series on topics from ReactJS to
Rubymotion to
Selenium, published numerous blogs,
and contributed to a number of OpenSource projects.

2015, starts with our team presenting at GardenCityRuby Conf.
We hope to get more such chances to interact and help out the community. Onwards to a new year!

Rails 4.1 introduced JSONserialization for cookies. Earlier
all the cookies were serialized using Marshal library of Ruby. The
marshalling of cookies can be
unsafe
because of the possibility of remote code execution vulnerability. So
the change to :json is welcoming.

The new applications created with Rails 4.1 or 4.2 have :json as the default
cookies serializer.

rake rails:update used for upgrading existing Rails apps to new versions rightly changes the
serializer to :json.

Rails.application.config.action_dispatch.cookies_serializer=:json

Deserialization error

However that change can introduce an issue in the application.

Consider a scenario where the cookies are being used for session
storage. Like many normal Rails apps, the current_user_id is being stored into the session.

So the deserialization of the existing cookies will fail and users will start getting errors.

Hybrid comes to rescue

To prevent this Rails provides with a hybrid serializer. The
hybrid serializer deserializes marshalled cookies and stores
them in JSON format for the next use. All the new cookies will be
serialized in the JSON format. This gives happy path for migrating
existing marshaled cookies to new Rails versions like 4.1 and 4.2.

To use this hybrid serializer, set cookies_serializer config as
:hybrid as follows:

Rails.application.config.action_dispatch.cookies_serializer=:hybrid

After this, all the existing marshalled cookies will be migrated to :json
format properly and in the future upgrade of Rails, you can
safely change the config from :hybrid to :json which is the
default and safe value of this config.

The second edition of RailsGirls Pune event was an amazing day spent
with some equally amazing folks. The event took place on 13th of December and it saw a huge turnout
of around 150+ women from various colleges and companies. It was a free event for beginners interested in learning about coding and
building applications using Ruby on Rails.

BigBinary team reached the venue, ThoughtWorks office, Pune, at about 8.30 AM.
Rajashree did the introductions and Gautam Rege, and I did the kick off. Gautam introduced Ruby,
along with how magical Ruby is and the importance of the event. I spent some time explaining how RailsGirls
began, as well as Rails Bridge and other similar events.

Next all instructors were grouped together. Grouping was done in
such a way that advanced instructors were paired with intermediate and beginner
instructors.

The talented folks from ThoughtWorks had created a fun movie explaining the three different tracks - beginner,
intermediate and advanced into which the students were divided.

I, Prathamesh and Richa Trivedi took to one of the advanced track
groups. We started off by pairing people to work with their partner and did a health check of everyones' system.
Many of the participants in our group had 1-2 years of professional experience in Java, .Net and so forth. This meant they
were quite familiar with setting up various things on their machine and that was a great help.
We started with basics of ruby- variables, loops, blocks, each, methods, classes, etc. This took
about 2 hours and then we started with Rails and MVC.

Santosh paired with Dinesh and participated
in intermediate track of a group of four students. They started with basics of Ruby and later started to build simple
blog app using Rails and deployed apps to Heroku by the end of the day.

At about 11.30, Siddhant Chothe from TechVision, did an inspiring talk
about Web Accessibility, Wiable gem,
and his journey in Ruby & Rails world.

Then We did the Bentobox activity. Participants were handed a page listing various aspects of software development like infrastructure, frontend,
application, storage in boxes. We read out technologies like XML, JSON, AJAX, MongoDB, etc, and asked
everyone to write these on stickies and place them in appropriate boxes on the “Bentobox”. This was helpful
for the participants to understand what different technologies are related to web-development and where
they are used.

Then everyone broke out for lunch. Our enthusiastic lot stayed back to avoid the rush, and began
with Rails development. We started by explaining basic MVC concepts and how Rails helps as a framework.
We started with a simple App, and created “pages/home” static home page. This helped our group
to understand rails generators, routes, controllers and views. With our first page up and running, we
went for lunch.

After lunch, a session on Origami was conducted by Nima Mankar. It was a good stress buster after
all of the first session’s bombardment over the participants.

Our next objective was to build an app and deploy it to heroku. Our group started out to build “The
Cat App”! We began with explaining controllers, CRUD operations, parts of URL, REST, etc.
We created a Cat model, and everyone loved the beauty and simplicity of migrations and performing
create, update, delete, find using ActiveRecord. We quickly moved on to building CatsController and
CRUD operations on the same. We made sure we did not use scaffold, so as to explain the underlying
magic, instead of scaffold hiding it away.

Soon everyone had a functional App, and it was fun to introduce GorbyPuff as the star of our App,
whose images were displayed as cat records, which store name of the image and url to an image.

We then setup the Apps on heroku and were ready for the next part- Showcase. It was amazing to see
so many groups complete the Apps and come up with fun, interesting and quirky ideas.
One student created Boyfriend Expense (Kharcha) Management App.

The day ended on a high note amid high enthusiasm from all the participants. We finished the workshop
with a huge cake for everyone.

Overall, it was well-organized, fun, enthusiastic and a day well spent.

Thanks to Rajshree, Shifa, Pooja,
Dominika and Magdalena for organizing such an awesome event.
Both Pune edition events, have shown great interest, and it has left us all looking forward
for the next one!