[rails-oceania] RESTful interface instead of DB
All, We have a requirement to build a UI without a DB. Instead of a DB there is another RESTful interface. What are people's opinions on this? How would you actually do this in rails? Thanks, Justin -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
[rails-oceania] Re: Bootstrapping a Co-working Space (from home). Tips please!
Hi Chris, Feel free to look up @kamal on twitter. He's a really nice guy and runs the co working space I'm working at in Malaysia called Fluent Space. https://fluentspace.my - SengMing Tan, @sengming On Oct 30, 9:43 pm, chrisjacob i.chris.ja...@gmail.com wrote: Hi Nathan, Thank you for the reply and the invitation to pick your brain (gotta love the RoRo community - so helpful!). Basically any words of wisdom from your experiences... any got-cha's, and even common sense things - like, buy quality Coffee - keeps the dev's coming back for moore, or plan to buy a large conference table - not only does it give clients the impression of grandeur, but with a tiny net attached it converts into a kick ass table tennis table for lunch time ^_^ I'll give you a bit more info about the space / vision and see what you think... Firstly, it's located in Coffs Harbour, NSW (actually, Boambee East, a suburb 10 minutes south of the city center). The property (potentially my new home if we purchase)... Realestate.com:http://www.realestate.com.au/property-house-nsw-boambee+east-107222171 Google Maps:http://maps.google.com.au/maps?q=115+Linden+Avenue,+Boambee+East,+New... The office space is on the ground floor. It has: Independent entryhttp://images3.au.reastatic.net/800x600/props/107222171/ImageF/201103... Smallish Lounge / Kitchen (sink, bench, cabinets)http://images2.au.reastatic.net/800x600/props/107222171/ImageI/201103... 1 good sized bed room - with window view out to open empty land and poolhttp://images2.au.reastatic.net/800x600/props/107222171/ImageJ/201103... Shower Toilet Aircon and Ceiling fan's Pool and Outside deckhttp://images1.au.reastatic.net/800x600/props/107222171/m...@20featur...http://images1.au.reastatic.net/800x600/props/107222171/ImageQ/201103... There is also a games room - a converted double garage with polished cement flooring... but thinking of turning that into a Yoga Studio space - my wife's pet project if we buy the place ;-) ... will also have some gym equipment in there, which could be appealing to co- workers.http://images4.au.reastatic.net/800x600/props/107222171/ImageC/201105... Plenty of street parking. Also it's a busy/popular suburban street - so plenty of free advertising if I were to put up signage out the front. ... there are 2 other home business within 5 houses either side (hair salon + hair and day spa). IGA supermarket + bakery + chemist + news-agency + bottleshop within walking / bike ride distance. Thing's I think people might like: - Deep desks - Spare monitor to plug into - ADSL2+ (fastest I can get) - Discounted bulk Day pass system - likehttp://www.co-worka.com.au/desk-hire.html - Optional early / late access - PC, Mac, iPhone iPad - for device / browser testing - Shared book library - Sandwich-press, kettle, biscuits bar fridge - Deck with comfy lounging chairs - BBQ Fridays! - ... I may need to invest in a Wii small wall mounted tv for the boardroom (aka the I'm f-ing bored room ;-)) - Whiteboard - Gym / laundry / shower - Off street bike rack The biggest perk tho - as corny as this sounds - is getting to work around other people... Coffs Harbour has a very segregated tech design community ... which is my biggest challenge to setting this up. Thinking about testing the waters with a local classifieds ad; and count how many bites I get... I could also target the local University. At the end of the day I already work from home... so worse case senario is I end up with bunch of excess desk space... and a Nintendo Wii :-P Concerns: - Tax (could be really good and/or bad benefits here - really I just need to a tax agent to talk to) - Neighbours not liking extra cars parked on street (although there is empty land next to the house - so if cars park there then I don't see why people would care). - Whether I need council approval in some way - not sure if co-working hired desks is a looppole in the residential / commercial laws... it' certainly not your normal office space rental setup. - Security insurance - I don't really want anyone leaving expensive stuff on site, and me being liable for it. - Demand - build it and they will come is probably a bad approach - I should really research and network more before converting the space. There are a few people I know I can already talk to already. Also street signage, letterbox drops, and networking with local business uni should be a good/cheap start - small community, so hopefully word of mouth will kick in. I could also look to host tech meet-up's drinks - great ice breaker. - Pricing - finding the sweet-spot... affordability I think is a big factor in a regional area - particularly for people already setup in a home office paying no extra business rent. - Contracts - I want to keep things simple. Certainly no lockin's... but also want my arse covered. If you read even half of that then - THANK YOU -
Re: [rails-oceania] What am I doing wrong with the AR callbacks?
I'm not failiar with that factory notation but if your factory is like FactoryGirl and that :participation factory template uses a :user factory template internally for the association, then if it is like FactoryGirl it will do a create on the user even if you are doing build on the outer template. This is a bit of a stab in the dark since I'm not sure what you are using for factories and what is in your templates but I have been stung like this with factorygirl before. If your participation had a user and that user was already persisted then your callback won't go off… Sorry this might be hopelessly off track… Cheers, Adam On 31/10/2011, at 1:59 PM, Dmytrii Nagirniak wrote: Hi, I must have some stupid mistake or something. Just can't seem to pass the spec. Could you guys please help me find where the evil has hidden in the details? describe Participation do describe invitation by email, :focus do let(:participation) { build :participation } # Factory let(:email) { participation.email } it should send an invitation do # This one is failing binding.pry # The code below is executed here participation.should_receive(:invite_user!) participation.save! end context when user already exists do let!(:existing) { create :user, :email = email } it should not send an invitation do participation.should_not_receive(:invite_user!) participation.save! end end end end Can't see anything wrong with the callbacks: # Check the before_validation callback options: participation.user # nil participation.valid? # true participation.user # User{id: nil} # Check the before_create callback options: participation.user_exists? # false participation.mark_for_invitation # true # Check the after_create callback options: participation.marked_for_invitation? # true # After all this I expect the invite_user! to be called: participation.stub(:invite_user!) { puts Doesn't get called :( } participation.save! # = true, Nothing is printed, which is consistent with the spec participation.user_id # = 11, so the user has been saved The actual implementation is: class Participation ActiveRecord::Base attr_accessor :email belongs_to :user validates :email, :email = true, :on = :create, :if = :using_email? before_validation :set_user_by_email, :if = :using_email?, :on = :create before_create :mark_for_invitation, :unless = :user_exists? after_create :invite_user!,:if = :marked_for_invitation? def using_email? email.present? end def user_exists? user.present? and user.persisted? end def set_user_by_email self.user = User.find_by_email(email) self.user ||= User.new(email: email).tap do |u| u.status = :invited end end def mark_for_invitation @invite_user = true true # make sure not cancelling the callback chain end def marked_for_invitation? !!@invite_user end def invite_user! # TODO: Send the invitation email or something end end Can't spot the problem. Thanks in advance, Dima http://www.ApproachE.com -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
[rails-oceania] Re: RESTful interface instead of DB
Depending on how close that backend interface is to what Rails expects from it, you can either get a seamless integration with ActiveResource [1], or dig deeper and just build your model as ActiveModel, leveraging modules provided by Rails 3 to quickly add stuff like validations, and replacing persistence with your own code that talks to your backend. For example, using the latter approach I integrated recently with IIS and its SOAP interfaces, using them instead of a database as the backend for some models. Documentation for ActiveModel is quite lacking, though, so in my experience getting familiar with the relevant parts of Rails code will let you get it up and running much faster. [1] http://api.rubyonrails.org/classes/ActiveResource/Base.html -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
Re: [rails-oceania] RESTful interface instead of DB
Hi Justin In the past I have used either ActiveResource (if the restful interface conforms to the standards that ActiveResource expects) or the rest-client gem. One problem I have run into though is the problem of creating data to test against. Sometimes this isn't possible, especially in endpoints you dont control, or read-only endpoints. In these cases I used WebMock or FakeWeb to mock the needed responses from the end-point. This allows you to test the code on your side without testing the end-point itself. I hope this helps Chris On 31 October 2011 10:18, Justin Urbanski jus...@the-urbanskis.com wrote: All, We have a requirement to build a UI without a DB. Instead of a DB there is another RESTful interface. What are people's opinions on this? How would you actually do this in rails? Thanks, Justin -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
[rails-oceania] Reminder: rorosyd is on next Tuesday
Hi everyone, It's nearly time for rorosyd again, next Tuesday November 8, 6:30 for a 7pm start at the Trinity:http://tinyurl.com/6emfna So far we have just one presentation lined up: * Taking Parsing up a PEG, Rob Howard So, if you would like to share something, please put your name down at: https://github.com/rails-oceania/roro/wiki/rorosyd-topics and let me know. See you at rorosyd! Regards, Keith -- http://www.cockatoosoftware.com.au http://keithpitty.com T: +61 (0) 417 405 109 F: +61 (2) 4340 4203 -- You received this message because you are subscribed to the Google Groups Ruby or Rails Oceania group. To post to this group, send email to rails-oceania@googlegroups.com. To unsubscribe from this group, send email to rails-oceania+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.