ruby-on-rails

Confusion about delayed_job startup.

I have script with that i can install everything on server. I don't need to monitor my jobs. Is it a proper way if i will add this two lines on my that script to start delayed_job server on my production server. chmod a+x script/delayed_job RAILS_ENV=production script/delayed_job start Because we have a product and we can't monitor it...

How to show all asked-for Translation Strings in Rails?

When Rails functions are asking for a translation (I18n.translate), I don't want to analyze their code in order to get the exact scopes etc. How can I add a debug output into the console for every string that was asked for? Examples: I18n.t 'errors.messages.invalid', :scope => :active_record # Translation for 'activerecord.errors.mes...

Error in paper clip plugin in rails

Image Paperclip::CommandNotFoundError I am getting this error. Installed Image magick, rmagic both specified path in developement.rb Paperclip.options[:command_path] = "/opt/local/bin" Using Snow Leapord ...

fetch start and end time for every job with delayed_job.

Is there any way i can fetch start and time for my every job. I am using delayed_job. ...

How do I update Sunspot-Solr's path after I change my Application Name

Normally my app was located here at : /data/Site/current/ but now it's: /data/Site2/current/ I tried to script/console into it, and reindex, and received the following error which lead me to believe that the new path is throwing it off: RSolr::RequestError: Solr Response: Failed_to_acquire_random_test_lock_please_verify_filesystem_f...

ActiveResource error handling

Hi. I have been searching for a while and yet I am not able to find a satisfactory answer as yet. I have two apps. FrontApp and BackApp. FrontApp has an active-resource which mimics a model in BackApp. All the model level validations live in BackApp and I need to handle those BackApp validations in FrontApp. I have following active-res...

Ruby on Rails: Replace a link with javascript

I have this <a href="#" id="preview_button"></a> And I want the link to be replaced with an actual link. So i figured I use this page.replace_html("preview_button","<a href='/preview/#{@object.name.to_url}' class='preview' onclick='window.open(this.href);return false;'>Preview</a>") but when I use the inspecter with chrom...

Looking for some great example web applications to learn real-world development techniques

I've done a bunch of web development with JSP/J2EE and some ASP.NET. Nevertheless, I still feel like I'm catching up with the web 2.0 stuff that relies heavily on JavaScript. I have two questions: I'm looking for great samples of web applications to learn development techniques. I prefer to look at real-world examples (i.e. someth...

Rails plugin for User reg, password recovery, the works?

Is there such a plugin for rails that will do everything for user registrations, or must this all be coded from the ground up using various plugins and combining them or just coding some parts by hand? ...

The framework spawner server exited unexpectedly

I'm having problems with my RoR application. Suddenly, after no changes or anything, I started getting the The framework spawner server exited unexpectedly exception. I've tried searching for some information, but everything leads to dead end. I had the app running for about half a year with no problems, but I suddenly got this error. ...

No response to Show and Rails Routes

I have my file structure set up appropriately ( I think ! ) , and claims nothing responds to show. My file structure : views/admin/admin_wysi/index.html.haml My controller ( controllers/admin/admin_wysis_controller.rb ) class Admin::AdminWysisController < Admin::ApplicationController def index end end My routes.rb map.name...

Convert plain text URLs to HTML hyperlinks in Ruby on Rails?

I have a text area into which users enter a lot of text that potentially includes hyperlinks. How can I display the text and have the URLs automatically appear as hyperlinks? Is there a gem, plugin, or existing method that does this? I'm looking to be able to do something like: <%=h @my_object.description.with_links %> in my view. ...

monit with delayed_job.

if my delayed_job server broke than monit will automatically restart the delayed_job server again or not? ...

Simpler way of solving Roles and Permission Problem

Query On Roles and Permission: Admin ,Carer ,Care Manager ,All are the Fixed Roles . Role "All" conditions has a different functionality - it means to read /write should be given to everyone irrespective of other roles. For each role can have read or write permission. I have solved this by creating a table called Permission with f...

Reducing the depth of a Hash object

I have a hash object from an ActiveRecord. I'm going to be calling to_json on it, but I am looking to reduce the depth of the object that is being returned. Here is what my find looks like: @tags = Tag.find_all_by_type("some_type", :select => :name) The result of @tags.to_json looks like this: [{"tag": {"name": "some tag name"}}, ...

Will Paginate Rails 3 Per Page

I am trying to limit the number of elements returned with mislav's will paginate with Rails 3. I am currently using: # Gemfile gem 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :branch => 'rails3' # company.rb class Company < ActiveRecord::Base self.per_page = 8 end # company_controller.rb def index @compan...

Rails scaffolding from scratch has its drawbacks..

1st Question: I'm trying to make the create method work, but it appears that my form is sending data innapropriately to my DB. This is the server.log : Processing Admin::AdminWysisController#create (for ::1 at 2010-06-22 13:43:58) [POST] Parameters: {"commit"=>"save", "action"=>"create", "authenticity_token"=>"P8pW7GnSNr7RZcxFcejpfsu9Y...

How to comment code in Rails views?

As I'm playing with Rails and developing views I often want to comment out code. Simple enough with classes & models but views are a bit more tricky. What's best way to comment code in a view so it's not interpreted by, well, anything... HTML gives us <!-- commented Rails code here --> though code enclosed here seems to get interprete...

pre selecting items in select box rails

UPDATE @selected attributes: group_id: "29" attributes_cache: {} @data attributes: created_at: 2010-06-19 10:16:13 term_id: "1" updated_at: 2010-06-19 10:16:13 id: "29" course_id: "1" Hi, I am trying to pre-select items within a select_tag <%= select_tag "contact[group_ids][]", options_for_select( @data.map{ |d| [...

How do you convert a Date in the form of a String to a ActiveSupport::TimeWithZone?

I am trying to create a stream that includes Twitter data + my app's but I'm having trouble sorting them because their time stamps are formatted in different ways. This is my code: answers = Answer.find(:all, :conditions => {:user_id => @user_id }, :limit => 20) tweets = Twitter::Search.new(params[:username]).to_a @feed = (answers + tw...