Visualizing Rails Schemas with the RailRoady Gem
engineering.coachup.com
Visualizing Rails Schemas with the RailRoady Gem
1–10 of 14 posts
Re: Visualizing Rails Schemas with the RailRoady Gem
#2I just yesterday found the rails-erd gem to accomplish the same task. https://github.com/voormedia/rails-erd
Re: Visualizing Rails Schemas with the RailRoady Gem
#3Rubymine comes with such a feature built-in. However, I found that my model diagram was too complicated to really be useful.
Re: Visualizing Rails Schemas with the RailRoady Gem
#4I prefer rails-ERD. annotate_models is also great.
Re: Visualizing Rails Schemas with the RailRoady Gem
#5If you use MySQL, planning with MySQL Workbench provides similar results to what was shown (table to table relations).
Re: Visualizing Rails Schemas with the RailRoady Gem
#6I prefer rails-ERD. annotate_models is also great.
Instead of annotate models, I have a function in my .irbrc/.pryrc that will print out the columns for me when I'm in a rails console (I usually have one open almost all of the time). I prefer this to cluttering my model files.
[6] pry(main)> c Account
Columns for 'accounts'
id :integer
created_at :datetime
updated_at :datetime
address :string
city :string
state :string
zip :string
phone_number :string
last_ip :string
# Print formatted column names and type info for ActiveRecord models
def fields(model)
puts "Columns for '#{model.table_name}'"
width = model.columns.inject(0) { |max_width, col| col.name.size > max_width ? col.name.size : max_width }
_columns = model.columns.collect do |c|
" %-#{width + 2}s :%s" % [c.name, c.type]
end.join("\n")
puts _columns
end
alias :c :fieldsRe: Visualizing Rails Schemas with the RailRoady Gem
#7RubyMine has this features built in and provides nice tools to manipulate the end diagram.
Re: Visualizing Rails Schemas with the RailRoady Gem
#8DataMapper has this as dm-visualizer as well in case you use that over AR in rails.
https://github.com/postmodern/dm-visualizer
Re: Visualizing Rails Schemas with the RailRoady Gem
#9DbWrench for Mac along with PgAdmin is another good alternative for doing this with a Postgres database.
Re: Visualizing Rails Schemas with the RailRoady Gem
#10I prefer rails-ERD. annotate_models is also great.
Instead of annotate models, I have a function in my .irbrc/.pryrc that will print out the columns for me when I'm in a rails console (I usually have one open almost all of the time). I prefer this to cluttering my model files. [6] pry(main)> c Account Columns for 'accounts' id :integer created_at :datetime updated_at :datetime address :string city :string state :string zip :string phone_number :string last_ip :string…
Do you keep the rails console running constantly? It seems more inconvenient to start and stop the rails console than navigate files for your schema, which is also searchable by virtue of it being written down.