ruby-on-rails

Empty Scope with Ruby on Rails

Hi there Following Problem: I need something like an empty scope. Which means that this scope is emtpy, but responds to all methods a scope usually responds to. I'm currently using a little dirty hack. I simply supply "1=0" as conditions. I find this realy ugly, since it hits the database. Simply returning an empty array won't work, sin...

javascript scrolling menu with scroll bar.

Hey Guys, Looking for an easy to use vertical sidebar with the following conditions. The sidebar follows you as you move down the page. The sidebar contains a scrollbar for extra long lists. Any help would be great! Cheers, Ash ...

Time to upgrade to Rails 3 or not?

I'm about to revisit an application that I've been trying to get off the ground for nearly a year now (keep getting sidetracked and too depressed to bother with it). The app was started with Rails 2.3, I believe and had a very minute amount of work done before it got abandoned. Coming back to Rails at this time, I see that 3.0 has been...

Passenger rake not found! Ubuntu (10.04)

Okay, so I installed rvm and everything as root. Then I installed Ruby Enterprise Edition with rvm. Now I've been having a TON of issues with rake and rvm so far and I'm not too sure as to why. I had to manually create links in my /usr/local/bin to rake to get rake working. But when I passenger-install-nginx-module Welcome to the Ph...

RoR has too much choice? what is meant by that?

I read somewhere (I can't recall where exactly) that RoR has too many choices, I don't know much about RoR so I wondering if someone could explain this for me (or maybe its not true?). Where exactly in the framework are the choices? Can someone summarize the more popular plugins for RoR for me? I gather these 'choices' are in: ORM t...

Why am I getting a NoMethodError for an attribute that exists in my model?

This is the error I get: ContactPostalcardsController#skip (NoMethodError) "undefined method `status=' for #<ContactPostalcard:0x2b21433d64b0>" This is the code calling it and trying to assign a value to the status attribute for ContactPostalcard (the Model): def skip @contact_postalcard = ContactPostalcard.new(params[:contact...

rails routes confusing show action with named route

i have a problem implementing a list action with its own route. here is what i have (just important parts) routes.rb map.resources :posts map.login "login" ,:controller => "user_sessions" ,:action => "new" map.logout "logout" , :controller => "user_sessions" , :action => "destroy" map.sort "sort" , :controller => "pos...

I'm excited about a personal project, should I do it in PHP or Rails ( but I have to learn Rails first )

I started learning Rails only a few days ago, but in the mean time I became very excited about a personal project. The project is quite hefty and would require several months to complete. Right now, I can't wait to start doing that project but I'm a bit reluctant in writing it in PHP. I've been working in PHP for a little more than a ye...

Sending delayed email from devise

Is there a simple way of telling Devise to send all email via delayed_job? ...

Ruby on rails: singular resource and form_for

I want user to work with only one order connected to user's session. So I set singular resource for order routes.rb: resource :order views/orders/new.html.erb: <%= form_for @order do |f| %> ... <% end %> But when I open the new order page I get an error: undefined method `orders_path` I know, that I can set :url => order_pat...

BDD with Cucumber and rspec - when is this redundant?

A Rails/tool specific version of: How deep are your unit tests? Right now, I currently write: Cucumber features (integration tests) - these test against the HTML/JS that is returned by our app, but sometimes also tests other things, like calls to third-party services. RSpec controller tests (functional tests), originally only if the c...

Rails AJAX UJS Question

rails 3.0 <% link_to about_path, :remote => true do %> About Us<span>Who we are</span> <% end %> def about render :update do |page| page[:content].replace_html :partial => 'dashboard/about' end end Having issues with AJAX in rails 3.0 Just trying to get it replace the html with a partial one clicked. An...

Basic UJS AJAX Rails 3.0 Update Question

Very simple AJAX call to make a div go up. Though it's not working. Trying to transition from 2.3.8 to 3.0. Any help is greatly appreciated. I've googled, though I'm not able to make any sense of the jargon. :( Thanks in advance View: <div class="test"> Whompa </div> <%= link_to 'Blind-Up', :controller=>:home,:actions=>:test, :remote...

Problem creating Rails 3 Engine

I'm working on creating my first Rails 3 engine and I'm currently getting the following error message is a Railtie/Engine and cannot be installed as plugin (RuntimeError) To give you a bit more background I'm not doing the Engine as a gem, but I've place the Engine files in the vendor/plugins folder. I know there is an issue with load...

DRY function in a better way

Hi could you tell me a way to write this code in a better way ? Create an user with data attributes fetched from facebook . User.create do |user| user.email = data['email'] user.password = Devise.friendly_token user.facebook_uid = data['facebook_uid'] user.first_name = data['first_name'] user.last_name = data['las...

Gem Install memcached-northscale error

Trying to install memcached-northscale and getting a weird error. Any help would be appreciated. $ sudo gem install memcached-northscale Building native extensions. This could take a while... ERROR: Error installing memcached-northscale: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/...

Rendering an Edit partial while selected a defaulted value

I have a partial in my rails app that loads the vote form (It's just a select with numbers ranging from 1-5). I'm now making another partial that loads up if the user has already voted it's suppose to be an EDIt partial where you get selected the value that you voted and if you wanted to you could change it. But for some reason is not wo...

How to sort ActiveRecord results using an attribute in the superclass?

Hi, I have two models: class Manufacturer < ActiveRecord::Base has_many :models end class Model < ActiveRecord::Base belongs_to :manufacturer belongs_to :model end What I want to be able to do is find all manufacturers whose models belong to a given category: manufacturers = Model.find(:all, :conditions=>["vehicle_category_id...

Ruby on Rails 3.0 Why do these two output two different things ?

<%= link_to 'Testing', wak_path %> *This requires a routes: match 'wak', :to => 'home#wak' Did they take this out of rails 3.0 or what is going on? <%= link_to 'Testing, :controller=>:home,:actions=>:wak %> But in the views, I'm getting two different code, the top method works, though the second method dosen't have the same behavi...

Call a method inside the model

Hi, I've defined a function called hash_swap inside the User model, but when I call it it always says Method not found. How could I call a function inside the model ? ...