ruby-on-rails

unable to start mongrel after adding basic html auththentication.

This is the output i get: root@marley:/home/rsouthard/projects/inventory# ruby script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.2.3 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails w...

BlueCloth isn't working with Rails 3

Is BlueCloth compatible with Rails 3? I can't make it work, maybe someone uses it? There is supposed to be a helper called 'markdown' available in the views after requiring 'bluecloth', but this doesn't seem to be available. ...

Ruby geocoding library compatible with latest Google maps, Yahoo maps, Bing APIs

What Ruby / Rails geocoding library is compatible with (can fetch data from): latest Yahoo PlaceFinder api latest Google V3 API Bing maps API Please also comment on the compatibility with Rails 3 and Ruby 1.9 ...

ActionController::InvalidAuthenticityToken problem

I read the answer from Mattyven on the title of What does this mean ? >> ActionController::InvalidAuthenticityToken I agreed that "you could also send along a parameter named "authenticity_token" with the value of <%= form_authenticity_token %>". But question is how? I put this into the form: <%= tag(:input, :type => "hidden", :name =>...

How do I cache a method with Ruby/Rails?

I have an expensive (time-consuming) external request to another web service I need to make, and I'd like to cache it. So I attempted to use this idiom, by putting the following in the application controller: def get_listings cache(:get_listings!) end def get_listings! return Hpricot.XML(open(xml_feed)) end When I call get_listin...

Rails 2.3.8: namespace + default route (server-dependent routing issue)

Hello! I have FriendshipRequests controller under controllers/users/ namespace. The problem appeared after setting up stage server: same url is processed different locally and on the stage. locally (mac os X, ruby 1.8.7p174, frozen rails 2.3.8, rack 1.1.0) /users/friendship_requests/accept?req_id=3 routes to Processing Users::Frien...

Reload Apache from Rails application

Dear All, I have an application which allows users to add there own domains and forward them to particular CNAME so that it works with our application. For my part, I just need to add a ServerAlias for the domain in my vhost file and reload the apache. I understand that rails app won't have necessary privileges to reload apache. So,...

Why doesn't Delayed Jobs work with my ActionMailer production setup?

I am working on a Ruby (1.8.6) on Rails (2.3.5) application in which I am currently using Gmail to deliver email messages. I want to switch to sending the messages with Delayed Jobs. I have delayed jobs sending messages on my development environment but when I deploy to my production server and try the messages get rejected and an error...

How do I customize the user registration route with the devise gem for Rails?

I use the Devise gem with Rails and would like to alter the action that occurs during user registration. My faulty customization looks like this: devise_for :users, :controllers => { :registrations => "users/registrations" } do post "/", :to => "users/registrations#create_from_admin" end Resulting in this: [bbrasky@admins-Mac...

Why does Rails to_json sometimes include attributes, attributes_cache, changed_attributes, etc?

My to_json call sometimes seems to include some extra cruft that I'm not expecting: {"response": [{"attributes": { (...actual list of key:value pairs, as expected) }, "json_class":"Survey", "attributes_cache":{} }, {"changed_attributes":{"survey_source":""}, "attributes": { (...actual list of...

Can I access information from one associated AR object in another when both are unsaved?

Say I open a Rails (2.3.8) script console and try this: a = Account.new(:first_name) = 'foo' i = a.invoices.build p i.account.first_name Account.rb is a model object and contains: has_many :invoices and Invoice.rb is a model as well containing: belongs_to :account, :validate => true In console line 3 above, i.account is nil. I r...

recaptcha within modal window (fancybox)

Hi, I am trying to load a form through ajax within fancybox. It works great, everything works fine. I used the recaptcha (rails) plugin and got the captcha on the form. Now when the fancybox loads, its getting redirected to an empty page with only captcha on it. I assume this is some problem with iframe and modal window? Has anyone ...

Rails: Why am I getting the wrong link on this pingback?

So I almost have a pingback sender ready for my rails app (people post links to content and donate to them). Almost. I've borrowed heavily from the code here: http://theadmin.org/articles/2007/12/04/mephisto-trackback-library/ I modified the slightly for my purposes: require 'net/http' require 'uri' class Trackback @data = { } ...

Structuring question and answer database in RoR

I'm thinking about how to structure the database tables on my Ruby on Rails app. It's an app that will allow academic surveys to be sent to a student population. But as I haven't had a lot of experience with database design, I don't know the answer to the following: Which of the following should my tables look like? Survey ID quest...

RubyAmf and Rails 3

I have recently been trying to upgrade my app form Rails 2.3.8 to newly-releases Rails 3. After going through fixing some Rails 3 RubyAMF doesn't seem to work: >>>>>>>> RubyAMF >>>>>>>>> #<RubyAMF::Actions::PrepareAction:0x1649924> took: 0.00017 secs The action '#<ActionDispatch::Request:0x15c0cf0>' could not be found for DaysControlle...

What is the HTTP content type for binary plist?

I am modifying a rails server to handle binary plist from an iPhone client via POST and PUT requests. The content type for text plist is text/plist, as far as I can tell. I would like the server to handle both text and binary plists, so I would like to distinguish between the two forms. What is the content type for binary plist? ...

Rspec Rails mocking associated model not working after find()

I have some nested models that require a bit more than the standard accepts_nested_attributes_for logic. Instead of automatically creating or updating child records based on id key, in this case the child records must already exist and have certain other conditions, or it raises an error. So as part of this, I have a parent model itera...

Setting up RVM gemset via Rails 3 template

I'm trying to set up an RVM gemset through a Rails 3 template and then, via commands in the template, start using the gemset and install the gems into the new gemset (named after the app). This does not seem to work properly. The new gems do not get installed into the gemset and in fact the gemset does not get created at all. Here's som...

if you don't use scaffolding, is ruby on rails still good for rapid development?

If you take out the scaffolding feature where it creates the model/controller, and CRUD pages for you, is ruby on rails still any faster to market than say, django? It seems very similiar to be if you take away that step...(even though I believe django has similar auto-gen capabilities) I am reading the starting guide on the rails site...

oauth2 and trusted sites

Hi, is there any possibility to work with trusted sites (for example - sites of one developer) using oauth/oauth2 without confirmation of access to user data? ...