README.md in arpa-0.0.2 vs README.md in arpa-0.0.3

- old
+ new

@@ -16,66 +16,66 @@ Or install it yourself as: $ gem install arpa -After you install Ar and add it to your Gemfile, you need to run the generator: +After you install Arpa and add it to your Gemfile, you need to run the generator: $ rails generate arpa:install This command will create some files that are needed to run the Gem. | File | Purpose | |----------|:-------------:| -| db/migrate/20140120201010_create_arpa_tables.rb | Migration to create the all **Ar** tables in your database (your name will include a different timestamp) | -| config/locales/arpa.en.yml | Locales to use in Ar classes | -| app/assets/stylesheets/arpa/arpa_accordion.scss | Basic stylesheet to use with Ar views | +| db/migrate/20140120201010_create_arpa_tables.rb | Migration to create the all **Arpa** tables in your database (your name will include a different timestamp) | +| config/locales/arpa.en.yml | Locales to use in Arpa classes | +| app/assets/stylesheets/arpa/arpa_accordion.scss | Basic stylesheet to use with Arpa views | | app/controllers/arpa/resources_controller.rb app/controllers/arpa/roles_controller.rb app/controllers/arpa/profiles_controller.rb | Controllers to use the CRUD actions for each one | | app/views/arpa/resources/ app/controllers/arpa/roles/ app/controllers/arpa/profiles/ | All views to use the CRUD actions for each controller above | -| config/routes.rb | Will add all routes into this file with all resources of Ar | +| config/routes.rb | Will add all routes into this file with all resources of Arpa | -After generate, you need to run the migration to create all Ar tables: +After generate, you need to run the migration to create all Arpa tables: $ rake db:migrate **Obs.:** The migration file will create a associate table between **Profiles** and **Users** (the Users must exist in your Application before adding the Gem) ## Usage -First of all you must create the Resources, Roles and Profiles (each is avaliable in the paths listed above). After that you need associate **Profiles** with **User** (to do this, you need create by your own the associate form view, saving some profiles in some user). Done that you can use some Helpers generated by Ar. +First of all you must create the Resources, Roles and Profiles (each is avaliable in the paths listed above). After that you need associate **Profiles** with **User** (to do this, you need create by your own the associate form view, saving some profiles in some user). Done that you can use some Helpers generated by Arpa. ### Association between Profiles and Users You just need have a method called **:profile_ids** inside the User model. This method should return a list of ids from profiles associated in the user. You just add a HBTM association in User model: ```ruby class User < ActiveRecord::Base - has_and_belongs_to_many :profiles, class_name: 'Ar::Repositories::Profiles::RepositoryProfile' + has_and_belongs_to_many :profiles, class_name: 'Arpa::Repositories::Profiles::RepositoryProfile' end ``` With this you will be able to use the :profile_ids method. ### Controller helpers -Ar will create some helpers to use inside your controllers and views. +Arpa will create some helpers to use inside your controllers and views. To verify if a user has access to some :controler and :action, use the following helper: ```ruby has_access?('users', 'index') ``` **Obs.:** To that helper method works. You must have **:session** (In Rails app already has) and **:current_user** attribute or method. --- -If you want use that method inside another object you should use the **Ar::Services::Verifier** class; +If you want use that method inside another object you should use the **Arpa::Services::Verifier** class; You just need pass as arguments the :session and :current_user: ```ruby -verifier = Ar::Services::Verifier.new(session, current_user) +verifier = Arpa::Services::Verifier.new(session, current_user) verifier.has_access?('users', 'index') ``` ### Controller Filter @@ -94,10 +94,10 @@ end end ``` -**Obs.:** The **has_access?** method come from Controller Helper method which Ar gem has been created. +**Obs.:** The **has_access?** method come from Controller Helper method which Arpa gem has been created. ## Information After generate, you will be able to access some paths for each Controller created: