Errors with no DB
Hi,
I'm just starting with RubyMine, I'm also new to Ruby and RoR.
I'm building a web site without a database as it's going to consume services rather than a database backend directly. I've initially configured the new application as per this post of SO http://stackoverflow.com/questions/3954307/rails-3-how-do-i-avoid-database-altogether
I've created a model for my application as per this method using ActiveModel http://railscasts.com/episodes/219-active-model however when I run a code inspection on the class:
class PlotBase
include ActiveModel::Validations
include ActiveModel::Conversion
extend ActiveModel::Naming
attr_accessor :id, :xCoor, :xCoor, :notes
validates_presence_of :id
validates_presence_of :xCoor
validates_presence_of :yCoor
def initialize(attributes = {})
attributes.each do |name, value|
send("#{name}=", value)
end
end
def persisted?
false
end
end
RubyMine is reporting a number of errors on the class but it's falls in line with the structure contained in the RailCast demo (and as per the full source for the same demo). The errors include:
- Cannot find variable with given name
Unless I also include:
def self.id
# code here
end
It also reports:
- DB field ':id' of undefined table for class 'PlotBase' or unable to find Rails Model association with name ':id'
Which I was assuming that the persisted method denotes this isn't a model linked to a corresponding database table.
I must be missing something obvious as I'm a complete noob so any pointers on the class structure would also be appreciated.
Thanks,
James
请先登录再写评论。
Hi James,
this looks like a bug for me, please file a bug in our tracker (http://youtrack.jetbrains.com/issues/RUBY)
Regards, Oleg.
Hi Oleg,
Logged in YouTrack item number RUBY-12105
I didn't know if I should assign a subsystem of Parser or not so left it blank and at normal priority.
That said this is extremely annoying if you are developing a database free project which must hit a decent sized portion of the userbase? Services and APIs are booming!
Cheers,
Jam
Thank you for the bug.
I believe its subsystem is "Inspections"
Oleg.
Makes complete sense! :)