I have a Rails 3 application, say, with hotels, where hotels belong to parent areas. When a user hits the app (served by mongrel >> nginx), I want the domain name used in the request to decide what area of hotels to serve up (domain name >> area). To achieve this I can see two options:
1) Rewrite the URL with nginx, inserting the are...
Hi All,
Query:
I have a link like
<%= link_to "link_name", :controller => "some_controller", :action =>
"some_action", :id => "some_id", :first_param => {:second_param => "some
value"} %>
and in my routes.rb
map.connect '/some_name/:id' :controller => "some_controller", :action
=> "some_action"
Above code is giving me a URL like
...
I am just starting to learn about Rails (ver. 3), and I am trying to create a user registration form with checkbox options for their interests, which may be 0 or more selections. I generated a User scaffold, and an interest model. I seeded the interests table in Postgresql with data:
Table "public.intere...
I am new to ruby and rails but seem to be getting the hang of it better than I expected...
So I have a few instance methods, within which calls to ruby gems are made. When one of them throws an error, how do I get that to gracefully pass back to the client? Either let it keep going if it can and display an error message, or die and giv...
As the title says, one of my helper functions to render partials isn't rendering correctly.
def render_contact_list
@contact_groups = ContactGroup.find(:all, :conditions => ["user_id = ?", current_user.id])
@contact_groups.each do |contact_group|
@contacts = Contact.find(:all, :conditions => ["group_id = ? and O...
Is there a PHP equivalent of Rails migrations?
Looking for a good solution for configuring schema changes locally and then automatically bumping them to the server without losing data.
...
hi,
I want to test a helper where I use a instance variable inside. I'm using rails 2.3 with the default testing framework. Can please someone write my a simple test (I guess a Unit test) for this? thanks
A simpler version of my code as example.
# controller
@bla = "some value"
# view
<%= foo %>
# helper
def foo
@bla.reverse
end
...
I'm trying to implement a multistep form using a nested form, but since I'm using a nested form, it's not working out like the railscast. I got this from railscast #217 (multistep form/wizards) http://railscasts.com/episodes/217-multistep-forms
old _event.html.erb form
<%= render "event_details", :f => f %>
<%= render "sandwich_detail...
At some point I started getting the error message:
uninitialized constant TaggingsController::Tag
for @tags = Tag.all(:order=>'name') and @tag = Tag.new
previously it had been working. I can see nothing that explains the cause. For at least 2 weeks it worked in production but not locally. Another developer downloaded the app an...
ruby on rails starting guide required
...
I am using the following regex
html.scan(Regexp.new(/Name:<\/td>(.*?)<\/td>/s))
to match the name [ Burkhart, Peterson & Company ] in this
<td class="generalinfo_left" align="right">Name:</td>
<td class="generalinfo_right">Burkhart, Peterson & Company</td>
...
I created a Rails app hosted on Heroku with a Memcache plugin limited to 5 MB.
How can I know about Memcache status, free cache left, biggest cache chunk etc.? Can I access this within the app (an admin page for example)? Or using the Ruby console? Also, is there any graphical plugin for this?
...
I have a rails model called County that has 5 columns of data for different population attributes for that county. There is a record in the counties table for each county in the US. I now need to add additional county level data to meet a new need. The counties table will get an additional 10 or so rows for numeric population data (break...
I have a hex value that I am getting from an XML file and I am trying to use that hex value as the background color for a data table. However, in IE8 it keeps rendering as a string.
When I have used
<%= h(@dhex1[k]) %>
it renders as
<%hex>A8960A<%/hex> with hex tags (note % signs are so browser does not think they are tags)
in...
I'm running a Rails app on Postgres through Heroku.
I'd like to implement similar to Facebook "likes" on my site for various items, such as user comments. What's the smartest way to store these in my database that will be efficient and fast?
The obvious one is just to have a like join table between users and items, something like this:...
I am trying to deploy my first rails app and struggling a bit. My plan is to initially host it on a heroku free account to get a feel for live deployments and do some production testing. Eventually I might move it to a VPS.
I use git and do not use Capistrano at the moment.
Heroku primarily uses git, which is fine, but git manages the...
Hi,
Is there a release date for Ruby on Rails 3? I've been searching but nothing yet.
...
Learning rails and something smells a little funny.
I have the following form for updating quantities in a shopping cart.
<% form_for(:cart, @cart.items, :url => { :action => "update_cart" }) do |f| %>
<table>
<tr>
<th>Item</th>
<th>Quantity</th>
<th>Price</th>
</tr>
<% for item in @cart.items %>
...
I am reading data from an xml doc and placing it on a web page using rails and REMXL. I use
@description1=XPath.match( xmldoc, "////description" )
to get the info into an array and just loop through in my view. However when using
<%= h(@description1[k]) %>
so it looks like
<description>fuzzy slippers</description>
on the web ...