Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions railties/doc/guides/source/es/empezando_con_rails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,19 @@ En cualquier caso, Rails creará un folder en tu directorio de trabajo llamado +
`-----------`-----------------------------------------------------------------------------------------------------------------------------
File/Folder Purpose
------------------------------------------------------------------------------------------------------------------------------------------
+README+ Este es un breve manual de instrucciones para tu aplicación. Úsalo para explicar a los demás lo que hace tu aplicación, como configurarla y demás temas.
+Rakefile+ Este archivo contiene tareas que se pueden ejecutar desde la terminal.
+app/+ Contiene los Controladores, Modelos y Vistas de tu aplicación. Durante el resto de esta guía te enfocarás en este directorio.
+config/+ Guarda las configuraciones de las rutas, bases de datos y características del tiempo de ejecución de la aplicación.
+db/+ Guarda el esquema actual de la base de datos así como las migraciones de base de datos. Pronto aprenderás sobre migraciones.
+doc/+ Documentación detallada de tu aplicación.
+lib/+ Módulos extendidos para tu aplicación (no se cubren en esta guía).
+log/+ Archivos de log de la aplicación.
+public/+ El único directorio que se muestra al mundo como tal. Aquí es donde se guardan tus imágenes, javascripts, hojas de estilo (CSS) y otros archivos estáticos.
+script/+ Scripts provistos por Rails para realizar tareas frecuentes tales como benchmarking?, instalación de plugins, arranque de la consola y del servidor web.
+test/+ Pruebas unitarias, fixtures y artefactos para pruebas. Éstas se documentan en link:../testing_rails_applications.html[Testing Rails Applications]
+tmp/+ Archivos temporales.
+vendor/+ Este es el lugar para el código de terceros. En una aplicación Rails, esto incluye Ruby Gems, el código fuente de Rails (si lo instalaste en tu proyecto) y plugins conteniendo funcionalidad adicional.
+README+ Este es un breve manual de instrucciones para tu aplicación. Úsalo para explicar a los demás lo que hace tu aplicación, como configurarla y demás temas.
+Rakefile+ Este archivo contiene tareas que se pueden ejecutar desde la terminal.
+app/+ Contiene los Controladores, Modelos y Vistas de tu aplicación. Durante el resto de esta guía te enfocarás en este directorio.
+config/+ Guarda las configuraciones de las rutas, bases de datos y características del tiempo de ejecución de la aplicación.
+db/+ Guarda el esquema actual de la base de datos así como las migraciones de base de datos. Pronto aprenderás sobre migraciones.
+doc/+ Documentación detallada de tu aplicación.
+lib/+ Módulos extendidos para tu aplicación (no se cubren en esta guía).
+log/+ Archivos de log de la aplicación.
+public/+ El único directorio que se muestra al mundo como tal. Aquí es donde se guardan tus imágenes, javascripts, hojas de estilo (CSS) y otros archivos estáticos.
+script/+ Scripts provistos por Rails para realizar tareas frecuentes tales como benchmarking?, instalación de plugins, arranque de la consola y del servidor web.
+test/+ Pruebas unitarias, fixtures y artefactos para pruebas. Éstas se documentan en link:../testing_rails_applications.html[Testing Rails Applications]
+tmp/+ Archivos temporales.
+vendor/+ Este es el lugar para el código de terceros. En una aplicación Rails, esto incluye Ruby Gems, el código fuente de Rails (si lo instalaste en tu proyecto) y plugins conteniendo funcionalidad adicional.
-------------------------------------------------------------------------------------------------------------------------------------------

=== Configurando una base de datos
Expand Down Expand Up @@ -207,9 +207,9 @@ Si no estás utilizando OS X 10.5 o más reciente, necesitarás instalar la gema
$ gem install sqlite3-ruby
-------------------------------------------------------

==== Configuring a MySQL Database
==== Configurando una base de datos MySQL

If you choose to use MySQL, your +config/database.yml+ will look a little different. Here's the development section:
Si eliges utilizar MySQL, tu +config/database.yml+ se verá un poco diferente. Esta es la configuración de un ambiente de desarrollo:

[source, ruby]
-------------------------------------------------------
Expand All @@ -221,11 +221,11 @@ development:
password:
socket: /tmp/mysql.sock
-------------------------------------------------------
If your development computer's MySQL installation includes a root user with an empty password, this configuration should work for you. Otherwise, change the username and password in the +development+ section as appropriate.
Si tu ordenador de desarrollo tiene una instalación de MySQL que incluye un usuario root con la contraseña vacia, esta configuración funcionará. De otro modo, deberás cambiar los datos de conexión en la sección de desarrollo por los apropiados.

==== Configuring a PostgreSQL Database
==== Configurando una base de datos PostgreSQL

If you choose to use PostgreSQL, your +config/database.yml+ will be customized to use PostgreSQL databases:
Si eliges utilizar una base de datos PostgreSQL, tu +config/database.yml+ deberás adaptarlo para utilizar la base de datos PostgreSQL:

[source, ruby]
-------------------------------------------------------
Expand All @@ -237,11 +237,11 @@ development:
password:
-------------------------------------------------------

Change the username and password in the +development+ section as appropriate.
Cambia el usuario y contraseña en la sección +development+ como sea apropiado a tu entorno para que la aplicación pueda conectarse.

== Hello, Rails!
== Hola, Rails!

One of the traditional places to start with a new language is by getting some text up on screen quickly. To do that in Rails, you need to create at minimum a controller and a view. Fortunately, you can do that in a single command. Enter this command in your terminal:
Una de las costumbres para comenzar con un nuevo lenguaje es mostrar un texto en la pantalla rapidamente. Para hacer eso en Rails, necesitarás crear un controlador mínimo y una vista. Afortunadamente, puedes hacer lo con un simple comando. Tipea este comando en tu terminal:

[source, shell]
-------------------------------------------------------
Expand Down Expand Up @@ -308,7 +308,7 @@ NOTE: For more information about routing, refer to link:../routing_outside_in.ht

== Getting Up and Running Quickly With Scaffolding

Rails _scaffolding_ is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.
Rails _scaffolding_ is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.

== Creating a Resource

Expand All @@ -329,7 +329,7 @@ File Purpose
------------------------------------------------------------------------------------------------------------------------------------------
app/models/post.rb The Post model
db/migrate/20081013124235_create_posts.rb Migration to create the posts table in your database (your name will include a different timestamp)
app/views/posts/index.html.erb A view to display an index of all posts
app/views/posts/index.html.erb A view to display an index of all posts
app/views/posts/show.html.erb A view to display a single post
app/views/posts/new.html.erb A view to create a new post
app/views/posts/edit.html.erb A view to edit an existing post
Expand Down Expand Up @@ -445,14 +445,14 @@ After the console loads, you can use it to work with your application's models:
[source, shell]
-------------------------------------------------------
>> p = Post.create(:content => "A new post")
=> #<Post id: nil, name: nil, title: nil, content: "A new post",
=> #<Post id: nil, name: nil, title: nil, content: "A new post",
created_at: nil, updated_at: nil>
>> p.save
=> false
>> p.errors
=> #<ActiveRecord::Errors:0x23bcf0c @base=#<Post id: nil, name: nil,
title: nil, content: "A new post", created_at: nil, updated_at: nil>,
@errors={"name"=>["can't be blank"], "title"=>["can't be blank",
=> #<ActiveRecord::Errors:0x23bcf0c @base=#<Post id: nil, name: nil,
title: nil, content: "A new post", created_at: nil, updated_at: nil>,
@errors={"name"=>["can't be blank"], "title"=>["can't be blank",
"is too short (minimum is 5 characters)"]}>
-------------------------------------------------------

Expand Down Expand Up @@ -809,7 +809,7 @@ class PostsController < ApplicationController
# ...
def show
@post = Post.find(params[:id])
# ...
# ...
end

def edit
Expand All @@ -836,7 +836,7 @@ class PostsController < ApplicationController
before_filter :find_post, :only => [:show, :edit, :update, :destroy]
# ...
def show
# ...
# ...
end

def edit
Expand Down Expand Up @@ -865,7 +865,7 @@ For more information on filters, see the link:actioncontroller_basics.html[Actio

Now that you've seen what's in a model built with scaffolding, it's time to add a second model to the application. The second model will handle comments on blog posts.

=== Generating a Model
=== Generating a Model

Models in Rails use a singular name, and their corresponding database tables use a plural name. For the model to hold comments, the convention is to use the name Comment. Even if you don't want to use the entire apparatus set up by scaffolding, most Rails developers still use generators to make things like models and controllers. To create the new model, run this command in your terminal:

Expand Down Expand Up @@ -1035,7 +1035,7 @@ class CommentsController < ApplicationController
render :action => "new"
end
end

def edit
@post = Post.find(params[:post_id])
@comment = Comment.find(params[:id])
Expand All @@ -1050,7 +1050,7 @@ class CommentsController < ApplicationController
render :action => "edit"
end
end

end
-------------------------------------------------------

Expand Down Expand Up @@ -1194,15 +1194,15 @@ As a final step, I'll modify the +show.html.erb+ view for a post to show the com

<h2>Comments</h2>
<% @post.comments.each do |c| %>
<p>
<b>Commenter:</b>
<%=h c.commenter %>
</p>

<p>
<b>Comment:</b>
<%=h c.body %>
</p>
<p>
<b>Commenter:</b>
<%=h c.commenter %>
</p>

<p>
<b>Comment:</b>
<%=h c.body %>
</p>
<% end %>

<%= link_to 'Edit', edit_post_path(@post) %> |
Expand Down