-
Day 1
ROR Introduction Lessons
-
1Ruby on Rails is an extremely productive web application framework written in Ruby by David Heinemeier Hansson. This tutorial gives you a complete understanding on Ruby on Rails. What is Ruby? Befor
-
2Most of the work in this tutorial will happen in the app folder, but here's a basic rundown on the function of each of the files and folders that Rails created by default: File/Folder Purpose
-
3The Hypertext Transfer Protocol specifies how a client machine requests information or actions from servers. This protocol specifies how two machines share information, which is called a request. Thes
-
4
-
51.Write a sample ruby code and print your name. 2.Build code using yield and insert html contents. 3.Do a sample http request and print the response.
-
-
Day 2
ROR Installation
-
1Follow the steps given below for installing Ruby on Rails. Step 1: Check Ruby Version First, check if you already have Ruby installed. Open the command prompt and type ruby -v. If Ruby responds,
-
2Prepare Your System You’ll need to prepare your computer with the required system software before installing Ruby on Rails. You’ll need superuser (root) access to update the system software.
-
3Terminal Commands Create a directory: mkdir [directory_name] Create a new rails application: rails new treebook Start the rails server: rails server Stop the rails server: Mac: ctrl+c W
-
41.Install rails on linux. 2.Create a sample application with sqlite . 3.Run the application on browser.
-
-
Day 3
Rails Application with mysql
-
1Ruby on Rails uses sqlite3 as its default database, which works great in many cases, but may not be sufficient for your application. If your application requires the scalability, centralization, and c
-
2A controller's purpose is to receive specific requests for the application. Routing decides which controller receives which requests. Often, there is more than one route to each controller, and differ
-
3Bundle install bundle-install Install the dependencies specified in your Gemfile bundle install [--binstubs[=DIRECTORY]] [--clean] [--full-index]
-
41.Create application using mysql and connect to database. 2.Create application home page 3.Install,update and uninstall gems.
-
-
Day 4
Rails Forms and form tags
-
1To create a form within this template, you will use a form builder. The primary form builder for Rails is provided by a helper method called form_for. To use this method, add this code into app/views/
-
2The most basic form helper is form_tag. [embed]https://gist.github.com/ramyajanarthanan/5f163ea0bbfee731c1ecbce60eeac036[/embed] When called without arguments like this, it creates a <form>
-
3From the controller's point of view, there are three ways to create an HTTP response: Call render to create a full response to send back to the browser Call redirect_to to send an HTTP redirec
-
41.Create a form using form_for and store the results to database 2.Create form using form_tag and store results to database. 3.Render action and json.
-
-
Day 5
Model ,migrations and Layouts
-
1Models in Rails are singular and the corresponding database table should be plural. For example Model name: Article Database table name: Articles Rails has a generator for creating models, whic
-
2Once you have created your migration using one of the generators it's time to get to work! 1 Creating a Table The create_table method is one of the most fundamental, but most of the time, will be ge
-
3To find the current layout, Rails first looks for a file in app/views/layouts with the same base name as the controller. For example, rendering actions from the PhotosController class will use app/vie
-
41.Create a model and add column through migration 2.Alter and remove columns of table. 3.Rollback the migration 4.Make the controller to work with specific layout file.
-
-
Day 6
CRUD and Partials
-
1CRUD: Reading and Writing Data CRUD is an acronym for the four verbs we use to operate on data: Create, Read, Update and Delete. Active Record automatically creates methods to allow an application
-
2Partial templates - usually just called "partials" - are another device for breaking the rendering process into more manageable chunks. With a partial, you can move the code for rendering a particular
-
31.Create and show the records from database. 2.Edit,update and delete records 3.Render a partial file and display the contents.
-
-
Day 7
Validations and its helpers
-
1Why Use Validations? Validations are used to ensure that only valid data is saved into your database. For example, it may be important to your application to ensure that every user provides a valid e
-
2Active Record offers many pre-defined validation helpers that you can use directly inside your class definitions. These helpers provide common validation rules. Every time a validation fails, an error
-
3Retrieving Objects from the Database To retrieve objects from the database, Active Record provides several finder methods. Each finder method allows you to pass arguments into it to perform certain
-
4
-
51.Validate the presence of name,email. 2.Validate the format of email 3.Get first and last 3 records from database 4.Print all records of database. 5.get unique records and Order records o
-
-
Day 8
RA DB Schema and scopes
-
1What are Schema Files for? Migrations, mighty as they may be, are not the authoritative source for your database schema. That role falls to either db/schema.rb or an SQL file which Active Record gene
-
2Limit and Offset To apply LIMIT to the SQL fired by the Model.find, you can specify the LIMIT using limit and offset methods on the relation. You can use limit to specify the number of records to
-
3For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called first_name on your Client model for example, you get find_by_f
-
41.Fetch 10 records using limit 2.Fetch records from 10 to 20. 3.Get all active records ids from database. 4.Get specific column records from database.
-
-
Day 9
Relations and Associations
-
1In Rails, an association is a connection between two Active Record models. Why do we need associations between models? Because they make common operations simpler and easier in your code. 2 The Types
-
2Active Record provides two finder methods for specifying JOIN clauses on the resulting SQL: joins and left_outer_joins. While joins should be used for INNER JOIN or custom queries, left_outer_joins is
-
3Eager Loading Multiple Associations Active Record lets you eager load any number of associations with a single Model.find call by using an array, hash, or a nested hash of array/hash with the include
-
41.User and mutiple skills.Build association. 2.Join two tables and fetch records 3.Join tables,fetch records based on conditions.
-
-
Day 10
Errors and Callbacks
-
1If you’re building a Rails application, you’ve probably heard of the asset pipeline. The asset pipeline can be thought of as the tools and mechanisms by which Javascript files, stylesheets, and im
-
2After Active Record has performed validations, any errors found can be accessed through the errors.messages instance method, which returns a collection of errors. By definition, an object is valid if
-
3Here is a list with all the available Active Record callbacks, listed in the same order in which they will get called during the respective operations: 1 Creating an Object before_validation
-
41.Add style sheets and java scripts using asset helpers and precompile assets. 2.Display errors on save. 3.Write call back before create and after update.
-
-
Day 11
Devise Configurations and Active Admin
-
1Devise 4.0 works with Rails 4.1 onwards. You can add it to your Gemfile with: gem 'devise' Then run bundle install Next, you need to run the generator: $ rails generate devise:install At this p
-
2The Devise method in your models also accepts some options to configure its modules. For example, you can choose the cost of the hashing algorithm with: devise :database_authenticatable, :registera
-
3Active Admin is a framework for creating administration style interfaces. It abstracts common business application patterns to make it simple for developers to implement beautiful and elegant interfac
-
41.Install devise and configure routes. 2.Generate views and controllers 3.Install active admin and save records using active admin.
-
-
Day 12
User Authentication and configuration
-
1Password-protected actions are a common feature in most web applications, only allowing registered users in with a valid password. This is called “User Authentication”, and many Rails applications
-
2Next, let’s write the new and create actions in the UsersController. https://gist.github.com/ramyajanarthanan/e83675f36bf091c5b085f315645ac497 We’ve created two main actions:
-
3Adding Some Validations to the User Model In addition to attr_accessors, we need to add some validation rules to make sure that the input data fits our requirements. class User < ActiveRecord::Ba
-
41.Set up users table on database 2. Register users with roles. 3.Login users and validate. 4.Paginate records using kaminari gem
-
-
Day 13
Image and file Uploads
-
1In Rails, add it to your Gemfile: gem 'carrierwave', '~> 1.0' Finally, restart the server to apply the changes. Start off by generating an uploader: rails generate uploader Avatar this shoul
-
2CarrierWave also has convenient support for multiple file upload fields. ActiveRecord Add a column which can store an array. This could be an array column or a JSON column for example. Your choice d
-
3Create versions from existing versions For performance reasons, it is often useful to create versions from existing ones instead of using the original file. If your uploader generates several version
-
41.Install carrierwave gem and create uploader 2.Upload image and file. 3.Show,Edit and delete the uploaded files.
-
-
Day 14
Ajax with rails
-
1AJAX = Asynchronous JavaScript And XML. AJAX is not a programming language. AJAX just uses a combination of: A browser built-in XMLHttpRequest object (to request data from a web server)
-
2AJAX is an important part of many Rails applications. It allows for making client-side changes without the need to reload the page. In this tutorial, you’ll see a very simple example of how to send
-
3We’re still in the todos controller create action, and we’re now able to instantiate new todos using the nicely structured params that we sent via Ajax. Currently, after creating the new Todo, we
-
41.Submit form using ajax 2.Save form details using remote: true 3.Create response as html and xml.
-
-
Day 15
Mailer,Session and Crons
-
1Action Mailer allows you to send emails from your application using mailer classes and views. Mailers work very similarly to controllers. They inherit from ActionMailer::Base and live in app/mailers,
-
2HTTP is a stateless protocol. Sessions make it stateful. Most applications need to keep track of certain state of a particular user. This could be the contents of a shopping basket or the user id o
-
3Cron is a time-based job scheduler in Unix-like computer operating systems. It can be used to schedule jobs to run periodically at fixed times, dates, or intervals. Cron is most suitable for schedulin
-
41.Create mailer and send welcome email on registration. 2.Set user_id as session and retrieve the session value. 3.Write a cron to be executed every Saturday.
-
-
Day 16
Lesosn 1 - Search Module
-
1This is an easy tutorial for implementing a keyword search form in a Rails app. Often found in a website's navbar, the search form enhances usability and gives a website or app a more polished feel.
-
2
-
-
Day 17
Lesson 1 - Introduction to Web Socket
-
1What are WebSockets? Wikipedia provides a meaty summary: "WebSocket is a protocol providing full-duplex communication channels over a single TCP connection." Let's chew through this in pieces.
-
2
-
-
Day 18
Lesson 1 - Timer in Ruby on Rails
-
1Rails provides great tools for working with time zones but there’s still a lot of things that can go wrong. This blog post aims to shed some light on these gotchas and provide solutions to the most
-
2
-
-
Day 19
Lesson 1 - Bidding Introduction
-
1Ajax stands for Asynchronous JavaScript and XML. Ajax is not a single technology; it is a suite of several technologies. Ajax incorporates the following − XHTML for the markup of web pages C
-
2
-
-
Day 20
lesson 1 - Bidding module
-
1You may have a requirement in which you want your site visitors to upload a file on your server. Rails makes it very easy to handle this requirement. Now we will proceed with a simple and small Rails
-
2
-
-
Day 21
Lesson 1 - Payment Introduction
-
1Working with APIs is awesome and frustrating at the same time. On the one hand, interfacing with other applications out there can greatly improve the reach and "cool factor" of your own app. On the ot
-
2It's pretty easy to turn your application into an API, but what about grabbing data from other APIs across the internet? That's where things usually get a bit more challenging because they're all diff
-
3
-
-
Day 22
lesson 1 - Introduction to OmniAuth2
-
1OAuth 2 is an authorization protocol that enables a third-party applications to obtain limited access to an HTTP service. One of the main aspects of this protocol is the access token that is issued to
-
2Authentication Via Twitter Adding a Strategy Let’s use the omniauth-twitter gem created by Arun Agrawal. It is one of the numerous strategies for OmniAuth. Drop it in the Gemfile: Gemfile [...
-
3
-
-
Day 23
Lesosn 1 - Payment workflow in RA
-
1As an example we will have an imaginary “Cookery School” application to sell online cooking courses. For this tutorial, we will work on the checkout branch, to use Stripe Checkout to process payme
-
2
-
-
Day 24
Lesson 1 - Types of Payment
-
1As an example we will have an imaginary “Cookery School” application to sell online cooking courses. You can check it out here: 1 2 3 4 5 6 git clone https://github.com/
-
2
-
-
Day 25
Lesson 1- Intregate a given Payment Gateway
-
1The controller’s jobs include: work with the request parameters determine how to activate the domain logic and data respond to requests The parameters give the controller the informati
-
2
-