ruby-on-rails

Is paperclip support rails3? how can i support upload pdf files only?

now i am trying to upload a pdf file to the server ,but i get nothing,when i try to get the url of the attached file,i got some missing.png file name. Is there some where i can set to tell the paperclip that i just want to upload pdf files but not pictures? great thanks... here is my class settings =====================================...

Seemingly redundant ActiveRecord has_many definition

I've been applying has and belongs to many style associations to a project I've been working on, but because I wanted to capture extra information in my join model, I'm implicitly setting it up via the more elaborate belongs_to/has_many approach instead of has_and_belongs_to_many. After initially stumbling on this, I learned that I neede...

vim rails javascript_tag highlighting

The problem: <% javascript_tag do %> // some js <% end %> When I use this method the javascript-syntax is not triggered inside the block. When I use the <script> tag it works. Is there a way to trigger the javascript syntax for the rails block in vim? Thanks. ...

If VTiger is in PHP, Which CRM is for Rails?

Hi, I come from a .NET background and just learned Ruby On Rails. My company uses VTiger for Customer Relationship Management. I have no idea about PHP. I am a rails fan, instead of me learning PHP to work on VTiger, I am looking for a solution in Rails. I found Fat Free CRM. Is it good? Also, Are their any better ones? ...

Paginate with order defined by joined model in Rails

I have currently the following problem in my Rails application (Rails 2.3.5): I want to sort books stored in the application by the author name, then the title of the book. Book and Author are concrete models, the corresponding tables are Ressources and People. The relevant portion of the schema is (I have stripped down the model a b...

Do you have a RubyGem wish or Rails Feature Request?

Post your idea here. Keep it short and interesting to the general public. When posted, your idea is up for grabs, anybody can make it happen, sell it as their own etc. etc. Who cares, as long as it gets done, right? The background: I came up with a great idea (but maybe it isn't or it's an utopia) and googled "rails feature request". ...

Rails paperclip, attach two different images with different sizes

Hello, I have two models; "entry" and "imageblock". Entry contains some text, and imageblock has a photo attachment and some text about the photo. Entry can have many imageblocks and imageblock belongs to entry. I want to add different types of imageblocks to the entry. One has a thumbnail, another a medium pic, large pic etc. I know...

How add hash parameter to url using redirect_to?

How add hash parameter to url using redirect_to? For example: http://localhost/products/#{page:2} ...

How do I update all other records when one is marked as default?

I am trying to change all of the default_standing fields to FALSE for all other records when someone marks one as TRUE. That way I will only ever have one default record in the table. Here is what I am doing in both create and update in my controller, but it doesn't seem to be working: def update @standing = Standing.find(params[:...

Rails Nested Model Build Once

I am implementing a multi-model form and it is carried across multiple pages. I have a method to try and ensure that the nested model only gets generated once: def initialize(*params) super(*params) if (@new_record) @main_generated = false end end def generate_main if !@main_generated members.build(:...

Paperclip ruby on rails s3 to_file method

I'm very confused here as to why paperclip isn't working for me. When accessing a previously saved file on s3 for processing this method of the paperclip s3 storage class causes an error: def to_file style = default_style return @queued_for_write[style] if @queued_for_write[style] filename = path(style).split(".") extname...

Ruby on Rails migration, change table to MyISAM

How does one create a Rails migration properly so that a table gets changed to MyISAM in MySQL? It is currently InnoDB. Running a raw execute statement will change the table, but it won't update db/schema.rb, so when the table is recreated in a testing environment, it goes back to InnoDB and my fulltext searches fail. How do I go about ...

rails3-generators does not add any generators

Here is my Gemfile gem 'rails', '3.0.0' ... gem 'haml-rails' gem 'jquery-rails' group :test do gem 'shoulda' gem 'rspec' gem 'rspec-rails' gem 'factory_girl' end gem 'rails3-generators', :group => :development ... I run bundle install/update. And then not all new generators (from rails3-generators) are added. haml generators...

Rails 3 - set environment

Hi, I have a rails 3 app (which I upgraded). It runs on passenger and nginx but on my production server it also starts with the environment set to 'production'. I know I am missing something really basic, but I just can't figure out where to set the environment instead of in environment.rb. Thanks for helping! UPDATE: ok, I learned I c...

Why does Rails not like this gem specification?

I've copied my Rails 2 site over to my production server, and when I run script/server on the production server, I get the following: -bash-3.2$ script/server => Booting Mongrel => Rails 2.3.8 application starting on http://0.0.0.0:3000 /home/nwa36a/vhosts/aromapersona.localhost/config/../vendor/rails/railties/lib/rails/vendor_gem_sourc...

Multiple database.yml but one application

The Setup I have a Ruby on Rails application that I manage from a sysadmin perspective. This application in installed on a pool of load balanced application servers. These application servers a running Apache 2 and Passenger 3.0. The application files are stored in a ramdisk because IO on the application servers are ridiculously slow. ...

How do I implement this image annotation javascript using AJAX with Rails?

There is a blog post that details how to do this with PHP, but I'm not clear on how to translate this to Ruby on Rails. For the getUrl, saveUrl, and deleteUrl what do I put so that I can hook it up to my AnnotationsController and create, read, and delete Annotation models? There is also server side code in PHP. jquery-image-annotate i...

Rails Builder::XmlMarkup for Web Service - Repetitive Section

I am using Builder to construct XML messages being sent to a WebService. Each of the different methods require different xml but they all have a set of common elements to start of the request (mostly account authentication stuff). Is there any way to do it in a DRY way? Here is my code for constructing a change pass phrase request: #...

virtual attribute with dates.

I have a form which i'd like to simplify. I'm recording a startdate and an enddate, but would like to show the user only a startdate and then a drop down with number of days. But I'm having problems with my model and storing it correctly. The first part works. def date=(thedate) #puts the startdate in the correct format... ...

Background processing a Ruby web app in a windows environment

I need to perform background processing for a Ruby on Rails app. I'd like to use delayed_job but it depends on Daemons which is not Windows compatible (needs the fork() function). Does anyone have suggestions for an alternative background processing library compatible with Windows that I can use with delayed_job? Or is it best just to u...