ruby-on-rails

RoR: Mailing Lists?

Are there any gems or plugins out there that make managing mailing lists (just for updates and announcements; not marketing... ie, MailChimp is overkill) easy to administer? Or is that just something that most Rails developers just build from scratch? Just curious. ...

How to get current URL in Rails?

How can I get current absolute URL in my Rails view? The request.request_uri gives me only relative URL. ...

XCode - Ruby on Rails Project Templates

Where can I find project templates for Ruby on Rails to use within projects? I am using Xcode version 3.2.2. From what I understand, Apple stopped shipping all project templates with xcode and made them available as optional downloads, yet I cannot find the templates for Ruby on Rails anywhere. Regards Mick ...

Performing multiple database operations in a single REST call

I am trying to figure out the best way to call REST actions that perform multiple actions and multiple database updates from a single call. In my data model, I have Diners and LunchBoxes, and Foods. LunchBoxes are just many-to-many relationships between Diners and Foods, but with a count attribute that says how many of that type of f...

Looking for a UK PHP cPanel reseller

Hello, I was wondering where I would be able to get a good cPanel reseller hosted in the UK at a sensible price. I am currently hosted by ResellerZoom in the US but I find the speeds very poor and so am hoping to move. Does anyone know anyone good at a low price which takes Paypal, or is a reasonably well known host? I don't need much ...

Are there other search options for heroku

I am about to launch a beta site, and heroku looks like a great option. The only think that is getting me down is that the only search option is $20/mth for the Websolr add-on. I am sure that Websolr is great, but at this very early point in this project, I rather not light up that expense. Are there any free search options to couple ...

How do I sort the rows in a nested object form in rails for just one view?

When working with a nested model in a form, is there a way to sort the nested models in the view or in the controller? The closest answer I could find was here, but both of those solutions involve putting sort orders in the model. I'd rather avoid changing things fundamentally like that and keep this particular sort order to just one pag...

Rails-friendly DHTML grid?

I have an Excel-based UI that I'd like to replicate as closely as possible in a Rails view. I'm looking for a DHTML grid control that ... can be easily formatted (w.r.t. column width, font size, etc.) is responsive (the page will have up to 200 columns and 200 rows) can have cells containing select controls has good Rails integration (...

Multiple foreign keys referencing the same table in RoR

I want a Customer to reference two Address models, one for the billing address and one for the shipping address. As I understand it, the foreign key is determined by its name, as _id. Obviously I can't name two rows address_id (to reference the Address table). How would I do this? create_table :customers do |t| t.integer :address_i...

Add a logout button in RESTFUL authentication

hi...I've installed RESTFUL authentication and everything seems to be working fine. i can signup and login. the only way i can logout is by typing in the URL http://localhost:3000/logout how do i add a logout button on a page? i tried adding one to the members.rhtml <%= link_to "logout", :controller=> "sessions", :action=> "destroy" %>...

difference between tableize and underscore in rails

Not sure what the difference between underscore (student_state) and tableize (student_states), other than tableize also pluralizes. However, not sure how they can be used differently. Obviously, you can use tableize to reference table name in database. But what different functionality does underscore provide, such as when you see :studen...

Rails form helper fails

Ok this is my first app in rails so hopefully this is a simple problem. Here is my object: - !ruby/object:ProductImage attributes: image_id: product_id: created_at: updated_at: attributes_cache: {} This works: <%= image_form.text_field :product_id %> But I get undefined method `image_id' for: <%= image_form.text_field :image_id %...

How to overwrite/extend existing spree classes in app/models?

Hey guys, I want to extend Class Role such that I can add more roles to the roles table in Spree. My application would have different prices based on roles. By default roles have: ("admin" and "user") in it. I want to add more types to the table. Q1: Can I just extend the Role class in one of my extensions? Q2: How can I implement (ac...

Ruby on Rails: Seeding data for a user upon signup?

I'm trying to create default seed records for every user that signs up to the app. I'm thinking I could use the after_create method in my users observer model: def after_create(user) user.recipes.create(:name => "Sample Recipe", :description => "This is a sample recipe.") user.cuisines.create(:name => "Sample Cusine", :description =...

RoR app running on mongrel development but not production

Hello all, This is my first stab at Ruby on Rails. Just deployed a very simple app to Heroku. The thing is that my app runs flawlessly on mongrel development; When I run it with "mongrel_rails start -e production" however, I get the error "We're sorry, but something went wrong." For the life of me, I couldn't debug this. Heroku logs i...

How to resuse deleted model id number in Rails?

Say I have a Post model. When I delete last post 'Post 24', I want the next post to take id of Post 24 and not Post 25. I want to show id in views and I don't want missing numbers. How do I do that? Thanks for your help. ...

If I use :class_name attribute to has_one, what do I put in the migration?

Hey all - I have a model in my Rails app that uses the :class_name attribute for has_one: class Foo < ActiveRecord:Base has_one :main_bar, :class_name => "Bar" # ... end I'm a bit unsure what to put in the migration for this class now. Can I use references? What will Rails be looking for as the column name for :main_bar? Can I d...

3D coordinates from disparity map

hey hi.. i m using ubuntu 9.04 and opencv 2.0 version.. i am successful in finding disparity map of stored image and having problem in finding 3D coordinates from disparity map.. plz help me to solve this problem as soon as possible ...

Button_to uses POST Link_to uses GET, why? ROR

I've ran into a ror problem using the link_to. Why does my link to use the GET method and my button_to use the POST method, after I specified my "method"=>"post" within the link_to parameters? View: <%= button_to "pdf", :action => 'getquote' %> <%= link_to 'pdf', {:controller => 'inventories', :action => 'getquote', :method => :post }...

How to use alerts and prompts JS dialogs in Ruby on Rails implementation of Selenium?

I'm learning Selenium now. I'm going to use it in the Ruby on Rails project. Now I created demo project just to test Selenium on Rails. Content of #{RAILS_ROOT}/test/selenium/articles/delete_article.rsel is following: setup :fixtures => :all open "/articles" assert_text_present("First Article title") assert_text_present("Destroy") c...