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: %=
i recon your model relation should be like this:
*plan belongs_to airline*
if so you could do this on the view:
% @plans.each do |plan| %
Airline: %= *plan.airline.company* %
% end %
meanwhile in the plans_controller.rb:
*@plans = Plan.all*
hope this help
On Sun, Sep 23, 2012 at 4:25 PM,
Hello
I'm new to both ruby and rails and have problem getting any debug
information from the log. When i encounter an We're sorry, but
something went wrong message, i look in the log/development.log and
this is all i find:
Started GET /characters/7 for 127.0.0.1 at 2012-09-23 11:45:34 +0200
Thanks for your answer. It worked.
I have totally forgotten the convenience association methods.
Rails is great!
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email
hello,
Im still working on ruby koans.
Now I have to do some sandwhich code.
The exercise looks like this :
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
class AboutSandwichCode EdgeCase::Koan
def count_lines(file_name)
file = open(file_name)
count = 0
while
Btw I am using Rails 3.2.3.
I have checked that Rails.logger.level = 0 so it should be :debug. And
i'm also sure that i'm running in development mode. But still I just get
this one line telling me about an internal error wich doesnt help me a
bit.
--
Posted via http://www.ruby-forum.com/.
--
I feel like an idiot for not being able to figure this out, but here goes.
I use the 'ejs' gem to create ejs template files. My
assets/javascripts/foo.jst.ejs file is served up as
localhost:3000/assets/foo and assets/foo.js, but
localhost:3000/assets/foo.ejs gives a routing error. I have
I am not sure that this way is simple. I usually use for gem configuration
this code
require 'active_support/configurable'
module GemModule
include ActiveSupport::Configurable
class self
def setup
yield config
end
end
end
And then you can write
GemModule.setup do |config|
Class, Module and Object are instances of the Class class.
Class.class
= Class
Module.class
= Class
Object.class
= Class
Class inherits from Module, which inherits from Object
Class.superclass
= Module
Module.superclass
= Object
So, every instance of the Class class is_a?(Class) and
Removing columns from tables while running application with ActiveRecord
causes errors, because ActiveRecord caches column names.
Workaround for ActiveRecord up to 3.0.9 was to override #columns method in
the model and filter out deprecated column names before migration
(basically - hide
1) Very good. Now you should try to determine what Ruby on Rails is,
and whether your questions have anything to do with Ruby on Rails.
2) Read a tutorial on ruby exception handling, or better yet buy the
book Beginning Ruby:
http://beginningruby.org/
and read that before trying to do the
But I don't get the principle.
There is no such principle as the Sandwich principle. The principle is
Don't Repeat Yourself(DRY). So if you find yourself writing the same or
similar code over and over again, try to figure out a way to extract the
repeated part into a method. That way you
On Sunday, September 23, 2012 8:11:43 AM UTC-4, Ilia Bylich wrote:
I am not sure that this way is simple. I usually use for gem configuration
this code
require 'active_support/configurable'
module GemModule
include ActiveSupport::Configurable
class self
def setup
yield
Hi 7stud,
1) Did you try shutting your command window and opening a new one and
then typing rails --verson?
I did a couple of times, does the same even after a reboot.
2) Post the value of your PATH environment variable.
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program
I am getting error while creating new app. Here are the details :
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/rails.png
create
Update:
Seems like the right log level is set. But for som reason i dont see an
error message and a stacktrace when encountering an error. Is there more
configuration to be done or should this be enough to be able to see the
stacktrace?
--
Posted via http://www.ruby-forum.com/.
--
You
On Sun, Sep 23, 2012 at 12:41 PM, Subhransu M. li...@ruby-forum.com wrote:
I am getting error while creating new app. Here are the details :
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
Hassan Schroeder wrote in post #1077209:
On Sun, Sep 23, 2012 at 12:41 PM, Subhransu M. li...@ruby-forum.com
wrote:
I am getting error while creating new app. Here are the details :
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
/usr/bin/ruby1.8
On Sun, Sep 23, 2012 at 1:16 PM, Subhransu M. li...@ruby-forum.com wrote:
checking for sqlite3.h... no
sqlite3.h is missing.
Yes , But that does not help!
Well, the bottom line is the development libraries on whatever distro
you're using aren't there for sqlite3 -- you need to figure out how
hi,
I use mysql . is it possible to exclude sqlite , then how to ?
--
Posted via http://www.ruby-forum.com/.
--
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@googlegroups.com.
To
On Sun, Sep 23, 2012 at 2:08 PM, Subhransu M. li...@ruby-forum.com wrote:
I use mysql . is it possible to exclude sqlite , then how to ?
Of course. Rails lets you use the database of your choice.
Change your Gemfile (and your config/database.yml) appropriately.
--
Hassan Schroeder
documentation:
By default, all methods in Ruby classes are public - accessible by
anyone. There are, nonetheless, only two exceptions for this rule: the
global methods defined under the Object class, and the initialize
method for any class. Both of them are implicitly private.
class Object
I have a simple require call that is failing with:
ruby mycar.rb
/Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
`require': cannot load such file -- mycar/car (LoadError)
from
anybody?
On Saturday, September 22, 2012 5:38:27 PM UTC-7, wragen22 wrote:
Getting this issue...even though I have my views there in both the
projects and application. Also getting a routes issue No route matches
[GET] /projects when going to projects when I have root :to =
Hi. There is a typo, the correct is Module MyCar
and try doing this: require './mycar/car'
On Sun, Sep 23, 2012 at 6:29 PM, S Ahmed sahmed1...@gmail.com wrote:
I have a simple require call that is failing with:
ruby mycar.rb
Why doesn't mine work, very confused??
I've never seen that require in any gems on the web thought?
https://github.com/ryanb/cancan/blob/master/lib/cancan.rb
require 'cancan/ability'
require 'cancan/rule'
require 'cancan/controller_resource'
require 'cancan/controller_additions'
require
Ok that made it work, but still doesn't make sense to me, there must be
something else wrong in my environment right?
Also to reference the class, I still needed to prefix the module name which
is also strange because I am requiring it!
Example:
require './mycar/car'
MyCar::Car.new # this
If you're seeing the friendly Sorry message, then you may be in production
mode. I only ever see the sorry a problem occurred in production, the rest of
the time it's stack traces all around.
Walter
On Sep 23, 2012, at 3:57 PM, Daniel Sundqvist wrote:
Update:
Seems like the right log
Also to reference the class, I still needed to prefix the module name
which is also strange because I am requiring it!
Look up the difference between 'require' and 'include'.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google
I've never seen that require in any gems on the web
That's because most of the time when you require something, it is a gem,
and gems are installed in specific directories that ruby searches when
you require something. You can see a list of the directories ruby
searches when you require
1) Post the definition of private.
2) Execute this program:
puts 'hello'
3) What conclusions do you draw from that?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send
On Mon, Sep 24, 2012 at 7:08 AM, Subhransu M. li...@ruby-forum.com wrote:
hi,
I use mysql . is it possible to exclude sqlite , then how to ?
you can use the -d option to pass the database you want to use.
additionally, you can use
rails new -h to show all options available to you. That
That's because most of the time when you require something, it is a gem,
and gems are installed in specific directories that ruby searches when
you require something. You can see a list of the directories ruby
searches when you require something by doing this:
p $LOAD_PATH
7Stud was very
I see what your saying.
I guess what I am asking then is, when developing your own gem, say I am
developing my gem on my Mac in:
/Users/me/projects/ruby/gem/some_gem_name/
So this means I have to somehow modify my load_path so that I can just
require things like:
require 'folder/file'
And
On Sun, Sep 23, 2012 at 7:46 PM, S Ahmed sahmed1...@gmail.com wrote:
I see what your saying.
I guess what I am asking then is, when developing your own gem, say I am
developing my gem on my Mac in:
/Users/me/projects/ruby/gem/some_gem_name/
So this means I have to somehow modify my
So I have a few models that need to be created, but only based on a few
inputs. There is no need for nested attributes, in fact I would rather
avoid this.
The way I have been doing it is like so
class WidgetsController ApplicationController
def create
respond_to do |format|
if
36 matches
Mail list logo