Giter Site home page Giter Site logo

Rails g not working about instiki HOT 9 OPEN

parasew avatar parasew commented on June 20, 2024
Rails g not working

from instiki.

Comments (9)

distler avatar distler commented on June 20, 2024

script/generate

from instiki.

Tamenze avatar Tamenze commented on June 20, 2024

Hmm, doesn't seem to work. When I run script/generate model User I get back the following error message:
/Users/tamenze/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- script/../config/environment (LoadError) from /Users/tamenze/.rvm/rubies/ruby-2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from script/generate:2:in <main>'

Line 2 of script/generate says require File.dirname(__FILE__) + '/../config/environment'. In my script folder, I don't have a config folder, is that the issue?

from instiki.

Tamenze avatar Tamenze commented on June 20, 2024

Update (different errors): I found this guide with more info on the script/generate command and added the . before it to make it .script/generate, which now gets me to a different error which I'm working through.

from instiki.

distler avatar distler commented on June 20, 2024

See this commit. Not all of the generators are working yet. (In particular, model still seems to be broken.)

from instiki.

distler avatar distler commented on June 20, 2024

This should complete the fix. Let me know if there are further problems.

from instiki.

Tamenze avatar Tamenze commented on June 20, 2024

Thank you! The problem I'm encountering now is outside the scope of script/generate, but if you have any advice I'd love to hear it.

There's still an error when I run script/generate, but it's because I added an initializer to the app (I'm trying to install Google Omni Auth). The error message in the console is telling me:
/instiki/config/initializers/omniauth.rb:3:in <top (required)>': undefined method application' for Rails:Module (NoMethodError).

The relevant line in omniauth.rb: Rails.application.config.middleware.use OmniAuth::Builder do
So now I'm looking into the methods that do exist for Rails:Module to try and find an alternate way of writing it (and i'm using Rails 4.2.6. and Ruby 2.3 btw).


To be clear, this^ came after I received a different error, with pry-rails when trying to generate the model: `/Users/tamenze/.rvm/gems/ruby-2.3.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'pry-rails'. (Bundler::GemRequireError) Gem Load Error is: uninitialized constant Rails::Railtie`

from instiki.

Tamenze avatar Tamenze commented on June 20, 2024

Still working on this problem, commented out the OmniAuth block in omniauth.rb to see what would happen. The User model generates, but without any fieldnames when I pass them in. ie: /script/generate model User provider uid name email oauth_token oauth_expires_at:datetime creates a migration that only has:

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.timestamps
    end
  end

  def self.down
    drop_table :users
  end
end

When I added column names and types manually in the migration file, and then migrated, table was not added to the Schema. So there's a few problems in this path of working, I'll continue digging into them this week, but just an update in case anyone else has dealt with this or has some insight that could point me in the right direction.

from instiki.

Tamenze avatar Tamenze commented on June 20, 2024

@distler is this built on Rails 2? Can I run it on Rails 4?

from instiki.

distler avatar distler commented on June 20, 2024

The app is built on Rails 2. Converting to Rails 4 (or 5) would be a big task.

from instiki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.