background preloader

Ruby on rails

Facebook Twitter

LinkedInData/linkedindata.rb at master · TransparencyToolkit/LinkedInData. Set Up Cron Jobs in Rails. Recently I came to a situation where I need to take an action based on time.

Set Up Cron Jobs in Rails

For example, a web application helps organizing an event and 48 hours before its scheduled time, it'll send out a reminder email to all attendees. It doesn't trigger by view, only time. Setting up a cron job or a delayed job can both achieve the goal. Let's look at cron job. In Rails, there are many gems available for scheduling. WheneverRufus schedulerResque schedulerClockwork Whenever Whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs. Understanding Rails model view controller (MVC)

Understanding Rails model view controller (MVC) | Codelearn Ruby on Rails Tutorial Module 1 - Lesson 5 In the last lesson - Adding pages from Rails controller - we created Pages controller with two actions - home and about.

Understanding Rails model view controller (MVC)

In this lesson, we will dive deeper into the Rails routes, Models, Views and Controller; also referred as Rails MVC architecture. Crawl & Scrap. Bienvenue - Polymer. Arantius/resurrect-pages. Rails Tutorial · Devise with RSpec and Cucumber. Devise with RSpec and Cucumber Introduction Ruby on Rails tutorial showing how to create a Rails 3.2 application using Devise with RSpec and Cucumber.

Rails Tutorial · Devise with RSpec and Cucumber

Devise provides ready-made authentication and user management. RSpec is a popular framework for unit testing. Cucumber is used for integration testing and behavior driven development. Trim white spaces from ruby string. Open Source Rails. How to reset a single table in rails? - Stack Overflow. CSCRIPT.EXE doesn't work out-of-the-box on Windows 8 Consumer Preview · Issue #81 · sstephenson/execjs · GitHub. Ruby on Rails API. Social Buttons for Bootstrap. Data Scraping and More With Ruby, Nokogiri, Sinatra and Heroku. In this article, you will learn the basics of scraping and parsing data from websites with Ruby and Nokogiri.

Data Scraping and More With Ruby, Nokogiri, Sinatra and Heroku

You will then take this information and build a sample application, first as a command line tool and then as a full Sinatra web app. Finally, you will deploy your new application on the heroku hosting platform. There is a screencast that accompanies this article. If you are interested in the process behind many of the thoughts and code in this article, watch the screencast. If you just want the facts, read the article. Data scraping is the process of extracting data from output that was originally intended for humans.

Nokogiri is a Ruby Gem that extracts data from web pages using CSS selectors. Rail Spikes: Loading seed data. At acts_as_conference next week (there’s still room to register) I’m going to be talking about challenges facing Rails teams.

Rail Spikes: Loading seed data

Today, I’d like to talk about loading your application’s seed data. Seed data? Seed data is anything that must be loaded for an application to work properly. An application needs its seed data loaded in order to run in development, test, and production. Examples include everything from an initial administrator account to small enumerations to huge amounts of data (one example of seed data given by a developer on the Ruby Users of Minnesota included every airport in the world). Seed data is mostly unchanging.

The ideal solution would be automatic: you shouldn’t have to think about it. Data Scraping and More with Ruby Nokogiri Sinatra and Heroku - YouTube. Ssl - How to connect to an https server with an invalid certificate using the latest versions of Ruby - Stack Overflow. RuntimeError on Windows trying to follow rubytutorial - Stack Overflow. Facebook OAuth using OmniAuth and Rails 4 - Hello, I'm Jim Van Fleet. I had to copy and paste in information from a variety of sources to end up with something I liked at the time of this writing.

Facebook OAuth using OmniAuth and Rails 4 - Hello, I'm Jim Van Fleet

Since I want to walk my students in Launchpad Code Academy through this process, I figured I’d make this walkthrough public. It may help newcomers for quite some time to come! About this solution We are going to be using a server-side OAuth authorization. The mechanism uses some JavaScript checks and interfaces with the JS Facebook API, but ultimately the connection is made on the server-side. You don’t necessarily have to be using Devise, but if you’re not, our tips about how to leverage this approach for Facebook login may not be helpful. With a little extra work, you can allow users that have attached their Facebook account to log in with Facebook. Getting started. Les Tableaux Ruby : Array en détails. Continuons sur la lancée programmation.

Les Tableaux Ruby : Array en détails

Après avoir fait un petit tour par QT, nous allons nous pencher sur Ruby. Rails as a Machine. ActionView. Returns a set of select tags (one for year, month, and day) pre-selected for accessing a specified date-based attribute (identified by method) on an object assigned to the template (identified by object).

ActionView

:use_month_numbers - Set to true if you want to use month numbers rather than month names (e.g. “2” instead of “February”). :use_two_digit_numbers - Set to true if you want to display two digit month and day numbers (e.g. “02” instead of “February” and “08” instead of “8”). :use_short_month - Set to true if you want to use abbreviated month names instead of full month names (e.g. “Feb” instead of “February”). :add_month_numbers - Set to true if you want to use both month numbers and month names (e.g. “2 - February” instead of “February”). If anything is passed in the html_options hash it will be applied to every select tag in the set. Ruby on Rails - Blogueur - Guillaure Barillot. Selenium is a great tool for integration testing but it has two major drawbacks : it relies on Firefox engine, so every time Firefox updates, you have to cross your finger and praise your test suite will still be usable it is f**** slow Solve those 2 problems in just a few minutes, switch to [...]

Ruby on Rails - Blogueur - Guillaure Barillot

When it came across image manipulation using Rails, I had to make a choice : Paperclip to handle high traffic/popular websites, and DragonFly for privates, more confidential but also more evolutive applications. Let’s start with an example : # Paperclip typical image URL /system/pictures/877/thumbnail/my_thumbnail_image_name.jpg?

1352719049 # DragonFly image URL /media/BAhbB1sHOgZmIjIyMDEyLzA5LzE0LzE3XzI0XzA0XzMyMl9BdXLDqWxpZV9DSEFVVkVBVS5KUEdbCDoGcDoKdGh1bWIiCjUweDUw Paperclip resizes the image on upload, then [...] C’est assez étonnant d’avoir encore ce genre de problème de nos jours, mais Ruby (même 1.9.3), ne gère toujours pas correctement les passages de caractères accentués en majuscule. Difference between form_for and form_tag helper tags in rails. September 10, 2011 JR rails form_for, form_tag, helpers, rails, scaffolding form_for helper (use for posting new resources) form_for is the helper method rails provides for you when you create a new resource using scaffolding: > rails generate scaffold Project name:string And it produces HTML that looks like this:

Difference between form_for and form_tag helper tags in rails

Ruby on rails 3 - How to reset auto increment field in a ActiveRecord migration? - Stack Overflow. Active Record loves blocks « Plataformatec Blog. I’d like to start with a question: Have you ever seen code like this? Class User < ActiveRecord::Baseend User.new.tap do |user| user.name = "John Doe" user.username = "john.doe" user.password = "john123"end I have. But what few developers know is that many methods in Active Record already accept a block, so you don't need to invoke tap in the first place. And that's all because Active Record loves blocks! Ruby on Rails API. Purchase Complete for Ruby on Rails Tutorial. Active Record Migrations — Ruby on Rails Guides.

1 Migration Overview Migrations are a convenient way to alter your database schema over time in a consistent and easy way. They use a Ruby DSL so that you don't have to write SQL by hand, allowing your schema and changes to be database independent. You can think of each migration as being a new 'version' of the database. A schema starts off with nothing in it, and each migration modifies it to add or remove tables, columns, or entries. Active Record knows how to update your schema along this timeline, bringing it from whatever point it is in the history to the latest version. Haml to eRb/HTML online converter. Building Advanced Forms. Don't forget to use Git to save your projects! Project: Flight Booker In this project, you'll get a chance to tackle some more advanced forms. This is the kind of thing you'll have to work with when handling user orders for anything more complicated than an e-book.

In this case, we'll build the first three steps of a typical checkout process for booking a one-way flight: A typical airline booking flow: Enter desired dates / airports and click "Search"Choose from among a list of eligible flightsEnter passenger information for all passengersEnter billing information Step 4 would be done via integration of something like Paypal, via a gem or an SDK or Stripe.

Your Task. Truncate table(s) with rails console - Stack Overflow. Active Record Query Interface — Ruby on Rails Guides. If you're used to using raw SQL to find database records, then you will generally find that there are better ways to carry out the same operations in Rails. Active Record insulates you from the need to use SQL in most cases. Code examples throughout this guide will refer to one or more of the following models: All of the following models use id as the primary key, unless specified otherwise. Cantino/huginn · GitHub. Rails & nested_attributes : un formulaire dynamique ?

Dans le cas d’une application ayant un objet parent qui possède un ou plusieurs objets enfants, il est possible de créer au sein du formulaire parent, les enfants qui lui sont associés. Nous allons vous présenter notre façon d’utiliser les « nested_attributes », celle-ci n’est pas forcément la meilleure et/ou la plus adaptée. Mais face au manque d’articles et de communication autour des nested, nous avons décidé de partager avec vous cette astuce. N’hésitez pas à nous communiquer vos retours via les commentaires. Prenons un exemple concret : nous avons un objet « voiture » (model) avec une liaison « has_many » sur l’objet enfant (model) « equipement ».

Jusque ici rien de plus classique que deux objets reliés entre eux. Ruby on rails - How to solve "certificate verify failed" on Windows? - Stack Overflow. Parsing HTML with Nokogiri. Nokogiri The Nokogiri gem is a fantastic library that serves virtually all of our HTML scraping needs. Once you have it installed, you will likely use it for the remainder of your web-crawling career. Download a cacert.pem for RailsInstaller.

Rails For Beginners: All You Need To Know! The ActiveRecord module is based on the concept of database abstraction. As we mentioned in Chapter 1, database abstraction is a way of coding an application so that it isn't dependent upon any one database. Code that's specific to a particular database server is hidden safely in ActiveRecord, and invoked as needed. The result is that a Rails application is not bound to any specific database server software. Should you need to change the underlying database server at a later time, no changes to your application code should be required. Examples of code that differs greatly between vendors, and which ActiveRecord abstracts, include: Before I can show you the magic of ActiveRecord in action, though, we need to do a little housekeeping.

Tables are the containers within a database that store our data in a structured manner, and they're made up of rows and columns. Ruby on Rails Cheatsheet - OWASP. Active Record Query Interface 3.0 - (m.onkey.org) Active Record Query Interface 3.0 Published about 3 years ago I’ve been working on revamping the Active Record query interface for the last few weeks ( while taking some time off in India from consulting work, before joining 37signals ), building on top of Emilio’s GSOC project of integrating ARel and ActiveRecord. Techlahoma - Multiple Authentications (Part 2) @ OctoLabs. ASCIIcasts - “Episode 236 - OmniAuth Part 2” (view original Railscast) Sleepycat/capoeiraottawa.ca · GitHub. Splendeo/activerecord-reset-pk-sequence · GitHub.

Coderwall.com : establishing geek cred since 1305712800. In this article I'm going to teach you how to authenticate your users easily using Facebook. This means a much easier sign up process for your users and you no longer have the responsibility of securing passwords. Coderwall.com : establishing geek cred since 1305712800. Authentification avec OmniAuth - Syrinxoon Tuts. OmniAuth est un framework d'authentification développé en Ruby. L'objectif d'OmniAuth est de fournir une interface standard pour l'authentification à l'aide de plusieurs services tiers tels que Facebook, Twitter ou OpenID.

Il est également possible depuis peu d'authentifier les utilisateurs via un couple login / mot de passe classique. #241 Simple OmniAuth - RailsCasts. The sqlite3 command line tool. In this part of the SQLite tutorial, we cover the sqlite3 command line tool. Quelle techno pour faire du web scraping ? - Sans catégorie - Human Coders Forum. En Ruby j'utilise le Nokogiri5 gem, très efficace.Lorsque la structure du site est complexe j'utilise l'extension Chrome de Kimono6 pour identifier les common patterns/css selectors qui m'intéressent. Ch4nd4n/sinatra_omniauth_demo · GitHub. Hébergement Ruby on Rails France - Mutualisé et dédié - Webpulser. Offres d’hébergement Ruby on Rails.

Ruby on Rails est un Framework basé sur le langage de programmation Ruby. Il est spécialement conçu pour des développements rapides et articulés sur la méthodologie Agile. Le principe de Ruby est de privilégier les conventions plutôt que les configurations. De plus en plus utilisé dans la création de sites internet et d’applications web, l’utilisation de Ruby on Rails implique un hébergement plus spécifiques et disposant entre autres des librairies Ruby. Handyman.com The #1 Source to find a Local, Professional, Licensed, Screened Handyman. Spec file for authentications controller used in OmniAuth integration. Rails Rumble - Separating Authentication and Identity with OmniAuth. Intridea/authbuttons · GitHub. ASCIIcasts - “Episode 304 - OmniAuth Identity” We Turn Likes Into Love.