What the current stable recommended release of Ruby? 1.8.7 or 1.9.x?
I will be deploying a rails(v 2.3.8) app & was wondering what version of ruby should I be using. My deployment environment is Ubuntu/Apache/passenger (mod_rails)
RubyOnRails.org website says - "We recommend Ruby 1.8.7 for use with Rails"
I want to know - whats the re...
Hello,
I have a quick parsing question. I have a file with the following structure
<admin>
<sampleName>Willow oak leaf</sampleName>
<sampleDescription comment="Total genes">
<cvParam cvLabel="Bob" accession="123" name="Oak" />
</sampleDescription>
</admin>
I'm trying to get out the text "Total genes" after the sampleDes...
I'm implementing a Stackoverflow-like reputation system on my rap lyrics explanation site, Rap Genius:
Good explanation: +10
Bad explanation: -1
Have the most explanations on a song: +30
My question is how to implement this. Specifically, I'm trying to decide whether I should create a table of reputation_events to aid in reputation r...
I've been updating my user test server and now suddenly I got an error every time I invoke rake with anything database-related.
Sample error:
rake db:drop RAILS_ENV='production' --trace
rake aborted!
undefined method `[]' for false:FalseClass
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:96
Here's line 96 of...
I started learning Ruby on Rails and found myself confounded by the syntax, so I had to read about somet of the Ruby syntax. I learned the syntax from http://www.cs.auckland.ac.nz/references/ruby/doc_bundle/Manual/man-1.4/syntax.html:
method_call do [`|' expr...`|'] expr...end
They call it an Iterator. I understand an iterator runs th...
Is it possible to use cassandra with heroku?
...
In PHP, the following would allow me to create a string without having to escape quotes..
$string = <<<EOD
',. whatever <"",'
EOD;
echo $string;
Is there anything similar to it in Ruby/Rails?
...
You can get the current_user's permissions from a view or controller using can? in this fashion:
<% if can? :update, @article %>
<%= link_to "Edit", edit_article_path(@article) %>
<% end %>
How can I access this functionality from a model using this syntax:
user.can?(:update, @article)
...
I have this line..
@organization.search_image = File.open(@photo.photo.path(:original))
Except that 's looking for something local, and all my photos are on S3 now. How would I translate that to opening a file on S3?
...
I am using paperclip to save photos to my users' profiles. Rails is saving the paperclip attachments multiple times every time a page loads. Any ideas on why this is happening?
...
I am using a flash chart library that takes an xml file/string as input. The xml file is generated using a xml.builder file, but I am not sure the generated xml file is actually being found.
If there is a (name).xml.builder file and a (name).html.erb file, does that mean both an html/xml file is generated, when format.html and format...
I need to restrict respond_to to JSON only, because I am constructing a web service that will provide JSON formatted output only. How do I do this?
...
Hi,
I'm curious about the best practice in creating web services which support both XML and JSON output.
At the moment, my service is very XML oriented (see below), but I want to add JSON support.
Here's one example:
def create
render_authentication_error and return if !@user
render_parameter_not_found_error("item") and...
Why would I choose Ruby on Rails instead of PHP or ASP.NET when starting a new middle-sized project that has no restrictions? (not limited by hardware/operating system/memory/etc)
...
Hi All,
I've encountered the following error while trying to create a blogging application. Any ideas why?
NoMethodError in Articles#show
Showing app/views/articles/show.html.erb where line #1 raised:
undefined method `title' for []:Array
Extracted source (around line #1):
1: <h2><%= @article.title %></h2>
2:
3: <% if @article...
My data resembles this:
class Team < ActiveRecord::Base
has_many :persons
belongs_to :leader, :class_name => "Person"
end
class Person < ActiveRecord::Base
belongs_to :team
end
I create the Team like this:
@team = Team.new
for (each new person as p)
new_person = @team.persons.build
new_person.name = p.name
if...
I am trying to use acts_as_taggable plugin to include tag functionality in my ruby on rails application. I have attached the code. I have installed the plugin and also run the migrations.I am getting the following error.
undefined method `each' for "value of the parameter":String
Code
location.rb - location table has name, tags(this ...
I am creating an application where I want to add metadata about table fields from an enterprise system.
I have a table_structure model which retrieves a table definition information like:
table_name
field_name
Field_type
field_length
...
a particular field may exist in multiple tables like:
tableA
fieldX
tableB
fieldX
regardless ...
Hey all
I'm having a few problems with the forgot password system from this tutorial.
My application uses Authlogic for the authentication system and it works perfectly for user login/logout and registrations. However after I followed that tutorial to the letter (password_reset controller renamed to 'reset' and I used my own existing m...
Hi fellows,
I have a problem with a rails app, an intranet that i am developing for my company. The problem is really weird, because i'm trying to reproduce it and i couldn't do it.
The app works without problems in my notebook, on linux with mysql, but in the dev server that we use (which also uses linux and mysql) it hangs up after th...