similar to: Migration: How to make a column the primary key

Displaying 20 results from an estimated 9000 matches similar to: "Migration: How to make a column the primary key"

2006 Apr 17
7
Serve static XML files how?
Hi, a Javascript in one of my Rails templates needs to load a static XML file. I tried several places to put the actual XML file, and I also tried to make the file a rails template (tried both .rhtml and .rxml) and access it via a controller action. None of these ways worked. Does the lighttpd server know how to serve XML files, or do I need to configure it first? Or, is there a good workaround?
2006 Apr 07
3
How to consume XMLRPC/SOAP web services in Rails?
Hi, does anybody know of any good HowTo for consuming XML-RPC and/or SOAP web services in Rails? I found some for Ruby (via soap4r/xmlrpc4r), but I was wondering whether there is something built into Rails already. So far it looks like there are methods to create web services, but not to consume them. Ingo Weiss
2006 Apr 04
4
Find records based on associated table''s colums
Hello, Let''s say I have a model for a "house". Each house has_a "city", which in turn has_a "state" which in turn has_a "country". The objective is to retrieve all houses in a given state, say "Massachusetts". Being new to Ruby on Rails what I like is that things that should be simple usually are simple, and since we have easy access to
2006 Apr 04
6
Console for Testing Routes?
Hi, when the "Agile Web Development" book talks about routes, there are what looks like console transcripts like the following: URL> store @params = {:controller => ''store'', :action = ''index''} Is there something like a console for testing routes (where you could put in a url and see how rails would route it)?? Ingo -- Posted via
2006 Oct 31
4
Auto-increment lost during migration.
Hi. I get some strange results when using rename_column on a primary key in a migration. It seems like the migration script removes the auto-increment property if you rename a column. This is a minimal example. create_table :foo, :primary_key => :foo_id do |t| t.column "name", :string end # renaming the primary key makes auto-increment disappear. rename_column
2007 Nov 15
1
''lazy'' url generation in view specs
Hi, I would like to use the ''lazy'' style of url generation in my views, omitting parameters from my calls to url_for (and named route methods) that are then filled in from the current request parameters. Example: url_for(:action => ''index'') will fill in (:controller => ''posts'') if params[:controller] is ''posts''
2008 Jan 15
5
broken URL on rspec.info
Hey folks. I was looking for the mailing list archive up on rspec.info. I clicked on the "community" link and received the URL "http://ey01-s00414/community/". This isn''t correct, obviously. The hint shows it as, "http://rspec.info/community". Where is the mailing list archive? How far back does it go? I''d really like to read back through it
2006 Jun 16
1
diff (to html) for Rails?
Hi, I am looking for a way to compare to pieces of text, and mark up the differences with html. Basically the way Basecamp Writeboards do it. I was wondering whether this is available as a plugin (my initial search didn''t turn up anything). Ingo Weiss -- Posted via http://www.ruby-forum.com/.
2006 Apr 26
2
Problem with auto-submitting AJAX form
Hello, I have a form generated with form_remote_tag that contains a selection list. I would like to auto-submit the form when the user makes a choice in the selection list, so I added an option :onchange => ''this.form.submit()'' to select_tag Now what happens is that when I make a choice, the partial template get''s rendered as expected, but not replacing the
2007 Jul 27
5
File.stub!
Hi, I''m trying to stub File.open and whenever I do, rspec blows up with the following error message (undefined method `add'' for nil:NilClass), which seems to happen because method __add in class Proxy is calling #add on global $rspec_mocks, which in turn is nil. Can someone explain what I''m doing wrong, as I can''t seem to stub anything out! Here''s
2007 Jun 15
6
problem getting started with stubbing in rails controller specs
Hello, Ingo! I''m copying your question to a new e-mail instead of replying to try to keep message threads separate. Have you tried setting up your expectation before issuing the get statement? For example, take this out of the setup block: get ''index'', :locale => ''en'' and move it after:
2006 Apr 27
3
Where to put general utility functions?
Hi, I have a bunch of utility functions. If I put them in "controllers/application.rb" then they will be accessible from all controllers. If I put them in "helpers/application_helper.rb" then they will be accessible from all templates. But what if I need to access them from everywhere - controllers, views, even models? Where do I put them? Ingo Weiss -- Posted via
2006 Apr 24
2
Console and changes to models
Hi, I am using the console a lot to test certain things. However, when I make changes to a model, the only way I found to update the console environment to reflect the changes is to shut it down and open a new console session, which can get quite annoying. Is there a better way? Thanks! Ingo Weiss -- Posted via http://www.ruby-forum.com/.
2007 Jan 03
2
error_message_on broken?
Hi, in my app, using the error_message_on form helper like this: <label for="user_name">User name:</label> <%= error_message_on ''user'', :name %> <%= f.text_field :name %> generates the following error: undefined method `errors'' for :user:Symbol I am using edge revision 5813 and the simply_helpful plugin. Is there a way to fix this?
2006 May 04
1
Problem caching XML files
Hi, When I turn on action cashing for actions that render as XML using builder templates, the files are cashed with an .html extension, and subsequently served as html which breaks things. Is there a way to cache files with an .xml extension? Ingo Weiss -- Posted via http://www.ruby-forum.com/.
2006 Apr 20
2
previous|next navigation question
When creating "< previous|next >"-type navigation to browse through records from a list of search results, what is the most efficient (best practices-) way to determine what the previous and next records are for a given record? Should I store the search results array and the position (index) of the current record in the session? Or restore the results array each time (running
2006 Jul 11
2
Trademark registration
Hi, sorry if this is considered off-topic, however I suspect that this list is full of people developing their own web apps who would appreciate this kind of information, so: I was wondering whether anybody would be willing to share his/her experience with trademarking a web app''s name(/logo) in the US. What are the alternatives, and what is the best/most affordable way to do it?
2006 Jun 03
1
First time plugin user: Problem with "acts_as_versioned"
Hi, I am having trouble with using the acts_as_versioned plugin. I installed the plugin, and ran the migration. acts_as_versioned created the versioned table OK, but when I try to use it I get an error. Here is some console output: >> m = Mymodel.find(:first) NameError: undefined local variable or method `acts_as_versioned'' for Mymodel:Class Did I miss a step? Ingo --
2006 Mar 28
7
Rails 1.1 and "freeze_gems"
I''m on OS X Tiger, and just upgraded my gems. I also ran ''rake rails:update''. After that, I ran "rake freeze_gems", I recieve the following: ===================== Freezing to the gems for Rails 1.1.0 rm -rf vendor/rails mkdir -p vendor/rails cd vendor/rails Unpacked gem: ''activesupport-1.3.0'' mv activesupport-1.3.0 activesupport Unpacked
2006 Mar 22
2
Radio Button Defailt Value?
I have: <%= radio_button ''foo'', ''bar_id'', ''1'' %> <%= radio_button ''foo'', ''bar_id'', ''2'' %> <%= radio_button ''foo'', ''bar_id'', ''3'' %> I would like to have option #3 be selected if foo.bar_id is nil. Is there a way to do