Monday 15 February 2010

ruby on rails 3.2 - mountable engine and modules. how to create lib files in an engine? -


I'm building an engine for an app that will use my company to do different things. My engine needs to use github_api gem to view and update the repository. When I can use gem with code in the controller (or model), then I put these methods in a module in the script folder I would like to, because I have to connect it to another API and not

but it seems that my engine does not like my module. It does not want to load the file, even when I specify it in the engine .rb file. I place the file inside the engine's Lib / module folder and it is included in the form of path.

My error is as follows: Crude continuous Myingin :: WelcomeController :: GithubPi

Like it will not load my files and when I try to get it, then I get errors and the server is not started.

engine.rb

  Module MyEngine class engine & lt; :: tracks :: engine isolate_namepace MyEngine config.autoload_paths & lt; & Lt; File.expand_path ("../ lib / modules /", __FILE__) End of End   

githubapi.rb

  Module Githubapi # List names Lists the dropdown-list # for the [string] repository name for the ultimate as the repository name as GitHub sees it get_repo_branches (repo_name) branch_names = Array.new git_connection = Github.new: oauth_token = & gt; ENV ['gothbognain'] branches = GIT_connection.psips Branches ('swami_name', repo_naya) branches. Branch | Branch_name & lt; & Lt; Branch.name end by branch_names.sort_by! {| M | M.downcase} Returns branch_names ending   

In order to see the method in the controller always returns results in errors

  @branches = Githubapi .get_repo_branches ('My_repo')   

Any help would be appreciated.

Is not it something that is using "add-on dependency" in the engine's gempeeck? is?

  Gems :: Specification. New work | [....] accessories [....] s.add_dependency "github_api" [....] stuff [....] end   

how do you indicate Your engine uses other gems.

No comments:

Post a Comment