Blog

Well, first of all you have to add a new folder in app/assets called "fonts" with all your custom fonts inside.

After that you have to tell Sprockets to compile that new fonts folder.

You should add this line into your config/application.rb file:

config.assets.paths << Rails.root.join('app', 'assets', 'fonts')

You don’t need to do that after Rails 4.1, that folder is already added by default. You should use it if you are using another folder such as “vendor/assets/fonts”.

Last thing you need to do is reference the fonts in your css.scss using the ‘font-path’ helper.

This is an example:

@font-face {
font-family: 'FontAwesome';
src: url(font-path('fontawesome-webfont.eot'));
src: url(font-path('fontawesome-webfont.eot?#iefix')) format('embedded-opentype'),
      ...

Rails 3.1 introduced a new way to organize and process front-end assets called Asset Pipeline.

This was one of the biggest changes and brought me several issues associated because I didn't know how it really works.

After using it in some projects and reading about it, I learnt about it, and now is so much clearer :)

How does it work?

Basically, the Asset Pipeline (sprockets-rails rails module) has three main goals:

  1. Collect, concatenate and minify assets into one file. (This reduce the number of request that a browser makes to render a web page)

  2. Version assets, using a unique fingerprint in order to avoid cache issues. (So, you could invalidate the cache modifying this fingerprint)

  3. Allows coding assets via a higher-level language, with precompilation down to the actual...


ActiveModel has different modules that can be mixin in your class to add behavior.

ActiveModel::Validations


To add validations to your class you only need to mixin the module ActiveModel::Validations
Notice the new validatior, absence of.


  class Person
    include ActiveModel::Validations

    attr_accessor :first_name
    attr_accessor :signature

    validates :first_name, presence: true
    validates :signature, absence: true
  end



ActiveModel::Model


If you need more active record behavior in your class than just validation you can mixin the ActiveModel::Model module, which will allow ruby objects to work with ActionPack and use instances of that class in view helpers such as form_for. It will also give more features to your classes such as:

  • Model name introspections
  • ...

"Turbolinks makes following links in your web application faster. Instead of letting the browser recompile the JavaScript and CSS between each page change, it keeps the current page instance alive and replaces only the body and the title in the head. Think CGI vs persistent process"

This is part of the description that you can find on Turbolinks github project Turbolinks it is being included by default in Rails 4 and it is easy to see why, it would greatly increase the speed of your app, especially in big project with tonnes of js and css. Here is a small guide of stuff to consider when we use it.

Events


On turbolinks the ready event of the document only triggers ones, on the initial page load, so every code that listens for that event will only triggered ones.

Instead, turbolinks gives you a range of events to deal with the lifecycle of the...

Create a Rails 4.0 beta application



Rails 4.0 is not a stable version yet and there is not official gem available so you must set it to get it from the master branch.
Rails 4.0 require ruby 1.9.3

Clone rails


  git clone https://github.com/rails/rails.git



Now let's install Rails dependencies


  cd rails
  bundle



You will probably get


  Bundler could not find compatible versions for gem "bundler":
    In Gemfile:
      rails (>= 0) ruby depends on
        bundler (< 2.0, >= 1.2.2) ruby

    Current Bundler version:
      bundler (1.1.4)

  This Gemfile requires a different version of Bundler.
  Perhaps you need to update Bundler by running `gem install bundler`?



If you do, you would must run


   ...



How to contact us

Our Location

DireccionArismendi 1420 Of. 102 Telefono(+598) 2409 15 66 Mailinfo@vairix.com

Follow us


Want to contact us?