I have a Ruby on Rails 3 news app. It takes a title, some content and an image attachment (using the paperclip gem). I'm using the RABL gem to provided a Sencha Architect project with a JSON feed.
The problem is Sencha Architect can't read the JSON url. When I try to load the data into the store I get a very unhelpful message saying 'Unable to load data using the supplied configuration' and a link to open the url in the browser (which opens just fine). Does Sencha Architect have a log somewhere that provides more information about this error?
Here are the RABL files:
# show.rabl
object @article
attributes :title, :body
node(:mobile_url) { |article| article.image.url(:mobile, false) }
node(:tablet_url) { |article| article.image.url(:tablet, false) }
node(:original_url) { |article| article.image.url(:original, false) }
# index.rabl
collection @articles
extends "articles/show"
RABL does not provide a content type by default so I have this in the articles controller:
before_filter :default_format_json
def default_format_json
if(request.headers["HTTP_ACCEPT"].nil? && params[:format].nil?)
request.format = "json"
end
end
This is the code generated by Architect to show the configuration options I have used:
# Stories store
Ext.define('MyApp.store.Stories', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.Story'
],
config: {
autoLoad: true,
model: 'MyApp.model.Story',
storeId: 'Stories',
proxy: {
type: 'jsonp',
url: 'https://feedr.org.uk/articles.json',
reader: {
type: 'json',
rootProperty: 'article'
}
}
}
});
# Story model
Ext.define('MyApp.model.Story', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'title'
},
{
name: 'body'
},
{
name: 'mobile_url'
},
{
name: 'tablet_url'
}
]
}
});
How can I get Sencha Architect to read my JSON data? Any help you can provide is much appreciated.