Hi there,
I am trying to run a migration on an existing database to change the column name on a table. When I run the migration, I get an error stating that Blob/Text fields cannot have a default value. The column in question is a text column, with a non-null attribute, but no default value.
The migration that Rails attempts is:
ALTE...
I've got a Rails 1.2.3 application that I need to launch on a new server, which has Rails 2.1.0
As I expected, just putting up the 1.2.3 code and trying to run with 2.1 fails.
I don't know enough about Rails to know what things to change myself, so my current plan is to generate a new project using 2.1.0 and then move the code myself m...
How do I create a XML file from a form in ruby on rails. The form elements should be converted into xml file and stored in my system at a specific location.
I am a newbie. so please help me out with some codes.
Thanks in advance.
...
Hi all, here's a beginner rails question...
After I do:
format.xml { head: ok}
How do I return from the controller endpoint without showing the view? If I drop off the end of the function at this point, I get what I expect, but if I call 'return', I end up in the view (or in my case in a missing view template). I can code up lots...
I return a form partial on a set of info like so...
Room1 Monday Tuesday Wednesday No. ppl
Blue Room $55 $55 $55 Select_tag (0-8)
Double Bed $100 $110 $200 Select_tag (0-8)
<% for room in @rooms %>
<tr>
<th scope="row" class="<%= cycle("spec", "specalt") -%>"><%=h roo...
How do I upload images and zip files in RoR? I am a newbie. So please help.
Give me both the view and the controller code example.
Thanks in advance.
...
The default way to output JSON in rails is some thing like:
Code:
render :json => friends.to_json(:only => [:username, :avatar_file_name, :id ])
Output
{"friends" :
[{"user":
{"avatar_file_name": "image1.jpg", "username": "user1", "id": 1}},
{"user":
{"avatar_file_name": "image2.jpg", "username": "user2", "id": 2}},
...
Hi I want to have custom ids for a table and not use the default auto_increment. Is that possible? I have turned :id => false and later on I create a t.column :id, :bigint
But when I create a new record the id is set to NULL
Is there anyway to bypass this behaviour.
I could set my primary key to a field uid (it is actually facebook id) ...
I am working my way through Head First Rails, and I keep seeing =>. It's in the routes:
map.connect '/marmots/new', controller=>'marmots', :action=>'new'
It's in rendering partials:
render :partial=>"new_marmot"
It's in options for links:
<%= link_to 'Destroy', marmot, :confirm=>'Are you sure?', :method=>:delete %>
Basically, => se...
I want to make a SQL query in a Rails app that adds a condition when a drop-down menu is added. Obviously I don't want to search with a blank condition if the drop down is not selected. How can I develop a dynamic condition in an SQL statement?
untested example:
When dropdown is not selected: Object.find("billy," :conditions => {})
Wh...
I'm looking to use the latest Twitter gem for a Rails app I'm working on.
However, executing the following line:
oauth = Twitter::OAuth.new(ServiceAPIKeys.twitter['api_key'], ServiceAPIKeys.twitter['secret_key'])
Triggers the following exception:
uninitialized constant Twitter::OAuth
I do have the gem configured in my environment....
If all I have is one model (for example Wiki) and want to save it along with its versions, I could use acts_as_versioned plugin which stores the wikis in "wikis" table and its versions in "wikis_versions" table. This is plain an simple even if I want to moderate the latest version before showing it to the public using a field as status w...
I need a very granular authorization system that works seamlessly with Authlogic.
I've tried these gems/plugins so far:
Lockdown
rails_authorization_plugin
ACL9
I've also looked at, but not tried implementing:
Padlock
I've searched around for a good tutorial detailing how to set up any of these with Authlogic in a way that makes...
Hello all,
I am getting the following error when i try to create the production db in Rails:
>rake db:schema:load RAILS_ENV=production --trace
rake db:schema:load RAILS_ENV=production --trace
(in C:/Users/user/Documents/Aptana Studio/truping)
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environme...
I am writing an Ajax request form with Ruby on Rails using a collection_select tag that looks like this:
<%= collection_select("Jobs", "clearance", @allClearances, "clearance", "clearance", {:prompt => "Select a Clearance"} )%>
Ruby then builds an HTML select tag with id = "Jobs_clearance" and name = "Jobs[clearance]"
I want to send t...
I'm trying to switch over to using HAML for my views but I keep getting unexpected KENSURE messages. I've used html2haml to switch over working view files. First run through it told me I didn't need the end that html2haml had in its output so I removed it and now I get errors that look like it is complaining about the form not being e...
I have a very annoying and hard to figure out bug in my rails project.
After having created a bunch of models and their relations, I want to list them.
But I keep getting an Error "can't dup NilClass". That is, until I restart the server. Then I can list them just fine.
Debugging this issue, it turns out that the Error gets raised in ...
This must be something simple but it's driving me nuts!
I have a migration where I want to update a record afterward
class SubjectsTextField < ActiveRecord::Migration
def self.up
add_column :users, :subjects, :text
User.find(39).update_attribute :subjects, "hey there"
end
def self.down
remove_column :users, :subjects...
I want to edit multiple items of my model photo in one form. I am unsure of how to correctly present and POST this with a form, as well as how to gather the items in the update action in the controller.
This is what I want:
<form>
<input name="photos[1][title]" value="Photo with id 1" />
<input name="photos[2][title]" value="Photo with...
Hey guys,
So I installed Ruby 1.9 into /usr/local/bin and kept Ruby 1.8.7 in /usr/bin. Renamed all my 1.8 ruby, rails, rdoc, etc. executables to ruby18, rails18, etc.
So, going ruby --version at the command line gives me:
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-darwin9.7.0]
If I start up an irb session and look at the $: va...