I'm a beginning to ROR, but here's what I'm trying to achieve. I have two items I want to associate: matters and people. Each matter can have many people. That is, I want to create people and matters separately and later be able to link them.
For example, I may create:
Bill Clinton
Barack Obama
I may create the matters:
Global warming
...
I have been looking for jobs right now. And, most of the companies require RoR or Django experience. I don't know both ... number of organization working in RoR is greater than Django ... but, I prefer django coz of Python ...
What do u coders/recruiter suggest me to know?
...
Prototype's Ajax accepts a parameter called 'parameters' with an hash array for parameters (prototype doc) which would automatically be sent as GET or POST vars, but I could not find how to add items to that array using the Rails button_to_remote method.
I could just add the parameters to the URL sent to the method, but that feels hacki...
I have the following rails form (which works) but I want to remove the submit_tag and have the form submit as soon as a radio button selection is made. How do I do that?
<% form_tag({ :controller => "votes", :action => "create", :id => @item.id } ) do %>
<p>
<% for i in 1..10 do %>
<%= radio_button_tag :rating, i %> ...
Going from Rails to ASP.net has been quite a pain. But I was wondering if any gurus out there know of equivalent translation of "cycle" from Rails for ASP.net ?
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001721
Basically to be able to conditionally output the nth parameter based on the nth time it's called....
Is there a way to pass a object, specifically a form_builder object used in a view, to an action in the controller? I am using a link_to_remote and want to update a variable in the controller and then add a new nested form element to my form via a render :update block.
If I pass it as a param, it gets converted string and I can't seem ...
I'm working with models analogous to the following:
class Owner < ActiveRecord::Base
has_many :owned
end
class Owned < ActiveRecord::Base
belongs_to :owner
end
You can presume that owned_id and owner_id are in the right places. The trouble is that, in a controller for a different mvc chain in the app,
@owner = Owned.find_by_id(...
I know this is a minor issue, but why, if you use scaffolding in RoR, can you use lines like 'new_*model name here*_path' in link tags, but without using scaffolding, I get a NameError? For example, I have a simple address book app that uses basic CRUD operations. I am a RoR beginner but wanted to build an app without scaffolding and t...
I'm trying to get my head around nested associations in Rails using ActiveResource.
My example is as follows:
What I have is an airport with many runways.
My show action in airports controller contains:
@airport = Airport.find(params[:id])
When I call http://localhost/airports/2.xml I get that piece of XML:
<airport>
<code>DUS</...
Quick summary:
I have a Rails app that is a personal checklist / to-do list. Basically, you can log in and manage your to-do list.
My Question:
When a user creates a new account, I want to populate their checklist with 20-30 default to-do items. I know I could say:
wash_the_car = ChecklistItem.new
wash_the_car.name = 'Wash and wax the ...
I would like to have Ajax form in Rails so i'm using form_remote_tag. The field
i would like to submit is email address - how can i use the Rails validations together
with form_remote_tag?
...
I have a gem that should take its data from the web but when I'm in test, I want to use a mock object. I want to be able to load data in the mock object using rails fixtures. The mock objects are here.
How can I do it?
...
When i'm starting the server with the path option
script/server --path=/myapp
while having a route
map.route 'foo', :controller => 'bar', :action => 'buzz'
then
ActionController::Routing::Routes.recognize_path('/myapp/foo')
raises an error "No route matched ..."
Question: How can i make Rails built-in routing recognize with p...
I have a Rack application that looks like this:
class Foo
def initialize(app)
@app = app
end
def call(env)
env["hello"] = "world"
@app.call(env)
end
end
After hooking my Rack application into Rails, how do I get access to env["hello"] from within Rails?
Update: Thanks to Gaius for the answer. Rack and Rails let y...
I read from some books that Phusion Passenger is the answer to easy Ruby on Rails deployment. But my friend said that first there was Apache + bunch of Mongrels, and then lighttpd, and then nginx, and now Passenger, and it seems endless...
he also said he uses dreamhost which uses Passenger, and sometimes he sees his request not being ...
Hello
I have the following join table that works:
class CreateRolesUsers < ActiveRecord::Migration
def self.up
create_table :roles_users,:id => false do |t|
t.integer :role_id, :null => false
t.integer :user_id, :null => false
end
end
def self.down
drop_table :roles_users
end
end
But I don't know h...
I'm trying to convert a column in my Rails app, for arguments sake let's pretend I'm trying to change the age column in my users table to a string representation rather than an int.
In my migration I have this;
def.self up
add_column :users, :age_text, :string
users = User.find(:all)
users.each do |u|
u.age_text = ...
I have a Apache + Haproxy + Mongrel setup for my rails application. When I hit a particular server page, mongrel takes around 100ms to process the request and I get the page in around 5 secs due to data transmission time on my slow home connection.
Now I see that during these 5 secs of data transmission, mongrel does not serve any ot...
I've been using Netbeans for Rails and like it a lot, considering how little I paid for it. But something that bothers me is that when I'm editing an RHTML or ERB file, it doesn't do the code autocomplete - or at least not reliably. Sometimes it shows the appropriate variables and methods that are available on an object after you type th...
when starting Ruby on Rails programming, I will use
rails first
rails second
and try out things in these "first" and "second" projects
but as they get more mature i want to check them into SVN and develop further, so can i rename them into
"superapp"
or
"web30"
and check into SVN and develop further without any side effects? I...