Hey,
Not exactly sure what the errors are indicating. I am getting the following syntax errors:
compile error
app/views/students/student_fail.html.haml:33: syntax error, unexpected tIDENTIFIER, expecting ')'
... :student_fail_attribute params[:StudentFailState.true], pa...
^
app/views/students/student_fail...
So this is my first real Ruby on Rails project. I've learned my lesson -- I didn't make all changes using migrations so things are a bit messed up.
What's the best way to start over with new migration files and rebuild the schema, etc? My project is too far along to rebuild the entire project, but not far enough along to where I care ab...
I need to implement a custom error page in my rails application that allows me to use erb.
I've been following this tutorial (http://blog.tommilewski.net/2009/05/custom-error-pages-in-rails/) and I cannot get it to work locally (or remotely). I am running Rails 2.3.5
Here's the gist of the approach.
1) in the 'application_controller...
Here's my models :
Class Audition
belongs_to :video
end
Class Video
has_one :audition
end
and my factories :
Factory.define :video do |v|
v.filename {Sham.filename}
v.video_url {Sham.url}
end
Factory.define :audition do |a|
a.video {|a| a.association(:video)}
a.label {Sham.label}
end
How could I create a vide...
usually in form_for
I do p.text_field :my_colum_name
but what if I have a select tag?
I tried following but did not work
<%=p.select_tag :conditions,options_for_select([ "a", "b", "c" ], "a") %>
it says select_tag is an undefined method
...
We have Ruby Rails and Apache tomcat servers running on the samw windows server. When the App on Apache Tomcat is installed alone its working fine, but when the ruby app is installed, the Apace Tomcat App stops working. We need to have both the apps running on the same server. Please help. The application running on Tomcat is displaying ...
I want to have a drop down that consists of values 10% 20% 30% so on till 100.
In ruby It can be done by
(10..100).step(10) { |i| p i }
how can i convert this into a select tag?
I tried:
<%=p.select :thc, options_for_select((10..100).step(10) {|s| ["#{s}%", s]})%>
but this is printing 10 11 12 13....100
...
So here is my form
<% remote_form_for([:admin, Page.new]) do |f| %>
<ol>
<li>
<%= f.label(:title) %>
<%= f.text_field(:title) %>
</li>
<li>
<%= f.label(:parent_page) %>
<%= f.select(:parent_page_id, Page.roots.map { |p| [p.title, p.id] }.unshift(["none", nil])...
I'm not sure if I'm able to describe this clearly but I'm going to give it a shot...I've painted myself into a bit of a corner. Obviously there's a bug in my code, so pls pardon the newbie question...
My Rails app uses subdomains like this...
UserAccount1.theapp.com - Primary user
UserAccount1.theapp.com - Secondary user
UserAccount2...
Hey folks, I am looking for something to manage and schedule the execution of rake tasks, like database backups or running reports; something that has a nice web interface so I don't have to use cron. I'm looking at hudson, but it seems this is more geared toward CI builds. Rather than roll my own, does anyone have any recommendations on...
I'm working on a public computer where access to the cmd is restricted, i.e., I cannot access it at all.
How do issue commands such as "rails", "rake", or even install gems among other options I'd normally use the command line for with the cmd?
...
I have a Product and Category table. Category has_many Product and Product belongs_to Category
When I work in console sandbox i can easily get the category a product belongs to by doing:
@p = Product.find(29)
@p.category
However, in the edit page of the Product I am not able to get the category it belongs to.
<% form_for :product, ...
I need a "I accept terms of service" checkbox on a page, it has to be checked in order for the order to proceed. It seems hence illogical to have a column in the database to match this (whether user has accepted or declined terms).
I am using the form helper like this in my view:
<%= check_box("client", "terms") %>
And in my model:
...
Hi i have 2 models
class User < ActiveRecord::Base
has_one :core, :as => :resource
validates_presence_of :name
end
class Core < ActiveRecord::Base
belongs_to :resource, :polymorphic => true
validates_presence_of :email
end
For insert a new user i use a form like this:
<%= error_messages_for :user %>
<% form_for :user, :...
Hi guys! I would like to make a Rails app to create a pretty download page for any file requested either through a link or by typing the url of the file. Is there a way to intercept the request for a file in Apache or elsewhere and send it to the app so it can generate the page?
I'd also prefer not to change the url when redirecting to ...
I'm writing an Ruby on Rails app using a legacy database. The problem I'm having is I have a unix timestamp column in the database. I'm trying to make it so that I can write a string like "2010-10-10" and get a Date when I read it.
def birthdate
bdate = self[:birthdate]
if bdate == 0
''
else
if bdate =~ $CetConfig.regexp...
I'm getting a port error when I try to deploy my app via:
cap deploy:cold
The error:
ssh: connect to host domain.com port 22: Connection refused
My deploy.rb (replaced sensitive info where appropriate):
set :user, 'user'
set :domain, 'domain.com'
set :application, "App Name"
# file paths
set :repository, "[email protected]:git/a...
I'm trying to get my computer (Mac OS X, running Leopard) running with the latest version of Rails. Before this, I had 2.3.5. I tried following some instructions a few days ago, but didn't seem to make much progress. Now, I can't do anything in Rails. You'll see what I mean in a sec.
Theoretically, I've got the latest versions of Ruby:
...
Ruby/Rails does lots of cool stuff when it comes to sugar for basic things, and I think there's a very common scenario that I was wondering if anyone has done a helper or something similar for.
a = Array.new(5, 1)
a.each_with_index do |x, i|
if i == 0
print x+1
elsif i == (a.length - 1)
print x*10
els...
I've used GeoKit and acts_as_geocodable in the past. I like GeoKit, but its missing nicer features like named_scopes. I'm not a huge fan of acts_as_geocodable because it duplicates address data into its own table.
Lately, these gems seem under-maintained.
What are some actively maintained gems out there?
...