similar to: Better way for select list for belongs_to?

Displaying 20 results from an estimated 10000 matches similar to: "Better way for select list for belongs_to?"

2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
Hi All, just in a spot of bother with this gem, I am trying to create a new location and get the above msg. here is my controller: class LocationsController < ApplicationController # GET /locations # GET /locations.json def index @locations = Location.all @json = Location.all.to_gmaps4rails end respond_to do |format| format.html # index.html.erb
2007 Jul 12
3
Agh, this is annoying. Why is this happening?
My problem: Mock ''Task_1005'' received unexpected message :user_id= with (1) No matter what I do to try to stub that out it will still fail out and give me that message. Here is my spec describe TasksController, "handling POST /tasks" do before(:each) do @task = mock_model(Task, :to_param => "1", :save => true)
2008 Sep 10
5
xmlhttprequest for updating
Hello, I am updating an object with an AJAX form: view: <% remote_form_for(@sample, :update => "content2") do %> <p> parameter: <br /> <%= select("sample","parameter",Parameter.find(:all).collect {|p| [p.description.gsub(''_'', '' ''),p.id]},{},{:size => 4, :multiple => true}) %>
2006 Jun 24
5
request.xhr? vs. respond_to
Searched around this forum, but didn''t find an answer for this question. Can you help this newbie understand any overlap and/or difference between request.xhr? and respond_to? If request.xhr? is true, should I expect it wants.js below? respond_to do |wants| wants.html { redirect_to(person_list_url) } wants.js wants.xml { render :xml => @person.to_xml(:include
2008 Aug 28
12
Rendering User attributes in XML
Let''s say an app has a User, and a User has many friends. Also, let''s say the app authentication was built on the restful_authentication plugin, and we have email and password in the Users table. The friends controller index might look like this; # GET /users/1/friends # GET /users/1/friends.xml def index @users = @user.friends respond_to do |format| format.html
2009 Jul 13
6
first app on Dreamhost with Passenger : "rails needs to know your username and password" ?
I am trying to deploy my first rails app with Dreamhost. I ftp''d over my existing app, turned on Passenger and pointed it to my /public directory. When I go to ''www.mydomain.com'' I get the ''Ruby on Rails: Welcome aboard'' default page, including the following: Getting started Here’s how to get rolling: 1. Create your databases and edit
2006 Nov 23
2
Some tips for testing respond_to block and making controller tests work with simply_helpful
Hi, Here''s two blog posts for those that need to test respond_to blocks and/or are currently using simply_helpful extensively. http://blog.methodmissing.com/2006/11/22/testing-different-content- types-with-rspec http://blog.methodmissing.com/2006/11/23/using-simply_helpful-with- rspec-controller-tests - Lourens
2007 Dec 06
2
Implementation of rest in ROR
Hi all, I am new to ROR world. I know the REST conceptually but find the difficulties in implementation can anybody guide me that which is the best book which i have to read. also some good links of implementation of rest in ROR. If anybody made a small application to restful in rails please forward me that application. i found some demo but i didn''t understand for what purpose they
2007 Apr 24
1
problem POSTing with curl and REST using scaffold_resource
I issued the following curl command to post to the database using REST: curl -i -X POST -d "<heartrate><heartRate>102</ heartRate><sessionID>1002</sessionID><timeStamp>15068</timeStamp></ heartrate>" http://localhost:3000/heartrates I have tested the GET (with curl also) and it works fine! curl http://localhost:3000/heartrates/45
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be working, but.... when i access duration = <%= @enquiry.course_duration %><br> in my final view it''s blank.. course_duration is getting set to null but works for the calculation? controller.. ---------- class EnquiriesController < ApplicationController layout ''welcome''
2009 Jun 14
3
Basic AJAX Response (Mootools)
Hi, I''ve done AJAX calls to Rails'' Controllers before yet never required to generate a response back to the view. In this respect, I have tried to keep it moronically simple and just add a node to see that it works, yet the response doesn''t come through / isn''t interpreted as it should. Long story short, code : // Have to use Mootools to integrate a
2008 Apr 20
1
Why is respond_to always rending the RXML view?
I''m having a problem in Rails 2 where respond_to is always rendering the RXML view even in the HTML rendering response. Can anyone tell me why this might be happening? Here''s a code snippet: respond_to do |accepts| accepts.html accepts.xml { render :action => ''show.rxml'', :layout => false} end If I change this to the following it works fine:
2006 Jul 31
2
is it possible to make to_xml use underscore instead of dash?
Hi all, I am getting ActiveRecord to produce XML with render :xml => @user.to_xml However, on the client end it is a bit annoying for me to deal with attributes like first-name. I would much rather have first_name. Is there any way for me to turn off the behavior of converting _ to -? This seems to be done by a call to dasherize inside the to_xml of
2006 Aug 01
2
The latest & greatest Routing (Rails Edge 4611)
Got a quick question regarding the latest and greatest: module ActionController module Routing SEPARATORS = %w( / ; . , ? ) Why is period (.) one of the separators? As it stands, the new routing code doesn''t recognize ''file.ext'' as the last component of a URL, which is sometimes defaulted to nil. See the generated code below. I don''t know everything
2009 Aug 16
5
any help with captcha in my comments ?
this is my error: Processing ApplicationController#create (for 127.0.0.1 at 2009-08-17 00:57:56) [POST] Parameters: {"comment"=>{"name"=>"asdasd", "body"=>"asdasd"}, "commit"=>"Add Comment", "post_id"=>"19",
2006 Apr 08
2
respond_to causes DoubleRenderError?
I have a custom authentication plugin that redirects users to a login site if they aren''t already authenticated and their session hasn''t timed out. I had things working fine with straight http requests, but wanted to add support for ajax requests. I thought this would be a simple matter of replacing all of my "redirect_to <blah> and return false" calls with
2005 Apr 20
2
Has And Belongs To Many Validations
Here is the schema that I am working with: courses -> courses_teachers <- teachers I want to ensure that a teacher is not assigned the same course more than once. In other words, if I''m in the courses_teachers table as teaching Spanish 101, if someone tries to add that same teacher/course combination to the table again, it will not be allowed. I thought I could use something
2009 Aug 23
4
Routing problems for different formats
I am having 2 similar problems with routing. 1. With Rails if I make a js request using jQuery I always have to append a ".js" extension to allow the request to be handled appropriately. If I don''t append a js extension I get html formatted data back. Using Merb this never happened and worked like I thought it should. 2. Today I am having problems allowing xml requests to be
2007 Nov 26
1
transition form respond_to to provides
I really like the new mime type handler however I was trying to convert some code and couldn''t figure out how. My rails action was handle 2 formats, html and xml respond_to do |format| format.html # show.html.erb format.xml do if @account.active? && @account.valid_referer?(session[:referer]) render :xml => @account.to_xml(:except
2006 Jul 26
7
syntax for specifying :html fallback on form_remote_tag
Has anyone gotten the :html option for specifying a ''fallback'' action if javascript''s not enabled working on form_remote_tag (or remote_form_for)? I can''t figure out how to specify the action that''s supposed to be invoked if js _is_ enabled. Or maybe I''m just misunderstanding how this thing is supposed to work. I was assuming