ruby-on-rails

Rails Script Segmentation Fault with RVM

I am getting a segmentation fault. Should which ruby return /usr/local/bin? rpi-wl-757:ellisberner maletor$ rails generate mailer ContactMailer /Users/maletor/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.4/lib/mysql2/mysql2.bundle: [BUG] **Segmentation fault** ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] Abort trap...

rails http basic authentication

in the view file, how can i ,check whether the user is authenticated? is there any helper methods like signed_in?, logged_in? etc. ? ...

Thinking Sphinx Combining :with parameters

Hi guys, I was wondering how I could combine the result sets of Thinking Sphinx I have the following query: Model.search :with => {:attribute_1 => id} Which I want to combine with: Model.search :with => {:attribute_2 => id} Is there a neat way to do this with just one search? I could do array addition but that does no seem to be ...

Loop Trick - How to show one attribute if... ?

Hi! I'm looking for a function we can use in a loop to do this: <% for rink in @rinks_in_region %> <%= rink.city #Show Only if city (n-1) != n %> <%= link_to_rink(rink.name+" Ice Rink",rink) %> <br> <% end -%> Basically just show the city only if it's different than the previous one. Make sense? Thanks for your help! ...

problem in downloading large file

hii all, am using apache as frontend to mongrel and loaded xsendfile module in apache .am looking for 1 GB of download .this is download routine def download @stream = Stream.find(params[:id]) send_file(@stream.location,:filename => @stream.name,:disposition > 'attachment',:x_sendfile => true ) and And this is how it is ...

Ruby on Rails Validation Question Inside Controller

Let's say I have a form_tag in a view gathering a view user input . With this input that I get through the params hash, I want to verify some of htis information such as email phone name. Can I just verify in the controller or is this a bad thing? I don't plan to save the thing I get to a db or anything, it's just getting put into an e...

Ruby alternative to .NET solution

Hi, I would like to know what my alternative would be for the following problem on a non-windows box that will be running a ruby on rails web application. The scenario is this: The user will activate a deep web crawl of a site that might take about 15 minutes to complete. I can use ajax to update the web page every so often with the ...

nested form & update_attributes

i am having trouble updating data in a multi-level nested form. i use partials to include all the fields for both the create & update views, and i do NOT have a problem with creating. only with updating. essentially the structure (simplified) is: user has_one profile profile has_many addresses form_for @user do |u| u.fields_for :pr...

Rails, Cucumber and localized messages.

I'm writing an application and I'm using localization everywhere I can. The problem is that I would like to test it using cucumber. I don't want to update the tests everytime the translation is changed. Is it possible to make cucumber understand something like that: When I am logged in Then I should see t(:login_ok) ...

how do i get without_access_control to work in a rails observer?

getting uninitialized constant Authorization::Maintenance in ActiveRecord::Observer. ...

Rails 3 has_and_belongs_to_many creates checkboxes in view

Hi, Based on following models class Company < ActiveRecord::Base has_and_belongs_to_many :origins end class Origin < ActiveRecord::Base has_and_belongs_to_many :companies end I want to have in my companies/_form a collection of checkboxes representing all origins. Don't know if the Company.new(params[:company]) in companies_con...

Acessing json using proxy

Hi freinds, I am rails developer, i need to fetch json in the remote server but it is not working form me .If it is local means working.How to set the proxy in jquery or rails .I am getting proxy only for php . Any suggestions?????? ...

Rails: How can I cache system table data

Say I have a system table 'categories' with 2 fixed records. The user will not be allowed to delete these 2 but may wish to add their own to extend their list. I need to be able to pull out the 'garden' category at certain times, e.g when creating a garden project. A class attribute reader that returns the garden instance would do the j...

Rails: what is wrong with this route?

For some strange reason cardsets_path('my') generates "/cardsets.my" instead of "/cardsets/my". Please explain why? config/routes.rb: match '/cardsets/:type', :to => 'cardsets#index', :requirements => { :type => /my|public/ }, :as => 'cardsets' resources :users do resources :cardsets do end end rake routes: cardsets /cardsets/:...

If I have IDEA, do I need rubymine for ruby dev or will it do both?

Does IDEA support all the features of rubymine, or is rubymine more refined for rails and IDEA doesn't have all the rubymine features? ...

Rails/Rspec Make tests to pass with http basic authentication

Hi, Here my http basic authentication in the application controller file (application_controller.rb) ... before_filter :authenticate protected def authenticate authenticate_or_request_with_http_basic do |username, password| username == "username" && password == "password" end end and the default test for the index action ...

submodel, subclass or subcontroller ruby on rails references

Hi I am busy making a ruby on rails app. I want to make an model that contains a text model, a picture model and a link model. Every model can have comments, But i don't want to make different comment models for the text, picture and link model. Is it possible to make a media model witch has a subclass(or how it is called) aka: picture ...

Accessing rails helper methods in models

In Rails 3, I am having a problem accessing a helper method from within a model In my ApplicationController I have a helper method called current_account which returns the account associated with the currently logged in user. I have a project model which contains projects that are associated with that account. I have specified 'belong...

Rake db:migrate syntax error

trying to setup webistrano and getting the following error: rake db:migrate (in /var/www/html/webistrano) rake aborted! /var/www/html/webistrano/vendor/rails/activesupport/lib/active_support/inflector.rb:273: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' when 1: "#{number}st" ^ /var/w...

How to safely sanitize input from TinyMCE in ruby?

Hi, I just added TinyMCE to a small CMS I built in Rails. I've been using Redcloth before to style user generated articles. Since I started using TinyMCE, I would like to also allow users to embed video (from youtube for ex) into their blog posts. I'm using the follow helper in the views: sanitize(text, :tags => %w(a object p...