ActionMailer and Ramaze
Is it possible to use ActionMailer in a web framework like Ramaze, or do I need to use Rails? ...
Is it possible to use ActionMailer in a web framework like Ramaze, or do I need to use Rails? ...
I have a list of tasks (name, starts_at) and I'm trying to display them in a daily view (just like iCal). def todays_tasks(day) Task.find(:all, :conditions => ["starts_at between ? and ?", day.beginning, day.ending] end I can't figure out how to convert Time.now such as "2009-04-12 10:00:00" into the beginning (and end) of the da...
I'm using Rails 2.3.2, and trying to get a nested object form to work properly. I've narrowed my problem to the issue that Rails is not setting my nested form elements with the *_attributes required to initiate the accepts_nested_attributes_for processing. My model code is: class Person < Party has_one :name, :class_name => "PersonN...
Is there a plugin available to have Rails run through a db:migrate on startup? I'm looking for a solution that doesn't involve calling out to the Rake task via the shell; so, no "system('rake db:migrate')". I can readily write my own plugin to do this, but figured it would be better to use/improve an existing migrate-on-init plugin if ...
I seem to be unable to use :order_by for more than one column at a time. For example, I have a "Show" model with date and attending columns. If I run the following code: @shows = Show.find(:all, :order => "date") I get the following results: [#<Show id: 7, date: "2009-04-18", attending: 2>, #<Show id: 1, date: "2009-04-18", atte...
I have a sequence of ActiveRecord objects that I want to cascade destroy but some of the objects are not being removed. Essentially I have as follows:- class Project < ActiveRecord::Base has_many :tasks, :dependent => :destroy has_many :schedules, :dependent => :destroy has_many :project_schedules, :through => :schedules, :class...
ActiveRecord objects of the class 'Location' (representing the db-table Locations) have the attributes 'url', 'lat' (latitude) and 'lng' (longitude). Lat-lng-combinations on this model should be unique. The problem is, that there are a lot of Location-objects in the database having duplicate lat-lng-combinations. I need help in doing ...
My Ruby on Rails application uses the following controller code to generate a sitemap.xml file: class SitemapController < ApplicationController layout nil def index headers['Content-Type'] = 'application/xml' last_post = Post.last if stale?(:etag => last_post, :last_modified => last_post.updated_at.utc) respond_to...
Am supposed to be learning French at the moment, but rather than learning any vocab, I've been mucking around with a rails app that tests vocab - so it displays a word, and I have to type its translation. Unfortunately, Firefox remembers everything I've already type there, so which diminishes its usefulness somewhat. Is it possible, th...
I'm trying to write a helper method that accepts the name of a plural resource and returns a corresponding link. The essence of the method is: def get_link(resource) link_to "#{resource.capitalize}", resource_path end Clearly the resource_path part above doesn't work. What I'd like is to be able to pass foos to get foos_path and bar...
I'm writing a little browser game as a project to learn RoR with and I'm quite new to it. This is a little method that's called regularly by a cronjob. I'm guessing there should be some way of adding elements to the potions array and then doing a bulk save at the end, I'm also not liking hitting the db each time in the loop to get the ...
I am storing a cost in my application. The cost is not formatted in the database. For example: 00.00 saves as 0, 1.00 saves as 1, and 40.50 saves as 40.5 I need to read these values from the database and convert them to strings for dollars and cents. For example: 0 --> cost_dollars = "00" & cost_cents = "00", 1 --> cost_dollars = "01...
I have done some work with Ruby on Rails but am still not comfortable writing a Rails app from scratch. My problem is that I am not able understand how to get the right model going when trying to write the application from scratch. I thought seeing the code of a complete existing application may help but am not sure. What should be the w...
Update: This gem DOES install with sudo rake gems:install. The problem is with loading. For instance, when I run script/console, it throws: no such file to load -- outoftime-noaa ... Even though sudo rake gems:install just installed it. I'm not sure if this matter, probably does, but it throws this error twice. -=-=- I'm looking...
Hello I am creating a web app that uses Rails built in helper functions to add ajax functionality to the site. I do not want the user to be able to use the app without JS as it will not function properly. I need to be able to prevent this. How can I go about stopping the user from loading any of my pages without JS? I have tried to us...
Someone who understands how rails caching works can really help me out here. Here's the code, nested inside of the Rails::Initializer.run block: config.after_initialize do SomeClass.const_set 'SOME_CONST', 'SOME_VAL' end Now if I run script/server and make a request, everything is dandy. However, on the second request to my Rails ap...
I am doing a very simple search on my DB using acts_as_ferret. I put this in my "Venue" model: acts_as_ferret :fields => [:name, :city] And this is in my controller search action: @t = Venue.find_by_contents(params[:search]+'~') and then I just render the results. render :text => @t.to_json, :success => true, :status => :ok I...
Same as http://stackoverflow.com/questions/658689/how-to-associate-labels-with-radio-buttons but for a rails app. I have a form with some radio buttons, and would like to associate labels with them. The label form helper only takes a form field as a parameter, but in this case I have multiple radio buttons for a single form field. The o...
Is it normal behaviour to not get the <div class="fieldWithErrors"> wrapped arround select tags that have validation errors? I personally see no reason why the select tags should be treated differently than other form tags (input, textarea). I do get the error in error_messages_for and error_message_on methods for that field. PS. I hav...
I have some text around an image that has been floated left. But the text goes right up against the border of the image. How do I make some white space around it? At the moment I've got in the CSS: .image { float:left } and the view: <% if article.newspic.exists? %> <div class ="image"> <%= newspic_thumbnail_tag(articl...