Search Results

Search found 9437 results on 378 pages for 'rails newbie'.

Page 139/378 | < Previous Page | 135 136 137 138 139 140 141 142 143 144 145 146  | Next Page >

  • Error when running rake db:create

    - by Amy
    Hi, I am trying to setup an ror app but I keep getting this error. Any ideas as to what may be causing the problem? /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require' /home/projects/testproject/lib/tasks/more_tasks.rake:3 /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/rails.rb:9 /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/rails.rb:9:in `each' /usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/rails.rb:9 /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /home/projects/testproject/Rakefile:10 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19

    Read the article

  • Anything speaking against the bitnami.org Ruby/Rails/Redmine Stack?

    - by Pekka
    I am looking to set up a Redmine server on a Windows virtual machine on my local workstation. (Background in this related question.) I have zero knowledge of Ruby nor Rails, and while Redmine may be the opportunity to dip into those platforms somewhat, my first goal is to get it running as quickly and easily as possible. For that, I am eyeing the Bitnami Redmine Package. It promises point-and-click install, and a self-contained environment with everything you need. Apart from the learning factor, are there any serious limitations this method implies? Any serious cutdowns in customizability? I will be wanting to customize the template right away, for example, and install plugins. The package looks o.k. to me but before I install it, I was curious to know whether anybody would advise against it and why. Edit: The first impression is great. From 0 to a working Redmine installation in twelve minutes! Wow.

    Read the article

  • Ruby on Rails: how to get error messages from a child resource displayed?

    - by randombits
    I'm having a difficult time understanding how to get Rails to show explicitly the error messages that a child resource is failing on when I render an XML template. Hypothetically, I have the following classes: class School < ActiveRecord::Base has_many :students validates_associated :students end class Student < ActiveRecord::Base belongs_to :school validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => "You must supply a valid email" end Now, in the controller, let's say we want to build a trivial API to allow us to add a new School with a student in it (again, I said, it's a terrible example, but plays its role for the purpose of the question) class SchoolsController < ApplicationController def create @school = School.new @student = school.students.build @student.email = "bad@email" respond_to do |format| if @school.save # some code else format.xml { render :xml => @school.errors, :status => :unprocessable_entity } end end end end Now the validation is working just fine, things die because the email doesn't match the regex that's set in the validates_format_of method in the Student class. However the output I get is the following: <?xml version="1.0" encoding="UTF-8"?> <errors> <error>Students is invalid</error> </errors> I want the more meaningful error message that I set above with validates_format_of to show up. Meaning, I want it to say: <error>You must supply a valid email</error> What am I doing wrong for that not to show up?

    Read the article

  • How to create a view to manage associations between HABTM models? (Rails)

    - by Chris Hart
    Hello, I am using Ruby on Rails and need to create a view that allows the creation of records through a HABTM relationship to another model. Specifically, I have the following models: Customer and ServiceOverride, and a join table customers_serviceoverrides. Using the customer view for create/update, I need to be able to create, update and delete ServiceOverrides and manage the attributes of the associated model(s) from the same view. Visually I'd prefer to have something like a plus/minus sign to add/delete service overrides, and each serviceoverride record has two string entities which need to be displayed and editable as well. However, if I could just get the code (a kind of nested form, I'm assuming?) working, I could work out the UI aspects. The models are pretty simple: class ServiceOverride < ActiveRecord::Base has_and_belongs_to_many :customers end class Customer < ActiveRecord::Base has_and_belongs_to_many :serviceoverrides end The closest thing I've found explaining this online is on this blog but it doesn't really address what I'm trying to do (both manage the linkages to the other model, and edit attributes of that model. Any help is appreciated. Thanks in advance. Chris

    Read the article

  • How to use will_paginate with a nested resource in Rails?

    - by Sue Petersen
    I'm new to Rails, and I'm having major trouble getting will_paginate to work with a nested resource. I have two models, Statement and Invoice. will_paginate is working on Statement, but I can't get it to work on Invoice. I know I'd doing something silly, but I can't figure it out and the examples I've found on google won't work for me. statement.rb class Statement < ActiveRecord::Base has_many :invoices def self.search(search, page) paginate :per_page => 19, :page => page, :conditions => ['company like ?', "%#{search}%"], :order => 'date_due DESC, company, supplier' end end statements_controller.rb <irrelevant code clipped for readability> def index #taken from the RAILSCAST 51, will_paginate podcast @statements = Statement.search(params[:search], params[:page]) end I call this in the view like so, and it works: <%= will_paginate @statements %> But I can't figure out how to get it to work for Invoices: invoice.rb class Invoice < ActiveRecord::Base belongs_to :statement def self.search(search, page) paginate :per_page => 19, :page => page, :conditions => ['company like ?', "%#{search}%"], :order => 'employee' end end invoices_controller.rb class InvoicesController < ApplicationController before_filter :find_statement #TODO I can't get will_paginate to work w a nested resource def index #taken from the RAILSCAST 51, will_paginate podcast @invoices = Invoice.search(params[:search], params[:page]) end def find_statement @statement_id = params[:statement_id] return(redirect_to(statements_url)) unless @statement_id @statement = Statement.find(@statement_id) end end And I try to call it like this: <%= will_paginate (@invoices) % The most common error message, as I play with this, is: "The @statements variable appears to be empty. Did you forget to pass the collection object for will_paginate?" I don't have a clue what the problem is, or how to fix it. Thanks for any help and guidance!

    Read the article

  • My Rails app is returning HTTP 500 for all its URLs, but nothing shows up in the log file. How can I

    - by mipadi
    I have a Rails app that is running on a production server with Apache and Phusion Passenger. The app works fine locally when using Mongrel, but whenever I try to load a URL on the production server, it returns HTTP 500. I know the server is working properly, because I can get the static elements of the application (e.g., JavaScript files, stylesheets, images) just fine. I've also checked the Passenger status and it is loading the app (it must be, since the app's 500 Internal Server Error page is returned, not just the default Apache one). Also, when I load the app via script/console production and do something like app.get("/"), 500 is also returned. The problem is that there is nothing in the log files to indicate the problem. production.log is empty. The Apache error logs show no problems with Apache, either. I'm stumped as to what's going on and I'm not sure how to diagnose the problem. I know I may have been a bit vague, but can anyone give a suggestion on what the problem may be? Or at least a way I can go about diagnosing it?

    Read the article

  • How to architect Rails site that can be edited while running?

    - by Chris Kimpton
    Hi, I am writing a Rails app that "scrapes/navigates" some other websites and webservices for content. I am using Mechanize and Savon to do the heavylifting. But given the dynamic nature of the web, I'd like to make my calls to these editable by the admin users of the site - rather than requiring me to release a new version of the site. The actual scraping thread happens async to the website, using the daemons gem. My requirements are: Thinking that the scraping/webservice calling code is quite simple, the easiest route is to make the whole class editable by the admins. Keep a history of the scraping code - so that we can fairly easily revert if we introduce a problem. Initially use the code from the file system, but as soon as thats been edited and stored somewhere, to use that code instead. I am thinking my options are: Store the code in the db (with a history table for the old versions) Store the code in a private git repo somewhere and access that for the history/latest versions. I am thinking the git route might be easiest, given its raison d'etre is to track file history... But perhaps there is a gem/plugin that does all this for me, out of the box? Thanks in advance for any tips/advice. ~chris

    Read the article

  • Anything speaking against the bitnami.org Ruby/Rails/Redmine Stack?

    - by Pekka
    I am looking to set up a Redmine server on a Windows virtual machine on my local workstation. (Background in this related question.) I have zero knowledge of Ruby nor Rails, and while Redmine may be the opportunity to dip into those platforms somewhat, my first goal is to get it running as quickly and easily as possible. For that, I am eyeing the Bitnami Redmine Package. It promises point-and-click install, and a self-contained environment with everything you need. Apart from the learning factor, are there any serious limitations this method implies? Any serious cutdowns in customizability? I will be wanting to customize the template right away, for example, and install plugins. The package looks o.k. to me but before I install it, I was curious to know whether anybody would advise against it and why. Edit: The first impression is great. From 0 to a working Redmine installation in twelve minutes! Wow.

    Read the article

  • How to validate presence of an uploaded file in rails?

    - by brad
    I'm playing around creating a rails file uploader and have struck a problem that should have an obvious solution. How do I check that a file has been selected in my form and uploaded? Here is my new.html.erb view <h2>Upload File</h2> <% form_for(@upload_file, :url => {:action => 'save'}, :html => {:multipart => true}) do |f| %> <%= f.error_messages %> <p> <%= f.label :file -%> <%= f.file_field :upload -%> </p> <p> <%= f.label :description %> <%= f.text_field :description %> </p> <p> <%= f.label :file_type %> <%= f.select :file_type, ["XML Data"] %> </p> <p><%= f.submit 'Upload File' %></p> <% end %> and here is my upload_file.rb model class UploadFile < ActiveRecord::Base validates_presence_of :description validates_presence_of :file_type validates_presence_of :upload def upload=(upload_file_field) self.name = "#{Time.now.strftime("%Y%m%d%H%M%S")}_#{upload_file_field.original_filename}" File.open("#{RAILS_ROOT}/public/upload/#{self.name}", "wb") { |f| f.write(upload_file_field.read) } end end If I use this as shown here, the validation validates_presence_of :upload always fails and I am returned to my form with an error message. I'd be very grateful if someone could explain how to do this validation correctly, and I'd be even more grateful if they could explain why it works. Thanks.

    Read the article

  • Session cookie not being created in Rails, very rarely and frustratingly.

    - by James
    Hi everyone, This is an issue sporadically for very few users, however we haven't been able to replicate it. However I have now got a Chrome instance (Mac) which is reproducing the error (for some unknown reason), and I hope to not restart it until I have this nailed! Rails application, using memcached for session store. While the bug manifests in the _app_session_id cookie not being created, our javascript-generated cookie test and app-generated language cookies are being created successfully. This means that 422 / InvalidAuthToken errors are thrown for every form that is submitted by those afflicted - people can't log into the app. The error occurs across all browsers - had reports for IE7 and Firefox (which most users use). Switching to another browser often fixes the issue (though not always), and standard cache-cookie-clear tactics do not. So now that I have got Chrome open which is having the same issue - in development, staging and live environments (meaning http and https). All other browsers are fine. I've restarted the servers and restarted memcached. I don't really want to restart Chrome - in the risk that the issue does go away with that (having said that, it hasn't worked for users). I've been tcpdumping the requests - and although I'll keep digging, I'd love it if anyone had any suggestions, places to start looking, anything. This is really painful ;) Thanks!

    Read the article

  • How would the 'Model' in a Rails-type webapp be implemented in a functional programming langauge?

    - by ceptorial
    In MVC web development frameworks such as Ruby on Rails, Django, and CakePHP, HTTP requests are routed to controllers, which fetch objects which are usually persisted to a backend database store. These objects represent things like users, blog posts, etc., and often contain logic within their methods for permissions, fetching and/or mutating other objects, validation, etc. These frameworks are all very much object oriented. I've been reading up recently on functional programming and it seems to tout tremendous benefits such as testability, conciseness, modularity, etc. However most of the examples I've seen for functional programming implement trivial functionality like quicksort or the fibonnacci sequence, not complex webapps. I've looked at a few 'functional' web frameworks, and they all seem to implement the view and controller just fine, but largely skip over the whole 'model' and 'persistence' part. (I'm talking more about frameworks like Compojure which are supposed to be purely functional, versus something Lift which conveniently seems to use the OO part of Scala for the model -- but correct me if I'm wrong here.) I haven't seen a good explanation of how functional programming can be used to provide the metaphor that OO programming provides, i.e. tables map to objects, and objects can have methods which provide powerful, encapsulated logic such as permissioning and validation. Also the whole concept of using SQL queries to persist data seems to violate the whole 'side effects' concept. Could someone provide an explanation of how the 'model' layer would be implemented in a functionally programmed web framework?

    Read the article

  • When i run rake db:create ,Error rake aborted! uninitialized constant Cucumber

    - by Big Bang Theory
    Hi I am trying to experiment on an open source application application . when i run $ rake db:create Following is the stacktrace rake aborted! uninitialized constant Cucumber /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:80:in `const_missing' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:92:in `const_missing' /home/BigBangTheory/Desktop/spot-us/lib/tasks/cucumber.rake:13 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1882:in `in_namespace' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:910:in `namespace' /home/BigBangTheory/Desktop/spot-us/lib/tasks/cucumber.rake:12 /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:145:in `load' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/rails.rb:8 /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/rails.rb:8:in `each' /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/rails.rb:8 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /home/BigBangTheory/Desktop/spot-us/Rakefile:9 /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `load' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2000:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run' /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31 /usr/bin/rake:19:in `load' /usr/bin/rake:19 Any help ?

    Read the article

  • How to serialize data from processing.js to rails application ?

    - by railscoder
    Hi I am creating a simple canvas using processing.js , how to pass values from rails application to Processing.js void drawBox(int bx, int by, int bs, int bs){ strokeWeight(3); stroke(50,50,50); // Test if the cursor is over the box if (mouseX > bx-bs && mouseX < bx+bs && mouseY > by-bs && mouseY < by+bs) { bover = true; if(!locked) { fill(181,213,255); } } else { fill(255); bover = false; } fill(192); stroke(64); roundRect(bx, by,80,30,10,10); // put in text if (!isRight) { text("Box Value", x-size+5, y-5); //Here i need to pass value from my controller } else { text("Box Value", x+5, y-5); //Here i need to pass value from my controller } } Instead of static string "Box Value" , I need to pass the value from the ex @post.name through ajax

    Read the article

  • How do I make a grouped select box grouped by a column for a given model in Formtastic for Rails?

    - by jklina
    In my Rails project I'm using Formtastic to manage my forms. I have a model, Tags, with a column, "group". The group column is just a simple hardcoded way to organize my tags. I will post my Tag model class so you can see how it's organized class Tag < ActiveRecord::Base class Group BRAND = 1 SEASON = 2 OCCASION = 3 CONDITION = 4 SUBCATEGORY = 5 end has_many :taggings, :dependent => :destroy has_many :plaggs, :through => :taggings has_many :monitorings, :as => :monitorizable validates_presence_of :name, :group validates_uniqueness_of :name, :case_sensitive => false def self.brands(options = {}) self.all({ :conditions => { :group => Group::BRAND } }.merge(options)) end def self.seasons(options = {}) self.all({ :conditions => { :group => Group::SEASON } }.merge(options)) end def self.occasions(options = {}) self.all({ :conditions => { :group => Group::OCCASION } }.merge(options)) end def self.conditions(options = {}) self.all({ :conditions => { :group => Group::CONDITION } }.merge(options)) end def self.subcategories(options = {}) self.all({ :conditions => { :group => Group::SUBCATEGORY } }.merge(options)) end def self.non_brands(options = {}) self.all({ :conditions => [ "`group` != ? AND `group` != ?", Tag::Group::SUBCATEGORY, Tag::Group::BRAND] }.merge(options)) end end My goal is to use Formtastic to provide a grouped multiselect box, grouped by the column, "group" with the tags that are returned from the non_brands method. I have tried the following: = f.input :tags, :required => false, :as => :select, :input_html => { :multiple => true }, :collection => tags, :selected => sel_tags, :group_by => :group, :prompt => false But I receive the following error: (undefined method `klass' for nil:NilClass) Any ideas where I'm going wrong? Thanks for looking :]

    Read the article

  • Why does this Rails named scope return empty (uninitialized?) objects?

    - by mipadi
    In a Rails app, I have a model, Machine, that contains the following named scope: named_scope :needs_updates, lambda { { :select => self.column_names.collect{|c| "\"machines\".\"#{c}\""}.join(','), :group => self.column_names.collect{|c| "\"machines\".\"#{c}\""}.join(','), :joins => 'LEFT JOIN "machine_updates" ON "machine_updates"."machine_id" = "machines"."id"', :having => ['"machines"."manual_updates" = ? AND "machines"."in_use" = ? AND (MAX("machine_updates"."date") IS NULL OR MAX("machine_updates"."date") < ?)', true, true, UPDATE_THRESHOLD.days.ago] } } This named scope works fine in development mode. In production mode, however, it returns the 2 models as expected, but the models are empty or uninitialized; that is, actual objects are returned (not nil), but all the fields are nil. For example, when inspecting the return value of the named scope in the console, the following is returned: [#<Machine >, #<Machine >] But, as you can see, all the fields of the objects returned are set to nil. The production and development environments are essentially the same. Both are using a SQLite database. Any ideas what's going wrong?

    Read the article

  • Excessive httpd processes to stack up on my Rails + Apache2 + Passenger production setup?

    - by LeoAlmighty
    I have a Rails + Apache2 + Postgres + Passenger application running in production mode in OSX Snow Leopard. The application serves as a data warehouse for another application in the cloud so I'm constantly getting API calls to my OSX production build. After a recent reboot, I'm finding a ton of httpd processes stacking up and eventually requiring an apache reboot. I haven't changed any settings, everything was running fine before. Any ideas on the best way to troubleshoot this? $ ps -ef|grep httpd 0 6203 1 0 0:00.20 ?? 0:00.47 /usr/sbin/httpd -D FOREGROUND 70 6222 6203 0 0:00.05 ?? 0:00.11 /usr/sbin/httpd -D FOREGROUND 70 6224 6203 0 0:00.31 ?? 0:00.50 /usr/sbin/httpd -D FOREGROUND 70 6233 6203 0 0:00.05 ?? 0:00.10 /usr/sbin/httpd -D FOREGROUND 70 6234 6203 0 0:00.43 ?? 0:00.64 /usr/sbin/httpd -D FOREGROUND 70 6243 6203 0 0:00.02 ?? 0:00.03 /usr/sbin/httpd -D FOREGROUND 70 6319 6203 0 0:00.08 ?? 0:00.16 /usr/sbin/httpd -D FOREGROUND 70 6334 6203 0 0:00.02 ?? 0:00.05 /usr/sbin/httpd -D FOREGROUND 70 6469 6203 0 0:00.04 ?? 0:00.08 /usr/sbin/httpd -D FOREGROUND 70 6487 6203 0 0:00.36 ?? 0:00.48 /usr/sbin/httpd -D FOREGROUND 70 6593 6203 0 0:00.36 ?? 0:00.48 /usr/sbin/httpd -D FOREGROUND 70 6709 6203 0 0:00.04 ?? 0:00.08 /usr/sbin/httpd -D FOREGROUND 70 6718 6203 0 0:00.04 ?? 0:00.10 /usr/sbin/httpd -D FOREGROUND 70 6834 6203 0 0:00.01 ?? 0:00.03 /usr/sbin/httpd -D FOREGROUND 70 6852 6203 0 0:00.00 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND 70 6853 6203 0 0:00.01 ?? 0:00.02 /usr/sbin/httpd -D FOREGROUND

    Read the article

  • Are these settings correct for sending mail through Rails/Gmail?

    - by aressidi
    Hi there, I spend a good deal of time building an email system for my Rails app that uses Gmail to send bulk mail to a list of opt-in users. I realize a shortcomming of using Google Apps for my mail, namely a rate limit on the number of emails it will send out (i believe 500). Anyway, I have reached out to my users to see how many have received the email, and a lot of them have not, though some have. The list I tried sending to was about 540 users, so I would have expected more "yes, got it," then "nope, still waiting" responses. I have two questions: Do these settings look correct for outgoing bulk mailing through Gmail? Again, using google apps to manage my domain and i know some people (including myself) have received the mailer. This is in a mail.rb initializer in my app. ActionMailer::Base.delivery_method = :sendmail ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 25, :domain => "mydomain.com", :authentication => :login, :user_name => "[email protected]", :password => "mypass" } Is there any way I can test if the mail was delivered, or at least attempted to be delivered? I can't tell where in the list the mailer stops mailing! The way I generate the list is through a query which then passes the user info to a mailer worker which sends the emails out via Starling/Workling. Any advice here would be useful. Happy to post code, but want to make sure the method I'm using is sound. Thanks for the help!

    Read the article

  • Help with creating a dropdown and other elements for a FAQ page with Ruby on Rails.

    - by AJ
    Hi, I'm new to rails and I'm trying to make a help page that just lists questions and answers. Currently I have something very simple like this : <% @helps.each do |help| %> <%=h help.category %> <%=h help.question %> <%=h help.answer %> <% end %> Along with each question and answer is a category they belong to. How do i create a dropdown that would let users list only the questions belonging to only one category? Secondly I would like to create a list of all the questions near the top of the page. The questions are actually links that when clicked bring you to the bottom of the page where the question/answer are. or when clicking on the link, it expands providing the answer underneath it, similar to facebooks help page. I think this would involve ajax, or java. It would be great if someone can point me in the right direction.

    Read the article

  • How to do HABTM management with auto completion in Rails?

    - by Andrei
    I am looking for a good solution for a probably typical problem of managing models with HABTM association in Rails. Let's assume that we have two models -- products and categories: Products has_many :categorizations has_many :categories, :through => :categorizations Categories has_many :categorizations has_many :products, :through => :categorizations Categorization belongs_to :product belongs_to :category Pat Shaughnessy is developing modified auto_complete plugin which can allow to manage one-to-many (and many-to-many) association: For someone that would be enough, but I don't really like so many text fields. I guess it is possible to combine the Ryan Bates' screencasts used by Pat in a slightly different way, namely, using one text field with autocomplete: Also it would be better to remove from the list of suggested tasks (one-to-many), or products|categories (many-to-many) those which have been already added. In the case of products-categories relationship, such auto completion would be used both in the form for product, and in the form for category. I hope that there is an existing plugin for that. I am not very experienced in Ruby, and don't really know how to implement such logic by myself. Any help is appreciated!

    Read the article

  • RSpec: Can't convert Image to String when using Nested Resource.

    - by darrint
    I'm having trouble with and RSpec view test. I'm using nested resources and the model with a belongs_to association. Here's what I have so far: describe "/images/edit.html.erb" do include ImagesHelper before(:each) do @image_pool = stub_model(ImagePool, :new_record => false, :base_path => '/') assigns[:image] = @image = stub_model(Image, :new_record? => false, :source_name => "value for source_name", :image_pool => @image_pool) end it "renders the edit image form" do render response.should have_tag("form[action=#{image_path(@image)}][method=post]") do with_tag('input#image_source_name[name=?]', "image[source_name]") end end end The error I'm receiving: ActionView::TemplateError in '/images/edit.html.erb renders the edit image form' can't convert Image into String On line #3 of app/views/images/edit.html.erb 1: <h1>Editing image</h1> 2: 3: <% form_for(@image) do |f| %> 4: <%= f.error_messages %> 5: 6: <p> app/views/images/edit.html.erb:3 /opt/dtcm/railstest/lib/ruby/gems/1.9.1/gems/rspec-rails-1.3.2/lib/spec/rails/extensions/action_view/base.rb:27:in `render_with_mock_proxy' /opt/dtcm/railstest/lib/ruby/gems/1.9.1/gems/rspec-rails-1.3.2/lib/spec/rails/example/view_example_group.rb:170:in `render' Looking at the rails code where the exception occurs is not very revealing. Any ideas on how I can narrow down what is going on here? One thing I tried was calling form_for directly from the example and I got a different error griping about lack of 'polymorphic_path' defined on Spec::Rails::Example::ViewExampleGroup::Subclass_4:0xblah. Not sure if that actually means anything.

    Read the article

  • How to :update after :success with link_to_remote Rails method?

    - by Kevin
    Hi, I'm trying to get two things done after a user clicks on a link: Delete a div Add another element at the bottom of the page I played with Rails link_to_remote and what I get with the code below is that the element is added before the div is deleted: <%= link_to_remote "&#x2713;", :url => { :controller => :movies, :action => :mark_as_seen, :movie => movie, :render => 'movie' }, :success => "Effect.Fade('movie_#{movie.id}_wrapper', { duration: 0.4 })", :update => "movies", :position => "bottom", :failure => "alert('Ooops! An error occurred.')" %> I tried to put :update and :position in a :complete callback, but nothing happened. And when I put both of them in the :success callback (after Effect.Fade), all I get is a parsing error. Any idea? Thanks, Kevin

    Read the article

  • How to avoid user keep trying login using Ruby on Rails?

    - by Tattat
    I want to create a login page, it can easy implement using Ruby on Rails. But the login is very simple, but I want more security. I want to stop the user keep trying the password. So, I have some ideas on that. First, stop login feature if the user keep trying the password for 15 mins. After the user login fail 5 times in 15 mins, the system should not allow the user login again in next 15 mins, ever his/her password is correct. Second, I want to add a human verification, after the user tried 5 times. After the user wait for 15 mins to login, I want to add an addition verification to the user. I want the user click the password, and the CAPTCHA image. If one of them is failed, they still can't login the system. He/She have 5 times to try, if he / she failed again, he/she need to want another 15 mins. Third, After the user tried 15 times, and still can't get into the system. I want to lock the user account, the user will receive an email, with a link to assign the password again. So, the question is "Is there any library to implement such authorization easily?" I know it can be implemented using code, but using library is much convenient. Also, I want to ask is there any security suggestion for that? thank u.

    Read the article

  • Rails: how to represent available view actions in a stateful model?

    - by Greg
    I have a model that is stateful. In each state there are a selection of actions that the user might want to perform on an instance of the model. Currently I am translating the model state to actions that get represented in the view using a view helper. Something like this... in the model: Class Thing def state_is_A? state == 'A' end end In the helper: def display_available_actions(thing) if thing.state_is_A? link_to <action1> link_to <action2> end end And in the view: <%= display_available_actions(@thing) %> I don't like the fact that the model state is translated into view actions in the helper. I would like this to be incorporated into the model. On the other hand, it doesn't seem healthy for the model and view to get so coupled. Is there a Ruby or Rails idiom that suits this kind of situation better than my approach? Should each state be a separate model perhaps?

    Read the article

  • Rails syntax for comments in templates: is this bug understood?

    - by brahn
    Using rails 2.3.2 I have a partial _foo.rhtml that begins with a comment as follows: <% # here is a comment %> <li><%= foo %></li> When I render the partial from a view in the traditional way, e.g. <% some_numbers = [1, 2, 3, 4, 5] %> <ul> <%= render :partial => "foo", :collection => some_numbers %> </ul> I found that the <li> and </li> tags are ommitted in the output -- i.e. the resulting HTML is <ul> 1 2 3 4 5 </ul> However, I can solve this problem by fixing _foo.rhtml to eliminate the space between the <% and the # so that the partial now reads: <%# here is a comment %> <li><%= foo %></li> My question: what's going on here? E.g., is <% # comment %> simply incorrect syntax for including comments in a template? Or is the problem more subtle? Thanks!

    Read the article

  • Why does Rails screw up timezones when I am editing a resource?

    - by DJTripleThreat
    Steps to produce this: prompt>rails test_app prompt>cd test_app prompt>script/generate scaffold date_test my_date:datetime prompt>rake db:migrate now edit your app/views/date_tests/edit.html.erb: <h1>Editing date_test</h1> <% form_for(@date_test) do |f| %> <%= f.error_messages %> <p> RIGHT!<br/> <%= text_field_tag @date_test, f.object.my_date %> </p> <p> WRONG!<br /> <%= f.text_field :my_date %> </p> <p> <%= f.submit 'Update' %> </p> <% end %> <%= link_to 'Show', @date_test %> | <%= link_to 'Back', date_tests_path %> now edit your config/environment.rb: #add this config.time_zone = 'Central Time (US & Canada)' This recreates the problem I am having in my actual app. The problem with my app is that I'm storing a date in a hidden field and rendering a "user friendly" version. Creating a resource works fine but as soon as I try to edit it the time changes (it adds the difference between my current time zone configuration and UTC). go to http://localhost:3000/date_tests/new and save the time then go to reedit it and you will have two different representations of the date/time one which will save incorrectly and the other that will.

    Read the article

< Previous Page | 135 136 137 138 139 140 141 142 143 144 145 146  | Next Page >