Yeah, working with spree extensions can be confusing at first. I was
greatly helped by looking at other spree extensions
(http://spreecommerce.com/extensions).
Here's a couple suggestions I've copy and pasted a lot from.
- https://github.com/spree/spree-product-assembly
- https://github.com/spree/spree_social
- https://github.com/spree/spree_related_products
On Friday, July 5, 2013 4:47:13 AM UTC-6, obregon cornsnook wrote:
Thanks for your response. I've managed to get this part working and can
now use the extension db table in the rails console.
I need to use the rails console to add rows though, as per the tutorial, because there's not yet any views created to add data.
Now I don't see how to add views. The tutorial makes much of Deface but I don't understand which 'hook' I'm supposed to overwrite as my extension
should produce a view separate from the store. It's not a products page as such.
The routes file is ok, I just see a blank page when visiting the required url.
How do I create view such that they will follow the application layout but contain their own content?
Thanks for your response. I've managed to get this part working and can
now use the extension db table in the rails console.
I need to use the rails console to add rows though, as per the tutorial, because there's not yet any views created to add data.
Now I don't see how to add views. The tutorial makes much of Deface but I don't understand which 'hook' I'm supposed to overwrite as my extension
should produce a view separate from the store. It's not a products page as such.
The routes file is ok, I just see a blank page when visiting the required url.
How do I create view such that they will follow the application layout but contain their own content?
On Monday, June 24, 2013 2:48:40 PM UTC+1, Gregor MacDougall wrote:
The basic steps are:
1. Create the migration in your extension
2. Install an updated version of your extension in your application
3. run rake railties:install:migratiions from your application to
copy the migration from your extension to your application
4. run rake db:migrate from your application
That should create the table you require.
Any time you want to add rows to your table you should do so from your
application.
--
Gregor MacDougall
Sr. Software Developer @ FreeRunning Technologies (
http://www.freerunningtech.com/
)
The basic steps are:
1. Create the migration in your extension
2. Install an updated version of your extension in your application
3. run rake railties:install:migratiions from your application to
copy the migration from your extension to your application
4. run rake db:migrate from your application
That should create the table you require.
Any time you want to add rows to your table you should do so from your
application.
--
Gregor MacDougall
Sr. Software Developer @ FreeRunning Technologies (
http://www.freerunningtech.com/
)
On Sunday, June 23, 2013 3:34:31 PM UTC-7, obregon cornsnook wrote:
Hi all,
Can anyone please tell me how I create an extension that requires it's
own db table? Based on the extension tutorial at
http://guides.spreecommerce.com/developer/extensions_tutorial.html it
looks like I should create the migration in the spree store and it will be
run when I run the install generator. However, I don't see my new 'offers'
table in the db and my site page gives the following error:
NameError in Spree::HomeController#offers
uninitialized constant Spree::Offer
Also - I need to add a row to this table but do I run rails console from
the store directory, or from the extension directory? The tutorial is
unclear.
Thanks.
Hi all,
Can anyone please tell me how I create an extension that requires it's
own db table? Based on the extension tutorial at
http://guides.spreecommerce.com/developer/extensions_tutorial.html it
looks like I should create the migration in the spree store and it will be
run when I run the install generator. However, I don't see my new 'offers'
table in the db and my site page gives the following error:
NameError in Spree::HomeController#offers
uninitialized constant Spree::Offer
Also - I need to add a row to this table but do I run rails console from
the store directory, or from the extension directory? The tutorial is
unclear.
Thanks.