background preloader

RoR

Facebook Twitter

A Retrospective on Ruby in 2015. This article was peer reviewed by Thom Parkin and Fred Heath. Thanks to all of SitePoint’s peer reviewers for making SitePoint content the best it can be! We’ve come to the end of 2015, which was a big year in Ruby. I thought it’d be a hoot to go back and look at some of the epics (major themes) of the year and the stories that comprised them. Kind of like a Agile process retrospective where I’m treating 2015 as a set of sprints and seeing how we did. In order to play out this contrived idea all the way, I will need to define the epics. I’d say that, almost every year, Ruby has the following major areas/epics/whatever where the community needs to be productive in order to consider that sprint/year a success: Improve the languageGrow the communityKeep up with the rest of the programming world Those are the epics I’ve defined.

Finally, any retrospective worth its weight in gems needs to look at what didn’t work. Improve the Language Ruby Battle of the Year Rails Off the Rails Grow the Community. Emphasized Insanity - Creating a Rails authentication system on Mongoid - Part 1. Preface A few days ago we started our first real all-MongoDB project at Nautilus6. Up until now we used Mongo only on small time projects, ones that hardly required any data storage at all so this is practically the first real project that we will try (and hopefully succeed) to deploy with Mongo as the data layer. Since we use Rails on this project (Duh) we had to choose between the existing MongoDB adapters for rails: MongoMapper – Which is pretty slick, has some plugin support but also replicates some of the familiar ActiveRecord functionality like: Dirty Attributes, Dynamic finders and magic timestamp attributes.

Mongoid – the new child, missing some features from MM (dirty attributes, dynamic finders for example) but does cover some ActiveRecord wonders MM doesn’t: Versioning, named scopes and better validation options. MongoId also supports a master/slave infrastructure which might be useful. We decided to go with Mongoid due to the fact that i kind of like the code base better. Yay! Remove startup-script with update-rc.d « firmit – FOSS notes. Create a mailer in Rails 4 | IntelligentBee Tech Blog. Hello party people and polar bears! You were probably wondering how it is you send email using Ruby on Rails.

Here’s how you create an automated email system that sends a confirmation email to each new user that registers to your app: 1. First off, in bash, you must generate your mailer, which uses the Rails generate command (pretty much the same way you generate a controller or a model). Cd ~/my_rails_project rails generate mailer welcome_mailer bundle install 2. This is how your setup_mail.rb file should look like: /config/initializers/setup_mail.rb 3. We do that by creating a method in the recently created mailer, which we’ll name registration_confirmation: /app/mailers/welcome_mailer.rb class WelcomeMailer < ActionMailer::Base def registration_confirmation(user) mail :to => user, :from => "email@domain.com", :subject => "Subject line" end end 4.

Hello, <%= @user.name %> Thank you for registering! WelcomeMailer.registration_confirmation(@user).deliver. Css2sass | Convert CSS Snippets to Syntactically Awesome StyleSheets code. Js2coffee: convert JavaScript code to CoffeeScript. GET and POST Parameter parsing in Rails. Rails gives a developer a lot of support, but it isn’t always clear exactly what’s going on under the covers. One area where I’ve had a bit of frustration is trying to understand exactly what Rails is doing for me when it parses my querystring. Somehow it knows that the querystring cart[items][]=5&cart[items][]=6 should result in an object that looks like: { "cart" => { "items" => [ "5", "6" ] } }.

I did some digging, and it looks like Rails uses Rack::Utils’ parse_nested_query helper. Their documentation is somewhat less comprehensive than I’d hoped, so I experimented a bit to figure out what’s going on. Below are a few examples of what I discovered. I’ve broken the query strings onto multiple lines simply for readability. Simple Input If your fields are named without any brackets, Rails will assume you don’t have any fancy nested data structure. Querystring: Parsed data structure: Attributes of an Object Using square brackets to name attributes, you can nest attributes inside an object:

List of Strategies · intridea/omniauth Wiki. This is a list of the strategies that are available for OmniAuth version 1.0 and later. Visit the linked website for additional information about the individual strategies. If you have implemented a strategy and would like to link to it here, feel free! Provider Strategies These providers are meant to be used directly by developers to authenticate to various services. Official designates that the strategy is maintained by developers of the service itself. Please keep the list in alphabetical order. Developer Strategies These strategies are meant to be used by people building their own strategies to easily leverage open standards or other common authentication systems.

Requested Strategies Would you like to see a provider supported that isn't yet? Rubular: a Ruby regular expression editor and tester. Ruby on Rails Cheat Sheet. A quick reference guide for Ruby on Rails, containing the default directory structure, predefined variables, methods, reserved words and regular expression syntax. The Ruby On Rails cheat sheet is designed to be printed on an A4 sheet of paper and live by a developers desk, to make life a bit easier. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size Ruby On Rails cheat sheet. I am no expert in Ruby, On Rails or off, so to ensure this cheat sheet was as useful as possible, I pestered the very helpful Amy Hoy of (24)Slash7 and David Heinemeier Hansson of Loud Thinking into giving me a hand.

Thanks, both of you - I appreciate it. Default Directory Structure Ruby on Rails by default uses a rather large selection of folders and files, organised into a directory structure. Pre-Defined Variables Ruby on Rails, like most languages, includes a large number of predefined variables. Reserved Words Regular Expression Syntax Methods Download. Ruby on Rails Guides: 레일즈 시작하기. 이 가이드는 레일즈 3.0에 기초합니다. 기존 버전의 레일즈에서는 이 문서의 코드가 동작하지 않을 수 있습니다. 1 이 가이드를 시작하기 위해서 이 가이드는 레일즈 어플리케이션을 처음으로 시작하는 초보자 분들을 위해 구성되어 있습니다. 이 문서는 레일즈 경험이 전혀 없다고 가정합니다. 루비 언어 버전 1.8.7 이상 루비 버전 1.8.7 p248 과 p249 는 레일즈 3.0을 중단 시키는 마샬링 버그를 포함하고 있습니다. 레일즈는 루비 프로그램 언어에서 동작하는 웹 어플리케이션 프레임워크 입니다. 2 레일즈란 무엇인가? 레일즈는 루비 언어로 작성된 웹 어플리케이션 프레임워크 입니다. 레일즈는 주장이 확실한 소프트웨어 입니다. 레일즈의 철학은 몇 가지 원칙을 포함합니다. DRY – “Don’t Repeat Yourself (반복하지 말 것)” – 이 원칙은 ‘같은 코드가 존재한다면 그것은 나쁜 것’을 의미합니다. 2.1 MVC 아키텍쳐 레일즈의 중심에는 MVC 라고 불리는 모델, 뷰, 컨트롤러 아키텍쳐가 있습니다.

유저 인터페이스와 비지니스 로직 분리 DRY 유지 편이성 더 쉬운 유지보스를 위한 코드 관리 편이성 2.1.1 모델(Models) 모델은 어플리케이션의 정보(data)와 데이터를 다루는 규칙들을 의미합니다. 2.1.2 뷰(Views) 뷰는 어플리케이션의 유저 인터페이스를 의미합니다. 2.1.3 컨트롤러(Controllers) 컨트롤러는 모델과 뷰를 "연결"하는 역할을 합니다. 2.2 레일즈의 컴포넌트 레일즈는 많은 개발 컴포넌트와 함께 제공됩니다. Action Pack Action Controller Action Dispatch Action View Action Mailer Active Model Active Record Active Resource Active Support Railties 2.2.1 액션 팩(Action Pack) 액션 팩은 액션 컨트롤러과 액션 뷰를 포함하는 젬입니다. 2.2.2 액션 컨트롤러(Action Controller) 3.1 레일즈 설치하기. ROR Lab. Wordstory. How to Install Ruby on Rails on Ubuntu 12.04 LTS (Precise Pangolin) with RVM. About Ruby on Rails Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications. Ruby on Rails does take a little while to install on a virtual server, but luckily there are a lot of helpful tools to make this process as easy as possible.

You can run this tutorial on your droplet as a user with sudo privileges. You can check out how to set that up here: Ubuntu Server Setup Step One— Install Ruby with RVM Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date: sudo apt-get update Once that's done, we can start installing RVM, Ruby Version Manager.

If you do not have curl on your system, you can start by installing it: sudo apt-get install curl To install RVM, open terminal and type in this command: \curl -L | bash -s stable After it is done installing, load RVM. Source ~/.rvm/scripts/rvm rvm requirements Step Two—Install Ruby See More. Ruby on Rails Tutorial: Learn Rails by Example book and screencasts by Michael Hartl.

Ruby on Rails Screencasts - RailsCasts.