I have created a default rails app. I am beginner to spree.
I am not able to find the code for the pages which are coming by default in the spree app.
This is how I have created the app
gem install rails -v 4.2.2
gem install bundler
gem install spree_cmd
rails _4.2.2_ new mystore
cd mystore
spree install --auto-accept
When I go to http://localhost:3000/t/categories/bags I get all the categories for this category.
But in my view I do not see any code. So from where are these coming from?
Please help.
it is coming from spree gems, you can see the front end code by opening the gem file in your editor by following. (you need to set you environment variables EDITOR or BUNDLER_EDITOR)
bundle open spree_frontend
or else you can do in terminal
bundle show spree_frontend
open 'path above something like /Users/xyz/.rvm/gems/ruby-2.2.3/gems/spree_frontend-3.0.8'
These pages come from within the Spree gem, which adds routes and views. Have a poke around and see what you find here: https://github.com/spree/spree/tree/master/core/app
It runs as a Rails engine, so read up on how that works here if you want to know how the gem adds routes: http://guides.rubyonrails.org/engines.html
See rails request/response log to find the rendered partials path in a request.
Also you may find http://guides.spreecommerce.com/developer/view.html helpful.
Related
I am building a new RoR app and i had tried to create a new model like below.
rails generate model Pic title:string description:text
But I keep on getting these errors always and I tried installing many methods like installing gems ,updated the gems etc.
P.S : I am trying install the older version of the gems. Is that creating a problem?
But none of it gave me the results. Please help me with this.
P.P.S : I am an absolute beginner to ruby. So please help me by giving solution with good reason. Thanks in Advance.
Hi seems like you have issues with your simple_form gem,try to remove from gem file and add gem 'simple_form' and run bundle install after this step run rails generate simple_form:install for creating config file for simple form.
Try this it may help you out.
As #Navneet pointed out generating a config file can also be used for configuration and it also works pretty well.
Another thing i found was , Here the gems used were older version. That created a compatibility issue(since it was not configured accordingly). So by replacing the gems with current version or stable ones , you can get rid of this problem.
Go to rubygems.org
Search for the gems and check whether its the latest version
If not, Replace the line of corresponding gem in Gemfile with newest one.
sorry if this questions are too simple. Just started to learn Ruby on Rails and Spree ecommerce.
Successfully installed the demo store according the the instructions here: https://github.com/spree/spree , however, I don't quite understand how the source codes at the Github are linked to the sources codes on the Ruby on Rails spree ecommerce store. The directories are pretty different from each other. For example, spree source codes have "/API", "/backend", "/core", etc... while the ruby on rails spree ecommerce store has "/app", "/bin", "/config", etc...
I know the ruby on rails auto generates some codes. But how the two correlated with each other? Say, some codes at Spree ecommerce are updated, what to do to update the Spree store?
thank you very much!
You should read more about how Gem, Bundler and Engine works.
The Spree framework is a gem that works as an engine with each part(API, backend, frontend, core) separated in their own directories like a separated gem, just for better organization. Used to be all inside the Spree gem back in the day.
Your Rails app, the one with the 'app/', 'bin/' and 'config/' directories, is the true application, when you install/add Spree in your app it will be mounted alongside with your Rails app and will provide all the e-commerce platform.
In short when your add a gem into your Gemfile, the gem will be downloaded to your local system in the bundle install part. Rails will load the files from the gems listed on your Gemfile and everything will be good and accessible, automagically for you.
To update the gem spree you would have to use the bundle update spree command and the bundler will take care of updating the files.
To customize your Spree code, you can start to learn how in their guide.
I added "gem 'kaminari'" to my gemfile and ran bundle per the instructions, and it looked like it installed, but I'm getting errors like 'current_page' method not found messages. The documentation indicates that there should be a kaminari directory created in my app/views directory, but there isn't one. I'm using rails 3.0.7. Is there a different/better way of installing this gem?
Thanks
Could you have forgotten to run the generator?
rails g kaminari:views default
That should create your kaminari directory.
I am newbie to Ruby on Rails and I would like to install "Spreecommerce". Could I have some help on doing this? I don't know where to start. Any help will be highly appreciable, thanks!
You are talking about Spreecommerce. Next time, try to add a link to the project/gem/plugin you are talking about.
Install the gem, on the command line like this:
gem install spree
Or, go to the Gemfile of your project and add the following line:
gem 'spree'
Then type this in the command line:
bundle install
Then, go to the official github page and read the documentation of this gem to get more information about it and how to use it. There is also this official getting started page that you need to read.
I'm trying to run this method which should work according to this:
ActiveSupport::TimeZone.new("whatever",3600)
but this initializer doesn't exist.
So I would like to look at the sources for my Rails version (2.3.4) to see if it's private or if I'm missing the point completely (the one-argument constructor works).
And suddenly I realize that I have no idea where to find the docs for my version nor the API. I use api.rubyonrails.org constantly (linked from here), but I'm not even sure what version it refers to (2.3.2, the 'current' version?). How can I get the API docs for my installation? How can I view the SOURCE for my Rails version? Can I view it in my Rails installation (either OSX or Ubuntu)? Online?
If the version were vendored (it's not), how would that affect my question?
Check out http://github.com/makandra/aegis/tree/master for a local gem documentation server. Even simpler is the gem server command. Both give documentation for installed versions of gems.
Also, sometimes gem install skips generating RDoc documentation; use gem rdoc --all to create docs for all installed gems. The docs are saved to /your-ruby-path/lib/ruby/gems/1.8/docs, by the way.
The source for all gems is at /your-ruby-path/lib/ruby/gems/1.8/gems, that includes both Rails and ActiveSupport, which are actually two separate gems.
There are several ways to get at your docs, the easiest being with a frozen rails gem. If you don't want to freeze it for some reason you can create a dummy rails app, freeze rails, and gen the docs:
rails dummy_app
rake rails:freeze:gems
rake doc:rails
rake rails:unfreeze
You can also generate docs for plugins you have installed. Try rake -T doc.
Freezing your rails gem has the added benefit that the code is right there for you to browse, but you can always go to wherever your gems get installed on your system. On MacOS this could be either ~/.gems, /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems, or maybe other?