similar to: required field for one, optional for another

Displaying 20 results from an estimated 30000 matches similar to: "required field for one, optional for another"

2012 Nov 12
7
RSpec: controller POST create
Rails 3.1.3 rspec-rails (2.11.4) rspec 2.11.1 I am new to rspec. I don''t quite understand tests for POST create part. I have generated scaffold, and simultaneously it generated controller_spec.rb as well. it "assigns a newly created plan as @plan" do post :create, {:plan => valid_attributes}, valid_session assigns(:plan).should be_a(Plan)
2012 Nov 30
4
Tokeninput incremental search not working
Rails 3.1.3 After watching http://railscasts.com/episodes/258-token-fields?autoplay=true I have installed the similar functionality to my app. However, def index @cities = City.all ... does in fact give the list of all cities in the text field, but def index @cities = City.where("name like ?", "%#{params[:q]}%") ... does NOT
2012 Oct 13
4
Database design, working but looking for better ways
Rails 3.1.3 Hi. I have designed the database used for my travel plan application. You should be able to look at the diagram in the link below, hopefully. https://cacoo.com/diagrams/biDSyxh8yzk2kIeg ("belongs_to" is omitted since it''s obvious) Basically, the application can list the destinations from a choice of the departure. Not mention that the departure_id (integer) and
2013 Jun 03
1
sidekiq: push background results to front
Rails 3.2.11 Sidekiq latest My app continues background jobs that generate texts as the output. class ProcessText include Sidekiq::Worker def perform(name, count) puts "executing..." @feed = Feed.first @feed.process # here it returns String results! end end What I want is basically how to send (or push?) the result texts to a particular web
2012 Sep 23
2
Find by id in the view template dynamically
Rails 3.1.3 I have a model ''Airline'', whose STRING column is ''company'' only. Also, another model ''Plan'' has an INTEGER column ''airline_id''. I would like to show the ''company'' name (string) in a template like <% @plans.each do |plan| %> Airline: <%=
2012 Aug 25
2
cannot bundle install due to missing therubyracer
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux] rails 3.1.3 Ubuntu 10.04 LTS I have another environment with MacOSX Snow Leopard, and am sharing the Rails project files through Dropbox. When I chose to develop a project further in this Ubuntu machine, I have executed ''bundle install'' which gave an error #--------- Gem::Installer::ExtensionBuildError: ERROR: Failed to
2012 Feb 24
3
Devise generates Mailer by its own?
Rails 3.1.3 Hi. I''m a little confused with Devise and ActionMailer. It seems that Devise has its own way of sending mails through ActionMailer. Does it generate Mailer class when "rails g devise..." command is executed? Or do I need to do some special command in order to generate Mailer? I have certainly set up a devise User table but there is no Mailer class for it,
2012 Jan 27
4
Redirecting to create new page with input
Rails 3.1.3 I believe this is a very very fundamental question, but since I am new to Rails, it''s more productive to ask someone to point out what I need to do. Say, I have a search method that generates a list of youtube videos. I have completed this part. And also, I have set up a database, Video, whose fields are video_title and URL. I need to place a button to each of these video
2012 Feb 22
3
Parent id for find_or_create method
Rails 3.1.3 I have tables, Video and Script having association, Video 1 --- n Script So, every Script needs the parent id, in this case, video_id. If I simply create a new Script instance, the view renders as follows. <%= render :partial => "new_script", :locals => { :script => Script.new(:video_id => @video.id)} %> which works fine. Now I would like to
2012 Mar 02
2
Change DB data type and limited decimals
Rails3.1.3 I have db type, startp:integer I need to change it to float. More specifically, 1.2, 45.1, 143.8 ... I have two questions: 1. Is removing and adding the field through migration the only way? in other words, is there a single command to change the type? 2. Is there anyway to limit the decimal place to only one? 56.3, 34.2... are acceptable, but 23.112, 77.34, ... are
2012 Oct 19
1
Globalize3 gem, upload data from CSV
Rails 3.1.3 Globalize3 latest I am not sure if I can ask this question here in general Rails forum. But I''ll try. Currently I am using a gem, Globalize3, which is useful for model I18n. https://github.com/svenfuchs/globalize3 Say, I have a model City, having only one column, name. City names appear differently depending on the language, so perhaps this particular gem is useful.
2012 Feb 07
2
save method (create action) saves twice
Rails 3.1.3 I have changed a regular scaffold action a bit so that it can save using ajax. All I needed to do was adding ":remote => true" in <div id="script_new"> <%= form_for script, :remote => true do |f| %> <!-- HERE!!! --> <%= f.hidden_field :video_id %> <%= f.text_field :text %> <%= f.submit "save" %>
2013 Mar 11
3
take two columns from a set of lists
say I have a matrix and lists like x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2) x.list <- lapply(seq_len(nrow(x)), function(i) x[i,]) if I want a column of the matrix x, I write x[, 2] for example. But how can I do something similar for a set of lists, x.list, above? > x.list [[1]] [1] 12.1 0.1 12.0 1.1 [[2]] [1] 3.44 3.00 33.10 23.00 unlist(x.list)[,2] does
2013 Oct 04
4
Best Book 4 RoR
Hello, Is there a great book for Ror. I am looking for a book with a step by step approch and by PROJECTS!! RoR needs to be ''practiced'', and i didn''t find those WORKING PROJECTS. Am i dreaming or is this paper exists. All the books on amazon are not amazING. They talks only about theory. Theory is fine, i mean this is RoR. But then... Thanks for those who, first,
2013 Mar 18
4
plotting CIE chromaticity diagram?
Has anyone plotted or is it possible to plot CIE *xy* chromaticity diagram http://en.wikipedia.org/wiki/File:CIE1931xy_blank.svg I need this plot in color. ishida [[alternative HTML version deleted]]
2012 Sep 10
2
suggestion for user-friendly input: typeahead
Rails 3.1.3 I am hoping some of you may give me suggestions about user input helper methods. I have a large set of model, Flight, and its fields are airline, flight_name, departure, destination As you can imagine, the flight data will be very large; it could be thousands if it is international. I will ask users to input the desired flight plan, and it will be crucial if the users make
2013 Mar 10
2
list + lapply insead of matrix + apply
I need to develop a simple list manipulation. Although it seems easier to do it in matrix form, but I need it in list form. I have a matrix x <- matrix(c(12.1, 3.44, 0.1, 3, 12, 33.1, 1.1, 23), nrow=2) for list form example, the conversion is x.list <- lapply(seq_len(nrow(x)), function(i) x[i,]) ### list version calcnorm=function(a, b){ diff <- mapply("-", a, b)
2013 Jun 25
6
creating an account with a username in devise
Hello, all. I have followed these links and have enabled a (current) user to login with a username: http://railscasts.com/episodes/209-introducing-devise http://railscasts.com/episodes/210-customizing-devise https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-using-their-username-or-email-address I want to allow a user to sign up with a username but am getting these
2012 Oct 29
16
Newbie - deployment, hosting
Hello, So, after learning ruby on rails and building a great app on my local machine, I need to find a host, deploy, and of course maintain a (staging and) production environment. This all seems very confusing, and I''d like to learn this in an organized manner, step by step: I''ve come across the names: Unicorn, nginx/apache, capistrano, Thin/mongrel, Engine Yard, EC2, etc.,
2012 Oct 16
8
<form> tag is self-closing before input fields .. (HAML generator used)
The form is inside a table, enclosing a <tr> = form_tag admins_backoffice_dashboards_path, :remote =>"true" do %tr.search %th= link_to t(:clear), "#", :id => :clearFilter %th= select_tag :role, options_from_collection_for_select(Role.global, :id, :name, :selected => @role_id ) %th= text_field_tag :email, nil, :value