Sunday, January 12, 2014

Redmine:: passing ruby variable to javascript

I needed to get user's first name from database and pass the value to a javascript variable in JSON format.

I wanted to exclude the root, so I used this line.


ActiveRecord::Base.include_root_in_json = false


then I declared a ruby variable named token which takes id and firstname attribute from user table,

  @token = User.all.to_json(only: [:id, :firstname])


In the erb file, I used the following line,

var tokenList = <%= @token.html_safe %>







Wednesday, January 1, 2014

Redmine: Change attachment size for file upload

log in to admin account, go to settings , then general.. then Maximum attachment size ... save it ....

Sunday, December 15, 2013

Redmine: Database table returcture in plugin

ruby script/rails d redmine_plugin_model Dods dod name:string description:string user:string created_at:timestamp created_by:string dod_to:string duration:integer
rake db:rollback
delete last migration
and table from db
ruby script/rails g redmine_plugin_model Dods dod name:string description:string created_at:timestamp created_by:string dod_to:string duration:integer
rake redmine:plugins:migrate

Saturday, December 14, 2013

Redmine:: import empty scaffold in Redmine

export RAILS_ENV=production


create a scaffold with correct database settings.
copy the model, view,controller into redmine plugin's app folder.
then open the route.rb file of redmine project

add this line
resources :dods  #here dods is my plugin name 

Wednesday, December 11, 2013

Redmine plugin creation in Ubuntu 13.10

export RAILS_ENV="production" 
ruby script/rails generate redmine_plugin testPlugin