similar to: Add virtual attribute

Displaying 20 results from an estimated 20000 matches similar to: "Add virtual attribute"

2012 Oct 08
11
Problems setting gmail mail
Hello, as attachment my problems concerning gmail Mailer errors in Rails. I hope anyone can help me out with the problem? If there is extra information needed, please tell me what you need more to help me out of my problems! Greetings! Attachments: http://www.ruby-forum.com/attachment/7790/errnoECONNREFUSED.jpg -- Posted via http://www.ruby-forum.com/. -- You received this message
2013 Feb 03
4
Create a helper for models and views?
Hi! If I have a method that is useful in both models and in views, where would be the appropriate place to put it? The method in question just takes two dates as strings, tries to parse them and returns all dates in the range between them. It also takes care of the issues when the dates are badly formatted etc etc.. This method is being used in several models (so a simple class method in
2013 Jan 26
4
Best practice to handle this
Hi! I have a model which has a field that can have three values only. I store the value in the database as an integer, 0, 1 or 2, but when I display it I want a more appropriate text. And, I want it to be translatable using i18n. Let''s say that it corresponds to how difficult something is. So, 0 represents "Easy", 1 represents "Normal" and 2 represents
2011 Mar 19
5
Routing issue
Hi! I have two models, artists and songs. I have this in my route file: resources :artists, :path => "ackord" do resources :songs end Which gives me urls like this (I''m using https://github.com/norman/friendly_id to create and manage slugs): example.com/ackord/artistname/songs/songname-id Now I want to remove the /songs part to get a url like this:
2012 Jul 19
20
Rails' inflections are messy
Yesterday, I opened a GitHub Issue<https://github.com/rails/rails/pull/7071> about moving Rails inflections to an initializer. The idea wasn''t received well, understandably, as generating a large initializer with new Rails apps is pretty unappealing. However, the core members seemed open to the discussion of alternatives continuing here. For those of you not in the know,
2013 Apr 09
1
Help me bout gem 'acts_as_api' in RoR
I''m working with ''acts_as_api'' but I cant''t understand how it to do I try to find tutorial about it with a small project using gem ''acts_as_api'' but I''m afraid it is none. who can give me some advice to build small project use gem ''acts_as_api'' Thanks.......... -- Posted via http://www.ruby-forum.com/. -- You
2010 Mar 10
6
Email section
Sir , I want to implement email section in ma web application.. so i found the method ''server_setting'' for it... Following is the method: config.action_mailer.server_settings = { :address => "smtp.gmail.com" , :port => 25, :domain => "gmail.com" , :authentication => :login, :user_name => "manish" , :password =>
2013 Jun 30
1
Sidekiq on Heroku
Hi I want to use Sidekiq to run some jobs in the background. The jobs will be created by the whenever gem (or similar) which creates a Sidekiq worker at a specific time. This worker will in turn create a few hundred Sidekiq jobs. So, I''m using Heroku and wonder if I need to use a separate worker dyno for these jobs? Or can I use, for example, Unicorn to run Sidekiq "inside"
2013 Jan 29
2
Count entries in postgresql grouped by date
Hi! I have a table with visits with a visited_at: attribute which is a datetime field. They seem to be stored as UTC. Now I want to count all visits each day and return something like: { 2013-01-01: 8, 2013-01-02: 4, 2013-01-07: 9, ... } So, I did it like this which kind of works...: def self.total_grouped_by_day(start_date, end_date) visits = where(visited_at:
2013 Jul 09
5
whenever gem
Hello All, I want to schedule a mail every day. I used whenever gem. I added gem ''whenever'' in my gemfile. Then in the terminal I did - "whenever ." which created a schedule.rb. In schedule.rd I added this piece of code:- set :environment, "development" every 2.minutes do runner "UserMailer.some_method" end Does it get invoked
2013 Feb 28
2
Create polymorphic resources
Hi I have created a polymorphic association for comments since I need commenting functionality on several models. The issue is that when I create the comment in my Commets#create action, I really don''t know what type the parent is of. So, let''s say I have Foo, Bar and Comment. Comment have this: belongs_to :commentable, polymorphic: true And Foo and Bar both have:
2013 Jun 09
2
Minitest mock or stub methods
Hi I''m building a small library to use in my Rails app which interacts with a 3rd party API. It fetches artists and tracks. So I have: lib/my_lib.rb lib/my_lib/artist.rb lib/my_lib/track.rb To get an artist I do artist = MyLib::Artist.find("Oasis") Which returns an instance of Artist if it finds (via 3rd party API) it or nil otherwise. Then I can call artist.tracks which
2009 Dec 21
2
Multiple email recipients
I''m trying to call multiple email addresses from database. But dont know how to get the logic into the recipients field. #subscriptions_controller def deliver @subscription = Subscription.find(params[:id]) @users = @subscription.users @subscription_recipients = @users.find(:all).collect { |user| user.email } @subscription.deliver flash[:notice] = "Delivered
2012 Feb 14
6
SMTP problem.
Hey all, well I am trying to send emails to newly created users but I have a problem. In the rails log it states that the email has been sent but the email is never actually received so obviously there is a problem. I have noticed one in particular and I don''t understand how to fix it. Once I create the user I get the following error message: Net::SMTPAuthenticationError (535-5.7.1
2011 Aug 04
1
how to create a mailer
hi, i got a problem in creating a mailer using rails g mailer UserMailer .. used to send a mail to the user entered e mail-id ...in the form. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send
2013 Sep 11
2
Mandrill mail problem
Hello All, I am trying to use Mandrill api in my rails app. I am getting this error every time:- Net::SMTPServerBusy (401 4.1.7 Bad sender address syntax) I am using Ruby - 1.9.3, rails - 3.2.8, Thin server, & Ubuntu 12.10. in Gemfile:- gem "mandrill-api", "~> 1.0.45" gem ''mandrill_mailer'' application.rb:- config.action_mailer.default_url_options
2013 Feb 08
1
Problem with many to many relationship
Hi I''m trying to create a many to many relationship between two models. A User can be associated with many Incidents and vice versa. class User < ActiveRecord::Base include ActiveModel::ForbiddenAttributesProtection has_many :incident_participants, foreign_key: "participant_id" has_many :participated_incidents, through: :incident_participants end class Incident
2012 Jan 27
2
to_json performance
Originally posted on github, reported to the right place. I would like to open a discussion about how `to_json` and `as_json` operates in Rails from a performance standpoint. I''m using Rails 3.2 but this issue applies to almost all versions of Rails. Our use case presents the challenge in sending out potentially large JSON (or XML, but we''ll focus on JSON rendering here)
2011 Dec 12
1
Errno::ECONNREFUSED (Connection refused - connect(2)): sending email in production
I don''t know how to get more info about this issue on my remote server ( Linux/Debian6 - Qmail) localhost testing is fine , so my class UserMailer < ActionMailer::Base is rendering correctly the email ( checked in the development log) now, testing the remote SMTP server , via the production console, using : ActionMailer::Base.smtp_settings = {:address  =>
2006 Nov 09
4
Plotting symbols with two positions?
Thanks a lot to Demitris for a prompt answer some minutes ago on another tread (see below). To avoid excess mails on the list, I move onto next question: I have another small plotting problem that confuses me. I want to plot results from a field trial series, using the numbers of the trials as symbols in the plot. pch = as.character(trial_no) works fine, but truncates the trial number to the