Ruby-Doc.org: Documenting the Ruby Language
<ruby> - HTML
The HTML <ruby> element represents a ruby annotation. Ruby annotations are for showing pronunciation of East Asian characters. Attributes This element only includes the global attributes. Examples Example 1: Character <ruby> 漢 <rp>(</rp><rt>Kan</rt><rp>)</rp> 字 <rp>(</rp><rt>ji</rt><rp>)</rp></ruby> Example 2: Word <ruby> 明日 <rp>(</rp><rt>Ashita</rt><rp>)</rp></ruby> Specifications Browser compatibility Legend Full support See also Document Tags and Contributors Contributors to this page:yuheiy, anton.ingfors, teoli, sideshowbarker, houhr, Pokechu22, erikadoyle, Sebastianz, Andrew_Pfeiffer, mkato, kscarfone, alispivak, tregagnon, Sheppy, SaschaNaz, ethertank, medicdude, jswisher, avsaro
Ruby on Rails Examples
In this chapter, we will create a simple but operational online library system for holding and managing the books. This application has a basic architecture and will be built using two ActiveRecord models to describe the types of data that is stored − Books, which describes an actual listing.Subject, which is used to group books together. Workflow for Creating Rails Applications A recommended work flow for creating Rails Application is as follows − So, let us start with creating our library application. Creating an Empty Rails Web Application Rails is both a runtime web application framework and a set of helper scripts that automate many of the things you do when developing a web application. Go into ruby installation directory to create your application.Run the following command to create a skeleton for library application. tp> rails new library Most of our development work will be creating and editing files in the library/app subdirectories. Starting Web Server What is next?
Ruby | Google Cloud
Take advantage of our APIs and services using the Google Cloud Ruby Gems and test run our code samples. Upload files to Google Cloud Storage Perform data analytics using Google BigQuery Write custom log data to the Stackdriver API Analyze text with the Cloud Natural Language API Upload Files to Google Cloud Storage gem install google-cloud-storage Set up a Cloud Platform Console project Sign in to your Google account.If you don't already have one, sign up for a new account. Using Google BigQuery gem install google-cloud-bigquery Sign in to your Google account.If you don't already have one, sign up for a new account. Using Stackdriver Logging gem install google-cloud-logging Sign in to your Google account.If you don't already have one, sign up for a new account. gem install google-cloud-language Google Stackdriver provides powerful monitoring, logging, and diagnostics. Google Stackdriver Unified monitoring, logging, and diagnostics for applications on Google Cloud Platform and AWS.
Getting Started with Rails
1 Guide Assumptions This guide is designed for beginners who want to get started with a Rails application from scratch. It does not assume that you have any prior experience with Rails. Rails is a web application framework running on the Ruby programming language. If you have no prior experience with Ruby, you will find a very steep learning curve diving straight into Rails. Be aware that some resources, while still excellent, cover versions of Ruby as old as 1.6, and commonly 1.8, and will not include some syntax that you will see in day-to-day development with Rails. 2 What is Rails? Rails is a web application development framework written in the Ruby programming language. Rails is opinionated software. The Rails philosophy includes two major guiding principles: Don't Repeat Yourself: DRY is a principle of software development which states that "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system." 3 Creating a New Rails Project 9 Security
Model–view–controller
Model–view–controller (MVC) is a software pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.[1][2] The central component, the model, consists of application data, business rules, logic and functions. A view can be any output representation of information, such as a chart or a diagram. Multiple views of the same information are possible, such as a bar chart for management and a tabular view for accountants. The third part, the controller, accepts input and converts it to commands for the model or view.[3] Component interactions[edit] A typical collaboration of the MVC components In addition to dividing the application into three kinds of components, the Model–view–controller (MVC) design defines the interactions between them.[4] Use in web applications[edit] History[edit] See also[edit]
Don't repeat yourself
Applying DRY[edit] DRY vs WET solutions[edit] Violations of DRY are typically referred to as WET solutions, which is commonly taken to stand for either "write everything twice" or "we enjoy typing".[2][3] See also[edit] References[edit] External links[edit]
Convention over configuration
Convention over configuration (also known as coding by convention) is a software design paradigm which seeks to decrease the number of decisions that developers need to make, gaining simplicity, but not necessarily losing flexibility. The phrase essentially means a developer only needs to specify unconventional aspects of the application. For example, if there's a class Sale in the model, the corresponding table in the database is called “sales” by default. It is only if one deviates from this convention, such as calling the table “sale”, that one needs to write code regarding these names. When the convention implemented by the tool matches the desired behavior, it behaves as expected without having to write configuration files. Motivation[edit] Some frameworks need multiple configuration files, each with many settings. Usage[edit] The Maven software tool auto-generated this directory structure for a Java project. Many modern frameworks use a convention over configuration approach.
Active record pattern
This pattern is commonly used by object persistence tools, and in object-relational mapping (ORM). Typically, foreign key relationships will be exposed as an object instance of the appropriate type via a property. Implementations[edit] Implementations of the concept can be found in various frameworks for many programming environments. part = new Part() part.name = "Sample part" part.price = 123.45 part.save() will create a new row in the parts table with the given values, and is roughly equivalent to the SQL command INSERT INTO parts (name, price) VALUES ('Sample part', 123.45); Conversely, the class can be used to query the database: b = Part.find_first("name", "gearbox") This will find a new Part object based on the first matching row from the parts table whose name column has the value "gearbox". SELECT * FROM parts WHERE name = 'gearbox' LIMIT 1; -- MySQL or PostgreSQL ColdFusion[edit] ColdFusion has an open source implementation of the Active Record pattern. PHP[edit] Ruby[edit] Java[edit]