text:
Ruby on Rails/Built-In Rails Tools/Generators

Introduction
Rails comes with a number of generators which are used to create stub files for models, controllers, views, unit tests, migrations and more. Generators are accessed through the command-line script RAILS_ROOT/script/generate

All commands look like rails generate generator generator-options

To see what options are available, just enter rails generate and Rails will show you all available options and what generators are currently installed. By default, you can choose from the different generators. The most important are:

 * controller
 * helper
 * mailer
 * migration
 * model
 * scaffold

If you want more information on different generators, simply enter the generator commend e.g. "script/generate model" in the console and you will get information to this specific command and examples explaining what the generator does.

You can use the generator multiple times for the same controller, but be careful: it will give you the option to overwrite your controller file (to add the actions you specify). As long as you have not modified the controller this might be fine, but if you have already added code then make sure you do not overwrite it and go back and manually add the action methods.

Generate a Model
To generate a model use the following:

rails generate model ModelName column:datatype column:datatype [...]

Replace ModelName with the CamelCase version of your model name. For example:

rails generate model Person name:string age:integer

This would generate the following:

exists app/models/ exists test/unit/ exists test/fixtures/ create app/models/person.rb create  test/unit/person_test.rb create  test/fixtures/people.yml exists db/migrate create db/migrate/20090607101912_create_people.rb

Any necessary directories will be automatically created. Existing ones will not be replaced. The file app/models/person.rb contains the Person class. test/unit/person_test.rb contains the unit test stub for the Person class. test/fixtures/people.yml contains a stub for test data which will be used to populate the test database during test runs. The db/migrate/20090607101912_create_people.rb contains the database migration stub for the Person class. Note that the timestamp at the beginning of the file (20090607101912) will always be different depending on the time you created the file. Also note how Rails pluralizes the class name to use the plural form as the corresponding table, fixture and migration names.

Generate a Controller
To generate a controller use the following:

rails generate controller ControllerName [actions]

Replace ControllerName with the CamelCase version of your controller name. When no actions are given, Rails will create a Controller that responds to all 7 REST actions (new, create, update, edit, destroy, index & show)

rails generate controller People

would generate the following output:

exists app/controllers/ exists app/helpers/ create app/views/people exists test/functional/ exists test/unit/helpers/ create app/controllers/people_controller.rb  create  test/functional/people_controller_test.rb  create  app/helpers/people_helper.rb  create  test/unit/helpers/people_helper_test.rb

The file app/controllers/people_controller.rb contains the PeopleController class. <tt>test/functional/people_controller_test.rb</tt> contains the functional test stub for the PersonController class. <tt>app/helpers/people_helper.rb</tt> is a stub for helper methods which will be made available to that controller and its associated views. Inside <tt>app/views/people</tt> you will find the created templates for the controller. Depending on the given parameters, there will be different files.

Generate a Migration
To generate a migration use the following:

rails generate migration MigrationName column:datatype column:datatype [...]

Replace MigrationName with the CamelCase version of your migration name. For example:

generate migration AddCityToPerson

This would generate the following:

exists db/migrate create db/migrate/20090607103358_add_city_to_person.rb

Migration are automatically generated each time you construct a new model, so you do not need to generate migrations by hand for each model. Typically you will use the migration generator when you need to change an existing model or need join tables. Again, the timestamp starting the filename will be different.


text:
Ruby on Rails/ActiveRecord

ActiveRecord - The Model

 * /Naming/
 * See the way the models are named and what names to avoid

 * /Migrations/
 * How to get your data inside the database in a convenient way

 * /Associations/
 * Connect different models together

 * /Callbacks/
 * Read about how to manipulate your data at certain states of their existence

 * /Validations/
 * Check your input for their correctness

 * /Attributes/
 * How to look up different criteria without writing SQL

 * /Aggregations/
 * Write advanced aggregations inside your model

 * /Calculations/
 * Do basic mathematical calculations with your data

 * /acts_as/
 * Extend functionality with acts_as

 * /Timestamps/
 * /Connection adapters/

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

title: Ruby on Rails/ActiveRecord


text:
Ruby on Rails/ActionController

ActionController - The Controller

 * /Actions/
 * Deal with different actions and see how URL can be translated to actions

 * /Parameters/
 * Learn how the user given data can be processed

 * /Sessions/
 * Manage sessions to store infos

 * /Cookies/
 * Handle cookies the "Rails way"

title: Ruby on Rails/ActionController


text:
User talk:Chris.Seedyk~enwikibooks

Hello and welcome to Wikibooks!

Here are some tips to help you get started:
 * You should sign your name on Talk and vote pages using four tildes, like this: ~~~~.
 * Remember to conduct any editing experiments in the sandbox.
 * If you're a Wikipedian, see Wikibooks for Wikipedians for a primer on how things work here (it's a little different).
 * If you want to base your work here on materials from Wikipedia, please use WB:RFI to bring the material over in compliance with the GFDL.
 * If you're an instructor and plan on using wikibooks for a class project, see Guidelines for class projects
 * Please say hello at the Staff Lounge with any questions or ideas.
 * Eventually, you might want to read the Manual of Style and Policies and Guidelines.
 * Please take a look at Naming policy before starting a new book.
 * Remember to maintain a Neutral point of view.
 * Explore, be bold in editing pages, and have fun!

You will find more resources in Community Portal. If you want to ask a question, visit the Study help desk, the Staff lounge, IRC channel or ask me personally on my talk page. For site news, see the Bulletin board. It might be an idea if you add this page to your "watchlist" so that you can see when any new information is posted there.

Good luck! -- Herby talk thyme 18:30, 29 December 2006 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Chris.Seedyk. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Chris.Seedyk~enwikibooks that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:06, 17 March 2015 (UTC)

Renamed
 This account has been renamed as part of single-user login finalisation. If you own this account you can |log in using your previous username and password for more information. If you do not like this account's new name, you can choose your own using this form after logging in: . -- Keegan (WMF) (talk) 04:47, 19 April 2015 (UTC)

title: User talk:Chris.Seedyk~enwikibooks


text:
Ruby on Rails/ActionView

ActionView - The View

 * Rendering and Redirecting
 * Learn about how to navigate different actions to different sites

 * Layout Files
 * How the view-files are handled

 * Forms
 * Deal with forms to edit data and more

 * Uploads
 * Basic instructions for uploads

 * Custom Helpers
 * Read about custom helpers to ease up development

title: Ruby on Rails/ActionView


text:
Ruby on Rails/Getting Started/Model-View-Controller

Model-View-Controller

As already mentioned, Rails relies on the MVC pattern. Model-View-Controller has some benefits over traditional concepts:

 * it keeps your business logic separated from your (HTML-based) views
 * keeps your code clean and neat in one place

Model
The model represents the information and the data from the database. It is as independent from the database as possible (Rails comes with its own O/R-Mapper, allowing you to change the database that feeds the application but not the application itself). The model also does the validation of the data before it gets into the database. Most of the time you will find a table in the database and an according model in your application.

View
The view is the presentation layer for your application. The view layer is responsible for rendering your models into one or more formats, such as XHTML, XML, or even Javascript. Rails supports arbitrary text rendering and thus all text formats, but also includes explicit support for Javascript and XML. Inside the view you will find (most of the time) HTML with embedded Ruby code. In Rails, views are implemented using ERb by default.

Controller
The controller connects the model with the view. In Rails, controllers are implemented as ActionController classes. The controller knows how to process the data that comes from the model and how to pass it onto the view. The controller should not include any database related actions (such as modifying data before it gets saved inside the database). This should be handled in the proper model.

Helpers
When you have code that you use frequently in your views or that is too big/messy to put inside of a view, you can define a method for it inside of a helper. All methods defined in the helpers are automatically usable in the views.

Best Practices
Current best practices include:

 * fat model and skinny controller
 * business logic should always be in the model
 * the view should have minimal code
 * Use helpers!
 * use models
 * DRY (Don't Repeat Yourself)


text:
Spanish/Lessons/¿Qué comes?

Lesson 6 — ¿Qué comes?

Dialogue

 * Raúl: Hola. ¿Qué compras?
 * Sofía: Hola, Raúl. Compro una barra de pan y una botella de leche.
 * Raúl: Vale. Así, ¿tomas leche y pan tostado para tu desayuno?
 * Sofía: Sí. Y tú, ¿qué desayunas?
 * Raúl: Normalmente, tomo zumo de naranja y una manzana.
 * Sofía: Y ¿tienes la comida que necesitas?
 * Raúl: Sí. Adiós.
 * Sofía: ¡Hasta luego!

Translation (wait until the end of the lesson).

Food and Drink

 * Notes
 * (m) above indicates that the noun is masculine (el queso — "the cheese"; los plátanos — "the bananas"), whereas (f) above indicates that it is feminine (la lechuga — "the lettuce"; las uvas — "the grapes")
 * In South America, papa is used instead of patata and Plátano refers to a plantain or cooking banana whereas a normal sweet banana is known as a banana or banano.
 * While agua is feminine, it takes the masculine articles un and el. For example, el agua curiosa ("the strange water") and las aguas curiosas ("the strange waters"). This is because agua starts with an accented a.
 * Con means "with", sin means without (café con leche means "coffee with milk", café sin leche means "coffee without milk").
 * Wine comes in two varieties, "red" and "white". In Spanish, they are called vino tinto and vino blanco.

 * Examples
 * Me gustan los huevos.
 * I like eggs.
 * No me gusta nada la lechuga.
 * I don't like lettuce at all.
 * Me encanta el té con leche.
 * I love tea with milk
 * Me gustan mucho las zanahorias, pero los pepinos son aburridos.
 * I like carrots a lot, but cucumbers are boring.

What do you eat?
To ask what someone else eats, use Qué followed by a form of one of the verbs below (¿Qué comes? means "What do you eat?"). To ask what someone likes to eat, use Qué te gusta then any of the verbs below (¿Qué te gusta comer? means "What do you like to eat?").

All of these verbs are regular except almorzar, which is one of the UE Verbs we learnt about in the last chapter; almuerzo, almuerzas, almuerza, almorzamos, almorzáis, almuerzan.
 * Note

 * Examples
 * ¿Qué te gusta almorzar?
 * What do you like to eat for lunch?
 * Como naranjas y plátanos, pero no me gustan las peras.
 * I eat oranges and bananas, but I don't like pears.
 * Me gusta comer uvas.
 * I like to eat grapes.
 * ¿Bebes leche?
 * Do you drink milk?

A bottle of wine

 * Notes
 * We previously learnt "unos/unas" as the translation for "some", e.g. unas manzanas ("some apples"), but this only works for plural nouns. "Some bread" has to be translated as algo de pan or just pan.
 * Also, there are two ways of saying "a glass of". Copa is for glasses with a stem (mostly wine: una copa de vino), and vaso is used for without a stem.
 * Obviously, in all these phrases, the un can be replaced with any number (Dos vasos de leche means "two glasses of milk").

 * Examples
 * Tres botellas de vino tinto
 * Three bottles of red wine
 * Un medio kilo de arroz
 * Half a kilo of rice
 * Una barra de pan
 * A loaf of bread
 * Cinco kilos y medio de patatas
 * Five and a half kilos of potatoes

Go to the exercises.

In the Shop
In Spanish, as in English, there are many ways of expressing what you would like to buy, some of which are listed below. You will also see some other useful words and phrases to use when shopping for food.

 * Notes
 * Comprar is a regular verb (compro, compras, compra, compramos, compráis, compran).
 * With ahí está(n), the n is added if the noun is plural.
 * Costar is a O => UE verb (cuesto, cuestas, cuesta, costamos, costáis, cuestan), but obviously, you only use the third person.
 * Also, if you want to say "How much does it cost?" you use ¿Cuánto cuesta(n)? (cuesta is for singular things, cuestan for plurals, as seen below).
 * In a bar or café in Spain, one usually pays for everything on leaving ¿La cuenta, por favor? is to ask for the bill and it relates to the verb contar - to count or to tell. Alternatively cobrar (collect) relates to payment (or cash) ¿me cobra? = may I pay?

 * Examples
 * Quisiera una manzana, por favor.
 * I would like an apple, please.
 * Querría comprar una barra de pan.
 * I'd like to buy a loaf of bread.
 * Me gustaría comprar una botella de vino tinto, por favor.
 * I'd like to buy a bottle of red wine, please.
 * ¿Cuánto cuestan las uvas?
 * How much do the grapes cost?
 * ¿Cuánto cuesta un kilo de patatas?
 * What does a kilo of potatoes cost?

Go to the exercises.

"E" and Consonant Adjectives
In Spanish, clearly not all adjectives end in "o" or "a". The good thing about these is that they stay the same, irrespective of gender.
 * Adjectives ending in "e" add an "s" when in the plural.
 * Adjectives ending in a consonant add an "es" when in the plural.

 * Notes
 * When an adjective (or indeed a noun) ends in z, it changes to a c in plural, then adds the "es" (feliz/felices — "happy").

 * Examples

Colours
Colours in Spanish are just adjectives, so they still have to agree and go after the noun. They are shown below.

 * Notes
 * Adjectives can function as nouns if you add an article in front of them. For example, el morado means "the purple one".
 * Take care with Brown!
 * The plural form of marrón is marrones (without the accent); las zanahorias marrones means "the brown carrots".
 * Marrones glacés are (in Spanish as in Italian) candied chestnuts.
 * Hair and eyes color brown is usually Castaño (chesnut).  Brown skin color is Moreno (tanned).
 * The adjective negrita (Literally:little black/bold face) is a term of familiarity or endearment is in Spanish and not to be confused with an offensive English expression.
 * Naranja is only the noun form of the word; when used as an adjective, anaranjado is used.
 * The color rosa ends in "a" even if applied to a masculine noun; el balón rosa, "the pink ball"

 * Examples
 * La manzana verde
 * The green apple
 * Los huevos blancos
 * The white eggs
 * El queso amarillo
 * The yellow cheese
 * Las naranjas anaranjadas
 * The orange oranges

Go to the exercises.

Summary
In this lesson, you have learnt You should now do the exercise related to each section (found here), and translate the dialogue at the top before moving on.
 * How to say some foods and drinks (la lechuga; una manzana; la leche).
 * How to say you eat and drink things (como, comes, come, comemos, coméis, comen).
 * How to say some simple quantities (un kilo de patatas; una copa de vino tinto)
 * What to say in a shop (quisiera; querría; la cuenta).
 * How to form adjectives that don't end in "O" or "A" (la tienda verde; los quesos azules)

You have now completed this chapter! Return to the Contents...

title: Spanish/Lessons/¿Qué comes?


text:
Ruby on Rails/Plugins

A large portion of the power of Rails comes from the wide range of plugins which are available for download.

Places to Get Plugins

 * AgileWebDevelopment Plugin Repository is currently the best location to find out about plugins available for Rails. This web site provides facilities for rating plugins and provides links to the plugin homepage and Subversion repository.
 * Rails Wiki Page for Plugins is the wiki page which contains a list of a large number of plugins.
 * RailsLodge Plugin Directory is an easy to use plugin directory with sample code on how to install and use each plugin.

Popular Plugins
Since other sites like the one above provide detailed information on plugins this book will not attempt to discuss every one of the popular plugins which are available, however there are some plugins which are used often enough and which are the source of enough questions that they are worth mentioning.

Acts_as_authenticated
This plugin provides a basis for authentication in your Rails app.

title: Ruby on Rails/Plugins


text:
User talk:Reece

Diving beetle Wikibugs
Hello Reece, I didn't realize the bug topic was just diving beetles and focused on predaceous d.b. So I made a new page. I want to know if that's ok. Thanks. Flolit (discuss • contribs) 16:21, 23 February 2011 (UTC)

WCI 2011 : Accelerating Wikibooks : Would like to discuss!
Hello!

I will be delivering a Talk at the Wikimedia Conference India 2011 on the topic of "Accelerating Wikibooks".

Over the next few days, I aim to make the proposal more and more wholesome and relevant. I'd like to discuss with you about the proposal and hope you can recommend me a few names on Wikibooks with whom I can discuss this.

I'd be very happy if you could discuss the proposal at User:Thewinster/Accelerating_Wikibooks

--Thewinster (discuss • contribs) 08:20, 26 September 2011 (UTC)

Summary of the proposal
This is not a summary of the final talk, only a tentative guideline.

 * Create Roadmaps for a book
 * Define Learning Outcomes
 * Annotate and Discuss new content available from around the web.
 * Minor tweaks and fixes which concentrate on crowdsourcing.
 * Identifying Small Contribution that advance a book and designing good UIs and triggers according to B.J. Fogg's Behavior Change Model, 8 Step Design Process. The paper can be found here at Persuasive Design : Eight Step Process by B. J. Fogg

De-sysop at WB:RFP
I've placed a notice on RFP following our email exchange. Unless you change your mind before 15 May at that point someone will raise the de-sysop request at meta. Thanks. QU TalkQu 09:20, 11 April 2012 (UTC)
 * I have removed your sysop flag per the local inactivity policy as requested by QU on meta. Snowolf How can I help? 20:18, 15 May 2012 (UTC)
 * When you have more time, we will welcome you back... Thanks for all your help over the years, look forward to seeing you again. QU TalkQu 21:25, 15 May 2012 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Urbane. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Urbane~enwikibooks that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:51, 17 March 2015 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Urbane User. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Urbane User~enwikibooks that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:51, 17 March 2015 (UTC)

title: User talk:Reece


text:
User talk:Aeden~enwikibooks

Hello and welcome to Wikibooks!

Here are some tips to help you get started:
 * You should sign your name on Talk and vote pages using four tildes, like this: ~~~~.
 * Remember to conduct any editing experiments in the sandbox.
 * If you're a Wikipedian, see Wikibooks for Wikipedians for a primer on how things work here (it's a little different).
 * If you want to base your work here on materials from Wikipedia, please use WB:RFI to bring the material over in compliance with the GFDL.
 * If you're an instructor and plan on using wikibooks for a class project, see Guidelines for class projects
 * Please say hello at the Staff Lounge with any questions or ideas.
 * Eventually, you might want to read the Manual of Style and Policies and Guidelines.
 * Please take a look at Naming policy before starting a new book.
 * Remember to maintain a Neutral point of view.
 * Explore, be bold in editing pages, and have fun!

You will find more resources in Community Portal. If you want to ask a question, visit the Study help desk, the Staff lounge, IRC channel or ask me personally on my talk page. For site news, see the Bulletin board. It might be an idea if you add this page to your "watchlist" so that you can see when any new information is posted there.

Good luck! -- Herby talk thyme 19:44, 29 December 2006 (UTC)

Validity of resources
Thanks for your tireless contributions. Though I have one question, I would like to ask what resources you used for your book, Ruby on Rails. --Herraotic 20:59, 29 December 2006 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Aeden. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Aeden~enwikibooks that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 22:55, 17 March 2015 (UTC)

Renamed
 This account has been renamed as part of single-user login finalisation. If you own this account you can |log in using your previous username and password for more information. If you do not like this account's new name, you can choose your own using this form after logging in: . -- Keegan (WMF) (talk) 04:29, 19 April 2015 (UTC)

title: User talk:Aeden~enwikibooks


text:
User talk:Leethal~enwikibooks

Hello and welcome to Wikibooks!

Here are some tips to help you get started:
 * You should sign your name on Talk and vote pages using four tildes, like this: ~~~~.
 * Remember to conduct any editing experiments in the sandbox.
 * If you're a Wikipedian, see Wikibooks for Wikipedians for a primer on how things work here (it's a little different).
 * If you want to base your work here on materials from Wikipedia, please use WB:RFI to bring the material over in compliance with the GFDL.
 * If you're an instructor and plan on using wikibooks for a class project, see Guidelines for class projects
 * Please say hello at the Staff Lounge with any questions or ideas.
 * Eventually, you might want to read the Manual of Style and Policies and Guidelines.
 * Please take a look at Naming policy before starting a new book.
 * Remember to maintain a Neutral point of view.
 * Explore, be bold in editing pages, and have fun!

You will find more resources in Community Portal. If you want to ask a question, visit the Study help desk, the Staff lounge, IRC channel or ask me personally on my talk page. For site news, see the Bulletin board. It might be an idea if you add this page to your "watchlist" so that you can see when any new information is posted there.

Good luck! -- Herby talk thyme 19:44, 29 December 2006 (UTC)

Get On IRC
Hey, Leethal, get in #rubyonrails! Aeden 15:18, 30 December 2006 (UTC)

Mambo Open Source/Design/Convert templates from 4.5 to 4.5.x
I noticed that you created Mambo Open Source/Design/Convert templates from 4.5 to 4.5.x under the user name "August." Is it, as it appears to be, redundant to Mambo Open Source/Convert templates from 4.5 to 4.5.x? Thanks in advance, User:Iamunknown 07:26, 8 January 2007 (UTC)

 * I tagged the page for speedy deletion. If it deleted in error, please feel free to request its undeletion or to ask that I do so. --Iamunknown 22:20, 20 January 2007 (UTC)

Your account will be renamed
Hello,

The developer team at Wikimedia is making some changes to how accounts work, as part of our on-going efforts to provide new and better tools for our users like cross-wiki notifications. These changes will mean you have the same account name everywhere. This will let us give you new features that will help you edit and discuss better, and allow more flexible user permissions for tools. One of the side-effects of this is that user accounts will now have to be unique across all 900 Wikimedia wikis. See the announcement for more information.

Unfortunately, your account clashes with another account also called Leethal. To make sure that both of you can use all Wikimedia projects in future, we have reserved the name Leethal~enwikibooks that only you will have. If you like it, you don't have to do anything. If you do not like it, you can pick out a different name.

Your account will still work as before, and you will be credited for all your edits made so far, but you will have to use the new account name when you log in.

Sorry for the inconvenience.

Yours, Keegan Peterzell Community Liaison, Wikimedia Foundation 23:24, 17 March 2015 (UTC)

Renamed
 This account has been renamed as part of single-user login finalisation. If you own this account you can |log in using your previous username and password for more information. If you do not like this account's new name, you can choose your own using this form after logging in: . -- Keegan (WMF) (talk) 05:11, 19 April 2015 (UTC)

title: User talk:Leethal~enwikibooks


text:
User:Leethal~enwikibooks

 * Name: August Lilleaas
 * Location: Norway, Oslo (GMT+1)

Stuff I did

 * Made the Mambo Open Source book (under the "august" username)
 * WIP at Ruby on Rails

title: User:Leethal~enwikibooks


text:
User:Herraotic/monobook.js

//

// Script from User:MarkS/extraeditbuttons.js extra edit buttons document.write(' ');

//User log tools -Checking for sleeper accounts document.write(' ');

//warning tools document.write(' '); //

//Replace txt document.write(' '); //

//Google tool document.write(' '); //

// Helper tools document.write(' '); //

//

//Rollback tools document.write(' '); // // VIEW SOURCE $(function {  if (location.href.indexOf('viewsource=1') != -1) {    sl = document.getElementById('wpSummaryLabel'); sl.parentNode.removeChild(sl);    ed = document.getElementById('wpSummary').parentNode; ed.parentNode.removeChild(ed);    return;  }  editbutton = document.getElementById('ca-edit');  if (editbutton && location.href.indexOf('action=edit')==-1) {    editlink = editbutton.getElementsByTagName('a')[0].href + '&viewsource=1';    tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];    na = document.createElement('a');    na.href = editlink; na.appendChild(document.createTextNode('view source'));    li = document.createElement('li'); li.id = 'ca-viewsource'; li.appendChild(na);    tabs.insertBefore(li,editbutton);  } });

//

// addPurge tab $( function {   var x = document.getElementById('ca-history');    if(!x) return;    if(x.children) x = x.children[0].href;    else x = x.childNodes[0].href;    addLink("p-cactions", x.replace(/=history/, "=purge"), 'purge', 'ca-purge', 'Purge the internal cache for this page', 0); });

title: User:Herraotic/monobook.js


text:
Ruby on Rails/ActiveSupport

Active Support is a collection of various utility classes and standard library extensions that were found useful for Rails. All these additions have hence been collected in this bundle as way to gather all that sugar that makes Ruby sweeter.

title: Ruby on Rails/ActiveSupport


text: User talk:80.58.205.36

title: User talk:80.58.205.36


text:
XForms/Select Multi-Column

Motivation
Sometimes you have a large number of items to select from, for example you want to include one of many counties within a state to include in your search. In the following example there are 87 counties that might be included in a search. These county names are places in seven columns with 13 counties in all but the last column.

Link to Working Example
Select Multi Column

Sample Program
Here is a sample program. Make sure to put the page into edit mode if you want to copy and paste the code. This is because Wiki software replaces the ampersand-lt-semicolon with a "&".

      Select all counties to include in the search:           </xf:itemset> </xf:select> <xf:select ref="counties3" appearance="full"> <xf:itemset model="code-tables" nodeset="instance('MNCountyCode')/EnumeratedValues/Item[(position > 26) and (position < 40)]"> <xf:label ref="Label" /> <xf:value ref="Value" /> </xf:itemset> </xf:select> <xf:select ref="counties4" appearance="full"> <xf:itemset model="code-tables" nodeset="instance('MNCountyCode')/EnumeratedValues/Item[(position > 39) and (position < 53)]"> <xf:label ref="Label" /> <xf:value ref="Value" /> </xf:itemset> </xf:select> <xf:select ref="counties5" appearance="full"> <xf:itemset model="code-tables" nodeset="instance('MNCountyCode')/EnumeratedValues/Item[(position > 52) and (position < 66)]"> <xf:label ref="Label" /> <xf:value ref="Value" /> </xf:itemset> </xf:select> <xf:select ref="counties6" appearance="full"> <xf:itemset model="code-tables" nodeset="instance('MNCountyCode')/EnumeratedValues/Item[(position > 65) and (position < 79)]"> <xf:label ref="Label" /> <xf:value ref="Value" /> </xf:itemset> </xf:select> <xf:select ref="counties7" appearance="full"> <xf:itemset model="code-tables" nodeset="instance('MNCountyCode')/EnumeratedValues/Item[(position > 78)]"> <xf:label ref="Label" /> <xf:value ref="Value" /> </xf:itemset> </xf:select> <xf:output ref="counties"> <xf:label>Counties selected: </xf:label> </xf:output>

Table for Data
The following is the shared resources file used by all the forms. Note that the values do not have any spaces in them. This way the codes can be passed through systems that use spaces as delimineters.

Discussion
The ideal way to do this would be to use a style sheet to pour the items into different cells of a table. Unfortunately there is little documentation on how the itemset results can be styled into different tables.

title: XForms/Select Multi-Column


text:
User:Aeden~enwikibooks

Anthony Eden is...

 * A software developer and project manager
 * An open source software author
 * A former Java and current Ruby programmer
 * A father of triplets
 * A surfer (the real kind, in the ocean)
 * Someone with a (blog)
 * Working on the Ruby on Rails WikiBook

title: User:Aeden~enwikibooks


text:
User talk:203.184.58.178

Welcome!
Welcome to Wikibooks, a collection of open-content textbooks! You don't have to log in to read or edit articles on Wikibooks, but creating an account is quick, free and non-intrusive, requires no personal information, and gives you many benefits, including:
 * The use of a username of your choice
 * The ability to view all your contributions via a "My contributions" link
 * Your own user page
 * Your own talk page which, if you choose, also allows users to send you messages without knowing your e-mail address
 * The use of your own personal watchlist to which you can add articles that interest you
 * The ability to rename pages.
 * The ability to upload images
 * The ability to customize the appearance and behavior of the website
 * The eligibility to become an administrator
 * The right to be heard in votes and elections
 * Your IP address will no longer be visible to other users.

We hope that you choose to become a Wikibookian and create an account. Feel free to ask me any questions you may have on my talk page. By the way, make sure to sign your posts and comments with four tildes (~~~~), which will let others know who left it.

title: User talk:203.184.58.178


text:
Ruby on Rails/Built-In Rails Tools

There are a wide variety of command-line tools which play a role in the development of a Rails application.

Generators
Generators are scripts which create stub code for new models, controllers, migrations and much more.

 * /Generators/
 * /Make a generator/

Rake
Rake is a build tool which is widely used in Ruby applications. Rails uses Rake tasks for many different things.

 * /Convenient Rake tasks/
 * /What is Rake anyway?/
 * /Make your own rake tasks/
 * /Command-Line Reference/

title: Ruby on Rails/Built-In Rails Tools


text:
Ruby on Rails/Getting Started/Convention Over Configuration

Convention over Configuration
When starting to work with Rails you will find yourself looking at controllers and lots of views and models for your database. In order to reduce the need of heavy configuration, the team behind Rails has set up rules to ease up working with the application. These rules are not one-way. You may define your own rules but for the beginning (and for your further work, too) it's a good idea to stick to the conventions that Rails offers. These conventions will speed up development, keep your code concise and readable and - most important - these conventions allow you an easy navigation inside your application.

An example should show you how the conventions work together: You have a database table called orders with the primary key id. The matching model is called order and the controller, that handles all the logic is named orders_controller. The view is split in different actions: if the controller has a new and edit action, there is also a new- and edit-view.


text:
Cookbook:Colonial Goose

Colonial goose is the name for a surprisingly effective preparation of roast leg of lamb.

Early colonial pioneers in New Zealand had sheep aplenty, but goose was relatively scarce. To prepare dishes similar to those they had back home in England the pioneers were very inventive. Colonial Goose is now a recognised classic, with some restaurants featuring it as a main attraction at midwinter festivities (June 21 in NZ). It involves the careful boning out a leg of lamb, stuffing it with honey and dried apricots, and then marinating it in a red wine based marinade which even gives it the appearance of goose when cooked.

Ingredients
You need a large leg of mutton. If you don’t know how to bone it out, ask your butcher to do it, stressing that you need to be able to stuff it.

Meat and stuffing

 * 1 large leg of mutton
 * 30 g (2 Tbsp) butter
 * 1 large tablespoon clear honey
 * 125 g (½ cup) dried apricots, finely diced
 * 1 medium-sized onion, finely diced
 * 1 cup fresh bread crumbs
 * ¼ teaspoon of salt
 * ¼ teaspoon of dried thyme
 * Freshly-ground black pepper
 * 1 beaten egg

Marinade

 * 250 g (1 cup / 1–2 ea.) sliced carrots
 * 2 large onions, sliced
 * 1 bay leaf
 * 3–4 crushed parsley stalks
 * 1 not-quite-full cup of red wine such as claret

Procedure

 * 1) To prepare the stuffing, melt the butter and honey over low heat, add the other ingredients, and combine well.
 * 2) Force the stuffing into the cavity in the meat, and sew it up with fine string.
 * 3) Combine all marinade ingredients.
 * 4) Place the leg into a plastic bag in a large bowl, and add the marinade mixture to the bag. Let marinate for 8 hours.
 * 5) Bake mutton in oven at 180 °C for 2 hours, checking on progress at 90 minutes. If the meat looks like it is over-browning, it can be covered by foil.
 * 6) Remove the string before carving.
 * 7) Strain the marinade and use 3–4 tablespoons of the liquor to make gravy.

Notes, tips, and variations

 * The meat is best prepared just after breakfast, so it can then be regularly turned over in the marinade throughout the day.

title: Cookbook:Colonial Goose


text:
Cookbook:Lolly Cake

| Cuisine of New Zealand

Lolly cake is a New Zealand cake which features lollies in the ingredients and thus can be thought of as "candy cake". The traditional candy used is Fruit Puffs which are like firm, slightly chewy marshmallows and are obviously fruity. Malt biscuits and coconut are also used and other ingredients can be added or substituted.

Ingredients

 * 250 g (1 packet) malt biscuits
 * 1 pinch of cinnamon (optional)
 * 120 g (1.5 sticks) of butter
 * 200 g (½ can or 7 ounces) condensed milk
 * 180 g (1 packet) Fruit Puffs
 * Shredded coconut

Procedure

 * 1) Crush the biscuits. They don't need to be a fine dust—some pieces can be left partially-crushed to give the cake a nicer texture.
 * 2) Mix in cinnamon, if you want it.
 * 3) Warm the butter and condensed milk in the microwave for 30 seconds until the butter is very soft. It's okay if the butter melts a bit.
 * 4) Cut the fruit puffs in half if you want or leave them whole.
 * 5) Mix the fruit puffs with the crushed biscuits, then add the butter and condensed milk. Mix well.
 * 6) Roll the mixture into a log shape, or roll small amounts into little balls.
 * 7) Roll the log or balls in the shredded coconut until completely covered.
 * 8) Place on a tray and cover with plastic wrap to keep moist. Chill for several hours in the fridge until hardened.
 * 9) Cut cake while still cold before it warms up again

References/External Links

 * Suzy's World:Steel Shows photo of cake.
 * Isaac Freeman:A Natural History of Lolly Cake Website about Lolly cake, with good pictures..
 * New Zealand Lolly Log Cake Shows substitute ingredients for USA

title: Cookbook:Lolly Cake


text:
User talk:65.93.13.207

Welcome!
Welcome to Wikibooks, a collection of open-content textbooks! You don't have to log in to read or edit articles on Wikibooks, but creating an account is quick, free and non-intrusive, requires no personal information, and gives you many benefits, including:
 * The use of a username of your choice
 * The ability to view all your contributions via a "My contributions" link
 * Your own user page
 * Your own talk page which, if you choose, also allows users to send you messages without knowing your e-mail address
 * The use of your own personal watchlist to which you can add articles that interest you
 * The ability to rename pages.
 * The ability to upload images
 * The ability to customize the appearance and behavior of the website
 * The eligibility to become an administrator
 * The right to be heard in votes and elections
 * Your IP address will no longer be visible to other users.

We hope that you choose to become a Wikibookian and create an account. Feel free to ask me any questions you may have on my talk page. By the way, make sure to sign your posts and comments with four tildes (~~~~), which will let others know who left it.

title: User talk:65.93.13.207


text:
User:Az1568/List3

List 3 from Wikiversity:Open Proxies.

title: User:Az1568/List3


text:
File:Ayflag.jpg

Summary
A photograph of the Adventist Youth (AY) Flag. This flag is used by Adventist Youth Societies and Pathfinder Clubs throughout the world. These clubs are operated by the Seventh-day Adventist Church.

Uploaded by Jim Thomas on 29 Dec, 2006

Licensing
/Images

title: File:Ayflag.jpg


text:
File:Pathfinderflag.jpg

Summary
A photograph of the Pathfinder Flag. This flag is used by Pathfinder Clubs throughout the world. These clubs are operated by the Seventh-day Adventist Church.

Uploaded by Jim Thomas on 29 Dec, 2006

Licensing
/Images

title: File:Pathfinderflag.jpg


text:
Ruby on Rails/Full Table of Contents

 * ../Getting Started/
 * ../Getting Started/Model-View-Controller/
 * ../Tools/
 * ../Built-In Rails Tools/Generators/
 * ../ActiveRecord/
 * ../ActiveRecord/Migrations/
 * ../ActionController/
 * ../ActionView/
 * ../ActiveSupport/
 * ../Plugins/

title: Ruby on Rails/Full Table of Contents


text:
Ruby on Rails/Getting Started/Install on Linux

Install or update Ruby
It is important that you get the right version of the language. Versions 1.8.2 and 1.8.4 are recommended. 1.8.3 has problems, and 1.8.5 (the current stable version) runs fine, but you will not be able to use breakpointer for debugging (a very handy tool). So I recommend 1.8.4.

Get it from the official Ruby website

Get it from the SVN repository

Debian
For Debian-based systems (Debian, Ubuntu, etc.), your best bet is to type:

sudo apt-get install ruby -t '1.8.4' sudo apt-get install irb rdoc

This should install the Ruby language interpreter, the RDoc documentation generator, and irb command-line interpreter.

Install RubyGems
You should be able to obtain RubyGems by going to the Gems Website and clicking the "download" link. Choose the proper archive and install.

Install Rails
Get to the command-line and type: sudo gem install rails --include-dependencies


text:
Ruby on Rails/Getting Started/Install on OS X

Option 1
sudo gem install rails --include-dependencies
 * Download Ruby and RubyGems
 * Install Ruby
 * Install RubyGems
 * Get to the command-line and type:

Option 2

 * Download Locomotive
 * Install Ruby on Rails software from Locomotive

Option 3

 * Use the broken Ruby installation on OSX 10.4 and follow this guide

RMagic
A shellscript has been made that will install everything you need to make RMagic work on your OS X box. Copy the contents, save it as a file and run the file through a terminal (by navigating to the file and type ./name_of_file.


text:
Ruby on Rails/Getting Started/Install on Windows

Installation on Windows
To start, you will need the following components:
 * Ruby
 * RubyGems
 * Rails
 * a driver for your database

Ruby
Install Ruby as a regular application. You might need administrator privileges to install it successfully. Check the Ruby site for the latest version. The Ruby sites provides packages for all OS. Just follow their steps: ruby website

Gems
RubyGems is a packaged Ruby application. Using the gem command helps you installing and deleting gem-packages. Gems allows you to install additional features for your application and easy management of already installed ones. RubyGems is now part of the standard library from Ruby version 1.9.

To verify availability, check the version of gems: gem -v

It should display the proper version (2.0.0 as of the writing of this book)

Rails
To install Rails, we can use our freshly installed gems (Rails is a gem). Use the console to type gem install rails

This downloads and install all the needed components on your system. After the installation is done, verify the installation by checking if you have the latest version: rails -v

It should display the current Rails version (2.3.2 as of writing this guide)

DB Driver
Rails supports a broad range of databases. The default database is SQLite3. You can specify the database you want to use when you first create your Rails project. But no worries, it can be altered any time. For this Wikibook, we will use SQLite3 as database.

To use SQLite3 on your system together with Ruby on Rails, download the latest dll files from the sqlite website. Choose the files that contains the dlls without TCL binding sqlitedll-3 x x.zip. After downloading, copy all the files inside the zip into your Ruby /bin directory

At last, we need to install a gem for our database. Since we are using SQLite3 in this book, we want to install the proper gem: gem install sqlite3-ruby --version 1.2.3

Even though 1.2.3 is not the current version, it will work as intended because newer version won't work in Windows

Database Configuration
If your first application is created, take a look inside the /config folder. We need to tell Rails the name of our database and how to use it. Depending on your chosen database during the creation of the Rails application, the database.yml file always look different. Because we decided to stay with the default SQLite3 database, the file will look something like this:

We may now give our database a proper name. Consider giving different names to your "test"- and to your "production"-database. This is especially important when working in a live-environment and you do not want bad data inside your database.

To create your database in our new project environment, we need to run rake db:create

Rake is a built-in tool, that allows you to run many pre-made programs to ease up development. There is more functionality inside Rake then just creating a database. But one thing at a time. The db:create commando creates the database with the given name (inside db.yml). If you're using SQLite3, you will find a *.sqlite3 file in the /db folder. This is your database, stored in a single, handy file. For practicing and local development purposes, this is ideal because all your data is in one file that can be quickly read and written.


text:
Ruby on Rails/ActiveRecord/Aggregations

Aggregations
Active Record implements aggregation through a macro-like class method called composed_of for representing attributes as value objects. It expresses relationships like "Account [is] composed of Money [among other things]" or "Person [is] composed of [an] address". Each call to the macro adds a description of how the value objects are created from the attributes of the entity object (when the entity is initialized either as a new object or from finding an existing object) and how it can be turned back into attributes (when the entity is saved to the database).

Example:

The customer class now has the following methods to manipulate the value objects:

* Customer#balance, Customer#balance=(money) * Customer#address, Customer#address=(address)

These methods will operate with value objects like the ones described below:

Now it’s possible to access attributes from the database through the value objects instead. If you choose to name the composition the same as the attributes name, it will be the only way to access that attribute. That’s the case with our balance attribute. You interact with the value objects just like you would any other attribute, though:

customer.balance = Money.new(20)    # sets the Money value object and the attribute customer.balance                    # => Money value object customer.balance.exchanged_to("DKK") # => Money.new(120, "DKK") customer.balance > Money.new(10)    # => true customer.balance == Money.new(20)   # => true customer.balance < Money.new(5)     # => false

Value objects can also be composed of multiple attributes such as the case of Address. The order of the mappings will determine the order of the parameters. Example:

customer.address_street = "Hyancintvej" customer.address_city  = "Copenhagen" customer.address       # => Address.new("Hyancintvej", "Copenhagen") customer.address = Address.new("May Street", "Chicago") customer.address_street # => "May Street" customer.address_city  # => "Chicago"

Writing value objects
Value objects are immutable and interchangeable objects that represent a given value such as a Money object representing $5. Two Money objects both representing $5 should be equal (through methods such as == and <=> from Comparable if ranking makes sense). This is unlike entity objects where equality is determined by identity. An entity class such as Customer can easily have two different objects that both have an address on Hyancintvej. Entity identity is determined by object or relational unique identifiers (such as primary keys). Normal ActiveRecord::Base classes are entity objects.

It’s also important to treat the value objects as immutable. Don‘t allow the Money object to have its amount changed after creation. Create a new money object with the new value instead. This is exemplified by the Money#exchanged_to method that returns a new value object instead of changing its own values. Active Record won’t persist value objects that have been changed through other means than the writer method.

The immutable requirement is enforced by Active Record by freezing any object assigned as a value object. Attempting to change it afterwards will result in a TypeError.

title: Ruby on Rails/ActiveRecord/Aggregations


text:
Ruby on Rails/ActiveRecord/Calculations

Calculations
Calculations provide methods for calculating aggregate values of columns in ActiveRecord models.

Calculate
All calculations are handled through the calculate method. The calculate method accepts the name of the operation, the column name and any options. The options can be used to customize the query with :conditions, :order, :group, :having and :joins.

The supported calculations are:

 * average
 * sum
 * minimum
 * maximum
 * count

The calculate method has two modes of working. If the :group option is not set then the result will be returned as a single numeric value (fixnum for count, float for average and the column type for everything else). If the :group option is set then the result is returned as an ordered Hash of the values and groups them by the :group column. The :group option takes either a column name or the name of a belongs_to association.

Note that if a condition specified in the calculation results in no values returned from the underlying table then the calculate method will return nil.

For example:

values = Person.maximum(:age, :group => 'last_name') puts values["Drake"] => 43

drake = Family.find_by_last_name('Drake') values = Person.maximum(:age, :group => :family) # Person belongs_to :family puts values[drake] => 43

values.each do |family, max_age| ... end

Average
You can use the average method to calculate the average value for a particular column. For example:

Person.average(:age)

Will return the average age of all people in the Person model.

An example of customizing the query:

Person.average(:age, :conditions => ['age >= ?', 55])

This would return the average age of people who are 55 or older.

Sum
The sum method will calculate the sum for a particular column. For example:

Product.sum(:number_in_stock)

Will return the sum of products in stock.

An example of customizing the query:

Product.sum(:number_in_stock, :conditions => ['category_id = ?', 10])

Will return the sum of the number of products which are in category 10 and in stock.

Minimum
The minimum method will calculate the minimum value for a particular column. For example:

Donation.minimum(:amount)

Will return the lowest amount donated.

An example of customizing the query:

Donation.minimum(:amount, :conditions => ['created_at > ?', 1.year.ago])

This will return the lowest amount donated within the last year.

Maximum
The maximum method will calculate the maximum value for a particular column. For example:

Donation.maximum(:amount)

Will return the largest amount donated.

An example of customizing the query:

Donation.maximum(:amount, :conditions => ['created_at > ?', 1.year.ago])

This will return the largest amount donated within the last year.

Count
Counts the number of items matching the condition(s).

TestResult.count(:all)

Will return the number of TestResult objects in the database.

An example of customizing the query:

TestResult.count(:all,:conditions=>['starttime>=?',Time.now-3600*24])

Will return the number of TestResult objects whose starttime field is within the last 24 hours.

title: Ruby on Rails/ActiveRecord/Calculations


text:
Ruby on Rails/ActiveRecord/acts as

acts_as_list
Acts as List will add methods to the ActiveRecord model which provide means for accessing the records as a list.

Directive
The acts_as_list directive will add methods to the ActiveRecord object to make each instance act as an element in a list. acts_as_list accepts two configuration options:

 * column : The name of the column used for keeping position (default is position)
 * scope : Restricts what is to be considered a list. Given a symbol, it will attach "_id" (if that hasn’t been already) and use that as the foreign key restriction. It’s also possible to give it an entire string that is interpolated if you need a tighter scope than just a foreign key. Example: acts_as_list :scope => ‘todo_list_id = #{todo_list_id} AND completed = 0’

Instance Methods
Each instance of a model which has the acts_as_list directive specified will automatically include methods for working with the records as a list:

 * decrement_position
 * first?
 * higher_item
 * in_list?
 * increment_position
 * insert_at
 * last?
 * lower_item
 * move_higher
 * move_lower
 * move_to_bottom
 * move_to_top
 * remove_from_list

Methods which change the position of the item in the list affect the persistent data immediately. For example, a call to move_to_top would be effective immediately.

Example
Given three people in the database (Joe, Bob and Jane, initially in that order):

p = Person.find_by_name('Joe') p.first? => true p.in_list? => true p.move_to_bottom p.first? => false p.last? => true

acts_as_tree
The acts_as_tree directive will add methods to the ActiveRecord object to make each instance acts as a node in a tree.

title: Ruby on Rails/ActiveRecord/acts as


text:
Ruby on Rails/ActiveRecord/Validations

Validations
ActiveRecord supports a variety of model validation methods and allows for addition new methods as needed.

General Usage
For a complete reference of all validations check out the official guide or the API documentation

Additionally you can apply a validation to one or more attributes using the validate_each directive:

It is also possible to define validations via custom methods or blocks:

 * validate
 * validate_on_create
 * validate_on_update

For example:

Normally validation occurs whenever a record is created or saved, however you can force validation to *not* occur using the save_with_validation method passing @false@ as the argument.

validates_acceptance_of
If you need to check if the user has set or "accepted" a certain checkbox you can use this validation. In this case, the check box with the HTML attribute "name='play_rules'" needs to be checked in order to pass validation.

validates_confirmation_of
This validator checks if an input field has been entered correct both times. For example if you want the user to enter his password 2 times to make sure he enters the correct password (this is seen very often when registering for a site) this is the helper you want to use. To use it, make sure to define it correctly in your view (Note the _confirmation):

validates_format_of
validates_format_of accepts a regular expression and checks for the input with the provided pattern given by the :with clause. Also note, that we used a customized message with this helper. This can be done with every validator in the same manner.

validates_length_of/validates_size_of
The length_of/size_of validator comes in handy if you need to check the input for a certain length of characters. In the example above, the username should not be longer than 50 characters and not shorter than 5. Alternatively you can specify a range that should be true in order to validate. Above the address should constist of 5 to 100 characters. Note that length_of and size_of/ are the same.

validates_numericality_of
Checks if the input is a number of any kind. To make sure, that the input is only an integer, you may use the optional :only_integer => true command. There are some useful options with this command for example :greater_than => 100 makes sure that the given number will be greater then 100: so 101 will be the first valid number.

validates_presence_of
One of the most basic validators, this one checks if anything has been inserted in the given form element ("name" in this case).

validates_uniqueness_of
Finally, a bit of a more advanced validator: this one checks inside the database if the attribute is already taken or not. In this case, if the user chooses the username "Paul" and the name "Paul" already exists inside the username column of your database, it won't validate.

with scope
It can also validate whether the value of the specified attributes are unique based on multiple scope parameters. For example, making sure that a teacher can only be on the schedule once per semester for a particular class.

When the record is created a check is performed to make sure that no record exists in the database with the given value for the specified attribute (that maps to a column). When the record is updated, the same check is made but disregarding the record itself.

Configuration Options

 * message - Specifies a custom error message (default is: "has already been taken")
 * scope - One or more columns by which to limit the scope of the uniqueness constraint.
 * if - Specifies a method, proc or string to call to determine if the validation should occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The method, proc or string should return or evaluate to a true or false value.

When writing your validation keep in mind that you can mix all of these together and there are even more advanced functions you might want to check out.

title: Ruby on Rails/ActiveRecord/Validations


text:
Ruby on Rails/ActiveRecord/Connection adapters

ActiveRecord abstracts the connection to the database through connection adapters. It currently supports the following databases:

 * DB2
 * Firebird
 * FrontBase
 * MySQL
 * OpenBase
 * Oracle
 * Postgresql
 * SQL Lite
 * SQL Server
 * Sybase

If you need to access the current connection adapter directly you can do so through the ActiveRecord::Base.connection class method. All connection adapters share some common functionality which is defined in the following source files:

 * active_record/connection_adapters/abstract_adapter.rb
 * active_record/connection_adapters/abstract/connection_specification.rb
 * active_record/connection_adapters/abstract/database_statements.rb
 * active_record/connection_adapters/abstract/quoting.rb
 * active_record/connection_adapters/abstract/schema_definition.rb
 * active_record/connection_adapters/abstract/schema_statements.rb


text:
Ruby on Rails/ActiveRecord/Timestamps

Active Record automatically timestamps during create and update operations if the table has fields created_at/created_on or updated_at/updated_on. This can be disabled on individual models by setting @self.record_timestamps = false@ in the class definition for the model. For example:

class SomeModel < ActiveRecord::Base self.record_timestamps = false end

Although there is no explicit requirement, typically the _on fields should be date types, whereas the _at fields should be datetime types.

Timestamps are in the local timezone by default but can use UTC by setting ActiveRecord::Base.default_timezone = :utc. This will normally be specified in config/environment.rb.

Source: active_record/timestamp.rb

title: Ruby on Rails/ActiveRecord/Timestamps


text:
Ruby on Rails/ActiveRecord/Associations

Introduction
Associations are methods to connect 2 models. Operations on objects become quite simple. The association describes the role of relations that models are having with each other. ActiveRecord associations can be used to describe one-to-one (1:1), one-to-many (1:n) and many-to-many (n:m) relationships between models. There are several types of associations

 * belongs_to and
 * has_one form a one-to-one relationship
 * has_one :through is a different way to create a one-to-one relationship

 * has_many and
 * belongs_to form a one-to-many relation

 * has_and_belongs_to_many or an alternative way
 * has_many :through to create a many-to-many relationship

For all following examples, we assume the following 4 models:

Also check out the ER-diagram for the models below:

belongs_to
The belongs_to association sets up an one-to-one (1:1) or one-to-many (1:n) relationship to an other model.

In our example, one Rating belongs to exactly one Product, so we need to set up a belongs_to association.

The product stores an id for a rating, both of them have a one-to-one Relationship. Meaning: One product belongs to one category and one product belongs to one rating.

has_one
The has_one association is a one-to-one relation too. It declares that each instance of a product from the productmodel possesses only one rating_id.

Since the rating and the product form a one-to-one relationship, it is up to us where we put the reference. Because we have put the reference (the rating_id) into the product (see belongs_to :rating into the product model), the association for the rating has to be has_one:product. Has_one and belongs_to always go together to form a relationship.

has_many
This is a one-to-many connection to an other model. In this case, one category has many products. Pay attention to the spelling, if you use has_many. The model that you want to reference needs to be written in plural.

The category and the product are forming a one-to-many relationship. Since a category has many products we put the has_many association inside the category. Note that also the product needs to contain a reference to the category. One product belongs to exactly one category, therefore we put belongs_to :category inside the product model.

has_and_belongs_to_many
Also known as : HABTM.

<tt>Has_and_belongs_to_many</tt> is the most complex association. You need to keep some things in mind: Because of the way relational databases work, you can not set up a direct relationship. You need to create a joining table. This is easily done with migrations. If we want to create a HABTM association for our product and tag, the association for the joining table might look like following:

Because we do not need a primary key inside the join table, we use <tt>:id => false</tt> to prevent the automatic creation of a primary key column. The naming of the table needs to be in alphabetical order. "P" is before "T" in the alphabet so the tablename has to be products_tags (note: plural).

has_many :through
This association is an other way to form a many-to-many relation. Consider the following ER-Diagramm to show the relationship.

Instead of using a join table we use another model for the relationship. If we want to find out which supplier is responsible for a specific category we need the product to link the models together. This way we can store additional data inside a real model that also acts as a joining model. Whenever you need to store data that additionally belongs to association (e.g. the date of the creation) you might want to use this type of association.

has_one :through
As with <tt>has_many :through</tt>, <tt>the has_one :through</tt> association uses an "extra" model to form a relation.

Consider this visual relationship:

Note: This example assumes that the membership inside a group is exclusive for each user.

title: Ruby on Rails/ActiveRecord/Associations


text:
Ruby on Rails/ActiveRecord/Callbacks

Callbacks
Callbacks provide a means of hooking into an ActiveRecord object's lifecycle.

Implementing Callbacks
There are four types of callbacks accepted by the callback macros:

 * Method references (symbol)
 * Callback objects
 * Inline methods (using a proc)
 * Inline eval methods (using a string) - deprecated.

Method references and callback objects are the recommended approaches, inline methods using a proc are sometimes appropriate (such as for creating mix-ins) and inline eval methods are deprecated.

Method Reference
The method reference callbacks work by specifying a protected or private method available in the object, like this:

Callback Objects
The callback objects have methods named after the callback, called with the record as the only parameter such as:

So you specify the object you want messaged on a given callback. When that callback is triggered the object has a method by the name of the callback messaged.

Proc
Example of using a Proc for a callback:

Inline Eval
The callback macros usually accept a symbol for the method they’re supposed to run, but you can also pass a "method string" which will then be evaluated within the binding of the callback. Example:

Notice that single plings (’) are used so the #{id} part isn’t evaluated until the callback is triggered. Also note that these inline callbacks can be stacked just like the regular ones:

before_save
This method is called before an ActiveRecord object is saved.

after_save
Once the active record object saved some method will be fired in that scenario we have to use the after_save callback.

before_create
called before creating a new object of the model

after_create
Called after creating new object and just before saving the records

Partially Documented Callbacks
The following callbacks are partially documented. Their use is discouraged because of performance issues.

after_find
The after_find callback is only executed if there is an explicit implementation in the model class. It will be called for each object returned from a find, and thus can potentially affect performance as noted in the Rails API Documentation.

after_initialize
The after_initialize method is only executed if there is an explicit implementation in the model class. It will be called whenever an ActiveRecord model is initialized. It will be called for each object returned from a find, and thus can potentially affect performance as noted in the Rails API documentation.

title: Ruby on Rails/ActiveRecord/Callbacks


text:
Ruby on Rails/ActiveRecord/Naming

Basics
ActiveRecord uses convention for naming classes, tables and fields. Rails uses convention over configuration. ActiveRecord expects applications to follow certain naming conventions. These conventions extend from file naming, class naming, table naming and more. By default classes are singular, tables are plural, primary keys are id and foreign keys are table_id.

Note: There are also certain names that are reserved and should not be used in your model for attributes outside of the conventions defined in Rails:

 * lock_version
 * type - This is only used when you have single table inheritance and must contain a class name
 * id - Reserved for primary keys
 * table_name_count - Reserved for counter cache
 * position - Reserved for acts_as_list
 * parent_id - Reserved for acts_as_tree
 * <tt>lft</tt> - Reserved for acts_as_nested_set
 * <tt>rgt</tt> - Reserved for acts_as_nested_set
 * <tt>quote</tt> - Method in ActiveRecord::Base which is used to quote SQL
 * <tt>template</tt>
 * <tt>class</tt>

Classes
ActiveRecord classes are named in singular form.

Tables
Tables for ActiveRecord objects are named in plural form by default. This pluralization is often an initial point of contention for new Rails users.

For a class named 'Dog', the default table name is 'Dogs'.

If you need to change the table name there are several ways to override the default behavior.

Set use_pluralization
In <tt>config/environment.rb</tt> you can specify <tt>ActiveRecord::Base.use_pluralization = false</tt>. This will apply to all ActiveRecord objects.

Use set_table_name
You can call <tt>set_table_name</tt> to specify a custom table name for a particular model.

For example:

Override table_name
You can also override the <tt>table_name</tt> method and return a value.

For example:

title: Ruby on Rails/ActiveRecord/Naming


text:
Ruby on Rails/ActiveRecord/Migrations

Migrations
Migrations meant to solve the problem of rolling out changes to your database. By defining the changes to your database schema in Ruby files, development teams can ensure that all changes to the database are properly versioned. Additionally migrations help to ensure that rolling out changes to fellow developers as well as other servers (development, QA, production) is handled in a consistent and manageable fashion.

Building a Migration
You can either build the migration on its own using

ruby script/generate migration Category

and write the specific commands afterwards (if you want to create custom SQL, this is the way to go) or you can create a model that comes with the migration using

ruby script/generate model Category name:string amount:integer

The console tells you that there were some files created and some already existent. As mentioned before, Rails will never overwrite existing files unless stated otherwise.

Now lets take a look at the migration

First of all, take a look at the number (20090409120944) in front of your file. This is the timestamp of your file and important for the creation of the database tables. This timestamp will always be different, depending on the exact time of the creation of your migration. The idea behind this is to have a "history" of all your migrations available.

But why is this important?

Imagine that you work on a Rails project and you create tables, alter columns or remove columns from your database via migrations. After some time, your client changes his mind and he wants only very basic features and you already started to create advanced features and altered the database. Because you can't remember all the changes that went into the database and their order, you will either spend a lot of time working on the database to have the "old" state available or you have to start from scratch because it would take too long to remember and redo all changes. This is where migration come in handy, because of the timestamp, Rails is able to recognize the changes in their actual order and all changes can be undone easily. Never alter the timestamp manually. This will certainly cause problems. For more on those topic, check out the "managing migrations" section

Speaking of undoing and redoing: notice the two methods inside your migration self.up and self.down. Both of them do exactly the opposite of each other. While self.up creates our categories table with all columns, self.down removes (drops) the table from the database with all its contents(!!). When Rails sees that the migration has not been moved to the database, it will use the self.up method, if you undo the migration, the self.down method gets executed. This way you can make sure that you will always be able to go back to a past state of your database. Keep in mind when writing own migrations always include a self.up and a self.down method to assure that the database state will be consistent after an rollback.

OK, let's start with the migration itself:

We want to create a table called categories(<tt>create_table :categories</tt>) that has a name and an amount column. Additionally Rails adds an timestamp for us where it will store the creation date and the update date for each row. Rails will also create an primary key called model_id that auto-increments (1,2,3,...) with every row.

You can choose from a variety of datatypes that go with ActiveRecord. The most common types are:

 * string
 * text
 * integer
 * decimal
 * timestamp
 * references
 * boolean

But wait, there is not yet a single table nor column in our database. We need to write the migration file into the database.

rake db:migrate

handles this job. The command is able to create the table and all the necessary columns inside the table. This command is not limited to migrating a single file so you can migrate an unlimited number of files at once. Rake also knows what migrations are already in the database so it won't overwrite your tables. For more info see "Managing Migrations".

To add a connection between your tables we want to add references in our model. References are comparable to foreign keys (Rails doesn't use foreign keys by default because not all databases can handle foreign keys but you can write custom SQL to make use of foreign keys) and tell your table where to look for further data.

Let's add another model to our already existent database. We want to create a category that has multiple products. So we need to reference this product in our category. We want to create a model:

ruby script/generate model Products name:string category:references

and insert it into the database

rake db:migrate

Note the type :references for the category. This tells Rails to create a column inside the database that holds a reference to our category. Inside our database there is now a <tt>category_id</tt> column for our product. (In order to work with these two models, we need to add associations inside our models, see Associations)

Managing Migrations
We already talked about how migrations can help you to organise your database in a very convenient manner. Now we will take a look at how this is achieved. You already know that the timestamp in the filename tells rails when the migration was created and Rake know what migrations are already inside the database.

To restore the state of the database as it was, say 5 migrations before the current, we can use $rake db:rollback STEP=5 This will undo the last 5 migrations that have been committed to the database.

To redo the last 5 steps, we can use a similar command $ rake db:migrate:redo STEP=5

You can also rollback or redo a specific version of a migration state, you just need to provide the timestamp: $ rake db:migrate:up VERSION=20080906120000 Choose whether you want the db_migrate:up method to be executed or the db_migrate:down method

Keep in mind, that restoring your database to a previous state will delete already inserted data completely!

Schema Method Reference
The following methods are available to define your schema changes in Ruby:

 * <tt>create_table(name, options)</tt>: Creates a table called name and makes the table object available to a block that adds columns to it, following the same format as <tt>add_column</tt>. See example above. The options hash is for fragments like "DEFAULT CHARSET=UTF-8" that are appended to the create table definition.
 * <tt>drop_table(name)</tt>: Drops the table called name.
 * <tt>rename_table(old_name, new_name)</tt>: Renames the table called old_name to new_name.
 * <tt>add_column(table_name, column_name, type, options)</tt>: Adds a new column to the table called table_name named column_name specified to be one of the following types: :string, :text, :integer, :float, :datetime, :timestamp, :time, :date, :binary, :boolean. A default value can be specified by passing an options hash like { :default => 11 }.
 * <tt>rename_column(table_name, column_name, new_column_name)</tt>: Renames a column but keeps the type and content.
 * <tt>change_column(table_name, column_name, type, options)</tt>: Changes the column to a different type using the same parameters as <tt>add_column</tt>.
 * <tt>remove_column(table_name, column_name)</tt>: Removes the column named column_name from the table called table_name.
 * <tt>add_index(table_name, column_names, index_type, index_name)</tt>: Add a new index with the name of the column, or index_name (if specified) on the column(s). Specify an optional index_type (e.g. UNIQUE).
 * <tt>remove_index(table_name, index_name)</tt>: Remove the index specified by index_name.

Command Reference

 * <tt>rake db:create[:all]</tt>: If :all not specified then create the database defined in config/database.yml for the current RAILS_ENV. If :all is specified then create all of the databases defined in config/database.yml.
 * <tt>rake db:fixtures:load</tt>: Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y
 * <tt>rake db:migrate [VERSION=n]</tt>: Migrate the database through scripts in db/migrate. Target specific version with VERSION=n
 * <tt>rake db:migrate:redo [STEP=n]</tt>: (2.0.2) Revert the database by rolling back "STEP" number of VERSIONS and re-applying migrations.
 * <tt>rake db:migrate:reset</tt>: (2.0.2) Drop the database, create it and then re-apply all migrations. The considerations outlined in the note to rake db:create apply.
 * <tt>rake db:reset</tt>: Drop and re-create database using db/schema.rb. The considerations outlined in the note to rake db:create apply.
 * <tt>rake db:rollback [STEP=N]</tt>: (2.0.2) Revert migration 1 or n STEPs back.
 * <tt>rake db:schema:dump</tt>: Create a db/schema.rb file that can be portably used against any DB supported by AR
 * <tt>rake db:schema:load</tt>: Load a schema.rb file into the database
 * <tt>rake db:sessions:clear</tt>: Clear the sessions table
 * <tt>rake db:sessions:create</tt>: Creates a sessions table for use with CGI::Session::ActiveRecordStore
 * <tt>rake db:structure:dump</tt>: Dump the database structure to a SQL file
 * <tt>rake db:test:clone</tt>: Recreate the test database from the current environment's database schema
 * <tt>rake db:test:clone_structure</tt>: Recreate the test databases from the development structure
 * <tt>rake db:test:prepare</tt>: Prepare the test database and load the schema
 * <tt>rake db:test:purge</tt>: Empty the test database

You can obtain the list of commands at any time using <tt>rake -T</tt> from within your application's root directory.

You can get a fuller description of each task by using <tt>rake --describe task:name:and:options</tt>

title: Ruby on Rails/ActiveRecord/Migrations


text:
Ruby on Rails/ActiveRecord/Attributes

Attributes
ActiveRecord attributes are automatically determined from the underlying database schema.

Basic Usage
All of the columns in a table are accessible through methods on the ActiveRecord model. For example:

Consider the following migration:

Because Rails has created a primary key for us and called it "id" we can already search for it inside the database. We can interact with the database via the build-in console: ruby script/console gives us a console that let us communicate with Rails.

Before we can select data from our database it is time to insert some products

>> Product.new(:name => "my book", :price => 14.99, :amount => 4).save if everything went right, Rails will show you a =>true inside the console... Let's add some more products

>> Product.new(:name => "my movie", :price => 4.89 :amount => 1).save

>> Product.new(:name => "my cd", :price => 9.98, :amount => 12).save

Now we have 3 products in our database, going from 1 to 3...

So let's select the first entry

>>Product.find(1)

and Rails tells you what it found for this id (remember: find only works when there is a Rails generated id as primary key)

=> #

so we are able to tell Rails to look for our entry with a specific id. But what happens when we have thousands of entries in our database? We can't remember every id of a Product, so Rails offers a very nifty solution:

>>Product.find_by_name("my book")

=> #

and Rails gives as the output we wanted. This not only works for the name, but for all columns in the database. We could also use .find_by_price or .find_by_amount

Or you can search for multiple products with their id:

>>Product.find(1,3)

=> #

You can also search for all products

>>Product.all

or

>>Products.find(:all)

for the first or the last product in your table

>>Product.first/last

or

>>Product.find(:first/:last)

If you want more controll over your data, you can use many build-in options or use custom SQL. Let's try to find our data in descending order (3,2,1)

>>Product.all(:order => "id DESC")

or alternatively

>>Product.find(:all, :order => "id DESC")

will give you all your products, starting with the last inserted id - in our case: 3

When we query our database we get lots of infos we are not really interested in such as the "created_at" and "updated_at" column. We only want to take a look at our id and the name so we may use

>>Product.all(:select => "id, name")

or

>>Product.find(:all, :select => "id, name")

This method will only display the name and the id of our products making it way more readable.

When searching for data, keep in mind that you can combine all these methods to your liking. To see more possibilities check out the RoR guide or the API.

Overriding Attributes
You can override any of the accessor methods in your ActiveRecord model classes in order to add logic. For example:

p = Product.new

p.name

=> "Unknown"

p.name = 'my disk'

p.name

=> "my disk"

You can access any attribute via self[attribute_name] (to get) or self[attribute_name]= (to set).

title: Ruby on Rails/ActiveRecord/Attributes


text:
Ruby on Rails/Getting Started/Creating a Rails application

Using the rails command
On the command line type  replacing appname with the name of your application. This will create a directory called appname and will create the Rails application directory structure under that directory. The appname directory will be called the home directory for the application from here on. Typical list of folders and files in rails application would look like following          app          components          config          db           doc          lib          log          public         Rakefile         README          script          test          tmp          vendor

Using SVN
If you are using Subversion another option for creating new Rails apps is to create a fresh Rails app using the <tt>rails</tt> command, making changes that are common (i.e. add .ignore options for Subversion, set up standard plugins you always use, add database.yml.example, etc) and then commit it to Subversion under something like 'railsapp'. You can then check out into a new directory to construct the Rails app:

svn copy /rails/railsapp /rails/new_app svn checkout /rails/new_app


text:
Ruby on Rails/Getting Started/Running the Server

The bundled WEBrick server
As you already know, Rails comes with an integrated server: WEBrick. WEBrick is a Ruby-written server to get you started right from the beginning. There are alternatives such as Mongrel or Phusion Passenger (formerly known as mod_ruby, a module for Apache). For local(!!) development WEBrick is a good choice.

To start up the server, simply open up a console, navigate to your Rails application and type
 * On Windows, OS X and Linux: ruby script/server

After some seconds, WEBrick has been initialized and you are ready to go. The console with the web server needs to stay open, otherwise the server will shut down. To see if everything is working as expected, open up your web browser and navigate to http://localhost:3000

You should see the default Rails start page saying that everything is working correctly. You can view the details page (name) for the current version of your environment and some other variables. The server console not only runs the server, but shows how the requests by the browser are processed, including the amount of queries, the used SQL syntax or the data from your submitted forms. There are several options, including but not limited to:
 *  -p port: Specify the port to run on
 * -b ip: Bind to a specific IP address
 * -e name: Use a specific Rails environment (like production)
 * -d: Run in daemon mode
 * -h: Display a help message with all command-line options

Mongrel
To start a single mongrel instance: mongrel_rails start This should be executed in the root directory of the Rails app you wish to run on Mongrel. There are numerous options you can specify, including:
 * On all platforms:

 * -p port: run on a specific port
 * -e environment: execute with a specific Rails environment, like <tt>production</tt>
 * <tt>-d</tt>: run in daemon mode


text:
Ruby on Rails/Contributors

A list of contributors to this book.

 * User:Aeden
 * User:Leethal
 * User:Zeus111
 * User:Ebraminio

Add your name to the list if you feel like it. No need to pay us or rub our backs.

title: Ruby on Rails/Contributors


text:
Cookbook:Pulikkachal (Tamil Spiced Tamarind Paste)

Pulikkachal, alternately spelled pulikachal, is a spiced tamarind paste. It is commonly mixed with rice to make tamarind rice (Puliyodharai).

Ingredients

 * 1 tsp coriander seeds (dhaniya)
 * 1 tsp fenugreek seeds
 * 1 tsp sesame seeds
 * 3 tbsp oil
 * 1 tsp urad dhal (black gram)
 * 1 tsp channa dhal (split chick-peas)
 * 4 red chiles
 * 1 cup tamarind extract
 * Salt
 * ¼ tsp asafoetida

 * Peanuts (optional)

Procedure

 * 1) Roast the coriander, fenugreek, and sesame seeds without oil. Grind into fine powder.
 * 2) Heat oil in a pan and add urad dhal, chickpeas and red chilies and fry for a few minutes. Add tamarind extract and salt. Allow it to boil. Add the ground spice powder and asafoetida, and mix well.
 * 3) Stir constantly until it becomes thick and the oil floats on the top of the mixture and it comes without sticking to the pan. Refrigerate and store.
 * 4) You can mix this with cooked rice and serve.


text: File:Rails logo.png

title: File:Rails logo.png


text:
Talk:Spanish/Lessons/¿Cómo te llamas?

The anki deck download is not available. - anonymous

Dialogue needs to be revised. "Regular" is hardly ever used in Spanish in this context. Other suggested words could be "bien," "fenómeno" (Arg.), "tranquilo/a." After "Qué tal?" the answer should be "Mal", not "Malo/a." 70.81.5.195 09:10, 30 December 2006 (UTC)

I would like the audio in a mp3 format so students with less computer knowledge can benifit from hearing the spoken word as I have never heard of ogg and I know alot of other people who also have not. Thanks MineAlways 12/31/06

wrong link
the link to the sound file for "¿Cómo se deletrea?" points to the sound file for "Que tál"
 * Yes, I was about to tell the same. I am removing the incorrect link from this featured book. Gracias V ani s che nuMail me/Talk 11:12, 21 September 2012 (UTC)

about double r
"el pupitre" is not considered a separate letter (and has never been).

More correct imposible --AleG2 20:12, 12 May 2007 (UTC)

about v and b
Though in some regions (e.g. Valladolid) v and b are pronounced differently, the norm is that they sound exactly the same (as can be seen in http://buscon.rae.es/draeI/SrvltGUIBusUsual?LEMA=v&TIPO_BUS=3&TIPO_HTML=2)

more about v and b
The author's explanation that there is "no difference" in the pronunciation of b and v is just dead wrong. It only applies in some circumstances. There are many examples where this would not apply. For example ventana (window) and vento (wind) are both pronounced with a V sound (as in Victor) not a B sound. You would never hear a native speaker pronounce it otherwise. This is such a basic elemental mistake that it calls into question the authority of the author to write this e-book. The author does not appear to be a native Spanish speaker. If you are just beginning to learn Spanish, I think you would be better served to find a textbook written by a native Spanish speaker with the proper credentials to back it up. The last thing you want to do is invest a lot of time learning a new language only to find out you learned a bunch of bad habits.
 * There are numerous authors of this page and the person who inserted this sentence on 4th April 2007 was editing anonymously, so we can't know how much of the rest of the book they are responsible for. If you see an error, you are free to correct it. Recent Runes (talk) 02:21, 1 January 2010 (UTC)
 * Not being a native speaker but having studied Spanish linguistics as well as having travelled most of the Spanish-speaking countries, I have to contradict this comment. Don't assume, because of your own experience, that something is exclusively or is absolutely not the case. Spanish exists in such a variety of pronunciation, that a universal truth can't be claimed. To just highlight one of the "truths" being claimed by the commenting person: "ventana" is pronounced with a more "b"-like sound by most of my acquaintances while the "v" in "viento" (note the spelling error!) tends to sound more like the "v" in "Victor".

In my very own experience (intensive immersion and dedicated studies for over 20 years) I have found there to be a tendency of having the same pronounciation for v and b. And certainly this is the most suitable approach for a beginner. I do not concur at all with the comment. More so I believe it to be preposterous to question the authority of the writer. Please be aware of the everlasting rivalries of different versions of Spanish. Although most of them claim to be "the ultimate" Spanish, all of them exist equally. It's not in the interest of the beginner to complicate the situation unnecessarily. Just go with the version of your teacher or your material in question. You will understand any kind of Spanish as well as being understood by any Spanish speaker eventually. Tropensachse (discuss • contribs) 14:25, 14 January 2015 (UTC)

Alphabet
This lesson page makes a few apparently inaccurate claims about the Spanish alphabet:
 * 1) that "ch" is no longer considered a separate letter but merely a digraph
 * 2) that "ll" is no longer considered a separate letter but merely a digraph
 * 3) that "rr" is considered a distinct Spanish letter

From my understanding, "rr" has never been considered a separate letter. "ch" and "ll" are still considered separate letters, except for collation purposes. Is there some reference to back up those claims? Rodasmith 03:52, 17 October 2007 (UTC)

Well, I was bold and changed the lesson page per my understanding. Feel free to revert and explain if you think I'm mistaken. Rodasmith 04:09, 17 October 2007 (UTC)

Double 'r'
I'm afraid this is not correct: "r at the beginning of a word or when doubled (rr), it is pronounced as a full trill (IPA: /r/), [b]elsewhere[/b] it is a single-tap trill (IPA: /ɾ/)" 'R' is also pronounced like rr in the middle of some words like 'enredo', 'alrededor', 'enrabietar' It is used in words in wich the 'r' takes place as the begining of a syllable. So I am going to put 'syllable' instead of 'word'. I hope not to use my deficient English. —Preceding unsigned comment added by 84.125.39.236 (discuss • contribs)

 * Well, as you point out, it is trilled after an n or l. It's also trilled after an s (e.g. in Israel), but otherwise, it's just tapped at the beginning of a syllable.   I've adjusted your edit accordingly.  Rodasmith (talk) 15:35, 1 July 2008 (UTC)

Fatal in English
Personally, I've never heard "fatal" as a response to "how are you" in English... if this part is to be included, it might be useful to mention where this usage is common... would it be reasonable to say that the Spanish "fatal" corresponds well to English "terrible"?

After re-reading the section, the table itself seems okay, translating Spanish 'fatal' as English 'very bad'... the confusing part (to me) is the sentence that reads:

 * Similarly, "Fatal" in the U.S. might mean a ruined manicure or a fight with one´s girlfriend, but would be reserved more for things like losing one's home in a Spanish-speaking country.

Since "fatal" is also a word in English, perhaps the writer means:

"very bad" in the U.S. ... but "fatal" in Spanish ...

Or, perhaps there are dialects that use "fatal" in English in these situations, but I'm not familiar with them.

mal or malo
the exercise "How are you" lists five words to be put in order - in the exercise the word 'mal' is used but in the answers it becomes 'malo' - can this be corrected by someone who knows the answer?

Error in word stress?
I wonder if there is an error near the end of this section, visible in the following quote:

''Monosyllables do not need accent marks – there is no need to mark the stressed syllable. However, the accent mark is used to distinguish between homographs, which are different words written with the same letters: sí (yes), si (if); tú (you, subject pronoun), tu (your, possessive adjective), él (he/him) & el (the). It is used on interrogative words, distinguishing them from in relative pronoun pairs: cómo (how?) & como (as), dónde (where?) & donde (where).''

Now in the last sentence, in the bolded text, is this still about pronouns? Perhaps it could be clarified further. 65.39.105.15 (discuss) 14:22, 16 September 2023 (UTC)

fatal
I suggest you omit all mention of U.S. in this section. To say people in the U.S. overexaggerate their slight misfortunes may be very true but is not relevant to learning a language, when United Statesians by and large only speak English and can not possibly have their own Spanish-speaking conventions like the more liberal use of the word 'fatal' suggested here.

 * Notes

For some of the words above, there are two options. The one ending in "o" is for males, and the one ending in "a" is for females. It's all to do with agreement, which is covered in future chapters.

Also, there are cultural differences in how people respond to "How are you?". In the U.S., we might answer "mal" if we have a headache, or we're having a bad hair day. In Spanish-speaking cultures, "mal" would be used if a family member were very ill, or somebody lost their job. Similarly, "fatal" in the U.S. might mean a ruined manicure or a fight with one´s girlfriend, but would be reserved more for things like losing one's home in a Spanish-speaking country. 65.39.105.15 (discuss) 22:58, 19 September 2023 (UTC)

title: Talk:Spanish/Lessons/¿Cómo te llamas?


text:
Talk:Spanish/Lessons/¿Qué te gusta hacer?

Revise dialogue. "¿Te gusta los deportes?" should say "¿Te gustan los deportes?" since GUSTAR refers to the object, which, in this sentence is plural (los deportes). I had never heard "chifla" in that context before. I would use "Me enloquece jugar..." or "Disfruto jugar..." The Spanish structure for the verb JUGAR is "jugar a." Therefore, the phrase should read "... jugar al baloncesto." "Practico la natación" is awkward. Phrase should read "Practico natación." Readers should note that the verb conjugation for Vosotros is used mainly in Spain, not Latin America. 70.81.5.195 09:26, 30 December 2006 (UTC)
 * Thanks for that!
 * "gusta" was a typo; I've got it correct further down.
 * Can we not say "Me gusta jugar..."?
 * My bad. Sorry; it is now corrected
 * My bad again; fixed.
 * Yes, I'm still not sure where to put that note - probably in lesson one.
 * Once again, thanks again! If you asee any more errors anywhere, please feel free to leave me a note, or fix them yourself. Saludos! Celestianpower 11:48, 30 December 2006 (UTC)

"Que" without accent in a question
Two of the examples say "Que opinas sobre" (four say "Qué opinas sobre"). Are those typos? --AVRS (talk) 11:28, 7 February 2010 (UTC)

Stem changing verbs, latin america / spain second person plural
In previous chapters, the second person plural is noted as being exclusive to Spain (that is, not used in Latin America). This particular instance of verb variation instruction does not include such an indication. So is JUGAR an exception to this custom, or was the designation as Spain-Spanish-Only omitted inadvertently?

== Stem-changing Verbs[edit | edit source] == Jugar the first type of irregular verb; known as a stem-changing verb. Basically, in the "I", "you", "he/she/it" and "they" forms, the u or o changes to a ue. The jugar example is written out below. 65.39.105.15 (discuss) 22:29, 19 September 2023 (UTC)


text:
User:Aphedox

I'm new to this whole wiki thing but I'm sure I'll find a niche.

title: User:Aphedox