Skip to main content

Posts

Showing posts with the label ruby on rails functionality

Instagram API Integration to get Instagram feed to your website

To integrate the Instagram API in your website, you need you have to follow following process Log in to Instagram and open this page https://instagram.com/developer/clients/manage Click on the button «Register a New Client». Then Fill all the Mandatory fields, in Valid Redirect URIs specify your valid redirected URI and click «Register». Then click «Manage» button to obtain both Client ID and Client Secret of your just registered app. Use the Client ID and Client Secret to generate access token with this link https://rudrastyh.com/tools/access-token . You can find more info there as well. A Short Introduction about sandbox mode All newly created apps start in Sandbox Mode Apps in Sandbox mode have access only to 20 latest media of an access token owner (and sandbox users invited to your app). To avoid these restrictions you should send your app to approval. We can get instagram feed in our website by two ways By User ID By a Username How can...

Filterrific - Rails Plugin for search, sort & filter data

What is filterrific? 'filterrific' gem is used for filtering the data only. It is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists. Ruby On Rails Gem Filterrific Features of filterrific gem: It Integrates with pagination Filters can be reset to default settings Makes heavy use of ActiveRecord Scopes API option to use Filterrific with Rails API mode. Just use gem 'filterrific', require: 'filterrific_api' in your Gemfile ActionController helpers to shuttle filter params from ActionView forms to ActiveRecord based models, and to return matching records back from ActiveRecord to ActionView It depends on ActiveRecord scopes for building DB queries Can be used for HTML/JS/JSON/XML response formats It is used to run filter settings from a filter UI to the controller and ActiveRecord It persists filter settings in the HTTP session or DB for saved searches Dependencies: Rails - 3.x and a...

Simple way to document API in Ruby on Rails using swagger document

After creating REST API, it’s important that API should be documented, so the others can use the documentation and understand the requirement and implementation of API. Swagger documentation provides the interface to REST APIs which allows people and system to understand the API without access to source code. Use ‘swagger-docs’ gem to document the API. This will generate swagger-ui json files for rails apps with APIs specification that can be used by person to know about the APIs. To start create swagger_docs.rb file in config/initializers and define your APIs as below: Swagger::Docs::Config.register_apis({ "1.0" => { :api_extension_type =>:json, # path for .json files :api_file_path =>"public", :base_path =>"http://api.somedomain.com", :clean_directory =>false, :attributes => { :info => { "title" =>"Swagger Sample App", } } } }) Swagger document contain the json controller which has ...

How to create Drag and Drop functionality in Ruby On Rails?

I have seen many developers that are looking for creating "Drag and Drop" functionality in Ruby On Rails technology. So I'm going to brief about a sample to create and implement this functionality using JQuery Rails, JQuery UI Rails and Rails Sortable gems. Given below are simple steps required to create the rails application: Ruby On Rails Programming How to create Drag and Drop functionality in Ruby on Rails? First of all we will create a simple application first to create the products. The first Step we required to create the Rails Application. $ rails new SampleSortRails By using the scaffold we will generate the the MVC components needed for Simple Products application form $ cd SampleSortRails $ rails g scaffold Product name:string description:text quantity:integer price:integer sort:integer Create the Products database table: $ rake db:create $ rake db:migrate Rails uses rake commands to run migrations. Migrations are Ruby clas...