Shiva Kumar 's Blog

Start small,Think Big

Rails Application structure



A brief explanation of rails application structure .i.e what folders and files are  created by rails when type the rails new app_name command
Assets - This is  where you have all your static files like image,stylesheets,javascript these are compiled by sprockets.when deployed these are served from /assets directory
Controller -This is where all your controller goes which helps to talk with views and models to do the process
Helpers-typical used for removing duplicate code from views mostly
Mailers-contains class used to send mails
Models -This where all your models goes .which can have both persistent and non-presistent which are not backed by database
Views-This where all your presentation files go like html,js and others
Config -configuration of your application takes place here
config/Application.rb-loads individual parts of the rails        application like activerecord,activecontroller ..we can also put default config
  config/boot.rb- load bundler and gems
  config/database.yml -This is the configuration file  for your database
environments - This where we have specific configuration for specific environment.. like setting caching false in development

/initializers - application specific config and third-party access tokens

en.yml : to support multiple languages
routes :  This is where all your route config goes

/db: This  is where your migrations,schemas and seeds go
db/schema.rb -is current state of you database you should not never edit this directly
db/seeds - for loading default data into database
gem file - used by bundler for loading library dependencies
  gemfile.lock - is locked-n gem versions..useful for deploying
public — this where all the static files used to go now it has been moved to app/assets it contains error pages
rakefile :loads all the rake tasks and also looks for lib/tasks to check if we have any custom rake task
Readme.rdoc -Readme about your application
script -contains rails executable ..this is the executable that run when you go into app directory and run rails command
test -This where your all testing takes place.
tmp  -temporary files go here.. if you worked with caching would see some files here

vendor- used for adding plugin but now handled by bundler
..third party assets not maintained by you like any javascript plugin

, , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">