ruby-on-rails

RubyMine on Mac, Rails environment on Ubuntu

I have installed RubyMine on Mac but my development environment for Ruby and Rails is on an Ubuntu VPS. When I run IRB in RubyMine, I assume it is using my Mac environment's IRB? Cause I have installed rvm, bundler, gems etc in my Ubuntu VPS. Is it possible to create an application in my Ubuntu VPS and use that environment rather than...

ruby on rails-views multiple line items dynamically added

Hi , Can I dynamically repeat same set of text boxes on the click of an ADD button in rails I have a scenario where i have to repeat form text boxes based on a users input. <td>TestDescription</td> <td><%= text_field( :report,:testDescription,:size => 20 ) %> </td> can i some how repeat this dynamically thanks ...

Any good reason to access many-to-many join table directly?

I have a Ruby on Rails application in which the code directly access many-to-many join tables directly. This makes modifying some of the code very difficult since it bypasses the normal associations and methods created via the :has_many and :has_many :through relationships. My question is simply, is this an acceptable thing to be doing ...

How to create a plugin/gem in rails

Hello Whats the best guide to start working like creating a plugin/gem. I got this tutorial from railscast but this is very basic.I got some other tutorials but all of them are too basic. Any other tutorial, you can suggest. and what the things we should kept in mind while creating a gem or plugin? ...

What's the difference between gems and plugins?

This may be a very lame question, but still I am confused when should I use a gem and when should I should use a plugin in my project. What's the basic difference between them? ...

Can anybody explain to me what exactly do you mean by Agile Development?

Possible Duplicate: What is Agile Development? I am working on ruby-on-rails from past 4 months. Previously i worked on php, asp.net, java etc. From past four months i am listening this:-- Agile Development Can anybody tell me what exactly this means. I have some basic things in my mind regarding this, but i am not introd...

My Ajax is trying to render a view that it shouldn't..

So everything works. But if a user has firebug's console open, they'll see a bug. :D When my AJAX is sent : $(".remove_qf").live("click", function(){ $.ajax({type: "POST", url: $(this).attr("href"), data: { '_method': 'delete' }, dataType: "script"}); return false; }) And my controller fires it : def destroy @quick_fact = @org...

How to thumbnail a multi-page pdf with paperclip

I'd like to have Paperclip create 2 thumbnails for each page of a multipage PDF file that is uploaded. I'm running Paperclip 2.3.1.1 and using this in my Asset model: has_attached_file :asset, :styles => { :medium => "800x600>", :thumb => "100x100>" } So, when I upload a 3 page pdf file, I was hoping this would ...

Ruby on Rails: upload files with progress bar and checking of filesize before upload

Are there any gems / plugins that allow for a slick implementation? Bonus for allowing multiple uploads =) ...

Rails migration; merging two models.

I have a table of Products and one of ProductGroups to categorize them. Now the ProductGroups will be removed and their data merged into the Products table. I made a migration that loops through the existing ProductGroup records and adds them as Products. This so we don't have to re-enter hundreds of groups manually. Afterwards the prod...

Make select list output in alphabetical order in Rails?

Hi Everyone, I have a select list in my model which lists a persons name with their employers name: <li>Case Handler Name<span><%= f.select :person_id, Person.all.collect { |x| [x.name_and_company, x.id] } %></span></li> def name_and_company return "#{personname} (#{company})" end Is it possible to force the select list to output ...

Rails - Accessing timestamps from a lookup table

Hola all, I'm trying to get the values from timestamps created in a lookup table. Let's say I've got Ingredients and Recipes, and a table called ingredients_recipes, with ingredient_id, recipe_id, and then the timestamps. How can I get access to those timestamps? Basically, I need to know when a given ingredient was added to a recipe. ...

Cucumber step definition for "Given that I'm logged in"

I've got a cucumber step: Given that I'm logged in I don't understand how I should implement it as a step definition. Could someone point me into right direction, tutorials, blogs etc. ...

Function 'xsltParseStylesheetDoc' not found in [libxml2.so]

This error comes up in Redhat Enterprise Linux Server 5.4 - 64 bit. Linux rhl-64-tibbr5 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux There is also this error in the stack trace. uninitialized constant Nokogiri::VERSION_INFO More version details: jruby-1.4.0RC1 ruby/gems/1.8/gems/activesupport-2....

How to set "Connection: close" header in Rails

To fix issues with Safari frequently hanging when uploading files, I need to make a request to my Rails server and have it return an empty body with a "Connection: close" header. More details about this fix can be found here. So far, I have tried: def close return head :ok, {'Connection' => 'close'} end def close response.headers[...

has_many :through association problem

I'm a bit of a newb to ruby and I am having a heck of a problem with the has_many :through associations. My system is currently set up with Authlogic and Declarative_auth. At the moment when I file a user it creates everything correctly except it doesnt insert the role_id in the users table even though it shows its being passed on submit...

Why isn't factory_girl operating transactionally for me? - rows remain in database after tests

I'm trying to use factory_girl to create a "user" factory (with RSpec) however it doesn't seem to be operating transactionally and is apparently failing because of remnant data from previous tests in the test database. Factory.define :user do |user| user.name "Joe Blow" user.email "[email protected]" ...

rials form_for creates a new database entry on refresh, without form submit

I'm new to rails and mongodb, and have a simple form attempting to create a category tree. Whenever I refresh the page, a new entry is put into the database. I'm not clicking the 'submit' button, just page refresh. The form looks like this <%= form_for Activity.create do |f| -%> <%= f.text_field :activity_name % > <%= f.submt "a...

Friendlier RoR ActiveRecord model definition?

Simple question that used to puzzle me about Rails: Is it possible to describe a Model's structure from within the model rb file? From what I understand a model's data structure is kept within the migration, and the model.rb file is supposed to contain only the business logic. Why is it so? Why does it make more sense to migrate the d...

How to invalidate has_many relationship in Rails

In my Rails app, I have a class with a has_many relationship. For the sake of efficiency, I want to do some direct SQL to update many rows in the database at once, and then I want to mark the has_many relationship as no longer valid. If later code accesses the has_many relationship, I want it to reload the data. But I obviously want t...