Hay Guys.
I've done a clear reinstall of OS X leopard. So there's nothing on my system at all.
I've installed xcode and im ready to install rails.
However, my system is a macbook (macbook2,1), and apparently it doesnt support support 64bit by default, apple is going to add this at a later date.
How would i go about installing rails? ...
I want to grab the most recent entry from a table. If I was just using sql, you could do
Select top 1 * from table ORDER BY EntryDate DESC
I'd like to know if there is a good active record way of doing this.
I could do something like:
table.find(:order => 'EntryDate DESC').first
But it seems like that would grab the entire result ...
In my routes.rb I've got:
map.connect ':name',
:controller => 'my_classes',
:action => 'show'
And that works perfectly, so a url like this sends params like so:
http://localhost:30000/awesome
Parameters: {"name"=>"awesome"}
But if I have something like this I get this error:
http://localhost:30000/weak.sauc...
I'm trying to upload a mp3 file (using the paperclip plugin) and then read the mp3 info (using the Mp3Info gem) right away so I can get the title, song length ect.
I can successfully upload a mp3 file using paperclip, but when I try Mp3Info.open(@song.music.url), I get an error saying the file is empty. Is there a proper reference to a...
I have a simple form like this:
<form name="serachForm" method="post" action="/home/search">
<input type="text" name="searchText" size="15" value="">
<input class="image" name="searchsubmit" value="Busca" src="/images/btn_go_search.gif" align="top" border="0" height="17" type="image" width="29">
</form>
And a controller with th...
In my application I have groups which are essentially just tags that can be assigned to different models, through a polymorphic relationship. In model Group I have:
def get_members_of(klass)
self.group_memberships.delete_if {|gm| gm.groupable_type != klass}.map{|g| g.groupable}
end
So if I did:
group.group_memberships
I would get...
Hi
I am trying to figure out what I am doing wrong with ActionMailer. I need to be able to pass more than one argument to a mailer but continue to receive the error "wrong number of arguments (1 for 2)".
My code is: soldier_controller
def create
@soldier = Soldier.new(params[:soldier])
@battalion = Battalion.find(params[:battalion_...
Hi folks,
I'm looking for some advice on the best way to provide a single place where ajax status/error messages are displayed for a rails app. This is similar to the rails flash subsystem, but for ajax requests.
Google Reader and gmail are good examples that have this functionality.
Any chance there is a simple plugin that provides ...
Users can edit "articles" in my application. Each article is mastered in the DB and sent to the client as Markdown -- I convert it to HTML client side with Javascript.
I'm doing this so that when the user wants to edit the article he can edit and POST the Markdown right back to the server (since it's already on the page).
My question i...
In my Rails controller I want to branch to a different controller's action, show its view and then return back to my original action, i.e. it's not a simple redirect, more like a sub-procedure call.
I want to use this whenever a user does something suspicious, like editing a post too often in a row. I still want to allow the edit, but f...
Let's assume three models, standard joins:
class Mailbox < ActiveRecord::Base
has_many :addresses
has_many :domains, :through => :addresses
end
class Address < ActiveRecord::Base
belongs_to :mailbox
belongs_to :domain
end
class Domain < ActiveRecord::Base
has_many :addresses
has_many :mailboxes, :through => :addresses
end
...
Hello,
I'm new to OS X and I'm new to Ruby on Rails.
I just installed Ruby and Rails and when going through my first tutorial here's what I got:
WARNING: Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
/usr/bin aren't both writable.
WARNING: You don't have /Users/sammat/.gem/ruby/1.8/bin in your PATH,
gem executabl...
I have a site built in Ruby On Rails which has many ads in different templates and views. It is hard to actualy remove each ad between tests and deployments.
I don't know whether Google approves many impressions (even if without clicks) on localhost.
How do you deal with this issue?
Maybe it is a good solution to set a variable/const...
Suppose I have the following HTML:
html = Four score and seven <b>years ago</b>
I want to parse this with Hpricot:
doc = Hpricot(html)
Find the <b> node:
node = doc.at('b')
and then get the character index of the <b> node within its parent:
node.character_index
=> 22
How can I do this (i.e., what's the real version of the cha...
When I use Rails scaffold, I can't access the page to edit fields. It shows me some kind of problem with all DATE fields. Here's the error:
can't convert Symbol into String
Extracted source (around line #124):
121: </p>
122: <p>
123: <%= f.label :dataDeCadastro %><br />
124: <%= f.date_select :dataDeCadastr...
Followed this question about delayed_job and monit
Its working on my development machine. But whenever I try to run on production, it just dies with following on delayed_job.log
*** Starting job worker delayed_job host:mail.welcometonewnepal.com pid:356
#<Mysql::Error: Access denied for user 'root'@'localhost' (using password: YES)>
**...
Hay Guys, whats the best books to learn ruby (and ruby on rails)?
Any books you guys would recommend?
Thanks
...
I'm migrating my old blog posts into my new Rails blog, and I want their updated_at attribute to match the corresponding value on my old blog (not the date they were migrated into my new Rails blog).
How can I do this? When I set updated_at manually it gets overridden by the before_save callback.
...
I am familiar with the concepts (took testing classes in college), but I am not sure how to really use them yet since I never worked on a "real" TDD project.
I am about to start the development of a project using Ruby on Rails (most likely using 2.3). This application will be used to manage data, users and some files. It won't be too co...
I've created an app that has several models (say A, B) that are polymorphically associated with a Comment model. When one views a page associated with A controller, show action, comments associated with the A object are displayed as is a form to create a new object. All of this works and is similar to Ryan Bates' 15 minute blog posted on...