Phlip wrote:
>> :tag_name.to_sym
>>
>> but :tag_name is not a variable...
>>     
>
> I noticed that just after posting, but fixing it didn't help.
>
>   
I didn't think it would solve your problems. merb-fixtures hasn't been 
updated since last summer.

If you are just going to use fixtures to generate static data, just use 
givens:

given "a post" do
  Post.create(:title => "a new post")
end

describe Post, :given => "a post" do
  it "should do something" do
    Post.first.title.should == "a new post"
  end
end

This is one reason why traditional fixtures aren't always used in merb 
testing. I like using dm-sweatshop because it frees me from having to 
come up with fake data, it just randomly generates what I want. Other 
then that I have no reason for using fixtures.
>>> And about datamapper, what if I did this?
>>>
>>>     merb-gen model post_too --orm datamapper
>>>
>>> Now all I'd need to do is read post_too.rb to see how datamapper works, 
>>> then 
>>> port that over to post.rb and toss post_too.rb. Right?
>>>
>>> Wrong! All that generated was a post_too_spec.rb, demanding I specify a 
>>> non-existent PostToo!
>>>   
>>>       
>> I don't think it is possible to mix ORMs like you are trying, you 
>> probably have to change the ORM in config/init.rb first. I'm not 100% on 
>> this one.
>>     
>
> Did you read my post? (I'm not trying to mix ORMs, BTW, I was just trying to 
> generate sample code to look at.)
>
> I am reporting a bug - admittedly on the wrong channels - that merb-gen did 
> not 
> create a model .rb.
>
>   
First of all, don't get smart with the guys trying to help you. Of 
course I freakin' read your post.

Read config/init.rb

What ORM is it set to? Sequel

What ORM are you using with merb-gen? Datamapper

Thats a mix. It was just a hint of a possible direction to try and fix 
your issue.

I just tried a quick test. I made a new merb app using sequel, made a 
post model with sequel, then made a post_too model with datamapper. No 
problem, so I can't reproduce your problem with a fresh app.

If you still want to go in that direction though, this is the contents 
of post_too.rb:

class PostToo
  include DataMapper::Resource
  property :id, Serial
end

So you are not missing out on much.
>> This will cause more problems for you though, as the controllers and 
>> views (at the very least) will all have to be updated to use datamapper 
>> instead of sequel as well. As simple as this merb app is, it would 
>> probably be less work to start fresh.
>>     
>
> Parenthetically, is mixing ORMs always high-risk? I had suspected that only 
> 'merb-gen model' accepted the --orm argument exactly so you could do that...
>
>   
You really need to read the rdocs on the different ORMs, at least the 
introductory readme files to see that they are used differently. They 
all expose a very different public api. It is like taking a rails app, 
dropping it into merb and expecting it to work. They are both web 
frameworks, but that doesn't mean they work the same way. As I noted 
above, I was able to use merb-gen to create models of 2 different ORMs, 
so you can do that. The problem that I was stating that in a pre 
existing app that is written for one ORM will not work if you just 
change the models.
>> It looks like the main issue is you are attempting to learn merb through 
>> updating someone elses code, and more specifically, trying to write 
>> tests for code you do not understand. I would highly recommend starting 
>> a fresh merb app using datamapper unless you are really familiar with 
>> SQL and want to have more flexibility you can use sequel. I just had a 
>> quick look back at your previous posts, and you mention you use Rails as 
>> your day job, so I'd really recommend you use activerecord if you are 
>> having difficulties with datamapper or sequel, as it is something you 
>> are already familiar with, and you can use fixture frameworks that are 
>> designed for activerecord as well.
>>     
>
> Your concern is noted, but if all the blogs keep saying that all this stuff 
> is 
> so danged easy and flexible, then..
Yes, it is easy and flexible. That means that you will find many apps 
that are not written the way you want due to the ease of that 
flexibility. If you find that is a disadvantage, you can either stick 
with the recommended tools (like datamapper and rspec) or use a more 
opinionated framework like Rails (which you are familiar with already).

Derek

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to