ruby

Integrating Oulook/Exchange Tasks with Linux-based Rails

Is it possible to integrate MS Outlook/Exchange tasks with Rails? I know how to send emails with Rails, but that isn't using anything "special" about exchange, just pointing it at the server. What is "special" about an Outlook Task and how I can I create/read/update/delete them from Rails. (Even a subset of CRUD would be great.) PS. I ...

Rails: For each Array giving Error?

In one form I am creating a territory and editing multiple users. The "user_attributes" below are for the users and the "name" is for the territory. So for each user_attribute I wanted to update the user model. params { "territory"=>{"name"=>"Central Canada", "user_attributes"=>[{"user_id"=>"30"},{"user_id"=>"30"}]} } create action...

Rails Plugins

What are some of your favorite rails plugins that you would consider "must haves"? This entry lists some of my favorites that I use in a large majority of my rails applications: My favorite rails plugins ...

Rails: Fields_for without a scope?

Is there a way to use fields_for with in a form without having a scope? For example: <% fields_for "user[]" do |x| <%= x.text_field :name %> <% end %> Without the user model being loaded in memory? I got it working using territory[user][][name], but I would like to keep it in ERB. ...

Big Web 2.0 sites written in Python?

Hulu, Twitter, Techcrunch, etc are written in Ruby. Yahoo, Facebook, and tons of big social networks are written in PHP. But what are some big top-name enterprise sites written in Python? I am going to spend my time investing in either Python (w/ Django) or Ruby (w/ Rails) to create a data-intensive web application that has a personali...

Ruby Atom generator to use with merb

I want to provide feed in my merb application. After reading wikipedia, RSSvsAtom and seeing that StackOverflow uses it, I think I will use Atom. What library should I use? I have found rAtom that looks quite good. Are there better alternatives? Or does merb has anything built in to help me? UPDATE: maybe I should just do the news in p...

Examples of 'Things' that are not Objects in Ruby

"Everything is an object" was one of the first things I learned about Ruby, but in Peter Cooper's Beginning Ruby: From Novice to Professional book, it is mentioned that "almost everything in Ruby is an object". Can you give me some examples of things that are not objects in Ruby? ...

Nesting content tags in rails

Hey. I've got some code from Agile Web Development that wraps some HTML around a method call as so: # from tagged_builder.rb, included as a FormBuilder helper def self.create_tagged_field(method_name) define_method(method_name) do |label, *args| @template.content_tag("p", @template.content_tag("label" , ...

Require path problem

Here is one more newbie question: require 'tasks/rails' I saw this line in Rakefile in the root path of every rails project. I guess this line is used to require vendor/rails/railties/lib/tasks/rails.rb to get all rake tasks loaded: $VERBOSE = nil # Load Rails rakefile extensions Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| l...

Scaffolding ActiveRecord: two columns of the same data type

Another basic Rails question: I have a database table that needs to contain references to exactly two different records of a specific data type. Hypothetical example: I'm making a video game database. I have a table for "Companies." I want to have exactly one developer and exactly one publisher for each "Videogame" entry. I know that ...

What exactly the license of rubyscript2exe ?

It says that rubyscript2exe license is GPL, but I can't understand the following: If I create an executable with it, may I use the application I created in my company without contribute it to the GNU society (without sharing my Ruby code?) Can I even include it in our product and sell my executable as a part of our product? Here is the...

Is there a Ruby equivalent to Perl's Data::Rmap?

Perl's Data::Rmap allows you to recursively evaluate a BLOCK over a list of data structures (locally setting $_ to each element) and return the list composed of the results of such evaluations. $_ can be used to modify the elements. This is useful for iterating over things like nested hashes, or hierarchies of arrays of hashes and the l...

"No such file to load" error when running Rspec

Mac OS 10.4 rspec (1.1.11, 1.1.4, 1.1.3, 0.5.15) rspec-rails (1.1.11) rspec_generator (0.5.15) rails 2.2.2 ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0] Created a new project... $ rails myproject Installed rspec into the project... $ script/generate rspec Generated a resource... $ script/generate rspec_scaffold myre...

Is it better to dive into Rails or Django going into the future?

I've been a dev using rails since it's initial release and have recently lost touch with it because I've done a lot of work with Django due to my recent fondness of python. I do like Ruby as well and was asked by a friend recently if he should approach Rails or Django. Given that Rails is merging with merb and has a huge user-base versus...

Ruby block and unparenthesized arguments

I extracted simple example: require 'pp' x = 1..3 pp x.map do |i| {:value => i, :double => (i*2)} end pp x.map { |i| {:value => i, :double => (i*2)} } pp(x.map do |i| {:value => i, :double => (i*2)} end) pp(x.map { |i| {:value => i, :double => (i*2)} }) I am wondering why first pp produces: [1, 2, 3] While all the oders are giving...

How to get last N records with activerecord

With :limit in query I will get first N records. What is the easiest way to get last N records? ...

Best way to collect Rails application usage statistics

I have a Rails application where users can set up their domains and publish content onto them. I need to collect public traffic statistics such as pageview count etc. One good example of this feature is flickr usage statistics i can see as a customer. The question is what is the best way to collect usage information. Should it be done b...

Primary servers in capistrano

I have a task in capistrano wherein I want just a single line to run only if the server is a marked as primary. Is there a variable or method that I can reference inside a task? 'primary?' or 'primary' doesn't seem to work. I've also tried something akin to the following: after "deploy", "task1" after "deploy", "task2" after "deploy"...

Calling a private instance method from a class method in Ruby.

Can I create a private instance method that can be called by a class method? class Foo def initialize(n) @n = n end private # or protected? def plus(n) @n += n end end class Foo def Foo.bar(my_instance, n) my_instance.plus(n) end end a = Foo.new(5) a.plus(3) # This should not be allowed, but Foo.bar(a, 3) # I...

How to install libraries?

I am trying to install the "libxml" Gem (http://libxml.rubyforge.org/install.xml) and it says that libxml requires a few other libraries to be installed in order to build and function properly: * libm (math routines: very standard) * libz (zlib) * libiconv * libxml2 I installed RubyGems but I wonder if "libiconv" for...