Hi,
I've been using online tutorials to learn ROR. I've used www.lynda.com video lessons to get a basic idea what Rails is all about, and for practice I used Rails version 2.0.2, during my training period. But now I'm into a development team in a starter company where there are no senior/experienced programmers to assist me and we're wo...
I have a table that contains a column for a boolean value. I want there to be only one row that can have that boolean value be true. Does rails support such a feature?
I'm looking for something like the following:
Table
id | bool_value
1 | false
2 | false
3 | true
4 | false
...
I have a quite big application, running from inside spree extension. Now the issue is, all requests are very slow even locally. I am getting messages like 'Waiting for localhost" or "waiting for server" in my browser status bar for 3 - 4 seconds for each request issued, before it starts execution. I can see execution time logged in log f...
At the moment, I have this run of code:
<%=h current_user.notes.collect { |t| t.name }.join(', ') %>
which outputs this:
note 1, note 2, note 3
How can I change it so that the output looks like this?
"note 1", "note 2", "note 3"
Thanks for reading.
Edit: Here is the full code of KandadaBoggu's suggestion below
$(window).ready(...
Hi,
I was wondering if anyone knew how to update the files (adding/removing/updating an attribute) produced by using the scaffold generator in ruby on rails.
For example:
scaffold student name:string lastname:string
so this will create a the associate files (controller,view,etc) with name and lastname as string attributes. When you ...
Hi,
I am sending data via get and I need to put it into a int array to be used in a find.
here is my code :
@found = Array.new
params['candidate'].each do |c|
@found << c.to_i
end
My url looks like this
http://localhost:3000/export/candidate?candidate[]=3&candidate[]=4&commit=Export
If it makes any difference I am u...
I have a customer that wants to build their own questionnaires. Something like WuFoo (www.wufoo.com) but more secure and contained within the app.
I've looked at Smerf (http://github.com/springbok/smerf) which provides the yaml-to-form conversion, but I'd like something the user can use to create their own forms.
...
Hi,
How can I debug rspec specs with an IDE? specifically I'm using the following:
* Ubuntu 10.04
* ruby 1.9.2-dev built with rvm
* rails3-beta4
* NetBeans 6.9
I have installed the ruby-debug19 and the ruby-debug-ide91 gems, but NetBeans doesn't recognize my fast-debugger. Besides trying to debug a spec in NetBeans gives the follow...
Why does rails use @poop object instance variables instead of just a local poop variable in the generated code? Is there some foreseen common situation where it's useful rather than simply using a local variable here? I would think it makes sense to use a local variable and not attach something to the object namespace unless you need it ...
Hi,
I am trying to receive data at one controller and then save it on another controller/model
From the api I wrote the following:
class ExportController < ApplicationController
def search
@assignment = Assignment.find_by_id(params[:assignment_id])
@assignment.candidates.new(params[:candidate_ids])
@assignment.candidates...
I have this view:
new.html.haml
%h1 New account
- form_for @user do |f|
= f.error_messages
= render :partial => "form", :object => f
= f.submit "Create account"
_form.html.haml
= form.label :email
= form.text_field :email
%br/
= form.label :password, form.object.new_record? ? nil : "Change password"
= form.password_field :pas...
Hey, I'm writing a personal bookmarking application, and looking for a way to keep track of favorite feeds.
All written in Rails.
Thanks
...
Hi folks,
I use Rails 3.0.0.beta4
I want to add a validation on uniqueness on two attributes, that means that my model is valid if the couple of 'recorded_at' and 'zipcode' is unique.
On one attribute here is the syntax
validates :zipcode, :uniqueness => true
thanks
...
Suppose you are working on an API, and you want nice URLs. For example, you want to provide the ability to query articles based on author, perhaps with sorting.
Standard:
GET http://example.com/articles.php?author=5&sort=desc
I imagine a RESTful way of doing this might be:
GET http://example.com/aritcles/all/author/5/sort/desc
...
So I am getting this error for one of my routes. I'am running Rails v2.3.8 + Mongrel 1.1.5. Does rails support only GET & POST??
ActionController::MethodNotAllowed (Only get and post requests are allowed.):
The route defined in my routes.rb is -
map.connect "#{base_url}/r/:id/rate?v=:value&u=:user_id", :conditions => { :method => :pu...
I need to serialize a matched set so it's values can be passed to my rails app.
The matched set code is (returns the parent div of every uninitialized select element):
jQuery('select').filter(function(index){
return jQuery(this).val() == 0;}).closest('div')
for serialization I really only need the id of each matched element so I...
I have this code somewhere in my controller:
raise PermissionDenied
When this is executed, I want to show a custom error page written in HAML, rather than the default NameError page.
Can anyone help me? Thanks.
...
I'm not sure what I could be doing to get this error. Obviously, I don't think I should be creating the specific file it mentions in my app\views folder. Can anybody point me in the right direction?
...
I have a route that looks like the following:
map.newsletter '/newsletter', :controller => "newsletter" , :action => "newsletter_signup"
There is also a NewsletterController and a Newsletter model. The thing is, I wanted to keep my controller down to one simple method, newsletter_signup. In there I simply check if the request is of ty...
More specifically, I need to create <button type="submit">Foo</button> type markup in my Rails form. Is there a helper for that?
...