Getting the domain name for a request with Ruby on Rails
Just tried to get the domain name in an ActionController and here we go: e.g.
render :text => request.domain()
Just tried to get the domain name in an ActionController and here we go: e.g.
render :text => request.domain()
Robert Dempsey has written a nice article about ‘Using Amazon S3, EC2, SQS, Lucene, and Ruby for Web Spidering‘, which is very interesting because it describes how to interact with Apache Lucene using Ruby.
I’ve just looked for the possibility to include the seconds into Rails’ DateHelper function datetime_select. After i haven’t found it in the Rails API documentation i tried to add an extra parameter include_seconds, set it to true and voilà … it worked like a charm:
<%= datetime_select("post", "written_on", :start_year => 1995, :include_seconds => true) %>
I got the error
no such file to load — mysql
when running my Rails application. After that i tried to install the mysql gem module using
sudo gem install mysql
but it gave me an error saying:
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
I then included a parameter to the install command which showed the path to the mysql_config file
sudo gem install mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
That did the trick.
I got the following error message when trying to run a Rails application with passenger after updating Rails:
undefined method `cache_template_loading=’ for ActionView::Base:Class
I had to comment or remove the line
config.action_view.cache_template_loading = true
in the production.rb file to fix the problem.
Just stumble on a Ruby on Rails online deployment service: Heroku. Don’t know if its good, but it looks promising.
:notice for positive feedback (action successful, etc)
:message for neutral feedback (reminders, etc)
:warning for negative feedback (action unsuccessful, error encountered, etc)
(via DZone)
Like i’ve said in my last posting i have played with the Ruby AWS:S3 library a little bit. The following happened:
After installing the library with…
sudo gem install aws-s3
…i uploaded the file ‘test.pdf’ using the following script:
# requiring necessary gems require 'rubygems' require 'aws/s3' # some name definitions file_to_upload = 'test.pdf' name_of_bucket= '#NAME OF YOUR BUCKET#' name_of_file_in_bucket = 'uploaded.pdf' # Create a connection to S3 AWS::S3::Base.establish_connection!( :access_key_id => '#YOUR ACCESS KEY#', :secret_access_key => '#YOUR SECRET ACCESS KEY#' ) # Create a bucket. Only necessary if there is not already one. AWS::S3::Bucket.create(name_of_bucket) # Store the file... AWS::S3::S3Object.store( name_of_file_in_bucket, File.open(file_to_upload), name_of_bucket, :content_type => 'application/pdf' )
That was all. After these steps i had a file named “uploaded.pdf” in my bucket. Seems to be a really easy to use this library. :)
Seems to be really promising. I’ll try this and will post my experiences with this library.
A Ruby Library for Amazon’s Simple Storage Service’s (S3) REST API.
I executed
gem install rmagick
and got the following error:
checking for Magick-config... no Can't install RMagick 2.3.0. Can't find Magick-config in [...]
I had to install the libmagick9-dev package with
apt-get install libmagick9-dev
to solve this problem.
This article gives you a full tour of Ruby on Rails 2.0 on Leopard—starting with building a web application using the latest Rails features with Xcode 3.0, and finishing with deploying the application to a production server running Leopard Server. Along the way we’ll explore unique features and benefits that Leopard brings to the party. In the end you’ll be better equipped to consider the advantages of powering your web application with Rails on Leopard.
Starling
FastRI is an alternative to the “ri” documentation browser for Ruby. As of 0.3.0, FastRI can operate in standalone mode (without using a DRb server, see below), so it can now fully replace ri for most intents and purposes.
Uuh…
NetBeans.org is proud to announce the availability of NetBeans IDE 6.0 Preview (Milestone 9). Here are some of the highlights:
- Ruby/JRuby/Ruby on Rails Support
- A Smarter and Faster Editor
- Improved Swing development (Swing Data Binding)
- Integrated Profiling
- Integrated Visual Design for Web Applications
- New, Integrated UI for CLDC/MIDP and CDC development
RailRoad is a class diagrams generator for Ruby on Rails applications. It’s a Ruby script that loads the application classes and analyzes its properties (attributes, methods) and relationships (inheritance, model associations like has_many, etc.) The output is a graph description in the DOT language, suitable to be handled with tools like Graphviz.