I'm using spree and created a new payment gateway extension. The problem is, my newly created payment gateway gets created first before the core payment gateway of spree. Here's the error message.
doesn't exist: SHOW FIELDS FROM gateway_options
I've had the same problem. Basically, there's a way to define the order in which extensions are loaded but not when their migrations are ran.
config.extensions = [:all, :site]
More info here.
The way I do it, is simply by renaming the "db" folder of the extensions' migrations needing to be ran later. When the others have ran, I rename it back to its original name and run the migrations again. Dirty, but it works.
There could probably be a way to make a rake task and automate this.
Related
I want to use in my project ckeditor with active storage, but when I generate to install ckeditor using orm active record and active storage, it create an initializer but not create any migration file.
Running via Spring preloader in process 23128
create config/initializers/ckeditor.rb
route mount Ckeditor::Engine => '/ckeditor'
Could not find "active_record/active_storage/ckeditor/asset.rb" in
any of your source paths. Your current source paths are:
/home/arif/Development/Test
Project/cable_test/lib/templates/ckeditor/install
/home/arif/.rvm/gems/ruby-2.4.2/gems/ckeditor-
4.1.3/lib/generators/ckeditor/templates
So I ran into this as well, and after poking around the code I figured I'd just run the generator without the flags like the docs. If you run into this problem just run the generator with no flags rails g ckeditor:install. Also, you'll need to look at these files and make sure your models match.
https://github.com/galetahub/ckeditor/tree/master/lib/generators/ckeditor/templates/active_record/active_storage/ckeditor
EDIT: It looks like active_storage is only available on the master branch as of this post.
I had an existing table named boss_name and I would like to create a rails model for it.
I used "rails generate bossname" to created the model and added the
self.table_name = "boss_name"
inside the class.
After the model had been successfully generated, I tried to start up rails console and trying to query the table.
Bossname.first give me the first value from boss_name table without problem.
rails console worked fine but when I'm running rspec for bossname_spec.rb, I had error which say "Bossname(Table doesn't exist)".
I hope anyone can tell me why it work for rails console and doesn't work for the application. Any hint on how to make it work on the application too is really appreciated.
That indicates that the boss_name table exists in your development database, but not in your test database. You can copy your current development database schema into your test database like this:
rake db:schema:dump
RAILS_ENV=test rake db:setup
I'm trying to add a module to Magento, which attaches an observer to the sales_order_invoice_register event, but having trouble getting it to work.
I have a small script that just does the following:
require_once('app/Mage.php');
Mage::app();
Mage::dispatchEvent('sales_order_invoice_register');
When I execute that script from the command line in the root of the Magento installation, the observers method is triggered as expected, so I think everything is correctly configured with the module (within the global section of my modules config.xml).
However, when I create an order and then ship and invoice it from the admin pages, I can see the event gets dispatched but the observer does not get triggered. This seems to be because the getEventConfig() method of Config.php when it looks up $_eventAreas['global'] does not contain the entry I added in my own config.xml (nor any other entry for the sales_order_invoice_register event). Does anyone have any ideas how this could occur, and what to do to fix it ?
Sorry, am going to answer my own question.
Had been looking at it for a couple of hours, just writing it out above made me notice something more emphatically. How could it work when running from the command line and not through apache ? Configuration had to be fine, unfortunately file ownership was not. I was running from the command line with my own user, not the web service user. I had created the module config files with my own user rather than with the web service user. Therefore for the web service process when scanning the module directories, my new module config would have been invisible causing it not to be loaded. I just chowned the files to the web service user and it worked immediately.
I need to create a gem, for my own use, that substitutes the current 'libnotify' gem as I find it unusable to have my testing notifications queued one after the other. I'll use dbus-send to create the notifications, and get their ID. Now I need some way of storing this ID between each code run so that I can retrieve it when a new notification is created and replace the notification instead of queuing a new one.
So how and where do I store this temporary data with my gem? All it needs is a simple scratch file, but it's not one I can delete after use. What would the best practise be for this?
One common idiom is to use an hidden folder in your home directory.
~/.mygem/data
I recently just started to migrate over a CI application to Amazon's EC2 service. To test I set up a micro instance of ubuntu and a LAMP stack. PHP, MySQL, HTTPD are all working beautifully. The one issue i'm having now is that when I run my application I receive an error saying that my helpers won't load. The helpers in particular that aren't loading are the ones in subdirectories in the helpers directory ie: /var/www/system/application/helpers/subdirectory/foo_helper.php
The helpers are being autoloaded and in my autoload.php config file they are written like:
$autoload['helper'] = array('subdirectory/foo', 'foo2',...);
Has anyone run into this issue, or have any pointers on where I could go look in my configuration to resolve this?
Thanks for the help!
I'd try debugging the helper function of the Loader class, in particular these lines :
system/libraries/Loader.php
elseif (file_exists(APPPATH.'helpers/'.$helper.EXT))
{
include_once(APPPATH.'helpers/'.$helper.EXT);
}
This is the code that will be hit when including application helpers. Check what path CodeIgniter is trying to include. Double check that the path exists - everyone makes typos now and again ;-)
I think the issue is that when I moved from Windows to Linux I forgot to take into account that linux is case-sensitive. So now I need to go through and rename my files and folders.
But this still doesn't solve the issue where it seems like the page is being cached and I'm not able to refresh and see my changes. Is there any way to force the page to grab a fresh copy from the server on every refresh?