ruby-on-rails

Is There An Equivalent to redirect_to :back in ASP.NET MVC

Is there an equivalent to Ruby On Rails' redirect_to :back in ASP.NET MVC? What about after submitting a form? For example: From page1 user clicks a link to page2. Submits a form on page2, then I want to redirect to page1. This works great if I hard code the redirect to go to Page1. However if the user clicks a link to page2 from pag...

HTTP Post Multipart/Form-Data to Rails from Desktop Client

I am trying to do an HTTP POST to create an instance of a model in my Ruby on Rails app from my Cocoa app. I am writing both the client (Cocoa) and server (Rails) so I can make changes in either location. I am running into a problem with the authentication token that is required when using Protect From Forgery All is fine when I can...

ruby on rails average per day

I'm trying to generate a report for the average number of calls a person makes per-day. The following generates the correct list, but if a user didn't make any calls a certain day it doesn't show up. Very much like this problem Going through the above link, i have this code: from_date = Time.now.at_beginning_of_month.to_s(:db) to_date...

Rails form_tag form writing - with non-active record model

Hey Rails People, I'm somewhat of a Rails newbie. I'm writing a couchrest-rails app, so am not using activerecord for this model. I just figured out that that means that form_for(@model) won't work. I'm trying to work out how to use form_tag -- but most of the examples don't involve new & create actions. This is wrong: <h1>New ...

Multiple Keyword Search Using Thinking Sphinx Rails Plugin

I'm using the sphinx search engine with the thinking sphinx plugin for rails. I have a job model with a title attribute that is indexed by sphinx. I'd like to search across multiple jobs and capture any that match 1 or more keywords. For instance... Job.search("rails, django, symfony") ...and get an array of job objects with the f...

Are there any good Ruby FTP libraries for Ubuntu?

After spending some time on Google all that I've found so far is ChilKat which only runs on Windows. I'm looking for something similar that'll run on Ubuntu. Obviously there's NET::FTP, Net::SSH and Net::SFTP so I could roll my own and that may be what I'll do, but I'm hoping to save a lot of time by using something else that's already b...

Apache minimum version for Phusion Passenger

Our current Apache installations are running Apache 2.0. Now we'd like to add some Rails applications and plan to run them on Apache with Phusion Passenger. I've gotten conflicting reports about whether we need to upgrade Apache to 2.2 in order to use Passenger (a consultant I highly respect recommended that; someone from Phusion says ...

Rails, jQuery, Ajax create and update.js.erb

Alright. I am working with RoR and jQuery and I have already got my update and create links working and functioning with their .js.erb files. The problem arises when in create with this line of code. #create.js.erb $("#promo_types").append("<%= escape_javascript(render(:partial => "promotion_type"))%>"); it is throwing an error: You ...

What must you know before you can get an entry-level Rails job?

Rails seems to be as simple or as complicated as you want to make it. When I look at job postings for Rails they often contain a lot of requirements beyond just being able to throw an app together. This makes me think that even if knew the Agile Rails book from front cover to back I still wouldn't qualify for most Rails jobs. So if yo...

In rails is it possible to load class layout dynamically?

I need message to have a different layout in project, is it possible in rails to do something like this? Class Messages::New < @project? ProjectLayout : NormalLayout end #i treid this, don't work, since @project has not been initiated. thanks ...

How to conditionally assign ActionController::Base.session in rails 2.3.3

I have a rails app that has the following content in the config/initializers/session_store.rb file: ActionController::Base.session = { :key => '_app_session', :secret => 'a really long string here', :expire_after => 2.minutes } ActionController::Base.session_store = :active_record_store So during normal operations ...

Ruby on Rails IDE for Windows

Which one do you prefer for serious Ruby on Rails development? I've been using NetBeans for PHP and Java for more than year, which works really great, but the Rails support isn't imho good enough. I often have problems with code completiton, where it doesn't find most of imported gems and functions and it's also pretty slow. On the oth...

Publish to Google Tasks from rails application

With iCal you can publish calendars for users to incorporate into their own calendars in Google Calendar. Is there a similar way to publish tasks to be publicly visible and able to be incorporated into a task manager such as Google Tasks or Remember The Milk? ...

Using accepts_nested_attributes_for + mass assignment protection in Rails

Say you have this structure: class House < ActiveRecord::Base has_many :rooms accepts_nested_attributes_for :rooms attr_accessible :rooms_attributes end class Room < ActiveRecord::Base has_one :tv accepts_nested_attributes_for :tv attr_accessible :tv_attributes end class Tv belongs_to :user attr_accessible :manufactu...

Interviewer: "How do you manage dependencies?"

In Rails, what does the question in the title mean? I know that when you install various gems they sometimes have dependencies on other gems. So before deploying the app, I would assume you would need to freeze Rails into the vendor directory and also unpack the gems and their dependent gems into the vendor/gems directory. Is this the...

DRYer tests with associations in factory_girl

Can anyone suggest a better way to make a factory use a pre-built model instance for its association? For example, so that it would be possible below to define a child of the Message factory so that a call to Factory(:my_message) could substitute for Factory(:message,:sender=>@me) ? Sometimes the setup hash is more involved than in this...

Rails plugin Restful_Authentication does not work.

I have tried to make it work around 6 times using different tutorials, and I arrive to the same result. I install the plugin correctly, generate the files correctly, add the routes correctly, migrate my database correctly, and yet when I go to myurl.com/signup or myurl.com/login, the "something went wrong" rails page appears (like a 404 ...

Rails: "Next post" and "Previous post" links in my show view, how to?

Hi community... I'm new in Rails... smile In my blog aplication I want to have a "Previous post" link and a "Next post" link in the bottom of my show view. How do I do this? Thanks! ...

How do i integrate Hoptoad with DelayedJob and DaemonSpawn?

I have been happily using the DelayedJob idiom: foo.send_later(:bar) This calls the method bar on the object foo in the DelayedJob process. And I've been using DaemonSpawn to kick off the DelayedJob process on my server. But... if foo throws an exception Hoptoad doesn't catch it. Is this a bug in any of these packages... or do I ne...

Which are the main things to be considered when migrating from rails 1.x to rails 2.x

Since the arrival of rails 2.3,the migration to new version became a big issue. There might have some things to be taken care on migration.Which r those. Any help is there and which r the advantages of this migration. ...