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

gem 'utopia_data' # on Gemfile

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 :site 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