Re: app doesn't run on windows

2014-06-07 Thread Magnus Holm
Did you find a solution?

It's been a while since I've been testing Camping on Windows, so I'm not
quite sure how to set up SQLite properly.

// Magnus

On Friday, May 16, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
wrote:

 Note: the error is caused by not having sqlite setup properly in windows
 and I'm still struggeling:(

 The app itself is fine.

 regards
 seba


 2014-05-15 10:37 GMT+02:00 Sebastjan Hribar sebastjan.hri...@gmail.com
 javascript:_e(%7B%7D,'cvml','sebastjan.hri...@gmail.com');:

 Hi,

 I have problem running the app in windows. This is the app I've asked
 question about recently (the review app).

 It runs ok in my linux mint debian edition, but on windows it doesn't.
 First issue was with encoding. Even if I've set the meta charset it
 didn't work. Now I've also set the enocoding to the utf-8 in the .rb file
 itself and I don't get any more errors.

 But I do get this error:
  Camping Problem! / not found

 And that's it. No other info. The app is exactly the same as the one
 running in LMDE.

 Could this issue be related to the campging.db? I can't find it on
 windows. Is it possible tha camping is denied the access to the folder
 where it should be created?


 regards,

 seba




-- 

// Magnus Holm
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Re: first app - some questions

2014-06-07 Thread Magnus Holm
On Saturday, May 3, 2014, Sebastjan Hribar sebastjan.hri...@gmail.com
wrote:

  Hi guys,

 just a little feedback from a beginner. I've finished my first camping
 app. Thank you for your help and guidance.

 The finished app is about quality management and enables users to fill out
 forms. Based on those forms different quality parameters are recorded per
 user and per project. These can be called up in summary reports for desired
 time frame and user. Along with all the forms for a period the average
 quality evaluation is also displayed. Reports can only be generated by
 quality managers.

 I've managed to reuse only one html form for creating, viewing and
 editing. In addition, I've setup the form in such a way, that submitting is
 possible only when the form was called via »new« or »edit« route and the
 user has appropriate authorizations.

 I have one question regarding the session. I don't actually know how to
 leverage or use it. According to the reference the session adds states to
 the app. Can someone explain a bit more?


Sorry for the late reply.

Here's an example of state:

  module App::Controllers
class Index
  def get
if @state.user_id
  Welcome user number #{@state.user_id}
else
  render :login
end
  end

  class Login
def post
  # Just log everyone in. No passwords here!
  @state.user_id = @input.user_id
  redirect Index
end
 end
   end

  module App::Views
def login
  form action: R(Login), method: :post do
label do
  p User ID:
  input name: :user_id
end
button Log in
   end
 end
  end

Here's an example of the flow when the user visits the site:

1. User visits GET /. Index#get is called.
2. The state is empty, so the #login view is rendered
3. The user enters his user ID (let's say 5).
4. When the user presses Log in, the browser will do a POST /login with
user_id=5 as parameters
5. Login#post is invoked. This sets the state variable and then redirects
to /.
6. The user's browser then shows GET /. Now he gets a welcome message, not
the login form.

Notice how the same request is done in both step 1 and 6 (GET /), but the
second time the user gets a completely different page. That's because the
state is different.

You might know about cookies: sessions are like cookies that only the
server know how to set. It's impossible for the client to set its own
session; every session has to be set through the @state-variable in an
action.

I hope this clarifies state/sessions a bit. Don't hesitate to ask more if
you're confused.

// Magnus


-- 

// Magnus Holm
___
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list