When building the following factory:
Factory.define :user do |f|
f.sequence(:name) { |n| "foo#{n}" }
f.resume_type_id { ResumeType.first.id }
end
ResumeType.first returns nil and I get an error.
ResumeType records are loaded via fixtures. I checked using the console and the entries are there, the table is not empty.
I've found ...
Hi, the website I'm developing will be in spanish. Therefore, I'll need the error messages in that language.
I created a file under Configuration directory called 'en.yml' in order to accomplish this. And I added the following code in it:
es:
activerecord:
errors:
models:
announcement:
attributes:
...
I'm guessing there's probably an easier way to do what I'm doing so that the code is less unwieldy.
I had trouble understanding how to use the revert_to method... i wanted something where i could call up two different versions at the same time, but this doesn't seem to be the way that vestal_versions works.
This code works, but I'm won...
Hi,
I'm facing a problem of cleaning up my application in Ruby on Rails. What I have is a pretty standard 3-panel, header and footer layout where different parts of the screen contain different functionality.
By that I mean for example that the header contains (among others) a select that allows one to select parts of the application a...
Hi, all.
I have application with 2 groups of models - content based (news, questions) and "something" based (devices, applications etc). I need to link all models between groups - for example question may belongs to 3 different things - one application and 2 devices. The same - for news. From other side - i need to see all news articles ...
I've been researching this one and found references to similar problems here and there, but none of them has led to a solution yet. I've installed passenger (2.2.11) and nginx (0.7.64) and when I start things up and hit a Rails URL, I get an error page informing me of a load error:
no such file to load -- /path/to/app/config/environment...
Hi Everyone,
I have managed to get my email problem sorted so now everytime a case is created an email goes out to the specified address.
I have a usermailer.rb
def makeakase(email, name, jobno, casesubject)
recipients email
from "no-reply@your_rails_app.com"
subject "FW: Kase creation from Survey Manager"
sen...
I need to display a UI element (e.g. a star or checkmark) for employees that are 'favorites' of the current user (another employee).
The Employee model has the following relationship defined to support this:
has_and_belongs_to_many :favorites, :class_name => "Employee", :join_table => "favorites",
:association_foreign_key => "fav...
Hi Everyone,
I have successfully created an email that sends on creation of a Kase, but now I need to attach a PDF that is created on the fly by Prawn and Prawno. Basically when you visit a kase such as application.com/kase/1 you just append the URL with .pdf i.e. application.com/kase/1.
I spent ages getting the PDF to work and look h...
I have some ARes models (see below) that I'm trying to use associations with (which seems to be wholly undocumented and maybe not possible but I thought I'd give it a try)
So on my service side, my ActiveRecord object will render something like
render :xml => @group.to_xml(:include => :customers)
(see generated xml below)
The models...
I have
<%=link_to topic.title, topic_path(topic) %>
- <%= truncate(topic.description_without_embed, :length=>50, :omission =>"...") %>
But what I really want to do is to truncate both the title and the post to 50 characters. How can this be done?
The output should look something like
Lorem ipsum dolor sit amet, consectetur adipisci...
Hi,
I have a local database, and all the tables are defined. Eventually I need to publish my data remotely, which I can do easily with PHPmyadmin. Problem however is that my remote host doesn't allow remote SQL connections at all, so writing a script that does a mysqldump and run it through a client (which would've been ideal) won't hel...
Hello.
How can I parse url string to hash like
{:controller => 'controller_name', :action => 'action_name', :id => 'id'}
?
...
I've been trying to do SEO friendly urls, and managed to get it work, but when I call index action on blogs, I get a weird "undefined method `parameterize' for nil:NilClass." The method works when using show method.
#model
def to_s
title
end
def to_param
"#{id}-#{to_s.parameterize}"
end
#controller
@blogs = Blog....
I am looking to host multiple ruby on rails apps and want to use lighttpd or nginx.How do I do multiple name server configuration. ?
I know how to do it in apache through webmin control panel.But trying to move away from apache here
...
For my client side development I use MooTools primarily, I have also just recently started learning rails. What is the best method of using Mootools in rails pages? Just adding my code inline like I would any other server side language? Or is there a better and cleaner way to do things?
Basically I'm asking the most conventional way of ...
Hey guys!
I want to export the page Info to Excel ,who can tell me how can i do this?
thank you!
...
I am currently building a Rails app, and trying to figure out the best way to authenticate that a user owns whatever data object they are trying to edit.
I already have an authentication system in place (restful-authentication), and I'm using a simple before_filter to make sure a user is logged in before they can reach certain areas of ...
I am building a online form, with about 20 multiple choice checkboxes.
I can get the nested data with this command.
raise params.to_yaml
I need to store these data and call them again later. I want to sort out which user chose which specific checkbox, i.e. who chose checkbox no.2?
What's the best way to store these data in database...
to KIS I have two models: Reservations and Containers.
Container
has_many :reservations
Reservation
belongs_to :container
When I update a reservation I also want to perform call backs on the respective Container.
What is a good way to do this?
Should I be using nested rest routes, put the container logic in the Reservation mod...