ruby-on-rails

Is Amazon SQS the right choice here? Rails performance issue.

I'm close to releasing a rails app with the common networking features (messaging, wall, etc.). I want to use some kind of background processing (most likely Bj) for off-loading tasks from the request/response cycle. This would happen when users invite friends via email to join and for email notifications. I'm not sure if I should just...

Running laika within netbeans with jruby 1.1.6

I'm Ruby/Rails newbie and trying to get the laika tool (http://github.com/CCHIT/laika/tree/master) running within NetBeans IDE. I'm getting the following exception. I'm using NetBeans IDE 6.5.1, JRubby 1.1.6 and GlassFish V3. Any ideas what might be wrong? INFO: Jruby version is: 1.1.6 INFO: Starting Rails instances SEVERE: Exception...

Rails: Keeping user spoofing checks DRY

In a fit of unoriginality, I'm writing a blog application using Ruby on Rails. My PostsController contains some code that ensures that the logged in user can only edit or delete their own posts. I tried factoring this code out into a private method with a single argument for the flash message to display, but when I did this and tested i...

What is this embedded ruby delimiter? -%>

"-%>" appears in some code in a tutorial I'm doing, as a delimiter of some embedded ruby, like this: <% 5.times do |i| -%> <%= thumbnail_tag slideshow.slides[i] %> <% end -%> What does it mean? There's nothing in the book about it (Rails Up and Running) ...

ruby on rails x charset

hi, i'm having problem to deal with charset in ruby on rails app, specificially in my templates. Code that comes from my database, works fine, but codes like ç ~ that are located in my views are not working. I added the following codes to my code I added a function like that, but that still not working i have ç ~ codes in my application...

How to get an eager loaded conditional to be lazy loading later on with ActiveRecord and Rails

First let me show some code. class User has_and_belongs_to_many :roles named_scope :employees, { :conditions => ["roles.name = 'Employee'"], :include => :roles } end OK, so later in a controller I wanted to search for all the employees right. I set the named scope up to help do that with the join and conditional search. But the pr...

Rails: How to override stylesheet_path

Hi, I've been trying to override Rails' stylesheet_path helper, but I haven't found a way how. I can't just open the ActionView::Helpers::AssetTagHelper module and override it there, because Rails won't pick up my new method. I know it's probably because the module gets mixed in, so how do I get around that? ...

How to get product information from amazon, just based on the URL?

I just have a link to a product page, at amazon. How do I get all the information (photo, price etc), in my ruby program, just using this link? ...

Is it possible to look beyond self in self.posts.find?

Expanding on recent_posts_on_self below, I want to add an all_recent_posts_on_self method but I'm not sure if it's possible using the syntax self.posts.find. On the other hand, all_recent_posts_on_class seems straightforward. class User < ActiveRecord::Base has_many :posts, :class_name => "Post" , :foreign_key => "author_id" has_man...

How do I painlessly receive mail in linux and feed it to Rails?

I've been googling all night for postfix howto's, but still I couldn't figure out how do I manage to receive email on linux-server (being more specific - Ubuntu). All I need is a catch-all mailbox which gets all emails and feeds them to the ruby script (which then passes it to Rails, of course). I was able to set-up postfix for sending ...

Changing the look of form buttons

With this little bit of CSS, my form buttons now look flattened (2D) and I quite like the look: input { border: 1px solid #999; } However, for file fields (select file to upload), the button is still 3D. And then the border goes all around that button and the text next to it. I tried fixing this problem by renaming input to .input,...

Insert form buttons outside a form

Is there a Rails library that allows you to insert form buttons and use them as hyperlinks instead? I think I've seen it somewhere before. ...

says if i develop a Ruby on Rails application using Rails 2.3.2, will that usually be compatible with Passenger on my hosting company?

says if i develop a Ruby on Rails application using Rails 2.3.2, will that usually be compatible with Passenger on my hosting company? If i ssh to my hosting company and type rails -v, i get 2.2.2... so looks like they might be using Rails 2.2.2. So if i develop a Rails app on my Macbook and ftp all files over there, will the Passenger...

Grouping by week/month/etc & ActiveRecord?

I'm doing some statics calculation in my product. A user has performed a number of operations, let's say posted comments. I want to be able to show them how many comments they've posted per week for the past month, or per month for the past year. Is there any way with activerecord to group this way? Is my best best to simply do thi...

why on Ruby on Rails, http://localhost:3000/stories/newnew will look for record id=newnew ?

using Ruby on Rails 2.3.2, since I already created Scaffold for Story, so instead of experimenting and creating a new action called "new" ("new" already exists from the scaffold), i used "newnew" in the controller file and in the view file, hoping that http://localhost:3000/stories/newnew will be another way to create a new record....

in Ruby on Rails 2.3.2, how to print out params during a create action?

there is a scaffold created Story... and in the create action, there is @story = Story.new(params[:story]) i was curious as to what is in params... so i want to dump out params... but there is no view associated with the create action... is there a way to dump out its content? is there a way to dump out the POST variables in of my c...

Ruby on Rails model inside namespace can't be found in controller

I'm new to rails and can't figure out this issue... I have a controller Admin::Blog::EntriesController defined in app/controllers/admin/blog/entries_controller.rb And I have a model called Blog::Entry defined in app/model/blog/entry.rb When I try to access my model from the controller, I get a "uninitialized constant Admin::Blog...

counter cache doesn't update but I can save to the parent and the child

I added a counter cache but can't get it to update. But I can update the parent - the Blog Post model by adding a new blog post - and I can update the child - Comments model - by adding a new comment. The counter cache is supposed to keep track of the total number of comments per blog post by auto-updating the blog_posts.comments_count f...

In Rails why do we use form_for @story do |f| when there is no loop?

we use (1..10).each do |i| p i end so that a value is "yield" to i in a block... but what about <% form_for @story do |f| %> <%= f.text_field :name %> <% end %> there is no loop at all... why do we need to make it look like a loop? Can't we do it without making it look like a loop? (write in another way)? Also, must be use ...

Ruby on rails gem for google map integration

Hi there, I would like to ask which is the best solution for integrating google maps into ruby on rails apps. Is a specific gem worth it or should we write our own views for it? Thanks for any input. ...