ruby-on-rails

Net::SMTPAuthenticationError 502 5.5.2 in Rails ActionMailer

Hi, i'm trying to send confirmation email to the user. But i get following error: Net::SMTPAuthenticationError (502 5.5.2 Error: command not recognized Configuration in production.rb is following: # Disable delivery errors, bad email addresses will be ignored config.action_mailer.raise_delivery_errors = true # set delivery metho...

jQuery strategy question

I have migrated frameworks from prototype to jQuery in my Rails apps, and I'm running into a consistent problem which I need some advice on. Often times I'll use an AJAX function that updates a portion of the page. When this happens, any other Javascript I use that relates to the section of the page that was updated no longer works. ...

Default value for select field from query string.

I have this link in my code: link_to "New question", new_question_url(:category_id => @category.id) I have this code in my new question form: <p> <%= f.label :category_id %><br /> <%= f.collection_select :category_id, Category.all, :id, :name %> </p> How can I make Rails automatically select the category from the category_id qu...

How to view an HABTM check box list inside a nested model

I'm running into a problem viewing a list of 'category' checkboxes when I try to nest them in a fields_for form. I have a 'product' model that 'has_many' 'photos' which 'has_and_belongs_to_many' 'categories'. I'm pretty sure all my associations in my models are correct, as is my joins table for the 'photos' and 'categories' relations...

AWS S3 with Rails problems with caching and reloading.

I have a bit of code like so which works fine if the file in question doesn't already exist. if AWS::S3::S3Object.exists? file_name, bucket.name + path_to_images puts "file exists (deleting)" AWS::S3::S3Object.delete file_name, bucket.name + path_to_images, :force => true end AWS::S3::S3Object.store file_name, File.read(file_pa...

/public/rails folder missing

In new rails installation the rails application doesn't contain the /public/rails/ folder and you can't see application properties from the default index.html page ...

How to tell ruby on rails, not to insert to a column ?

I have a table, with merge replication on it (SQL Server 2005). There is a rowguid column. I want RoR to ignore this column, and not insert into this, and not include this when generating the INSERT statement. ...

rails trim whitespace from searchlogic text field

This works: Baseline Controller @search = Baseline.search(params[:search]) @baselines = @search.paginate :page => params[:page], :per_page => params[:per_page] baseline index view <% form_for @search do |f| %> <%= f.text_field :baseline_name_like_or_description_like %> <%= submit_tag 'Search' %> <% end %> Where would I trim t...

Why am I getting Paperclip::CommandNotFoundError with deploy and not on my local?

[paperclip] identify '-format' '%wx%h' '/tmp/stream,3360,1.jpeg[0]' 2>/dev/null [paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandNotFoundError> [paperclip] identify '-format' '%wx%h' '/tmp/stream,3360,1.jpeg[0]' 2>/dev/null [paperclip] An error was received while processing: #<Paper...

simple user authentication and creation plugin in rails?

Hi i have a simple record system in rails, it has customers, appointments and visits as models. with visits and appointments belonging to customer. i want a simple authentication plug-in for the owner of the application, to be able to log in and edit and create new data in the system (administrator user) and be able to add new admin ...

rails formtastic habtm in and out

EDIT: looking for this: http://diminishing.org/extending-formtastic-with-a-sprinkle-of-jquery (If this works I'll answer my own question) I've started to create an in and out type habtm (has many and belongs to many) form through formtastic. However I would like it to be more flexible to the user, meaning if you select a name on one si...

Difference between Ruby 1.8.6 and 1.8.7?

What are the main reasons or pros/cons somebody would choose to work in 1.8.6 over 1.8.7 or vice versa? So far I can only find this answer, which is from the latest version of the Agile Rails beta e-book: "Rails 3.0 requires requires Ruby version 1.8.7 or Ruby 1.9.2-preview3. (It is known not to work on Ruby versions 1.8.6, Ruby 1.9.1...

Observe field is not doing anything

I want a search field to start outputting results once a user starts typing. This is my view: <%= observe_field 'keyword', :url => { :action=> 'search_results' }, :frequency => 0.5, :update => 'results', :loading => "$('.spinner').show()", :complete => visual_effect(:slide_down, "results", :d...

RoR - how to update facebook status with RoR ?

sorry, if my english so bad.. i created a simple auction app with RoR. in my app, if i create a new auction, i want my facebook status update with the new auction that i have created. how to do that? nb: this is not facebook app. what should be required? oauth? help me please ...

How to assign the contents of one model to another in Rails?

I have the following create action: def create @order = Order.new(params[:order]) if params[:same_as_above] == "1" @order.billing_address.name = @order.shipping_address.name @order.billing_address.number = @order.shipping_address.number @order.billing_address.street = @order.shipping_address.town end ...

What is the correct status code for a RESTful resource when the request method is allowed, but the action cannot be completed

... due to server-side rules. Specifically, I have comments that nest, and I am forbidding the deletion of comments with children. So when someone requests: DELETE /comments/5 where the 5th comment has children, I do not allow the comment to be deleted. What is the appropriate HTTP status code? I use a 405 elsewhere on the site, but...

how to build on ActiveRecord association before parent object has an id?

Hi, I have a model, Foo, that has_many Bars. It has a virtual attribute, current_baz, that returns the baz attribute of the latest Bar from the association (if one exists). I'd like to define Foo.current_baz= so that one can say my_foo.update_attributes(:current_baz => 7), and in particular, I'd like it to work when a new Foo is created...

How to benchmark and optimize a really database-intensive Rails action?

There is an action in the admin section of a client's site, say Admin::Analytics (that I did not build but have to maintain) that compiles site usage analytics by performing a couple dozen, rather intensive database queries. This functionality has always been a bottleneck to application performance whenever the analytics report is being...

Div Showing Up At Incorrect Location

I have a that contains two nested div's. One of the nested div's contains a javascript graph. When the page renders, the javascript graph is at an incorrect location, outside of the 's area. Does anyone know what I am doing wrong? Here are the css: #graph_container{ width: 75%; margin: 0 auto; background-color: #FFF; pa...

Any way to use attachment_fu with a custom asset server?

I have a rails app using attachment_fu for uploads. Is there any way to use a custom asset server with attachment_fu? In the end, I want all of my file uploads to go to files.example.com. And example.com to pull all resources from there. Any help is appreciated, thanks! ...