ruby-on-rails

RoR define meaningful relations between two models

i want to define a many-to-many relation in a rails project. how is the best way to give the individual relations different meanings? +------------+ has many +-------------+ | | ---------------------> | | | person | | project | | | <--------------------- | ...

Do you know of any Rails "Announcements" plugins?

I've noticed in various web apps that users are prompted with initial announcements to help them use the app for the first time (and users have the option to click "Don't show this message again in the future" or something similar) Is there a plugin that does that? Or, would you simply program a many-to-many relationship between users a...

Python on Rails?

Would it be possible to translate the Ruby on Rails code base to Python? I think many people like Python more than Ruby, but find Ruby on Rails features better (as a whole) than the ones in Python web frameworks. So that, would it be possible? Or does Ruby on Rails utilize language-specific features that would be difficult to translate...

User-generated database entries in rails

I am trying to do something in Rails and will admit that I'm no genius programmer, but I'm attempting to learn. I want to create a database with user-generated entries of no specific number. The best example of what I am trying to do can be illustrated by twitter. I assume every time the user adds a new tweet it adds a row to the use...

rails recaptcha on localhost? windows causing issues?

I just checked out this answer: http://stackoverflow.com/questions/1076600/rails-recaptcha-plugin-always-returns-false but it didn't seem to help. I'm trying to run recaptcha on rails on my local machine. The site says the API keys should work for prod and local. I've checked the keys many times and have even tried "workarounds" where y...

Why do you have to explicitly specify scope with friendly_id?

I'm using the friendly_id gem. I also have my routes nested: # config/routes.rb map.resources :users do |user| user.resources :events end So I have URLs like /users/nfm/events/birthday-2009. In my models, I want the event title to be scoped to the username, so that both nfm and mrmagoo can have events birthday-2009 without them bei...

BrowserCMS portlet

This is probably a dumb question, but.. Any ideas how to insert BrowserCMS portlet into an actual page? What is weird, yes, I couldn't find that in their docs.... ...

How do I use open id in ruby on rails?

There doesn't appear to be any recent information about using Open ID in Ruby on Rails... the only walkthroughs that I can find do not work anymore. Does anyone know of a walkthrough or documentation that will actually work with modern versions of ruby on rails and required software? I've been struggling with this for days and cannot ma...

Ruby on rails - insert dynamic form drop down menu values to table

Hello, I'm trying to insert a drop down menu values to a table named units and that drop values are coming from another model named properties. Here is the schema of the units. create_table "units", :force => true do |t| t.string "number" t.decimal "monthly_rent" t.datetime "created_at" t.datetime "updated_at" t....

How does FasterCSV determine whether or not to add quote?

Hi, When I try to output some data into a text file using FasterCSV, sometimes it adds the quotes to the concatenated string and sometimes it does not. For instance: FasterCSV.generate do |csv| csv << ["E"+company_code] csv << ["A"+company_name] end Both company_code and company_name are Strings and contains data bu...

Receiving Email (ActionMailer) with Rails to process image attachments

I am trying to parse an email sent to my app server. It should read the email to find the user by email then add the photo to the user's photo models Here is what I have so far. What am I doing wrong? class Mailman < ActionMailer::Base def receive(email) logger.info("Got an email about: #{email.subject}") if (@user = Us...

localize strftime rails 2.2

<% @recently_active_objects = Activity.find(:all, :limit => 10, :order => "id DESC") %> <% @recently_active_objects.group_by{ |object| object.created_at.midnight }.each do |day, objects| %> <h3><%= day.strftime("%A, %B %e") %></h3> <% objects.each do |object| %> <%= activity_message_for_activity(object) %> ...

how to use sphinx in rails and exclude results based on a column value

I have a simple query to show users that are active, but somehow it is still showing inactive users. I am using sphinx. The query looks like: User.search keywords,:conditions=>conditions, :match_mode=>:boolean, :order =>sort_order.to_s, :page => page,:per_page =>per_page the conditions hash looks like this: conditions = {:is_expired...

Email not going out

I want to generate Email from my ruby application, So i used Action mail class for that. I configured the Email setting on environment.rb my configuration is as follows ActionMailer::Base.raise_delivery_errors = false ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "mail.authsmtp.com",...

Problem installing metric_fu related with flay.

hi i have installed metric_fu om a rails 2.2 system running hobo and i just can't get to run the metrics command. this is my log: $:apfcool $item rake metrics:all (in /Users/$/Documents/apf/apfcool) * master /Users/$/.gem/ruby/1.8/gems/flay-1.4.0/lib/flay.rb:171:in `process_sexp': undefined method `<' for nil:NilClass (NoMethodError) ...

Best way to reload parts of a form

I want to reload a part of a form generated with the form_for-helper via AJAX. After reloading the part I still want to have access to the form object. How can I do this? Best regards ...

Strange jquery post problem, wrong post url is used

I have a form I wish to submit via ajax usind the jQuery $.post command. The form looks like this: <form action="/wine/merlot/reviews" class="new_review" id="new_review" method="post"> And the jquery call is: $(document).ready(function() { $('#new_review').submit(function() { $.post($(this).attr('action'), $(this).serialize(),...

Adobe Flex 3 : Fault Event doesnt return XML Feed sent from Server

Hi I am working on a flex application which communicates with a Rails backened. When i request for some data, It sends back xml feed. In some cases, if given parameters are not valid, then rails return an error feed with status code = 422 as following email is wrong But I dont get this feed in FaultEvent of Flex, How could i read erro...

virtual model and form_for (or formtastic)

Hi, all. Sometimes we need form without model creation - for example search field or email, where should be send some instructions. What is the best way to create this forms? Can i create virtual model or something like this? I'd like to use formtastic, but not form_tag. ...

Rails - Remote Domain Name

Hi, A remote IP can be recive via: request.remote_ip (http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html). But is there a simple way to try to get the remote domain name (of this IP)? Thanks ...