From 3979812999023e3c11ade95ca5442374ab5f95b8 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Fri, 13 Jan 2012 10:51:53 -0500 Subject: Getting Started Guide: Update reference about JavaScript runtimes --- railties/guides/source/getting_started.textile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index a36f84e9fd..63e0173e3f 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -447,7 +447,13 @@ start a web server on your development machine. You can do this by running: $ rails server -TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the absence of a runtime will give you an +execjs+ error. Usually Mac OS X and Windows come with a JavaScript runtime installed. +therubyracer+ and +therubyrhino+ are the commonly used runtimes for Ruby and JRuby respectively. You can also investigate a list of runtimes at "ExecJS":https://github.com/sstephenson/execjs. +TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and +the absence of a runtime will give you an +execjs+ error. Usually Mac OS X +and Windows come with a JavaScript runtime installed. +therubyracer+ gem is +added commented to Gemfile for new apps and you can uncomment if you need it. ++therubyrhino+ is the recommended runtime for JRuby users and is added by default +to Gemfile in apps generated under JRuby. You can investigate about all the +supported runtimes at "ExecJS":https://github.com/sstephenson/execjs#readme. This will fire up an instance of the WEBrick web server by default (Rails can also use several other web servers). To see your application in action, open a -- cgit v1.2.3 From 4871433519901c024477a969563aa9d160d08590 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Fri, 13 Jan 2012 20:05:42 -0500 Subject: Mention how use config.assets.prefix to avoid conflicting with an existing "/assets" route --- railties/guides/source/3_1_release_notes.textile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/3_1_release_notes.textile b/railties/guides/source/3_1_release_notes.textile index bfe6db4651..f88d8624ba 100644 --- a/railties/guides/source/3_1_release_notes.textile +++ b/railties/guides/source/3_1_release_notes.textile @@ -46,13 +46,20 @@ gem 'jquery-rails' h5. config/application.rb -The asset pipeline requires the following additions: +* The asset pipeline requires the following additions: config.assets.enabled = true config.assets.version = '1.0' +* If your application is using the "/assets" route for a resource you may want change the prefix used for assets to avoid conflicts: + + +# Defaults to '/assets' +config.assets.prefix = '/asset-files' + + h5. config/environments/development.rb * Remove the RJS setting config.action_view.debug_rjs = true. -- cgit v1.2.3 From 04a05e58995b3c7c2949fbbd31a2cb669b8edc87 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Fri, 13 Jan 2012 23:14:10 -0700 Subject: Fix styling of example layout. Fixes #4461 --- railties/guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/guides') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 63e0173e3f..d2031027c8 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -844,7 +844,7 @@ below: <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> - + <%= yield %> -- cgit v1.2.3 From 2d76d1f4752c18cd6c72c42fedb07219d68a88c4 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 15 Jan 2012 14:30:23 -0200 Subject: Improve description of :allow_destroy option for nested attributes in getting started guide --- railties/guides/source/getting_started.textile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index d2031027c8..4a0b6959fb 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -447,11 +447,11 @@ start a web server on your development machine. You can do this by running: $ rails server -TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and -the absence of a runtime will give you an +execjs+ error. Usually Mac OS X +TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and +the absence of a runtime will give you an +execjs+ error. Usually Mac OS X and Windows come with a JavaScript runtime installed. +therubyracer+ gem is added commented to Gemfile for new apps and you can uncomment if you need it. -+therubyrhino+ is the recommended runtime for JRuby users and is added by default ++therubyrhino+ is the recommended runtime for JRuby users and is added by default to Gemfile in apps generated under JRuby. You can investigate about all the supported runtimes at "ExecJS":https://github.com/sstephenson/execjs#readme. @@ -1695,10 +1695,10 @@ class Post < ActiveRecord::Base end -The +:allow_destroy+ option on the nested attribute declaration tells Rails to -display a "remove" checkbox on the view that you'll build shortly. The -+:reject_if+ option prevents saving new tags that do not have any attributes -filled in. +The +:allow_destroy+ option tells Rails to enable destroying tags through the +nested attributes (you'll handle that by displaying a "remove" checkbox on the +view that you'll build shortly). The +:reject_if+ option prevents saving new +tags that do not have any attributes filled in. We will modify +views/posts/_form.html.erb+ to render a partial to make a tag: -- cgit v1.2.3 From 3cf22c8ab5294a332c6f4e20174c50165265f1d1 Mon Sep 17 00:00:00 2001 From: Dan Pickett Date: Sun, 15 Jan 2012 15:08:01 -0500 Subject: change class to id per scaffold change #4472 --- railties/guides/source/getting_started.textile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 4a0b6959fb..084ea6780d 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -1014,7 +1014,7 @@ by its id value. After finding the record, Rails displays it by using +app/views/posts/show.html.erb+: -

<%= notice %>

+

<%= notice %>

Name: @@ -1281,7 +1281,7 @@ So first, we'll wire up the Post show template (+/app/views/posts/show.html.erb+) to let us make a new comment: -

<%= notice %>

+

<%= notice %>

Name: @@ -1347,7 +1347,7 @@ template. This is where we want the comment to show, so let's add that to the +app/views/posts/show.html.erb+. -

<%= notice %>

+

<%= notice %>

Name: @@ -1429,7 +1429,7 @@ Then you can change +app/views/posts/show.html.erb+ to look like the following: -

<%= notice %>

+

<%= notice %>

Name: @@ -1500,7 +1500,7 @@ create a file +app/views/comments/_form.html.erb+ containing: Then you make the +app/views/posts/show.html.erb+ look like the following: -

<%= notice %>

+

<%= notice %>

Name: @@ -1771,7 +1771,7 @@ Finally, we will edit the app/views/posts/show.html.erb template to show our tags. -

<%= notice %>

+

<%= notice %>

Name: @@ -1831,7 +1831,7 @@ Now you can edit the view in app/views/posts/show.html.erb to look like this: -

<%= notice %>

+

<%= notice %>

Name: -- cgit v1.2.3 From 1d170e36a239799a55e513ff3b259cc95e80d574 Mon Sep 17 00:00:00 2001 From: Richard Hulse Date: Mon, 16 Jan 2012 11:15:30 +1300 Subject: [docs] Update pipeline asset organization section. * Calified how assets are included. * Added information about using index manifests. --- railties/guides/source/asset_pipeline.textile | 61 +++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile index da7d46ef71..2ea307d005 100644 --- a/railties/guides/source/asset_pipeline.textile +++ b/railties/guides/source/asset_pipeline.textile @@ -109,22 +109,75 @@ NOTE: You must have an "ExecJS":https://github.com/sstephenson/execjs#readme sup h4. Asset Organization -Assets that must be precompiled can be placed inside an application in one of three locations: +app/assets+, +lib/assets+ or +vendor/assets+. +Pipeline assets can be placed inside an application in one of three locations: +app/assets+, +lib/assets+ or +vendor/assets+. +app/assets+ is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets. +lib/assets+ is for your own libraries' code that doesn't really fit into the scope of the application or those libraries which are shared across applications. -+vendor/assets+ is for assets that are owned by outside entities, such as code for JavaScript plugins. ++vendor/assets+ is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks. -All subdirectories that exist within these three locations are added to the search path for Sprockets. You can see this search path by inspecting +Rails.application.config.assets.paths+ in the Rails console. When a client requests an asset, these paths are traversed (in the order that they occur in the search path) to see if they contain an asset matching the name specified. If an asset is found, it's processed by Sprockets and served. +h5. Search paths -You can add additional (fully qualified) paths to the pipeline in +config/application.rb+. For example: +When a file is referenced from a manifest or a helper, Sprockets searches the three default asset locations for it. + +The default locations are: The subdirectory +images+ under +app/assets+, and the subdirectories +javascripts+ and +stylsheets+ in all three asset locations. + +For example, these files: + +app/assets/javascripts/home.js +lib/assets/javascripts/moovinator.js +vendor/assets/javascript/slider.js + + +would be referenced in a manfest like this: + + +//= require home +//= require moovinator +//= require slider + + +Asset in subdirectories can also be accessed. + + +app/assets/javascripts/sub/something.js + + +is referenced as: + + +//= require sub/something + + +You can view the search path by inspecting +Rails.application.config.assets.paths+ in the Rails console. + +Additional (fully qualified) paths can be added to the pipeline in +config/application.rb+. For example: config.assets.paths << Rails.root.join("app", "assets", "flash") +Paths are traversed in the order that they occur in the search path. + +It is important to note that files you want to reference outside a manifest must be added to the precompile array or they will not be available in the production environment. + +h5. Using index files + +Sprockets uses files named +index+ (with the relevant extensions) for a special purpose. + +To explain by example, if you have a jQuery library with many modules this can be stored in +lib/assets/library_name+. + +The file +lib/assets/library_name/index.js+ serves as the manifest for all files in this library. This file could include a list of all the required files in order, or a simple require_tree directive. + +The library as a whole can be accessed in the site's application manifest like so: + + +//= require library_name + + +This simplifies maintainance and keeps things clean by allowing related code to be grouped before inclusion elsewhere. + h4. Coding Links to Assets Sprockets does not add any new methods to access your assets - you still use the familiar +javascript_include_tag+ and +stylesheet_link_tag+. -- cgit v1.2.3 From ddc63fbbc145b349f20d65c8be76be8126a23477 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 16 Jan 2012 22:03:59 +0530 Subject: copy editing asset pipeline changes --- railties/guides/source/asset_pipeline.textile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile index 2ea307d005..ff2bd08602 100644 --- a/railties/guides/source/asset_pipeline.textile +++ b/railties/guides/source/asset_pipeline.textile @@ -121,16 +121,17 @@ h5. Search paths When a file is referenced from a manifest or a helper, Sprockets searches the three default asset locations for it. -The default locations are: The subdirectory +images+ under +app/assets+, and the subdirectories +javascripts+ and +stylsheets+ in all three asset locations. +The default locations are: +app/assets/images+ and the subdirectories +javascripts+ and +stylesheets+ in all three asset locations. For example, these files: + app/assets/javascripts/home.js lib/assets/javascripts/moovinator.js vendor/assets/javascript/slider.js -would be referenced in a manfest like this: +would be referenced in a manifest like this: //= require home @@ -138,7 +139,7 @@ would be referenced in a manfest like this: //= require slider -Asset in subdirectories can also be accessed. +Assets inside subdirectories can also be accessed. app/assets/javascripts/sub/something.js @@ -166,9 +167,7 @@ h5. Using index files Sprockets uses files named +index+ (with the relevant extensions) for a special purpose. -To explain by example, if you have a jQuery library with many modules this can be stored in +lib/assets/library_name+. - -The file +lib/assets/library_name/index.js+ serves as the manifest for all files in this library. This file could include a list of all the required files in order, or a simple require_tree directive. +For example, if you have a jQuery library with many modules, which is stored in +lib/assets/library_name+, the file +lib/assets/library_name/index.js+ serves as the manifest for all files in this library. This file could include a list of all the required files in order, or a simple require_tree directive. The library as a whole can be accessed in the site's application manifest like so: @@ -176,7 +175,7 @@ The library as a whole can be accessed in the site's application manifest like s //= require library_name -This simplifies maintainance and keeps things clean by allowing related code to be grouped before inclusion elsewhere. +This simplifies maintenance and keeps things clean by allowing related code to be grouped before inclusion elsewhere. h4. Coding Links to Assets -- cgit v1.2.3 From 7af8ee7658cfcade1fb9949830ca78a98a97a367 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Mon, 16 Jan 2012 22:04:25 +0530 Subject: minor edits in getting started guide --- railties/guides/source/getting_started.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 084ea6780d..c77bc93cfb 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -449,8 +449,8 @@ $ rails server TIP: Compiling CoffeeScript to JavaScript requires a JavaScript runtime and the absence of a runtime will give you an +execjs+ error. Usually Mac OS X -and Windows come with a JavaScript runtime installed. +therubyracer+ gem is -added commented to Gemfile for new apps and you can uncomment if you need it. +and Windows come with a JavaScript runtime installed. Rails adds the +therubyracer+ gem +to Gemfile in a commented line for new apps and you can uncomment if you need it. +therubyrhino+ is the recommended runtime for JRuby users and is added by default to Gemfile in apps generated under JRuby. You can investigate about all the supported runtimes at "ExecJS":https://github.com/sstephenson/execjs#readme. -- cgit v1.2.3