UtopiaData Documentation

About

Quando minha Utopia de Abertura de Dados por parte do governo for realidade, ainda então, estaremos caminhando para um pais mais democratico

Install

UtopiaData run on top of Rails application, on your Gemfile

gem 'utopia_data'
gem "inherited_resources"
gem "roar-rails"

bundle install
bundle exec rails g utopia:resource law

Configure

Please check your database config on database.yml

Create a Resource

Atention! create a resource *DON'T* touch on database, *you need* create your table before it

In the example law is my resource, the should be a word in singular

bundle exec rails g utopia:resource law

It will create app/resource/law.rb, like it

UtopiaData.register :law do
end

Changing default

Database Table Name

to change the database table name you can pass your database name to table_name config

UtopiaData.register :law do
  table_name "LAW122"
end

Attributes

to change what attribute you want to expose, you can use attribites config

UtopiaData.register :law do
  attributes do
    set :number
    set :author
  end
end

All other attributes will be protected

Run Server

bundle exec  rails s # run server

License

See COPYING file