ruby-on-rails

Make image in HTML based mail no resizable

I have composed a simple mail message with ActionMailer <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Welcome mail</title> <style type="text/css" media="screen"> img { display: block; position:...

associations in rails from front end

I have a User and Group model. User has_many Groups and Group belongs_to User I already have entries in the user table: id name -------------- 1 testuser 2 someotheruser Imagine if the user with id 1 (testuser) is logged in and I want to create groups inside that user. When I create a new group from new action in Group C...

rails 3 is printing html tags to screen instead of rendering them

I'm using vhochstein's fork of active_scaffold, which runs quite nicely on rails 3, except for a few small bugs - http://github.com/vhochstein/active_scaffold. In rails 2.3, the following code disables a link: return "<a class='disabled'>#{text}</a>" unless authorized But in Rails 3, it causes the escaped html tags to be printed out ...

rake db:migrate not working for me

I am getting this error rake db:migrate (in /Users/john/Sites/my_app) rake aborted! Don't know how to build task 'db:migrate' When I trace the error I get rake aborted! Don't know how to build task 'db:migrate' /usr/local/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1728:in `[]' /usr/local/lib/ruby/gems/1.8/gems/rake-0....

Paperclip error: "no decode delegate for this image format"

I use Windows 7 and I installed ImageMagic. I can run Identify command from console without a problem. But when I use my Rails application (run from Aptana RadRails IDE), it gives me an error: Magick: no decode delegate for this image format `/Users/karl/AppData/Local/Temp/stream,5000,1.jpg[0]'' @ error/constitute.c/ReadImage/532. Mag...

drop down list in rails

I have something basic generated from nifty_scaffold in a partial form: _form.html.erb <p> <%= f.label :group_id %><br /> <%= f.text_field :group_id %> </p> Instead of a text field I want to convert the above from text_field to a drop down list which will be populated with groups which I set below. My new action in Emplo...

how to use rails3-jquery-autocomplete plugin for multiple words autocomplete

Hi, I have use rails3-jquery-autocomplete plugin and I am just wondering how can I use it to do multiple words autocomplete. e.g. INPUT rails, gem it should generate auto-list twice. How to solve this problem?.. ...

Best Ruby editor for Windows with VI commands

I am looking for a good ruby editor that supports VI commands. I have been using gvim but it would be nice to have an IDE that helps me navigate between files. Any suggestions? I realize there is a similar question http://stackoverflow.com/questions/172168/ruby-on-rails-editor-for-windows however it doesn't address VI specific editors. ...

rails has_and_belongs_to_many or manual implementation

I'm designing a ruby on rails app for a pharmacy, and one of the features is that there are stores who have pharmacists who work there. In addition, there are pharmacists, who can work at many stores. This sounds like a job for HABTM, right? Well, being the novice I am, I manually designed a workaround (because I never heard of HABTM ...

Mock out Curl::Easy.perform? (in Curb)

Is there a way to mock out Curb's Easy.perform method for unit testing? I use this to hit Facebook's graph API, and none of the http mock libs seem to support Curb. What's the best approach here? ...

Ruby Gem for intra-site messaging? (think LinkedIn, Facebook, etc.)

Many sites have communication via the site (instead of via email). Examples: LinkedIn: Click "Inbox" at the top of the screen. Facebook: Click "Messages" in the left sidebar. Is there a gem that provides this sort of functionality? Googling hasn't turned up much, because the search terms are so generic - "Rails gem messaging" "Ruby...

In Rails, I'm trying to pass an attribute to a Model's "new" method, then to the "create method". What's the most efficient way to do this?

In my Rails application I have a Forum with many Topics. From the Forum's, "show" page I have a list of Topics with a link to create a new Topic. My goal is to make sure that when creating the new Topic I have the ID of the Forum when I get to the Topic's "create" method. Right now I'm thinking I'd have to create a hidden field on the To...

Accessing a model instance from a different model's controller

I have a Thread model which has a show page, and in that action's view code I have: <%= render 'comments/form' %> What is the proper way to initialize the new Comment? I've tried: @comment = @thread.comments.build(params[:comment]) in the Comment create action and the comment form's view code. Thread helper methods and Model metho...

Rails explictly resolving view helpers with same name

I'm having a conflict between overloaded helper names. ApplicationHelper has a method called 'title' that take 0 arguments LayoutHelper has a method called 'title' that takes 2 arguments I have a layout that calls the LayoutHelper::title when it should be calling the ApplicationHelper::title. The number of arguments in the call is 0 so...

Rails on iPhone with JQTouch login issues.

Hi Everyone, I have a rails app with a mobile view using jqtouch. If the application is viewed on an iPhone application.mobile.erb loads in place of the default application.HTML.erb. Everything works fine, except the login. Users can login and then view the content. However, they have to login everytime they load the site. Is there a ...

Will Paginate pagination options

I am trying to make the next and previous button more defined. Are there any predefined styles that are available to me using mislav-will_paginate ...

ActionController::MethodNotAllowed (Only get and post requests are allowed.):

Not sure what's going on. I've used the following bit of code to try and edit the name of a category, but I'm getting the error message above. My code for the form and submit for the edit is: - <% form_for :category, :url => categories_url(@category),:html => { :method => :put } do |f| -%> <p>Name: <br /><%= f.text_field :name, :size =>...

Cron job plugin for Rails?

Hi What's the best cron job plugin for Rails, if there is one? I just want to send an e-mail reminder at midnight every day to people that fall under a certin category. thanks ...

Going from Javascript to a rails action

I currently have a city that someone will enter into the system and I want to go from my javascript action to a rails action so i can get the city.id from the database. For example my javascript function get_city(city){ //city comes in like "Washington DC" } my rails action def return_city_id @city = City.find_by_name(params["...

checking events that are on tomorrow in rails?

HI i would like to write a method that returns all the events that are on tomorrow or within the next 24 hours. e.g def tomorrows_events @events = Event.will_occur_in next_24_hours end i have a datetime for each event which is called so to get it it would be, @event.date_and_time i have the search logic gem installed but don't kn...