Is there any good way to implement nested form in Rails 3?
I've been trying to find a decent solution for nested form, but I couldn't find any tutorial or blog on this topic. Please come and rescue. ...
I've been trying to find a decent solution for nested form, but I couldn't find any tutorial or blog on this topic. Please come and rescue. ...
I am trying to get the OAuth gem to work with Rails 3 and I'm running into this weird problem... (independent of the gem, I think I've run into this once before) I have a controller called "OauthTestController", and a model called "ConsumerToken". The model looks like this. require 'oauth/models/consumers/token' class ConsumerToken < ...
Editing my question for conciseness and to update what I've done: How do I model having multiple Addresses for a Company and assign a single Address to a Contact, and be able to assign them when creating or editing a Contact? I want to use nested attributes to be able to add an address at the time of creating a new contact. That addre...
In my edit action of my employees_controller I have this line of code: #Employee#edit 69: if @employee.user.person.addresses.length == 0 70: @employee.user.person.addresses << Address.new 71: end which should add a blank Address if there are none so it will show up in my edit erb file. That way if there were no Addresses associated ...
I'm working on a rails app to integrate with infusionsoft's xmlrpc api. Does anyone have any tips or pointers for integrating a system smoothly? What are best practices? How do you best re-factor code? Thanks for any tips / ideas ...
I have a model Campaign and the campaign/show goes through a loop of the Emails. Campaign has_many Emails. <h2>Emails to Send Today</h2> <% for email in @campaign.emails %> <p><strong>Email: </strong><%= link_to email.title, email_path(email) %> sent after <%= distance_of_time_in_words(email.days.days) %></p> <% end %> ...
Dear all, Why does Ruby on rails generated more queries in the background on Postgres than MySQL? I haven't tried deploying Rails on production with Postgres yet, but I am just afraid this generated queries would affect the performance. Do you find Rails with Postgres is slower than MySQL, knowing that it produce more query on the backg...
I have a situation where in theory I would need to use a belongs_to_many relationship. I have an Example model and a Sentence model. Each example object has one sentence but these sentences are not necessarily unique. So, for example, I could have two example models that each have one sentence that is the same sentence. I'm not sure ...
In rails guides it's described like this: "Objects will be in addition destroyed if they’re associated with :dependent => :destroy, and deleted if they’re associated with :dependent => :delete_all." Right, cool. But what's the difference between being destroyed and being deleted? I tried both and it seems to do the same thing. ...
Hi, I'm trying to parse web pages but I sometimes get 404 errors. Here's the code I use to get the web page: result = Net::HTTP::get URI.parse(URI.escape(url)) How do I test if result is a 404 error code? Thank you, Kevin ...
G'day guys, currently have almost finished writing a rails application that allows a CSV download of the database. This is generated when the index is first viewed. Is there an easy way to insert a link to a helper that returns a CSV document? That is to say is it easy to insert links to helpers? This would make a lot of problems I've ...
hi, My rails application is running on thin server which i want to benchmark using apachebench the command am using is ab -n 1 -c 1 http://localhost:3001/welcome/search?query="doctor"&rad=5 But thin server is not taking this url.Its giving !! Invalid Request Can any one help me how to give the url such that thin accepts th...
I'm trying to mock a class method with rspec: lib/db.rb class Db def self.list(options) Db::Payload.list(options) end end lib/db/payload.rb class Db::Payload def self.list(options={}) end end In my spec, I'm trying to setup the expectation Db::Payload.list will be called when I call Db.list: require 'db/payload' d...
Can you give examples of books that teach large web app development? it must not be focused on a programming language, but to be generical with the concepts and structure. thanks :) EDIT anyway the language used is ruby on rails 2.3.4 ...
Site structure: / /products /products/design /products/photo /about I want to see parent menu item also highlighted by CSS, when child is active. (When 'design' or 'photo' is active 'products' should be highlighted too.) I'm using this for child and simple urls: <li class="<%= current_page?(:action => 'design') %>"> <%= link_to...
I have a Campaign model which has_many Calls, Emails, and Letters. For now, these are each a separate Model with different controllers and actions (although I would like to start to think of ways to collapse them once the models and actions stabilize). They do share two attributes at least: :days and :title I would like a way to repre...
How to make it work? I have a file index.html.haml and a index.html.erb. the erb one works, then when i delete the erb, it gives me the template is missing error. I have rails 2.3.4 and installed the haml gem. "Template is missing Missing template profiles/index.erb in view path app/views" ...
In Rails erb, am using the snippet to show visiting team in a tournament match. How do I get to initially show the current visiting_team? What am I doing wrong? <%= f.select(:visiting_team_id, Team.all.collect{|t| [t.name, t.id] }) %> ...
Hy, Im trying to use this "script/generate cell ShoppingCart display" but in the error is showing me "C:/Users/Totty/workspace/test1/" and test1 is not the project i want to add the cell. I want to add the cell to test2, how do i do? thanks ...
I would like to list all posts that are connected with some specific category and classroom. I have: class Post < ActiveRecord::Base has_many :category_posts has_many :categories, :through => :category_posts has_many :classroom_posts has_many :classrooms, :through => :classroom_posts end class Category < ActiveRecord::Base h...