Hi everyone,
I use vim with various plugins for editing ruby code. I have proper syntax highlighting set up but I was wondering if anyone knew of a way to get ruby syntax checking, similar to what you might see in an IDE such as visual studio, radrails, etc?
Something that would simply turn stuff red or break highlighting when I'm m...
Anyone have any idea why the following code is resulting in an "undefined method 'grouped_options_for_select' for #<ActionView::Base:0x43881ec>" error?
@user_options = [['Group 1',['User 1','User 2']],['Group 2',['User 3','User 4']]]
select_tag('ufc[proponent]',grouped_options_for_select(@user_options))
I'm about to pull my hair out, ...
Hi
I want to send multiple ids that selected with checkboxes to the controller in this code :
<% form_for :product do %>
<table border="1px">
<tr>
<th>
Select
</th>
<th>
Image
</th>
<th>
Product Name
</th>
<th>
Product Descripti...
I have a boss who is convinced learning Rails is too steep a learning curve and not cost effective from a labor standpoint when straight Ruby running as a CGI app on Apache is available. He is proposing, for our rewrite, that we use straight Ruby w/ no framework rather than Rails (or Merb, Sinatra, etc.) I believe in my heart that this...
I have an ImagesController that kicks off a non-trivial save operation. Here's the high-level background:
I have several different physical file types to deal with in my application. Each of these belongs_to a Binary. Files can be created, of course, and this process involves uploading a physical file to a temporary location, possibly v...
I'm finding that autotest has stopped working...
$ autotest
loading autotest/rails
Autotest style autotest/rails doesn't seem to exist. Aborting.
According to this blog post, the common reason for this error is that people don't have the autotest-rails gem installed. However, I definitely have that installed:
autotest-rails (4.1.0)
Z...
Hey everyone,
This is probably pretty basic, but I'm trying to figure out how to show how many comments a post has in rails, on the post index page of my app.
comments belongs_to post, and post has_many comments
Just not sure how to show on the index page, the amount of comments for each post.
Thanks in advance!
Elliot
...
I just started working on a website that will help people understand what rappers are talking about. Users will see the lyrics to a rap song and they'll be able to click certain lyrics to see an explanation. Here's a screenshot (you can also check out the site itself here):
(Original lyrics censored; click here to see them)
Anyway, m...
I'm working with the Rails mislav-will_paginate plugin to paginate my records. I want to produce the following output, regardless of whether there were multiple pages:
X - Y of Z
1 - 100 of 1826
will_paginate in WillPaginate::ViewHelpers returns nil if there was only one page of records. I want to override this in the cleanest possibl...
@father = Hierarchy.find(:first, :conditions => ['label = ?', 'father'])
@father.children.each do |child|
puts @father.object_id == child.parent.object_id
end
I would have thought the results here would be all true.
Instead they are all false.
Why does ActiveRecord work this way instead of recognizing that these are the ...
Please see UPDATES at the bottom of the question...
For reference, this problem evolved out of some fixes I made based on a previous problem I was having here: http://stackoverflow.com/questions/1298846/associating-two-models-in-rails-user-and-profile
I'm building an app that has a user model and a profile model.
I want to associate t...
I'm trying to access my Amazon S3 account using the aws-s3 gem, but no matter what I do, I can't even print a bucket list.
Error:
undefined method `bytesize' for #<AWS::S3::Bucket:0x1b9e488>
From Code:
# hello_world.rb
require 'rubygems'
require 'sinatra'
require 'aws/s3'
get '/' do
connection = AWS::S3::Base.establish_connection...
I am making a data intensive web application that I am trying to optimize. I've heard of forking and threading, but I have no idea whether they are applicable to what I am trying to do and if so how to implement them. My code looks like this:
def search
@amazon_data=Hash.from_xml(item.retrieve_amazon(params[:sku]))
unles...
Reading along with the agile book, it says this in a footnote:
... You simply pass the select helper the result of doing a find(:all) on your lookup
table.
Okay ...
<%= f.select :source, Source.find(:all) %>
My source controller (and therefore table) looks like this:
create_table :sources do |t|
t.string :source
t.times...
Hi, I want to something like the following:
@user.update_attributes(:name => "Obama", :profile => { :current_location => 'US' })
where User has_one profile.
...
I'm trying to make a threaded comments system that behaves like Reddit's: I click "Reply" on a comment, a form shows up. This form has a "Cancel" button that removes the form, going back to the original state.
I'm trying to achieve that with one link_to_function that adds the form, and the form itself has a button_to_function to remove ...
How can I validate Rails model string attribute that it belongs to specific language alphabet characters?
Thanks.
...
How to return the number of Posts Tagged with "example" using acts_as_taggable under ROR
currently I am implementing this by declare
<%=Questions.find_tagged_with("example", :match_all => true).size%>
I wonder if there is any other better solutions out there, thank you in advance!
...
So basically I have a controller. something like this
def show
@user = User.find[:params[id]]
#code to show in a view
end
User has properties such as name, address, gender etc. How can I access these properties in the model? Can I overload the model accesser for name for example and replace it with my own value or concatenate someth...
how to avoid cross site scripting in "ruby on rails"
i used the code below
<%= link_to h(@user.name), user_url(@user) %>
and, i want to know, how and where do we check this script is working or not.
...