Its all about Ruby On Rails
Posts tagged Trick
Jquery Full Calendar with RubyOnRails
Mar 29th
Cross Posted from http://vinsol.com/blog
Contrary to popular belief, working on a client project gives us a generous margin of creativity and explore innovative solutions.Take the example of a recent project I was working on. The client required a collaboration-based calendar module for their application similar to Google Calendar. Initially we started developing it from scratch , but then, we found an awesome Jquery plugin.
“FullCalendar” provides a full-sized, drag & drop calendar. It uses AJAX to fetch events on-the-fly for each month. It also supports an intuitive interface to manage events that spans over multiple days or weeks. It is visually customizable and exposes hooks for user-triggered events (like clicking or dragging an event).
I decided to give it a try and utilize its hooks for user triggered events within our Rails application. This small effort resulted in a barebone Rails app that might provide a good base for your project which require calendar, scheduling or appointment features. I called it fullcalendar_rails and it is now available on github with a working demo at http://fullcalendar.vinsol.com.
Update: Added recurring events functionality to the demo app.
Feel free to give your valuable feedback. I hope you will find this useful.
Change timezone of ubuntu machine from command line
Jul 15th
If you guys want to change timezone of your ubuntu machine then you can do it by issuing:
dpkg-reconfigure tzdata
This may be helpful if you deal with servers.
Printing large image diagrams generated by RailRoad
Mar 23rd
I use RailRoad for generating Ruby on Rails diagrams, but always wish I could print those diagrams. Generally diagrams are too big to print on a single A4 size paper and I didn’t find any tool to print larger images in parts so that I can join them. If I print the image generated by RailRoad on single page, it of no use as it is hardly readable.
Fortunately, two days ago I found something which resolved this issue. It is a linux command and print a particular image on four pages. Here is that command:
lp -o scaling=200 models.png
Tip: Open DB shell/console from rails root dir
Jan 29th
Just a quick tip you might be using this already.
If you guys want to open your app’s DB shell. Then you can use rails utility ‘dbconsole’ by issuing “script/dbconsole” from rails root directory.
It will ask for DB password, and open your db shell.
If you use sake, you may like following sake task:
desc 'Launches the database shell using the values defined in config/database.yml'
task 'db:shell', :needs => [ 'environment' ] do
config = ActiveRecord::Base.configurations[(RAILS_ENV or "development")]
command = ""
case config["adapter"]
when "mysql" then
(command << "mysql ")
(command << "--host=#{(config["host"] or "localhost")} ")
(command << "--port=#{(config["port"] or 3306)} ")
(command << "--user=#{(config["username"] or "root")} ")
(command << "--password=#{(config["password"] or "")} ")
(command << config["database"])
when "postgresql" then
puts("You should consider switching to MySQL or get off your butt and submit a patch")
else
(command << "echo Unsupported database adapter: #{config["adapter"]}")
end
system(command)
end
quick_scopes: Rails plugin to automatically add some quick named_scopes to your models
Jan 29th
Today I came across a new plugin named quick_scopes, and thought you guys might be interested to give it a try. Checkout http://github.com/internuity/quick_scopes/tree/master